Index: src/scopeinfo.h |
=================================================================== |
--- src/scopeinfo.h (revision 5059) |
+++ src/scopeinfo.h (working copy) |
@@ -54,17 +54,12 @@ |
// Create a ScopeInfo instance from a scope. |
explicit ScopeInfo(Scope* scope); |
- // Create a ScopeInfo instance from an Object holding the serialized data. |
- explicit ScopeInfo(Object* data); |
+ // Create a ScopeInfo instance from SerializedScopeInfo. |
+ explicit ScopeInfo(SerializedScopeInfo* data); |
- // Creates a heap object holding the serialized scope info. |
- Handle<Object> Serialize(); |
+ // Creates a SerializedScopeInfo holding the serialized scope info. |
+ Handle<SerializedScopeInfo> Serialize(); |
- static Handle<Object> CreateHeapObject(Scope* scope); |
- |
- // Serializes empty scope info. |
- static Object* EmptyHeapObject(); |
- |
// -------------------------------------------------------------------------- |
// Lookup |
@@ -88,64 +83,80 @@ |
int NumberOfLocals() const; |
// -------------------------------------------------------------------------- |
- // The following functions provide quick access to scope info details |
- // for runtime routines w/o the need to explicitly create a ScopeInfo |
- // object. |
- // |
- // ScopeInfo is the only class which should have to know about the |
- // encoding of it's information in a FixedArray object, which is why these |
- // functions are in this class. |
+ // Debugging support |
+#ifdef DEBUG |
+ void Print(); |
+#endif |
+ |
+ private: |
+ Handle<String> function_name_; |
+ bool calls_eval_; |
+ List<Handle<String>, Allocator > parameters_; |
+ List<Handle<String>, Allocator > stack_slots_; |
+ List<Handle<String>, Allocator > context_slots_; |
+ List<Variable::Mode, Allocator > context_modes_; |
+}; |
+ |
+ |
+// This object provides quick access to scope info details for runtime |
+// routines w/o the need to explicitly create a ScopeInfo object. |
+class SerializedScopeInfo : public FixedArray { |
+ public : |
+ |
+ static SerializedScopeInfo* cast(Object* object) { |
+ ASSERT(object->IsFixedArray()); |
+ return reinterpret_cast<SerializedScopeInfo*>(object); |
+ } |
+ |
// Does this scope call eval. |
- static bool CallsEval(Object* data); |
+ bool CallsEval(); |
// Return the number of stack slots for code. |
- static int NumberOfStackSlots(Object* data); |
+ int NumberOfStackSlots(); |
// Return the number of context slots for code. |
- static int NumberOfContextSlots(Object* data); |
+ int NumberOfContextSlots(); |
// Return if this has context slots besides MIN_CONTEXT_SLOTS; |
- static bool HasHeapAllocatedLocals(Object* data); |
+ bool HasHeapAllocatedLocals(); |
// Lookup support for serialized scope info. Returns the |
// the stack slot index for a given slot name if the slot is |
// present; otherwise returns a value < 0. The name must be a symbol |
// (canonicalized). |
- static int StackSlotIndex(Object* data, String* name); |
+ int StackSlotIndex(String* name); |
// Lookup support for serialized scope info. Returns the |
// context slot index for a given slot name if the slot is present; otherwise |
// returns a value < 0. The name must be a symbol (canonicalized). |
// If the slot is present and mode != NULL, sets *mode to the corresponding |
// mode for that variable. |
- static int ContextSlotIndex(Object* data, String* name, Variable::Mode* mode); |
+ int ContextSlotIndex(String* name, Variable::Mode* mode); |
// Lookup support for serialized scope info. Returns the |
// parameter index for a given parameter name if the parameter is present; |
// otherwise returns a value < 0. The name must be a symbol (canonicalized). |
- static int ParameterIndex(Object* data, String* name); |
+ int ParameterIndex(String* name); |
// Lookup support for serialized scope info. Returns the |
// function context slot index if the function name is present (named |
// function expressions, only), otherwise returns a value < 0. The name |
// must be a symbol (canonicalized). |
- static int FunctionContextSlotIndex(Object* data, String* name); |
+ int FunctionContextSlotIndex(String* name); |
- // -------------------------------------------------------------------------- |
- // Debugging support |
+ static Handle<SerializedScopeInfo> Create(Scope* scope); |
-#ifdef DEBUG |
- void Print(); |
-#endif |
+ // Serializes empty scope info. |
+ static SerializedScopeInfo* Empty(); |
private: |
- Handle<String> function_name_; |
- bool calls_eval_; |
- List<Handle<String>, Allocator > parameters_; |
- List<Handle<String>, Allocator > stack_slots_; |
- List<Handle<String>, Allocator > context_slots_; |
- List<Variable::Mode, Allocator > context_modes_; |
+ |
+ inline Object** ContextEntriesAddr(); |
+ |
+ inline Object** ParameterEntriesAddr(); |
+ |
+ inline Object** StackSlotEntriesAddr(); |
}; |