Revision: 22385
Author: [email protected]
Date: Mon Jul 14 18:22:34 2014 UTC
Log: MIPS: This CL simplifies var / const by ensuring the behavior is
consistent in itself, and with regular JS semantics; between regular
var/const and eval-ed var/const.
Port r22379 (fb62653)
Original commit message:
Legacy const is changed so that a declaration declares a configurable, but
non-writable, slot, and the initializer reconfigures it (when possible) to
non-configurable non-writable. This avoids the need for "the hole" as
marker value in JSContextExtensionObjects and GlobalObjects. Undefined is
used instead.
BUG=
[email protected]
Review URL: https://codereview.chromium.org/389373004
http://code.google.com/p/v8/source/detail?r=22385
Modified:
/branches/bleeding_edge/src/mips/full-codegen-mips.cc
/branches/bleeding_edge/src/mips64/full-codegen-mips64.cc
=======================================
--- /branches/bleeding_edge/src/mips/full-codegen-mips.cc Fri Jul 11
01:50:12 2014 UTC
+++ /branches/bleeding_edge/src/mips/full-codegen-mips.cc Mon Jul 14
18:22:34 2014 UTC
@@ -856,7 +856,7 @@
__ mov(a0, zero_reg); // Smi::FromInt(0) indicates no initial
value.
__ Push(cp, a2, a1, a0);
}
- __ CallRuntime(Runtime::kDeclareContextSlot, 4);
+ __ CallRuntime(Runtime::kDeclareLookupSlot, 4);
break;
}
}
@@ -912,7 +912,7 @@
__ Push(cp, a2, a1);
// Push initial value for function declaration.
VisitForStackValue(declaration->fun());
- __ CallRuntime(Runtime::kDeclareContextSlot, 4);
+ __ CallRuntime(Runtime::kDeclareLookupSlot, 4);
break;
}
}
@@ -2450,15 +2450,6 @@
a1, offset, a3, a2, kRAHasBeenSaved, kDontSaveFPRegs);
}
}
-
-
-void FullCodeGenerator::EmitCallStoreContextSlot(
- Handle<String> name, StrictMode strict_mode) {
- __ li(a1, Operand(name));
- __ li(a0, Operand(Smi::FromInt(strict_mode)));
- __ Push(v0, cp, a1, a0); // Value, context, name, strict mode.
- __ CallRuntime(Runtime::kStoreContextSlot, 4);
-}
void FullCodeGenerator::EmitVariableAssignment(Variable* var, Token::Value
op) {
@@ -2475,7 +2466,7 @@
if (var->IsLookupSlot()) {
__ li(a0, Operand(var->name()));
__ Push(v0, cp, a0); // Context and name.
- __ CallRuntime(Runtime::kInitializeConstContextSlot, 3);
+ __ CallRuntime(Runtime::kInitializeLegacyConstLookupSlot, 3);
} else {
ASSERT(var->IsStackAllocated() || var->IsContextSlot());
Label skip;
@@ -2489,29 +2480,32 @@
} else if (var->mode() == LET && op != Token::INIT_LET) {
// Non-initializing assignment to let variable needs a write barrier.
- if (var->IsLookupSlot()) {
- EmitCallStoreContextSlot(var->name(), strict_mode());
- } else {
- ASSERT(var->IsStackAllocated() || var->IsContextSlot());
- Label assign;
- MemOperand location = VarOperand(var, a1);
- __ lw(a3, location);
- __ LoadRoot(t0, Heap::kTheHoleValueRootIndex);
- __ Branch(&assign, ne, a3, Operand(t0));
- __ li(a3, Operand(var->name()));
- __ push(a3);
- __ CallRuntime(Runtime::kThrowReferenceError, 1);
- // Perform the assignment.
- __ bind(&assign);
- EmitStoreToStackLocalOrContextSlot(var, location);
- }
+ ASSERT(!var->IsLookupSlot());
+ ASSERT(var->IsStackAllocated() || var->IsContextSlot());
+ Label assign;
+ MemOperand location = VarOperand(var, a1);
+ __ lw(a3, location);
+ __ LoadRoot(t0, Heap::kTheHoleValueRootIndex);
+ __ Branch(&assign, ne, a3, Operand(t0));
+ __ li(a3, Operand(var->name()));
+ __ push(a3);
+ __ CallRuntime(Runtime::kThrowReferenceError, 1);
+ // Perform the assignment.
+ __ bind(&assign);
+ EmitStoreToStackLocalOrContextSlot(var, location);
} else if (!var->is_const_mode() || op == Token::INIT_CONST) {
- // Assignment to var or initializing assignment to let/const
- // in harmony mode.
if (var->IsLookupSlot()) {
- EmitCallStoreContextSlot(var->name(), strict_mode());
+ ASSERT(op == Token::ASSIGN || op == Token::INIT_VAR ||
+ op == Token::ASSIGN_ADD);
+ // Assignment to var.
+ __ li(a1, Operand(var->name()));
+ __ li(a0, Operand(Smi::FromInt(strict_mode())));
+ __ Push(v0, cp, a1, a0); // Value, context, name, strict mode.
+ __ CallRuntime(Runtime::kStoreLookupSlot, 4);
} else {
+ // Assignment to var or initializing assignment to let/const in
harmony
+ // mode.
ASSERT((var->IsStackAllocated() || var->IsContextSlot()));
MemOperand location = VarOperand(var, a1);
if (generate_debug_code_ && op == Token::INIT_LET) {
=======================================
--- /branches/bleeding_edge/src/mips64/full-codegen-mips64.cc Fri Jul 11
01:50:12 2014 UTC
+++ /branches/bleeding_edge/src/mips64/full-codegen-mips64.cc Mon Jul 14
18:22:34 2014 UTC
@@ -852,7 +852,7 @@
__ mov(a0, zero_reg); // Smi::FromInt(0) indicates no initial
value.
__ Push(cp, a2, a1, a0);
}
- __ CallRuntime(Runtime::kDeclareContextSlot, 4);
+ __ CallRuntime(Runtime::kDeclareLookupSlot, 4);
break;
}
}
@@ -908,7 +908,7 @@
__ Push(cp, a2, a1);
// Push initial value for function declaration.
VisitForStackValue(declaration->fun());
- __ CallRuntime(Runtime::kDeclareContextSlot, 4);
+ __ CallRuntime(Runtime::kDeclareLookupSlot, 4);
break;
}
}
@@ -2445,15 +2445,6 @@
a1, offset, a3, a2, kRAHasBeenSaved, kDontSaveFPRegs);
}
}
-
-
-void FullCodeGenerator::EmitCallStoreContextSlot(
- Handle<String> name, StrictMode strict_mode) {
- __ li(a1, Operand(name));
- __ li(a0, Operand(Smi::FromInt(strict_mode)));
- __ Push(v0, cp, a1, a0); // Value, context, name, strict mode.
- __ CallRuntime(Runtime::kStoreContextSlot, 4);
-}
void FullCodeGenerator::EmitVariableAssignment(Variable* var, Token::Value
op) {
@@ -2469,7 +2460,7 @@
if (var->IsLookupSlot()) {
__ li(a0, Operand(var->name()));
__ Push(v0, cp, a0); // Context and name.
- __ CallRuntime(Runtime::kInitializeConstContextSlot, 3);
+ __ CallRuntime(Runtime::kInitializeLegacyConstLookupSlot, 3);
} else {
ASSERT(var->IsStackAllocated() || var->IsContextSlot());
Label skip;
@@ -2483,29 +2474,36 @@
} else if (var->mode() == LET && op != Token::INIT_LET) {
// Non-initializing assignment to let variable needs a write barrier.
- if (var->IsLookupSlot()) {
- EmitCallStoreContextSlot(var->name(), strict_mode());
- } else {
- ASSERT(var->IsStackAllocated() || var->IsContextSlot());
- Label assign;
- MemOperand location = VarOperand(var, a1);
- __ ld(a3, location);
- __ LoadRoot(a4, Heap::kTheHoleValueRootIndex);
- __ Branch(&assign, ne, a3, Operand(a4));
- __ li(a3, Operand(var->name()));
- __ push(a3);
- __ CallRuntime(Runtime::kThrowReferenceError, 1);
- // Perform the assignment.
- __ bind(&assign);
- EmitStoreToStackLocalOrContextSlot(var, location);
- }
+ ASSERT(!var->IsLookupSlot());
+ ASSERT(var->IsStackAllocated() || var->IsContextSlot());
+ Label assign;
+ MemOperand location = VarOperand(var, a1);
+ __ ld(a3, location);
+ __ LoadRoot(a4, Heap::kTheHoleValueRootIndex);
+ __ Branch(&assign, ne, a3, Operand(a4));
+ __ li(a3, Operand(var->name()));
+ __ push(a3);
+ __ CallRuntime(Runtime::kThrowReferenceError, 1);
+ // Perform the assignment.
+ __ bind(&assign);
+ EmitStoreToStackLocalOrContextSlot(var, location);
} else if (!var->is_const_mode() || op == Token::INIT_CONST) {
- // Assignment to var or initializing assignment to let/const
- // in harmony mode.
if (var->IsLookupSlot()) {
- EmitCallStoreContextSlot(var->name(), strict_mode());
+ ASSERT(op == Token::ASSIGN || op == Token::INIT_VAR ||
+ op == Token::ASSIGN_ADD);
+ // Assignment to var.
+ __ li(a4, Operand(var->name()));
+ __ li(a3, Operand(Smi::FromInt(strict_mode())));
+ // jssp[0] : mode.
+ // jssp[8] : name.
+ // jssp[16] : context.
+ // jssp[24] : value.
+ __ Push(v0, cp, a4, a3);
+ __ CallRuntime(Runtime::kStoreLookupSlot, 4);
} else {
+ // Assignment to var or initializing assignment to let/const in
harmony
+ // mode.
ASSERT((var->IsStackAllocated() || var->IsContextSlot()));
MemOperand location = VarOperand(var, a1);
if (generate_debug_code_ && op == Token::INIT_LET) {
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.