| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 if (FLAG_trace_contexts) { | 117 if (FLAG_trace_contexts) { |
| 118 PrintF(" - looking in context %p", reinterpret_cast<void*>(*context)); | 118 PrintF(" - looking in context %p", reinterpret_cast<void*>(*context)); |
| 119 if (context->IsNativeContext()) PrintF(" (native context)"); | 119 if (context->IsNativeContext()) PrintF(" (native context)"); |
| 120 PrintF("\n"); | 120 PrintF("\n"); |
| 121 } | 121 } |
| 122 | 122 |
| 123 // 1. Check global objects, subjects of with, and extension objects. | 123 // 1. Check global objects, subjects of with, and extension objects. |
| 124 if (context->IsNativeContext() || | 124 if (context->IsNativeContext() || |
| 125 context->IsWithContext() || | 125 context->IsWithContext() || |
| 126 (context->IsFunctionContext() && context->has_extension())) { | 126 (context->IsFunctionContext() && context->has_extension())) { |
| 127 Handle<JSObject> object(JSObject::cast(context->extension()), isolate); | 127 Handle<JSReceiver> object( |
| 128 JSReceiver::cast(context->extension()), isolate); |
| 128 // Context extension objects needs to behave as if they have no | 129 // Context extension objects needs to behave as if they have no |
| 129 // prototype. So even if we want to follow prototype chains, we need | 130 // prototype. So even if we want to follow prototype chains, we need |
| 130 // to only do a local lookup for context extension objects. | 131 // to only do a local lookup for context extension objects. |
| 131 if ((flags & FOLLOW_PROTOTYPE_CHAIN) == 0 || | 132 if ((flags & FOLLOW_PROTOTYPE_CHAIN) == 0 || |
| 132 object->IsJSContextExtensionObject()) { | 133 object->IsJSContextExtensionObject()) { |
| 133 *attributes = object->GetLocalPropertyAttribute(*name); | 134 *attributes = object->GetLocalPropertyAttribute(*name); |
| 134 } else { | 135 } else { |
| 135 *attributes = object->GetPropertyAttribute(*name); | 136 *attributes = object->GetPropertyAttribute(*name); |
| 136 } | 137 } |
| 138 if (isolate->has_pending_exception()) return Handle<Object>(); |
| 139 |
| 137 if (*attributes != ABSENT) { | 140 if (*attributes != ABSENT) { |
| 138 if (FLAG_trace_contexts) { | 141 if (FLAG_trace_contexts) { |
| 139 PrintF("=> found property in context object %p\n", | 142 PrintF("=> found property in context object %p\n", |
| 140 reinterpret_cast<void*>(*object)); | 143 reinterpret_cast<void*>(*object)); |
| 141 } | 144 } |
| 142 return object; | 145 return object; |
| 143 } | 146 } |
| 144 } | 147 } |
| 145 | 148 |
| 146 // 2. Check the context proper if it has slots. | 149 // 2. Check the context proper if it has slots. |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 353 // During bootstrapping we allow all objects to pass as global | 356 // During bootstrapping we allow all objects to pass as global |
| 354 // objects. This is necessary to fix circular dependencies. | 357 // objects. This is necessary to fix circular dependencies. |
| 355 Isolate* isolate = Isolate::Current(); | 358 Isolate* isolate = Isolate::Current(); |
| 356 return isolate->heap()->gc_state() != Heap::NOT_IN_GC || | 359 return isolate->heap()->gc_state() != Heap::NOT_IN_GC || |
| 357 isolate->bootstrapper()->IsActive() || | 360 isolate->bootstrapper()->IsActive() || |
| 358 object->IsGlobalObject(); | 361 object->IsGlobalObject(); |
| 359 } | 362 } |
| 360 #endif | 363 #endif |
| 361 | 364 |
| 362 } } // namespace v8::internal | 365 } } // namespace v8::internal |
| OLD | NEW |