| 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 2500 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2511 | 2511 |
| 2512 static bool NeedsHomeObject(Expression* expr); | 2512 static bool NeedsHomeObject(Expression* expr); |
| 2513 | 2513 |
| 2514 int materialized_literal_count() { return materialized_literal_count_; } | 2514 int materialized_literal_count() { return materialized_literal_count_; } |
| 2515 int expected_property_count() { return expected_property_count_; } | 2515 int expected_property_count() { return expected_property_count_; } |
| 2516 int parameter_count() { return parameter_count_; } | 2516 int parameter_count() { return parameter_count_; } |
| 2517 | 2517 |
| 2518 bool AllowsLazyCompilation(); | 2518 bool AllowsLazyCompilation(); |
| 2519 bool AllowsLazyCompilationWithoutContext(); | 2519 bool AllowsLazyCompilationWithoutContext(); |
| 2520 | 2520 |
| 2521 void InitializeSharedInfo(Handle<Code> code); | |
| 2522 | |
| 2523 Handle<String> debug_name() const { | 2521 Handle<String> debug_name() const { |
| 2524 if (raw_name_ != NULL && !raw_name_->IsEmpty()) { | 2522 if (raw_name_ != NULL && !raw_name_->IsEmpty()) { |
| 2525 return raw_name_->string(); | 2523 return raw_name_->string(); |
| 2526 } | 2524 } |
| 2527 return inferred_name(); | 2525 return inferred_name(); |
| 2528 } | 2526 } |
| 2529 | 2527 |
| 2530 Handle<String> inferred_name() const { | 2528 Handle<String> inferred_name() const { |
| 2531 if (!inferred_name_.is_null()) { | 2529 if (!inferred_name_.is_null()) { |
| 2532 DCHECK(raw_inferred_name_ == NULL); | 2530 DCHECK(raw_inferred_name_ == NULL); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 2547 raw_inferred_name_ = NULL; | 2545 raw_inferred_name_ = NULL; |
| 2548 } | 2546 } |
| 2549 | 2547 |
| 2550 void set_raw_inferred_name(const AstString* raw_inferred_name) { | 2548 void set_raw_inferred_name(const AstString* raw_inferred_name) { |
| 2551 DCHECK(raw_inferred_name != NULL); | 2549 DCHECK(raw_inferred_name != NULL); |
| 2552 raw_inferred_name_ = raw_inferred_name; | 2550 raw_inferred_name_ = raw_inferred_name; |
| 2553 DCHECK(inferred_name_.is_null()); | 2551 DCHECK(inferred_name_.is_null()); |
| 2554 inferred_name_ = Handle<String>(); | 2552 inferred_name_ = Handle<String>(); |
| 2555 } | 2553 } |
| 2556 | 2554 |
| 2557 // shared_info may be null if it's not cached in full code. | |
| 2558 Handle<SharedFunctionInfo> shared_info() { return shared_info_; } | |
| 2559 | |
| 2560 bool pretenure() { return Pretenure::decode(bitfield_); } | 2555 bool pretenure() { return Pretenure::decode(bitfield_); } |
| 2561 void set_pretenure() { bitfield_ |= Pretenure::encode(true); } | 2556 void set_pretenure() { bitfield_ |= Pretenure::encode(true); } |
| 2562 | 2557 |
| 2563 bool has_duplicate_parameters() { | 2558 bool has_duplicate_parameters() { |
| 2564 return HasDuplicateParameters::decode(bitfield_); | 2559 return HasDuplicateParameters::decode(bitfield_); |
| 2565 } | 2560 } |
| 2566 | 2561 |
| 2567 bool is_function() { return IsFunction::decode(bitfield_) == kIsFunction; } | 2562 bool is_function() { return IsFunction::decode(bitfield_) == kIsFunction; } |
| 2568 | 2563 |
| 2569 // This is used as a heuristic on when to eagerly compile a function | 2564 // 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... |
| 2631 IsFunction::encode(is_function) | | 2626 IsFunction::encode(is_function) | |
| 2632 EagerCompileHintBit::encode(eager_compile_hint) | | 2627 EagerCompileHintBit::encode(eager_compile_hint) | |
| 2633 FunctionKindBits::encode(kind) | | 2628 FunctionKindBits::encode(kind) | |
| 2634 ShouldBeUsedOnceHintBit::encode(kDontKnowIfShouldBeUsedOnce); | 2629 ShouldBeUsedOnceHintBit::encode(kDontKnowIfShouldBeUsedOnce); |
| 2635 DCHECK(IsValidFunctionKind(kind)); | 2630 DCHECK(IsValidFunctionKind(kind)); |
| 2636 } | 2631 } |
| 2637 | 2632 |
| 2638 private: | 2633 private: |
| 2639 const AstRawString* raw_name_; | 2634 const AstRawString* raw_name_; |
| 2640 Handle<String> name_; | 2635 Handle<String> name_; |
| 2641 Handle<SharedFunctionInfo> shared_info_; | |
| 2642 Scope* scope_; | 2636 Scope* scope_; |
| 2643 ZoneList<Statement*>* body_; | 2637 ZoneList<Statement*>* body_; |
| 2644 const AstString* raw_inferred_name_; | 2638 const AstString* raw_inferred_name_; |
| 2645 Handle<String> inferred_name_; | 2639 Handle<String> inferred_name_; |
| 2646 AstProperties ast_properties_; | 2640 AstProperties ast_properties_; |
| 2647 BailoutReason dont_optimize_reason_; | 2641 BailoutReason dont_optimize_reason_; |
| 2648 | 2642 |
| 2649 int materialized_literal_count_; | 2643 int materialized_literal_count_; |
| 2650 int expected_property_count_; | 2644 int expected_property_count_; |
| 2651 int parameter_count_; | 2645 int parameter_count_; |
| (...skipping 958 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3610 | 3604 |
| 3611 private: | 3605 private: |
| 3612 Zone* zone_; | 3606 Zone* zone_; |
| 3613 AstValueFactory* ast_value_factory_; | 3607 AstValueFactory* ast_value_factory_; |
| 3614 }; | 3608 }; |
| 3615 | 3609 |
| 3616 | 3610 |
| 3617 } } // namespace v8::internal | 3611 } } // namespace v8::internal |
| 3618 | 3612 |
| 3619 #endif // V8_AST_H_ | 3613 #endif // V8_AST_H_ |
| OLD | NEW |