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

Side by Side Diff: src/scopes.h

Issue 6810016: Merge 7519 to trunk (Closed) Base URL: http://v8.googlecode.com/svn/trunk/
Patch Set: Created 9 years, 8 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 | « no previous file | 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 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 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 360 matching lines...) Expand 10 before | Expand all | Expand 10 after
371 bool outer_scope_calls_eval_; 371 bool outer_scope_calls_eval_;
372 bool inner_scope_calls_eval_; 372 bool inner_scope_calls_eval_;
373 bool outer_scope_is_eval_scope_; 373 bool outer_scope_is_eval_scope_;
374 bool force_eager_compilation_; 374 bool force_eager_compilation_;
375 375
376 // Computed via AllocateVariables; function scopes only. 376 // Computed via AllocateVariables; function scopes only.
377 int num_stack_slots_; 377 int num_stack_slots_;
378 int num_heap_slots_; 378 int num_heap_slots_;
379 379
380 // Serialized scopes support. 380 // Serialized scopes support.
381 SerializedScopeInfo* scope_info_; 381 Handle<SerializedScopeInfo> scope_info_;
382 bool resolved() { return scope_info_ != NULL; } 382 bool resolved() { return !scope_info_.is_null(); }
383 383
384 // Create a non-local variable with a given name. 384 // Create a non-local variable with a given name.
385 // These variables are looked up dynamically at runtime. 385 // These variables are looked up dynamically at runtime.
386 Variable* NonLocal(Handle<String> name, Variable::Mode mode); 386 Variable* NonLocal(Handle<String> name, Variable::Mode mode);
387 387
388 // Variable resolution. 388 // Variable resolution.
389 Variable* LookupRecursive(Handle<String> name, 389 Variable* LookupRecursive(Handle<String> name,
390 bool inner_lookup, 390 bool inner_lookup,
391 Variable** invalidated_local); 391 Variable** invalidated_local);
392 void ResolveVariable(Scope* global_scope, 392 void ResolveVariable(Scope* global_scope,
(...skipping 14 matching lines...) Expand all
407 407
408 // Variable allocation. 408 // Variable allocation.
409 void AllocateStackSlot(Variable* var); 409 void AllocateStackSlot(Variable* var);
410 void AllocateHeapSlot(Variable* var); 410 void AllocateHeapSlot(Variable* var);
411 void AllocateParameterLocals(); 411 void AllocateParameterLocals();
412 void AllocateNonParameterLocal(Variable* var); 412 void AllocateNonParameterLocal(Variable* var);
413 void AllocateNonParameterLocals(); 413 void AllocateNonParameterLocals();
414 void AllocateVariablesRecursively(); 414 void AllocateVariablesRecursively();
415 415
416 private: 416 private:
417 Scope(Scope* inner_scope, SerializedScopeInfo* scope_info); 417 Scope(Scope* inner_scope, Handle<SerializedScopeInfo> scope_info);
418 418
419 void AddInnerScope(Scope* inner_scope) { 419 void AddInnerScope(Scope* inner_scope) {
420 if (inner_scope != NULL) { 420 if (inner_scope != NULL) {
421 inner_scopes_.Add(inner_scope); 421 inner_scopes_.Add(inner_scope);
422 inner_scope->outer_scope_ = this; 422 inner_scope->outer_scope_ = this;
423 } 423 }
424 } 424 }
425 425
426 void SetDefaults(Type type, 426 void SetDefaults(Type type,
427 Scope* outer_scope, 427 Scope* outer_scope,
428 SerializedScopeInfo* scope_info) { 428 Handle<SerializedScopeInfo> scope_info);
429 outer_scope_ = outer_scope;
430 type_ = type;
431 scope_name_ = FACTORY->empty_symbol();
432 dynamics_ = NULL;
433 receiver_ = NULL;
434 function_ = NULL;
435 arguments_ = NULL;
436 arguments_shadow_ = NULL;
437 illegal_redecl_ = NULL;
438 scope_inside_with_ = false;
439 scope_contains_with_ = false;
440 scope_calls_eval_ = false;
441 // Inherit the strict mode from the parent scope.
442 strict_mode_ = (outer_scope != NULL) && outer_scope->strict_mode_;
443 outer_scope_calls_eval_ = false;
444 inner_scope_calls_eval_ = false;
445 outer_scope_is_eval_scope_ = false;
446 force_eager_compilation_ = false;
447 num_stack_slots_ = 0;
448 num_heap_slots_ = 0;
449 scope_info_ = scope_info;
450 }
451 }; 429 };
452 430
453 431
454 // Scope used during pre-parsing. 432 // Scope used during pre-parsing.
455 class DummyScope : public Scope { 433 class DummyScope : public Scope {
456 public: 434 public:
457 DummyScope() 435 DummyScope()
458 : Scope(GLOBAL_SCOPE), 436 : Scope(GLOBAL_SCOPE),
459 nesting_level_(1), // Allows us to Leave the initial scope. 437 nesting_level_(1), // Allows us to Leave the initial scope.
460 inside_with_level_(kNotInsideWith) { 438 inside_with_level_(kNotInsideWith) {
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
499 int nesting_level_; 477 int nesting_level_;
500 // Nesting level of outermost scope that is contained in a with statement, 478 // Nesting level of outermost scope that is contained in a with statement,
501 // or kNotInsideWith if there are no with's around the current scope. 479 // or kNotInsideWith if there are no with's around the current scope.
502 int inside_with_level_; 480 int inside_with_level_;
503 }; 481 };
504 482
505 483
506 } } // namespace v8::internal 484 } } // namespace v8::internal
507 485
508 #endif // V8_SCOPES_H_ 486 #endif // V8_SCOPES_H_
OLDNEW
« no previous file with comments | « no previous file | src/scopes.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698