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/linkage.h" | 7 #include "src/compiler/linkage.h" |
| 8 #include "src/compiler/operator-properties.h" | 8 #include "src/compiler/operator-properties.h" |
| 9 #include "src/interpreter/bytecode-array-iterator.h" | 9 #include "src/interpreter/bytecode-array-iterator.h" |
| 10 | 10 |
| (...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 545 UNIMPLEMENTED(); | 545 UNIMPLEMENTED(); |
| 546 } | 546 } |
| 547 | 547 |
| 548 | 548 |
| 549 void BytecodeGraphBuilder::VisitCreateObjectLiteral( | 549 void BytecodeGraphBuilder::VisitCreateObjectLiteral( |
| 550 const interpreter::BytecodeArrayIterator& iterator) { | 550 const interpreter::BytecodeArrayIterator& iterator) { |
| 551 UNIMPLEMENTED(); | 551 UNIMPLEMENTED(); |
| 552 } | 552 } |
| 553 | 553 |
| 554 | 554 |
| 555 Node* BytecodeGraphBuilder::ProcessCallArguments(const Operator* call_op, | |
| 556 interpreter::Register callee, | |
| 557 interpreter::Register receiver, | |
| 558 size_t arity) { | |
| 559 Node** all = info()->zone()->NewArray<Node*>(arity); | |
| 560 all[0] = environment()->LookupRegister(callee); | |
| 561 all[1] = environment()->LookupRegister(receiver); | |
| 562 int reciever_index = receiver.index(); | |
| 563 for (int i = 2; i < arity; ++i) { | |
| 564 all[i] = environment()->LookupRegister( | |
| 565 interpreter::Register(reciever_index + i - 1)); | |
| 566 } | |
| 567 Node* value = MakeNode(call_op, static_cast<int>(arity), all, false); | |
| 568 return value; | |
| 569 } | |
| 570 | |
| 571 | |
| 572 void BytecodeGraphBuilder::BuildCall( | |
| 573 const interpreter::BytecodeArrayIterator& iterator) { | |
| 574 // TODO(rmcilroy): Set receiver_hint correctly based on whether the reciever | |
| 575 // register has been loaded with null / undefined explicitly or we are sure it | |
| 576 // is not null / undefined. | |
| 577 ConvertReceiverMode receiver_hint = ConvertReceiverMode::kAny; | |
| 578 interpreter::Register callee = iterator.GetRegisterOperand(0); | |
| 579 interpreter::Register reciever = iterator.GetRegisterOperand(1); | |
| 580 size_t arg_count = iterator.GetCountOperand(2); | |
| 581 VectorSlotPair feedback = CreateVectorSlotPair(iterator.GetIndexOperand(3)); | |
| 582 | |
| 583 const Operator* call = javascript()->CallFunction( | |
| 584 arg_count + 2, language_mode(), feedback, receiver_hint); | |
| 585 Node* value = ProcessCallArguments(call, callee, reciever, arg_count + 2); | |
| 586 AddEmptyFrameStateInputs(value); | |
|
mythria
2015/11/12 09:18:36
Just a note: I moved TODO to add real frame states
rmcilroy
2015/11/12 12:28:03
SGTM, done.
| |
| 587 environment()->BindAccumulator(value); | |
| 588 } | |
| 589 | |
| 590 | |
| 555 void BytecodeGraphBuilder::VisitCall( | 591 void BytecodeGraphBuilder::VisitCall( |
| 556 const interpreter::BytecodeArrayIterator& iterator) { | 592 const interpreter::BytecodeArrayIterator& iterator) { |
| 557 UNIMPLEMENTED(); | 593 BuildCall(iterator); |
| 558 } | 594 } |
| 559 | 595 |
| 560 | 596 |
| 597 void BytecodeGraphBuilder::VisitCallWide( | |
| 598 const interpreter::BytecodeArrayIterator& iterator) { | |
| 599 BuildCall(iterator); | |
| 600 } | |
| 601 | |
| 602 | |
| 561 void BytecodeGraphBuilder::VisitCallRuntime( | 603 void BytecodeGraphBuilder::VisitCallRuntime( |
| 562 const interpreter::BytecodeArrayIterator& iterator) { | 604 const interpreter::BytecodeArrayIterator& iterator) { |
| 563 UNIMPLEMENTED(); | 605 UNIMPLEMENTED(); |
| 564 } | 606 } |
| 565 | 607 |
| 566 | 608 |
| 567 void BytecodeGraphBuilder::VisitCallJSRuntime( | 609 void BytecodeGraphBuilder::VisitCallJSRuntime( |
| 568 const interpreter::BytecodeArrayIterator& iterator) { | 610 const interpreter::BytecodeArrayIterator& iterator) { |
| 569 UNIMPLEMENTED(); | 611 UNIMPLEMENTED(); |
| 570 } | 612 } |
| (...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 986 | 1028 |
| 987 void BytecodeGraphBuilder::UpdateControlDependencyToLeaveFunction(Node* exit) { | 1029 void BytecodeGraphBuilder::UpdateControlDependencyToLeaveFunction(Node* exit) { |
| 988 if (environment()->IsMarkedAsUnreachable()) return; | 1030 if (environment()->IsMarkedAsUnreachable()) return; |
| 989 environment()->MarkAsUnreachable(); | 1031 environment()->MarkAsUnreachable(); |
| 990 exit_controls_.push_back(exit); | 1032 exit_controls_.push_back(exit); |
| 991 } | 1033 } |
| 992 | 1034 |
| 993 } // namespace compiler | 1035 } // namespace compiler |
| 994 } // namespace internal | 1036 } // namespace internal |
| 995 } // namespace v8 | 1037 } // namespace v8 |
| OLD | NEW |