Changeset 179873 in webkit
- Timestamp:
- Feb 10, 2015, 11:01:41 AM (12 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 4 edited
-
ChangeLog (modified) (1 diff)
-
bytecompiler/NodesCodegen.cpp (modified) (1 diff)
-
parser/Parser.cpp (modified) (3 diffs)
-
tests/typeProfiler/loop.js (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r179865 r179873 1 2015-02-10 Saam Barati <saambarati1@gmail.com> 2 3 Parser::parseVarDeclarationList gets the wrong JSToken for the last identifier 4 https://bugs.webkit.org/show_bug.cgi?id=141272 5 6 Reviewed by Oliver Hunt. 7 8 This patch fixes a bug where the wrong text location would be 9 assigned to a variable declaration inside a ForIn/ForOf loop. 10 It also fixes a bug in the type profiler where the type profiler 11 emits the wrong text offset for a ForIn loop's variable declarator 12 when it's not a pattern node. 13 14 * bytecompiler/NodesCodegen.cpp: 15 (JSC::ForInNode::emitLoopHeader): 16 * parser/Parser.cpp: 17 (JSC::Parser<LexerType>::parseVarDeclarationList): 18 * tests/typeProfiler/loop.js: 19 (testForIn): 20 (testForOf): 21 1 22 2015-02-09 Saam Barati <saambarati1@gmail.com> 2 23 -
trunk/Source/JavaScriptCore/bytecompiler/NodesCodegen.cpp
r179865 r179873 2077 2077 generator.emitMove(local.get(), propertyName); 2078 2078 if (generator.vm()->typeProfiler()) 2079 generator.emitTypeProfilerExpressionInfo( m_lexpr->position(), JSTextPosition(-1, m_lexpr->position().offset + ident.length(), -1));2079 generator.emitTypeProfilerExpressionInfo(simpleBinding->divotStart(), simpleBinding->divotEnd()); 2080 2080 return; 2081 2081 } -
trunk/Source/JavaScriptCore/parser/Parser.cpp
r179682 r179873 453 453 TreeExpression tail = 0; 454 454 const Identifier* lastIdent; 455 JSToken lastIdentToken; 455 456 do { 456 457 lastIdent = 0; … … 467 468 const Identifier* name = m_token.m_data.ident; 468 469 lastIdent = name; 470 lastIdentToken = m_token; 469 471 next(); 470 472 hasInitializer = match(EQUAL); … … 507 509 } while (match(COMMA)); 508 510 if (lastIdent) 509 lastPattern = createBindingPattern(context, DeconstructToVariables, *lastIdent, 0, m_token);511 lastPattern = createBindingPattern(context, DeconstructToVariables, *lastIdent, 0, lastIdentToken); 510 512 return head; 511 513 } -
trunk/Source/JavaScriptCore/tests/typeProfiler/loop.js
r179865 r179873 2 2 3 3 function testForIn(x) { 4 // FIXME: add support for the following statement types: "for (var arg of expr)" and "for (var arg in expr)"5 // https://bugs.webkit.org/show_bug.cgi?id=1412416 4 for (var arg1 in x) 5 x; 6 7 7 for (arg2 in x) 8 8 x; 9 9 10 for ({x: arg3} in x) 10 for ({x: arg3} in x) 11 x; 12 13 for (var {x: arg4} in x) 11 14 x; 12 15 } 13 16 14 17 function testForOf(x) { 18 for (var arg1 of x) 19 x; 20 15 21 for (arg2 of x) 16 22 x; … … 18 24 for ({x: arg3} of x) 19 25 x; 26 for (var {x: arg4} of x) 27 x; 20 28 } 21 29 22 30 testForIn([1]) 23 var types = findTypeForExpression(testForIn, "arg2"); 31 var types = findTypeForExpression(testForIn, "arg1"); 32 assert(types.instructionTypeSet.primitiveTypeNames.indexOf(T.String) !== -1, "Primitive type names should contain 'String'"); 33 types = findTypeForExpression(testForIn, "arg2"); 24 34 assert(types.instructionTypeSet.primitiveTypeNames.indexOf(T.String) !== -1, "Primitive type names should contain 'String'"); 25 35 types = findTypeForExpression(testForIn, "arg3"); 26 36 assert(types.instructionTypeSet.primitiveTypeNames.indexOf(T.Undefined) !== -1, "Primitive type names should contain 'Undefined'"); 37 types = findTypeForExpression(testForIn, "arg4"); 38 assert(types.instructionTypeSet.primitiveTypeNames.indexOf(T.Undefined) !== -1, "Primitive type names should contain 'Undefined'"); 27 39 28 40 testForOf([1]) 41 types = findTypeForExpression(testForOf, "arg1"); 42 assert(types.instructionTypeSet.primitiveTypeNames.indexOf(T.Integer) !== -1, "Primitive type names should contain 'Integer'"); 29 43 types = findTypeForExpression(testForOf, "arg2"); 30 44 assert(types.instructionTypeSet.primitiveTypeNames.indexOf(T.Integer) !== -1, "Primitive type names should contain 'Integer'"); 31 45 types = findTypeForExpression(testForOf, "arg3"); 32 46 assert(types.instructionTypeSet.primitiveTypeNames.indexOf(T.Undefined) !== -1, "Primitive type names should contain 'Undefined'"); 47 types = findTypeForExpression(testForOf, "arg4"); 48 assert(types.instructionTypeSet.primitiveTypeNames.indexOf(T.Undefined) !== -1, "Primitive type names should contain 'Undefined'"); 33 49 testForOf([{x:29}]) 50 types = findTypeForExpression(testForOf, "arg1"); 51 assert(types.instructionTypeSet.structures[0].fields.indexOf("x") !== -1, "variable 'arg1' should have field 'x'"); 34 52 types = findTypeForExpression(testForOf, "arg2"); 35 assert(types.instructionTypeSet.structures[0].fields.indexOf("x") !== -1, "variable 'arg 1' should have field 'x'");53 assert(types.instructionTypeSet.structures[0].fields.indexOf("x") !== -1, "variable 'arg2' should have field 'x'"); 36 54 types = findTypeForExpression(testForOf, "arg3"); 37 55 assert(types.instructionTypeSet.primitiveTypeNames.indexOf(T.Integer) !== -1, "Primitive type names should contain 'Integer'"); 56 types = findTypeForExpression(testForOf, "arg4"); 57 assert(types.instructionTypeSet.primitiveTypeNames.indexOf(T.Integer) !== -1, "Primitive type names should contain 'Integer'");
Note:
See TracChangeset
for help on using the changeset viewer.