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

Unified Diff: src/scopes.cc

Issue 1224793002: Loads and stores to global vars are now made via property cell shortcuts installed into parent scri… (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Addressing comments 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/runtime/runtime-object.cc ('k') | src/x64/full-codegen-x64.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/scopes.cc
diff --git a/src/scopes.cc b/src/scopes.cc
index f9eef9ab21d990c191df5aee894803c8682700e1..d6a414b32050e2552b3405530fe323b0966e40e2 100644
--- a/src/scopes.cc
+++ b/src/scopes.cc
@@ -14,9 +14,6 @@
namespace v8 {
namespace internal {
-// TODO(ishell): remove this once compiler support is landed.
-bool enable_context_globals = false;
-
// ----------------------------------------------------------------------------
// Implementation of LocalsMap
//
@@ -1478,14 +1475,19 @@ void Scope::AllocateDeclaredGlobal(Isolate* isolate, Variable* var) {
DCHECK(var->scope() == this);
DCHECK(!var->IsVariable(isolate->factory()->dot_result_string()) ||
!var->IsStackLocal());
- if (var->IsUnallocated() && var->IsStaticGlobalObjectProperty()) {
- DCHECK_EQ(-1, var->index());
- DCHECK(var->name()->IsString());
- var->AllocateTo(VariableLocation::GLOBAL, num_heap_slots_);
- num_global_slots_++;
- // Each global variable occupies two slots in the context: for reads
- // and writes.
- num_heap_slots_ += 2;
+ if (var->IsUnallocated()) {
+ if (var->IsStaticGlobalObjectProperty()) {
+ DCHECK_EQ(-1, var->index());
+ DCHECK(var->name()->IsString());
+ var->AllocateTo(VariableLocation::GLOBAL, num_heap_slots_);
+ num_global_slots_++;
+ // Each global variable occupies two slots in the context: for reads
+ // and writes.
+ num_heap_slots_ += 2;
+ } else {
+ // There must be only DYNAMIC_GLOBAL in the script scope.
+ DCHECK(!is_script_scope() || DYNAMIC_GLOBAL == var->mode());
+ }
}
}
@@ -1513,7 +1515,7 @@ void Scope::AllocateNonParameterLocalsAndDeclaredGlobals(Isolate* isolate) {
AllocateNonParameterLocal(isolate, vars[i].var());
}
- if (enable_context_globals) {
+ if (FLAG_global_var_shortcuts) {
for (int i = 0; i < var_count; i++) {
AllocateDeclaredGlobal(isolate, vars[i].var());
}
« no previous file with comments | « src/runtime/runtime-object.cc ('k') | src/x64/full-codegen-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698