| 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 // During bootstrapping, the global object might not be set and we | 53 // During bootstrapping, the global object might not be set and we |
| 54 // have to search the context chain to find the global context. | 54 // have to search the context chain to find the global context. |
| 55 Context* current = this; | 55 Context* current = this; |
| 56 while (!current->IsGlobalContext()) { | 56 while (!current->IsGlobalContext()) { |
| 57 current = Context::cast(JSFunction::cast(current->closure())->context()); | 57 current = Context::cast(JSFunction::cast(current->closure())->context()); |
| 58 } | 58 } |
| 59 return current; | 59 return current; |
| 60 } | 60 } |
| 61 | 61 |
| 62 | 62 |
| 63 JSObject* Context::global_proxy() { |
| 64 return global_context()->global_proxy_object(); |
| 65 } |
| 66 |
| 67 void Context::set_global_proxy(JSObject* object) { |
| 68 global_context()->set_global_proxy_object(object); |
| 69 } |
| 70 |
| 71 |
| 63 Handle<Object> Context::Lookup(Handle<String> name, ContextLookupFlags flags, | 72 Handle<Object> Context::Lookup(Handle<String> name, ContextLookupFlags flags, |
| 64 int* index_, PropertyAttributes* attributes) { | 73 int* index_, PropertyAttributes* attributes) { |
| 65 Handle<Context> context(this); | 74 Handle<Context> context(this); |
| 66 | 75 |
| 67 // The context must be in frame slot 0 (if not debugging). | 76 // The context must be in frame slot 0 (if not debugging). |
| 68 if (kDebug && !Debug::InDebugger()) { | 77 if (kDebug && !Debug::InDebugger()) { |
| 69 StackFrameLocator locator; | 78 StackFrameLocator locator; |
| 70 ASSERT(context->fcontext() == | 79 ASSERT(context->fcontext() == |
| 71 Context::cast( | 80 Context::cast( |
| 72 locator.FindJavaScriptFrame(0)->context())->fcontext()); | 81 locator.FindJavaScriptFrame(0)->context())->fcontext()); |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 | 194 |
| 186 // slot not found | 195 // slot not found |
| 187 if (FLAG_trace_contexts) { | 196 if (FLAG_trace_contexts) { |
| 188 PrintF("=> no property/slot found\n"); | 197 PrintF("=> no property/slot found\n"); |
| 189 } | 198 } |
| 190 return Handle<Object>(reinterpret_cast<JSObject*>(NULL)); | 199 return Handle<Object>(reinterpret_cast<JSObject*>(NULL)); |
| 191 } | 200 } |
| 192 | 201 |
| 193 | 202 |
| 194 } } // namespace v8::internal | 203 } } // namespace v8::internal |
| OLD | NEW |