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

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: Minor clean-up/simplication in Runtime_InterpreterForInPrepare. 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 bfbf371666ac3c33501dc3babc369acaed7753a2..1ab6c677d33e5162ce560c3b6be8b0055324f75a 100644
--- a/src/compiler/bytecode-graph-builder.cc
+++ b/src/compiler/bytecode-graph-builder.cc
@@ -1394,15 +1394,15 @@ void BytecodeGraphBuilder::VisitToName(
}
-void BytecodeGraphBuilder::VisitToNumber(
+void BytecodeGraphBuilder::VisitToObject(
const interpreter::BytecodeArrayIterator& iterator) {
- BuildCastOperator(javascript()->ToNumber(), iterator);
+ BuildCastOperator(javascript()->ToObject(), iterator);
}
-void BytecodeGraphBuilder::VisitToObject(
+void BytecodeGraphBuilder::VisitToNumber(
const interpreter::BytecodeArrayIterator& iterator) {
- BuildCastOperator(javascript()->ToObject(), iterator);
+ BuildCastOperator(javascript()->ToNumber(), iterator);
}
@@ -1513,19 +1513,55 @@ void BytecodeGraphBuilder::VisitReturn(
void BytecodeGraphBuilder::VisitForInPrepare(
const interpreter::BytecodeArrayIterator& iterator) {
- UNIMPLEMENTED();
+ Node* prepare = nullptr;
+ {
+ FrameStateBeforeAndAfter states(this, iterator);
+ Node* receiver = environment()->LookupAccumulator();
+ prepare = NewNode(javascript()->ForInPrepare(), receiver);
+ environment()->RecordAfterState(prepare, &states);
+ }
+ // Project cache_type, cache_array, cache_length into register
+ // operands 1, 2, 3.
+ for (int i = 0; i < 3; i++) {
+ environment()->BindRegister(iterator.GetRegisterOperand(i),
+ NewNode(common()->Projection(i), prepare));
+ }
+}
+
+
+void BytecodeGraphBuilder::VisitForInDone(
+ const interpreter::BytecodeArrayIterator& iterator) {
+ FrameStateBeforeAndAfter states(this, 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);
+ environment()->BindAccumulator(exit_cond, &states);
}
void BytecodeGraphBuilder::VisitForInNext(
const interpreter::BytecodeArrayIterator& iterator) {
- UNIMPLEMENTED();
+ FrameStateBeforeAndAfter states(this, iterator);
+ Node* receiver =
+ environment()->LookupRegister(iterator.GetRegisterOperand(0));
+ Node* cache_type =
+ environment()->LookupRegister(iterator.GetRegisterOperand(1));
+ Node* cache_array =
+ environment()->LookupRegister(iterator.GetRegisterOperand(2));
+ Node* index = environment()->LookupRegister(iterator.GetRegisterOperand(3));
+ Node* value = NewNode(javascript()->ForInNext(), receiver, cache_array,
+ cache_type, index);
+ environment()->BindAccumulator(value, &states);
}
-void BytecodeGraphBuilder::VisitForInDone(
+void BytecodeGraphBuilder::VisitForInStep(
const interpreter::BytecodeArrayIterator& iterator) {
- UNIMPLEMENTED();
+ FrameStateBeforeAndAfter states(this, iterator);
+ Node* index = environment()->LookupRegister(iterator.GetRegisterOperand(0));
+ index = NewNode(javascript()->ForInStep(), index);
+ environment()->BindAccumulator(index, &states);
}
« 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