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