| 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 #include "src/unscopables.h" | 
| 10 | 11 | 
| 11 namespace v8 { | 12 namespace v8 { | 
| 12 namespace internal { | 13 namespace internal { | 
| 13 | 14 | 
| 14 Context* Context::declaration_context() { | 15 Context* Context::declaration_context() { | 
| 15   Context* current = this; | 16   Context* current = this; | 
| 16   while (!current->IsFunctionContext() && !current->IsNativeContext()) { | 17   while (!current->IsFunctionContext() && !current->IsNativeContext()) { | 
| 17     current = current->previous(); | 18     current = current->previous(); | 
| 18     DCHECK(current->closure() == closure()); | 19     DCHECK(current->closure() == closure()); | 
| 19   } | 20   } | 
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 103         (context->IsFunctionContext() && context->has_extension())) { | 104         (context->IsFunctionContext() && context->has_extension())) { | 
| 104       Handle<JSReceiver> object( | 105       Handle<JSReceiver> object( | 
| 105           JSReceiver::cast(context->extension()), isolate); | 106           JSReceiver::cast(context->extension()), isolate); | 
| 106       // Context extension objects needs to behave as if they have no | 107       // Context extension objects needs to behave as if they have no | 
| 107       // prototype.  So even if we want to follow prototype chains, we need | 108       // prototype.  So even if we want to follow prototype chains, we need | 
| 108       // to only do a local lookup for context extension objects. | 109       // to only do a local lookup for context extension objects. | 
| 109       Maybe<PropertyAttributes> maybe; | 110       Maybe<PropertyAttributes> maybe; | 
| 110       if ((flags & FOLLOW_PROTOTYPE_CHAIN) == 0 || | 111       if ((flags & FOLLOW_PROTOTYPE_CHAIN) == 0 || | 
| 111           object->IsJSContextExtensionObject()) { | 112           object->IsJSContextExtensionObject()) { | 
| 112         maybe = JSReceiver::GetOwnPropertyAttributes(object, name); | 113         maybe = JSReceiver::GetOwnPropertyAttributes(object, name); | 
|  | 114       } else if (FLAG_harmony_unscopables && context->IsWithContext()) { | 
|  | 115         LookupIterator it(object, name); | 
|  | 116         maybe = UnscopableLookup(&it); | 
| 113       } else { | 117       } else { | 
| 114         maybe = JSReceiver::GetPropertyAttributes(object, name); | 118         maybe = JSReceiver::GetPropertyAttributes(object, name); | 
| 115       } | 119       } | 
|  | 120 | 
| 116       if (!maybe.has_value) return Handle<Object>(); | 121       if (!maybe.has_value) return Handle<Object>(); | 
| 117       DCHECK(!isolate->has_pending_exception()); | 122       DCHECK(!isolate->has_pending_exception()); | 
| 118       *attributes = maybe.value; | 123       *attributes = maybe.value; | 
| 119 | 124 | 
| 120       if (maybe.value != ABSENT) { | 125       if (maybe.value != ABSENT) { | 
| 121         if (FLAG_trace_contexts) { | 126         if (FLAG_trace_contexts) { | 
| 122           PrintF("=> found property in context object %p\n", | 127           PrintF("=> found property in context object %p\n", | 
| 123                  reinterpret_cast<void*>(*object)); | 128                  reinterpret_cast<void*>(*object)); | 
| 124         } | 129         } | 
| 125         return object; | 130         return object; | 
| (...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 373 bool Context::IsBootstrappingOrGlobalObject(Isolate* isolate, Object* object) { | 378 bool Context::IsBootstrappingOrGlobalObject(Isolate* isolate, Object* object) { | 
| 374   // During bootstrapping we allow all objects to pass as global | 379   // During bootstrapping we allow all objects to pass as global | 
| 375   // objects. This is necessary to fix circular dependencies. | 380   // objects. This is necessary to fix circular dependencies. | 
| 376   return isolate->heap()->gc_state() != Heap::NOT_IN_GC || | 381   return isolate->heap()->gc_state() != Heap::NOT_IN_GC || | 
| 377       isolate->bootstrapper()->IsActive() || | 382       isolate->bootstrapper()->IsActive() || | 
| 378       object->IsGlobalObject(); | 383       object->IsGlobalObject(); | 
| 379 } | 384 } | 
| 380 #endif | 385 #endif | 
| 381 | 386 | 
| 382 } }  // namespace v8::internal | 387 } }  // namespace v8::internal | 
| OLD | NEW | 
|---|