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

Unified Diff: src/scopeinfo.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/hydrogen.cc ('k') | src/scopes.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/scopeinfo.cc
diff --git a/src/scopeinfo.cc b/src/scopeinfo.cc
index c79a98060cccb039999c811e0e5ac626bb10a2e4..fda3b1bd38978c68a3618981ed4728393958e2a1 100644
--- a/src/scopeinfo.cc
+++ b/src/scopeinfo.cc
@@ -340,7 +340,7 @@ int ScopeInfo::ContextLength() {
scope_type() == MODULE_SCOPE;
if (has_context) {
- return Context::MIN_CONTEXT_SLOTS + context_locals + 2 * context_globals +
+ return Context::MIN_CONTEXT_SLOTS + context_locals + context_globals +
(function_name_context_slot ? 1 : 0);
}
}
@@ -553,7 +553,7 @@ int ScopeInfo::ContextSlotIndex(Handle<ScopeInfo> scope_info,
var -= scope_info->ContextLocalCount();
*location = VariableLocation::GLOBAL;
result = Context::MIN_CONTEXT_SLOTS +
- scope_info->ContextLocalCount() + 2 * var;
+ scope_info->ContextLocalCount() + var;
}
context_slot_cache->Update(scope_info, name, *mode, *location,
@@ -573,15 +573,10 @@ int ScopeInfo::ContextSlotIndex(Handle<ScopeInfo> scope_info,
String* ScopeInfo::ContextSlotName(int slot_index) {
- // TODO(bmeurer): Simplify this once we have only a single slot for both reads
- // and writes to context globals; currently we have 2 slots per context
- // global, and these are located after the common context slots (of which we
- // always have Context::MIN_CONTEXT_SLOTS) and the context locals.
- int const var =
- slot_index - (Context::MIN_CONTEXT_SLOTS + ContextLocalCount());
+ int const var = slot_index - Context::MIN_CONTEXT_SLOTS;
DCHECK_LE(0, var);
- DCHECK_LT(var, 2 * ContextGlobalCount());
- return ContextLocalName(ContextLocalCount() + var / 2);
+ DCHECK_LT(var, ContextLocalCount() + ContextGlobalCount());
+ return ContextLocalName(var);
}
« no previous file with comments | « src/hydrogen.cc ('k') | src/scopes.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698