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

Side by Side Diff: src/compiler/js-generic-lowering.cc

Issue 1906823002: Move of the type feedback vector to the closure. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: REBASE. 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/compiler/js-create-lowering.cc ('k') | src/compiler/js-graph.h » ('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/code-factory.h" 5 #include "src/code-factory.h"
6 #include "src/code-stubs.h" 6 #include "src/code-stubs.h"
7 #include "src/compiler/common-operator.h" 7 #include "src/compiler/common-operator.h"
8 #include "src/compiler/js-generic-lowering.h" 8 #include "src/compiler/js-generic-lowering.h"
9 #include "src/compiler/js-graph.h" 9 #include "src/compiler/js-graph.h"
10 #include "src/compiler/machine-operator.h" 10 #include "src/compiler/machine-operator.h"
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 152
153 void JSGenericLowering::LowerJSLoadProperty(Node* node) { 153 void JSGenericLowering::LowerJSLoadProperty(Node* node) {
154 Node* closure = NodeProperties::GetValueInput(node, 2); 154 Node* closure = NodeProperties::GetValueInput(node, 2);
155 Node* effect = NodeProperties::GetEffectInput(node); 155 Node* effect = NodeProperties::GetEffectInput(node);
156 Node* control = NodeProperties::GetControlInput(node); 156 Node* control = NodeProperties::GetControlInput(node);
157 CallDescriptor::Flags flags = AdjustFrameStatesForCall(node); 157 CallDescriptor::Flags flags = AdjustFrameStatesForCall(node);
158 const PropertyAccess& p = PropertyAccessOf(node->op()); 158 const PropertyAccess& p = PropertyAccessOf(node->op());
159 Callable callable = 159 Callable callable =
160 CodeFactory::KeyedLoadICInOptimizedCode(isolate(), UNINITIALIZED); 160 CodeFactory::KeyedLoadICInOptimizedCode(isolate(), UNINITIALIZED);
161 // Load the type feedback vector from the closure. 161 // Load the type feedback vector from the closure.
162 Node* shared_info = effect = graph()->NewNode( 162 Node* literals = effect = graph()->NewNode(
163 machine()->Load(MachineType::AnyTagged()), closure, 163 machine()->Load(MachineType::AnyTagged()), closure,
164 jsgraph()->IntPtrConstant(JSFunction::kSharedFunctionInfoOffset - 164 jsgraph()->IntPtrConstant(JSFunction::kLiteralsOffset - kHeapObjectTag),
165 kHeapObjectTag),
166 effect, control); 165 effect, control);
167 Node* vector = effect = graph()->NewNode( 166 Node* vector = effect = graph()->NewNode(
168 machine()->Load(MachineType::AnyTagged()), shared_info, 167 machine()->Load(MachineType::AnyTagged()), literals,
169 jsgraph()->IntPtrConstant(SharedFunctionInfo::kFeedbackVectorOffset - 168 jsgraph()->IntPtrConstant(LiteralsArray::kFeedbackVectorOffset -
170 kHeapObjectTag), 169 kHeapObjectTag),
171 effect, control); 170 effect, control);
172 node->InsertInput(zone(), 2, jsgraph()->SmiConstant(p.feedback().index())); 171 node->InsertInput(zone(), 2, jsgraph()->SmiConstant(p.feedback().index()));
173 node->ReplaceInput(3, vector); 172 node->ReplaceInput(3, vector);
174 node->ReplaceInput(6, effect); 173 node->ReplaceInput(6, effect);
175 ReplaceWithStubCall(node, callable, flags); 174 ReplaceWithStubCall(node, callable, flags);
176 } 175 }
177 176
178 177
179 void JSGenericLowering::LowerJSLoadNamed(Node* node) { 178 void JSGenericLowering::LowerJSLoadNamed(Node* node) {
180 Node* closure = NodeProperties::GetValueInput(node, 1); 179 Node* closure = NodeProperties::GetValueInput(node, 1);
181 Node* effect = NodeProperties::GetEffectInput(node); 180 Node* effect = NodeProperties::GetEffectInput(node);
182 Node* control = NodeProperties::GetControlInput(node); 181 Node* control = NodeProperties::GetControlInput(node);
183 CallDescriptor::Flags flags = AdjustFrameStatesForCall(node); 182 CallDescriptor::Flags flags = AdjustFrameStatesForCall(node);
184 NamedAccess const& p = NamedAccessOf(node->op()); 183 NamedAccess const& p = NamedAccessOf(node->op());
185 Callable callable = CodeFactory::LoadICInOptimizedCode( 184 Callable callable = CodeFactory::LoadICInOptimizedCode(
186 isolate(), NOT_INSIDE_TYPEOF, UNINITIALIZED); 185 isolate(), NOT_INSIDE_TYPEOF, UNINITIALIZED);
187 // Load the type feedback vector from the closure. 186 // Load the type feedback vector from the closure.
188 Node* shared_info = effect = graph()->NewNode( 187 Node* literals = effect = graph()->NewNode(
189 machine()->Load(MachineType::AnyTagged()), closure, 188 machine()->Load(MachineType::AnyTagged()), closure,
190 jsgraph()->IntPtrConstant(JSFunction::kSharedFunctionInfoOffset - 189 jsgraph()->IntPtrConstant(JSFunction::kLiteralsOffset - kHeapObjectTag),
191 kHeapObjectTag),
192 effect, control); 190 effect, control);
193 Node* vector = effect = graph()->NewNode( 191 Node* vector = effect = graph()->NewNode(
194 machine()->Load(MachineType::AnyTagged()), shared_info, 192 machine()->Load(MachineType::AnyTagged()), literals,
195 jsgraph()->IntPtrConstant(SharedFunctionInfo::kFeedbackVectorOffset - 193 jsgraph()->IntPtrConstant(LiteralsArray::kFeedbackVectorOffset -
196 kHeapObjectTag), 194 kHeapObjectTag),
197 effect, control); 195 effect, control);
198 node->InsertInput(zone(), 1, jsgraph()->HeapConstant(p.name())); 196 node->InsertInput(zone(), 1, jsgraph()->HeapConstant(p.name()));
199 node->InsertInput(zone(), 2, jsgraph()->SmiConstant(p.feedback().index())); 197 node->InsertInput(zone(), 2, jsgraph()->SmiConstant(p.feedback().index()));
200 node->ReplaceInput(3, vector); 198 node->ReplaceInput(3, vector);
201 node->ReplaceInput(6, effect); 199 node->ReplaceInput(6, effect);
202 ReplaceWithStubCall(node, callable, flags); 200 ReplaceWithStubCall(node, callable, flags);
203 } 201 }
204 202
205 203
206 void JSGenericLowering::LowerJSLoadGlobal(Node* node) { 204 void JSGenericLowering::LowerJSLoadGlobal(Node* node) {
207 Node* closure = NodeProperties::GetValueInput(node, 0); 205 Node* closure = NodeProperties::GetValueInput(node, 0);
208 Node* context = NodeProperties::GetContextInput(node); 206 Node* context = NodeProperties::GetContextInput(node);
209 Node* effect = NodeProperties::GetEffectInput(node); 207 Node* effect = NodeProperties::GetEffectInput(node);
210 Node* control = NodeProperties::GetControlInput(node); 208 Node* control = NodeProperties::GetControlInput(node);
211 CallDescriptor::Flags flags = AdjustFrameStatesForCall(node); 209 CallDescriptor::Flags flags = AdjustFrameStatesForCall(node);
212 const LoadGlobalParameters& p = LoadGlobalParametersOf(node->op()); 210 const LoadGlobalParameters& p = LoadGlobalParametersOf(node->op());
213 Callable callable = CodeFactory::LoadICInOptimizedCode( 211 Callable callable = CodeFactory::LoadICInOptimizedCode(
214 isolate(), p.typeof_mode(), UNINITIALIZED); 212 isolate(), p.typeof_mode(), UNINITIALIZED);
215 // Load the type feedback vector from the closure. 213 // Load the type feedback vector from the closure.
216 Node* shared_info = effect = graph()->NewNode( 214 Node* literals = effect = graph()->NewNode(
217 machine()->Load(MachineType::AnyTagged()), closure, 215 machine()->Load(MachineType::AnyTagged()), closure,
218 jsgraph()->IntPtrConstant(JSFunction::kSharedFunctionInfoOffset - 216 jsgraph()->IntPtrConstant(JSFunction::kLiteralsOffset - kHeapObjectTag),
219 kHeapObjectTag),
220 effect, control); 217 effect, control);
221 Node* vector = effect = graph()->NewNode( 218 Node* vector = effect = graph()->NewNode(
222 machine()->Load(MachineType::AnyTagged()), shared_info, 219 machine()->Load(MachineType::AnyTagged()), literals,
223 jsgraph()->IntPtrConstant(SharedFunctionInfo::kFeedbackVectorOffset - 220 jsgraph()->IntPtrConstant(LiteralsArray::kFeedbackVectorOffset -
224 kHeapObjectTag), 221 kHeapObjectTag),
225 effect, control); 222 effect, control);
226 // Load global object from the context. 223 // Load global object from the context.
227 Node* native_context = effect = 224 Node* native_context = effect =
228 graph()->NewNode(machine()->Load(MachineType::AnyTagged()), context, 225 graph()->NewNode(machine()->Load(MachineType::AnyTagged()), context,
229 jsgraph()->IntPtrConstant( 226 jsgraph()->IntPtrConstant(
230 Context::SlotOffset(Context::NATIVE_CONTEXT_INDEX)), 227 Context::SlotOffset(Context::NATIVE_CONTEXT_INDEX)),
231 effect, control); 228 effect, control);
232 Node* global = effect = graph()->NewNode( 229 Node* global = effect = graph()->NewNode(
233 machine()->Load(MachineType::AnyTagged()), native_context, 230 machine()->Load(MachineType::AnyTagged()), native_context,
(...skipping 11 matching lines...) Expand all
245 void JSGenericLowering::LowerJSStoreProperty(Node* node) { 242 void JSGenericLowering::LowerJSStoreProperty(Node* node) {
246 Node* closure = NodeProperties::GetValueInput(node, 3); 243 Node* closure = NodeProperties::GetValueInput(node, 3);
247 Node* effect = NodeProperties::GetEffectInput(node); 244 Node* effect = NodeProperties::GetEffectInput(node);
248 Node* control = NodeProperties::GetControlInput(node); 245 Node* control = NodeProperties::GetControlInput(node);
249 CallDescriptor::Flags flags = AdjustFrameStatesForCall(node); 246 CallDescriptor::Flags flags = AdjustFrameStatesForCall(node);
250 PropertyAccess const& p = PropertyAccessOf(node->op()); 247 PropertyAccess const& p = PropertyAccessOf(node->op());
251 LanguageMode language_mode = p.language_mode(); 248 LanguageMode language_mode = p.language_mode();
252 Callable callable = CodeFactory::KeyedStoreICInOptimizedCode( 249 Callable callable = CodeFactory::KeyedStoreICInOptimizedCode(
253 isolate(), language_mode, UNINITIALIZED); 250 isolate(), language_mode, UNINITIALIZED);
254 // Load the type feedback vector from the closure. 251 // Load the type feedback vector from the closure.
255 Node* shared_info = effect = graph()->NewNode( 252 Node* literals = effect = graph()->NewNode(
256 machine()->Load(MachineType::AnyTagged()), closure, 253 machine()->Load(MachineType::AnyTagged()), closure,
257 jsgraph()->IntPtrConstant(JSFunction::kSharedFunctionInfoOffset - 254 jsgraph()->IntPtrConstant(JSFunction::kLiteralsOffset - kHeapObjectTag),
258 kHeapObjectTag),
259 effect, control); 255 effect, control);
260 Node* vector = effect = graph()->NewNode( 256 Node* vector = effect = graph()->NewNode(
261 machine()->Load(MachineType::AnyTagged()), shared_info, 257 machine()->Load(MachineType::AnyTagged()), literals,
262 jsgraph()->IntPtrConstant(SharedFunctionInfo::kFeedbackVectorOffset - 258 jsgraph()->IntPtrConstant(LiteralsArray::kFeedbackVectorOffset -
263 kHeapObjectTag), 259 kHeapObjectTag),
264 effect, control); 260 effect, control);
265 node->InsertInput(zone(), 3, jsgraph()->SmiConstant(p.feedback().index())); 261 node->InsertInput(zone(), 3, jsgraph()->SmiConstant(p.feedback().index()));
266 node->ReplaceInput(4, vector); 262 node->ReplaceInput(4, vector);
267 node->ReplaceInput(7, effect); 263 node->ReplaceInput(7, effect);
268 ReplaceWithStubCall(node, callable, flags); 264 ReplaceWithStubCall(node, callable, flags);
269 } 265 }
270 266
271 267
272 void JSGenericLowering::LowerJSStoreNamed(Node* node) { 268 void JSGenericLowering::LowerJSStoreNamed(Node* node) {
273 Node* closure = NodeProperties::GetValueInput(node, 2); 269 Node* closure = NodeProperties::GetValueInput(node, 2);
274 Node* effect = NodeProperties::GetEffectInput(node); 270 Node* effect = NodeProperties::GetEffectInput(node);
275 Node* control = NodeProperties::GetControlInput(node); 271 Node* control = NodeProperties::GetControlInput(node);
276 CallDescriptor::Flags flags = AdjustFrameStatesForCall(node); 272 CallDescriptor::Flags flags = AdjustFrameStatesForCall(node);
277 NamedAccess const& p = NamedAccessOf(node->op()); 273 NamedAccess const& p = NamedAccessOf(node->op());
278 Callable callable = CodeFactory::StoreICInOptimizedCode( 274 Callable callable = CodeFactory::StoreICInOptimizedCode(
279 isolate(), p.language_mode(), UNINITIALIZED); 275 isolate(), p.language_mode(), UNINITIALIZED);
280 // Load the type feedback vector from the closure. 276 // Load the type feedback vector from the closure.
281 Node* shared_info = effect = graph()->NewNode( 277 Node* literals = effect = graph()->NewNode(
282 machine()->Load(MachineType::AnyTagged()), closure, 278 machine()->Load(MachineType::AnyTagged()), closure,
283 jsgraph()->IntPtrConstant(JSFunction::kSharedFunctionInfoOffset - 279 jsgraph()->IntPtrConstant(JSFunction::kLiteralsOffset - kHeapObjectTag),
284 kHeapObjectTag),
285 effect, control); 280 effect, control);
286 Node* vector = effect = graph()->NewNode( 281 Node* vector = effect = graph()->NewNode(
287 machine()->Load(MachineType::AnyTagged()), shared_info, 282 machine()->Load(MachineType::AnyTagged()), literals,
288 jsgraph()->IntPtrConstant(SharedFunctionInfo::kFeedbackVectorOffset - 283 jsgraph()->IntPtrConstant(LiteralsArray::kFeedbackVectorOffset -
289 kHeapObjectTag), 284 kHeapObjectTag),
290 effect, control); 285 effect, control);
291 node->InsertInput(zone(), 1, jsgraph()->HeapConstant(p.name())); 286 node->InsertInput(zone(), 1, jsgraph()->HeapConstant(p.name()));
292 node->InsertInput(zone(), 3, jsgraph()->SmiConstant(p.feedback().index())); 287 node->InsertInput(zone(), 3, jsgraph()->SmiConstant(p.feedback().index()));
293 node->ReplaceInput(4, vector); 288 node->ReplaceInput(4, vector);
294 node->ReplaceInput(7, effect); 289 node->ReplaceInput(7, effect);
295 ReplaceWithStubCall(node, callable, flags); 290 ReplaceWithStubCall(node, callable, flags);
296 } 291 }
297 292
298 293
299 void JSGenericLowering::LowerJSStoreGlobal(Node* node) { 294 void JSGenericLowering::LowerJSStoreGlobal(Node* node) {
300 Node* closure = NodeProperties::GetValueInput(node, 1); 295 Node* closure = NodeProperties::GetValueInput(node, 1);
301 Node* context = NodeProperties::GetContextInput(node); 296 Node* context = NodeProperties::GetContextInput(node);
302 Node* effect = NodeProperties::GetEffectInput(node); 297 Node* effect = NodeProperties::GetEffectInput(node);
303 Node* control = NodeProperties::GetControlInput(node); 298 Node* control = NodeProperties::GetControlInput(node);
304 CallDescriptor::Flags flags = AdjustFrameStatesForCall(node); 299 CallDescriptor::Flags flags = AdjustFrameStatesForCall(node);
305 const StoreGlobalParameters& p = StoreGlobalParametersOf(node->op()); 300 const StoreGlobalParameters& p = StoreGlobalParametersOf(node->op());
306 Callable callable = CodeFactory::StoreICInOptimizedCode( 301 Callable callable = CodeFactory::StoreICInOptimizedCode(
307 isolate(), p.language_mode(), UNINITIALIZED); 302 isolate(), p.language_mode(), UNINITIALIZED);
308 // Load the type feedback vector from the closure. 303 // Load the type feedback vector from the closure.
309 Node* shared_info = effect = graph()->NewNode( 304 Node* literals = effect = graph()->NewNode(
310 machine()->Load(MachineType::AnyTagged()), closure, 305 machine()->Load(MachineType::AnyTagged()), closure,
311 jsgraph()->IntPtrConstant(JSFunction::kSharedFunctionInfoOffset - 306 jsgraph()->IntPtrConstant(JSFunction::kLiteralsOffset - kHeapObjectTag),
312 kHeapObjectTag),
313 effect, control); 307 effect, control);
314 Node* vector = effect = graph()->NewNode( 308 Node* vector = effect = graph()->NewNode(
315 machine()->Load(MachineType::AnyTagged()), shared_info, 309 machine()->Load(MachineType::AnyTagged()), literals,
316 jsgraph()->IntPtrConstant(SharedFunctionInfo::kFeedbackVectorOffset - 310 jsgraph()->IntPtrConstant(LiteralsArray::kFeedbackVectorOffset -
317 kHeapObjectTag), 311 kHeapObjectTag),
318 effect, control); 312 effect, control);
319 // Load global object from the context. 313 // Load global object from the context.
320 Node* native_context = effect = 314 Node* native_context = effect =
321 graph()->NewNode(machine()->Load(MachineType::AnyTagged()), context, 315 graph()->NewNode(machine()->Load(MachineType::AnyTagged()), context,
322 jsgraph()->IntPtrConstant( 316 jsgraph()->IntPtrConstant(
323 Context::SlotOffset(Context::NATIVE_CONTEXT_INDEX)), 317 Context::SlotOffset(Context::NATIVE_CONTEXT_INDEX)),
324 effect, control); 318 effect, control);
325 Node* global = effect = graph()->NewNode( 319 Node* global = effect = graph()->NewNode(
326 machine()->Load(MachineType::AnyTagged()), native_context, 320 machine()->Load(MachineType::AnyTagged()), native_context,
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
479 } 473 }
480 } 474 }
481 475
482 476
483 void JSGenericLowering::LowerJSCreateClosure(Node* node) { 477 void JSGenericLowering::LowerJSCreateClosure(Node* node) {
484 CreateClosureParameters const& p = CreateClosureParametersOf(node->op()); 478 CreateClosureParameters const& p = CreateClosureParametersOf(node->op());
485 CallDescriptor::Flags flags = AdjustFrameStatesForCall(node); 479 CallDescriptor::Flags flags = AdjustFrameStatesForCall(node);
486 Handle<SharedFunctionInfo> const shared_info = p.shared_info(); 480 Handle<SharedFunctionInfo> const shared_info = p.shared_info();
487 node->InsertInput(zone(), 0, jsgraph()->HeapConstant(shared_info)); 481 node->InsertInput(zone(), 0, jsgraph()->HeapConstant(shared_info));
488 482
489 // Use the FastNewClosureStub that allocates in new space only for nested 483 // Use the FastNewClosureStub only for functions allocated in new space.
490 // functions that don't need literals cloning. 484 if (p.pretenure() == NOT_TENURED) {
491 if (p.pretenure() == NOT_TENURED && shared_info->num_literals() == 0) {
492 Callable callable = CodeFactory::FastNewClosure( 485 Callable callable = CodeFactory::FastNewClosure(
493 isolate(), shared_info->language_mode(), shared_info->kind()); 486 isolate(), shared_info->language_mode(), shared_info->kind());
494 ReplaceWithStubCall(node, callable, flags); 487 ReplaceWithStubCall(node, callable, flags);
495 } else { 488 } else {
496 ReplaceWithRuntimeCall(node, (p.pretenure() == TENURED) 489 ReplaceWithRuntimeCall(node, (p.pretenure() == TENURED)
497 ? Runtime::kNewClosure_Tenured 490 ? Runtime::kNewClosure_Tenured
498 : Runtime::kNewClosure); 491 : Runtime::kNewClosure);
499 } 492 }
500 } 493 }
501 494
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
749 } 742 }
750 743
751 744
752 MachineOperatorBuilder* JSGenericLowering::machine() const { 745 MachineOperatorBuilder* JSGenericLowering::machine() const {
753 return jsgraph()->machine(); 746 return jsgraph()->machine();
754 } 747 }
755 748
756 } // namespace compiler 749 } // namespace compiler
757 } // namespace internal 750 } // namespace internal
758 } // namespace v8 751 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/js-create-lowering.cc ('k') | src/compiler/js-graph.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698