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 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 return reinterpret_cast<Context*>(result); | 261 return reinterpret_cast<Context*>(result); |
262 } | 262 } |
263 void set_previous(Context* context) { set(PREVIOUS_INDEX, context); } | 263 void set_previous(Context* context) { set(PREVIOUS_INDEX, context); } |
264 | 264 |
265 bool has_extension() { return unchecked_extension() != NULL; } | 265 bool has_extension() { return unchecked_extension() != NULL; } |
266 JSObject* extension() { return JSObject::cast(unchecked_extension()); } | 266 JSObject* extension() { return JSObject::cast(unchecked_extension()); } |
267 void set_extension(JSObject* object) { set(EXTENSION_INDEX, object); } | 267 void set_extension(JSObject* object) { set(EXTENSION_INDEX, object); } |
268 | 268 |
269 GlobalObject* global() { | 269 GlobalObject* global() { |
270 Object* result = get(GLOBAL_INDEX); | 270 Object* result = get(GLOBAL_INDEX); |
271 ASSERT(Heap::gc_state() != Heap::NOT_IN_GC || | 271 ASSERT(IsBootstrappingOrGlobalObject(result)); |
272 IsBootstrappingOrGlobalObject(result)); | |
273 return reinterpret_cast<GlobalObject*>(result); | 272 return reinterpret_cast<GlobalObject*>(result); |
274 } | 273 } |
275 void set_global(GlobalObject* global) { set(GLOBAL_INDEX, global); } | 274 void set_global(GlobalObject* global) { set(GLOBAL_INDEX, global); } |
276 | 275 |
277 // Returns a JSGlobalProxy object or null. | 276 // Returns a JSGlobalProxy object or null. |
278 JSObject* global_proxy(); | 277 JSObject* global_proxy(); |
279 void set_global_proxy(JSObject* global); | 278 void set_global_proxy(JSObject* global); |
280 | 279 |
281 // The builtins object. | 280 // The builtins object. |
282 JSBuiltinsObject* builtins(); | 281 JSBuiltinsObject* builtins(); |
283 | 282 |
284 // Compute the global context by traversing the context chain. | 283 // Compute the global context by traversing the context chain. |
285 Context* global_context(); | 284 Context* global_context(); |
286 | 285 |
287 // Tells if this is a function context (as opposed to a 'with' context). | 286 // Tells if this is a function context (as opposed to a 'with' context). |
288 bool is_function_context() { return unchecked_previous() == NULL; } | 287 bool is_function_context() { return unchecked_previous() == NULL; } |
289 | 288 |
290 // Tells whether the global context is marked with out of memory. | 289 // Tells whether the global context is marked with out of memory. |
291 bool has_out_of_memory() { | 290 inline bool has_out_of_memory(); |
292 return global_context()->out_of_memory() == Heap::true_value(); | |
293 } | |
294 | 291 |
295 // Mark the global context with out of memory. | 292 // Mark the global context with out of memory. |
296 void mark_out_of_memory() { | 293 inline void mark_out_of_memory(); |
297 global_context()->set_out_of_memory(Heap::true_value()); | |
298 } | |
299 | 294 |
300 // The exception holder is the object used as a with object in | 295 // The exception holder is the object used as a with object in |
301 // the implementation of a catch block. | 296 // the implementation of a catch block. |
302 bool is_exception_holder(Object* object) { | 297 bool is_exception_holder(Object* object) { |
303 return IsCatchContext() && extension() == object; | 298 return IsCatchContext() && extension() == object; |
304 } | 299 } |
305 | 300 |
306 // A global context hold a list of all functions which have been optimized. | 301 // A global context hold a list of all functions which have been optimized. |
307 void AddOptimizedFunction(JSFunction* function); | 302 void AddOptimizedFunction(JSFunction* function); |
308 void RemoveOptimizedFunction(JSFunction* function); | 303 void RemoveOptimizedFunction(JSFunction* function); |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
378 #ifdef DEBUG | 373 #ifdef DEBUG |
379 // Bootstrapping-aware type checks. | 374 // Bootstrapping-aware type checks. |
380 static bool IsBootstrappingOrContext(Object* object); | 375 static bool IsBootstrappingOrContext(Object* object); |
381 static bool IsBootstrappingOrGlobalObject(Object* object); | 376 static bool IsBootstrappingOrGlobalObject(Object* object); |
382 #endif | 377 #endif |
383 }; | 378 }; |
384 | 379 |
385 } } // namespace v8::internal | 380 } } // namespace v8::internal |
386 | 381 |
387 #endif // V8_CONTEXTS_H_ | 382 #endif // V8_CONTEXTS_H_ |
OLD | NEW |