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

Side by Side Diff: src/scopes.h

Issue 7535004: Merge bleeding edge up to 8774 into the GC branch. (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/gc/
Patch Set: Created 9 years, 4 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/scopeinfo.cc ('k') | src/scopes.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 301 matching lines...) Expand 10 before | Expand all | Expand 10 after
312 void Print(int n = 0); // n = indentation; n < 0 => don't print recursively 312 void Print(int n = 0); // n = indentation; n < 0 => don't print recursively
313 #endif 313 #endif
314 314
315 // --------------------------------------------------------------------------- 315 // ---------------------------------------------------------------------------
316 // Implementation. 316 // Implementation.
317 protected: 317 protected:
318 friend class ParserFactory; 318 friend class ParserFactory;
319 319
320 explicit Scope(Type type); 320 explicit Scope(Type type);
321 321
322 Isolate* const isolate_;
323
322 // Scope tree. 324 // Scope tree.
323 Scope* outer_scope_; // the immediately enclosing outer scope, or NULL 325 Scope* outer_scope_; // the immediately enclosing outer scope, or NULL
324 ZoneList<Scope*> inner_scopes_; // the immediately enclosed inner scopes 326 ZoneList<Scope*> inner_scopes_; // the immediately enclosed inner scopes
325 327
326 // The scope type. 328 // The scope type.
327 Type type_; 329 Type type_;
328 330
329 // Debugging support. 331 // Debugging support.
330 Handle<String> scope_name_; 332 Handle<String> scope_name_;
331 333
(...skipping 16 matching lines...) Expand all
348 // Convenience variable. 350 // Convenience variable.
349 Variable* receiver_; 351 Variable* receiver_;
350 // Function variable, if any; function scopes only. 352 // Function variable, if any; function scopes only.
351 Variable* function_; 353 Variable* function_;
352 // Convenience variable; function scopes only. 354 // Convenience variable; function scopes only.
353 Variable* arguments_; 355 Variable* arguments_;
354 356
355 // Illegal redeclaration. 357 // Illegal redeclaration.
356 Expression* illegal_redecl_; 358 Expression* illegal_redecl_;
357 359
358 // Scope-specific information. 360 // Scope-specific information computed during parsing.
359 bool scope_inside_with_; // this scope is inside a 'with' of some outer scope 361 //
360 bool scope_contains_with_; // this scope contains a 'with' statement 362 // This scope is inside a 'with' of some outer scope.
361 bool scope_calls_eval_; // this scope contains an 'eval' call 363 bool scope_inside_with_;
362 bool strict_mode_; // this scope is a strict mode scope 364 // This scope contains a 'with' statement.
365 bool scope_contains_with_;
366 // This scope or a nested catch scope or with scope contain an 'eval' call. At
367 // the 'eval' call site this scope is the declaration scope.
368 bool scope_calls_eval_;
369 // This scope is a strict mode scope.
370 bool strict_mode_;
363 371
364 // Computed via PropagateScopeInfo. 372 // Computed via PropagateScopeInfo.
365 bool outer_scope_calls_eval_; 373 bool outer_scope_calls_eval_;
366 bool outer_scope_calls_non_strict_eval_; 374 bool outer_scope_calls_non_strict_eval_;
367 bool inner_scope_calls_eval_; 375 bool inner_scope_calls_eval_;
368 bool outer_scope_is_eval_scope_; 376 bool outer_scope_is_eval_scope_;
369 bool force_eager_compilation_; 377 bool force_eager_compilation_;
370 378
371 // True if it doesn't need scope resolution (e.g., if the scope was 379 // True if it doesn't need scope resolution (e.g., if the scope was
372 // constructed based on a serialized scope info or a catch context). 380 // constructed based on a serialized scope info or a catch context).
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
416 void AllocateNonParameterLocals(); 424 void AllocateNonParameterLocals();
417 void AllocateVariablesRecursively(); 425 void AllocateVariablesRecursively();
418 426
419 private: 427 private:
420 // Construct a function scope based on the scope info. 428 // Construct a function scope based on the scope info.
421 Scope(Scope* inner_scope, Handle<SerializedScopeInfo> scope_info); 429 Scope(Scope* inner_scope, Handle<SerializedScopeInfo> scope_info);
422 430
423 // Construct a catch scope with a binding for the name. 431 // Construct a catch scope with a binding for the name.
424 Scope(Scope* inner_scope, Handle<String> catch_variable_name); 432 Scope(Scope* inner_scope, Handle<String> catch_variable_name);
425 433
434 inline Slot* NewSlot(Variable* var, Slot::Type type, int index) {
435 return new(isolate_->zone()) Slot(isolate_, var, type, index);
436 }
437
426 void AddInnerScope(Scope* inner_scope) { 438 void AddInnerScope(Scope* inner_scope) {
427 if (inner_scope != NULL) { 439 if (inner_scope != NULL) {
428 inner_scopes_.Add(inner_scope); 440 inner_scopes_.Add(inner_scope);
429 inner_scope->outer_scope_ = this; 441 inner_scope->outer_scope_ = this;
430 } 442 }
431 } 443 }
432 444
433 void SetDefaults(Type type, 445 void SetDefaults(Type type,
434 Scope* outer_scope, 446 Scope* outer_scope,
435 Handle<SerializedScopeInfo> scope_info); 447 Handle<SerializedScopeInfo> scope_info);
436 }; 448 };
437 449
438 } } // namespace v8::internal 450 } } // namespace v8::internal
439 451
440 #endif // V8_SCOPES_H_ 452 #endif // V8_SCOPES_H_
OLDNEW
« no previous file with comments | « src/scopeinfo.cc ('k') | src/scopes.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698