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

Side by Side Diff: src/scopes.h

Issue 7860045: Stack allocating block scoped variables. Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebased on tip of tree. Created 9 years 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 321 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 // Current number of var or const locals. 332 // Current number of var or const locals.
333 int num_var_or_const() { return num_var_or_const_; } 333 int num_var_or_const() { return num_var_or_const_; }
334 334
335 // Result of variable allocation. 335 // Result of variable allocation.
336 int num_stack_slots() const { return num_stack_slots_; } 336 int num_stack_slots() const { return num_stack_slots_; }
337 int num_heap_slots() const { return num_heap_slots_; } 337 int num_heap_slots() const { return num_heap_slots_; }
338 338
339 int StackLocalCount() const; 339 int StackLocalCount() const;
340 int ContextLocalCount() const; 340 int ContextLocalCount() const;
341 341
342 // Computed during code generation; for block scopes only. The depth
343 // above the function locals on the stack at which the stack locals
344 // of the block start.
345 int stack_slots_depth() const {
346 return stack_slots_depth_;
347 }
348 void set_stack_slots_depth(int stack_slots_depth) {
349 stack_slots_depth_ = stack_slots_depth;
350 }
351
342 // Make sure this scope and all outer scopes are eagerly compiled. 352 // Make sure this scope and all outer scopes are eagerly compiled.
343 void ForceEagerCompilation() { force_eager_compilation_ = true; } 353 void ForceEagerCompilation() { force_eager_compilation_ = true; }
344 354
345 // Determine if we can use lazy compilation for this scope. 355 // Determine if we can use lazy compilation for this scope.
346 bool AllowsLazyCompilation() const; 356 bool AllowsLazyCompilation() const;
347 357
348 // True if the outer context of this scope is always the global context. 358 // True if the outer context of this scope is always the global context.
349 bool HasTrivialOuterContext() const; 359 bool HasTrivialOuterContext() const;
350 360
351 // The number of contexts between this and scope; zero if this == scope. 361 // The number of contexts between this and scope; zero if this == scope.
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
449 // constructed based on a serialized scope info or a catch context). 459 // constructed based on a serialized scope info or a catch context).
450 bool already_resolved_; 460 bool already_resolved_;
451 461
452 // Computed as variables are declared. 462 // Computed as variables are declared.
453 int num_var_or_const_; 463 int num_var_or_const_;
454 464
455 // Computed via AllocateVariables; function, block and catch scopes only. 465 // Computed via AllocateVariables; function, block and catch scopes only.
456 int num_stack_slots_; 466 int num_stack_slots_;
457 int num_heap_slots_; 467 int num_heap_slots_;
458 468
469 // Computed during code generation; for block scopes only.
470 int stack_slots_depth_;
471
459 // Serialized scope info support. 472 // Serialized scope info support.
460 Handle<ScopeInfo> scope_info_; 473 Handle<ScopeInfo> scope_info_;
461 bool already_resolved() { return already_resolved_; } 474 bool already_resolved() { return already_resolved_; }
462 475
463 // Create a non-local variable with a given name. 476 // Create a non-local variable with a given name.
464 // These variables are looked up dynamically at runtime. 477 // These variables are looked up dynamically at runtime.
465 Variable* NonLocal(Handle<String> name, VariableMode mode); 478 Variable* NonLocal(Handle<String> name, VariableMode mode);
466 479
467 // Variable resolution. 480 // Variable resolution.
468 // Possible results of a recursive variable lookup telling if and how a 481 // Possible results of a recursive variable lookup telling if and how a
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
551 } 564 }
552 565
553 void SetDefaults(ScopeType type, 566 void SetDefaults(ScopeType type,
554 Scope* outer_scope, 567 Scope* outer_scope,
555 Handle<ScopeInfo> scope_info); 568 Handle<ScopeInfo> scope_info);
556 }; 569 };
557 570
558 } } // namespace v8::internal 571 } } // namespace v8::internal
559 572
560 #endif // V8_SCOPES_H_ 573 #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