| 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 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 381 Object* Context::DeoptimizedCodeListHead() { | 381 Object* Context::DeoptimizedCodeListHead() { |
| 382 DCHECK(IsNativeContext()); | 382 DCHECK(IsNativeContext()); |
| 383 return get(DEOPTIMIZED_CODE_LIST); | 383 return get(DEOPTIMIZED_CODE_LIST); |
| 384 } | 384 } |
| 385 | 385 |
| 386 | 386 |
| 387 Handle<Object> Context::ErrorMessageForCodeGenerationFromStrings() { | 387 Handle<Object> Context::ErrorMessageForCodeGenerationFromStrings() { |
| 388 Isolate* isolate = GetIsolate(); | 388 Isolate* isolate = GetIsolate(); |
| 389 Handle<Object> result(error_message_for_code_gen_from_strings(), isolate); | 389 Handle<Object> result(error_message_for_code_gen_from_strings(), isolate); |
| 390 if (!result->IsUndefined()) return result; | 390 if (!result->IsUndefined()) return result; |
| 391 return isolate->factory()->NewStringFromStaticAscii( | 391 return isolate->factory()->NewStringFromStaticChars( |
| 392 "Code generation from strings disallowed for this context"); | 392 "Code generation from strings disallowed for this context"); |
| 393 } | 393 } |
| 394 | 394 |
| 395 | 395 |
| 396 #ifdef DEBUG | 396 #ifdef DEBUG |
| 397 bool Context::IsBootstrappingOrValidParentContext( | 397 bool Context::IsBootstrappingOrValidParentContext( |
| 398 Object* object, Context* child) { | 398 Object* object, Context* child) { |
| 399 // During bootstrapping we allow all objects to pass as | 399 // During bootstrapping we allow all objects to pass as |
| 400 // contexts. This is necessary to fix circular dependencies. | 400 // contexts. This is necessary to fix circular dependencies. |
| 401 if (child->GetIsolate()->bootstrapper()->IsActive()) return true; | 401 if (child->GetIsolate()->bootstrapper()->IsActive()) return true; |
| 402 if (!object->IsContext()) return false; | 402 if (!object->IsContext()) return false; |
| 403 Context* context = Context::cast(object); | 403 Context* context = Context::cast(object); |
| 404 return context->IsNativeContext() || context->IsGlobalContext() || | 404 return context->IsNativeContext() || context->IsGlobalContext() || |
| 405 context->IsModuleContext() || !child->IsModuleContext(); | 405 context->IsModuleContext() || !child->IsModuleContext(); |
| 406 } | 406 } |
| 407 | 407 |
| 408 | 408 |
| 409 bool Context::IsBootstrappingOrGlobalObject(Isolate* isolate, Object* object) { | 409 bool Context::IsBootstrappingOrGlobalObject(Isolate* isolate, Object* object) { |
| 410 // During bootstrapping we allow all objects to pass as global | 410 // During bootstrapping we allow all objects to pass as global |
| 411 // objects. This is necessary to fix circular dependencies. | 411 // objects. This is necessary to fix circular dependencies. |
| 412 return isolate->heap()->gc_state() != Heap::NOT_IN_GC || | 412 return isolate->heap()->gc_state() != Heap::NOT_IN_GC || |
| 413 isolate->bootstrapper()->IsActive() || | 413 isolate->bootstrapper()->IsActive() || |
| 414 object->IsGlobalObject(); | 414 object->IsGlobalObject(); |
| 415 } | 415 } |
| 416 #endif | 416 #endif |
| 417 | 417 |
| 418 } } // namespace v8::internal | 418 } } // namespace v8::internal |
| OLD | NEW |