OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 do { | 87 do { |
88 if (FLAG_trace_contexts) { | 88 if (FLAG_trace_contexts) { |
89 PrintF(" - looking in context %p", *context); | 89 PrintF(" - looking in context %p", *context); |
90 if (context->IsGlobalContext()) PrintF(" (global context)"); | 90 if (context->IsGlobalContext()) PrintF(" (global context)"); |
91 PrintF("\n"); | 91 PrintF("\n"); |
92 } | 92 } |
93 | 93 |
94 // check extension/with object | 94 // check extension/with object |
95 if (context->has_extension()) { | 95 if (context->has_extension()) { |
96 Handle<JSObject> extension = Handle<JSObject>(context->extension()); | 96 Handle<JSObject> extension = Handle<JSObject>(context->extension()); |
97 if ((flags & FOLLOW_PROTOTYPE_CHAIN) == 0) { | 97 // Context extension objects needs to behave as if they have no |
| 98 // prototype. So even if we want to follow prototype chains, we |
| 99 // need to only do a local lookup for context extension objects. |
| 100 if ((flags & FOLLOW_PROTOTYPE_CHAIN) == 0 || |
| 101 extension->IsJSContextExtensionObject()) { |
98 *attributes = extension->GetLocalPropertyAttribute(*name); | 102 *attributes = extension->GetLocalPropertyAttribute(*name); |
99 } else { | 103 } else { |
100 *attributes = extension->GetPropertyAttribute(*name); | 104 *attributes = extension->GetPropertyAttribute(*name); |
101 } | 105 } |
102 if (*attributes != ABSENT) { | 106 if (*attributes != ABSENT) { |
103 // property found | 107 // property found |
104 if (FLAG_trace_contexts) { | 108 if (FLAG_trace_contexts) { |
105 PrintF("=> found property in context object %p\n", *extension); | 109 PrintF("=> found property in context object %p\n", *extension); |
106 } | 110 } |
107 return extension; | 111 return extension; |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 | 205 |
202 | 206 |
203 bool Context::IsBootstrappingOrGlobalObject(Object* object) { | 207 bool Context::IsBootstrappingOrGlobalObject(Object* object) { |
204 // During bootstrapping we allow all objects to pass as global | 208 // During bootstrapping we allow all objects to pass as global |
205 // objects. This is necessary to fix circular dependencies. | 209 // objects. This is necessary to fix circular dependencies. |
206 return Bootstrapper::IsActive() || object->IsGlobalObject(); | 210 return Bootstrapper::IsActive() || object->IsGlobalObject(); |
207 } | 211 } |
208 #endif | 212 #endif |
209 | 213 |
210 } } // namespace v8::internal | 214 } } // namespace v8::internal |
OLD | NEW |