| OLD | NEW |
| 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 |
| 11 // with the distribution. | 11 // with the distribution. |
| 12 // * Neither the name of Google Inc. nor the names of its | 12 // * Neither the name of Google Inc. nor the names of its |
| 13 // contributors may be used to endorse or promote products derived | 13 // contributors may be used to endorse or promote products derived |
| 14 // from this software without specific prior written permission. | 14 // from this software without specific prior written permission. |
| 15 // | 15 // |
| 16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | 16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | 17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | 18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | 19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 | 27 |
| 28 #ifndef V8_SCOPEINFO_H_ | 28 #ifndef V8_SCOPEINFO_H_ |
| 29 #define V8_SCOPEINFO_H_ | 29 #define V8_SCOPEINFO_H_ |
| 30 | 30 |
| 31 #include "allocation.h" |
| 31 #include "variables.h" | 32 #include "variables.h" |
| 32 #include "zone-inl.h" | 33 #include "zone-inl.h" |
| 33 | 34 |
| 34 namespace v8 { | 35 namespace v8 { |
| 35 namespace internal { | 36 namespace internal { |
| 36 | 37 |
| 37 // Scope information represents information about a functions's | 38 // Scope information represents information about a functions's |
| 38 // scopes (currently only one, because we don't do any inlining) | 39 // scopes (currently only one, because we don't do any inlining) |
| 39 // and the allocation of the scope's variables. Scope information | 40 // and the allocation of the scope's variables. Scope information |
| 40 // is stored in a compressed form in FixedArray objects and is used | 41 // is stored in a compressed form in FixedArray objects and is used |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 // -------------------------------------------------------------------------- | 86 // -------------------------------------------------------------------------- |
| 86 // Debugging support | 87 // Debugging support |
| 87 | 88 |
| 88 #ifdef DEBUG | 89 #ifdef DEBUG |
| 89 void Print(); | 90 void Print(); |
| 90 #endif | 91 #endif |
| 91 | 92 |
| 92 private: | 93 private: |
| 93 Handle<String> function_name_; | 94 Handle<String> function_name_; |
| 94 bool calls_eval_; | 95 bool calls_eval_; |
| 96 bool is_strict_mode_; |
| 95 List<Handle<String>, Allocator > parameters_; | 97 List<Handle<String>, Allocator > parameters_; |
| 96 List<Handle<String>, Allocator > stack_slots_; | 98 List<Handle<String>, Allocator > stack_slots_; |
| 97 List<Handle<String>, Allocator > context_slots_; | 99 List<Handle<String>, Allocator > context_slots_; |
| 98 List<Variable::Mode, Allocator > context_modes_; | 100 List<Variable::Mode, Allocator > context_modes_; |
| 99 }; | 101 }; |
| 100 | 102 |
| 101 | 103 |
| 102 // This object provides quick access to scope info details for runtime | 104 // This object provides quick access to scope info details for runtime |
| 103 // routines w/o the need to explicitly create a ScopeInfo object. | 105 // routines w/o the need to explicitly create a ScopeInfo object. |
| 104 class SerializedScopeInfo : public FixedArray { | 106 class SerializedScopeInfo : public FixedArray { |
| 105 public : | 107 public : |
| 106 | 108 |
| 107 static SerializedScopeInfo* cast(Object* object) { | 109 static SerializedScopeInfo* cast(Object* object) { |
| 108 ASSERT(object->IsFixedArray()); | 110 ASSERT(object->IsFixedArray()); |
| 109 return reinterpret_cast<SerializedScopeInfo*>(object); | 111 return reinterpret_cast<SerializedScopeInfo*>(object); |
| 110 } | 112 } |
| 111 | 113 |
| 112 // Does this scope call eval? | 114 // Does this scope call eval? |
| 113 bool CallsEval(); | 115 bool CallsEval(); |
| 114 | 116 |
| 117 // Is this scope a strict mode scope? |
| 118 bool IsStrictMode(); |
| 119 |
| 115 // Does this scope have an arguments shadow? | 120 // Does this scope have an arguments shadow? |
| 116 bool HasArgumentsShadow() { | 121 bool HasArgumentsShadow() { |
| 117 return StackSlotIndex(GetHeap()->arguments_shadow_symbol()) >= 0; | 122 return StackSlotIndex(GetHeap()->arguments_shadow_symbol()) >= 0; |
| 118 } | 123 } |
| 119 | 124 |
| 120 // Return the number of stack slots for code. | 125 // Return the number of stack slots for code. |
| 121 int NumberOfStackSlots(); | 126 int NumberOfStackSlots(); |
| 122 | 127 |
| 123 // Return the number of context slots for code. | 128 // Return the number of context slots for code. |
| 124 int NumberOfContextSlots(); | 129 int NumberOfContextSlots(); |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 240 uint32_t values_[kLength]; | 245 uint32_t values_[kLength]; |
| 241 | 246 |
| 242 friend class Isolate; | 247 friend class Isolate; |
| 243 DISALLOW_COPY_AND_ASSIGN(ContextSlotCache); | 248 DISALLOW_COPY_AND_ASSIGN(ContextSlotCache); |
| 244 }; | 249 }; |
| 245 | 250 |
| 246 | 251 |
| 247 } } // namespace v8::internal | 252 } } // namespace v8::internal |
| 248 | 253 |
| 249 #endif // V8_SCOPEINFO_H_ | 254 #endif // V8_SCOPEINFO_H_ |
| OLD | NEW |