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

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

Issue 2797993006: [turbofan] Add type to the allocation operator. (Closed)
Patch Set: Remove caching 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/typer.cc » ('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..bf4f1d7dab09e24aa1447aa13ed325f108c2a942 100644
--- a/src/compiler/simplified-operator.cc
+++ b/src/compiler/simplified-operator.cc
@@ -388,9 +388,32 @@ NumberOperationHint NumberOperationHintOf(const Operator* op) {
return OpParameter<NumberOperationHint>(op);
}
+size_t hash_value(AllocateParameters info) {
+ return base::hash_combine(info.type(), info.pretenure());
+}
+
+V8_EXPORT_PRIVATE std::ostream& operator<<(std::ostream& os,
+ AllocateParameters info) {
+ info.type()->PrintTo(os);
+ return os << ", " << info.pretenure();
+}
+
+bool operator==(AllocateParameters const& lhs, AllocateParameters const& rhs) {
+ return lhs.pretenure() == rhs.pretenure() && lhs.type() == rhs.type();
+}
+
+bool operator!=(AllocateParameters const& lhs, AllocateParameters const& rhs) {
+ return !(lhs == rhs);
+}
+
PretenureFlag PretenureFlagOf(const Operator* op) {
DCHECK_EQ(IrOpcode::kAllocate, op->opcode());
- return OpParameter<PretenureFlag>(op);
+ return OpParameter<AllocateParameters>(op).pretenure();
+}
+
+Type* AllocateTypeOf(const Operator* op) {
+ DCHECK_EQ(IrOpcode::kAllocate, op->opcode());
+ return OpParameter<AllocateParameters>(op).type();
}
UnicodeEncoding UnicodeEncodingOf(const Operator* op) {
@@ -646,17 +669,6 @@ struct SimplifiedOperatorGlobalCache final {
CheckFloat64HoleNaNOperator<CheckFloat64HoleMode::kNeverReturnHole>
kCheckFloat64HoleNeverReturnHoleOperator;
- template <PretenureFlag kPretenure>
- struct AllocateOperator final : public Operator1<PretenureFlag> {
- AllocateOperator()
- : Operator1<PretenureFlag>(
- IrOpcode::kAllocate,
- Operator::kNoDeopt | Operator::kNoThrow | Operator::kNoWrite,
- "Allocate", 1, 1, 1, 1, 1, 0, kPretenure) {}
- };
- AllocateOperator<NOT_TENURED> kAllocateNotTenuredOperator;
- AllocateOperator<TENURED> kAllocateTenuredOperator;
-
struct EnsureWritableFastElementsOperator final : public Operator {
EnsureWritableFastElementsOperator()
: Operator( // --
@@ -864,15 +876,12 @@ bool IsRestLengthOf(const Operator* op) {
return OpParameter<ArgumentsLengthParameters>(op).is_rest_length;
}
-const Operator* SimplifiedOperatorBuilder::Allocate(PretenureFlag pretenure) {
- switch (pretenure) {
- case NOT_TENURED:
- return &cache_.kAllocateNotTenuredOperator;
- case TENURED:
- return &cache_.kAllocateTenuredOperator;
- }
- UNREACHABLE();
- return nullptr;
+const Operator* SimplifiedOperatorBuilder::Allocate(Type* type,
+ PretenureFlag pretenure) {
+ return new (zone()) Operator1<AllocateParameters>(
+ IrOpcode::kAllocate,
+ Operator::kNoDeopt | Operator::kNoThrow | Operator::kNoWrite, "Allocate",
+ 1, 1, 1, 1, 1, 0, AllocateParameters(type, pretenure));
}
« no previous file with comments | « src/compiler/simplified-operator.h ('k') | src/compiler/typer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698