Commit d9e11718 authored by bmeurer's avatar bmeurer Committed by Commit bot

[interpreter] Don't go to the runtime for ForInDone.

The bytecode handler for ForInDone can just do a word comparison on
index and cache length instead of calling out to %ForInDone.

R=rmcilroy@chromium.org

Review URL: https://codereview.chromium.org/1825513003

Cr-Commit-Position: refs/heads/master@{#35023}
parent ca387dbd
......@@ -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>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment