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 bool follow_chains = true; | |
250 while (follow_chains) { | |
251 Handle<SerializedScopeInfo> scope_info( | |
252 context->closure()->shared()->scope_info()); | |
253 if (scope_info->CallsEval()) { | |
254 *outer_scope_calls_eval = true; | |
255 if (!scope_info->IsStrictMode()) { | |
256 // No need to go further since the answers will not change | |
257 // from here. | |
258 *outer_scope_calls_non_strict_eval = true; | |
259 return; | |
260 } | |
261 } | |
262 if (context->IsGlobalContext()) follow_chains = false; | |
fschneider
2011/05/11 10:35:11
small simplification?
while (true) {
...
if
Mads Ager (chromium)
2011/05/11 11:24:11
Done.
| |
263 context = Context::cast(context->closure()->context()); | |
264 } | |
265 } | |
266 | |
267 | |
246 void Context::AddOptimizedFunction(JSFunction* function) { | 268 void Context::AddOptimizedFunction(JSFunction* function) { |
247 ASSERT(IsGlobalContext()); | 269 ASSERT(IsGlobalContext()); |
248 #ifdef DEBUG | 270 #ifdef DEBUG |
249 Object* element = get(OPTIMIZED_FUNCTIONS_LIST); | 271 Object* element = get(OPTIMIZED_FUNCTIONS_LIST); |
250 while (!element->IsUndefined()) { | 272 while (!element->IsUndefined()) { |
251 CHECK(element != function); | 273 CHECK(element != function); |
252 element = JSFunction::cast(element)->next_function_link(); | 274 element = JSFunction::cast(element)->next_function_link(); |
253 } | 275 } |
254 | 276 |
255 CHECK(function->next_function_link()->IsUndefined()); | 277 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 | 340 // During bootstrapping we allow all objects to pass as global |
319 // objects. This is necessary to fix circular dependencies. | 341 // objects. This is necessary to fix circular dependencies. |
320 Isolate* isolate = Isolate::Current(); | 342 Isolate* isolate = Isolate::Current(); |
321 return isolate->heap()->gc_state() != Heap::NOT_IN_GC || | 343 return isolate->heap()->gc_state() != Heap::NOT_IN_GC || |
322 isolate->bootstrapper()->IsActive() || | 344 isolate->bootstrapper()->IsActive() || |
323 object->IsGlobalObject(); | 345 object->IsGlobalObject(); |
324 } | 346 } |
325 #endif | 347 #endif |
326 | 348 |
327 } } // namespace v8::internal | 349 } } // namespace v8::internal |
OLD | NEW |