| 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_AST_H_ | 5 #ifndef V8_AST_H_ |
| 6 #define V8_AST_H_ | 6 #define V8_AST_H_ |
| 7 | 7 |
| 8 #include "src/v8.h" | 8 #include "src/v8.h" |
| 9 | 9 |
| 10 #include "src/assembler.h" | 10 #include "src/assembler.h" |
| (...skipping 2494 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2505 | 2505 |
| 2506 static bool NeedsHomeObject(Expression* expr); | 2506 static bool NeedsHomeObject(Expression* expr); |
| 2507 | 2507 |
| 2508 int materialized_literal_count() { return materialized_literal_count_; } | 2508 int materialized_literal_count() { return materialized_literal_count_; } |
| 2509 int expected_property_count() { return expected_property_count_; } | 2509 int expected_property_count() { return expected_property_count_; } |
| 2510 int parameter_count() { return parameter_count_; } | 2510 int parameter_count() { return parameter_count_; } |
| 2511 | 2511 |
| 2512 bool AllowsLazyCompilation(); | 2512 bool AllowsLazyCompilation(); |
| 2513 bool AllowsLazyCompilationWithoutContext(); | 2513 bool AllowsLazyCompilationWithoutContext(); |
| 2514 | 2514 |
| 2515 void InitializeSharedInfo(Handle<Code> code); | |
| 2516 | |
| 2517 Handle<String> debug_name() const { | 2515 Handle<String> debug_name() const { |
| 2518 if (raw_name_ != NULL && !raw_name_->IsEmpty()) { | 2516 if (raw_name_ != NULL && !raw_name_->IsEmpty()) { |
| 2519 return raw_name_->string(); | 2517 return raw_name_->string(); |
| 2520 } | 2518 } |
| 2521 return inferred_name(); | 2519 return inferred_name(); |
| 2522 } | 2520 } |
| 2523 | 2521 |
| 2524 Handle<String> inferred_name() const { | 2522 Handle<String> inferred_name() const { |
| 2525 if (!inferred_name_.is_null()) { | 2523 if (!inferred_name_.is_null()) { |
| 2526 DCHECK(raw_inferred_name_ == NULL); | 2524 DCHECK(raw_inferred_name_ == NULL); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 2541 raw_inferred_name_ = NULL; | 2539 raw_inferred_name_ = NULL; |
| 2542 } | 2540 } |
| 2543 | 2541 |
| 2544 void set_raw_inferred_name(const AstString* raw_inferred_name) { | 2542 void set_raw_inferred_name(const AstString* raw_inferred_name) { |
| 2545 DCHECK(raw_inferred_name != NULL); | 2543 DCHECK(raw_inferred_name != NULL); |
| 2546 raw_inferred_name_ = raw_inferred_name; | 2544 raw_inferred_name_ = raw_inferred_name; |
| 2547 DCHECK(inferred_name_.is_null()); | 2545 DCHECK(inferred_name_.is_null()); |
| 2548 inferred_name_ = Handle<String>(); | 2546 inferred_name_ = Handle<String>(); |
| 2549 } | 2547 } |
| 2550 | 2548 |
| 2551 // shared_info may be null if it's not cached in full code. | |
| 2552 Handle<SharedFunctionInfo> shared_info() { return shared_info_; } | |
| 2553 | |
| 2554 bool pretenure() { return Pretenure::decode(bitfield_); } | 2549 bool pretenure() { return Pretenure::decode(bitfield_); } |
| 2555 void set_pretenure() { bitfield_ |= Pretenure::encode(true); } | 2550 void set_pretenure() { bitfield_ |= Pretenure::encode(true); } |
| 2556 | 2551 |
| 2557 bool has_duplicate_parameters() { | 2552 bool has_duplicate_parameters() { |
| 2558 return HasDuplicateParameters::decode(bitfield_); | 2553 return HasDuplicateParameters::decode(bitfield_); |
| 2559 } | 2554 } |
| 2560 | 2555 |
| 2561 bool is_function() { return IsFunction::decode(bitfield_) == kIsFunction; } | 2556 bool is_function() { return IsFunction::decode(bitfield_) == kIsFunction; } |
| 2562 | 2557 |
| 2563 // This is used as a heuristic on when to eagerly compile a function | 2558 // This is used as a heuristic on when to eagerly compile a function |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2625 IsFunction::encode(is_function) | | 2620 IsFunction::encode(is_function) | |
| 2626 EagerCompileHintBit::encode(eager_compile_hint) | | 2621 EagerCompileHintBit::encode(eager_compile_hint) | |
| 2627 FunctionKindBits::encode(kind) | | 2622 FunctionKindBits::encode(kind) | |
| 2628 ShouldBeUsedOnceHintBit::encode(kDontKnowIfShouldBeUsedOnce); | 2623 ShouldBeUsedOnceHintBit::encode(kDontKnowIfShouldBeUsedOnce); |
| 2629 DCHECK(IsValidFunctionKind(kind)); | 2624 DCHECK(IsValidFunctionKind(kind)); |
| 2630 } | 2625 } |
| 2631 | 2626 |
| 2632 private: | 2627 private: |
| 2633 const AstRawString* raw_name_; | 2628 const AstRawString* raw_name_; |
| 2634 Handle<String> name_; | 2629 Handle<String> name_; |
| 2635 Handle<SharedFunctionInfo> shared_info_; | |
| 2636 Scope* scope_; | 2630 Scope* scope_; |
| 2637 ZoneList<Statement*>* body_; | 2631 ZoneList<Statement*>* body_; |
| 2638 const AstString* raw_inferred_name_; | 2632 const AstString* raw_inferred_name_; |
| 2639 Handle<String> inferred_name_; | 2633 Handle<String> inferred_name_; |
| 2640 AstProperties ast_properties_; | 2634 AstProperties ast_properties_; |
| 2641 BailoutReason dont_optimize_reason_; | 2635 BailoutReason dont_optimize_reason_; |
| 2642 | 2636 |
| 2643 int materialized_literal_count_; | 2637 int materialized_literal_count_; |
| 2644 int expected_property_count_; | 2638 int expected_property_count_; |
| 2645 int parameter_count_; | 2639 int parameter_count_; |
| (...skipping 958 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3604 | 3598 |
| 3605 private: | 3599 private: |
| 3606 Zone* zone_; | 3600 Zone* zone_; |
| 3607 AstValueFactory* ast_value_factory_; | 3601 AstValueFactory* ast_value_factory_; |
| 3608 }; | 3602 }; |
| 3609 | 3603 |
| 3610 | 3604 |
| 3611 } } // namespace v8::internal | 3605 } } // namespace v8::internal |
| 3612 | 3606 |
| 3613 #endif // V8_AST_H_ | 3607 #endif // V8_AST_H_ |
| OLD | NEW |