Changeset 47404 in webkit
- Timestamp:
- Aug 17, 2009 6:00:12 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/ChangeLog
r47392 r47404 1 2009-08-17 Oliver Hunt <oliver@apple.com> 2 3 RS=Mark Rowe. 4 5 REGRESSION (r47292): Prototype.js is broken by ES5 Arguments changes 6 https://bugs.webkit.org/show_bug.cgi?id=28341 7 <rdar://problem/7145615> 8 9 Reverting r47292. Alas Prototype.js breaks with Arguments inheriting 10 from Array as ES5 attempted. Prototype.js defines $A in terms of a 11 function it places on (among other global objects) the Array prototype, 12 thus breaking $A for arrays. 13 14 * runtime/Arguments.h: 15 (JSC::Arguments::Arguments): 16 * runtime/JSGlobalObject.cpp: 17 (JSC::JSGlobalObject::reset): 18 (JSC::JSGlobalObject::markChildren): 19 * runtime/JSGlobalObject.h: 20 (JSC::JSGlobalObject::JSGlobalObjectData::JSGlobalObjectData): 21 * runtime/ObjectPrototype.cpp: 22 (JSC::ObjectPrototype::ObjectPrototype): 23 * runtime/ObjectPrototype.h: 24 * tests/mozilla/ecma_3/Function/arguments-001.js: 25 1 26 2009-08-17 Peter Kasting <pkasting@google.com> 2 27 -
trunk/JavaScriptCore/runtime/Arguments.h
r47330 r47404 101 101 102 102 void init(CallFrame*); 103 void initializeStandardProperties(CallFrame*);104 103 105 104 OwnPtr<ArgumentsData> d; … … 135 134 , d(new ArgumentsData) 136 135 { 137 initializeStandardProperties(callFrame);138 136 JSFunction* callee; 139 137 ptrdiff_t firstParameterIndex; … … 174 172 { 175 173 ASSERT(!callFrame->callee()->body()->parameterCount()); 176 177 initializeStandardProperties(callFrame); 174 178 175 unsigned numArguments = callFrame->argumentCount() - 1; 179 176 … … 243 240 } 244 241 245 246 inline void Arguments::initializeStandardProperties(CallFrame* callFrame)247 {248 putDirectFunction(callFrame->propertyNames().constructor, callFrame->lexicalGlobalObject()->objectConstructor(), DontEnum);249 putDirectFunction(callFrame->propertyNames().toString, callFrame->lexicalGlobalObject()->objectToStringFunction(), DontEnum);250 putDirectFunction(callFrame->propertyNames().toLocaleString, callFrame->lexicalGlobalObject()->objectToLocaleStringFunction(), DontEnum);251 }252 242 253 243 } // namespace JSC -
trunk/JavaScriptCore/runtime/JSGlobalObject.cpp
r47304 r47404 211 211 d()->callFunction = callFunction; 212 212 d()->applyFunction = applyFunction; 213 NativeFunctionWrapper* objectToStringFunction = 0; 214 NativeFunctionWrapper* objectToLocaleStringFunction = 0; 215 d()->objectPrototype = new (exec) ObjectPrototype(exec, ObjectPrototype::createStructure(jsNull()), d()->prototypeFunctionStructure.get(), &objectToStringFunction, &objectToLocaleStringFunction); 216 d()->objectToStringFunction = objectToStringFunction; 217 d()->objectToLocaleStringFunction = objectToLocaleStringFunction; 213 d()->objectPrototype = new (exec) ObjectPrototype(exec, ObjectPrototype::createStructure(jsNull()), d()->prototypeFunctionStructure.get()); 218 214 d()->functionPrototype->structure()->setPrototypeWithoutTransition(d()->objectPrototype); 219 215 … … 222 218 d()->functionStructure = JSFunction::createStructure(d()->functionPrototype); 223 219 d()->callbackFunctionStructure = JSCallbackFunction::createStructure(d()->functionPrototype); 220 d()->argumentsStructure = Arguments::createStructure(d()->objectPrototype); 224 221 d()->callbackConstructorStructure = JSCallbackConstructor::createStructure(d()->objectPrototype); 225 222 d()->callbackObjectStructure = JSCallbackObject<JSObject>::createStructure(d()->objectPrototype); 226 223 227 224 d()->arrayPrototype = new (exec) ArrayPrototype(ArrayPrototype::createStructure(d()->objectPrototype)); 228 d()->argumentsStructure = Arguments::createStructure(d()->arrayPrototype);229 225 d()->arrayStructure = JSArray::createStructure(d()->arrayPrototype); 230 226 d()->regExpMatchesArrayStructure = RegExpMatchesArray::createStructure(d()->arrayPrototype); … … 261 257 // Constructors 262 258 263 ObjectConstructor* objectConstructor = new (exec) ObjectConstructor(exec, ObjectConstructor::createStructure(d()->functionPrototype), d()->objectPrototype, d()->prototypeFunctionStructure.get());259 JSCell* objectConstructor = new (exec) ObjectConstructor(exec, ObjectConstructor::createStructure(d()->functionPrototype), d()->objectPrototype, d()->prototypeFunctionStructure.get()); 264 260 JSCell* functionConstructor = new (exec) FunctionConstructor(exec, FunctionConstructor::createStructure(d()->functionPrototype), d()->functionPrototype); 265 261 JSCell* arrayConstructor = new (exec) ArrayConstructor(exec, ArrayConstructor::createStructure(d()->functionPrototype), d()->arrayPrototype, d()->prototypeFunctionStructure.get()); … … 275 271 RefPtr<Structure> nativeErrorStructure = NativeErrorConstructor::createStructure(d()->functionPrototype); 276 272 277 d()->objectConstructor = objectConstructor;278 273 d()->evalErrorConstructor = new (exec) NativeErrorConstructor(exec, nativeErrorStructure, evalErrorPrototype); 279 274 d()->rangeErrorConstructor = new (exec) NativeErrorConstructor(exec, nativeErrorStructure, rangeErrorPrototype); … … 374 369 if (registerFile.globalObject() == this) 375 370 registerFile.markGlobals(markStack, &globalData()->heap); 376 377 markIfNeeded(markStack, d()->objectConstructor); 371 378 372 markIfNeeded(markStack, d()->regExpConstructor); 379 373 markIfNeeded(markStack, d()->errorConstructor); … … 388 382 markIfNeeded(markStack, d()->callFunction); 389 383 markIfNeeded(markStack, d()->applyFunction); 390 markIfNeeded(markStack, d()->objectToStringFunction);391 markIfNeeded(markStack, d()->objectToLocaleStringFunction);392 384 393 385 markIfNeeded(markStack, d()->objectPrototype); -
trunk/JavaScriptCore/runtime/JSGlobalObject.h
r47304 r47404 39 39 class ErrorConstructor; 40 40 class FunctionPrototype; 41 class GlobalCodeBlock; 41 42 class GlobalEvalFunction; 42 43 class NativeErrorConstructor; 43 class GlobalCodeBlock; 44 class ObjectConstructor; 44 class ProgramCodeBlock; 45 45 class PrototypeFunction; 46 46 class RegExpConstructor; … … 62 62 , registerArraySize(0) 63 63 , globalScopeChain(NoScopeChain()) 64 , objectConstructor(0)65 64 , regExpConstructor(0) 66 65 , errorConstructor(0) … … 74 73 , callFunction(0) 75 74 , applyFunction(0) 76 , objectToStringFunction(0)77 , objectToLocaleStringFunction(0)78 75 , objectPrototype(0) 79 76 , functionPrototype(0) … … 104 101 int recursion; 105 102 106 ObjectConstructor* objectConstructor;107 103 RegExpConstructor* regExpConstructor; 108 104 ErrorConstructor* errorConstructor; … … 117 113 NativeFunctionWrapper* callFunction; 118 114 NativeFunctionWrapper* applyFunction; 119 NativeFunctionWrapper* objectToStringFunction;120 NativeFunctionWrapper* objectToLocaleStringFunction;121 115 122 116 ObjectPrototype* objectPrototype; … … 191 185 // replaces the global object's associated property. 192 186 193 ObjectConstructor* objectConstructor() const { return d()->objectConstructor; }194 187 RegExpConstructor* regExpConstructor() const { return d()->regExpConstructor; } 195 188 … … 212 205 DatePrototype* datePrototype() const { return d()->datePrototype; } 213 206 RegExpPrototype* regExpPrototype() const { return d()->regExpPrototype; } 214 215 NativeFunctionWrapper* objectToStringFunction() const { return d()->objectToStringFunction; }216 NativeFunctionWrapper* objectToLocaleStringFunction() const { return d()->objectToLocaleStringFunction; }217 207 218 208 JSObject* methodCallDummy() const { return d()->methodCallDummy; } -
trunk/JavaScriptCore/runtime/ObjectPrototype.cpp
r47292 r47404 41 41 static JSValue JSC_HOST_CALL objectProtoFuncToLocaleString(ExecState*, JSObject*, JSValue, const ArgList&); 42 42 43 ObjectPrototype::ObjectPrototype(ExecState* exec, PassRefPtr<Structure> stucture, Structure* prototypeFunctionStructure , NativeFunctionWrapper** toStringFunction, NativeFunctionWrapper** toLocaleStringFunction)43 ObjectPrototype::ObjectPrototype(ExecState* exec, PassRefPtr<Structure> stucture, Structure* prototypeFunctionStructure) 44 44 : JSObject(stucture) 45 45 { 46 NativeFunctionWrapper* toString = new (exec) NativeFunctionWrapper(exec, prototypeFunctionStructure, 0, exec->propertyNames().toString, objectProtoFuncToString); 47 NativeFunctionWrapper* toLocaleString = new (exec) NativeFunctionWrapper(exec, prototypeFunctionStructure, 0, exec->propertyNames().toLocaleString, objectProtoFuncToLocaleString); 48 *toStringFunction = toString; 49 *toLocaleStringFunction = toLocaleString; 50 putDirectFunctionWithoutTransition(exec, toString, DontEnum); 51 putDirectFunctionWithoutTransition(exec, toLocaleString, DontEnum); 46 putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, prototypeFunctionStructure, 0, exec->propertyNames().toString, objectProtoFuncToString), DontEnum); 47 putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, prototypeFunctionStructure, 0, exec->propertyNames().toLocaleString, objectProtoFuncToLocaleString), DontEnum); 52 48 putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, prototypeFunctionStructure, 0, exec->propertyNames().valueOf, objectProtoFuncValueOf), DontEnum); 53 49 putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, prototypeFunctionStructure, 1, exec->propertyNames().hasOwnProperty, objectProtoFuncHasOwnProperty), DontEnum); -
trunk/JavaScriptCore/runtime/ObjectPrototype.h
r47292 r47404 28 28 class ObjectPrototype : public JSObject { 29 29 public: 30 ObjectPrototype(ExecState*, PassRefPtr<Structure>, Structure* prototypeFunctionStructure , NativeFunctionWrapper** toStringFunction, NativeFunctionWrapper** toLocaleStringFunction);30 ObjectPrototype(ExecState*, PassRefPtr<Structure>, Structure* prototypeFunctionStructure); 31 31 }; 32 32 -
trunk/JavaScriptCore/tests/mozilla/ecma_3/Function/arguments-001.js
r47292 r47404 50 50 51 51 actual = a instanceof Array; 52 expect = true;52 expect = false; 53 53 addThis(); 54 54 55 55 actual = a.length; 56 expect = 0;56 expect = undefined; 57 57 addThis(); 58 58 … … 66 66 67 67 actual = a instanceof Array; 68 expect = true;68 expect = false; 69 69 addThis(); 70 70 71 71 actual = a.length; 72 expect = 0;72 expect = undefined; 73 73 addThis(); 74 74 -
trunk/LayoutTests/ChangeLog
r47401 r47404 1 2009-08-17 Oliver Hunt <oliver@apple.com> 2 3 RS=Mark Rowe. 4 5 REGRESSION (r47291-r47308): MobileMe applications do not load data 6 https://bugs.webkit.org/show_bug.cgi?id=28341 7 8 Reverting r47292 9 10 * fast/js/arguments-expected.txt: 11 * fast/js/resources/arguments.js: 12 1 13 2009-08-17 Brian Weinstein <bweinstein@apple.com> 2 14 -
trunk/LayoutTests/fast/js/arguments-expected.txt
r47292 r47404 130 130 FAIL argumentsConstUndefined() should be undefined. Was [object Arguments] 131 131 PASS argumentCalleeInException() is argumentCalleeInException 132 PASS getArguments() instanceof Object is true133 PASS getArguments() instanceof Array is true134 PASS getArguments().constructor is Object135 PASS Object.getPrototypeOf(getArguments()) is Array.prototype136 PASS getArguments().toString is Object.prototype.toString137 PASS getArguments().toLocaleString is Object.prototype.toLocaleString138 PASS getArguments() instanceof originalObject is true139 PASS getArguments() instanceof originalArray is true140 PASS getArguments().constructor is originalObject141 PASS originalObject.getPrototypeOf(getArguments()) is originalArray.prototype142 PASS getArguments().toString is originalObject.prototype.toString143 PASS getArguments().toLocaleString is originalObject.prototype.toLocaleString144 PASS originalObject.getPrototypeOf(getArguments()) is originalArrayPrototype145 PASS getArguments().toString is originalObjectToString146 PASS getArguments().toLocaleString is originalObjectToLocaleString147 132 PASS successfullyParsed is true 148 133 -
trunk/LayoutTests/fast/js/resources/arguments.js
r47292 r47404 535 535 shouldBe("argumentCalleeInException()", "argumentCalleeInException") 536 536 537 function getArguments() {538 return arguments;539 }540 541 shouldBeTrue("getArguments() instanceof Object");542 shouldBeTrue("getArguments() instanceof Array");543 shouldBe("getArguments().constructor", "Object");544 shouldBe("Object.getPrototypeOf(getArguments())", "Array.prototype");545 shouldBe("getArguments().toString", "Object.prototype.toString");546 shouldBe("getArguments().toLocaleString", "Object.prototype.toLocaleString");547 548 var originalObject = Object;549 Object = function NewObject() {};550 var originalArray = Array;551 Array = function NewArray() {};552 shouldBeTrue("getArguments() instanceof originalObject");553 shouldBeTrue("getArguments() instanceof originalArray");554 shouldBe("getArguments().constructor", "originalObject");555 shouldBe("originalObject.getPrototypeOf(getArguments())", "originalArray.prototype");556 shouldBe("getArguments().toString", "originalObject.prototype.toString");557 shouldBe("getArguments().toLocaleString", "originalObject.prototype.toLocaleString");558 559 var originalObjectToString = originalObject.prototype.toString;560 originalObject.prototype.toString = function NewObjectPrototypeToString() {};561 var originalObjectToLocaleString = originalObject.prototype.toLocaleString;562 originalObject.prototype.toLocaleString = function NewObjectPrototypeToLocaleString() {};563 var originalArrayPrototype = originalArray.prototype;564 Array.prototype = function NewArrayPrototype() {};565 shouldBe("originalObject.getPrototypeOf(getArguments())", "originalArrayPrototype");566 shouldBe("getArguments().toString", "originalObjectToString");567 shouldBe("getArguments().toLocaleString", "originalObjectToLocaleString");568 569 537 var successfullyParsed = true;
Note: See TracChangeset
for help on using the changeset viewer.