| 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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 return global_context()->global_proxy_object(); | 69 return global_context()->global_proxy_object(); |
| 70 } | 70 } |
| 71 | 71 |
| 72 void Context::set_global_proxy(JSObject* object) { | 72 void Context::set_global_proxy(JSObject* object) { |
| 73 global_context()->set_global_proxy_object(object); | 73 global_context()->set_global_proxy_object(object); |
| 74 } | 74 } |
| 75 | 75 |
| 76 | 76 |
| 77 Handle<Object> Context::Lookup(Handle<String> name, ContextLookupFlags flags, | 77 Handle<Object> Context::Lookup(Handle<String> name, ContextLookupFlags flags, |
| 78 int* index_, PropertyAttributes* attributes) { | 78 int* index_, PropertyAttributes* attributes) { |
| 79 Heap* heap = GetHeap(); |
| 79 Handle<Context> context(this); | 80 Handle<Context> context(this); |
| 80 | 81 |
| 81 bool follow_context_chain = (flags & FOLLOW_CONTEXT_CHAIN) != 0; | 82 bool follow_context_chain = (flags & FOLLOW_CONTEXT_CHAIN) != 0; |
| 82 *index_ = -1; | 83 *index_ = -1; |
| 83 *attributes = ABSENT; | 84 *attributes = ABSENT; |
| 84 | 85 |
| 85 if (FLAG_trace_contexts) { | 86 if (FLAG_trace_contexts) { |
| 86 PrintF("Context::Lookup("); | 87 PrintF("Context::Lookup("); |
| 87 name->ShortPrint(); | 88 name->ShortPrint(); |
| 88 PrintF(")\n"); | 89 PrintF(")\n"); |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 case Variable::TEMPORARY: UNREACHABLE(); break; | 149 case Variable::TEMPORARY: UNREACHABLE(); break; |
| 149 } | 150 } |
| 150 return context; | 151 return context; |
| 151 } | 152 } |
| 152 | 153 |
| 153 // check parameter locals in context | 154 // check parameter locals in context |
| 154 int param_index = scope_info->ParameterIndex(*name); | 155 int param_index = scope_info->ParameterIndex(*name); |
| 155 if (param_index >= 0) { | 156 if (param_index >= 0) { |
| 156 // slot found. | 157 // slot found. |
| 157 int index = | 158 int index = |
| 158 scope_info->ContextSlotIndex(HEAP->arguments_shadow_symbol(), NULL); | 159 scope_info->ContextSlotIndex(heap->arguments_shadow_symbol(), NULL); |
| 159 ASSERT(index >= 0); // arguments must exist and be in the heap context | 160 ASSERT(index >= 0); // arguments must exist and be in the heap context |
| 160 Handle<JSObject> arguments(JSObject::cast(context->get(index))); | 161 Handle<JSObject> arguments(JSObject::cast(context->get(index))); |
| 161 ASSERT(arguments->HasLocalProperty(HEAP->length_symbol())); | 162 ASSERT(arguments->HasLocalProperty(heap->length_symbol())); |
| 162 if (FLAG_trace_contexts) { | 163 if (FLAG_trace_contexts) { |
| 163 PrintF("=> found parameter %d in arguments object\n", param_index); | 164 PrintF("=> found parameter %d in arguments object\n", param_index); |
| 164 } | 165 } |
| 165 *index_ = param_index; | 166 *index_ = param_index; |
| 166 *attributes = NONE; | 167 *attributes = NONE; |
| 167 return arguments; | 168 return arguments; |
| 168 } | 169 } |
| 169 | 170 |
| 170 // check intermediate context (holding only the function name variable) | 171 // check intermediate context (holding only the function name variable) |
| 171 if (follow_context_chain) { | 172 if (follow_context_chain) { |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 Isolate::Current()->bootstrapper()->IsActive() || | 253 return Isolate::Current()->bootstrapper()->IsActive() || |
| 253 object->IsGlobalObject(); | 254 object->IsGlobalObject(); |
| 254 } | 255 } |
| 255 #endif | 256 #endif |
| 256 | 257 |
| 257 } } // namespace v8::internal | 258 } } // namespace v8::internal |
| OLD | NEW |