Commit 70d2c1cf authored by jyan's avatar jyan Committed by Commit bot

S390: Remove all non-function-name uses of CONST_LEGACY

Port 59546149

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, bjaideep@ca.ibm.com, michael_dawson@ca.ibm.com, mbrandy@us.ibm.com

BUG=
LOG=N

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

Cr-Commit-Position: refs/heads/master@{#35673}
parent b2a36b9e
......@@ -700,7 +700,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:
......@@ -1210,17 +1210,12 @@ void FullCodeGenerator::EmitDynamicLookupFastCase(VariableProxy* proxy,
} else if (var->mode() == DYNAMIC_LOCAL) {
Variable* local = var->local_if_not_shadowed();
__ LoadP(r2, ContextSlotOperandCheckExtensions(local, slow));
if (local->mode() == LET || local->mode() == CONST ||
local->mode() == CONST_LEGACY) {
if (local->mode() == LET || local->mode() == CONST) {
__ CompareRoot(r2, Heap::kTheHoleValueRootIndex);
__ bne(done);
if (local->mode() == CONST_LEGACY) {
__ LoadRoot(r2, Heap::kUndefinedValueRootIndex);
} else { // LET || CONST
__ mov(r2, Operand(var->name()));
__ push(r2);
__ CallRuntime(Runtime::kThrowReferenceError);
}
__ mov(r2, Operand(var->name()));
__ push(r2);
__ CallRuntime(Runtime::kThrowReferenceError);
}
__ b(done);
}
......@@ -1274,10 +1269,6 @@ void FullCodeGenerator::EmitVariableLoad(VariableProxy* proxy,
__ mov(r2, Operand(var->name()));
__ push(r2);
__ CallRuntime(Runtime::kThrowReferenceError);
} else {
// Uninitialized legacy const bindings are unholed.
DCHECK(var->mode() == CONST_LEGACY);
__ LoadRoot(r2, Heap::kUndefinedValueRootIndex);
}
__ bind(&done);
context()->Plug(r2);
......@@ -2191,8 +2182,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());
......@@ -2213,25 +2203,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(r2);
__ mov(r2, Operand(var->name()));
__ Push(cp, r2); // Context and name.
__ CallRuntime(Runtime::kInitializeLegacyConstLookupSlot);
} else {
DCHECK(var->IsStackAllocated() || var->IsContextSlot());
Label skip;
MemOperand location = VarOperand(var, r3);
__ LoadP(r4, location);
__ CompareRoot(r4, Heap::kTheHoleValueRootIndex);
__ bne(&skip);
EmitStoreToStackLocalOrContextSlot(var, location);
__ bind(&skip);
}
} else {
DCHECK(var->mode() == CONST_LEGACY && op != Token::INIT);
if (is_strict(language_mode())) {
......
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