Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(152)

Unified Diff: src/compiler/bytecode-graph-builder.cc

Issue 1437873002: [Interpreter] Add support for Call bytecode to bytecode graph builder. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@mythri_load
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/compiler/bytecode-graph-builder.h ('k') | src/compiler/interpreter-assembler.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
}
« no previous file with comments | « src/compiler/bytecode-graph-builder.h ('k') | src/compiler/interpreter-assembler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698