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 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
356 bool IsNullLiteral() const; | 356 bool IsNullLiteral() const; |
357 | 357 |
358 // True if we can prove that the expression is the undefined literal. | 358 // True if we can prove that the expression is the undefined literal. |
359 bool IsUndefinedLiteral(Isolate* isolate) const; | 359 bool IsUndefinedLiteral(Isolate* isolate) const; |
360 | 360 |
361 // Expression type bounds | 361 // Expression type bounds |
362 Bounds bounds() const { return bounds_; } | 362 Bounds bounds() const { return bounds_; } |
363 void set_bounds(Bounds bounds) { bounds_ = bounds; } | 363 void set_bounds(Bounds bounds) { bounds_ = bounds; } |
364 | 364 |
365 // Whether the expression is parenthesized | 365 // Whether the expression is parenthesized |
366 unsigned parenthesization_level() const { return parenthesization_level_; } | 366 bool is_parenthesized() const { return is_parenthesized_; } |
367 bool is_parenthesized() const { return parenthesization_level_ > 0; } | 367 bool is_multi_parenthesized() const { return is_multi_parenthesized_; } |
368 void increase_parenthesization_level() { ++parenthesization_level_; } | 368 void increase_parenthesization_level() { |
| 369 is_multi_parenthesized_ = is_parenthesized_; |
| 370 is_parenthesized_ = true; |
| 371 } |
369 | 372 |
370 // Type feedback information for assignments and properties. | 373 // Type feedback information for assignments and properties. |
371 virtual bool IsMonomorphic() { | 374 virtual bool IsMonomorphic() { |
372 UNREACHABLE(); | 375 UNREACHABLE(); |
373 return false; | 376 return false; |
374 } | 377 } |
375 virtual SmallMapList* GetReceiverTypes() { | 378 virtual SmallMapList* GetReceiverTypes() { |
376 UNREACHABLE(); | 379 UNREACHABLE(); |
377 return NULL; | 380 return NULL; |
378 } | 381 } |
379 virtual KeyedAccessStoreMode GetStoreMode() { | 382 virtual KeyedAccessStoreMode GetStoreMode() { |
380 UNREACHABLE(); | 383 UNREACHABLE(); |
381 return STANDARD_STORE; | 384 return STANDARD_STORE; |
382 } | 385 } |
383 | 386 |
384 // TODO(rossberg): this should move to its own AST node eventually. | 387 // TODO(rossberg): this should move to its own AST node eventually. |
385 virtual void RecordToBooleanTypeFeedback(TypeFeedbackOracle* oracle); | 388 virtual void RecordToBooleanTypeFeedback(TypeFeedbackOracle* oracle); |
386 byte to_boolean_types() const { return to_boolean_types_; } | 389 byte to_boolean_types() const { return to_boolean_types_; } |
387 | 390 |
388 BailoutId id() const { return id_; } | 391 BailoutId id() const { return id_; } |
389 TypeFeedbackId test_id() const { return test_id_; } | 392 TypeFeedbackId test_id() const { return test_id_; } |
390 | 393 |
391 protected: | 394 protected: |
392 Expression(Zone* zone, int pos, IdGen* id_gen) | 395 Expression(Zone* zone, int pos, IdGen* id_gen) |
393 : AstNode(pos), | 396 : AstNode(pos), |
| 397 is_parenthesized_(false), |
| 398 is_multi_parenthesized_(false), |
394 bounds_(Bounds::Unbounded(zone)), | 399 bounds_(Bounds::Unbounded(zone)), |
395 parenthesization_level_(0), | |
396 id_(id_gen->GetNextId()), | 400 id_(id_gen->GetNextId()), |
397 test_id_(id_gen->GetNextId()) {} | 401 test_id_(id_gen->GetNextId()) {} |
398 void set_to_boolean_types(byte types) { to_boolean_types_ = types; } | 402 void set_to_boolean_types(byte types) { to_boolean_types_ = types; } |
399 | 403 |
400 private: | 404 private: |
| 405 byte to_boolean_types_; |
| 406 bool is_parenthesized_ : 1; |
| 407 bool is_multi_parenthesized_ : 1; |
401 Bounds bounds_; | 408 Bounds bounds_; |
402 byte to_boolean_types_; | |
403 unsigned parenthesization_level_; | |
404 | 409 |
405 const BailoutId id_; | 410 const BailoutId id_; |
406 const TypeFeedbackId test_id_; | 411 const TypeFeedbackId test_id_; |
407 }; | 412 }; |
408 | 413 |
409 | 414 |
410 class BreakableStatement : public Statement { | 415 class BreakableStatement : public Statement { |
411 public: | 416 public: |
412 enum BreakableType { | 417 enum BreakableType { |
413 TARGET_FOR_ANONYMOUS, | 418 TARGET_FOR_ANONYMOUS, |
(...skipping 3139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3553 Zone* zone_; | 3558 Zone* zone_; |
3554 Visitor visitor_; | 3559 Visitor visitor_; |
3555 AstValueFactory* ast_value_factory_; | 3560 AstValueFactory* ast_value_factory_; |
3556 AstNode::IdGen* id_gen_; | 3561 AstNode::IdGen* id_gen_; |
3557 }; | 3562 }; |
3558 | 3563 |
3559 | 3564 |
3560 } } // namespace v8::internal | 3565 } } // namespace v8::internal |
3561 | 3566 |
3562 #endif // V8_AST_H_ | 3567 #endif // V8_AST_H_ |
OLD | NEW |