| 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 10 matching lines...) Expand all Loading... |
| 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_CONTEXTS_H_ | 28 #ifndef V8_CONTEXTS_H_ |
| 29 #define V8_CONTEXTS_H_ | 29 #define V8_CONTEXTS_H_ |
| 30 | 30 |
| 31 #include "isolate.h" | |
| 32 | |
| 33 namespace v8 { | 31 namespace v8 { |
| 34 namespace internal { | 32 namespace internal { |
| 35 | 33 |
| 36 | 34 |
| 37 enum ContextLookupFlags { | 35 enum ContextLookupFlags { |
| 38 FOLLOW_CONTEXT_CHAIN = 1, | 36 FOLLOW_CONTEXT_CHAIN = 1, |
| 39 FOLLOW_PROTOTYPE_CHAIN = 2, | 37 FOLLOW_PROTOTYPE_CHAIN = 2, |
| 40 | 38 |
| 41 DONT_FOLLOW_CHAINS = 0, | 39 DONT_FOLLOW_CHAINS = 0, |
| 42 FOLLOW_CHAINS = FOLLOW_CONTEXT_CHAIN | FOLLOW_PROTOTYPE_CHAIN | 40 FOLLOW_CHAINS = FOLLOW_CONTEXT_CHAIN | FOLLOW_PROTOTYPE_CHAIN |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 255 // The builtins object. | 253 // The builtins object. |
| 256 JSBuiltinsObject* builtins(); | 254 JSBuiltinsObject* builtins(); |
| 257 | 255 |
| 258 // Compute the global context by traversing the context chain. | 256 // Compute the global context by traversing the context chain. |
| 259 Context* global_context(); | 257 Context* global_context(); |
| 260 | 258 |
| 261 // Tells if this is a function context (as opposed to a 'with' context). | 259 // Tells if this is a function context (as opposed to a 'with' context). |
| 262 bool is_function_context() { return unchecked_previous() == NULL; } | 260 bool is_function_context() { return unchecked_previous() == NULL; } |
| 263 | 261 |
| 264 // Tells whether the global context is marked with out of memory. | 262 // Tells whether the global context is marked with out of memory. |
| 265 bool has_out_of_memory() { | 263 inline bool has_out_of_memory(); |
| 266 return global_context()->out_of_memory() == HEAP->true_value(); | |
| 267 } | |
| 268 | 264 |
| 269 // Mark the global context with out of memory. | 265 // Mark the global context with out of memory. |
| 270 void mark_out_of_memory() { | 266 inline void mark_out_of_memory(); |
| 271 global_context()->set_out_of_memory(HEAP->true_value()); | |
| 272 } | |
| 273 | 267 |
| 274 // The exception holder is the object used as a with object in | 268 // The exception holder is the object used as a with object in |
| 275 // the implementation of a catch block. | 269 // the implementation of a catch block. |
| 276 bool is_exception_holder(Object* object) { | 270 bool is_exception_holder(Object* object) { |
| 277 return IsCatchContext() && extension() == object; | 271 return IsCatchContext() && extension() == object; |
| 278 } | 272 } |
| 279 | 273 |
| 280 #define GLOBAL_CONTEXT_FIELD_ACCESSORS(index, type, name) \ | 274 #define GLOBAL_CONTEXT_FIELD_ACCESSORS(index, type, name) \ |
| 281 void set_##name(type* value) { \ | 275 void set_##name(type* value) { \ |
| 282 ASSERT(IsGlobalContext()); \ | 276 ASSERT(IsGlobalContext()); \ |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 335 #ifdef DEBUG | 329 #ifdef DEBUG |
| 336 // Bootstrapping-aware type checks. | 330 // Bootstrapping-aware type checks. |
| 337 static bool IsBootstrappingOrContext(Object* object); | 331 static bool IsBootstrappingOrContext(Object* object); |
| 338 static bool IsBootstrappingOrGlobalObject(Object* object); | 332 static bool IsBootstrappingOrGlobalObject(Object* object); |
| 339 #endif | 333 #endif |
| 340 }; | 334 }; |
| 341 | 335 |
| 342 } } // namespace v8::internal | 336 } } // namespace v8::internal |
| 343 | 337 |
| 344 #endif // V8_CONTEXTS_H_ | 338 #endif // V8_CONTEXTS_H_ |
| OLD | NEW |