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

Unified Diff: src/scopes.cc

Issue 1250413002: [stubs] Further optimize Load/StoreGlobalViaContext stubs. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: REBASE 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
Index: src/scopes.cc
diff --git a/src/scopes.cc b/src/scopes.cc
index 4aca42042233652d3ad0b597804793652e8b106d..65d30cae79c7abee991c9283e15d5e9afc68f7c0 100644
--- a/src/scopes.cc
+++ b/src/scopes.cc
@@ -1490,11 +1490,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());
@@ -1624,11 +1621,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
« src/flag-definitions.h ('K') | « src/scopeinfo.cc ('k') | src/x64/code-stubs-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698