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

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

Issue 2035413003: Revert of Provide a tagged allocation top pointer. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 6 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 | « src/code-stub-assembler.cc ('k') | src/crankshaft/arm/lithium-codegen-arm.cc » ('j') | 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 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 // Update the allocation top with the new object allocation. 139 // Update the allocation top with the new object allocation.
140 // TODO(bmeurer): Defer writing back top as much as possible. 140 // TODO(bmeurer): Defer writing back top as much as possible.
141 Node* top = graph()->NewNode(machine()->IntAdd(), state->top(), 141 Node* top = graph()->NewNode(machine()->IntAdd(), state->top(),
142 jsgraph()->IntPtrConstant(object_size)); 142 jsgraph()->IntPtrConstant(object_size));
143 effect = graph()->NewNode( 143 effect = graph()->NewNode(
144 machine()->Store(StoreRepresentation( 144 machine()->Store(StoreRepresentation(
145 MachineType::PointerRepresentation(), kNoWriteBarrier)), 145 MachineType::PointerRepresentation(), kNoWriteBarrier)),
146 top_address, jsgraph()->IntPtrConstant(0), top, effect, control); 146 top_address, jsgraph()->IntPtrConstant(0), top, effect, control);
147 147
148 // Compute the effective inner allocated address. 148 // Compute the effective inner allocated address.
149 value = graph()->NewNode(machine()->BitcastWordToTagged(), state->top()); 149 value = graph()->NewNode(
150 machine()->BitcastWordToTagged(),
151 graph()->NewNode(machine()->IntAdd(), state->top(),
152 jsgraph()->IntPtrConstant(kHeapObjectTag)));
150 153
151 // Extend the allocation {group}. 154 // Extend the allocation {group}.
152 group->Add(value); 155 group->Add(value);
153 state = AllocationState::Open(group, state_size, top, zone()); 156 state = AllocationState::Open(group, state_size, top, zone());
154 } else { 157 } else {
155 // Setup a mutable reservation size node; will be patched as we fold 158 // Setup a mutable reservation size node; will be patched as we fold
156 // additional allocations into this new group. 159 // additional allocations into this new group.
157 Node* size = graph()->NewNode(common()->Int32Constant(object_size)); 160 Node* size = graph()->NewNode(common()->Int32Constant(object_size));
158 161
159 // Load allocation top and limit. 162 // Load allocation top and limit.
(...skipping 28 matching lines...) Expand all
188 Node* target = pretenure == NOT_TENURED 191 Node* target = pretenure == NOT_TENURED
189 ? jsgraph()->AllocateInNewSpaceStubConstant() 192 ? jsgraph()->AllocateInNewSpaceStubConstant()
190 : jsgraph()->AllocateInOldSpaceStubConstant(); 193 : jsgraph()->AllocateInOldSpaceStubConstant();
191 if (!allocate_operator_.is_set()) { 194 if (!allocate_operator_.is_set()) {
192 CallDescriptor* descriptor = 195 CallDescriptor* descriptor =
193 Linkage::GetAllocateCallDescriptor(graph()->zone()); 196 Linkage::GetAllocateCallDescriptor(graph()->zone());
194 allocate_operator_.set(common()->Call(descriptor)); 197 allocate_operator_.set(common()->Call(descriptor));
195 } 198 }
196 vfalse = efalse = graph()->NewNode(allocate_operator_.get(), target, 199 vfalse = efalse = graph()->NewNode(allocate_operator_.get(), target,
197 size, efalse, if_false); 200 size, efalse, if_false);
201 vfalse = graph()->NewNode(machine()->IntSub(), vfalse,
202 jsgraph()->IntPtrConstant(kHeapObjectTag));
198 } 203 }
199 204
200 control = graph()->NewNode(common()->Merge(2), if_true, if_false); 205 control = graph()->NewNode(common()->Merge(2), if_true, if_false);
201 effect = graph()->NewNode(common()->EffectPhi(2), etrue, efalse, control); 206 effect = graph()->NewNode(common()->EffectPhi(2), etrue, efalse, control);
202 value = graph()->NewNode( 207 value = graph()->NewNode(
203 common()->Phi(MachineType::PointerRepresentation(), 2), vtrue, vfalse, 208 common()->Phi(MachineType::PointerRepresentation(), 2), vtrue, vfalse,
204 control); 209 control);
205 210
206 // Compute the new top and write it back. 211 // Compute the new top and write it back.
207 top = graph()->NewNode(machine()->IntAdd(), value, 212 top = graph()->NewNode(machine()->IntAdd(), value,
208 jsgraph()->IntPtrConstant(object_size)); 213 jsgraph()->IntPtrConstant(object_size));
209 effect = graph()->NewNode( 214 effect = graph()->NewNode(
210 machine()->Store(StoreRepresentation( 215 machine()->Store(StoreRepresentation(
211 MachineType::PointerRepresentation(), kNoWriteBarrier)), 216 MachineType::PointerRepresentation(), kNoWriteBarrier)),
212 top_address, jsgraph()->IntPtrConstant(0), top, effect, control); 217 top_address, jsgraph()->IntPtrConstant(0), top, effect, control);
213 218
214 // Compute the initial object address. 219 // Compute the initial object address.
215 value = graph()->NewNode(machine()->BitcastWordToTagged(), value); 220 value = graph()->NewNode(
221 machine()->BitcastWordToTagged(),
222 graph()->NewNode(machine()->IntAdd(), value,
223 jsgraph()->IntPtrConstant(kHeapObjectTag)));
216 224
217 // Start a new allocation group. 225 // Start a new allocation group.
218 AllocationGroup* group = 226 AllocationGroup* group =
219 new (zone()) AllocationGroup(value, pretenure, size, zone()); 227 new (zone()) AllocationGroup(value, pretenure, size, zone());
220 state = AllocationState::Open(group, object_size, top, zone()); 228 state = AllocationState::Open(group, object_size, top, zone());
221 } 229 }
222 } else { 230 } else {
223 // Load allocation top and limit. 231 // Load allocation top and limit.
224 Node* top = effect = 232 Node* top = effect =
225 graph()->NewNode(machine()->Load(MachineType::Pointer()), top_address, 233 graph()->NewNode(machine()->Load(MachineType::Pointer()), top_address,
(...skipping 15 matching lines...) Expand all
241 graph()->NewNode(common()->Branch(BranchHint::kTrue), check, control); 249 graph()->NewNode(common()->Branch(BranchHint::kTrue), check, control);
242 250
243 Node* if_true = graph()->NewNode(common()->IfTrue(), branch); 251 Node* if_true = graph()->NewNode(common()->IfTrue(), branch);
244 Node* etrue = effect; 252 Node* etrue = effect;
245 Node* vtrue; 253 Node* vtrue;
246 { 254 {
247 etrue = graph()->NewNode( 255 etrue = graph()->NewNode(
248 machine()->Store(StoreRepresentation( 256 machine()->Store(StoreRepresentation(
249 MachineType::PointerRepresentation(), kNoWriteBarrier)), 257 MachineType::PointerRepresentation(), kNoWriteBarrier)),
250 top_address, jsgraph()->IntPtrConstant(0), new_top, etrue, if_true); 258 top_address, jsgraph()->IntPtrConstant(0), new_top, etrue, if_true);
251 vtrue = graph()->NewNode(machine()->BitcastWordToTagged(), top); 259 vtrue = graph()->NewNode(
260 machine()->BitcastWordToTagged(),
261 graph()->NewNode(machine()->IntAdd(), top,
262 jsgraph()->IntPtrConstant(kHeapObjectTag)));
252 } 263 }
253 264
254 Node* if_false = graph()->NewNode(common()->IfFalse(), branch); 265 Node* if_false = graph()->NewNode(common()->IfFalse(), branch);
255 Node* efalse = effect; 266 Node* efalse = effect;
256 Node* vfalse; 267 Node* vfalse;
257 { 268 {
258 Node* target = pretenure == NOT_TENURED 269 Node* target = pretenure == NOT_TENURED
259 ? jsgraph()->AllocateInNewSpaceStubConstant() 270 ? jsgraph()->AllocateInNewSpaceStubConstant()
260 : jsgraph()->AllocateInOldSpaceStubConstant(); 271 : jsgraph()->AllocateInOldSpaceStubConstant();
261 if (!allocate_operator_.is_set()) { 272 if (!allocate_operator_.is_set()) {
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
476 return jsgraph()->common(); 487 return jsgraph()->common();
477 } 488 }
478 489
479 MachineOperatorBuilder* MemoryOptimizer::machine() const { 490 MachineOperatorBuilder* MemoryOptimizer::machine() const {
480 return jsgraph()->machine(); 491 return jsgraph()->machine();
481 } 492 }
482 493
483 } // namespace compiler 494 } // namespace compiler
484 } // namespace internal 495 } // namespace internal
485 } // namespace v8 496 } // namespace v8
OLDNEW
« no previous file with comments | « src/code-stub-assembler.cc ('k') | src/crankshaft/arm/lithium-codegen-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698