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