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 Scope* scope() const { return scope_; } | 2511 Scope* scope() const { return scope_; } |
2512 ZoneList<Statement*>* body() const { return body_; } | 2512 ZoneList<Statement*>* body() const { return body_; } |
2513 void set_function_token_position(int pos) { function_token_position_ = pos; } | 2513 void set_function_token_position(int pos) { function_token_position_ = pos; } |
2514 int function_token_position() const { return function_token_position_; } | 2514 int function_token_position() const { return function_token_position_; } |
2515 int start_position() const; | 2515 int start_position() const; |
2516 int end_position() const; | 2516 int end_position() const; |
2517 int SourceSize() const { return end_position() - start_position(); } | 2517 int SourceSize() const { return end_position() - start_position(); } |
2518 bool is_expression() const { return IsExpression::decode(bitfield_); } | 2518 bool is_expression() const { return IsExpression::decode(bitfield_); } |
2519 bool is_anonymous() const { return IsAnonymous::decode(bitfield_); } | 2519 bool is_anonymous() const { return IsAnonymous::decode(bitfield_); } |
2520 LanguageMode language_mode() const; | 2520 LanguageMode language_mode() const; |
2521 bool uses_super_property() const; | |
2522 | 2521 |
2523 static bool NeedsHomeObject(Expression* literal) { | 2522 static bool NeedsHomeObject(Expression* expr); |
2524 return literal != NULL && literal->IsFunctionLiteral() && | |
2525 literal->AsFunctionLiteral()->uses_super_property(); | |
2526 } | |
2527 | 2523 |
2528 int materialized_literal_count() { return materialized_literal_count_; } | 2524 int materialized_literal_count() { return materialized_literal_count_; } |
2529 int expected_property_count() { return expected_property_count_; } | 2525 int expected_property_count() { return expected_property_count_; } |
2530 int handler_count() { return handler_count_; } | 2526 int handler_count() { return handler_count_; } |
2531 int parameter_count() { return parameter_count_; } | 2527 int parameter_count() { return parameter_count_; } |
2532 | 2528 |
2533 bool AllowsLazyCompilation(); | 2529 bool AllowsLazyCompilation(); |
2534 bool AllowsLazyCompilationWithoutContext(); | 2530 bool AllowsLazyCompilationWithoutContext(); |
2535 | 2531 |
2536 void InitializeSharedInfo(Handle<Code> code); | 2532 void InitializeSharedInfo(Handle<Code> code); |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2595 | 2591 |
2596 // A hint that we expect this function to be called (exactly) once, | 2592 // A hint that we expect this function to be called (exactly) once, |
2597 // i.e. we suspect it's an initialization function. | 2593 // i.e. we suspect it's an initialization function. |
2598 bool should_be_used_once_hint() const { | 2594 bool should_be_used_once_hint() const { |
2599 return ShouldBeUsedOnceHintBit::decode(bitfield_) == kShouldBeUsedOnce; | 2595 return ShouldBeUsedOnceHintBit::decode(bitfield_) == kShouldBeUsedOnce; |
2600 } | 2596 } |
2601 void set_should_be_used_once_hint() { | 2597 void set_should_be_used_once_hint() { |
2602 bitfield_ = ShouldBeUsedOnceHintBit::update(bitfield_, kShouldBeUsedOnce); | 2598 bitfield_ = ShouldBeUsedOnceHintBit::update(bitfield_, kShouldBeUsedOnce); |
2603 } | 2599 } |
2604 | 2600 |
2605 FunctionKind kind() { return FunctionKindBits::decode(bitfield_); } | 2601 FunctionKind kind() const { return FunctionKindBits::decode(bitfield_); } |
2606 | 2602 |
2607 int ast_node_count() { return ast_properties_.node_count(); } | 2603 int ast_node_count() { return ast_properties_.node_count(); } |
2608 AstProperties::Flags* flags() { return ast_properties_.flags(); } | 2604 AstProperties::Flags* flags() { return ast_properties_.flags(); } |
2609 void set_ast_properties(AstProperties* ast_properties) { | 2605 void set_ast_properties(AstProperties* ast_properties) { |
2610 ast_properties_ = *ast_properties; | 2606 ast_properties_ = *ast_properties; |
2611 } | 2607 } |
2612 const ZoneFeedbackVectorSpec* feedback_vector_spec() const { | 2608 const ZoneFeedbackVectorSpec* feedback_vector_spec() const { |
2613 return ast_properties_.get_spec(); | 2609 return ast_properties_.get_spec(); |
2614 } | 2610 } |
2615 bool dont_optimize() { return dont_optimize_reason_ != kNoReason; } | 2611 bool dont_optimize() { return dont_optimize_reason_ != kNoReason; } |
(...skipping 981 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3597 | 3593 |
3598 private: | 3594 private: |
3599 Zone* zone_; | 3595 Zone* zone_; |
3600 AstValueFactory* ast_value_factory_; | 3596 AstValueFactory* ast_value_factory_; |
3601 }; | 3597 }; |
3602 | 3598 |
3603 | 3599 |
3604 } } // namespace v8::internal | 3600 } } // namespace v8::internal |
3605 | 3601 |
3606 #endif // V8_AST_H_ | 3602 #endif // V8_AST_H_ |
OLD | NEW |