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); |
} |