Commit ab674bab authored by klaasb's avatar klaasb Committed by Commit bot

Fix mistake in FastNewFunctionContextStub

We assumed we could use a do..while, but the requested amount of slots could've
been 0 and we already started at MIN_CONTEXT_SLOTS. In that case the loop
should've been skipped.

Review-Url: https://codereview.chromium.org/2227723003
Cr-Commit-Position: refs/heads/master@{#38499}
parent c001a9ec
...@@ -4797,14 +4797,14 @@ compiler::Node* FastNewFunctionContextStub::Generate( ...@@ -4797,14 +4797,14 @@ compiler::Node* FastNewFunctionContextStub::Generate(
assembler->Bind(&loop); assembler->Bind(&loop);
{ {
Node* slot_index = var_slot_index.value(); Node* slot_index = var_slot_index.value();
// check for < length later, there are at least Context::MIN_CONTEXT_SLOTS assembler->GotoUnless(assembler->Int32LessThan(slot_index, length),
&after_loop);
assembler->StoreFixedArrayElement(function_context, slot_index, undefined, assembler->StoreFixedArrayElement(function_context, slot_index, undefined,
SKIP_WRITE_BARRIER); SKIP_WRITE_BARRIER);
Node* one = assembler->Int32Constant(1); Node* one = assembler->Int32Constant(1);
Node* next_index = assembler->Int32Add(slot_index, one); Node* next_index = assembler->Int32Add(slot_index, one);
var_slot_index.Bind(next_index); var_slot_index.Bind(next_index);
assembler->Branch(assembler->Int32LessThan(next_index, length), &loop, assembler->Goto(&loop);
&after_loop);
} }
assembler->Bind(&after_loop); assembler->Bind(&after_loop);
......
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