| Differences between
and this patch
- a/Source/JavaScriptCore/ChangeLog +18 lines
Lines 1-3 a/Source/JavaScriptCore/ChangeLog_sec1
1
2011-04-22  Xan Lopez  <xlopez@igalia.com>
2
3
        Reviewed by NOBODY (OOPS!).
4
5
        Colliding isinf/isnan between C99 and C++0x with GCC 4.6.0
6
        https://bugs.webkit.org/show_bug.cgi?id=59249
7
8
        Don't use "using namespace std;" in files where isnan or isinf are
9
        used, since it can lead to ambiguity in C++0x compilers. See the
10
        bug for more details.
11
12
        * bytecompiler/BytecodeGenerator.cpp: drop "using namespace std;"
13
        (JSC::BytecodeGenerator::BytecodeGenerator): use std:: prefix explictly.
14
        (JSC::BytecodeGenerator::newRegister): ditto.
15
        * wtf/MathExtras.h: do not import isnan and isinf into the global
16
        namespace with GCC in C++0x mode, since it will collide with the
17
        C99 functions.
18
1
2011-04-22  Patrick Gansterer  <paroga@webkit.org>
19
2011-04-22  Patrick Gansterer  <paroga@webkit.org>
2
20
3
        Unreviewed. Build fix for ENABLE(INTERPRETER) after r84556.
21
        Unreviewed. Build fix for ENABLE(INTERPRETER) after r84556.
- a/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp -4 / +2 lines
Lines 36-43 a/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp_sec1
36
#include "ScopeChain.h"
36
#include "ScopeChain.h"
37
#include "UString.h"
37
#include "UString.h"
38
38
39
using namespace std;
40
41
namespace JSC {
39
namespace JSC {
42
40
43
/*
41
/*
Lines 267-273 BytecodeGenerator::BytecodeGenerator(ProgramNode* programNode, ScopeChainNode* s a/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp_sec2
267
            
265
            
268
            if (entry.isNull())
266
            if (entry.isNull())
269
                newGlobals.add(function->ident().impl());
267
                newGlobals.add(function->ident().impl());
270
            functionInfo[i] = make_pair(entry.getIndex(), entry.isReadOnly());
268
            functionInfo[i] = std::make_pair(entry.getIndex(), entry.isReadOnly());
271
        }
269
        }
272
        
270
        
273
        Vector<bool, 16> shouldCreateVar(varStack.size());
271
        Vector<bool, 16> shouldCreateVar(varStack.size());
Lines 636-642 bool BytecodeGenerator::isLocalConstant(const Identifier& ident) a/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp_sec3
636
RegisterID* BytecodeGenerator::newRegister()
634
RegisterID* BytecodeGenerator::newRegister()
637
{
635
{
638
    m_calleeRegisters.append(m_calleeRegisters.size());
636
    m_calleeRegisters.append(m_calleeRegisters.size());
639
    m_codeBlock->m_numCalleeRegisters = max<int>(m_codeBlock->m_numCalleeRegisters, m_calleeRegisters.size());
637
    m_codeBlock->m_numCalleeRegisters = std::max<int>(m_codeBlock->m_numCalleeRegisters, m_calleeRegisters.size());
640
    return &m_calleeRegisters.last();
638
    return &m_calleeRegisters.last();
641
}
639
}
642
640
- a/Source/JavaScriptCore/wtf/MathExtras.h +2 lines
Lines 240-247 inline int clampToInteger(unsigned value) a/Source/JavaScriptCore/wtf/MathExtras.h_sec1
240
240
241
#if !COMPILER(MSVC) && !(COMPILER(RVCT) && PLATFORM(BREWMP)) && !OS(SOLARIS) && !OS(SYMBIAN)
241
#if !COMPILER(MSVC) && !(COMPILER(RVCT) && PLATFORM(BREWMP)) && !OS(SOLARIS) && !OS(SYMBIAN)
242
using std::isfinite;
242
using std::isfinite;
243
#ifndef __GXX_EXPERIMENTAL_CXX0X__
243
using std::isinf;
244
using std::isinf;
244
using std::isnan;
245
using std::isnan;
246
#endif
245
using std::signbit;
247
using std::signbit;
246
#endif
248
#endif
247
249
- a/Source/WebCore/ChangeLog +23 lines
Lines 1-3 a/Source/WebCore/ChangeLog_sec1
1
2011-04-22  Xan Lopez  <xlopez@igalia.com>
2
3
        Reviewed by NOBODY (OOPS!).
4
5
        Colliding isinf/isnan between C99 and C++0x with GCC 4.6.0
6
        https://bugs.webkit.org/show_bug.cgi?id=59249
7
8
        Don't use "using namespace std;" in files where isnan or isinf are
9
        used, since it can lead to ambiguity in C++0x compilers. See the
10
        bug for more details.
11
12
        * html/HTMLInputElement.cpp: drop "using namespace std;"
13
        (WebCore::HTMLInputElement::applyStep): use std:: prefix explictly.
14
        (WebCore::HTMLInputElement::stepUpFromRenderer): ditto.
15
        * html/NumberInputType.cpp:
16
        (WebCore::NumberInputType::valueAsNumber): drop "using namespace std;"
17
        (WebCore::NumberInputType::setValueAsNumber): use std:: prefix explicitly.
18
        (WebCore::NumberInputType::rangeUnderflow): ditto.
19
        (WebCore::NumberInputType::rangeOverflow): ditto.
20
        (WebCore::NumberInputType::minimum): ditto.
21
        (WebCore::NumberInputType::maximum): ditto.
22
        (WebCore::NumberInputType::visibleValue): ditto.
23
1
2011-04-22  Dan Bernstein  <mitz@apple.com>
24
2011-04-22  Dan Bernstein  <mitz@apple.com>
2
25
3
        Reviewed by Sam Weinig.
26
        Reviewed by Sam Weinig.
- a/Source/WebCore/html/HTMLInputElement.cpp -6 / +4 lines
Lines 54-61 a/Source/WebCore/html/HTMLInputElement.cpp_sec1
54
#include <wtf/MathExtras.h>
54
#include <wtf/MathExtras.h>
55
#include <wtf/StdLibExtras.h>
55
#include <wtf/StdLibExtras.h>
56
56
57
using namespace std;
58
59
namespace WebCore {
57
namespace WebCore {
60
58
61
using namespace HTMLNames;
59
using namespace HTMLNames;
Lines 325-331 void HTMLInputElement::applyStep(double count, ExceptionCode& ec) a/Source/WebCore/html/HTMLInputElement.cpp_sec2
325
        ec = INVALID_STATE_ERR;
323
        ec = INVALID_STATE_ERR;
326
        return;
324
        return;
327
    }
325
    }
328
    const double nan = numeric_limits<double>::quiet_NaN();
326
    const double nan = std::numeric_limits<double>::quiet_NaN();
329
    double current = m_inputType->parseToDoubleWithDecimalPlaces(value(), nan, &currentDecimalPlaces);
327
    double current = m_inputType->parseToDoubleWithDecimalPlaces(value(), nan, &currentDecimalPlaces);
330
    if (!isfinite(current)) {
328
    if (!isfinite(current)) {
331
        ec = INVALID_STATE_ERR;
329
        ec = INVALID_STATE_ERR;
Lines 345-351 void HTMLInputElement::applyStep(double count, ExceptionCode& ec) a/Source/WebCore/html/HTMLInputElement.cpp_sec3
345
        newValue = m_inputType->minimum();
343
        newValue = m_inputType->minimum();
346
    unsigned baseDecimalPlaces;
344
    unsigned baseDecimalPlaces;
347
    double base = m_inputType->stepBaseWithDecimalPlaces(&baseDecimalPlaces);
345
    double base = m_inputType->stepBaseWithDecimalPlaces(&baseDecimalPlaces);
348
    baseDecimalPlaces = min(baseDecimalPlaces, 16u);
346
    baseDecimalPlaces = std::min(baseDecimalPlaces, 16u);
349
    if (newValue < pow(10.0, 21.0)) {
347
    if (newValue < pow(10.0, 21.0)) {
350
      if (stepMismatch(value())) {
348
      if (stepMismatch(value())) {
351
            double scale = pow(10.0, static_cast<double>(max(stepDecimalPlaces, currentDecimalPlaces)));
349
            double scale = pow(10.0, static_cast<double>(max(stepDecimalPlaces, currentDecimalPlaces)));
Lines 1380-1386 void HTMLInputElement::stepUpFromRenderer(int n) a/Source/WebCore/html/HTMLInputElement.cpp_sec4
1380
    else if (!getAllowedValueStepWithDecimalPlaces(&step, &stepDecimalPlaces))
1378
    else if (!getAllowedValueStepWithDecimalPlaces(&step, &stepDecimalPlaces))
1381
        return;
1379
        return;
1382
    base = m_inputType->stepBaseWithDecimalPlaces(&baseDecimalPlaces);
1380
    base = m_inputType->stepBaseWithDecimalPlaces(&baseDecimalPlaces);
1383
    baseDecimalPlaces = min(baseDecimalPlaces, 16u);
1381
    baseDecimalPlaces = std::min(baseDecimalPlaces, 16u);
1384
1382
1385
    int sign;
1383
    int sign;
1386
    if (step > 0)
1384
    if (step > 0)
Lines 1390-1396 void HTMLInputElement::stepUpFromRenderer(int n) a/Source/WebCore/html/HTMLInputElement.cpp_sec5
1390
    else
1388
    else
1391
        sign = 0;
1389
        sign = 0;
1392
1390
1393
    const double nan = numeric_limits<double>::quiet_NaN();
1391
    const double nan = std::numeric_limits<double>::quiet_NaN();
1394
    String currentStringValue = value();
1392
    String currentStringValue = value();
1395
    double current = m_inputType->parseToDouble(currentStringValue, nan);
1393
    double current = m_inputType->parseToDouble(currentStringValue, nan);
1396
    if (!isfinite(current)) {
1394
    if (!isfinite(current)) {
- a/Source/WebCore/html/NumberInputType.cpp -10 / +8 lines
Lines 48-54 a/Source/WebCore/html/NumberInputType.cpp_sec1
48
namespace WebCore {
48
namespace WebCore {
49
49
50
using namespace HTMLNames;
50
using namespace HTMLNames;
51
using namespace std;
52
51
53
static const double numberDefaultStep = 1.0;
52
static const double numberDefaultStep = 1.0;
54
static const double numberStepScaleFactor = 1.0;
53
static const double numberStepScaleFactor = 1.0;
Lines 65-80 const AtomicString& NumberInputType::formControlType() const a/Source/WebCore/html/NumberInputType.cpp_sec2
65
64
66
double NumberInputType::valueAsNumber() const
65
double NumberInputType::valueAsNumber() const
67
{
66
{
68
    return parseToDouble(element()->value(), numeric_limits<double>::quiet_NaN());
67
    return parseToDouble(element()->value(), std::numeric_limits<double>::quiet_NaN());
69
}
68
}
70
69
71
void NumberInputType::setValueAsNumber(double newValue, ExceptionCode& ec) const
70
void NumberInputType::setValueAsNumber(double newValue, ExceptionCode& ec) const
72
{
71
{
73
    if (newValue < -numeric_limits<float>::max()) {
72
    if (newValue < -std::numeric_limits<float>::max()) {
74
        ec = INVALID_STATE_ERR;
73
        ec = INVALID_STATE_ERR;
75
        return;
74
        return;
76
    }
75
    }
77
    if (newValue > numeric_limits<float>::max()) {
76
    if (newValue > std::numeric_limits<float>::max()) {
78
        ec = INVALID_STATE_ERR;
77
        ec = INVALID_STATE_ERR;
79
        return;
78
        return;
80
    }
79
    }
Lines 94-107 bool NumberInputType::typeMismatch() const a/Source/WebCore/html/NumberInputType.cpp_sec3
94
93
95
bool NumberInputType::rangeUnderflow(const String& value) const
94
bool NumberInputType::rangeUnderflow(const String& value) const
96
{
95
{
97
    const double nan = numeric_limits<double>::quiet_NaN();
96
    const double nan = std::numeric_limits<double>::quiet_NaN();
98
    double doubleValue = parseToDouble(value, nan);
97
    double doubleValue = parseToDouble(value, nan);
99
    return isfinite(doubleValue) && doubleValue < minimum();
98
    return isfinite(doubleValue) && doubleValue < minimum();
100
}
99
}
101
100
102
bool NumberInputType::rangeOverflow(const String& value) const
101
bool NumberInputType::rangeOverflow(const String& value) const
103
{
102
{
104
    const double nan = numeric_limits<double>::quiet_NaN();
103
    const double nan = std::numeric_limits<double>::quiet_NaN();
105
    double doubleValue = parseToDouble(value, nan);
104
    double doubleValue = parseToDouble(value, nan);
106
    return isfinite(doubleValue) && doubleValue > maximum();
105
    return isfinite(doubleValue) && doubleValue > maximum();
107
}
106
}
Lines 113-124 bool NumberInputType::supportsRangeLimitation() const a/Source/WebCore/html/NumberInputType.cpp_sec4
113
112
114
double NumberInputType::minimum() const
113
double NumberInputType::minimum() const
115
{
114
{
116
    return parseToDouble(element()->fastGetAttribute(minAttr), -numeric_limits<float>::max());
115
    return parseToDouble(element()->fastGetAttribute(minAttr), -std::numeric_limits<float>::max());
117
}
116
}
118
117
119
double NumberInputType::maximum() const
118
double NumberInputType::maximum() const
120
{
119
{
121
    return parseToDouble(element()->fastGetAttribute(maxAttr), numeric_limits<float>::max());
120
    return parseToDouble(element()->fastGetAttribute(maxAttr), std::numeric_limits<float>::max());
122
}
121
}
123
122
124
bool NumberInputType::stepMismatch(const String& value, double step) const
123
bool NumberInputType::stepMismatch(const String& value, double step) const
Lines 222-228 String NumberInputType::visibleValue() const a/Source/WebCore/html/NumberInputType.cpp_sec5
222
    String currentValue = element()->value();
221
    String currentValue = element()->value();
223
    if (currentValue.isEmpty())
222
    if (currentValue.isEmpty())
224
        return currentValue;
223
        return currentValue;
225
    double doubleValue = numeric_limits<double>::quiet_NaN();
224
    double doubleValue = std::numeric_limits<double>::quiet_NaN();
226
    unsigned decimalPlace;
225
    unsigned decimalPlace;
227
    parseToDoubleForNumberTypeWithDecimalPlaces(currentValue, &doubleValue, &decimalPlace);
226
    parseToDoubleForNumberTypeWithDecimalPlaces(currentValue, &doubleValue, &decimalPlace);
228
    String localized = formatLocalizedNumber(doubleValue, decimalPlace);
227
    String localized = formatLocalizedNumber(doubleValue, decimalPlace);
229
- 

Return to Bug 59249