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 set_is_parenthesized(bool value) { | |
marja
2014/06/26 14:38:13
Afaics this is never called with false (which woul
| |
351 if (value) { | |
352 ++parenthesization_level_; | |
353 } else { | |
354 parenthesization_level_ = 0; | |
355 } | |
356 } | |
357 | |
347 // Type feedback information for assignments and properties. | 358 // Type feedback information for assignments and properties. |
348 virtual bool IsMonomorphic() { | 359 virtual bool IsMonomorphic() { |
349 UNREACHABLE(); | 360 UNREACHABLE(); |
350 return false; | 361 return false; |
351 } | 362 } |
352 virtual SmallMapList* GetReceiverTypes() { | 363 virtual SmallMapList* GetReceiverTypes() { |
353 UNREACHABLE(); | 364 UNREACHABLE(); |
354 return NULL; | 365 return NULL; |
355 } | 366 } |
356 virtual KeyedAccessStoreMode GetStoreMode() { | 367 virtual KeyedAccessStoreMode GetStoreMode() { |
357 UNREACHABLE(); | 368 UNREACHABLE(); |
358 return STANDARD_STORE; | 369 return STANDARD_STORE; |
359 } | 370 } |
360 | 371 |
361 // TODO(rossberg): this should move to its own AST node eventually. | 372 // TODO(rossberg): this should move to its own AST node eventually. |
362 virtual void RecordToBooleanTypeFeedback(TypeFeedbackOracle* oracle); | 373 virtual void RecordToBooleanTypeFeedback(TypeFeedbackOracle* oracle); |
363 byte to_boolean_types() const { return to_boolean_types_; } | 374 byte to_boolean_types() const { return to_boolean_types_; } |
364 | 375 |
365 BailoutId id() const { return id_; } | 376 BailoutId id() const { return id_; } |
366 TypeFeedbackId test_id() const { return test_id_; } | 377 TypeFeedbackId test_id() const { return test_id_; } |
367 | 378 |
368 protected: | 379 protected: |
369 Expression(Zone* zone, int pos) | 380 Expression(Zone* zone, int pos) |
370 : AstNode(pos), | 381 : AstNode(pos), |
371 zone_(zone), | 382 zone_(zone), |
372 bounds_(Bounds::Unbounded(zone)), | 383 bounds_(Bounds::Unbounded(zone)), |
384 parenthesization_level_(0), | |
373 id_(GetNextId(zone)), | 385 id_(GetNextId(zone)), |
374 test_id_(GetNextId(zone)) {} | 386 test_id_(GetNextId(zone)) {} |
375 void set_to_boolean_types(byte types) { to_boolean_types_ = types; } | 387 void set_to_boolean_types(byte types) { to_boolean_types_ = types; } |
376 | 388 |
377 Zone* zone_; | 389 Zone* zone_; |
378 | 390 |
379 private: | 391 private: |
380 Bounds bounds_; | 392 Bounds bounds_; |
381 byte to_boolean_types_; | 393 byte to_boolean_types_; |
394 unsigned parenthesization_level_; | |
382 | 395 |
383 const BailoutId id_; | 396 const BailoutId id_; |
384 const TypeFeedbackId test_id_; | 397 const TypeFeedbackId test_id_; |
385 }; | 398 }; |
386 | 399 |
387 | 400 |
388 class BreakableStatement : public Statement { | 401 class BreakableStatement : public Statement { |
389 public: | 402 public: |
390 enum BreakableType { | 403 enum BreakableType { |
391 TARGET_FOR_ANONYMOUS, | 404 TARGET_FOR_ANONYMOUS, |
(...skipping 3038 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3430 private: | 3443 private: |
3431 Zone* zone_; | 3444 Zone* zone_; |
3432 Visitor visitor_; | 3445 Visitor visitor_; |
3433 AstValueFactory* ast_value_factory_; | 3446 AstValueFactory* ast_value_factory_; |
3434 }; | 3447 }; |
3435 | 3448 |
3436 | 3449 |
3437 } } // namespace v8::internal | 3450 } } // namespace v8::internal |
3438 | 3451 |
3439 #endif // V8_AST_H_ | 3452 #endif // V8_AST_H_ |
OLD | NEW |