Index: src/scopeinfo.cc |
diff --git a/src/scopeinfo.cc b/src/scopeinfo.cc |
index 1aa51603dbdd59be3819e27adaf7342307190284..48585eba6fde9d74a5b25e201ddc210d9ca2dba1 100644 |
--- a/src/scopeinfo.cc |
+++ b/src/scopeinfo.cc |
@@ -138,7 +138,7 @@ ScopeInfo<Allocator>::ScopeInfo(Scope* scope) |
ASSERT(proxy->var()->index() - Context::MIN_CONTEXT_SLOTS == |
context_modes_.length()); |
context_slots_.Add(FACTORY->empty_symbol()); |
- context_modes_.Add(INTERNAL); |
+ context_modes_.Add(proxy->var()->mode()); |
} |
} |
} |
@@ -181,8 +181,9 @@ ScopeInfo<Allocator>::ScopeInfo(Scope* scope) |
// present) |
-static inline Object** ReadInt(Object** p, int* x) { |
- *x = (reinterpret_cast<Smi*>(*p++))->value(); |
+template <class T> |
+static inline Object** ReadInt(Object** p, T* x) { |
+ *x = static_cast<T>((reinterpret_cast<Smi*>(*p++))->value()); |
return p; |
} |
@@ -513,16 +514,24 @@ int SerializedScopeInfo::ParameterIndex(String* name) { |
} |
-int SerializedScopeInfo::FunctionContextSlotIndex(String* name) { |
+int SerializedScopeInfo::FunctionContextSlotIndex(String* name, |
+ VariableMode* mode) { |
ASSERT(name->IsSymbol()); |
if (length() > 0) { |
Object** p = data_start(); |
if (*p == name) { |
p = ContextEntriesAddr(); |
int number_of_context_slots; |
- ReadInt(p, &number_of_context_slots); |
+ p = ReadInt(p, &number_of_context_slots); |
ASSERT(number_of_context_slots != 0); |
// The function context slot is the last entry. |
+ if (mode != NULL) { |
+ // Seek to context slot entry. |
+ p += (number_of_context_slots - 1) * 2; |
+ // Seek to mode. |
+ ++p; |
+ ReadInt(p, mode); |
+ } |
return number_of_context_slots + Context::MIN_CONTEXT_SLOTS - 1; |
} |
} |