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

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

Issue 1218783005: Support for global var shortcuts in script contexts. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fixing builds Created 5 years, 5 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/arm/full-codegen-arm.cc ('k') | src/ast.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/arm64/full-codegen-arm64.cc
diff --git a/src/arm64/full-codegen-arm64.cc b/src/arm64/full-codegen-arm64.cc
index 0345751dfc7c3c6d8047139f388be000e0c99c31..ece201775f96e6ca35ce95fd89731c7c9f54f073 100644
--- a/src/arm64/full-codegen-arm64.cc
+++ b/src/arm64/full-codegen-arm64.cc
@@ -354,7 +354,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());
@@ -873,7 +873,8 @@ void FullCodeGenerator::VisitVariableDeclaration(
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()
@@ -881,8 +882,8 @@ void FullCodeGenerator::VisitVariableDeclaration(
zone());
break;
- case Variable::PARAMETER:
- case Variable::LOCAL:
+ case VariableLocation::PARAMETER:
+ case VariableLocation::LOCAL:
if (hole_init) {
Comment cmnt(masm_, "[ VariableDeclaration");
__ LoadRoot(x10, Heap::kTheHoleValueRootIndex);
@@ -890,7 +891,7 @@ void FullCodeGenerator::VisitVariableDeclaration(
}
break;
- case Variable::CONTEXT:
+ case VariableLocation::CONTEXT:
if (hole_init) {
Comment cmnt(masm_, "[ VariableDeclaration");
EmitDebugCheckDeclarationContext(variable);
@@ -901,7 +902,7 @@ void FullCodeGenerator::VisitVariableDeclaration(
}
break;
- case Variable::LOOKUP: {
+ case VariableLocation::LOOKUP: {
Comment cmnt(masm_, "[ VariableDeclaration");
__ Mov(x2, Operand(variable->name()));
// Declaration nodes are always introduced in one of four modes.
@@ -932,7 +933,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_);
@@ -942,15 +944,15 @@ void FullCodeGenerator::VisitFunctionDeclaration(
break;
}
- case Variable::PARAMETER:
- case Variable::LOCAL: {
+ case VariableLocation::PARAMETER:
+ case VariableLocation::LOCAL: {
Comment cmnt(masm_, "[ Function Declaration");
VisitForAccumulatorValue(declaration->fun());
__ Str(result_register(), StackOperand(variable));
break;
}
- case Variable::CONTEXT: {
+ case VariableLocation::CONTEXT: {
Comment cmnt(masm_, "[ Function Declaration");
EmitDebugCheckDeclarationContext(variable);
VisitForAccumulatorValue(declaration->fun());
@@ -969,7 +971,7 @@ void FullCodeGenerator::VisitFunctionDeclaration(
break;
}
- case Variable::LOOKUP: {
+ case VariableLocation::LOOKUP: {
Comment cmnt(masm_, "[ Function Declaration");
__ Mov(x2, Operand(variable->name()));
__ Mov(x1, Smi::FromInt(NONE));
@@ -987,20 +989,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();
}
}
@@ -1478,7 +1481,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");
__ Ldr(LoadDescriptor::ReceiverRegister(), GlobalObjectMemOperand());
__ Mov(LoadDescriptor::NameRegister(), Operand(var->name()));
@@ -1489,9 +1493,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");
@@ -1561,7 +1565,7 @@ void FullCodeGenerator::EmitVariableLoad(VariableProxy* proxy) {
break;
}
- case Variable::LOOKUP: {
+ case VariableLocation::LOOKUP: {
Label done, slow;
// Generate code for loading from variables potentially shadowed by
// eval-introduced variables.
@@ -2423,7 +2427,7 @@ void FullCodeGenerator::EmitStoreToStackLocalOrContextSlot(
void FullCodeGenerator::EmitVariableAssignment(Variable* var, Token::Value op,
FeedbackVectorICSlot slot) {
ASM_LOCATION("FullCodeGenerator::EmitVariableAssignment");
- if (var->IsUnallocated()) {
+ if (var->IsUnallocatedOrGlobalSlot()) {
// Global var, const, or let.
__ Mov(StoreDescriptor::NameRegister(), Operand(var->name()));
__ Ldr(StoreDescriptor::ReceiverRegister(), GlobalObjectMemOperand());
@@ -4486,7 +4490,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()) {
__ Ldr(x12, GlobalObjectMemOperand());
__ Mov(x11, Operand(var->name()));
__ Mov(x10, Smi::FromInt(SLOPPY));
@@ -4841,7 +4845,7 @@ void FullCodeGenerator::VisitForTypeofValue(Expression* expr) {
DCHECK(!context()->IsEffect());
DCHECK(!context()->IsTest());
VariableProxy* proxy = expr->AsVariableProxy();
- if (proxy != NULL && proxy->var()->IsUnallocated()) {
+ if (proxy != NULL && proxy->var()->IsUnallocatedOrGlobalSlot()) {
Comment cmnt(masm_, "Global variable");
__ Ldr(LoadDescriptor::ReceiverRegister(), GlobalObjectMemOperand());
__ Mov(LoadDescriptor::NameRegister(), Operand(proxy->name()));
« no previous file with comments | « src/arm/full-codegen-arm.cc ('k') | src/ast.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698