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

Side by Side Diff: src/compiler/change-lowering.cc

Issue 1951853002: [turbofan] Inline the allocation fast path. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 7 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/compiler/change-lowering.h ('k') | src/compiler/pipeline.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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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/change-lowering.h" 5 #include "src/compiler/change-lowering.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/machine-operator.h" 9 #include "src/compiler/machine-operator.h"
10 #include "src/compiler/node-properties.h" 10 #include "src/compiler/node-properties.h"
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 Reduction ChangeLowering::ReduceStoreElement(Node* node) { 88 Reduction ChangeLowering::ReduceStoreElement(Node* node) {
89 const ElementAccess& access = ElementAccessOf(node->op()); 89 const ElementAccess& access = ElementAccessOf(node->op());
90 node->ReplaceInput(1, ComputeIndex(access, node->InputAt(1))); 90 node->ReplaceInput(1, ComputeIndex(access, node->InputAt(1)));
91 NodeProperties::ChangeOp(node, machine()->Store(StoreRepresentation( 91 NodeProperties::ChangeOp(node, machine()->Store(StoreRepresentation(
92 access.machine_type.representation(), 92 access.machine_type.representation(),
93 access.write_barrier_kind))); 93 access.write_barrier_kind)));
94 return Changed(node); 94 return Changed(node);
95 } 95 }
96 96
97 Reduction ChangeLowering::ReduceAllocate(Node* node) { 97 Reduction ChangeLowering::ReduceAllocate(Node* node) {
98 PretenureFlag pretenure = OpParameter<PretenureFlag>(node->op()); 98 PretenureFlag const pretenure = OpParameter<PretenureFlag>(node->op());
99 Node* target = pretenure == NOT_TENURED 99
100 ? jsgraph()->AllocateInNewSpaceStubConstant() 100 Node* size = node->InputAt(0);
101 : jsgraph()->AllocateInOldSpaceStubConstant(); 101 Node* effect = node->InputAt(1);
102 node->InsertInput(graph()->zone(), 0, target); 102 Node* control = node->InputAt(2);
103 if (!allocate_operator_.is_set()) { 103
104 CallDescriptor* descriptor = 104 if (machine()->Is64()) {
105 Linkage::GetAllocateCallDescriptor(graph()->zone()); 105 size = graph()->NewNode(machine()->ChangeInt32ToInt64(), size);
106 allocate_operator_.set(common()->Call(descriptor));
107 } 106 }
108 NodeProperties::ChangeOp(node, allocate_operator_.get()); 107
109 return Changed(node); 108 Node* top_address = jsgraph()->ExternalConstant(
109 pretenure == NOT_TENURED
110 ? ExternalReference::new_space_allocation_top_address(isolate())
111 : ExternalReference::old_space_allocation_top_address(isolate()));
112 Node* limit_address = jsgraph()->ExternalConstant(
113 pretenure == NOT_TENURED
114 ? ExternalReference::new_space_allocation_limit_address(isolate())
115 : ExternalReference::old_space_allocation_limit_address(isolate()));
116
117 Node* top = effect =
118 graph()->NewNode(machine()->Load(MachineType::Pointer()), top_address,
119 jsgraph()->IntPtrConstant(0), effect, control);
120 Node* limit = effect =
121 graph()->NewNode(machine()->Load(MachineType::Pointer()), limit_address,
122 jsgraph()->IntPtrConstant(0), effect, control);
123
124 Node* new_top = graph()->NewNode(machine()->IntAdd(), top, size);
125
126 Node* check = graph()->NewNode(machine()->UintLessThan(), new_top, limit);
127 Node* branch =
128 graph()->NewNode(common()->Branch(BranchHint::kTrue), check, control);
129
130 Node* if_true = graph()->NewNode(common()->IfTrue(), branch);
131 Node* etrue = effect;
132 Node* vtrue;
133 {
134 etrue = graph()->NewNode(
135 machine()->Store(StoreRepresentation(
136 MachineType::PointerRepresentation(), kNoWriteBarrier)),
137 top_address, jsgraph()->IntPtrConstant(0), new_top, etrue, if_true);
138 vtrue = graph()->NewNode(machine()->BitcastWordToTagged(),
139 graph()->NewNode(machine()->IntAdd(), top,
140 jsgraph()->IntPtrConstant(1)));
141 }
142
143 Node* if_false = graph()->NewNode(common()->IfFalse(), branch);
144 Node* efalse = effect;
145 Node* vfalse;
146 {
147 Node* target = pretenure == NOT_TENURED
148 ? jsgraph()->AllocateInNewSpaceStubConstant()
149 : jsgraph()->AllocateInOldSpaceStubConstant();
150 if (!allocate_operator_.is_set()) {
151 CallDescriptor* descriptor =
152 Linkage::GetAllocateCallDescriptor(graph()->zone());
153 allocate_operator_.set(common()->Call(descriptor));
154 }
155 vfalse = efalse = graph()->NewNode(allocate_operator_.get(), target, size,
156 efalse, if_false);
157 }
158
159 control = graph()->NewNode(common()->Merge(2), if_true, if_false);
160 effect = graph()->NewNode(common()->EffectPhi(2), etrue, efalse, control);
161 Node* value = graph()->NewNode(
162 common()->Phi(MachineRepresentation::kTagged, 2), vtrue, vfalse, control);
163
164 ReplaceWithValue(node, value, effect);
165 return Replace(value);
110 } 166 }
111 167
112 Isolate* ChangeLowering::isolate() const { return jsgraph()->isolate(); } 168 Isolate* ChangeLowering::isolate() const { return jsgraph()->isolate(); }
113 169
114 170
115 Graph* ChangeLowering::graph() const { return jsgraph()->graph(); } 171 Graph* ChangeLowering::graph() const { return jsgraph()->graph(); }
116 172
117 173
118 CommonOperatorBuilder* ChangeLowering::common() const { 174 CommonOperatorBuilder* ChangeLowering::common() const {
119 return jsgraph()->common(); 175 return jsgraph()->common();
120 } 176 }
121 177
122 178
123 MachineOperatorBuilder* ChangeLowering::machine() const { 179 MachineOperatorBuilder* ChangeLowering::machine() const {
124 return jsgraph()->machine(); 180 return jsgraph()->machine();
125 } 181 }
126 182
127 } // namespace compiler 183 } // namespace compiler
128 } // namespace internal 184 } // namespace internal
129 } // namespace v8 185 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/change-lowering.h ('k') | src/compiler/pipeline.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698