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 2479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2490 Scope* scope() const { return scope_; } | 2490 Scope* scope() const { return scope_; } |
2491 ZoneList<Statement*>* body() const { return body_; } | 2491 ZoneList<Statement*>* body() const { return body_; } |
2492 void set_function_token_position(int pos) { function_token_position_ = pos; } | 2492 void set_function_token_position(int pos) { function_token_position_ = pos; } |
2493 int function_token_position() const { return function_token_position_; } | 2493 int function_token_position() const { return function_token_position_; } |
2494 int start_position() const; | 2494 int start_position() const; |
2495 int end_position() const; | 2495 int end_position() const; |
2496 int SourceSize() const { return end_position() - start_position(); } | 2496 int SourceSize() const { return end_position() - start_position(); } |
2497 bool is_expression() const { return IsExpression::decode(bitfield_); } | 2497 bool is_expression() const { return IsExpression::decode(bitfield_); } |
2498 bool is_anonymous() const { return IsAnonymous::decode(bitfield_); } | 2498 bool is_anonymous() const { return IsAnonymous::decode(bitfield_); } |
2499 StrictMode strict_mode() const; | 2499 StrictMode strict_mode() const; |
2500 bool needs_super_binding() const; | 2500 bool uses_super() const; |
2501 | 2501 |
2502 static bool NeedsHomeObject(Expression* literal) { | 2502 static bool NeedsHomeObject(Expression* literal) { |
2503 return literal != NULL && literal->IsFunctionLiteral() && | 2503 return literal != NULL && literal->IsFunctionLiteral() && |
2504 literal->AsFunctionLiteral()->needs_super_binding(); | 2504 literal->AsFunctionLiteral()->uses_super(); |
2505 } | 2505 } |
2506 | 2506 |
2507 int materialized_literal_count() { return materialized_literal_count_; } | 2507 int materialized_literal_count() { return materialized_literal_count_; } |
2508 int expected_property_count() { return expected_property_count_; } | 2508 int expected_property_count() { return expected_property_count_; } |
2509 int handler_count() { return handler_count_; } | 2509 int handler_count() { return handler_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 |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2578 } | 2578 } |
2579 bool is_generator() { | 2579 bool is_generator() { |
2580 return IsGeneratorFunction(FunctionKindBits::decode(bitfield_)); | 2580 return IsGeneratorFunction(FunctionKindBits::decode(bitfield_)); |
2581 } | 2581 } |
2582 bool is_concise_method() { | 2582 bool is_concise_method() { |
2583 return IsConciseMethod(FunctionKindBits::decode(bitfield_)); | 2583 return IsConciseMethod(FunctionKindBits::decode(bitfield_)); |
2584 } | 2584 } |
2585 bool is_default_constructor() { | 2585 bool is_default_constructor() { |
2586 return IsDefaultConstructor(FunctionKindBits::decode(bitfield_)); | 2586 return IsDefaultConstructor(FunctionKindBits::decode(bitfield_)); |
2587 } | 2587 } |
2588 bool is_default_constructor_call_super() { | |
2589 return IsDefaultConstructorCallSuper(FunctionKindBits::decode(bitfield_)); | |
2590 } | |
2591 | 2588 |
2592 int ast_node_count() { return ast_properties_.node_count(); } | 2589 int ast_node_count() { return ast_properties_.node_count(); } |
2593 AstProperties::Flags* flags() { return ast_properties_.flags(); } | 2590 AstProperties::Flags* flags() { return ast_properties_.flags(); } |
2594 void set_ast_properties(AstProperties* ast_properties) { | 2591 void set_ast_properties(AstProperties* ast_properties) { |
2595 ast_properties_ = *ast_properties; | 2592 ast_properties_ = *ast_properties; |
2596 } | 2593 } |
2597 int slot_count() { | 2594 int slot_count() { |
2598 return ast_properties_.feedback_slots(); | 2595 return ast_properties_.feedback_slots(); |
2599 } | 2596 } |
2600 int ic_slot_count() { return ast_properties_.ic_feedback_slots(); } | 2597 int ic_slot_count() { return ast_properties_.ic_feedback_slots(); } |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2652 int parameter_count_; | 2649 int parameter_count_; |
2653 int function_token_position_; | 2650 int function_token_position_; |
2654 | 2651 |
2655 unsigned bitfield_; | 2652 unsigned bitfield_; |
2656 class IsExpression : public BitField<bool, 0, 1> {}; | 2653 class IsExpression : public BitField<bool, 0, 1> {}; |
2657 class IsAnonymous : public BitField<bool, 1, 1> {}; | 2654 class IsAnonymous : public BitField<bool, 1, 1> {}; |
2658 class Pretenure : public BitField<bool, 2, 1> {}; | 2655 class Pretenure : public BitField<bool, 2, 1> {}; |
2659 class HasDuplicateParameters : public BitField<ParameterFlag, 3, 1> {}; | 2656 class HasDuplicateParameters : public BitField<ParameterFlag, 3, 1> {}; |
2660 class IsFunction : public BitField<IsFunctionFlag, 4, 1> {}; | 2657 class IsFunction : public BitField<IsFunctionFlag, 4, 1> {}; |
2661 class IsParenthesized : public BitField<IsParenthesizedFlag, 5, 1> {}; | 2658 class IsParenthesized : public BitField<IsParenthesizedFlag, 5, 1> {}; |
2662 class FunctionKindBits : public BitField<FunctionKind, 6, 5> {}; | 2659 class FunctionKindBits : public BitField<FunctionKind, 6, 4> {}; |
2663 }; | 2660 }; |
2664 | 2661 |
2665 | 2662 |
2666 class ClassLiteral FINAL : public Expression { | 2663 class ClassLiteral FINAL : public Expression { |
2667 public: | 2664 public: |
2668 typedef ObjectLiteralProperty Property; | 2665 typedef ObjectLiteralProperty Property; |
2669 | 2666 |
2670 DECLARE_NODE_TYPE(ClassLiteral) | 2667 DECLARE_NODE_TYPE(ClassLiteral) |
2671 | 2668 |
2672 Handle<String> name() const { return raw_name_->string(); } | 2669 Handle<String> name() const { return raw_name_->string(); } |
(...skipping 1037 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3710 private: | 3707 private: |
3711 Zone* zone_; | 3708 Zone* zone_; |
3712 Visitor visitor_; | 3709 Visitor visitor_; |
3713 AstValueFactory* ast_value_factory_; | 3710 AstValueFactory* ast_value_factory_; |
3714 }; | 3711 }; |
3715 | 3712 |
3716 | 3713 |
3717 } } // namespace v8::internal | 3714 } } // namespace v8::internal |
3718 | 3715 |
3719 #endif // V8_AST_H_ | 3716 #endif // V8_AST_H_ |
OLD | NEW |