| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/v8.h" | 5 #include "src/v8.h" |
| 6 | 6 |
| 7 #include "src/bootstrapper.h" | 7 #include "src/bootstrapper.h" |
| 8 #include "src/debug.h" | 8 #include "src/debug.h" |
| 9 #include "src/scopeinfo.h" | 9 #include "src/scopeinfo.h" |
| 10 | 10 |
| (...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 465 | 465 |
| 466 Handle<Object> Context::ErrorMessageForCodeGenerationFromStrings() { | 466 Handle<Object> Context::ErrorMessageForCodeGenerationFromStrings() { |
| 467 Isolate* isolate = GetIsolate(); | 467 Isolate* isolate = GetIsolate(); |
| 468 Handle<Object> result(error_message_for_code_gen_from_strings(), isolate); | 468 Handle<Object> result(error_message_for_code_gen_from_strings(), isolate); |
| 469 if (!result->IsUndefined()) return result; | 469 if (!result->IsUndefined()) return result; |
| 470 return isolate->factory()->NewStringFromStaticChars( | 470 return isolate->factory()->NewStringFromStaticChars( |
| 471 "Code generation from strings disallowed for this context"); | 471 "Code generation from strings disallowed for this context"); |
| 472 } | 472 } |
| 473 | 473 |
| 474 | 474 |
| 475 #ifdef DEBUG | 475 #if DCHECK_IS_ON |
| 476 bool Context::IsBootstrappingOrValidParentContext( | 476 bool Context::IsBootstrappingOrValidParentContext( |
| 477 Object* object, Context* child) { | 477 Object* object, Context* child) { |
| 478 // During bootstrapping we allow all objects to pass as | 478 // During bootstrapping we allow all objects to pass as |
| 479 // contexts. This is necessary to fix circular dependencies. | 479 // contexts. This is necessary to fix circular dependencies. |
| 480 if (child->GetIsolate()->bootstrapper()->IsActive()) return true; | 480 if (child->GetIsolate()->bootstrapper()->IsActive()) return true; |
| 481 if (!object->IsContext()) return false; | 481 if (!object->IsContext()) return false; |
| 482 Context* context = Context::cast(object); | 482 Context* context = Context::cast(object); |
| 483 return context->IsNativeContext() || context->IsScriptContext() || | 483 return context->IsNativeContext() || context->IsScriptContext() || |
| 484 context->IsModuleContext() || !child->IsModuleContext(); | 484 context->IsModuleContext() || !child->IsModuleContext(); |
| 485 } | 485 } |
| 486 | 486 |
| 487 | 487 |
| 488 bool Context::IsBootstrappingOrGlobalObject(Isolate* isolate, Object* object) { | 488 bool Context::IsBootstrappingOrGlobalObject(Isolate* isolate, Object* object) { |
| 489 // During bootstrapping we allow all objects to pass as global | 489 // During bootstrapping we allow all objects to pass as global |
| 490 // objects. This is necessary to fix circular dependencies. | 490 // objects. This is necessary to fix circular dependencies. |
| 491 return isolate->heap()->gc_state() != Heap::NOT_IN_GC || | 491 return isolate->heap()->gc_state() != Heap::NOT_IN_GC || |
| 492 isolate->bootstrapper()->IsActive() || | 492 isolate->bootstrapper()->IsActive() || |
| 493 object->IsGlobalObject(); | 493 object->IsGlobalObject(); |
| 494 } | 494 } |
| 495 #endif | 495 #endif |
| 496 | 496 |
| 497 } } // namespace v8::internal | 497 } } // namespace v8::internal |
| OLD | NEW |