OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_SCOPES_H_ | 5 #ifndef V8_SCOPES_H_ |
6 #define V8_SCOPES_H_ | 6 #define V8_SCOPES_H_ |
7 | 7 |
8 #include "src/ast.h" | 8 #include "src/ast.h" |
9 #include "src/pending-compilation-error-handler.h" | 9 #include "src/pending-compilation-error-handler.h" |
10 #include "src/zone.h" | 10 #include "src/zone.h" |
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
340 // Does this scope have the potential to execute declarations non-linearly? | 340 // Does this scope have the potential to execute declarations non-linearly? |
341 bool is_nonlinear() const { return scope_nonlinear_; } | 341 bool is_nonlinear() const { return scope_nonlinear_; } |
342 | 342 |
343 // Whether this needs to be represented by a runtime context. | 343 // Whether this needs to be represented by a runtime context. |
344 bool NeedsContext() const { return num_heap_slots() > 0; } | 344 bool NeedsContext() const { return num_heap_slots() > 0; } |
345 | 345 |
346 bool NeedsHomeObject() const { | 346 bool NeedsHomeObject() const { |
347 return scope_uses_super_property_ || | 347 return scope_uses_super_property_ || |
348 (scope_calls_eval_ && (IsConciseMethod(function_kind()) || | 348 (scope_calls_eval_ && (IsConciseMethod(function_kind()) || |
349 IsAccessorFunction(function_kind()) || | 349 IsAccessorFunction(function_kind()) || |
350 IsConstructor(function_kind()))); | 350 IsClassConstructor(function_kind()))); |
351 } | 351 } |
352 | 352 |
353 const Scope* NearestOuterEvalScope() const { | 353 const Scope* NearestOuterEvalScope() const { |
354 if (is_eval_scope()) return this; | 354 if (is_eval_scope()) return this; |
355 if (outer_scope() == nullptr) return nullptr; | 355 if (outer_scope() == nullptr) return nullptr; |
356 return outer_scope()->NearestOuterEvalScope(); | 356 return outer_scope()->NearestOuterEvalScope(); |
357 } | 357 } |
358 | 358 |
359 // --------------------------------------------------------------------------- | 359 // --------------------------------------------------------------------------- |
360 // Accessors. | 360 // Accessors. |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
438 | 438 |
439 // The local variable 'arguments' if we need to allocate it; NULL otherwise. | 439 // The local variable 'arguments' if we need to allocate it; NULL otherwise. |
440 Variable* arguments() const { | 440 Variable* arguments() const { |
441 DCHECK(!is_arrow_scope() || arguments_ == nullptr); | 441 DCHECK(!is_arrow_scope() || arguments_ == nullptr); |
442 return arguments_; | 442 return arguments_; |
443 } | 443 } |
444 | 444 |
445 Variable* this_function_var() const { | 445 Variable* this_function_var() const { |
446 // This is only used in derived constructors atm. | 446 // This is only used in derived constructors atm. |
447 DCHECK(this_function_ == nullptr || | 447 DCHECK(this_function_ == nullptr || |
448 (is_function_scope() && (IsConstructor(function_kind()) || | 448 (is_function_scope() && (IsClassConstructor(function_kind()) || |
449 IsConciseMethod(function_kind()) || | 449 IsConciseMethod(function_kind()) || |
450 IsAccessorFunction(function_kind())))); | 450 IsAccessorFunction(function_kind())))); |
451 return this_function_; | 451 return this_function_; |
452 } | 452 } |
453 | 453 |
454 // Declarations list. | 454 // Declarations list. |
455 ZoneList<Declaration*>* declarations() { return &decls_; } | 455 ZoneList<Declaration*>* declarations() { return &decls_; } |
456 | 456 |
457 // Inner scope list. | 457 // Inner scope list. |
458 ZoneList<Scope*>* inner_scopes() { return &inner_scopes_; } | 458 ZoneList<Scope*>* inner_scopes() { return &inner_scopes_; } |
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
817 PendingCompilationErrorHandler pending_error_handler_; | 817 PendingCompilationErrorHandler pending_error_handler_; |
818 | 818 |
819 // For tracking which classes are declared consecutively. Needed for strong | 819 // For tracking which classes are declared consecutively. Needed for strong |
820 // mode. | 820 // mode. |
821 int class_declaration_group_start_; | 821 int class_declaration_group_start_; |
822 }; | 822 }; |
823 | 823 |
824 } } // namespace v8::internal | 824 } } // namespace v8::internal |
825 | 825 |
826 #endif // V8_SCOPES_H_ | 826 #endif // V8_SCOPES_H_ |
OLD | NEW |