| Index: src/ia32/full-codegen-ia32.cc
|
| diff --git a/src/ia32/full-codegen-ia32.cc b/src/ia32/full-codegen-ia32.cc
|
| index 132a949bd073100cdb68c4a23d323c5220330558..5fd4414a802b707f6db37c1125e7c446782e4e52 100644
|
| --- a/src/ia32/full-codegen-ia32.cc
|
| +++ b/src/ia32/full-codegen-ia32.cc
|
| @@ -353,7 +353,7 @@ void FullCodeGenerator::Generate() {
|
| VariableDeclaration* function = scope()->function();
|
| DCHECK(function->proxy()->var()->mode() == CONST ||
|
| function->proxy()->var()->mode() == CONST_LEGACY);
|
| - DCHECK(function->proxy()->var()->location() != Variable::UNALLOCATED);
|
| + DCHECK(!function->proxy()->var()->IsUnallocatedOrGlobalSlot());
|
| VisitVariableDeclaration(function);
|
| }
|
| VisitDeclarations(scope()->declarations());
|
| @@ -823,15 +823,16 @@ void FullCodeGenerator::VisitVariableDeclaration(
|
| Variable* variable = proxy->var();
|
| bool hole_init = mode == LET || mode == CONST || mode == CONST_LEGACY;
|
| switch (variable->location()) {
|
| - case Variable::UNALLOCATED:
|
| + case VariableLocation::GLOBAL:
|
| + case VariableLocation::UNALLOCATED:
|
| globals_->Add(variable->name(), zone());
|
| globals_->Add(variable->binding_needs_init()
|
| ? isolate()->factory()->the_hole_value()
|
| : isolate()->factory()->undefined_value(), zone());
|
| break;
|
|
|
| - case Variable::PARAMETER:
|
| - case Variable::LOCAL:
|
| + case VariableLocation::PARAMETER:
|
| + case VariableLocation::LOCAL:
|
| if (hole_init) {
|
| Comment cmnt(masm_, "[ VariableDeclaration");
|
| __ mov(StackOperand(variable),
|
| @@ -839,7 +840,7 @@ void FullCodeGenerator::VisitVariableDeclaration(
|
| }
|
| break;
|
|
|
| - case Variable::CONTEXT:
|
| + case VariableLocation::CONTEXT:
|
| if (hole_init) {
|
| Comment cmnt(masm_, "[ VariableDeclaration");
|
| EmitDebugCheckDeclarationContext(variable);
|
| @@ -850,7 +851,7 @@ void FullCodeGenerator::VisitVariableDeclaration(
|
| }
|
| break;
|
|
|
| - case Variable::LOOKUP: {
|
| + case VariableLocation::LOOKUP: {
|
| Comment cmnt(masm_, "[ VariableDeclaration");
|
| __ push(esi);
|
| __ push(Immediate(variable->name()));
|
| @@ -880,7 +881,8 @@ void FullCodeGenerator::VisitFunctionDeclaration(
|
| VariableProxy* proxy = declaration->proxy();
|
| Variable* variable = proxy->var();
|
| switch (variable->location()) {
|
| - case Variable::UNALLOCATED: {
|
| + case VariableLocation::GLOBAL:
|
| + case VariableLocation::UNALLOCATED: {
|
| globals_->Add(variable->name(), zone());
|
| Handle<SharedFunctionInfo> function =
|
| Compiler::GetSharedFunctionInfo(declaration->fun(), script(), info_);
|
| @@ -890,15 +892,15 @@ void FullCodeGenerator::VisitFunctionDeclaration(
|
| break;
|
| }
|
|
|
| - case Variable::PARAMETER:
|
| - case Variable::LOCAL: {
|
| + case VariableLocation::PARAMETER:
|
| + case VariableLocation::LOCAL: {
|
| Comment cmnt(masm_, "[ FunctionDeclaration");
|
| VisitForAccumulatorValue(declaration->fun());
|
| __ mov(StackOperand(variable), result_register());
|
| break;
|
| }
|
|
|
| - case Variable::CONTEXT: {
|
| + case VariableLocation::CONTEXT: {
|
| Comment cmnt(masm_, "[ FunctionDeclaration");
|
| EmitDebugCheckDeclarationContext(variable);
|
| VisitForAccumulatorValue(declaration->fun());
|
| @@ -915,7 +917,7 @@ void FullCodeGenerator::VisitFunctionDeclaration(
|
| break;
|
| }
|
|
|
| - case Variable::LOOKUP: {
|
| + case VariableLocation::LOOKUP: {
|
| Comment cmnt(masm_, "[ FunctionDeclaration");
|
| __ push(esi);
|
| __ push(Immediate(variable->name()));
|
| @@ -932,20 +934,21 @@ void FullCodeGenerator::VisitImportDeclaration(ImportDeclaration* declaration) {
|
| VariableProxy* proxy = declaration->proxy();
|
| Variable* variable = proxy->var();
|
| switch (variable->location()) {
|
| - case Variable::UNALLOCATED:
|
| + case VariableLocation::GLOBAL:
|
| + case VariableLocation::UNALLOCATED:
|
| // TODO(rossberg)
|
| break;
|
|
|
| - case Variable::CONTEXT: {
|
| + case VariableLocation::CONTEXT: {
|
| Comment cmnt(masm_, "[ ImportDeclaration");
|
| EmitDebugCheckDeclarationContext(variable);
|
| // TODO(rossberg)
|
| break;
|
| }
|
|
|
| - case Variable::PARAMETER:
|
| - case Variable::LOCAL:
|
| - case Variable::LOOKUP:
|
| + case VariableLocation::PARAMETER:
|
| + case VariableLocation::LOCAL:
|
| + case VariableLocation::LOOKUP:
|
| UNREACHABLE();
|
| }
|
| }
|
| @@ -1426,7 +1429,8 @@ void FullCodeGenerator::EmitVariableLoad(VariableProxy* proxy) {
|
| // Three cases: global variables, lookup variables, and all other types of
|
| // variables.
|
| switch (var->location()) {
|
| - case Variable::UNALLOCATED: {
|
| + case VariableLocation::GLOBAL:
|
| + case VariableLocation::UNALLOCATED: {
|
| Comment cmnt(masm_, "[ Global variable");
|
| __ mov(LoadDescriptor::ReceiverRegister(), GlobalObjectOperand());
|
| __ mov(LoadDescriptor::NameRegister(), var->name());
|
| @@ -1437,9 +1441,9 @@ void FullCodeGenerator::EmitVariableLoad(VariableProxy* proxy) {
|
| break;
|
| }
|
|
|
| - case Variable::PARAMETER:
|
| - case Variable::LOCAL:
|
| - case Variable::CONTEXT: {
|
| + case VariableLocation::PARAMETER:
|
| + case VariableLocation::LOCAL:
|
| + case VariableLocation::CONTEXT: {
|
| Comment cmnt(masm_, var->IsContextSlot() ? "[ Context variable"
|
| : "[ Stack variable");
|
| if (var->binding_needs_init()) {
|
| @@ -1507,7 +1511,7 @@ void FullCodeGenerator::EmitVariableLoad(VariableProxy* proxy) {
|
| break;
|
| }
|
|
|
| - case Variable::LOOKUP: {
|
| + case VariableLocation::LOOKUP: {
|
| Comment cmnt(masm_, "[ Lookup variable");
|
| Label done, slow;
|
| // Generate code for loading from variables potentially shadowed
|
| @@ -2645,7 +2649,7 @@ void FullCodeGenerator::EmitStoreToStackLocalOrContextSlot(
|
|
|
| void FullCodeGenerator::EmitVariableAssignment(Variable* var, Token::Value op,
|
| FeedbackVectorICSlot slot) {
|
| - if (var->IsUnallocated()) {
|
| + if (var->IsUnallocatedOrGlobalSlot()) {
|
| // Global var, const, or let.
|
| __ mov(StoreDescriptor::NameRegister(), var->name());
|
| __ mov(StoreDescriptor::ReceiverRegister(), GlobalObjectOperand());
|
| @@ -4728,7 +4732,7 @@ void FullCodeGenerator::VisitUnaryOperation(UnaryOperation* expr) {
|
| // "delete this" is allowed.
|
| bool is_this = var->HasThisName(isolate());
|
| DCHECK(is_sloppy(language_mode()) || is_this);
|
| - if (var->IsUnallocated()) {
|
| + if (var->IsUnallocatedOrGlobalSlot()) {
|
| __ push(GlobalObjectOperand());
|
| __ push(Immediate(var->name()));
|
| __ push(Immediate(Smi::FromInt(SLOPPY)));
|
| @@ -5093,7 +5097,7 @@ void FullCodeGenerator::VisitForTypeofValue(Expression* expr) {
|
| DCHECK(!context()->IsEffect());
|
| DCHECK(!context()->IsTest());
|
|
|
| - if (proxy != NULL && proxy->var()->IsUnallocated()) {
|
| + if (proxy != NULL && proxy->var()->IsUnallocatedOrGlobalSlot()) {
|
| Comment cmnt(masm_, "[ Global variable");
|
| __ mov(LoadDescriptor::ReceiverRegister(), GlobalObjectOperand());
|
| __ mov(LoadDescriptor::NameRegister(), Immediate(proxy->name()));
|
|
|