| OLD | NEW | 
|---|
| 1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 the V8 project authors. All rights reserved. | 
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be | 
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. | 
| 4 | 4 | 
| 5 #include "src/compiler/bytecode-graph-builder.h" | 5 #include "src/compiler/bytecode-graph-builder.h" | 
| 6 | 6 | 
| 7 #include "src/compiler/bytecode-branch-analysis.h" | 7 #include "src/compiler/bytecode-branch-analysis.h" | 
| 8 #include "src/compiler/linkage.h" | 8 #include "src/compiler/linkage.h" | 
| 9 #include "src/compiler/operator-properties.h" | 9 #include "src/compiler/operator-properties.h" | 
| 10 #include "src/interpreter/bytecodes.h" | 10 #include "src/interpreter/bytecodes.h" | 
| (...skipping 1322 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1333 } | 1333 } | 
| 1334 | 1334 | 
| 1335 void BytecodeGraphBuilder::VisitTestIn() { | 1335 void BytecodeGraphBuilder::VisitTestIn() { | 
| 1336   BuildCompareOp(javascript()->HasProperty()); | 1336   BuildCompareOp(javascript()->HasProperty()); | 
| 1337 } | 1337 } | 
| 1338 | 1338 | 
| 1339 void BytecodeGraphBuilder::VisitTestInstanceOf() { | 1339 void BytecodeGraphBuilder::VisitTestInstanceOf() { | 
| 1340   BuildCompareOp(javascript()->InstanceOf()); | 1340   BuildCompareOp(javascript()->InstanceOf()); | 
| 1341 } | 1341 } | 
| 1342 | 1342 | 
| 1343 void BytecodeGraphBuilder::VisitToName() { | 1343 void BytecodeGraphBuilder::BuildCastOperator(const Operator* js_op) { | 
| 1344   FrameStateBeforeAndAfter states(this); | 1344   FrameStateBeforeAndAfter states(this); | 
| 1345   Node* value = | 1345   Node* value = NewNode(js_op, environment()->LookupAccumulator()); | 
| 1346       NewNode(javascript()->ToName(), environment()->LookupAccumulator()); |  | 
| 1347   environment()->BindRegister(bytecode_iterator().GetRegisterOperand(0), value, | 1346   environment()->BindRegister(bytecode_iterator().GetRegisterOperand(0), value, | 
| 1348                               &states); | 1347                               &states); | 
| 1349 } | 1348 } | 
| 1350 | 1349 | 
|  | 1350 void BytecodeGraphBuilder::VisitToName() { | 
|  | 1351   BuildCastOperator(javascript()->ToName()); | 
|  | 1352 } | 
|  | 1353 | 
| 1351 void BytecodeGraphBuilder::VisitToObject() { | 1354 void BytecodeGraphBuilder::VisitToObject() { | 
| 1352   FrameStateBeforeAndAfter states(this); | 1355   BuildCastOperator(javascript()->ToObject()); | 
| 1353   Node* node = |  | 
| 1354       NewNode(javascript()->ToObject(), environment()->LookupAccumulator()); |  | 
| 1355   environment()->BindAccumulator(node, &states); |  | 
| 1356 } | 1356 } | 
| 1357 | 1357 | 
| 1358 void BytecodeGraphBuilder::VisitToNumber() { | 1358 void BytecodeGraphBuilder::VisitToNumber() { | 
| 1359   FrameStateBeforeAndAfter states(this); | 1359   BuildCastOperator(javascript()->ToNumber()); | 
| 1360   Node* value = |  | 
| 1361       NewNode(javascript()->ToNumber(), environment()->LookupAccumulator()); |  | 
| 1362   environment()->BindRegister(bytecode_iterator().GetRegisterOperand(0), value, |  | 
| 1363                               &states); |  | 
| 1364 } | 1360 } | 
| 1365 | 1361 | 
| 1366 void BytecodeGraphBuilder::VisitJump() { BuildJump(); } | 1362 void BytecodeGraphBuilder::VisitJump() { BuildJump(); } | 
| 1367 | 1363 | 
| 1368 void BytecodeGraphBuilder::VisitJumpConstant() { BuildJump(); } | 1364 void BytecodeGraphBuilder::VisitJumpConstant() { BuildJump(); } | 
| 1369 | 1365 | 
| 1370 | 1366 | 
| 1371 void BytecodeGraphBuilder::VisitJumpIfTrue() { | 1367 void BytecodeGraphBuilder::VisitJumpIfTrue() { | 
| 1372   BuildJumpIfEqual(jsgraph()->TrueConstant()); | 1368   BuildJumpIfEqual(jsgraph()->TrueConstant()); | 
| 1373 } | 1369 } | 
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1451 } | 1447 } | 
| 1452 | 1448 | 
| 1453 // We cannot create a graph from the debugger copy of the bytecode array. | 1449 // We cannot create a graph from the debugger copy of the bytecode array. | 
| 1454 #define DEBUG_BREAK(Name, ...) \ | 1450 #define DEBUG_BREAK(Name, ...) \ | 
| 1455   void BytecodeGraphBuilder::Visit##Name() { UNREACHABLE(); } | 1451   void BytecodeGraphBuilder::Visit##Name() { UNREACHABLE(); } | 
| 1456 DEBUG_BREAK_BYTECODE_LIST(DEBUG_BREAK); | 1452 DEBUG_BREAK_BYTECODE_LIST(DEBUG_BREAK); | 
| 1457 #undef DEBUG_BREAK | 1453 #undef DEBUG_BREAK | 
| 1458 | 1454 | 
| 1459 void BytecodeGraphBuilder::BuildForInPrepare() { | 1455 void BytecodeGraphBuilder::BuildForInPrepare() { | 
| 1460   FrameStateBeforeAndAfter states(this); | 1456   FrameStateBeforeAndAfter states(this); | 
| 1461   Node* receiver = environment()->LookupAccumulator(); | 1457   Node* receiver = | 
|  | 1458       environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0)); | 
| 1462   Node* prepare = NewNode(javascript()->ForInPrepare(), receiver); | 1459   Node* prepare = NewNode(javascript()->ForInPrepare(), receiver); | 
| 1463   environment()->BindRegistersToProjections( | 1460   environment()->BindRegistersToProjections( | 
| 1464       bytecode_iterator().GetRegisterOperand(0), prepare, &states); | 1461       bytecode_iterator().GetRegisterOperand(1), prepare, &states); | 
| 1465 } | 1462 } | 
| 1466 | 1463 | 
| 1467 void BytecodeGraphBuilder::VisitForInPrepare() { BuildForInPrepare(); } | 1464 void BytecodeGraphBuilder::VisitForInPrepare() { BuildForInPrepare(); } | 
| 1468 | 1465 | 
| 1469 void BytecodeGraphBuilder::VisitForInDone() { | 1466 void BytecodeGraphBuilder::VisitForInDone() { | 
| 1470   FrameStateBeforeAndAfter states(this); | 1467   FrameStateBeforeAndAfter states(this); | 
| 1471   Node* index = | 1468   Node* index = | 
| 1472       environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0)); | 1469       environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0)); | 
| 1473   Node* cache_length = | 1470   Node* cache_length = | 
| 1474       environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(1)); | 1471       environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(1)); | 
| (...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1832     // Phi does not exist yet, introduce one. | 1829     // Phi does not exist yet, introduce one. | 
| 1833     value = NewPhi(inputs, value, control); | 1830     value = NewPhi(inputs, value, control); | 
| 1834     value->ReplaceInput(inputs - 1, other); | 1831     value->ReplaceInput(inputs - 1, other); | 
| 1835   } | 1832   } | 
| 1836   return value; | 1833   return value; | 
| 1837 } | 1834 } | 
| 1838 | 1835 | 
| 1839 }  // namespace compiler | 1836 }  // namespace compiler | 
| 1840 }  // namespace internal | 1837 }  // namespace internal | 
| 1841 }  // namespace v8 | 1838 }  // namespace v8 | 
| OLD | NEW | 
|---|