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

Side by Side Diff: src/compiler/memory-optimizer.cc

Issue 2348293003: [turbofan] Propagate tenuring decisions to child object allocations. (Closed)
Patch Set: Created 4 years, 3 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 the V8 project authors. All rights reserved. 1 // Copyright 2016 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/compiler/memory-optimizer.h" 5 #include "src/compiler/memory-optimizer.h"
6 6
7 #include "src/compiler/js-graph.h" 7 #include "src/compiler/js-graph.h"
8 #include "src/compiler/linkage.h" 8 #include "src/compiler/linkage.h"
9 #include "src/compiler/node-matchers.h" 9 #include "src/compiler/node-matchers.h"
10 #include "src/compiler/node-properties.h" 10 #include "src/compiler/node-properties.h"
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 } 102 }
103 103
104 void MemoryOptimizer::VisitAllocate(Node* node, AllocationState const* state) { 104 void MemoryOptimizer::VisitAllocate(Node* node, AllocationState const* state) {
105 DCHECK_EQ(IrOpcode::kAllocate, node->opcode()); 105 DCHECK_EQ(IrOpcode::kAllocate, node->opcode());
106 Node* value; 106 Node* value;
107 Node* size = node->InputAt(0); 107 Node* size = node->InputAt(0);
108 Node* effect = node->InputAt(1); 108 Node* effect = node->InputAt(1);
109 Node* control = node->InputAt(2); 109 Node* control = node->InputAt(2);
110 PretenureFlag pretenure = OpParameter<PretenureFlag>(node->op()); 110 PretenureFlag pretenure = OpParameter<PretenureFlag>(node->op());
111 111
112 // Propagate tenuring from outer allocations to inner allocations, i.e.
113 // when we allocate an object in old space and store a newly allocated
114 // child object into the pretenured object, then the newly allocated
115 // child object also should get pretenured to old space.
116 if (pretenure == TENURED) {
117 for (Edge const edge : node->use_edges()) {
118 Node* const user = edge.from();
119 if (user->opcode() == IrOpcode::kStoreField && edge.index() == 0) {
120 Node* const child = user->InputAt(1);
121 if (child->opcode() == IrOpcode::kAllocate &&
122 OpParameter<PretenureFlag>(child) == NOT_TENURED) {
Jarin 2016/09/20 09:40:28 Can we have PretenureFlagOf, please?
Benedikt Meurer 2016/09/20 09:42:55 Follow-up CL.
123 NodeProperties::ChangeOp(child, node->op());
124 break;
125 }
126 }
127 }
128 } else {
129 DCHECK_EQ(NOT_TENURED, pretenure);
130 for (Edge const edge : node->use_edges()) {
131 Node* const user = edge.from();
132 if (user->opcode() == IrOpcode::kStoreField && edge.index() == 1) {
133 Node* const parent = user->InputAt(0);
134 if (parent->opcode() == IrOpcode::kAllocate &&
135 OpParameter<PretenureFlag>(parent) == TENURED) {
136 pretenure = TENURED;
137 break;
138 }
139 }
140 }
141 }
142
112 // Determine the top/limit addresses. 143 // Determine the top/limit addresses.
113 Node* top_address = jsgraph()->ExternalConstant( 144 Node* top_address = jsgraph()->ExternalConstant(
114 pretenure == NOT_TENURED 145 pretenure == NOT_TENURED
115 ? ExternalReference::new_space_allocation_top_address(isolate()) 146 ? ExternalReference::new_space_allocation_top_address(isolate())
116 : ExternalReference::old_space_allocation_top_address(isolate())); 147 : ExternalReference::old_space_allocation_top_address(isolate()));
117 Node* limit_address = jsgraph()->ExternalConstant( 148 Node* limit_address = jsgraph()->ExternalConstant(
118 pretenure == NOT_TENURED 149 pretenure == NOT_TENURED
119 ? ExternalReference::new_space_allocation_limit_address(isolate()) 150 ? ExternalReference::new_space_allocation_limit_address(isolate())
120 : ExternalReference::old_space_allocation_limit_address(isolate())); 151 : ExternalReference::old_space_allocation_limit_address(isolate()));
121 152
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after
495 return jsgraph()->common(); 526 return jsgraph()->common();
496 } 527 }
497 528
498 MachineOperatorBuilder* MemoryOptimizer::machine() const { 529 MachineOperatorBuilder* MemoryOptimizer::machine() const {
499 return jsgraph()->machine(); 530 return jsgraph()->machine();
500 } 531 }
501 532
502 } // namespace compiler 533 } // namespace compiler
503 } // namespace internal 534 } // namespace internal
504 } // namespace v8 535 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698