Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(150)

Unified Diff: src/full-codegen/mips/full-codegen-mips.cc

Issue 2615033002: [fullcodegen] Remove dead hole check logic (Closed)
Patch Set: x87 Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/full-codegen/ia32/full-codegen-ia32.cc ('k') | src/full-codegen/mips64/full-codegen-mips64.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/full-codegen/mips/full-codegen-mips.cc
diff --git a/src/full-codegen/mips/full-codegen-mips.cc b/src/full-codegen/mips/full-codegen-mips.cc
index 4c25738349cb0accea6cadb6c4a007ea0af04ccd..e49b6b72ca6380c6f478501e3f2c78dbb842476c 100644
--- a/src/full-codegen/mips/full-codegen-mips.cc
+++ b/src/full-codegen/mips/full-codegen-mips.cc
@@ -754,9 +754,9 @@ void FullCodeGenerator::VisitVariableDeclaration(
VariableDeclaration* declaration) {
VariableProxy* proxy = declaration->proxy();
Variable* variable = proxy->var();
+ DCHECK(!variable->binding_needs_init());
switch (variable->location()) {
case VariableLocation::UNALLOCATED: {
- DCHECK(!variable->binding_needs_init());
globals_->Add(variable->name(), zone());
FeedbackVectorSlot slot = proxy->VariableFeedbackSlot();
DCHECK(!slot.IsInvalid());
@@ -766,22 +766,7 @@ void FullCodeGenerator::VisitVariableDeclaration(
}
case VariableLocation::PARAMETER:
case VariableLocation::LOCAL:
- if (variable->binding_needs_init()) {
- Comment cmnt(masm_, "[ VariableDeclaration");
- __ LoadRoot(t0, Heap::kTheHoleValueRootIndex);
- __ sw(t0, StackOperand(variable));
- }
- break;
-
case VariableLocation::CONTEXT:
- if (variable->binding_needs_init()) {
- Comment cmnt(masm_, "[ VariableDeclaration");
- EmitDebugCheckDeclarationContext(variable);
- __ LoadRoot(at, Heap::kTheHoleValueRootIndex);
- __ sw(at, ContextMemOperand(cp, variable->index()));
- // No write barrier since the_hole_value is in old space.
- PrepareForBailoutForId(proxy->id(), BailoutState::NO_REGISTERS);
- }
break;
case VariableLocation::LOOKUP:
@@ -1146,6 +1131,7 @@ void FullCodeGenerator::EmitVariableLoad(VariableProxy* proxy,
SetExpressionPosition(proxy);
PrepareForBailoutForId(proxy->BeforeId(), BailoutState::NO_REGISTERS);
Variable* var = proxy->var();
+ DCHECK(!var->binding_needs_init());
// Two cases: global variables and all other types of variables.
switch (var->location()) {
@@ -1162,21 +1148,6 @@ void FullCodeGenerator::EmitVariableLoad(VariableProxy* proxy,
DCHECK_EQ(NOT_INSIDE_TYPEOF, typeof_mode);
Comment cmnt(masm_, var->IsContextSlot() ? "[ Context variable"
: "[ Stack variable");
- if (proxy->hole_check_mode() == HoleCheckMode::kRequired) {
- // Throw a reference error when using an uninitialized let/const
- // binding in harmony mode.
- Label done;
- GetVar(v0, var);
- __ LoadRoot(at, Heap::kTheHoleValueRootIndex);
- __ subu(at, v0, at); // Sub as compare: at == 0 on eq.
- __ Branch(&done, ne, at, Operand(zero_reg));
- __ li(a0, Operand(var->name()));
- __ push(a0);
- __ CallRuntime(Runtime::kThrowReferenceError);
- __ bind(&done);
- context()->Plug(v0);
- break;
- }
context()->Plug(var);
break;
}
@@ -1495,8 +1466,7 @@ void FullCodeGenerator::VisitAssignment(Assignment* expr) {
switch (assign_type) {
case VARIABLE: {
VariableProxy* proxy = expr->target()->AsVariableProxy();
- EmitVariableAssignment(proxy->var(), expr->op(), expr->AssignmentSlot(),
- proxy->hole_check_mode());
+ EmitVariableAssignment(proxy->var(), expr->op(), expr->AssignmentSlot());
PrepareForBailoutForId(expr->AssignmentId(), BailoutState::TOS_REGISTER);
context()->Plug(v0);
break;
@@ -1688,8 +1658,7 @@ void FullCodeGenerator::EmitAssignment(Expression* expr,
case VARIABLE: {
VariableProxy* proxy = expr->AsVariableProxy();
EffectContext context(this);
- EmitVariableAssignment(proxy->var(), Token::ASSIGN, slot,
- proxy->hole_check_mode());
+ EmitVariableAssignment(proxy->var(), Token::ASSIGN, slot);
break;
}
case NAMED_PROPERTY: {
@@ -1732,61 +1701,23 @@ void FullCodeGenerator::EmitStoreToStackLocalOrContextSlot(
}
void FullCodeGenerator::EmitVariableAssignment(Variable* var, Token::Value op,
- FeedbackVectorSlot slot,
- HoleCheckMode hole_check_mode) {
+ FeedbackVectorSlot slot) {
+ DCHECK(!var->binding_needs_init());
if (var->IsUnallocated()) {
// Global var, const, or let.
__ mov(StoreDescriptor::ValueRegister(), result_register());
__ LoadGlobalObject(StoreDescriptor::ReceiverRegister());
CallStoreIC(slot, var->name());
- } else if (IsLexicalVariableMode(var->mode()) && op != Token::INIT) {
- DCHECK(!var->IsLookupSlot());
- DCHECK(var->IsStackAllocated() || var->IsContextSlot());
- MemOperand location = VarOperand(var, a1);
- // Perform an initialization check for lexically declared variables.
- if (hole_check_mode == HoleCheckMode::kRequired) {
- Label assign;
- __ lw(a3, location);
- __ LoadRoot(t0, Heap::kTheHoleValueRootIndex);
- __ Branch(&assign, ne, a3, Operand(t0));
- __ li(a3, Operand(var->name()));
- __ push(a3);
- __ CallRuntime(Runtime::kThrowReferenceError);
- __ bind(&assign);
- }
- if (var->mode() != CONST) {
- EmitStoreToStackLocalOrContextSlot(var, location);
- } else if (var->throw_on_const_assignment(language_mode())) {
+ } else if (var->mode() == CONST && op != Token::INIT) {
+ if (var->throw_on_const_assignment(language_mode())) {
__ CallRuntime(Runtime::kThrowConstAssignError);
}
- } else if (var->is_this() && var->mode() == CONST && op == Token::INIT) {
- // Initializing assignment to const {this} needs a write barrier.
- DCHECK(var->IsStackAllocated() || var->IsContextSlot());
- Label uninitialized_this;
- MemOperand location = VarOperand(var, a1);
- __ lw(a3, location);
- __ LoadRoot(at, Heap::kTheHoleValueRootIndex);
- __ Branch(&uninitialized_this, eq, a3, Operand(at));
- __ li(a0, Operand(var->name()));
- __ Push(a0);
- __ CallRuntime(Runtime::kThrowReferenceError);
- __ bind(&uninitialized_this);
- EmitStoreToStackLocalOrContextSlot(var, location);
-
} else {
- DCHECK(var->mode() != CONST || op == Token::INIT);
+ DCHECK(!var->is_this());
DCHECK((var->IsStackAllocated() || var->IsContextSlot()));
DCHECK(!var->IsLookupSlot());
- // Assignment to var or initializing assignment to let/const in harmony
- // mode.
MemOperand location = VarOperand(var, a1);
- if (FLAG_debug_code && var->mode() == LET && op == Token::INIT) {
- // Check for an uninitialized let binding.
- __ lw(a2, location);
- __ LoadRoot(t0, Heap::kTheHoleValueRootIndex);
- __ Check(eq, kLetBindingReInitialization, a2, Operand(t0));
- }
EmitStoreToStackLocalOrContextSlot(var, location);
}
}
@@ -2528,8 +2459,8 @@ void FullCodeGenerator::VisitCountOperation(CountOperation* expr) {
VariableProxy* proxy = expr->expression()->AsVariableProxy();
if (expr->is_postfix()) {
{ EffectContext context(this);
- EmitVariableAssignment(proxy->var(), Token::ASSIGN, expr->CountSlot(),
- proxy->hole_check_mode());
+ EmitVariableAssignment(proxy->var(), Token::ASSIGN,
+ expr->CountSlot());
PrepareForBailoutForId(expr->AssignmentId(),
BailoutState::TOS_REGISTER);
context.Plug(v0);
@@ -2540,8 +2471,7 @@ void FullCodeGenerator::VisitCountOperation(CountOperation* expr) {
context()->PlugTOS();
}
} else {
- EmitVariableAssignment(proxy->var(), Token::ASSIGN, expr->CountSlot(),
- proxy->hole_check_mode());
+ EmitVariableAssignment(proxy->var(), Token::ASSIGN, expr->CountSlot());
PrepareForBailoutForId(expr->AssignmentId(),
BailoutState::TOS_REGISTER);
context()->Plug(v0);
« no previous file with comments | « src/full-codegen/ia32/full-codegen-ia32.cc ('k') | src/full-codegen/mips64/full-codegen-mips64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698