Reviewers: Steven,
Description:
MIPS: port Avoid dynamic lookup when initializing let declared variables.
Ported r9156 (cb50742).
Original commit message:
'Let's inside a 'with' would initialize the variable
using the StoreContextSlot runtime function which
would fail because it checks that the variable does
not hold the hole value.
BUG=
TEST=
Please review this at http://codereview.chromium.org/7849008/
Affected files:
M src/mips/full-codegen-mips.cc
Index: src/mips/full-codegen-mips.cc
diff --git a/src/mips/full-codegen-mips.cc b/src/mips/full-codegen-mips.cc
index
385e57ae663a7dedc389148c768553a72d42fb9b..838a6ecd95a59703d28bb80b53b5f2b6757f3838
100644
--- a/src/mips/full-codegen-mips.cc
+++ b/src/mips/full-codegen-mips.cc
@@ -1943,12 +1943,24 @@ void
FullCodeGenerator::EmitVariableAssignment(Variable* var,
switch (slot->type()) {
case Slot::PARAMETER:
case Slot::LOCAL:
+ if (FLAG_debug_code && op == Token::INIT_LET) {
+ // Check for an uninitialized let binding.
+ __ lw(a1, MemOperand(fp, SlotOffset(slot)));
+ __ LoadRoot(t0, Heap::kTheHoleValueRootIndex);
+ __ Check(eq, "Let binding re-initialization.", a1, Operand(t0));
+ }
// Perform the assignment.
__ sw(result_register(), MemOperand(fp, SlotOffset(slot)));
break;
case Slot::CONTEXT: {
MemOperand target = EmitSlotSearch(slot, a1);
+ if (FLAG_debug_code && op == Token::INIT_LET) {
+ // Check for an uninitialized let binding.
+ __ lw(a3, target);
+ __ LoadRoot(t0, Heap::kTheHoleValueRootIndex);
+ __ Check(eq, "Let binding re-initialization.", a3, Operand(t0));
+ }
// Perform the assignment and issue the write barrier.
__ sw(result_register(), target);
// RecordWrite may destroy all its register arguments.
@@ -1959,6 +1971,7 @@ void
FullCodeGenerator::EmitVariableAssignment(Variable* var,
}
case Slot::LOOKUP:
+ ASSERT(op != Token::INIT_LET);
// Call the runtime for the assignment.
__ push(v0); // Value.
__ li(a1, Operand(slot->var()->name()));
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev