| OLD | NEW |
| 1 // Copyright 2006-2008 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 |
| 11 // with the distribution. | 11 // with the distribution. |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 236 if (index >= 0) return false; | 236 if (index >= 0) return false; |
| 237 context = Context::cast(context->closure()->context()); | 237 context = Context::cast(context->closure()->context()); |
| 238 } | 238 } |
| 239 | 239 |
| 240 // No local or potential with statement found so the variable is | 240 // No local or potential with statement found so the variable is |
| 241 // global unless it is shadowed by an eval-introduced variable. | 241 // global unless it is shadowed by an eval-introduced variable. |
| 242 return true; | 242 return true; |
| 243 } | 243 } |
| 244 | 244 |
| 245 | 245 |
| 246 void Context::ComputeEvalScopeInfo(bool* outer_scope_calls_eval, |
| 247 bool* outer_scope_calls_non_strict_eval) { |
| 248 Context* context = this; |
| 249 while (true) { |
| 250 Handle<SerializedScopeInfo> scope_info( |
| 251 context->closure()->shared()->scope_info()); |
| 252 if (scope_info->CallsEval()) { |
| 253 *outer_scope_calls_eval = true; |
| 254 if (!scope_info->IsStrictMode()) { |
| 255 // No need to go further since the answers will not change |
| 256 // from here. |
| 257 *outer_scope_calls_non_strict_eval = true; |
| 258 return; |
| 259 } |
| 260 } |
| 261 if (context->IsGlobalContext()) break; |
| 262 context = Context::cast(context->closure()->context()); |
| 263 } |
| 264 } |
| 265 |
| 266 |
| 246 void Context::AddOptimizedFunction(JSFunction* function) { | 267 void Context::AddOptimizedFunction(JSFunction* function) { |
| 247 ASSERT(IsGlobalContext()); | 268 ASSERT(IsGlobalContext()); |
| 248 #ifdef DEBUG | 269 #ifdef DEBUG |
| 249 Object* element = get(OPTIMIZED_FUNCTIONS_LIST); | 270 Object* element = get(OPTIMIZED_FUNCTIONS_LIST); |
| 250 while (!element->IsUndefined()) { | 271 while (!element->IsUndefined()) { |
| 251 CHECK(element != function); | 272 CHECK(element != function); |
| 252 element = JSFunction::cast(element)->next_function_link(); | 273 element = JSFunction::cast(element)->next_function_link(); |
| 253 } | 274 } |
| 254 | 275 |
| 255 CHECK(function->next_function_link()->IsUndefined()); | 276 CHECK(function->next_function_link()->IsUndefined()); |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 318 // During bootstrapping we allow all objects to pass as global | 339 // During bootstrapping we allow all objects to pass as global |
| 319 // objects. This is necessary to fix circular dependencies. | 340 // objects. This is necessary to fix circular dependencies. |
| 320 Isolate* isolate = Isolate::Current(); | 341 Isolate* isolate = Isolate::Current(); |
| 321 return isolate->heap()->gc_state() != Heap::NOT_IN_GC || | 342 return isolate->heap()->gc_state() != Heap::NOT_IN_GC || |
| 322 isolate->bootstrapper()->IsActive() || | 343 isolate->bootstrapper()->IsActive() || |
| 323 object->IsGlobalObject(); | 344 object->IsGlobalObject(); |
| 324 } | 345 } |
| 325 #endif | 346 #endif |
| 326 | 347 |
| 327 } } // namespace v8::internal | 348 } } // namespace v8::internal |
| OLD | NEW |