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 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
337 // True iff the expression is the null literal. | 337 // True iff the expression is the null literal. |
338 bool IsNullLiteral() const; | 338 bool IsNullLiteral() const; |
339 | 339 |
340 // True if we can prove that the expression is the undefined literal. | 340 // True if we can prove that the expression is the undefined literal. |
341 bool IsUndefinedLiteral(Isolate* isolate) const; | 341 bool IsUndefinedLiteral(Isolate* isolate) const; |
342 | 342 |
343 // Expression type bounds | 343 // Expression type bounds |
344 Bounds bounds() const { return bounds_; } | 344 Bounds bounds() const { return bounds_; } |
345 void set_bounds(Bounds bounds) { bounds_ = bounds; } | 345 void set_bounds(Bounds bounds) { bounds_ = bounds; } |
346 | 346 |
| 347 // Whether the expression is parenthesized |
| 348 unsigned parenthesization_level() const { return parenthesization_level_; } |
| 349 bool is_parenthesized() const { return parenthesization_level_ > 0; } |
| 350 void increase_parenthesization_level() { ++parenthesization_level_; } |
| 351 |
347 // Type feedback information for assignments and properties. | 352 // Type feedback information for assignments and properties. |
348 virtual bool IsMonomorphic() { | 353 virtual bool IsMonomorphic() { |
349 UNREACHABLE(); | 354 UNREACHABLE(); |
350 return false; | 355 return false; |
351 } | 356 } |
352 virtual SmallMapList* GetReceiverTypes() { | 357 virtual SmallMapList* GetReceiverTypes() { |
353 UNREACHABLE(); | 358 UNREACHABLE(); |
354 return NULL; | 359 return NULL; |
355 } | 360 } |
356 virtual KeyedAccessStoreMode GetStoreMode() { | 361 virtual KeyedAccessStoreMode GetStoreMode() { |
357 UNREACHABLE(); | 362 UNREACHABLE(); |
358 return STANDARD_STORE; | 363 return STANDARD_STORE; |
359 } | 364 } |
360 | 365 |
361 // TODO(rossberg): this should move to its own AST node eventually. | 366 // TODO(rossberg): this should move to its own AST node eventually. |
362 virtual void RecordToBooleanTypeFeedback(TypeFeedbackOracle* oracle); | 367 virtual void RecordToBooleanTypeFeedback(TypeFeedbackOracle* oracle); |
363 byte to_boolean_types() const { return to_boolean_types_; } | 368 byte to_boolean_types() const { return to_boolean_types_; } |
364 | 369 |
365 BailoutId id() const { return id_; } | 370 BailoutId id() const { return id_; } |
366 TypeFeedbackId test_id() const { return test_id_; } | 371 TypeFeedbackId test_id() const { return test_id_; } |
367 | 372 |
368 protected: | 373 protected: |
369 Expression(Zone* zone, int pos) | 374 Expression(Zone* zone, int pos) |
370 : AstNode(pos), | 375 : AstNode(pos), |
371 zone_(zone), | 376 zone_(zone), |
372 bounds_(Bounds::Unbounded(zone)), | 377 bounds_(Bounds::Unbounded(zone)), |
| 378 parenthesization_level_(0), |
373 id_(GetNextId(zone)), | 379 id_(GetNextId(zone)), |
374 test_id_(GetNextId(zone)) {} | 380 test_id_(GetNextId(zone)) {} |
375 void set_to_boolean_types(byte types) { to_boolean_types_ = types; } | 381 void set_to_boolean_types(byte types) { to_boolean_types_ = types; } |
376 | 382 |
377 Zone* zone_; | 383 Zone* zone_; |
378 | 384 |
379 private: | 385 private: |
380 Bounds bounds_; | 386 Bounds bounds_; |
381 byte to_boolean_types_; | 387 byte to_boolean_types_; |
| 388 unsigned parenthesization_level_; |
382 | 389 |
383 const BailoutId id_; | 390 const BailoutId id_; |
384 const TypeFeedbackId test_id_; | 391 const TypeFeedbackId test_id_; |
385 }; | 392 }; |
386 | 393 |
387 | 394 |
388 class BreakableStatement : public Statement { | 395 class BreakableStatement : public Statement { |
389 public: | 396 public: |
390 enum BreakableType { | 397 enum BreakableType { |
391 TARGET_FOR_ANONYMOUS, | 398 TARGET_FOR_ANONYMOUS, |
(...skipping 3033 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3425 private: | 3432 private: |
3426 Zone* zone_; | 3433 Zone* zone_; |
3427 Visitor visitor_; | 3434 Visitor visitor_; |
3428 AstValueFactory* ast_value_factory_; | 3435 AstValueFactory* ast_value_factory_; |
3429 }; | 3436 }; |
3430 | 3437 |
3431 | 3438 |
3432 } } // namespace v8::internal | 3439 } } // namespace v8::internal |
3433 | 3440 |
3434 #endif // V8_AST_H_ | 3441 #endif // V8_AST_H_ |
OLD | NEW |