Index: src/compiler/bytecode-graph-builder.cc |
diff --git a/src/compiler/bytecode-graph-builder.cc b/src/compiler/bytecode-graph-builder.cc |
index d7d33d1e9beff2fcc16478ff2c1d2a037d1d54ab..db29f6da82a6bf05a34a3e8f5903a4b5bf529681 100644 |
--- a/src/compiler/bytecode-graph-builder.cc |
+++ b/src/compiler/bytecode-graph-builder.cc |
@@ -552,9 +552,51 @@ void BytecodeGraphBuilder::VisitCreateObjectLiteral( |
} |
+Node* BytecodeGraphBuilder::ProcessCallArguments(const Operator* call_op, |
+ interpreter::Register callee, |
+ interpreter::Register receiver, |
+ size_t arity) { |
+ Node** all = info()->zone()->NewArray<Node*>(arity); |
+ all[0] = environment()->LookupRegister(callee); |
+ all[1] = environment()->LookupRegister(receiver); |
+ int reciever_index = receiver.index(); |
+ for (int i = 2; i < arity; ++i) { |
+ all[i] = environment()->LookupRegister( |
+ interpreter::Register(reciever_index + i - 1)); |
+ } |
+ Node* value = MakeNode(call_op, static_cast<int>(arity), all, false); |
+ return value; |
+} |
+ |
+ |
+void BytecodeGraphBuilder::BuildCall( |
+ const interpreter::BytecodeArrayIterator& iterator) { |
+ // TODO(rmcilroy): Set receiver_hint correctly based on whether the reciever |
+ // register has been loaded with null / undefined explicitly or we are sure it |
+ // is not null / undefined. |
+ ConvertReceiverMode receiver_hint = ConvertReceiverMode::kAny; |
+ interpreter::Register callee = iterator.GetRegisterOperand(0); |
+ interpreter::Register reciever = iterator.GetRegisterOperand(1); |
+ size_t arg_count = iterator.GetCountOperand(2); |
+ VectorSlotPair feedback = CreateVectorSlotPair(iterator.GetIndexOperand(3)); |
+ |
+ const Operator* call = javascript()->CallFunction( |
+ arg_count + 2, language_mode(), feedback, receiver_hint); |
+ Node* value = ProcessCallArguments(call, callee, reciever, arg_count + 2); |
+ 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.
|
+ environment()->BindAccumulator(value); |
+} |
+ |
+ |
void BytecodeGraphBuilder::VisitCall( |
const interpreter::BytecodeArrayIterator& iterator) { |
- UNIMPLEMENTED(); |
+ BuildCall(iterator); |
+} |
+ |
+ |
+void BytecodeGraphBuilder::VisitCallWide( |
+ const interpreter::BytecodeArrayIterator& iterator) { |
+ BuildCall(iterator); |
} |