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

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: Update to directly build bytecode in unittest 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
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..d42a36b694f91673baaad19c81f7debf4fe5051f 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 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
oth 2015/11/13 12:24:06 s/reciever/receiver/
+ // is not null / undefined.
+ ConvertReceiverMode receiver_hint = ConvertReceiverMode::kAny;
+ interpreter::Register callee = iterator.GetRegisterOperand(0);
+ interpreter::Register reciever = iterator.GetRegisterOperand(1);
oth 2015/11/13 12:24:06 s/reciever/receiver/
+ 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);
+ 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);
}

Powered by Google App Engine
This is Rietveld 408576698