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/compiler/type-hints.h" |
9 #include "src/runtime/runtime.h" | 9 #include "src/runtime/runtime.h" |
10 | 10 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 | 44 |
45 | 45 |
46 // The ConvertReceiverMode is used as parameter by JSConvertReceiver operators. | 46 // The ConvertReceiverMode is used as parameter by JSConvertReceiver operators. |
47 ConvertReceiverMode ConvertReceiverModeOf(Operator const* op); | 47 ConvertReceiverMode ConvertReceiverModeOf(Operator const* op); |
48 | 48 |
49 | 49 |
50 // The ToBooleanHints are used as parameter by JSToBoolean operators. | 50 // The ToBooleanHints are used as parameter by JSToBoolean operators. |
51 ToBooleanHints ToBooleanHintsOf(Operator const* op); | 51 ToBooleanHints ToBooleanHintsOf(Operator const* op); |
52 | 52 |
53 | 53 |
54 // Defines the language mode and hints for a JavaScript binary operations. | |
55 // This is used as parameter by JSAdd, JSSubtract, etc. operators. | |
56 class BinaryOperationParameters final { | |
57 public: | |
58 BinaryOperationParameters(LanguageMode language_mode, | |
59 BinaryOperationHints hints) | |
60 : language_mode_(language_mode), hints_(hints) {} | |
61 | |
62 LanguageMode language_mode() const { return language_mode_; } | |
63 BinaryOperationHints hints() const { return hints_; } | |
64 | |
65 private: | |
66 LanguageMode const language_mode_; | |
67 BinaryOperationHints const hints_; | |
68 }; | |
69 | |
70 bool operator==(BinaryOperationParameters const&, | |
71 BinaryOperationParameters const&); | |
72 bool operator!=(BinaryOperationParameters const&, | |
73 BinaryOperationParameters const&); | |
74 | |
75 size_t hash_value(BinaryOperationParameters const&); | |
76 | |
77 std::ostream& operator<<(std::ostream&, BinaryOperationParameters const&); | |
78 | |
79 BinaryOperationParameters const& BinaryOperationParametersOf(Operator const*); | |
80 | |
81 | |
82 // Defines the arity and the feedback for a JavaScript constructor call. This is | 54 // Defines the arity and the feedback for a JavaScript constructor call. This is |
83 // used as a parameter by JSCallConstruct operators. | 55 // used as a parameter by JSCallConstruct operators. |
84 class CallConstructParameters final { | 56 class CallConstructParameters final { |
85 public: | 57 public: |
86 CallConstructParameters(size_t arity, VectorSlotPair const& feedback) | 58 CallConstructParameters(size_t arity, VectorSlotPair const& feedback) |
87 : arity_(arity), feedback_(feedback) {} | 59 : arity_(arity), feedback_(feedback) {} |
88 | 60 |
89 size_t arity() const { return arity_; } | 61 size_t arity() const { return arity_; } |
90 VectorSlotPair const& feedback() const { return feedback_; } | 62 VectorSlotPair const& feedback() const { return feedback_; } |
91 | 63 |
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
411 // AST. Most operators have no parameters, thus can be globally shared for all | 383 // AST. Most operators have no parameters, thus can be globally shared for all |
412 // graphs. | 384 // graphs. |
413 class JSOperatorBuilder final : public ZoneObject { | 385 class JSOperatorBuilder final : public ZoneObject { |
414 public: | 386 public: |
415 explicit JSOperatorBuilder(Zone* zone); | 387 explicit JSOperatorBuilder(Zone* zone); |
416 | 388 |
417 const Operator* Equal(); | 389 const Operator* Equal(); |
418 const Operator* NotEqual(); | 390 const Operator* NotEqual(); |
419 const Operator* StrictEqual(); | 391 const Operator* StrictEqual(); |
420 const Operator* StrictNotEqual(); | 392 const Operator* StrictNotEqual(); |
421 const Operator* LessThan(LanguageMode language_mode); | 393 const Operator* LessThan(); |
422 const Operator* GreaterThan(LanguageMode language_mode); | 394 const Operator* GreaterThan(); |
423 const Operator* LessThanOrEqual(LanguageMode language_mode); | 395 const Operator* LessThanOrEqual(); |
424 const Operator* GreaterThanOrEqual(LanguageMode language_mode); | 396 const Operator* GreaterThanOrEqual(); |
425 const Operator* BitwiseOr(LanguageMode language_mode, | 397 const Operator* BitwiseOr(BinaryOperationHints hints); |
426 BinaryOperationHints hints); | 398 const Operator* BitwiseXor(BinaryOperationHints hints); |
427 const Operator* BitwiseXor(LanguageMode language_mode, | 399 const Operator* BitwiseAnd(BinaryOperationHints hints); |
428 BinaryOperationHints hints); | 400 const Operator* ShiftLeft(BinaryOperationHints hints); |
429 const Operator* BitwiseAnd(LanguageMode language_mode, | 401 const Operator* ShiftRight(BinaryOperationHints hints); |
430 BinaryOperationHints hints); | 402 const Operator* ShiftRightLogical(BinaryOperationHints hints); |
431 const Operator* ShiftLeft(LanguageMode language_mode, | 403 const Operator* Add(BinaryOperationHints hints); |
432 BinaryOperationHints hints); | 404 const Operator* Subtract(BinaryOperationHints hints); |
433 const Operator* ShiftRight(LanguageMode language_mode, | 405 const Operator* Multiply(BinaryOperationHints hints); |
434 BinaryOperationHints hints); | 406 const Operator* Divide(BinaryOperationHints hints); |
435 const Operator* ShiftRightLogical(LanguageMode language_mode, | 407 const Operator* Modulus(BinaryOperationHints hints); |
436 BinaryOperationHints hints); | |
437 const Operator* Add(LanguageMode language_mode, BinaryOperationHints hints); | |
438 const Operator* Subtract(LanguageMode language_mode, | |
439 BinaryOperationHints hints); | |
440 const Operator* Multiply(LanguageMode language_mode, | |
441 BinaryOperationHints hints); | |
442 const Operator* Divide(LanguageMode language_mode, | |
443 BinaryOperationHints hints); | |
444 const Operator* Modulus(LanguageMode language_mode, | |
445 BinaryOperationHints hints); | |
446 | 408 |
447 const Operator* ToBoolean(ToBooleanHints hints); | 409 const Operator* ToBoolean(ToBooleanHints hints); |
448 const Operator* ToNumber(); | 410 const Operator* ToNumber(); |
449 const Operator* ToString(); | 411 const Operator* ToString(); |
450 const Operator* ToName(); | 412 const Operator* ToName(); |
451 const Operator* ToObject(); | 413 const Operator* ToObject(); |
452 const Operator* Yield(); | 414 const Operator* Yield(); |
453 | 415 |
454 const Operator* Create(); | 416 const Operator* Create(); |
455 const Operator* CreateArguments(CreateArgumentsType type); | 417 const Operator* CreateArguments(CreateArgumentsType type); |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
527 Zone* const zone_; | 489 Zone* const zone_; |
528 | 490 |
529 DISALLOW_COPY_AND_ASSIGN(JSOperatorBuilder); | 491 DISALLOW_COPY_AND_ASSIGN(JSOperatorBuilder); |
530 }; | 492 }; |
531 | 493 |
532 } // namespace compiler | 494 } // namespace compiler |
533 } // namespace internal | 495 } // namespace internal |
534 } // namespace v8 | 496 } // namespace v8 |
535 | 497 |
536 #endif // V8_COMPILER_JS_OPERATOR_H_ | 498 #endif // V8_COMPILER_JS_OPERATOR_H_ |
OLD | NEW |