| OLD | NEW |
| 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 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 296 | 296 |
| 297 // Declarations list. | 297 // Declarations list. |
| 298 ZoneList<Declaration*>* declarations() { return &decls_; } | 298 ZoneList<Declaration*>* declarations() { return &decls_; } |
| 299 | 299 |
| 300 // Inner scope list. | 300 // Inner scope list. |
| 301 ZoneList<Scope*>* inner_scopes() { return &inner_scopes_; } | 301 ZoneList<Scope*>* inner_scopes() { return &inner_scopes_; } |
| 302 | 302 |
| 303 // --------------------------------------------------------------------------- | 303 // --------------------------------------------------------------------------- |
| 304 // Variable allocation. | 304 // Variable allocation. |
| 305 | 305 |
| 306 // Collect all used locals in this scope. | 306 // Collect stack and context allocated local variables in this scope. Note |
| 307 void CollectUsedVariables(ZoneList<Variable*>* locals); | 307 // that the function variable - if present - is not collected and should be |
| 308 // handled separately. |
| 309 void CollectStackAndContextLocals(ZoneList<Variable*>* stack_locals, |
| 310 ZoneList<Variable*>* context_locals); |
| 308 | 311 |
| 309 // Resolve and fill in the allocation information for all variables | 312 // Resolve and fill in the allocation information for all variables |
| 310 // in this scopes. Must be called *after* all scopes have been | 313 // in this scopes. Must be called *after* all scopes have been |
| 311 // processed (parsed) to ensure that unresolved variables can be | 314 // processed (parsed) to ensure that unresolved variables can be |
| 312 // resolved properly. | 315 // resolved properly. |
| 313 // | 316 // |
| 314 // In the case of code compiled and run using 'eval', the context | 317 // In the case of code compiled and run using 'eval', the context |
| 315 // parameter is the context in which eval was called. In all other | 318 // parameter is the context in which eval was called. In all other |
| 316 // cases the context parameter is an empty handle. | 319 // cases the context parameter is an empty handle. |
| 317 void AllocateVariables(Handle<Context> context); | 320 void AllocateVariables(Handle<Context> context); |
| 318 | 321 |
| 319 // Current number of var or const locals. | 322 // Current number of var or const locals. |
| 320 int num_var_or_const() { return num_var_or_const_; } | 323 int num_var_or_const() { return num_var_or_const_; } |
| 321 | 324 |
| 322 // Result of variable allocation. | 325 // Result of variable allocation. |
| 323 int num_stack_slots() const { return num_stack_slots_; } | 326 int num_stack_slots() const { return num_stack_slots_; } |
| 324 int num_heap_slots() const { return num_heap_slots_; } | 327 int num_heap_slots() const { return num_heap_slots_; } |
| 325 | 328 |
| 329 int StackLocalCount() const; |
| 330 int ContextLocalCount() const; |
| 331 |
| 326 // Make sure this scope and all outer scopes are eagerly compiled. | 332 // Make sure this scope and all outer scopes are eagerly compiled. |
| 327 void ForceEagerCompilation() { force_eager_compilation_ = true; } | 333 void ForceEagerCompilation() { force_eager_compilation_ = true; } |
| 328 | 334 |
| 329 // Determine if we can use lazy compilation for this scope. | 335 // Determine if we can use lazy compilation for this scope. |
| 330 bool AllowsLazyCompilation() const; | 336 bool AllowsLazyCompilation() const; |
| 331 | 337 |
| 332 // True if the outer context of this scope is always the global context. | 338 // True if the outer context of this scope is always the global context. |
| 333 bool HasTrivialOuterContext() const; | 339 bool HasTrivialOuterContext() const; |
| 334 | 340 |
| 335 // The number of contexts between this and scope; zero if this == scope. | 341 // The number of contexts between this and scope; zero if this == scope. |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 538 } | 544 } |
| 539 | 545 |
| 540 void SetDefaults(ScopeType type, | 546 void SetDefaults(ScopeType type, |
| 541 Scope* outer_scope, | 547 Scope* outer_scope, |
| 542 Handle<ScopeInfo> scope_info); | 548 Handle<ScopeInfo> scope_info); |
| 543 }; | 549 }; |
| 544 | 550 |
| 545 } } // namespace v8::internal | 551 } } // namespace v8::internal |
| 546 | 552 |
| 547 #endif // V8_SCOPES_H_ | 553 #endif // V8_SCOPES_H_ |
| OLD | NEW |