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

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

Issue 1531693002: [Interpreter] Implement ForIn in bytecode graph builder. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@oth-0009-phi
Patch Set: Created 5 years 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 | « no previous file | src/interpreter/bytecode-array-builder.h » ('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 f4c5055ec043a9b788e0e4b61fb546bd5b5deb2d..0a38b8934cebf7aee0ecbeea300a465f35c82d1a 100644
--- a/src/compiler/bytecode-graph-builder.cc
+++ b/src/compiler/bytecode-graph-builder.cc
@@ -1013,7 +1013,6 @@ void BytecodeGraphBuilder::BuildBinaryOp(
Node* left = environment()->LookupRegister(iterator.GetRegisterOperand(0));
Node* right = environment()->LookupAccumulator();
Node* node = NewNode(js_op, left, right);
-
AddEmptyFrameStateInputs(node);
environment()->BindAccumulator(node);
}
@@ -1369,19 +1368,53 @@ void BytecodeGraphBuilder::VisitReturn(
void BytecodeGraphBuilder::VisitForInPrepare(
const interpreter::BytecodeArrayIterator& iterator) {
- UNIMPLEMENTED();
+ Node* receiver =
+ environment()->LookupRegister(iterator.GetRegisterOperand(0));
+ Node* property_names = environment()->LookupAccumulator();
+ const Operator* call_runtime =
+ javascript()->CallRuntime(Runtime::kInterpreterForInPrepare, 2);
Benedikt Meurer 2015/12/16 10:53:25 What about JSForInPrepare? Calling interpreter run
+ Node** args = info()->zone()->NewArray<Node*>(2);
+ args[0] = receiver;
+ args[1] = property_names;
+ Node* value = MakeNode(call_runtime, 2, args, false);
+ AddEmptyFrameStateInputs(value);
+ environment()->BindAccumulator(value);
+}
+
+
+void BytecodeGraphBuilder::VisitForInDone(
+ const interpreter::BytecodeArrayIterator& iterator) {
+ Node* index = environment()->LookupRegister(iterator.GetRegisterOperand(0));
+ Node* cache_length =
+ environment()->LookupRegister(iterator.GetRegisterOperand(1));
+ Node* exit_cond = NewNode(javascript()->ForInDone(), index, cache_length);
+ AddEmptyFrameStateInputs(exit_cond);
+ environment()->BindAccumulator(exit_cond);
}
void BytecodeGraphBuilder::VisitForInNext(
const interpreter::BytecodeArrayIterator& iterator) {
- UNIMPLEMENTED();
+ Node* receiver =
+ environment()->LookupRegister(iterator.GetRegisterOperand(0));
+ Node* index = environment()->LookupRegister(iterator.GetRegisterOperand(1));
+ Node* cache_type =
+ environment()->LookupRegister(iterator.GetRegisterOperand(2));
+ Node* cache_array =
+ environment()->LookupRegister(iterator.GetRegisterOperand(3));
+ Node* value = NewNode(javascript()->ForInNext(), receiver, cache_array,
+ cache_type, index);
+ AddEmptyFrameStateInputs(value);
+ environment()->BindAccumulator(value);
}
-void BytecodeGraphBuilder::VisitForInDone(
+void BytecodeGraphBuilder::VisitForInStep(
const interpreter::BytecodeArrayIterator& iterator) {
- UNIMPLEMENTED();
+ Node* index = environment()->LookupRegister(iterator.GetRegisterOperand(0));
+ index = NewNode(javascript()->ForInStep(), index);
+ AddEmptyFrameStateInputs(index);
+ environment()->BindRegister(iterator.GetRegisterOperand(0), index);
}
« no previous file with comments | « no previous file | src/interpreter/bytecode-array-builder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698