OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
363 | 363 |
364 JSModule* module() { return JSModule::cast(get(EXTENSION_INDEX)); } | 364 JSModule* module() { return JSModule::cast(get(EXTENSION_INDEX)); } |
365 void set_module(JSModule* module) { set(EXTENSION_INDEX, module); } | 365 void set_module(JSModule* module) { set(EXTENSION_INDEX, module); } |
366 | 366 |
367 // Get the context where var declarations will be hoisted to, which | 367 // Get the context where var declarations will be hoisted to, which |
368 // may be the context itself. | 368 // may be the context itself. |
369 Context* declaration_context(); | 369 Context* declaration_context(); |
370 | 370 |
371 GlobalObject* global_object() { | 371 GlobalObject* global_object() { |
372 Object* result = get(GLOBAL_OBJECT_INDEX); | 372 Object* result = get(GLOBAL_OBJECT_INDEX); |
373 ASSERT(IsBootstrappingOrGlobalObject(result)); | 373 ASSERT(IsBootstrappingOrGlobalObject(this->GetIsolate(), result)); |
374 return reinterpret_cast<GlobalObject*>(result); | 374 return reinterpret_cast<GlobalObject*>(result); |
375 } | 375 } |
376 void set_global_object(GlobalObject* object) { | 376 void set_global_object(GlobalObject* object) { |
377 set(GLOBAL_OBJECT_INDEX, object); | 377 set(GLOBAL_OBJECT_INDEX, object); |
378 } | 378 } |
379 | 379 |
380 // Returns a JSGlobalProxy object or null. | 380 // Returns a JSGlobalProxy object or null. |
381 JSObject* global_proxy(); | 381 JSObject* global_proxy(); |
382 void set_global_proxy(JSObject* global); | 382 void set_global_proxy(JSObject* global); |
383 | 383 |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
501 kHeaderSize + FIRST_WEAK_SLOT * kPointerSize, | 501 kHeaderSize + FIRST_WEAK_SLOT * kPointerSize, |
502 kSize> MarkCompactBodyDescriptor; | 502 kSize> MarkCompactBodyDescriptor; |
503 | 503 |
504 private: | 504 private: |
505 // Unchecked access to the slots. | 505 // Unchecked access to the slots. |
506 Object* unchecked_previous() { return get(PREVIOUS_INDEX); } | 506 Object* unchecked_previous() { return get(PREVIOUS_INDEX); } |
507 | 507 |
508 #ifdef DEBUG | 508 #ifdef DEBUG |
509 // Bootstrapping-aware type checks. | 509 // Bootstrapping-aware type checks. |
510 static bool IsBootstrappingOrValidParentContext(Object* object, Context* kid); | 510 static bool IsBootstrappingOrValidParentContext(Object* object, Context* kid); |
511 static bool IsBootstrappingOrGlobalObject(Object* object); | 511 static bool IsBootstrappingOrGlobalObject(Isolate* isolate, Object* object); |
512 #endif | 512 #endif |
513 | 513 |
514 STATIC_CHECK(kHeaderSize == Internals::kContextHeaderSize); | 514 STATIC_CHECK(kHeaderSize == Internals::kContextHeaderSize); |
515 STATIC_CHECK(EMBEDDER_DATA_INDEX == Internals::kContextEmbedderDataIndex); | 515 STATIC_CHECK(EMBEDDER_DATA_INDEX == Internals::kContextEmbedderDataIndex); |
516 }; | 516 }; |
517 | 517 |
518 } } // namespace v8::internal | 518 } } // namespace v8::internal |
519 | 519 |
520 #endif // V8_CONTEXTS_H_ | 520 #endif // V8_CONTEXTS_H_ |
OLD | NEW |