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

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

Issue 1456453002: [Interpreter] Add support for Call bytecode to bytecode graph builder. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Compilation fix (signed/unsigned). 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..85f6e21046c25ca2aa3f681915a2d424a14cbf9d 100644
--- a/src/compiler/bytecode-graph-builder.cc
+++ b/src/compiler/bytecode-graph-builder.cc
@@ -162,6 +162,8 @@ VectorSlotPair BytecodeGraphBuilder::CreateVectorSlotPair(int slot_id) {
}
+// TODO(mythria): Replace this function with one which adds real frame state.
+// Also add before and after frame states and checkpointing if required.
void BytecodeGraphBuilder::AddEmptyFrameStateInputs(Node* node) {
int frame_state_count =
OperatorProperties::GetFrameStateInputCount(node->op());
@@ -397,8 +399,6 @@ void BytecodeGraphBuilder::BuildNamedLoad(
const Operator* op = javascript()->LoadNamed(language_mode(), name, feedback);
Node* node = NewNode(op, object, BuildLoadFeedbackVector());
- // TODO(mythria): Replace with real frame state. Also add before and after
- // frame states if required.
AddEmptyFrameStateInputs(node);
environment()->BindAccumulator(node);
}
@@ -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 receiver_index = receiver.index();
+ for (int i = 2; i < static_cast<int>(arity); ++i) {
+ all[i] = environment()->LookupRegister(
+ interpreter::Register(receiver_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 receiver
+ // 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 receiver = 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, receiver, arg_count + 2);
+ AddEmptyFrameStateInputs(value);
+ environment()->BindAccumulator(value);
+}
+
+
void BytecodeGraphBuilder::VisitCall(
const interpreter::BytecodeArrayIterator& iterator) {
- UNIMPLEMENTED();
+ BuildCall(iterator);
+}
+
+
+void BytecodeGraphBuilder::VisitCallWide(
+ const interpreter::BytecodeArrayIterator& iterator) {
+ BuildCall(iterator);
}
@@ -588,7 +630,6 @@ void BytecodeGraphBuilder::BuildBinaryOp(
Node* right = environment()->LookupAccumulator();
Node* node = NewNode(js_op, left, right);
- // TODO(oth): Real frame state and environment check pointing.
AddEmptyFrameStateInputs(node);
environment()->BindAccumulator(node);
}
« 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