Changeset 173911 in webkit
- Timestamp:
- Sep 24, 2014 2:14:32 AM (10 years ago)
- Location:
- trunk
- Files:
-
- 3 deleted
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r173910 r173911 1 2014-09-24 Commit Queue <commit-queue@webkit.org> 2 3 Unreviewed, rolling out r173839. 4 https://bugs.webkit.org/show_bug.cgi?id=137062 5 6 NumberConstruct should no longer use static tables (Requested 7 by dpino on #webkit). 8 9 Reverted changeset: 10 11 "Simple ES6 feature: Number constructor extras" 12 https://bugs.webkit.org/show_bug.cgi?id=131707 13 http://trac.webkit.org/changeset/173839 14 1 15 2014-09-24 Benjamin Poulain <bpoulain@apple.com> 2 16 -
trunk/LayoutTests/js/Object-getOwnPropertyNames-expected.txt
r173839 r173911 51 51 PASS getSortedOwnPropertyNames(Boolean) is ['length', 'name', 'prototype'] 52 52 PASS getSortedOwnPropertyNames(Boolean.prototype) is ['constructor', 'toString', 'valueOf'] 53 PASS getSortedOwnPropertyNames(Number) is [' EPSILON', 'MAX_SAFE_INTEGER', 'MAX_VALUE', 'MIN_SAFE_INTEGER', 'MIN_VALUE', 'NEGATIVE_INFINITY', 'NaN', 'POSITIVE_INFINITY', 'isFinite', 'isInteger', 'isNaN', 'isSafeInteger', 'length', 'name', 'parseFloat', 'parseInt', 'prototype']53 PASS getSortedOwnPropertyNames(Number) is ['MAX_VALUE', 'MIN_VALUE', 'NEGATIVE_INFINITY', 'NaN', 'POSITIVE_INFINITY', 'length', 'name', 'prototype'] 54 54 PASS getSortedOwnPropertyNames(Number.prototype) is ['clz', 'constructor', 'toExponential', 'toFixed', 'toLocaleString', 'toPrecision', 'toString', 'valueOf'] 55 55 PASS getSortedOwnPropertyNames(Date) is ['UTC', 'length', 'name', 'now', 'parse', 'prototype'] -
trunk/LayoutTests/js/script-tests/Object-getOwnPropertyNames.js
r173839 r173911 59 59 "Boolean": "['length', 'name', 'prototype']", 60 60 "Boolean.prototype": "['constructor', 'toString', 'valueOf']", 61 "Number": "[' EPSILON', 'MAX_SAFE_INTEGER', 'MAX_VALUE', 'MIN_SAFE_INTEGER', 'MIN_VALUE', 'NEGATIVE_INFINITY', 'NaN', 'POSITIVE_INFINITY', 'isFinite', 'isInteger', 'isNaN', 'isSafeInteger', 'length', 'name', 'parseFloat', 'parseInt', 'prototype']",61 "Number": "['MAX_VALUE', 'MIN_VALUE', 'NEGATIVE_INFINITY', 'NaN', 'POSITIVE_INFINITY', 'length', 'name', 'prototype']", 62 62 "Number.prototype": "['clz', 'constructor', 'toExponential', 'toFixed', 'toLocaleString', 'toPrecision', 'toString', 'valueOf']", 63 63 "Date": "['UTC', 'length', 'name', 'now', 'parse', 'prototype']", -
trunk/Source/JavaScriptCore/ChangeLog
r173896 r173911 1 2014-09-24 Commit Queue <commit-queue@webkit.org> 2 3 Unreviewed, rolling out r173839. 4 https://bugs.webkit.org/show_bug.cgi?id=137062 5 6 NumberConstruct should no longer use static tables (Requested 7 by dpino on #webkit). 8 9 Reverted changeset: 10 11 "Simple ES6 feature: Number constructor extras" 12 https://bugs.webkit.org/show_bug.cgi?id=131707 13 http://trac.webkit.org/changeset/173839 14 1 15 2014-09-23 Mark Lam <mark.lam@apple.com> 2 16 -
trunk/Source/JavaScriptCore/runtime/CommonIdentifiers.h
r173839 r173911 119 119 macro(instructionCount) \ 120 120 macro(isArray) \ 121 macro(isFinite) \122 macro(isInteger) \123 macro(isNaN) \124 121 macro(isPrototypeOf) \ 125 macro(isSafeInteger) \126 122 macro(isView) \ 127 123 macro(isWatchpoint) \ … … 145 141 macro(osrExits) \ 146 142 macro(parse) \ 147 macro(parseFloat) \148 macro(parseInt) \149 143 macro(postMessage) \ 150 144 macro(profiledBytecodes) \ -
trunk/Source/JavaScriptCore/runtime/NumberConstructor.cpp
r173839 r173911 27 27 #include "NumberPrototype.h" 28 28 #include "JSCInlines.h" 29 #include "JSGlobalObjectFunctions.h"30 29 31 30 namespace JSC { 32 31 33 static EncodedJSValue numberConstructorEpsilonValue(ExecState*, JSObject*, EncodedJSValue, PropertyName);34 32 static EncodedJSValue numberConstructorNaNValue(ExecState*, JSObject*, EncodedJSValue, PropertyName); 35 33 static EncodedJSValue numberConstructorNegInfinity(ExecState*, JSObject*, EncodedJSValue, PropertyName); … … 37 35 static EncodedJSValue numberConstructorMaxValue(ExecState*, JSObject*, EncodedJSValue, PropertyName); 38 36 static EncodedJSValue numberConstructorMinValue(ExecState*, JSObject*, EncodedJSValue, PropertyName); 39 static EncodedJSValue numberConstructorMaxSafeInteger(ExecState*, JSObject*, EncodedJSValue, PropertyName);40 static EncodedJSValue numberConstructorMinSafeInteger(ExecState*, JSObject*, EncodedJSValue, PropertyName);41 static EncodedJSValue JSC_HOST_CALL numberConstructorFuncIsFinite(ExecState*);42 static EncodedJSValue JSC_HOST_CALL numberConstructorFuncIsInteger(ExecState*);43 static EncodedJSValue JSC_HOST_CALL numberConstructorFuncIsNaN(ExecState*);44 static EncodedJSValue JSC_HOST_CALL numberConstructorFuncIsSafeInteger(ExecState*);45 37 46 38 } // namespace JSC … … 56 48 /* Source for NumberConstructor.lut.h 57 49 @begin numberConstructorTable 58 EPSILON numberConstructorEpsilonValue DontEnum|DontDelete|ReadOnly 59 NaN numberConstructorNaNValue DontEnum|DontDelete|ReadOnly 60 NEGATIVE_INFINITY numberConstructorNegInfinity DontEnum|DontDelete|ReadOnly 61 POSITIVE_INFINITY numberConstructorPosInfinity DontEnum|DontDelete|ReadOnly 62 MAX_VALUE numberConstructorMaxValue DontEnum|DontDelete|ReadOnly 63 MIN_VALUE numberConstructorMinValue DontEnum|DontDelete|ReadOnly 64 MAX_SAFE_INTEGER numberConstructorMaxSafeInteger DontEnum|DontDelete|ReadOnly 65 MIN_SAFE_INTEGER numberConstructorMinSafeInteger DontEnum|DontDelete|ReadOnly 66 isFinite numberConstructorFuncIsFinite DontEnum|Function 1 67 isInteger numberConstructorFuncIsInteger DontEnum|Function 1 68 isNaN numberConstructorFuncIsNaN DontEnum|Function 1 69 isSafeInteger numberConstructorFuncIsSafeInteger DontEnum|Function 1 70 parseFloat globalFuncParseFloat DontEnum|Function 1 71 parseInt globalFuncParseInt DontEnum|Function 2 50 NaN numberConstructorNaNValue DontEnum|DontDelete|ReadOnly 51 NEGATIVE_INFINITY numberConstructorNegInfinity DontEnum|DontDelete|ReadOnly 52 POSITIVE_INFINITY numberConstructorPosInfinity DontEnum|DontDelete|ReadOnly 53 MAX_VALUE numberConstructorMaxValue DontEnum|DontDelete|ReadOnly 54 MIN_VALUE numberConstructorMinValue DontEnum|DontDelete|ReadOnly 72 55 @end 73 56 */ … … 92 75 bool NumberConstructor::getOwnPropertySlot(JSObject* object, ExecState* exec, PropertyName propertyName, PropertySlot& slot) 93 76 { 94 if (isFunction(exec->vm(), propertyName.uid())) { 95 return getStaticFunctionSlot<InternalFunction>(exec, numberConstructorTable, 96 jsCast<NumberConstructor*>(object), propertyName, slot); 97 } 98 return getStaticValueSlot<NumberConstructor, InternalFunction>(exec, numberConstructorTable, 99 jsCast<NumberConstructor*>(object), propertyName, slot); 77 return getStaticValueSlot<NumberConstructor, InternalFunction>(exec, numberConstructorTable, jsCast<NumberConstructor*>(object), propertyName, slot); 100 78 } 101 79 102 bool ALWAYS_INLINE NumberConstructor::isFunction(VM& vm, AtomicStringImpl* propertyName)103 {104 return propertyName == vm.propertyNames->isFinite105 || propertyName == vm.propertyNames->isInteger106 || propertyName == vm.propertyNames->isNaN107 || propertyName == vm.propertyNames->isSafeInteger108 || propertyName == vm.propertyNames->parseFloat109 || propertyName == vm.propertyNames->parseInt;110 }111 112 // ECMA-262 20.1.2.1113 static EncodedJSValue numberConstructorEpsilonValue(ExecState*, JSObject*, EncodedJSValue, PropertyName)114 {115 return JSValue::encode(jsDoubleNumber((std::numeric_limits<double>::epsilon())));116 }117 118 // ECMA-262 20.1.2.8119 80 static EncodedJSValue numberConstructorNaNValue(ExecState*, JSObject*, EncodedJSValue, PropertyName) 120 81 { … … 122 83 } 123 84 124 // ECMA-262 20.1.2.9125 85 static EncodedJSValue numberConstructorNegInfinity(ExecState*, JSObject*, EncodedJSValue, PropertyName) 126 86 { 127 return JSValue::encode(js DoubleNumber(-std::numeric_limits<double>::infinity()));87 return JSValue::encode(jsNumber(-std::numeric_limits<double>::infinity())); 128 88 } 129 89 130 // ECMA-262 20.1.2.14131 90 static EncodedJSValue numberConstructorPosInfinity(ExecState*, JSObject*, EncodedJSValue, PropertyName) 132 91 { 133 return JSValue::encode(js DoubleNumber(std::numeric_limits<double>::infinity()));92 return JSValue::encode(jsNumber(std::numeric_limits<double>::infinity())); 134 93 } 135 94 136 // ECMA-262 20.1.2.7137 95 static EncodedJSValue numberConstructorMaxValue(ExecState*, JSObject*, EncodedJSValue, PropertyName) 138 96 { 139 return JSValue::encode(js DoubleNumber(1.7976931348623157E+308));97 return JSValue::encode(jsNumber(1.7976931348623157E+308)); 140 98 } 141 99 142 // ECMA-262 20.1.2.11143 100 static EncodedJSValue numberConstructorMinValue(ExecState*, JSObject*, EncodedJSValue, PropertyName) 144 101 { 145 return JSValue::encode(jsDoubleNumber(5E-324)); 146 } 147 148 // ECMA-262 20.1.2.6 149 static EncodedJSValue numberConstructorMaxSafeInteger(ExecState*, JSObject*, EncodedJSValue, PropertyName) 150 { 151 return JSValue::encode(jsDoubleNumber(9007199254740991.0)); 152 } 153 154 // ECMA-262 20.1.2.7 155 static EncodedJSValue numberConstructorMinSafeInteger(ExecState*, JSObject*, EncodedJSValue, PropertyName) 156 { 157 return JSValue::encode(jsDoubleNumber(-9007199254740991.0)); 102 return JSValue::encode(jsNumber(5E-324)); 158 103 } 159 104 … … 185 130 } 186 131 187 // ECMA-262 20.1.2.2188 static EncodedJSValue JSC_HOST_CALL numberConstructorFuncIsFinite(ExecState* exec)189 {190 JSValue argument = exec->argument(0);191 return JSValue::encode(jsBoolean(argument.isNumber() && (argument.isInt32() || std::isfinite(argument.asDouble()))));192 }193 194 // ECMA-262 20.1.2.3195 static EncodedJSValue JSC_HOST_CALL numberConstructorFuncIsInteger(ExecState* exec)196 {197 JSValue argument = exec->argument(0);198 bool isInteger;199 if (argument.isInt32())200 isInteger = true;201 else if (!argument.isDouble())202 isInteger = false;203 else {204 double number = argument.asDouble();205 isInteger = std::isfinite(number) && trunc(number) == number;206 }207 return JSValue::encode(jsBoolean(isInteger));208 }209 210 // ECMA-262 20.1.2.4211 static EncodedJSValue JSC_HOST_CALL numberConstructorFuncIsNaN(ExecState* exec)212 {213 JSValue argument = exec->argument(0);214 return JSValue::encode(jsBoolean(argument.isDouble() && std::isnan(argument.asDouble())));215 }216 217 // ECMA-262 20.1.2.5218 static EncodedJSValue JSC_HOST_CALL numberConstructorFuncIsSafeInteger(ExecState* exec)219 {220 JSValue argument = exec->argument(0);221 bool isInteger;222 if (argument.isInt32())223 isInteger = true;224 else if (!argument.isDouble())225 isInteger = false;226 else {227 double number = argument.asDouble();228 isInteger = trunc(number) == number && std::abs(number) <= 9007199254740991.0;229 }230 return JSValue::encode(jsBoolean(isInteger));231 }232 233 132 } // namespace JSC -
trunk/Source/JavaScriptCore/runtime/NumberConstructor.h
r173839 r173911 59 59 static ConstructType getConstructData(JSCell*, ConstructData&); 60 60 static CallType getCallData(JSCell*, CallData&); 61 static bool isFunction(VM&, AtomicStringImpl* propertyName);62 61 }; 63 62
Note: See TracChangeset
for help on using the changeset viewer.