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