OLD | NEW |
1 // Copyright 2011 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 |
(...skipping 27 matching lines...) Expand all Loading... |
38 Context* current = this; | 38 Context* current = this; |
39 while (!current->IsFunctionContext() && !current->IsNativeContext()) { | 39 while (!current->IsFunctionContext() && !current->IsNativeContext()) { |
40 current = current->previous(); | 40 current = current->previous(); |
41 ASSERT(current->closure() == closure()); | 41 ASSERT(current->closure() == closure()); |
42 } | 42 } |
43 return current; | 43 return current; |
44 } | 44 } |
45 | 45 |
46 | 46 |
47 JSBuiltinsObject* Context::builtins() { | 47 JSBuiltinsObject* Context::builtins() { |
48 GlobalObject* object = global(); | 48 GlobalObject* object = global_object(); |
49 if (object->IsJSGlobalObject()) { | 49 if (object->IsJSGlobalObject()) { |
50 return JSGlobalObject::cast(object)->builtins(); | 50 return JSGlobalObject::cast(object)->builtins(); |
51 } else { | 51 } else { |
52 ASSERT(object->IsJSBuiltinsObject()); | 52 ASSERT(object->IsJSBuiltinsObject()); |
53 return JSBuiltinsObject::cast(object); | 53 return JSBuiltinsObject::cast(object); |
54 } | 54 } |
55 } | 55 } |
56 | 56 |
57 | 57 |
58 Context* Context::native_context() { | 58 Context* Context::native_context() { |
59 // Fast case: the global object for this context has been set. In | 59 // Fast case: the global object for this context has been set. In |
60 // that case, the global object has a direct pointer to the global | 60 // that case, the global object has a direct pointer to the global |
61 // context. | 61 // context. |
62 if (global()->IsGlobalObject()) { | 62 if (global_object()->IsGlobalObject()) { |
63 return global()->native_context(); | 63 return global_object()->native_context(); |
64 } | 64 } |
65 | 65 |
66 // During bootstrapping, the global object might not be set and we | 66 // During bootstrapping, the global object might not be set and we |
67 // have to search the context chain to find the native context. | 67 // have to search the context chain to find the native context. |
68 ASSERT(Isolate::Current()->bootstrapper()->IsActive()); | 68 ASSERT(Isolate::Current()->bootstrapper()->IsActive()); |
69 Context* current = this; | 69 Context* current = this; |
70 while (!current->IsNativeContext()) { | 70 while (!current->IsNativeContext()) { |
71 JSFunction* closure = JSFunction::cast(current->closure()); | 71 JSFunction* closure = JSFunction::cast(current->closure()); |
72 current = Context::cast(closure->context()); | 72 current = Context::cast(closure->context()); |
73 } | 73 } |
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
322 // During bootstrapping we allow all objects to pass as global | 322 // During bootstrapping we allow all objects to pass as global |
323 // objects. This is necessary to fix circular dependencies. | 323 // objects. This is necessary to fix circular dependencies. |
324 Isolate* isolate = Isolate::Current(); | 324 Isolate* isolate = Isolate::Current(); |
325 return isolate->heap()->gc_state() != Heap::NOT_IN_GC || | 325 return isolate->heap()->gc_state() != Heap::NOT_IN_GC || |
326 isolate->bootstrapper()->IsActive() || | 326 isolate->bootstrapper()->IsActive() || |
327 object->IsGlobalObject(); | 327 object->IsGlobalObject(); |
328 } | 328 } |
329 #endif | 329 #endif |
330 | 330 |
331 } } // namespace v8::internal | 331 } } // namespace v8::internal |
OLD | NEW |