| Index: src/scopeinfo.cc | 
| diff --git a/src/scopeinfo.cc b/src/scopeinfo.cc | 
| index 1aa51603dbdd59be3819e27adaf7342307190284..47b541ea460543d72218ddb8da1cbbc423b64e23 100644 | 
| --- a/src/scopeinfo.cc | 
| +++ b/src/scopeinfo.cc | 
| @@ -51,6 +51,7 @@ ScopeInfo<Allocator>::ScopeInfo(Scope* scope) | 
| : function_name_(FACTORY->empty_symbol()), | 
| calls_eval_(scope->calls_eval()), | 
| is_strict_mode_(scope->is_strict_mode()), | 
| +      type_(scope->type()), | 
| parameters_(scope->num_parameters()), | 
| stack_slots_(scope->num_stack_slots()), | 
| context_slots_(scope->num_heap_slots()), | 
| @@ -150,6 +151,10 @@ ScopeInfo<Allocator>::ScopeInfo(Scope* scope) | 
| // | 
| // - calls eval boolean flag | 
| // | 
| +// - is strict mode scope | 
| +// | 
| +// - scope type | 
| +// | 
| // - number of variables in the context object (smi) (= function context | 
| //   slot index + 1) | 
| // - list of pairs (name, Var mode) of context-allocated variables (starting | 
| @@ -181,8 +186,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; | 
| } | 
|  | 
| @@ -193,20 +199,21 @@ static inline Object** ReadBool(Object** p, bool* x) { | 
| } | 
|  | 
|  | 
| -static inline Object** ReadSymbol(Object** p, Handle<String>* s) { | 
| -  *s = Handle<String>(reinterpret_cast<String*>(*p++)); | 
| +template <class T> | 
| +static inline Object** ReadObject(Object** p, Handle<T>* s) { | 
| +  *s = Handle<T>::cast(Handle<Object>(*p++)); | 
| return p; | 
| } | 
|  | 
|  | 
| -template <class Allocator> | 
| -static Object** ReadList(Object** p, List<Handle<String>, Allocator >* list) { | 
| +template <class Allocator, class T> | 
| +static Object** ReadList(Object** p, List<Handle<T>, Allocator >* list) { | 
| ASSERT(list->is_empty()); | 
| int n; | 
| p = ReadInt(p, &n); | 
| while (n-- > 0) { | 
| -    Handle<String> s; | 
| -    p = ReadSymbol(p, &s); | 
| +    Handle<T> s; | 
| +    p = ReadObject(p, &s); | 
| list->Add(s); | 
| } | 
| return p; | 
| @@ -223,7 +230,7 @@ static Object** ReadList(Object** p, | 
| while (n-- > 0) { | 
| Handle<String> s; | 
| int m; | 
| -    p = ReadSymbol(p, &s); | 
| +    p = ReadObject(p, &s); | 
| p = ReadInt(p, &m); | 
| list->Add(s); | 
| modes->Add(static_cast<VariableMode>(m)); | 
| @@ -242,9 +249,10 @@ ScopeInfo<Allocator>::ScopeInfo(SerializedScopeInfo* data) | 
| if (data->length() > 0) { | 
| Object** p0 = data->data_start(); | 
| Object** p = p0; | 
| -    p = ReadSymbol(p, &function_name_); | 
| +    p = ReadObject(p, &function_name_); | 
| p = ReadBool(p, &calls_eval_); | 
| p = ReadBool(p, &is_strict_mode_); | 
| +    p = ReadInt(p, &type_); | 
| p = ReadList<Allocator>(p, &context_slots_, &context_modes_); | 
| p = ReadList<Allocator>(p, ¶meters_); | 
| p = ReadList<Allocator>(p, &stack_slots_); | 
| @@ -265,18 +273,19 @@ static inline Object** WriteBool(Object** p, bool b) { | 
| } | 
|  | 
|  | 
| -static inline Object** WriteSymbol(Object** p, Handle<String> s) { | 
| +template <class T> | 
| +static inline Object** WriteObject(Object** p, Handle<T> s) { | 
| *p++ = *s; | 
| return p; | 
| } | 
|  | 
|  | 
| -template <class Allocator> | 
| -static Object** WriteList(Object** p, List<Handle<String>, Allocator >* list) { | 
| +template <class Allocator, class T> | 
| +static Object** WriteList(Object** p, List<Handle<T>, Allocator >* list) { | 
| const int n = list->length(); | 
| p = WriteInt(p, n); | 
| for (int i = 0; i < n; i++) { | 
| -    p = WriteSymbol(p, list->at(i)); | 
| +    p = WriteObject(p, list->at(i)); | 
| } | 
| return p; | 
| } | 
| @@ -289,7 +298,7 @@ static Object** WriteList(Object** p, | 
| const int n = list->length(); | 
| p = WriteInt(p, n); | 
| for (int i = 0; i < n; i++) { | 
| -    p = WriteSymbol(p, list->at(i)); | 
| +    p = WriteObject(p, list->at(i)); | 
| p = WriteInt(p, modes->at(i)); | 
| } | 
| return p; | 
| @@ -298,8 +307,9 @@ static Object** WriteList(Object** p, | 
|  | 
| template<class Allocator> | 
| Handle<SerializedScopeInfo> ScopeInfo<Allocator>::Serialize() { | 
| -  // function name, calls eval, is_strict_mode, length for 3 tables: | 
| -  const int extra_slots = 1 + 1 + 1 + 3; | 
| +  // function name, calls eval, is_strict_mode, scope type, | 
| +  // length for 3 tables: | 
| +  const int extra_slots = 1 + 1 + 1 + 1 + 3; | 
| int length = extra_slots + | 
| context_slots_.length() * 2 + | 
| parameters_.length() + | 
| @@ -311,9 +321,10 @@ Handle<SerializedScopeInfo> ScopeInfo<Allocator>::Serialize() { | 
|  | 
| Object** p0 = data->data_start(); | 
| Object** p = p0; | 
| -  p = WriteSymbol(p, function_name_); | 
| +  p = WriteObject(p, function_name_); | 
| p = WriteBool(p, calls_eval_); | 
| p = WriteBool(p, is_strict_mode_); | 
| +  p = WriteInt(p, type_); | 
| p = WriteList(p, &context_slots_, &context_modes_); | 
| p = WriteList(p, ¶meters_); | 
| p = WriteList(p, &stack_slots_); | 
| @@ -361,8 +372,8 @@ SerializedScopeInfo* SerializedScopeInfo::Empty() { | 
|  | 
| Object** SerializedScopeInfo::ContextEntriesAddr() { | 
| ASSERT(length() > 0); | 
| -  // +3 for function name, calls eval, strict mode. | 
| -  return data_start() + 3; | 
| +  // +4 for function name, calls eval, strict mode, scope type. | 
| +  return data_start() + 4; | 
| } | 
|  | 
|  | 
| @@ -406,6 +417,16 @@ bool SerializedScopeInfo::IsStrictMode() { | 
| } | 
|  | 
|  | 
| +ScopeType SerializedScopeInfo::Type() { | 
| +  ASSERT(length() > 0); | 
| +  // +3 for function name, calls eval, strict mode. | 
| +  Object** p = data_start() + 3; | 
| +  ScopeType type; | 
| +  p = ReadInt(p, &type); | 
| +  return type; | 
| +} | 
| + | 
| + | 
| int SerializedScopeInfo::NumberOfStackSlots() { | 
| if (length() > 0) { | 
| Object** p = StackSlotEntriesAddr(); | 
| @@ -439,6 +460,12 @@ bool SerializedScopeInfo::HasHeapAllocatedLocals() { | 
| } | 
|  | 
|  | 
| +bool SerializedScopeInfo::HasContext() { | 
| +  return HasHeapAllocatedLocals() || | 
| +      Type() == WITH_SCOPE; | 
| +} | 
| + | 
| + | 
| int SerializedScopeInfo::StackSlotIndex(String* name) { | 
| ASSERT(name->IsSymbol()); | 
| if (length() > 0) { | 
|  |