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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 *attributes = ABSENT; | 83 *attributes = ABSENT; |
84 | 84 |
85 if (FLAG_trace_contexts) { | 85 if (FLAG_trace_contexts) { |
86 PrintF("Context::Lookup("); | 86 PrintF("Context::Lookup("); |
87 name->ShortPrint(); | 87 name->ShortPrint(); |
88 PrintF(")\n"); | 88 PrintF(")\n"); |
89 } | 89 } |
90 | 90 |
91 do { | 91 do { |
92 if (FLAG_trace_contexts) { | 92 if (FLAG_trace_contexts) { |
93 PrintF(" - looking in context %p", *context); | 93 PrintF(" - looking in context %p", reinterpret_cast<void*>(*context)); |
94 if (context->IsGlobalContext()) PrintF(" (global context)"); | 94 if (context->IsGlobalContext()) PrintF(" (global context)"); |
95 PrintF("\n"); | 95 PrintF("\n"); |
96 } | 96 } |
97 | 97 |
98 // check extension/with object | 98 // check extension/with object |
99 if (context->has_extension()) { | 99 if (context->has_extension()) { |
100 Handle<JSObject> extension = Handle<JSObject>(context->extension()); | 100 Handle<JSObject> extension = Handle<JSObject>(context->extension()); |
101 // Context extension objects needs to behave as if they have no | 101 // Context extension objects needs to behave as if they have no |
102 // prototype. So even if we want to follow prototype chains, we | 102 // prototype. So even if we want to follow prototype chains, we |
103 // need to only do a local lookup for context extension objects. | 103 // need to only do a local lookup for context extension objects. |
104 if ((flags & FOLLOW_PROTOTYPE_CHAIN) == 0 || | 104 if ((flags & FOLLOW_PROTOTYPE_CHAIN) == 0 || |
105 extension->IsJSContextExtensionObject()) { | 105 extension->IsJSContextExtensionObject()) { |
106 *attributes = extension->GetLocalPropertyAttribute(*name); | 106 *attributes = extension->GetLocalPropertyAttribute(*name); |
107 } else { | 107 } else { |
108 *attributes = extension->GetPropertyAttribute(*name); | 108 *attributes = extension->GetPropertyAttribute(*name); |
109 } | 109 } |
110 if (*attributes != ABSENT) { | 110 if (*attributes != ABSENT) { |
111 // property found | 111 // property found |
112 if (FLAG_trace_contexts) { | 112 if (FLAG_trace_contexts) { |
113 PrintF("=> found property in context object %p\n", *extension); | 113 PrintF("=> found property in context object %p\n", |
| 114 reinterpret_cast<void*>(*extension)); |
114 } | 115 } |
115 return extension; | 116 return extension; |
116 } | 117 } |
117 } | 118 } |
118 | 119 |
119 if (context->is_function_context()) { | 120 if (context->is_function_context()) { |
120 // we have context-local slots | 121 // we have context-local slots |
121 | 122 |
122 // check non-parameter locals in context | 123 // check non-parameter locals in context |
123 Handle<SerializedScopeInfo> scope_info( | 124 Handle<SerializedScopeInfo> scope_info( |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 | 248 |
248 | 249 |
249 bool Context::IsBootstrappingOrGlobalObject(Object* object) { | 250 bool Context::IsBootstrappingOrGlobalObject(Object* object) { |
250 // During bootstrapping we allow all objects to pass as global | 251 // During bootstrapping we allow all objects to pass as global |
251 // objects. This is necessary to fix circular dependencies. | 252 // objects. This is necessary to fix circular dependencies. |
252 return Bootstrapper::IsActive() || object->IsGlobalObject(); | 253 return Bootstrapper::IsActive() || object->IsGlobalObject(); |
253 } | 254 } |
254 #endif | 255 #endif |
255 | 256 |
256 } } // namespace v8::internal | 257 } } // namespace v8::internal |
OLD | NEW |