Commit 0e039730 authored by bmeurer's avatar bmeurer Committed by Commit bot

[turbofan] Introduce PretenureFlagOf helper function.

R=jarin@chromium.org

Review-Url: https://codereview.chromium.org/2357573002
Cr-Commit-Position: refs/heads/master@{#39539}
parent b42ecda5
...@@ -107,7 +107,7 @@ void MemoryOptimizer::VisitAllocate(Node* node, AllocationState const* state) { ...@@ -107,7 +107,7 @@ void MemoryOptimizer::VisitAllocate(Node* node, AllocationState const* state) {
Node* size = node->InputAt(0); Node* size = node->InputAt(0);
Node* effect = node->InputAt(1); Node* effect = node->InputAt(1);
Node* control = node->InputAt(2); Node* control = node->InputAt(2);
PretenureFlag pretenure = OpParameter<PretenureFlag>(node->op()); PretenureFlag pretenure = PretenureFlagOf(node->op());
// Propagate tenuring from outer allocations to inner allocations, i.e. // Propagate tenuring from outer allocations to inner allocations, i.e.
// when we allocate an object in old space and store a newly allocated // when we allocate an object in old space and store a newly allocated
...@@ -119,7 +119,7 @@ void MemoryOptimizer::VisitAllocate(Node* node, AllocationState const* state) { ...@@ -119,7 +119,7 @@ void MemoryOptimizer::VisitAllocate(Node* node, AllocationState const* state) {
if (user->opcode() == IrOpcode::kStoreField && edge.index() == 0) { if (user->opcode() == IrOpcode::kStoreField && edge.index() == 0) {
Node* const child = user->InputAt(1); Node* const child = user->InputAt(1);
if (child->opcode() == IrOpcode::kAllocate && if (child->opcode() == IrOpcode::kAllocate &&
OpParameter<PretenureFlag>(child) == NOT_TENURED) { PretenureFlagOf(child->op()) == NOT_TENURED) {
NodeProperties::ChangeOp(child, node->op()); NodeProperties::ChangeOp(child, node->op());
break; break;
} }
...@@ -132,7 +132,7 @@ void MemoryOptimizer::VisitAllocate(Node* node, AllocationState const* state) { ...@@ -132,7 +132,7 @@ void MemoryOptimizer::VisitAllocate(Node* node, AllocationState const* state) {
if (user->opcode() == IrOpcode::kStoreField && edge.index() == 1) { if (user->opcode() == IrOpcode::kStoreField && edge.index() == 1) {
Node* const parent = user->InputAt(0); Node* const parent = user->InputAt(0);
if (parent->opcode() == IrOpcode::kAllocate && if (parent->opcode() == IrOpcode::kAllocate &&
OpParameter<PretenureFlag>(parent) == TENURED) { PretenureFlagOf(parent->op()) == TENURED) {
pretenure = TENURED; pretenure = TENURED;
break; break;
} }
......
...@@ -332,6 +332,11 @@ NumberOperationHint NumberOperationHintOf(const Operator* op) { ...@@ -332,6 +332,11 @@ NumberOperationHint NumberOperationHintOf(const Operator* op) {
return OpParameter<NumberOperationHint>(op); return OpParameter<NumberOperationHint>(op);
} }
PretenureFlag PretenureFlagOf(const Operator* op) {
DCHECK_EQ(IrOpcode::kAllocate, op->opcode());
return OpParameter<PretenureFlag>(op);
}
#define PURE_OP_LIST(V) \ #define PURE_OP_LIST(V) \
V(BooleanNot, Operator::kNoProperties, 1, 0) \ V(BooleanNot, Operator::kNoProperties, 1, 0) \
V(NumberEqual, Operator::kCommutative, 2, 0) \ V(NumberEqual, Operator::kCommutative, 2, 0) \
......
...@@ -183,6 +183,8 @@ std::ostream& operator<<(std::ostream&, NumberOperationHint); ...@@ -183,6 +183,8 @@ std::ostream& operator<<(std::ostream&, NumberOperationHint);
NumberOperationHint NumberOperationHintOf(const Operator* op) NumberOperationHint NumberOperationHintOf(const Operator* op)
WARN_UNUSED_RESULT; WARN_UNUSED_RESULT;
PretenureFlag PretenureFlagOf(const Operator* op) WARN_UNUSED_RESULT;
// Interface for building simplified operators, which represent the // Interface for building simplified operators, which represent the
// medium-level operations of V8, including adding numbers, allocating objects, // medium-level operations of V8, including adding numbers, allocating objects,
// indexing into objects and arrays, etc. // indexing into objects and arrays, etc.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment