| 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_AST_H_ | 5 #ifndef V8_AST_AST_H_ |
| 6 #define V8_AST_AST_H_ | 6 #define V8_AST_AST_H_ |
| 7 | 7 |
| 8 #include "src/assembler.h" | 8 #include "src/assembler.h" |
| 9 #include "src/ast/ast-value-factory.h" | 9 #include "src/ast/ast-value-factory.h" |
| 10 #include "src/ast/modules.h" | 10 #include "src/ast/modules.h" |
| (...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 369 virtual void RecordToBooleanTypeFeedback(TypeFeedbackOracle* oracle); | 369 virtual void RecordToBooleanTypeFeedback(TypeFeedbackOracle* oracle); |
| 370 uint16_t to_boolean_types() const { | 370 uint16_t to_boolean_types() const { |
| 371 return ToBooleanTypesField::decode(bit_field_); | 371 return ToBooleanTypesField::decode(bit_field_); |
| 372 } | 372 } |
| 373 | 373 |
| 374 void set_base_id(int id) { base_id_ = id; } | 374 void set_base_id(int id) { base_id_ = id; } |
| 375 static int num_ids() { return parent_num_ids() + 2; } | 375 static int num_ids() { return parent_num_ids() + 2; } |
| 376 BailoutId id() const { return BailoutId(local_id(0)); } | 376 BailoutId id() const { return BailoutId(local_id(0)); } |
| 377 TypeFeedbackId test_id() const { return TypeFeedbackId(local_id(1)); } | 377 TypeFeedbackId test_id() const { return TypeFeedbackId(local_id(1)); } |
| 378 | 378 |
| 379 // Parenthesized expressions in the form `( Expression )`. | |
| 380 void set_is_parenthesized() { | |
| 381 bit_field_ = ParenthesizedField::update(bit_field_, true); | |
| 382 } | |
| 383 bool is_parenthesized() const { | |
| 384 return ParenthesizedField::decode(bit_field_); | |
| 385 } | |
| 386 | |
| 387 protected: | 379 protected: |
| 388 Expression(Zone* zone, int pos) | 380 Expression(Zone* zone, int pos) |
| 389 : AstNode(pos), | 381 : AstNode(pos), |
| 390 base_id_(BailoutId::None().ToInt()), | 382 base_id_(BailoutId::None().ToInt()), |
| 391 bounds_(Bounds::Unbounded()), | 383 bounds_(Bounds::Unbounded()), |
| 392 bit_field_(0) {} | 384 bit_field_(0) {} |
| 393 static int parent_num_ids() { return 0; } | 385 static int parent_num_ids() { return 0; } |
| 394 void set_to_boolean_types(uint16_t types) { | 386 void set_to_boolean_types(uint16_t types) { |
| 395 bit_field_ = ToBooleanTypesField::update(bit_field_, types); | 387 bit_field_ = ToBooleanTypesField::update(bit_field_, types); |
| 396 } | 388 } |
| 397 | 389 |
| 398 int base_id() const { | 390 int base_id() const { |
| 399 DCHECK(!BailoutId(base_id_).IsNone()); | 391 DCHECK(!BailoutId(base_id_).IsNone()); |
| 400 return base_id_; | 392 return base_id_; |
| 401 } | 393 } |
| 402 | 394 |
| 403 private: | 395 private: |
| 404 int local_id(int n) const { return base_id() + parent_num_ids() + n; } | 396 int local_id(int n) const { return base_id() + parent_num_ids() + n; } |
| 405 | 397 |
| 406 int base_id_; | 398 int base_id_; |
| 407 Bounds bounds_; | 399 Bounds bounds_; |
| 408 class ToBooleanTypesField : public BitField16<uint16_t, 0, 9> {}; | 400 class ToBooleanTypesField : public BitField16<uint16_t, 0, 9> {}; |
| 409 class ParenthesizedField | |
| 410 : public BitField16<bool, ToBooleanTypesField::kNext, 1> {}; | |
| 411 uint16_t bit_field_; | 401 uint16_t bit_field_; |
| 412 // Ends with 16-bit field; deriving classes in turn begin with | 402 // Ends with 16-bit field; deriving classes in turn begin with |
| 413 // 16-bit fields for optimum packing efficiency. | 403 // 16-bit fields for optimum packing efficiency. |
| 414 }; | 404 }; |
| 415 | 405 |
| 416 | 406 |
| 417 class BreakableStatement : public Statement { | 407 class BreakableStatement : public Statement { |
| 418 public: | 408 public: |
| 419 enum BreakableType { | 409 enum BreakableType { |
| 420 TARGET_FOR_ANONYMOUS, | 410 TARGET_FOR_ANONYMOUS, |
| (...skipping 3140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3561 // the parser-level zone. | 3551 // the parser-level zone. |
| 3562 Zone* parser_zone_; | 3552 Zone* parser_zone_; |
| 3563 AstValueFactory* ast_value_factory_; | 3553 AstValueFactory* ast_value_factory_; |
| 3564 }; | 3554 }; |
| 3565 | 3555 |
| 3566 | 3556 |
| 3567 } // namespace internal | 3557 } // namespace internal |
| 3568 } // namespace v8 | 3558 } // namespace v8 |
| 3569 | 3559 |
| 3570 #endif // V8_AST_AST_H_ | 3560 #endif // V8_AST_AST_H_ |
| OLD | NEW |