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 ASSERT(current->closure() == closure()); | 19 ASSERT(current->closure() == closure()); |
19 } | 20 } |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
102 context->IsWithContext() || | 103 context->IsWithContext() || |
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 if ((flags & FOLLOW_PROTOTYPE_CHAIN) == 0 || | 110 if ((flags & FOLLOW_PROTOTYPE_CHAIN) == 0 || |
110 object->IsJSContextExtensionObject()) { | 111 object->IsJSContextExtensionObject()) { |
111 *attributes = JSReceiver::GetOwnPropertyAttributes(object, name); | 112 *attributes = JSReceiver::GetOwnPropertyAttributes(object, name); |
113 } else if (FLAG_harmony_unscopables && context->IsWithContext()) { | |
114 LookupIterator it(object, name); | |
115 *attributes = UnscopableLookup(&it); | |
112 } else { | 116 } else { |
113 *attributes = JSReceiver::GetPropertyAttributes(object, name); | 117 *attributes = JSReceiver::GetPropertyAttributes(object, name); |
114 } | 118 } |
119 | |
115 if (isolate->has_pending_exception()) return Handle<Object>(); | 120 if (isolate->has_pending_exception()) return Handle<Object>(); |
arv (Not doing code reviews)
2014/07/25 15:33:26
Exception is handled here.
Toon Verwaest
2014/07/25 18:52:11
The problem is that it was looking for pending exc
| |
116 | 121 |
117 if (*attributes != ABSENT) { | 122 if (*attributes != ABSENT) { |
118 if (FLAG_trace_contexts) { | 123 if (FLAG_trace_contexts) { |
119 PrintF("=> found property in context object %p\n", | 124 PrintF("=> found property in context object %p\n", |
120 reinterpret_cast<void*>(*object)); | 125 reinterpret_cast<void*>(*object)); |
121 } | 126 } |
122 return object; | 127 return object; |
123 } | 128 } |
124 } | 129 } |
125 | 130 |
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
367 bool Context::IsBootstrappingOrGlobalObject(Isolate* isolate, Object* object) { | 372 bool Context::IsBootstrappingOrGlobalObject(Isolate* isolate, Object* object) { |
368 // During bootstrapping we allow all objects to pass as global | 373 // During bootstrapping we allow all objects to pass as global |
369 // objects. This is necessary to fix circular dependencies. | 374 // objects. This is necessary to fix circular dependencies. |
370 return isolate->heap()->gc_state() != Heap::NOT_IN_GC || | 375 return isolate->heap()->gc_state() != Heap::NOT_IN_GC || |
371 isolate->bootstrapper()->IsActive() || | 376 isolate->bootstrapper()->IsActive() || |
372 object->IsGlobalObject(); | 377 object->IsGlobalObject(); |
373 } | 378 } |
374 #endif | 379 #endif |
375 | 380 |
376 } } // namespace v8::internal | 381 } } // namespace v8::internal |
OLD | NEW |