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

Unified Diff: src/interpreter/interpreter.cc

Issue 1825513003: [interpreter] Don't go to the runtime for ForInDone. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 9 months 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/interpreter/interpreter.cc
diff --git a/src/interpreter/interpreter.cc b/src/interpreter/interpreter.cc
index 2284eef10efe903bf68d5419407ea96be1284110..1c98dc7eb58d07d93baa0d484665861e42af1d0a 100644
--- a/src/interpreter/interpreter.cc
+++ b/src/interpreter/interpreter.cc
@@ -1564,16 +1564,27 @@ void Interpreter::DoForInNext(InterpreterAssembler* assembler) {
//
// Returns true if the end of the enumerable properties has been reached.
void Interpreter::DoForInDone(InterpreterAssembler* assembler) {
- // TODO(oth): Implement directly rather than making a runtime call.
Node* index_reg = __ BytecodeOperandReg(0);
Node* index = __ LoadRegister(index_reg);
Node* cache_length_reg = __ BytecodeOperandReg(1);
Node* cache_length = __ LoadRegister(cache_length_reg);
- Node* context = __ GetContext();
- Node* result =
- __ CallRuntime(Runtime::kForInDone, context, index, cache_length);
- __ SetAccumulator(result);
- __ Dispatch();
+
+ // Check if {index} is at {cache_length} already.
+ InterpreterAssembler::Label if_true(assembler), if_false(assembler);
+ Node* condition = __ WordEqual(index, cache_length);
+ __ Branch(condition, &if_true, &if_false);
+ __ Bind(&if_true);
+ {
+ Node* result = __ BooleanConstant(true);
+ __ SetAccumulator(result);
+ __ Dispatch();
+ }
+ __ Bind(&if_false);
+ {
+ Node* result = __ BooleanConstant(false);
+ __ SetAccumulator(result);
+ __ Dispatch();
+ }
}
// ForInStep <index>
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698