Index: src/scopeinfo.cc |
diff --git a/src/scopeinfo.cc b/src/scopeinfo.cc |
index d62bc4129588196d3f3faf6d7c1fd035b39bbaa6..ed4705465e0e293b0baad49035bfdb38e1e32141 100644 |
--- a/src/scopeinfo.cc |
+++ b/src/scopeinfo.cc |
@@ -18,9 +18,14 @@ Handle<ScopeInfo> ScopeInfo::Create(Isolate* isolate, Zone* zone, |
// Collect stack and context locals. |
ZoneList<Variable*> stack_locals(scope->StackLocalCount(), zone); |
ZoneList<Variable*> context_locals(scope->ContextLocalCount(), zone); |
- scope->CollectStackAndContextLocals(&stack_locals, &context_locals); |
+ ZoneList<Variable*> strong_mode_free_variables(0, zone); |
+ |
+ scope->CollectStackAndContextLocals(&stack_locals, &context_locals, |
+ &strong_mode_free_variables); |
const int stack_local_count = stack_locals.length(); |
const int context_local_count = context_locals.length(); |
+ const int strong_mode_free_variable_count = |
+ strong_mode_free_variables.length(); |
// Make sure we allocate the correct amount. |
DCHECK(scope->StackLocalCount() == stack_local_count); |
DCHECK(scope->ContextLocalCount() == context_local_count); |
@@ -49,9 +54,9 @@ Handle<ScopeInfo> ScopeInfo::Create(Isolate* isolate, Zone* zone, |
const bool has_function_name = function_name_info != NONE; |
const int parameter_count = scope->num_parameters(); |
- const int length = kVariablePartIndex |
- + parameter_count + stack_local_count + 2 * context_local_count |
- + (has_function_name ? 2 : 0); |
+ const int length = kVariablePartIndex + parameter_count + stack_local_count + |
+ 2 * context_local_count + (has_function_name ? 2 : 0) + |
+ strong_mode_free_variable_count; |
Factory* factory = isolate->factory(); |
Handle<ScopeInfo> scope_info = factory->NewScopeInfo(length); |
@@ -71,6 +76,7 @@ Handle<ScopeInfo> ScopeInfo::Create(Isolate* isolate, Zone* zone, |
scope_info->SetParameterCount(parameter_count); |
scope_info->SetStackLocalCount(stack_local_count); |
scope_info->SetContextLocalCount(context_local_count); |
+ scope_info->SetStrongModeFreeVariableCount(strong_mode_free_variable_count); |
int index = kVariablePartIndex; |
// Add parameters. |
@@ -113,6 +119,11 @@ Handle<ScopeInfo> ScopeInfo::Create(Isolate* isolate, Zone* zone, |
scope_info->set(index++, Smi::FromInt(value)); |
} |
+ DCHECK(index == scope_info->StrongModeFreeVariableEntriesIndex()); |
+ for (int i = 0; i < strong_mode_free_variable_count; ++i) { |
+ scope_info->set(index++, *strong_mode_free_variables[i]->name()); |
+ } |
+ |
// If present, add the function variable name and its index. |
DCHECK(index == scope_info->FunctionNameEntryIndex()); |
if (has_function_name) { |
@@ -285,6 +296,13 @@ bool ScopeInfo::LocalIsSynthetic(int var) { |
} |
+String* ScopeInfo::StrongModeFreeVariableName(int var) { |
+ DCHECK(0 <= var && var < StrongModeFreeVariableCount()); |
+ int info_index = StrongModeFreeVariableEntriesIndex() + var; |
+ return String::cast(get(info_index)); |
+} |
+ |
+ |
int ScopeInfo::StackSlotIndex(String* name) { |
DCHECK(name->IsInternalizedString()); |
if (length() > 0) { |
@@ -432,11 +450,16 @@ int ScopeInfo::ContextLocalInfoEntriesIndex() { |
} |
-int ScopeInfo::FunctionNameEntryIndex() { |
+int ScopeInfo::StrongModeFreeVariableEntriesIndex() { |
return ContextLocalInfoEntriesIndex() + ContextLocalCount(); |
} |
+int ScopeInfo::FunctionNameEntryIndex() { |
+ return StrongModeFreeVariableEntriesIndex() + StrongModeFreeVariableCount(); |
+} |
+ |
+ |
int ContextSlotCache::Hash(Object* data, String* name) { |
// Uses only lower 32 bits if pointers are larger. |
uintptr_t addr_hash = |