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

Unified Diff: src/compiler/simplified-operator.cc

Issue 2802113003: [turbofan] Introduce a SpeculativeToNumber operator. (Closed)
Patch Set: Paint it green! Created 3 years, 8 months 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
« no previous file with comments | « src/compiler/simplified-operator.h ('k') | src/compiler/typed-optimization.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/simplified-operator.cc
diff --git a/src/compiler/simplified-operator.cc b/src/compiler/simplified-operator.cc
index f360c4ac0fe419382b7f34e288c1973e8ccc906f..5d32ffc7c94d2ab83f76f011b459242806410878 100644
--- a/src/compiler/simplified-operator.cc
+++ b/src/compiler/simplified-operator.cc
@@ -371,7 +371,8 @@ size_t hash_value(NumberOperationHint hint) {
}
NumberOperationHint NumberOperationHintOf(const Operator* op) {
- DCHECK(op->opcode() == IrOpcode::kSpeculativeNumberAdd ||
+ DCHECK(op->opcode() == IrOpcode::kSpeculativeToNumber ||
+ op->opcode() == IrOpcode::kSpeculativeNumberAdd ||
op->opcode() == IrOpcode::kSpeculativeNumberSubtract ||
op->opcode() == IrOpcode::kSpeculativeNumberMultiply ||
op->opcode() == IrOpcode::kSpeculativeNumberDivide ||
@@ -684,6 +685,26 @@ struct SimplifiedOperatorGlobalCache final {
SPECULATIVE_NUMBER_BINOP_LIST(SPECULATIVE_NUMBER_BINOP)
#undef SPECULATIVE_NUMBER_BINOP
+ template <NumberOperationHint kHint>
+ struct SpeculativeToNumberOperator final
+ : public Operator1<NumberOperationHint> {
+ SpeculativeToNumberOperator()
+ : Operator1<NumberOperationHint>(
+ IrOpcode::kSpeculativeToNumber, // opcode
+ Operator::kFoldable | Operator::kNoThrow, // flags
+ "SpeculativeToNumber", // name
+ 1, 1, 1, 1, 1, 0, // counts
+ kHint) {} // parameter
+ };
+ SpeculativeToNumberOperator<NumberOperationHint::kSignedSmall>
+ kSpeculativeToNumberSignedSmallOperator;
+ SpeculativeToNumberOperator<NumberOperationHint::kSigned32>
+ kSpeculativeToNumberSigned32Operator;
+ SpeculativeToNumberOperator<NumberOperationHint::kNumber>
+ kSpeculativeToNumberNumberOperator;
+ SpeculativeToNumberOperator<NumberOperationHint::kNumberOrOddball>
+ kSpeculativeToNumberNumberOrOddballOperator;
+
#define BUFFER_ACCESS(Type, type, TYPE, ctype, size) \
struct LoadBuffer##Type##Operator final : public Operator1<BufferAccess> { \
LoadBuffer##Type##Operator() \
@@ -795,6 +816,22 @@ const Operator* SimplifiedOperatorBuilder::CheckFloat64Hole(
return nullptr;
}
+const Operator* SimplifiedOperatorBuilder::SpeculativeToNumber(
+ NumberOperationHint hint) {
+ switch (hint) {
+ case NumberOperationHint::kSignedSmall:
+ return &cache_.kSpeculativeToNumberSignedSmallOperator;
+ case NumberOperationHint::kSigned32:
+ return &cache_.kSpeculativeToNumberSigned32Operator;
+ case NumberOperationHint::kNumber:
+ return &cache_.kSpeculativeToNumberNumberOperator;
+ case NumberOperationHint::kNumberOrOddball:
+ return &cache_.kSpeculativeToNumberNumberOrOddballOperator;
+ }
+ UNREACHABLE();
+ return nullptr;
+}
+
const Operator* SimplifiedOperatorBuilder::EnsureWritableFastElements() {
return &cache_.kEnsureWritableFastElements;
}
« no previous file with comments | « src/compiler/simplified-operator.h ('k') | src/compiler/typed-optimization.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698