Changeset 36977 in webkit for trunk/JavaScriptCore/kjs/NumberConstructor.cpp
- Timestamp:
- Sep 26, 2008, 7:36:15 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/kjs/NumberConstructor.cpp
r36726 r36977 22 22 #include "config.h" 23 23 #include "NumberConstructor.h" 24 #include "NumberConstructor.lut.h"25 24 26 25 #include "NumberObject.h" … … 31 30 ASSERT_CLASS_FITS_IN_CELL(NumberConstructor); 32 31 32 static JSValue* numberConstructorNaNValue(ExecState*, const Identifier&, const PropertySlot&); 33 static JSValue* numberConstructorNegInfinity(ExecState*, const Identifier&, const PropertySlot&); 34 static JSValue* numberConstructorPosInfinity(ExecState*, const Identifier&, const PropertySlot&); 35 static JSValue* numberConstructorMaxValue(ExecState*, const Identifier&, const PropertySlot&); 36 static JSValue* numberConstructorMinValue(ExecState*, const Identifier&, const PropertySlot&); 37 38 } // namespace JSC 39 40 #include "NumberConstructor.lut.h" 41 42 namespace JSC { 43 33 44 const ClassInfo NumberConstructor::info = { "Function", &InternalFunction::info, 0, ExecState::numberTable }; 34 45 35 /* Source for Number Object.lut.h46 /* Source for NumberConstructor.lut.h 36 47 @begin numberTable 37 NaN NumberConstructor::NaNValue DontEnum|DontDelete|ReadOnly38 NEGATIVE_INFINITY NumberConstructor::NegInfinity DontEnum|DontDelete|ReadOnly39 POSITIVE_INFINITY NumberConstructor::PosInfinity DontEnum|DontDelete|ReadOnly40 MAX_VALUE NumberConstructor::MaxValue DontEnum|DontDelete|ReadOnly41 MIN_VALUE NumberConstructor::MinValue DontEnum|DontDelete|ReadOnly48 NaN numberConstructorNaNValue DontEnum|DontDelete|ReadOnly 49 NEGATIVE_INFINITY numberConstructorNegInfinity DontEnum|DontDelete|ReadOnly 50 POSITIVE_INFINITY numberConstructorPosInfinity DontEnum|DontDelete|ReadOnly 51 MAX_VALUE numberConstructorMaxValue DontEnum|DontDelete|ReadOnly 52 MIN_VALUE numberConstructorMinValue DontEnum|DontDelete|ReadOnly 42 53 @end 43 54 */ 55 44 56 NumberConstructor::NumberConstructor(ExecState* exec, PassRefPtr<StructureID> structure, NumberPrototype* numberPrototype) 45 57 : InternalFunction(exec, structure, Identifier(exec, numberPrototype->info.className)) … … 57 69 } 58 70 59 JSValue* NumberConstructor::getValueProperty(ExecState* exec, int token) const71 JSValue* numberConstructorNaNValue(ExecState* exec, const Identifier&, const PropertySlot&) 60 72 { 61 // ECMA 15.7.3 62 switch (token) { 63 case NaNValue: 64 return jsNaN(exec); 65 case NegInfinity: 66 return jsNumberCell(exec, -Inf); 67 case PosInfinity: 68 return jsNumberCell(exec, Inf); 69 case MaxValue: 70 return jsNumberCell(exec, 1.7976931348623157E+308); 71 case MinValue: 72 return jsNumberCell(exec, 5E-324); 73 } 74 ASSERT_NOT_REACHED(); 75 return jsNull(); 73 return jsNaN(exec); 74 } 75 76 JSValue* numberConstructorNegInfinity(ExecState* exec, const Identifier&, const PropertySlot&) 77 { 78 return jsNumberCell(exec, -Inf); 79 } 80 81 JSValue* numberConstructorPosInfinity(ExecState* exec, const Identifier&, const PropertySlot&) 82 { 83 return jsNumberCell(exec, Inf); 84 } 85 86 JSValue* numberConstructorMaxValue(ExecState* exec, const Identifier&, const PropertySlot&) 87 { 88 return jsNumberCell(exec, 1.7976931348623157E+308); 89 } 90 91 JSValue* numberConstructorMinValue(ExecState* exec, const Identifier&, const PropertySlot&) 92 { 93 return jsNumberCell(exec, 5E-324); 76 94 } 77 95
Note:
See TracChangeset
for help on using the changeset viewer.