| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 } | 217 } |
| 218 | 218 |
| 219 | 219 |
| 220 bool Context::GlobalIfNotShadowedByEval(Handle<String> name) { | 220 bool Context::GlobalIfNotShadowedByEval(Handle<String> name) { |
| 221 Context* context = this; | 221 Context* context = this; |
| 222 | 222 |
| 223 // Check that there is no local with the given name in contexts | 223 // Check that there is no local with the given name in contexts |
| 224 // before the global context and check that there are no context | 224 // before the global context and check that there are no context |
| 225 // extension objects (conservative check for with statements). | 225 // extension objects (conservative check for with statements). |
| 226 while (!context->IsGlobalContext()) { | 226 while (!context->IsGlobalContext()) { |
| 227 // Check if the context is a catch or with context, or has called | 227 // Check if the context is a catch or with context, or has introduced |
| 228 // non-strict eval. | 228 // bindings by calling non-strict eval. |
| 229 if (context->has_extension()) return false; | 229 if (context->has_extension()) return false; |
| 230 | 230 |
| 231 // Not a with context so it must be a function context. | 231 // Not a with context so it must be a function context. |
| 232 ASSERT(context->IsFunctionContext()); | 232 ASSERT(context->IsFunctionContext()); |
| 233 | 233 |
| 234 // Check non-parameter locals. | 234 // Check non-parameter locals. |
| 235 Handle<SerializedScopeInfo> scope_info( | 235 Handle<SerializedScopeInfo> scope_info( |
| 236 context->closure()->shared()->scope_info()); | 236 context->closure()->shared()->scope_info()); |
| 237 Variable::Mode mode; | 237 Variable::Mode mode; |
| 238 int index = scope_info->ContextSlotIndex(*name, &mode); | 238 int index = scope_info->ContextSlotIndex(*name, &mode); |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 352 // During bootstrapping we allow all objects to pass as global | 352 // During bootstrapping we allow all objects to pass as global |
| 353 // objects. This is necessary to fix circular dependencies. | 353 // objects. This is necessary to fix circular dependencies. |
| 354 Isolate* isolate = Isolate::Current(); | 354 Isolate* isolate = Isolate::Current(); |
| 355 return isolate->heap()->gc_state() != Heap::NOT_IN_GC || | 355 return isolate->heap()->gc_state() != Heap::NOT_IN_GC || |
| 356 isolate->bootstrapper()->IsActive() || | 356 isolate->bootstrapper()->IsActive() || |
| 357 object->IsGlobalObject(); | 357 object->IsGlobalObject(); |
| 358 } | 358 } |
| 359 #endif | 359 #endif |
| 360 | 360 |
| 361 } } // namespace v8::internal | 361 } } // namespace v8::internal |
| OLD | NEW |