PPC: Remove all non-function-name uses of CONST_LEGACY
Port 59546149c6
Original commit message:
Now that all 'const' declarations are of the ES2015 variety, the only
use of CONST_LEGACY is for function name bindings in sloppy mode
named function expressions.
This patch aims to delete all code meant to handle other cases, which
mostly had to do with hole initialization/hole checks. Since function
name bindings are initialized at entry to a function, it's impossible
to ever observe one in an uninitialized state.
To simplify the patch further, it removes the `IMPORT` VariableMode,
as it's not likely to be needed (IMPORT is identical to CONST for
the purpose of VariableMode).
R=adamk@chromium.org, joransiu@ca.ibm.com, jyan@ca.ibm.com, michael_dawson@ca.ibm.com, mbrandy@us.ibm.com
BUG=
LOG=N
Review URL: https://codereview.chromium.org/1902163003
Cr-Commit-Position: refs/heads/master@{#35635}
This commit is contained in:
parent
bef390da2a
commit
f8844a6ee1
@ -723,7 +723,7 @@ void FullCodeGenerator::VisitVariableDeclaration(
|
||||
VariableProxy* proxy = declaration->proxy();
|
||||
VariableMode mode = declaration->mode();
|
||||
Variable* variable = proxy->var();
|
||||
bool hole_init = mode == LET || mode == CONST || mode == CONST_LEGACY;
|
||||
bool hole_init = mode == LET || mode == CONST;
|
||||
switch (variable->location()) {
|
||||
case VariableLocation::GLOBAL:
|
||||
case VariableLocation::UNALLOCATED:
|
||||
@ -1246,17 +1246,12 @@ void FullCodeGenerator::EmitDynamicLookupFastCase(VariableProxy* proxy,
|
||||
} else if (var->mode() == DYNAMIC_LOCAL) {
|
||||
Variable* local = var->local_if_not_shadowed();
|
||||
__ LoadP(r3, ContextSlotOperandCheckExtensions(local, slow));
|
||||
if (local->mode() == LET || local->mode() == CONST ||
|
||||
local->mode() == CONST_LEGACY) {
|
||||
if (local->mode() == LET || local->mode() == CONST) {
|
||||
__ CompareRoot(r3, Heap::kTheHoleValueRootIndex);
|
||||
__ bne(done);
|
||||
if (local->mode() == CONST_LEGACY) {
|
||||
__ LoadRoot(r3, Heap::kUndefinedValueRootIndex);
|
||||
} else { // LET || CONST
|
||||
__ mov(r3, Operand(var->name()));
|
||||
__ push(r3);
|
||||
__ CallRuntime(Runtime::kThrowReferenceError);
|
||||
}
|
||||
__ mov(r3, Operand(var->name()));
|
||||
__ push(r3);
|
||||
__ CallRuntime(Runtime::kThrowReferenceError);
|
||||
}
|
||||
__ b(done);
|
||||
}
|
||||
@ -1312,10 +1307,6 @@ void FullCodeGenerator::EmitVariableLoad(VariableProxy* proxy,
|
||||
__ mov(r3, Operand(var->name()));
|
||||
__ push(r3);
|
||||
__ CallRuntime(Runtime::kThrowReferenceError);
|
||||
} else {
|
||||
// Uninitialized legacy const bindings are unholed.
|
||||
DCHECK(var->mode() == CONST_LEGACY);
|
||||
__ LoadRoot(r3, Heap::kUndefinedValueRootIndex);
|
||||
}
|
||||
__ bind(&done);
|
||||
context()->Plug(r3);
|
||||
@ -2238,8 +2229,7 @@ void FullCodeGenerator::EmitVariableAssignment(Variable* var, Token::Value op,
|
||||
__ bind(&uninitialized_this);
|
||||
EmitStoreToStackLocalOrContextSlot(var, location);
|
||||
|
||||
} else if (!var->is_const_mode() ||
|
||||
(var->mode() == CONST && op == Token::INIT)) {
|
||||
} else if (!var->is_const_mode() || op == Token::INIT) {
|
||||
if (var->IsLookupSlot()) {
|
||||
// Assignment to var.
|
||||
__ Push(var->name());
|
||||
@ -2260,25 +2250,6 @@ void FullCodeGenerator::EmitVariableAssignment(Variable* var, Token::Value op,
|
||||
}
|
||||
EmitStoreToStackLocalOrContextSlot(var, location);
|
||||
}
|
||||
} else if (var->mode() == CONST_LEGACY && op == Token::INIT) {
|
||||
// Const initializers need a write barrier.
|
||||
DCHECK(!var->IsParameter()); // No const parameters.
|
||||
if (var->IsLookupSlot()) {
|
||||
__ push(r3);
|
||||
__ mov(r3, Operand(var->name()));
|
||||
__ Push(cp, r3); // Context and name.
|
||||
__ CallRuntime(Runtime::kInitializeLegacyConstLookupSlot);
|
||||
} else {
|
||||
DCHECK(var->IsStackAllocated() || var->IsContextSlot());
|
||||
Label skip;
|
||||
MemOperand location = VarOperand(var, r4);
|
||||
__ LoadP(r5, location);
|
||||
__ CompareRoot(r5, Heap::kTheHoleValueRootIndex);
|
||||
__ bne(&skip);
|
||||
EmitStoreToStackLocalOrContextSlot(var, location);
|
||||
__ bind(&skip);
|
||||
}
|
||||
|
||||
} else {
|
||||
DCHECK(var->mode() == CONST_LEGACY && op != Token::INIT);
|
||||
if (is_strict(language_mode())) {
|
||||
|
Loading…
Reference in New Issue
Block a user