Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(456)

Side by Side Diff: src/contexts.cc

Issue 7904008: Introduce with scope and rework variable resolution. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Latest version. Created 9 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/contexts.h ('k') | src/ia32/full-codegen-ia32.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 if (index >= 0) return false; 267 if (index >= 0) return false;
268 context = context->previous(); 268 context = context->previous();
269 } 269 }
270 270
271 // No local or potential with statement found so the variable is 271 // No local or potential with statement found so the variable is
272 // global unless it is shadowed by an eval-introduced variable. 272 // global unless it is shadowed by an eval-introduced variable.
273 return true; 273 return true;
274 } 274 }
275 275
276 276
277 void Context::ComputeEvalScopeInfo(bool* outer_scope_calls_eval, 277 void Context::ComputeEvalScopeInfo(bool* outer_scope_calls_non_strict_eval) {
278 bool* outer_scope_calls_non_strict_eval) {
279 // Skip up the context chain checking all the function contexts to see 278 // Skip up the context chain checking all the function contexts to see
280 // whether they call eval. 279 // whether they call eval.
281 Context* context = this; 280 Context* context = this;
282 while (!context->IsGlobalContext()) { 281 while (!context->IsGlobalContext()) {
283 if (context->IsFunctionContext()) { 282 if (context->IsFunctionContext()) {
284 Handle<SerializedScopeInfo> scope_info( 283 Handle<SerializedScopeInfo> scope_info(
285 context->closure()->shared()->scope_info()); 284 context->closure()->shared()->scope_info());
286 if (scope_info->CallsEval()) { 285 if (scope_info->CallsEval() && !scope_info->IsStrictMode()) {
287 *outer_scope_calls_eval = true; 286 // No need to go further since the answers will not change from
288 if (!scope_info->IsStrictMode()) { 287 // here.
289 // No need to go further since the answers will not change from 288 *outer_scope_calls_non_strict_eval = true;
290 // here. 289 return;
291 *outer_scope_calls_non_strict_eval = true;
292 return;
293 }
294 } 290 }
295 } 291 }
296 context = context->previous(); 292 context = context->previous();
297 } 293 }
298 } 294 }
299 295
300 296
301 void Context::AddOptimizedFunction(JSFunction* function) { 297 void Context::AddOptimizedFunction(JSFunction* function) {
302 ASSERT(IsGlobalContext()); 298 ASSERT(IsGlobalContext());
303 #ifdef DEBUG 299 #ifdef DEBUG
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
373 // During bootstrapping we allow all objects to pass as global 369 // During bootstrapping we allow all objects to pass as global
374 // objects. This is necessary to fix circular dependencies. 370 // objects. This is necessary to fix circular dependencies.
375 Isolate* isolate = Isolate::Current(); 371 Isolate* isolate = Isolate::Current();
376 return isolate->heap()->gc_state() != Heap::NOT_IN_GC || 372 return isolate->heap()->gc_state() != Heap::NOT_IN_GC ||
377 isolate->bootstrapper()->IsActive() || 373 isolate->bootstrapper()->IsActive() ||
378 object->IsGlobalObject(); 374 object->IsGlobalObject();
379 } 375 }
380 #endif 376 #endif
381 377
382 } } // namespace v8::internal 378 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/contexts.h ('k') | src/ia32/full-codegen-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698