| OLD | NEW |
| 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 return context_slots_[i - Context::MIN_CONTEXT_SLOTS]; | 85 return context_slots_[i - Context::MIN_CONTEXT_SLOTS]; |
| 86 } | 86 } |
| 87 int number_of_context_slots() const { | 87 int number_of_context_slots() const { |
| 88 int l = context_slots_.length(); | 88 int l = context_slots_.length(); |
| 89 return l == 0 ? 0 : l + Context::MIN_CONTEXT_SLOTS; | 89 return l == 0 ? 0 : l + Context::MIN_CONTEXT_SLOTS; |
| 90 } | 90 } |
| 91 | 91 |
| 92 Handle<String> LocalName(int i) const; | 92 Handle<String> LocalName(int i) const; |
| 93 int NumberOfLocals() const; | 93 int NumberOfLocals() const; |
| 94 | 94 |
| 95 | |
| 96 // -------------------------------------------------------------------------- | 95 // -------------------------------------------------------------------------- |
| 97 // The following functions provide quick access to scope info details | 96 // The following functions provide quick access to scope info details |
| 98 // for runtime routines w/o the need to explicitly create a ScopeInfo | 97 // for runtime routines w/o the need to explicitly create a ScopeInfo |
| 99 // object. | 98 // object. |
| 100 // | 99 // |
| 101 // ScopeInfo is the only class which should have to know about the | 100 // ScopeInfo is the only class which should have to know about the |
| 102 // encoding of it's information in a Code object, which is why these | 101 // encoding of it's information in a Code object, which is why these |
| 103 // functions are in this class. | 102 // functions are in this class. |
| 104 | 103 |
| 104 // Does this scope call eval. |
| 105 static bool CallsEval(Code* code); |
| 106 |
| 105 // Return the number of stack slots for code. | 107 // Return the number of stack slots for code. |
| 106 static int NumberOfStackSlots(Code* code); | 108 static int NumberOfStackSlots(Code* code); |
| 107 | 109 |
| 108 // Return the number of context slots for code. | 110 // Return the number of context slots for code. |
| 109 static int NumberOfContextSlots(Code* code); | 111 static int NumberOfContextSlots(Code* code); |
| 110 | 112 |
| 111 // Lookup support for scope info embedded in Code objects. Returns | 113 // Lookup support for scope info embedded in Code objects. Returns |
| 112 // the stack slot index for a given slot name if the slot is | 114 // the stack slot index for a given slot name if the slot is |
| 113 // present; otherwise returns a value < 0. The name must be a symbol | 115 // present; otherwise returns a value < 0. The name must be a symbol |
| 114 // (canonicalized). | 116 // (canonicalized). |
| (...skipping 10 matching lines...) Expand all Loading... |
| 125 // parameter index for a given parameter name if the parameter is present; | 127 // parameter index for a given parameter name if the parameter is present; |
| 126 // otherwise returns a value < 0. The name must be a symbol (canonicalized). | 128 // otherwise returns a value < 0. The name must be a symbol (canonicalized). |
| 127 static int ParameterIndex(Code* code, String* name); | 129 static int ParameterIndex(Code* code, String* name); |
| 128 | 130 |
| 129 // Lookup support for scope info embedded in Code objects. Returns the | 131 // Lookup support for scope info embedded in Code objects. Returns the |
| 130 // function context slot index if the function name is present (named | 132 // function context slot index if the function name is present (named |
| 131 // function expressions, only), otherwise returns a value < 0. The name | 133 // function expressions, only), otherwise returns a value < 0. The name |
| 132 // must be a symbol (canonicalized). | 134 // must be a symbol (canonicalized). |
| 133 static int FunctionContextSlotIndex(Code* code, String* name); | 135 static int FunctionContextSlotIndex(Code* code, String* name); |
| 134 | 136 |
| 135 | |
| 136 // -------------------------------------------------------------------------- | 137 // -------------------------------------------------------------------------- |
| 137 // Debugging support | 138 // Debugging support |
| 138 | 139 |
| 139 #ifdef DEBUG | 140 #ifdef DEBUG |
| 140 void Print(); | 141 void Print(); |
| 141 #endif | 142 #endif |
| 142 | 143 |
| 143 private: | 144 private: |
| 144 Handle<String> function_name_; | 145 Handle<String> function_name_; |
| 146 bool calls_eval_; |
| 145 List<Handle<String>, Allocator > parameters_; | 147 List<Handle<String>, Allocator > parameters_; |
| 146 List<Handle<String>, Allocator > stack_slots_; | 148 List<Handle<String>, Allocator > stack_slots_; |
| 147 List<Handle<String>, Allocator > context_slots_; | 149 List<Handle<String>, Allocator > context_slots_; |
| 148 List<Variable::Mode, Allocator > context_modes_; | 150 List<Variable::Mode, Allocator > context_modes_; |
| 149 }; | 151 }; |
| 150 | 152 |
| 151 } } // namespace v8::internal | 153 } } // namespace v8::internal |
| 152 | 154 |
| 153 #endif // V8_SCOPEINFO_H_ | 155 #endif // V8_SCOPEINFO_H_ |
| OLD | NEW |