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 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
297 return get(OPTIMIZED_FUNCTIONS_LIST); | 297 return get(OPTIMIZED_FUNCTIONS_LIST); |
298 } | 298 } |
299 | 299 |
300 | 300 |
301 void Context::ClearOptimizedFunctions() { | 301 void Context::ClearOptimizedFunctions() { |
302 set(OPTIMIZED_FUNCTIONS_LIST, GetHeap()->undefined_value()); | 302 set(OPTIMIZED_FUNCTIONS_LIST, GetHeap()->undefined_value()); |
303 } | 303 } |
304 | 304 |
305 | 305 |
306 #ifdef DEBUG | 306 #ifdef DEBUG |
307 bool Context::IsBootstrappingOrContext(Object* object) { | 307 bool Context::IsBootstrappingOrValidParentContext( |
| 308 Object* object, Context* child) { |
308 // During bootstrapping we allow all objects to pass as | 309 // During bootstrapping we allow all objects to pass as |
309 // contexts. This is necessary to fix circular dependencies. | 310 // contexts. This is necessary to fix circular dependencies. |
310 return Isolate::Current()->bootstrapper()->IsActive() || object->IsContext(); | 311 if (Isolate::Current()->bootstrapper()->IsActive()) return true; |
| 312 if (!object->IsContext()) return false; |
| 313 Context* context = Context::cast(object); |
| 314 return context->IsGlobalContext() || context->IsModuleContext() || |
| 315 !child->IsModuleContext(); |
311 } | 316 } |
312 | 317 |
313 | 318 |
314 bool Context::IsBootstrappingOrGlobalObject(Object* object) { | 319 bool Context::IsBootstrappingOrGlobalObject(Object* object) { |
315 // During bootstrapping we allow all objects to pass as global | 320 // During bootstrapping we allow all objects to pass as global |
316 // objects. This is necessary to fix circular dependencies. | 321 // objects. This is necessary to fix circular dependencies. |
317 Isolate* isolate = Isolate::Current(); | 322 Isolate* isolate = Isolate::Current(); |
318 return isolate->heap()->gc_state() != Heap::NOT_IN_GC || | 323 return isolate->heap()->gc_state() != Heap::NOT_IN_GC || |
319 isolate->bootstrapper()->IsActive() || | 324 isolate->bootstrapper()->IsActive() || |
320 object->IsGlobalObject(); | 325 object->IsGlobalObject(); |
321 } | 326 } |
322 #endif | 327 #endif |
323 | 328 |
324 } } // namespace v8::internal | 329 } } // namespace v8::internal |
OLD | NEW |