Changeset 128111 in webkit
- Timestamp:
- Sep 10, 2012 2:49:25 PM (12 years ago)
- Location:
- trunk
- Files:
-
- 5 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r128105 r128111 1 2012-09-10 Geoffrey Garen <ggaren@apple.com> 2 3 DFG misses arguments tear-off for function.arguments if 'arguments' is used 4 https://bugs.webkit.org/show_bug.cgi?id=96227 5 6 Reviewed by Gavin Barraclough. 7 8 New test, and updated expectations. 9 10 * fast/js/script-tests/function-dot-arguments.js: 11 * fast/js/function-dot-arguments-expected.txt: Updated for new behavior. 12 13 * fast/js/dfg-tear-off-function-dot-arguments.html: 14 * fast/js/script-tests/dfg-tear-off-function-dot-arguments.js: Added. New test for bug cited here. 15 16 * fast/js/function-dot-arguments-identity-expected.txt: 17 * fast/js/function-dot-arguments-identity.html: Added. New test for new behavior. 18 1 19 2012-09-10 Fady Samuel <fsamuel@chromium.org> 2 20 -
trunk/LayoutTests/fast/js/function-dot-arguments-expected.txt
r76090 r128111 9 9 PASS lengthTest() is '0' 10 10 PASS lengthTest('From', '%E5%8C%97%E4%BA%AC', 360, '/', 'webkit.org') is '5' 11 PASS assignTest() is true11 PASS assignTest().toString() is '[object Arguments]' 12 12 PASS assignVarUndefinedTest().toString() is '[object Arguments]' 13 13 PASS assignVarUndefinedTest2().toString() is '[object Arguments]' 14 PASS assignVarInitTest() is true15 PASS assignVarInitTest2() is true14 PASS assignVarInitTest().toString() is '[object Arguments]' 15 PASS assignVarInitTest2().toString() is '[object Arguments]' 16 16 PASS assignConstUndefinedTest().toString() is '[object Arguments]' 17 17 PASS assignConstUndefinedTest2().toString() is '[object Arguments]' 18 PASS assignConstInitTest() is true19 PASS assignConstInitTest2() is true20 PASS assignForInitTest() is true21 PASS assignForInitTest2() is true22 PASS assignForInInitTest() is true18 PASS assignConstInitTest().toString() is '[object Arguments]' 19 PASS assignConstInitTest2().toString() is '[object Arguments]' 20 PASS assignForInitTest().toString() is '[object Arguments]' 21 PASS assignForInitTest2().toString() is '[object Arguments]' 22 PASS assignForInInitTest().toString() is '[object Arguments]' 23 23 PASS paramInitTest(true).toString() is '[object Arguments]' 24 24 PASS paramFunctionConstructorInitTest(true).toString() is '[object Arguments]' … … 28 28 PASS lexicalArgumentsLiveRead2(1, 0, 3) is 2 29 29 PASS lexicalArgumentsLiveRead3(1, 2, 0) is 3 30 PASS lexicalArgumentsLiveWrite1(0, 2, 3) is 131 PASS lexicalArgumentsLiveWrite2(1, 0, 3) is 232 PASS lexicalArgumentsLiveWrite3(1, 2, 0) is 330 PASS lexicalArgumentsLiveWrite1(0, 2, 3) is 0 31 PASS lexicalArgumentsLiveWrite2(1, 0, 3) is 0 32 PASS lexicalArgumentsLiveWrite3(1, 2, 0) is 0 33 33 PASS argumentsNotLiveRead1(0, 2, 3) is 0 34 34 PASS argumentsNotLiveRead2(1, 0, 3) is 0 … … 40 40 PASS overwroteArgumentsInDynamicScope1() is true 41 41 PASS overwroteArgumentsInDynamicScope2() is true 42 PASS overwroteArgumentsInDynamicScope3() is true42 PASS overwroteArgumentsInDynamicScope3().toString() is '[object Arguments]' 43 43 PASS successfullyParsed is true 44 44 -
trunk/LayoutTests/fast/js/script-tests/function-dot-arguments.js
r98407 r128111 28 28 return g(); 29 29 } 30 shouldBe True("assignTest()");30 shouldBe("assignTest().toString()", "'[object Arguments]'"); 31 31 32 32 function assignVarUndefinedTest() … … 64 64 return g(); 65 65 } 66 shouldBe True("assignVarInitTest()");66 shouldBe("assignVarInitTest().toString()", "'[object Arguments]'"); 67 67 68 68 function assignVarInitTest2() … … 76 76 return g(); 77 77 } 78 shouldBe True("assignVarInitTest2()");78 shouldBe("assignVarInitTest2().toString()", "'[object Arguments]'"); 79 79 80 80 function assignConstUndefinedTest() … … 112 112 return g(); 113 113 } 114 shouldBe True("assignConstInitTest()");114 shouldBe("assignConstInitTest().toString()", "'[object Arguments]'"); 115 115 116 116 function assignConstInitTest2() … … 124 124 return g(); 125 125 } 126 shouldBe True("assignConstInitTest2()");126 shouldBe("assignConstInitTest2().toString()", "'[object Arguments]'"); 127 127 128 128 function assignForInitTest() … … 136 136 return g(); 137 137 } 138 shouldBe True("assignForInitTest()");138 shouldBe("assignForInitTest().toString()", "'[object Arguments]'"); 139 139 140 140 function assignForInitTest2() … … 148 148 return g(); 149 149 } 150 shouldBe True("assignForInitTest2()");150 shouldBe("assignForInitTest2().toString()", "'[object Arguments]'"); 151 151 152 152 function assignForInInitTest() … … 160 160 return g(); 161 161 } 162 shouldBe True("assignForInInitTest()");162 shouldBe("assignForInInitTest().toString()", "'[object Arguments]'"); 163 163 164 164 function paramInitTest(arguments) … … 237 237 return a; 238 238 } 239 shouldBe("lexicalArgumentsLiveWrite1(0, 2, 3)", " 1");239 shouldBe("lexicalArgumentsLiveWrite1(0, 2, 3)", "0"); 240 240 241 241 function lexicalArgumentsLiveWrite2(a, b, c) … … 245 245 return b; 246 246 } 247 shouldBe("lexicalArgumentsLiveWrite2(1, 0, 3)", " 2");247 shouldBe("lexicalArgumentsLiveWrite2(1, 0, 3)", "0"); 248 248 249 249 function lexicalArgumentsLiveWrite3(a, b, c) … … 253 253 return c; 254 254 } 255 shouldBe("lexicalArgumentsLiveWrite3(1, 2, 0)", " 3");255 shouldBe("lexicalArgumentsLiveWrite3(1, 2, 0)", "0"); 256 256 257 257 function argumentsNotLiveRead1(a, b, c) … … 322 322 shouldBeTrue("overwroteArgumentsInDynamicScope1()"); 323 323 shouldBeTrue("overwroteArgumentsInDynamicScope2()"); 324 shouldBe True("overwroteArgumentsInDynamicScope3()");324 shouldBe("overwroteArgumentsInDynamicScope3().toString()", "'[object Arguments]'"); -
trunk/Source/JavaScriptCore/ChangeLog
r128100 r128111 1 2012-09-10 Geoffrey Garen <ggaren@apple.com> 2 3 DFG misses arguments tear-off for function.arguments if 'arguments' is used 4 https://bugs.webkit.org/show_bug.cgi?id=96227 5 6 Reviewed by Gavin Barraclough. 7 8 We've decided not to allow function.arguments to alias the local 9 'arguments' object, or a local var or function named 'arguments'. 10 Aliasing complicates the implementation (cf, this bug) and can produce 11 surprising behavior for web programmers. 12 13 Eliminating the aliasing has the side-effect of fixing this bug. 14 15 The compatibilty story: function.arguments is deprecated, was never 16 specified, and throws an exception in strict mode, so we expect it to 17 disappear over time. Firefox does not alias to 'arguments'; Chrome 18 does, but not if you use eval or with; IE does; Safari did. 19 20 * dfg/DFGByteCodeParser.cpp: Noticed a little cleanup while verifying 21 this code. Use the CodeBlock method for better encapsulation. 22 23 * interpreter/Interpreter.cpp: 24 (JSC::Interpreter::retrieveArgumentsFromVMCode): Behavior change: don't 25 alias. 26 27 * tests/mozilla/js1_4/Functions/function-001.js: 28 (TestFunction_4): Updated test expectations for changed behavior. 29 1 30 2012-09-10 Filip Pizlo <fpizlo@apple.com> 2 31 -
trunk/Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp
r128096 r128111 3192 3192 } 3193 3193 3194 if (codeBlock-> usesArguments() || codeBlock->needsActivation()) {3194 if (codeBlock->argumentsAreCaptured()) { 3195 3195 for (int i = argumentCountIncludingThis; i--;) 3196 3196 inlineCallFrame.capturedVars.set(argumentToOperand(i) + inlineCallFrame.stackOffset); -
trunk/Source/JavaScriptCore/interpreter/Interpreter.cpp
r128096 r128111 5106 5106 return jsNull(); 5107 5107 5108 CodeBlock* codeBlock = functionCallFrame->someCodeBlockForPossiblyInlinedCode();5109 if (codeBlock->usesArguments()) {5110 ASSERT(codeBlock->codeType() == FunctionCode);5111 int argumentsRegister = codeBlock->argumentsRegister();5112 int realArgumentsRegister = unmodifiedArgumentsRegister(argumentsRegister);5113 if (JSValue arguments = functionCallFrame->uncheckedR(argumentsRegister).jsValue())5114 return arguments;5115 JSValue arguments = JSValue(Arguments::create(callFrame->globalData(), functionCallFrame));5116 functionCallFrame->r(argumentsRegister) = arguments;5117 functionCallFrame->r(realArgumentsRegister) = arguments;5118 return arguments;5119 }5120 5121 5108 Arguments* arguments = Arguments::create(functionCallFrame->globalData(), functionCallFrame); 5122 5109 arguments->tearOff(functionCallFrame); -
trunk/Source/JavaScriptCore/tests/mozilla/js1_4/Functions/function-001.js
r11995 r128111 83 83 "return function.arguments when function contains an arguments property", 84 84 "PASS", 85 TestFunction_4( " F", "A", "I", "L" ) +"");85 TestFunction_4( "P", "A", "S", "S" ) +""); 86 86 87 87 test(); … … 101 101 102 102 function TestFunction_4( a, b, c, d, e ) { 103 var arguments = " PASS";104 return TestFunction_4.arguments;103 var arguments = "FAIL"; 104 return Array.prototype.join.call(TestFunction_4.arguments, ""); 105 105 } 106 106
Note: See TracChangeset
for help on using the changeset viewer.