OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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_COMPILER_JS_OPERATOR_H_ | 5 #ifndef V8_COMPILER_JS_OPERATOR_H_ |
6 #define V8_COMPILER_JS_OPERATOR_H_ | 6 #define V8_COMPILER_JS_OPERATOR_H_ |
7 | 7 |
| 8 #include "src/compiler/type-hints.h" |
8 #include "src/runtime/runtime.h" | 9 #include "src/runtime/runtime.h" |
9 | 10 |
10 namespace v8 { | 11 namespace v8 { |
11 namespace internal { | 12 namespace internal { |
12 namespace compiler { | 13 namespace compiler { |
13 | 14 |
14 // Forward declarations. | 15 // Forward declarations. |
15 class Operator; | 16 class Operator; |
16 struct JSOperatorGlobalCache; | 17 struct JSOperatorGlobalCache; |
17 | 18 |
(...skipping 29 matching lines...) Expand all Loading... |
47 | 48 |
48 | 49 |
49 // Defines whether tail call optimization is allowed. | 50 // Defines whether tail call optimization is allowed. |
50 enum class TailCallMode : unsigned { kAllow, kDisallow }; | 51 enum class TailCallMode : unsigned { kAllow, kDisallow }; |
51 | 52 |
52 size_t hash_value(TailCallMode); | 53 size_t hash_value(TailCallMode); |
53 | 54 |
54 std::ostream& operator<<(std::ostream&, TailCallMode); | 55 std::ostream& operator<<(std::ostream&, TailCallMode); |
55 | 56 |
56 | 57 |
| 58 // Defines the language mode and hints for a JavaScript binary operations. |
| 59 // This is used as parameter by JSAdd, JSSubtract, etc. operators. |
| 60 class BinaryOperationParameters final { |
| 61 public: |
| 62 BinaryOperationParameters(LanguageMode language_mode, |
| 63 BinaryOperationHints hints) |
| 64 : language_mode_(language_mode), hints_(hints) {} |
| 65 |
| 66 LanguageMode language_mode() const { return language_mode_; } |
| 67 BinaryOperationHints hints() const { return hints_; } |
| 68 |
| 69 private: |
| 70 LanguageMode const language_mode_; |
| 71 BinaryOperationHints const hints_; |
| 72 }; |
| 73 |
| 74 bool operator==(BinaryOperationParameters const&, |
| 75 BinaryOperationParameters const&); |
| 76 bool operator!=(BinaryOperationParameters const&, |
| 77 BinaryOperationParameters const&); |
| 78 |
| 79 size_t hash_value(BinaryOperationParameters const&); |
| 80 |
| 81 std::ostream& operator<<(std::ostream&, BinaryOperationParameters const&); |
| 82 |
| 83 BinaryOperationParameters const& BinaryOperationParametersOf(Operator const*); |
| 84 |
| 85 |
57 // Defines the arity and the feedback for a JavaScript constructor call. This is | 86 // Defines the arity and the feedback for a JavaScript constructor call. This is |
58 // used as a parameter by JSCallConstruct operators. | 87 // used as a parameter by JSCallConstruct operators. |
59 class CallConstructParameters final { | 88 class CallConstructParameters final { |
60 public: | 89 public: |
61 CallConstructParameters(size_t arity, VectorSlotPair const& feedback) | 90 CallConstructParameters(size_t arity, VectorSlotPair const& feedback) |
62 : arity_(arity), feedback_(feedback) {} | 91 : arity_(arity), feedback_(feedback) {} |
63 | 92 |
64 size_t arity() const { return arity_; } | 93 size_t arity() const { return arity_; } |
65 VectorSlotPair const& feedback() const { return feedback_; } | 94 VectorSlotPair const& feedback() const { return feedback_; } |
66 | 95 |
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
439 explicit JSOperatorBuilder(Zone* zone); | 468 explicit JSOperatorBuilder(Zone* zone); |
440 | 469 |
441 const Operator* Equal(); | 470 const Operator* Equal(); |
442 const Operator* NotEqual(); | 471 const Operator* NotEqual(); |
443 const Operator* StrictEqual(); | 472 const Operator* StrictEqual(); |
444 const Operator* StrictNotEqual(); | 473 const Operator* StrictNotEqual(); |
445 const Operator* LessThan(LanguageMode language_mode); | 474 const Operator* LessThan(LanguageMode language_mode); |
446 const Operator* GreaterThan(LanguageMode language_mode); | 475 const Operator* GreaterThan(LanguageMode language_mode); |
447 const Operator* LessThanOrEqual(LanguageMode language_mode); | 476 const Operator* LessThanOrEqual(LanguageMode language_mode); |
448 const Operator* GreaterThanOrEqual(LanguageMode language_mode); | 477 const Operator* GreaterThanOrEqual(LanguageMode language_mode); |
449 const Operator* BitwiseOr(LanguageMode language_mode); | 478 const Operator* BitwiseOr(LanguageMode language_mode, |
450 const Operator* BitwiseXor(LanguageMode language_mode); | 479 BinaryOperationHints hints); |
451 const Operator* BitwiseAnd(LanguageMode language_mode); | 480 const Operator* BitwiseXor(LanguageMode language_mode, |
452 const Operator* ShiftLeft(LanguageMode language_mode); | 481 BinaryOperationHints hints); |
453 const Operator* ShiftRight(LanguageMode language_mode); | 482 const Operator* BitwiseAnd(LanguageMode language_mode, |
454 const Operator* ShiftRightLogical(LanguageMode language_mode); | 483 BinaryOperationHints hints); |
455 const Operator* Add(LanguageMode language_mode); | 484 const Operator* ShiftLeft(LanguageMode language_mode, |
456 const Operator* Subtract(LanguageMode language_mode); | 485 BinaryOperationHints hints); |
457 const Operator* Multiply(LanguageMode language_mode); | 486 const Operator* ShiftRight(LanguageMode language_mode, |
458 const Operator* Divide(LanguageMode language_mode); | 487 BinaryOperationHints hints); |
459 const Operator* Modulus(LanguageMode language_mode); | 488 const Operator* ShiftRightLogical(LanguageMode language_mode, |
| 489 BinaryOperationHints hints); |
| 490 const Operator* Add(LanguageMode language_mode, BinaryOperationHints hints); |
| 491 const Operator* Subtract(LanguageMode language_mode, |
| 492 BinaryOperationHints hints); |
| 493 const Operator* Multiply(LanguageMode language_mode, |
| 494 BinaryOperationHints hints); |
| 495 const Operator* Divide(LanguageMode language_mode, |
| 496 BinaryOperationHints hints); |
| 497 const Operator* Modulus(LanguageMode language_mode, |
| 498 BinaryOperationHints hints); |
460 | 499 |
461 const Operator* UnaryNot(); | 500 const Operator* UnaryNot(); |
462 const Operator* ToBoolean(); | 501 const Operator* ToBoolean(); |
463 const Operator* ToNumber(); | 502 const Operator* ToNumber(); |
464 const Operator* ToString(); | 503 const Operator* ToString(); |
465 const Operator* ToName(); | 504 const Operator* ToName(); |
466 const Operator* ToObject(); | 505 const Operator* ToObject(); |
467 const Operator* Yield(); | 506 const Operator* Yield(); |
468 | 507 |
469 const Operator* Create(); | 508 const Operator* Create(); |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
543 Zone* const zone_; | 582 Zone* const zone_; |
544 | 583 |
545 DISALLOW_COPY_AND_ASSIGN(JSOperatorBuilder); | 584 DISALLOW_COPY_AND_ASSIGN(JSOperatorBuilder); |
546 }; | 585 }; |
547 | 586 |
548 } // namespace compiler | 587 } // namespace compiler |
549 } // namespace internal | 588 } // namespace internal |
550 } // namespace v8 | 589 } // namespace v8 |
551 | 590 |
552 #endif // V8_COMPILER_JS_OPERATOR_H_ | 591 #endif // V8_COMPILER_JS_OPERATOR_H_ |
OLD | NEW |