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

Unified Diff: src/scopes.cc

Issue 1258213002: [stubs] Use a single slot for context globals. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: 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/scopeinfo.cc ('k') | no next file » | 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 bf580cfa74cc21b86c6ab597063645c8a74a6da4..1473b2471f59ebbd87acf6cebdbd5f3c114cfc42 100644
--- a/src/scopes.cc
+++ b/src/scopes.cc
@@ -1470,11 +1470,8 @@ void Scope::AllocateDeclaredGlobal(Isolate* isolate, Variable* var) {
if (var->IsStaticGlobalObjectProperty()) {
DCHECK_EQ(-1, var->index());
DCHECK(var->name()->IsString());
- var->AllocateTo(VariableLocation::GLOBAL, num_heap_slots_);
+ 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());
@@ -1600,11 +1597,12 @@ int Scope::ContextLocalCount() const {
if (num_heap_slots() == 0) return 0;
bool is_function_var_in_context =
function_ != NULL && function_->proxy()->var()->IsContextSlot();
- return num_heap_slots() - Context::MIN_CONTEXT_SLOTS -
- 2 * num_global_slots() - (is_function_var_in_context ? 1 : 0);
+ return num_heap_slots() - Context::MIN_CONTEXT_SLOTS - num_global_slots() -
+ (is_function_var_in_context ? 1 : 0);
}
int Scope::ContextGlobalCount() const { return num_global_slots(); }
+
} // namespace internal
} // namespace v8
« no previous file with comments | « src/scopeinfo.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698