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/contexts.h" | 5 #include "src/contexts.h" |
6 | 6 |
7 #include "src/bootstrapper.h" | 7 #include "src/bootstrapper.h" |
8 #include "src/debug/debug.h" | 8 #include "src/debug/debug.h" |
9 #include "src/scopeinfo.h" | 9 #include "src/scopeinfo.h" |
10 | 10 |
(...skipping 536 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
547 | 547 |
548 | 548 |
549 int Context::IntrinsicIndexForName(Handle<String> string) { | 549 int Context::IntrinsicIndexForName(Handle<String> string) { |
550 NATIVE_CONTEXT_INTRINSIC_FUNCTIONS(COMPARE_NAME); | 550 NATIVE_CONTEXT_INTRINSIC_FUNCTIONS(COMPARE_NAME); |
551 return kNotFound; | 551 return kNotFound; |
552 } | 552 } |
553 | 553 |
554 #undef COMPARE_NAME | 554 #undef COMPARE_NAME |
555 | 555 |
556 | 556 |
| 557 bool Context::IsJSBuiltin(Handle<Context> native_context, |
| 558 Handle<JSFunction> function) { |
| 559 #define COMPARE_FUNCTION(index, type, name) \ |
| 560 if (*function == native_context->get(index)) return true; |
| 561 NATIVE_CONTEXT_JS_BUILTINS(COMPARE_FUNCTION); |
| 562 #undef COMPARE_FUNCTION |
| 563 return false; |
| 564 } |
| 565 |
| 566 |
557 #ifdef DEBUG | 567 #ifdef DEBUG |
558 bool Context::IsBootstrappingOrValidParentContext( | 568 bool Context::IsBootstrappingOrValidParentContext( |
559 Object* object, Context* child) { | 569 Object* object, Context* child) { |
560 // During bootstrapping we allow all objects to pass as | 570 // During bootstrapping we allow all objects to pass as |
561 // contexts. This is necessary to fix circular dependencies. | 571 // contexts. This is necessary to fix circular dependencies. |
562 if (child->GetIsolate()->bootstrapper()->IsActive()) return true; | 572 if (child->GetIsolate()->bootstrapper()->IsActive()) return true; |
563 if (!object->IsContext()) return false; | 573 if (!object->IsContext()) return false; |
564 Context* context = Context::cast(object); | 574 Context* context = Context::cast(object); |
565 return context->IsNativeContext() || context->IsScriptContext() || | 575 return context->IsNativeContext() || context->IsScriptContext() || |
566 context->IsModuleContext() || !child->IsModuleContext(); | 576 context->IsModuleContext() || !child->IsModuleContext(); |
567 } | 577 } |
568 | 578 |
569 | 579 |
570 bool Context::IsBootstrappingOrGlobalObject(Isolate* isolate, Object* object) { | 580 bool Context::IsBootstrappingOrGlobalObject(Isolate* isolate, Object* object) { |
571 // During bootstrapping we allow all objects to pass as global | 581 // During bootstrapping we allow all objects to pass as global |
572 // objects. This is necessary to fix circular dependencies. | 582 // objects. This is necessary to fix circular dependencies. |
573 return isolate->heap()->gc_state() != Heap::NOT_IN_GC || | 583 return isolate->heap()->gc_state() != Heap::NOT_IN_GC || |
574 isolate->bootstrapper()->IsActive() || | 584 isolate->bootstrapper()->IsActive() || |
575 object->IsGlobalObject(); | 585 object->IsGlobalObject(); |
576 } | 586 } |
577 #endif | 587 #endif |
578 | 588 |
579 } // namespace internal | 589 } // namespace internal |
580 } // namespace v8 | 590 } // namespace v8 |
OLD | NEW |