Chromium Code Reviews| 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 1349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1360 | 1360 |
| 1361 void BytecodeGraphBuilder::VisitForInStep() { | 1361 void BytecodeGraphBuilder::VisitForInStep() { |
| 1362 FrameStateBeforeAndAfter states(this); | 1362 FrameStateBeforeAndAfter states(this); |
| 1363 Node* index = | 1363 Node* index = |
| 1364 environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0)); | 1364 environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0)); |
| 1365 index = NewNode(javascript()->ForInStep(), index); | 1365 index = NewNode(javascript()->ForInStep(), index); |
| 1366 environment()->BindAccumulator(index, &states); | 1366 environment()->BindAccumulator(index, &states); |
| 1367 } | 1367 } |
| 1368 | 1368 |
| 1369 void BytecodeGraphBuilder::VisitSuspendGenerator() { | 1369 void BytecodeGraphBuilder::VisitSuspendGenerator() { |
| 1370 UNIMPLEMENTED(); | 1370 Node* state = environment()->LookupAccumulator(); |
| 1371 Node* generator = environment()->LookupRegister( | |
| 1372 bytecode_iterator().GetRegisterOperand(0)); | |
| 1373 | |
| 1374 for (int i = 0; i < environment()->register_count(); ++i) { | |
| 1375 NewNode(javascript()->CallRuntime(Runtime::kGeneratorWriteRegister), | |
|
Benedikt Meurer
2016/05/10 10:32:08
Nit: use StoreRegister or SetRegister instead of W
neis
2016/05/10 11:32:06
Done.
| |
| 1376 generator, jsgraph()->Constant(i), | |
| 1377 environment()->LookupRegister(interpreter::Register(i))); | |
|
Michael Starzinger
2016/05/10 10:53:05
nit: Better pull out the "environment()->LookupReg
neis
2016/05/10 11:32:06
Done.
| |
| 1378 } | |
| 1379 | |
| 1380 NewNode(javascript()->CallRuntime(Runtime::kGeneratorSetContext), generator); | |
| 1381 NewNode(javascript()->CallRuntime(Runtime::kGeneratorSetContinuation), | |
| 1382 generator, state); | |
| 1371 } | 1383 } |
| 1372 | 1384 |
| 1373 void BytecodeGraphBuilder::VisitResumeGenerator() { | 1385 void BytecodeGraphBuilder::VisitResumeGenerator() { |
| 1374 UNIMPLEMENTED(); | 1386 FrameStateBeforeAndAfter states(this); |
| 1387 | |
| 1388 Node* generator = environment()->LookupRegister( | |
| 1389 bytecode_iterator().GetRegisterOperand(0)); | |
| 1390 Node* state = NewNode(javascript()->CallRuntime( | |
| 1391 Runtime::kGeneratorGetContinuation), generator); | |
| 1392 | |
| 1393 // Bijection between registers and array indices must match that used in | |
| 1394 // InterpreterAssembler::ExportRegisterFile. | |
| 1395 for (int i = 0; i < environment()->register_count(); ++i) { | |
| 1396 Node* value = NewNode( | |
| 1397 javascript()->CallRuntime(Runtime::kGeneratorReadRegister), | |
|
Benedikt Meurer
2016/05/10 10:32:08
Nit: use LoadRegister instead of ReadRegister
neis
2016/05/10 11:32:06
Done.
| |
| 1398 generator, jsgraph()->Constant(i)); | |
| 1399 environment()->BindRegister(interpreter::Register(i), value); | |
| 1400 | |
| 1401 NewNode(javascript()->CallRuntime(Runtime::kGeneratorWriteRegister), | |
| 1402 generator, jsgraph()->Constant(i), jsgraph()->StaleRegisterConstant()); | |
| 1403 } | |
| 1404 | |
| 1405 NewNode(javascript()->CallRuntime(Runtime::kGeneratorSetContinuation), | |
| 1406 generator, jsgraph()->Constant(JSGeneratorObject::kGeneratorExecuting)); | |
| 1407 | |
| 1408 environment()->BindAccumulator(state, &states); | |
| 1375 } | 1409 } |
| 1376 | 1410 |
| 1377 void BytecodeGraphBuilder::VisitWide() { | 1411 void BytecodeGraphBuilder::VisitWide() { |
| 1378 // Consumed by the BytecodeArrayIterator. | 1412 // Consumed by the BytecodeArrayIterator. |
| 1379 UNREACHABLE(); | 1413 UNREACHABLE(); |
| 1380 } | 1414 } |
| 1381 | 1415 |
| 1382 void BytecodeGraphBuilder::VisitExtraWide() { | 1416 void BytecodeGraphBuilder::VisitExtraWide() { |
| 1383 // Consumed by the BytecodeArrayIterator. | 1417 // Consumed by the BytecodeArrayIterator. |
| 1384 UNREACHABLE(); | 1418 UNREACHABLE(); |
| 1385 } | 1419 } |
| 1386 | 1420 |
| 1387 void BytecodeGraphBuilder::VisitIllegal() { | 1421 void BytecodeGraphBuilder::VisitIllegal() { |
| 1388 // Never present in valid bytecode. | 1422 NewNode(javascript()->CallRuntime(Runtime::kAbort), |
| 1389 UNREACHABLE(); | 1423 jsgraph()->Constant(kIllegalBytecode)); |
| 1390 } | 1424 } |
| 1391 | 1425 |
| 1392 void BytecodeGraphBuilder::SwitchToMergeEnvironment(int current_offset) { | 1426 void BytecodeGraphBuilder::SwitchToMergeEnvironment(int current_offset) { |
| 1393 if (merge_environments_[current_offset] != nullptr) { | 1427 if (merge_environments_[current_offset] != nullptr) { |
| 1394 if (environment() != nullptr) { | 1428 if (environment() != nullptr) { |
| 1395 merge_environments_[current_offset]->Merge(environment()); | 1429 merge_environments_[current_offset]->Merge(environment()); |
| 1396 } | 1430 } |
| 1397 set_environment(merge_environments_[current_offset]); | 1431 set_environment(merge_environments_[current_offset]); |
| 1398 } | 1432 } |
| 1399 } | 1433 } |
| (...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1654 // Phi does not exist yet, introduce one. | 1688 // Phi does not exist yet, introduce one. |
| 1655 value = NewPhi(inputs, value, control); | 1689 value = NewPhi(inputs, value, control); |
| 1656 value->ReplaceInput(inputs - 1, other); | 1690 value->ReplaceInput(inputs - 1, other); |
| 1657 } | 1691 } |
| 1658 return value; | 1692 return value; |
| 1659 } | 1693 } |
| 1660 | 1694 |
| 1661 } // namespace compiler | 1695 } // namespace compiler |
| 1662 } // namespace internal | 1696 } // namespace internal |
| 1663 } // namespace v8 | 1697 } // namespace v8 |
| OLD | NEW |