| 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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 // This code is in ScopeInfo because only here we should have to know | 68 // This code is in ScopeInfo because only here we should have to know |
| 69 // about the encoding. | 69 // about the encoding. |
| 70 static void IterateScopeInfo(Code* code, ObjectVisitor* v); | 70 static void IterateScopeInfo(Code* code, ObjectVisitor* v); |
| 71 | 71 |
| 72 | 72 |
| 73 // -------------------------------------------------------------------------- | 73 // -------------------------------------------------------------------------- |
| 74 // Lookup | 74 // Lookup |
| 75 | 75 |
| 76 Handle<String> function_name() const { return function_name_; } | 76 Handle<String> function_name() const { return function_name_; } |
| 77 | 77 |
| 78 bool supports_eval() const { return supports_eval_; } | |
| 79 | |
| 80 Handle<String> parameter_name(int i) const { return parameters_[i]; } | 78 Handle<String> parameter_name(int i) const { return parameters_[i]; } |
| 81 int number_of_parameters() const { return parameters_.length(); } | 79 int number_of_parameters() const { return parameters_.length(); } |
| 82 | 80 |
| 83 Handle<String> stack_slot_name(int i) const { return stack_slots_[i]; } | 81 Handle<String> stack_slot_name(int i) const { return stack_slots_[i]; } |
| 84 int number_of_stack_slots() const { return stack_slots_.length(); } | 82 int number_of_stack_slots() const { return stack_slots_.length(); } |
| 85 | 83 |
| 86 Handle<String> context_slot_name(int i) const { | 84 Handle<String> context_slot_name(int i) const { |
| 87 return context_slots_[i - Context::MIN_CONTEXT_SLOTS]; | 85 return context_slots_[i - Context::MIN_CONTEXT_SLOTS]; |
| 88 } | 86 } |
| 89 int number_of_context_slots() const { | 87 int number_of_context_slots() const { |
| 90 int l = context_slots_.length(); | 88 int l = context_slots_.length(); |
| 91 return l == 0 ? 0 : l + Context::MIN_CONTEXT_SLOTS; | 89 return l == 0 ? 0 : l + Context::MIN_CONTEXT_SLOTS; |
| 92 } | 90 } |
| 93 | 91 |
| 94 Handle<String> LocalName(int i) const; | 92 Handle<String> LocalName(int i) const; |
| 95 int NumberOfLocals() const; | 93 int NumberOfLocals() const; |
| 96 | 94 |
| 97 | 95 |
| 98 // -------------------------------------------------------------------------- | 96 // -------------------------------------------------------------------------- |
| 99 // The following functions provide quick access to scope info details | 97 // The following functions provide quick access to scope info details |
| 100 // for runtime routines w/o the need to explicitly create a ScopeInfo | 98 // for runtime routines w/o the need to explicitly create a ScopeInfo |
| 101 // object. | 99 // object. |
| 102 // | 100 // |
| 103 // ScopeInfo is the only class which should have to know about the | 101 // ScopeInfo is the only class which should have to know about the |
| 104 // encoding of it's information in a Code object, which is why these | 102 // encoding of it's information in a Code object, which is why these |
| 105 // functions are in this class. | 103 // functions are in this class. |
| 106 | 104 |
| 107 static bool SupportsEval(Code* code); | |
| 108 | |
| 109 // Return the number of stack slots for code. | 105 // Return the number of stack slots for code. |
| 110 static int NumberOfStackSlots(Code* code); | 106 static int NumberOfStackSlots(Code* code); |
| 111 | 107 |
| 112 // Return the number of context slots for code. | 108 // Return the number of context slots for code. |
| 113 static int NumberOfContextSlots(Code* code); | 109 static int NumberOfContextSlots(Code* code); |
| 114 | 110 |
| 115 // Lookup support for scope info embedded in Code objects. Returns | 111 // Lookup support for scope info embedded in Code objects. Returns |
| 116 // the stack slot index for a given slot name if the slot is | 112 // the stack slot index for a given slot name if the slot is |
| 117 // present; otherwise returns a value < 0. The name must be a symbol | 113 // present; otherwise returns a value < 0. The name must be a symbol |
| 118 // (canonicalized). | 114 // (canonicalized). |
| (...skipping 20 matching lines...) Expand all Loading... |
| 139 | 135 |
| 140 // -------------------------------------------------------------------------- | 136 // -------------------------------------------------------------------------- |
| 141 // Debugging support | 137 // Debugging support |
| 142 | 138 |
| 143 #ifdef DEBUG | 139 #ifdef DEBUG |
| 144 void Print(); | 140 void Print(); |
| 145 #endif | 141 #endif |
| 146 | 142 |
| 147 private: | 143 private: |
| 148 Handle<String> function_name_; | 144 Handle<String> function_name_; |
| 149 bool supports_eval_; | |
| 150 List<Handle<String>, Allocator > parameters_; | 145 List<Handle<String>, Allocator > parameters_; |
| 151 List<Handle<String>, Allocator > stack_slots_; | 146 List<Handle<String>, Allocator > stack_slots_; |
| 152 List<Handle<String>, Allocator > context_slots_; | 147 List<Handle<String>, Allocator > context_slots_; |
| 153 List<Variable::Mode, Allocator > context_modes_; | 148 List<Variable::Mode, Allocator > context_modes_; |
| 154 }; | 149 }; |
| 155 | 150 |
| 156 } } // namespace v8::internal | 151 } } // namespace v8::internal |
| 157 | 152 |
| 158 #endif // V8_SCOPEINFO_H_ | 153 #endif // V8_SCOPEINFO_H_ |
| OLD | NEW |