| 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", reinterpret_cast<void*>(*context)); | 93 PrintF(" - looking in context %p", *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", | 113 PrintF("=> found property in context object %p\n", *extension); |
| 114 reinterpret_cast<void*>(*extension)); | |
| 115 } | 114 } |
| 116 return extension; | 115 return extension; |
| 117 } | 116 } |
| 118 } | 117 } |
| 119 | 118 |
| 120 if (context->is_function_context()) { | 119 if (context->is_function_context()) { |
| 121 // we have context-local slots | 120 // we have context-local slots |
| 122 | 121 |
| 123 // check non-parameter locals in context | 122 // check non-parameter locals in context |
| 124 Handle<SerializedScopeInfo> scope_info( | 123 Handle<SerializedScopeInfo> scope_info( |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 248 | 247 |
| 249 | 248 |
| 250 bool Context::IsBootstrappingOrGlobalObject(Object* object) { | 249 bool Context::IsBootstrappingOrGlobalObject(Object* object) { |
| 251 // During bootstrapping we allow all objects to pass as global | 250 // During bootstrapping we allow all objects to pass as global |
| 252 // objects. This is necessary to fix circular dependencies. | 251 // objects. This is necessary to fix circular dependencies. |
| 253 return Bootstrapper::IsActive() || object->IsGlobalObject(); | 252 return Bootstrapper::IsActive() || object->IsGlobalObject(); |
| 254 } | 253 } |
| 255 #endif | 254 #endif |
| 256 | 255 |
| 257 } } // namespace v8::internal | 256 } } // namespace v8::internal |
| OLD | NEW |