Index: src/compiler/simplified-operator.cc |
diff --git a/src/compiler/simplified-operator.cc b/src/compiler/simplified-operator.cc |
index d341391bc00f7d263d8392a6153a5e8c19d23776..e720343fb370b108817171c834fb0cf6788bdda9 100644 |
--- a/src/compiler/simplified-operator.cc |
+++ b/src/compiler/simplified-operator.cc |
@@ -214,6 +214,15 @@ struct SimplifiedOperatorGlobalCache final { |
PURE_OP_LIST(PURE) |
#undef PURE |
+ template <PretenureFlag kPretenure> |
+ struct AllocateOperator final : public Operator1<PretenureFlag> { |
+ AllocateOperator() |
+ : Operator1<PretenureFlag>(IrOpcode::kAllocate, Operator::kNoThrow, |
+ "Allocate", 1, 1, 1, 1, 1, 0, kPretenure) {} |
+ }; |
+ AllocateOperator<NOT_TENURED> kAllocateNotTenuredOperator; |
+ AllocateOperator<TENURED> kAllocateTenuredOperator; |
+ |
#define BUFFER_ACCESS(Type, type, TYPE, ctype, size) \ |
struct LoadBuffer##Type##Operator final : public Operator1<BufferAccess> { \ |
LoadBuffer##Type##Operator() \ |
@@ -258,9 +267,14 @@ const Operator* SimplifiedOperatorBuilder::ReferenceEqual(Type* type) { |
const Operator* SimplifiedOperatorBuilder::Allocate(PretenureFlag pretenure) { |
- return new (zone()) |
- Operator1<PretenureFlag>(IrOpcode::kAllocate, Operator::kNoThrow, |
- "Allocate", 1, 1, 1, 1, 1, 0, pretenure); |
+ switch (pretenure) { |
+ case NOT_TENURED: |
+ return &cache_.kAllocateNotTenuredOperator; |
+ case TENURED: |
+ return &cache_.kAllocateTenuredOperator; |
+ } |
+ UNREACHABLE(); |
+ return nullptr; |
} |