| 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 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 330 // True iff the expression is the null literal. | 330 // True iff the expression is the null literal. |
| 331 bool IsNullLiteral() const; | 331 bool IsNullLiteral() const; |
| 332 | 332 |
| 333 // True if we can prove that the expression is the undefined literal. Note | 333 // True if we can prove that the expression is the undefined literal. Note |
| 334 // that this also checks for loads of the global "undefined" variable. | 334 // that this also checks for loads of the global "undefined" variable. |
| 335 bool IsUndefinedLiteral() const; | 335 bool IsUndefinedLiteral() const; |
| 336 | 336 |
| 337 // True iff the expression is a valid target for an assignment. | 337 // True iff the expression is a valid target for an assignment. |
| 338 bool IsValidReferenceExpressionOrThis() const; | 338 bool IsValidReferenceExpressionOrThis() const; |
| 339 | 339 |
| 340 // Expression type bounds | |
| 341 Bounds bounds() const { return bounds_; } | |
| 342 void set_bounds(Bounds bounds) { bounds_ = bounds; } | |
| 343 | |
| 344 // Type feedback information for assignments and properties. | 340 // Type feedback information for assignments and properties. |
| 345 virtual bool IsMonomorphic() { | 341 virtual bool IsMonomorphic() { |
| 346 UNREACHABLE(); | 342 UNREACHABLE(); |
| 347 return false; | 343 return false; |
| 348 } | 344 } |
| 349 virtual SmallMapList* GetReceiverTypes() { | 345 virtual SmallMapList* GetReceiverTypes() { |
| 350 UNREACHABLE(); | 346 UNREACHABLE(); |
| 351 return NULL; | 347 return NULL; |
| 352 } | 348 } |
| 353 virtual KeyedAccessStoreMode GetStoreMode() const { | 349 virtual KeyedAccessStoreMode GetStoreMode() const { |
| (...skipping 13 matching lines...) Expand all Loading... |
| 367 | 363 |
| 368 void set_base_id(int id) { base_id_ = id; } | 364 void set_base_id(int id) { base_id_ = id; } |
| 369 static int num_ids() { return parent_num_ids() + 2; } | 365 static int num_ids() { return parent_num_ids() + 2; } |
| 370 BailoutId id() const { return BailoutId(local_id(0)); } | 366 BailoutId id() const { return BailoutId(local_id(0)); } |
| 371 TypeFeedbackId test_id() const { return TypeFeedbackId(local_id(1)); } | 367 TypeFeedbackId test_id() const { return TypeFeedbackId(local_id(1)); } |
| 372 | 368 |
| 373 protected: | 369 protected: |
| 374 Expression(Zone* zone, int pos) | 370 Expression(Zone* zone, int pos) |
| 375 : AstNode(pos), | 371 : AstNode(pos), |
| 376 base_id_(BailoutId::None().ToInt()), | 372 base_id_(BailoutId::None().ToInt()), |
| 377 bounds_(Bounds::Unbounded()), | |
| 378 bit_field_(0) {} | 373 bit_field_(0) {} |
| 379 static int parent_num_ids() { return 0; } | 374 static int parent_num_ids() { return 0; } |
| 380 void set_to_boolean_types(uint16_t types) { | 375 void set_to_boolean_types(uint16_t types) { |
| 381 bit_field_ = ToBooleanTypesField::update(bit_field_, types); | 376 bit_field_ = ToBooleanTypesField::update(bit_field_, types); |
| 382 } | 377 } |
| 383 | 378 |
| 384 int base_id() const { | 379 int base_id() const { |
| 385 DCHECK(!BailoutId(base_id_).IsNone()); | 380 DCHECK(!BailoutId(base_id_).IsNone()); |
| 386 return base_id_; | 381 return base_id_; |
| 387 } | 382 } |
| 388 | 383 |
| 389 private: | 384 private: |
| 390 int local_id(int n) const { return base_id() + parent_num_ids() + n; } | 385 int local_id(int n) const { return base_id() + parent_num_ids() + n; } |
| 391 | 386 |
| 392 int base_id_; | 387 int base_id_; |
| 393 Bounds bounds_; | |
| 394 class ToBooleanTypesField : public BitField16<uint16_t, 0, 9> {}; | 388 class ToBooleanTypesField : public BitField16<uint16_t, 0, 9> {}; |
| 395 uint16_t bit_field_; | 389 uint16_t bit_field_; |
| 396 // Ends with 16-bit field; deriving classes in turn begin with | 390 // Ends with 16-bit field; deriving classes in turn begin with |
| 397 // 16-bit fields for optimum packing efficiency. | 391 // 16-bit fields for optimum packing efficiency. |
| 398 }; | 392 }; |
| 399 | 393 |
| 400 | 394 |
| 401 class BreakableStatement : public Statement { | 395 class BreakableStatement : public Statement { |
| 402 public: | 396 public: |
| 403 enum BreakableType { | 397 enum BreakableType { |
| (...skipping 3154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3558 : NULL; \ | 3552 : NULL; \ |
| 3559 } | 3553 } |
| 3560 AST_NODE_LIST(DECLARE_NODE_FUNCTIONS) | 3554 AST_NODE_LIST(DECLARE_NODE_FUNCTIONS) |
| 3561 #undef DECLARE_NODE_FUNCTIONS | 3555 #undef DECLARE_NODE_FUNCTIONS |
| 3562 | 3556 |
| 3563 | 3557 |
| 3564 } // namespace internal | 3558 } // namespace internal |
| 3565 } // namespace v8 | 3559 } // namespace v8 |
| 3566 | 3560 |
| 3567 #endif // V8_AST_AST_H_ | 3561 #endif // V8_AST_AST_H_ |
| OLD | NEW |