Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(127)

Unified Diff: src/compiler/js-operator.h

Issue 1487973002: [turbofan] Add binary operation hints for javascript operators. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/compiler/js-operator.h
diff --git a/src/compiler/js-operator.h b/src/compiler/js-operator.h
index ba7c744cf3b01827e885225c3519332f34d81ea9..7e698ce65396fc156b2755678804e724621e25f8 100644
--- a/src/compiler/js-operator.h
+++ b/src/compiler/js-operator.h
@@ -5,6 +5,7 @@
#ifndef V8_COMPILER_JS_OPERATOR_H_
#define V8_COMPILER_JS_OPERATOR_H_
+#include "src/compiler/type-hints.h"
#include "src/runtime/runtime.h"
namespace v8 {
@@ -54,6 +55,34 @@ size_t hash_value(TailCallMode);
std::ostream& operator<<(std::ostream&, TailCallMode);
+// Defines the language mode and hints for a JavaScript binary operations.
+// This is used as parameter by JSAdd, JSSubtract, etc. operators.
+class BinaryOperationParameters final {
+ public:
+ BinaryOperationParameters(LanguageMode language_mode,
+ BinaryOperationHints hints)
+ : language_mode_(language_mode), hints_(hints) {}
+
+ LanguageMode language_mode() const { return language_mode_; }
+ BinaryOperationHints hints() const { return hints_; }
+
+ private:
+ LanguageMode const language_mode_;
+ BinaryOperationHints const hints_;
+};
+
+bool operator==(BinaryOperationParameters const&,
+ BinaryOperationParameters const&);
+bool operator!=(BinaryOperationParameters const&,
+ BinaryOperationParameters const&);
+
+size_t hash_value(BinaryOperationParameters const&);
+
+std::ostream& operator<<(std::ostream&, BinaryOperationParameters const&);
+
+BinaryOperationParameters const& BinaryOperationParametersOf(Operator const*);
+
+
// Defines the arity and the feedback for a JavaScript constructor call. This is
// used as a parameter by JSCallConstruct operators.
class CallConstructParameters final {
@@ -446,17 +475,27 @@ class JSOperatorBuilder final : public ZoneObject {
const Operator* GreaterThan(LanguageMode language_mode);
const Operator* LessThanOrEqual(LanguageMode language_mode);
const Operator* GreaterThanOrEqual(LanguageMode language_mode);
- const Operator* BitwiseOr(LanguageMode language_mode);
- const Operator* BitwiseXor(LanguageMode language_mode);
- const Operator* BitwiseAnd(LanguageMode language_mode);
- const Operator* ShiftLeft(LanguageMode language_mode);
- const Operator* ShiftRight(LanguageMode language_mode);
- const Operator* ShiftRightLogical(LanguageMode language_mode);
- const Operator* Add(LanguageMode language_mode);
- const Operator* Subtract(LanguageMode language_mode);
- const Operator* Multiply(LanguageMode language_mode);
- const Operator* Divide(LanguageMode language_mode);
- const Operator* Modulus(LanguageMode language_mode);
+ const Operator* BitwiseOr(LanguageMode language_mode,
+ BinaryOperationHints hints);
+ const Operator* BitwiseXor(LanguageMode language_mode,
+ BinaryOperationHints hints);
+ const Operator* BitwiseAnd(LanguageMode language_mode,
+ BinaryOperationHints hints);
+ const Operator* ShiftLeft(LanguageMode language_mode,
+ BinaryOperationHints hints);
+ const Operator* ShiftRight(LanguageMode language_mode,
+ BinaryOperationHints hints);
+ const Operator* ShiftRightLogical(LanguageMode language_mode,
+ BinaryOperationHints hints);
+ const Operator* Add(LanguageMode language_mode, BinaryOperationHints hints);
+ const Operator* Subtract(LanguageMode language_mode,
+ BinaryOperationHints hints);
+ const Operator* Multiply(LanguageMode language_mode,
+ BinaryOperationHints hints);
+ const Operator* Divide(LanguageMode language_mode,
+ BinaryOperationHints hints);
+ const Operator* Modulus(LanguageMode language_mode,
+ BinaryOperationHints hints);
const Operator* UnaryNot();
const Operator* ToBoolean();

Powered by Google App Engine
This is Rietveld 408576698