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

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

Issue 1683043002: [turbofan] No need to load the feedback vector on the JS graph level. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 10 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/bytecode-graph-builder.cc ('k') | 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 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 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 273
274 274
275 void JSGenericLowering::LowerJSToObject(Node* node) { 275 void JSGenericLowering::LowerJSToObject(Node* node) {
276 CallDescriptor::Flags flags = AdjustFrameStatesForCall(node); 276 CallDescriptor::Flags flags = AdjustFrameStatesForCall(node);
277 Callable callable = CodeFactory::ToObject(isolate()); 277 Callable callable = CodeFactory::ToObject(isolate());
278 ReplaceWithStubCall(node, callable, flags); 278 ReplaceWithStubCall(node, callable, flags);
279 } 279 }
280 280
281 281
282 void JSGenericLowering::LowerJSLoadProperty(Node* node) { 282 void JSGenericLowering::LowerJSLoadProperty(Node* node) {
283 Node* closure = NodeProperties::GetValueInput(node, 2);
284 Node* effect = NodeProperties::GetEffectInput(node);
285 Node* control = NodeProperties::GetControlInput(node);
283 CallDescriptor::Flags flags = AdjustFrameStatesForCall(node); 286 CallDescriptor::Flags flags = AdjustFrameStatesForCall(node);
284 const PropertyAccess& p = PropertyAccessOf(node->op()); 287 const PropertyAccess& p = PropertyAccessOf(node->op());
285 Callable callable = CodeFactory::KeyedLoadICInOptimizedCode( 288 Callable callable = CodeFactory::KeyedLoadICInOptimizedCode(
286 isolate(), p.language_mode(), UNINITIALIZED); 289 isolate(), p.language_mode(), UNINITIALIZED);
290 // Load the type feedback vector from the closure.
291 Node* shared_info = effect = graph()->NewNode(
292 machine()->Load(MachineType::AnyTagged()), closure,
293 jsgraph()->IntPtrConstant(JSFunction::kSharedFunctionInfoOffset -
294 kHeapObjectTag),
295 effect, control);
296 Node* vector = effect = graph()->NewNode(
297 machine()->Load(MachineType::AnyTagged()), shared_info,
298 jsgraph()->IntPtrConstant(SharedFunctionInfo::kFeedbackVectorOffset -
299 kHeapObjectTag),
300 effect, control);
287 node->InsertInput(zone(), 2, jsgraph()->SmiConstant(p.feedback().index())); 301 node->InsertInput(zone(), 2, jsgraph()->SmiConstant(p.feedback().index()));
302 node->ReplaceInput(3, vector);
303 node->ReplaceInput(6, effect);
288 ReplaceWithStubCall(node, callable, flags); 304 ReplaceWithStubCall(node, callable, flags);
289 } 305 }
290 306
291 307
292 void JSGenericLowering::LowerJSLoadNamed(Node* node) { 308 void JSGenericLowering::LowerJSLoadNamed(Node* node) {
309 Node* closure = NodeProperties::GetValueInput(node, 1);
310 Node* effect = NodeProperties::GetEffectInput(node);
311 Node* control = NodeProperties::GetControlInput(node);
293 CallDescriptor::Flags flags = AdjustFrameStatesForCall(node); 312 CallDescriptor::Flags flags = AdjustFrameStatesForCall(node);
294 NamedAccess const& p = NamedAccessOf(node->op()); 313 NamedAccess const& p = NamedAccessOf(node->op());
295 Callable callable = CodeFactory::LoadICInOptimizedCode( 314 Callable callable = CodeFactory::LoadICInOptimizedCode(
296 isolate(), NOT_INSIDE_TYPEOF, p.language_mode(), UNINITIALIZED); 315 isolate(), NOT_INSIDE_TYPEOF, p.language_mode(), UNINITIALIZED);
316 // Load the type feedback vector from the closure.
317 Node* shared_info = effect = graph()->NewNode(
318 machine()->Load(MachineType::AnyTagged()), closure,
319 jsgraph()->IntPtrConstant(JSFunction::kSharedFunctionInfoOffset -
320 kHeapObjectTag),
321 effect, control);
322 Node* vector = effect = graph()->NewNode(
323 machine()->Load(MachineType::AnyTagged()), shared_info,
324 jsgraph()->IntPtrConstant(SharedFunctionInfo::kFeedbackVectorOffset -
325 kHeapObjectTag),
326 effect, control);
297 node->InsertInput(zone(), 1, jsgraph()->HeapConstant(p.name())); 327 node->InsertInput(zone(), 1, jsgraph()->HeapConstant(p.name()));
298 node->InsertInput(zone(), 2, jsgraph()->SmiConstant(p.feedback().index())); 328 node->InsertInput(zone(), 2, jsgraph()->SmiConstant(p.feedback().index()));
329 node->ReplaceInput(3, vector);
330 node->ReplaceInput(6, effect);
299 ReplaceWithStubCall(node, callable, flags); 331 ReplaceWithStubCall(node, callable, flags);
300 } 332 }
301 333
302 334
303 void JSGenericLowering::LowerJSLoadGlobal(Node* node) { 335 void JSGenericLowering::LowerJSLoadGlobal(Node* node) {
336 Node* closure = NodeProperties::GetValueInput(node, 0);
304 Node* context = NodeProperties::GetContextInput(node); 337 Node* context = NodeProperties::GetContextInput(node);
305 Node* effect = NodeProperties::GetEffectInput(node); 338 Node* effect = NodeProperties::GetEffectInput(node);
339 Node* control = NodeProperties::GetControlInput(node);
306 CallDescriptor::Flags flags = AdjustFrameStatesForCall(node); 340 CallDescriptor::Flags flags = AdjustFrameStatesForCall(node);
307 const LoadGlobalParameters& p = LoadGlobalParametersOf(node->op()); 341 const LoadGlobalParameters& p = LoadGlobalParametersOf(node->op());
308 Callable callable = CodeFactory::LoadICInOptimizedCode( 342 Callable callable = CodeFactory::LoadICInOptimizedCode(
309 isolate(), p.typeof_mode(), SLOPPY, UNINITIALIZED); 343 isolate(), p.typeof_mode(), SLOPPY, UNINITIALIZED);
344 // Load the type feedback vector from the closure.
345 Node* shared_info = effect = graph()->NewNode(
346 machine()->Load(MachineType::AnyTagged()), closure,
347 jsgraph()->IntPtrConstant(JSFunction::kSharedFunctionInfoOffset -
348 kHeapObjectTag),
349 effect, control);
350 Node* vector = effect = graph()->NewNode(
351 machine()->Load(MachineType::AnyTagged()), shared_info,
352 jsgraph()->IntPtrConstant(SharedFunctionInfo::kFeedbackVectorOffset -
353 kHeapObjectTag),
354 effect, control);
310 // Load global object from the context. 355 // Load global object from the context.
311 Node* native_context = 356 Node* native_context = effect =
312 graph()->NewNode(machine()->Load(MachineType::AnyTagged()), context, 357 graph()->NewNode(machine()->Load(MachineType::AnyTagged()), context,
313 jsgraph()->IntPtrConstant( 358 jsgraph()->IntPtrConstant(
314 Context::SlotOffset(Context::NATIVE_CONTEXT_INDEX)), 359 Context::SlotOffset(Context::NATIVE_CONTEXT_INDEX)),
315 effect, graph()->start()); 360 effect, control);
316 Node* global = graph()->NewNode( 361 Node* global = effect = graph()->NewNode(
317 machine()->Load(MachineType::AnyTagged()), native_context, 362 machine()->Load(MachineType::AnyTagged()), native_context,
318 jsgraph()->IntPtrConstant(Context::SlotOffset(Context::EXTENSION_INDEX)), 363 jsgraph()->IntPtrConstant(Context::SlotOffset(Context::EXTENSION_INDEX)),
319 effect, graph()->start()); 364 effect, control);
320 node->InsertInput(zone(), 0, global); 365 node->InsertInput(zone(), 0, global);
321 node->InsertInput(zone(), 1, jsgraph()->HeapConstant(p.name())); 366 node->InsertInput(zone(), 1, jsgraph()->HeapConstant(p.name()));
322 node->InsertInput(zone(), 2, jsgraph()->SmiConstant(p.feedback().index())); 367 node->InsertInput(zone(), 2, jsgraph()->SmiConstant(p.feedback().index()));
368 node->ReplaceInput(3, vector);
369 node->ReplaceInput(6, effect);
323 ReplaceWithStubCall(node, callable, flags); 370 ReplaceWithStubCall(node, callable, flags);
324 } 371 }
325 372
326 373
327 void JSGenericLowering::LowerJSStoreProperty(Node* node) { 374 void JSGenericLowering::LowerJSStoreProperty(Node* node) {
375 Node* closure = NodeProperties::GetValueInput(node, 3);
376 Node* effect = NodeProperties::GetEffectInput(node);
377 Node* control = NodeProperties::GetControlInput(node);
328 CallDescriptor::Flags flags = AdjustFrameStatesForCall(node); 378 CallDescriptor::Flags flags = AdjustFrameStatesForCall(node);
329 PropertyAccess const& p = PropertyAccessOf(node->op()); 379 PropertyAccess const& p = PropertyAccessOf(node->op());
330 LanguageMode language_mode = p.language_mode(); 380 LanguageMode language_mode = p.language_mode();
331 Callable callable = CodeFactory::KeyedStoreICInOptimizedCode( 381 Callable callable = CodeFactory::KeyedStoreICInOptimizedCode(
332 isolate(), language_mode, UNINITIALIZED); 382 isolate(), language_mode, UNINITIALIZED);
333 DCHECK(p.feedback().index() != -1); 383 // Load the type feedback vector from the closure.
384 Node* shared_info = effect = graph()->NewNode(
385 machine()->Load(MachineType::AnyTagged()), closure,
386 jsgraph()->IntPtrConstant(JSFunction::kSharedFunctionInfoOffset -
387 kHeapObjectTag),
388 effect, control);
389 Node* vector = effect = graph()->NewNode(
390 machine()->Load(MachineType::AnyTagged()), shared_info,
391 jsgraph()->IntPtrConstant(SharedFunctionInfo::kFeedbackVectorOffset -
392 kHeapObjectTag),
393 effect, control);
334 node->InsertInput(zone(), 3, jsgraph()->SmiConstant(p.feedback().index())); 394 node->InsertInput(zone(), 3, jsgraph()->SmiConstant(p.feedback().index()));
335 ReplaceWithStubCall(node, callable, 395 node->ReplaceInput(4, vector);
336 CallDescriptor::kPatchableCallSite | flags); 396 node->ReplaceInput(7, effect);
397 ReplaceWithStubCall(node, callable, flags);
337 } 398 }
338 399
339 400
340 void JSGenericLowering::LowerJSStoreNamed(Node* node) { 401 void JSGenericLowering::LowerJSStoreNamed(Node* node) {
402 Node* closure = NodeProperties::GetValueInput(node, 2);
403 Node* effect = NodeProperties::GetEffectInput(node);
404 Node* control = NodeProperties::GetControlInput(node);
341 CallDescriptor::Flags flags = AdjustFrameStatesForCall(node); 405 CallDescriptor::Flags flags = AdjustFrameStatesForCall(node);
342 NamedAccess const& p = NamedAccessOf(node->op()); 406 NamedAccess const& p = NamedAccessOf(node->op());
343 Callable callable = CodeFactory::StoreICInOptimizedCode( 407 Callable callable = CodeFactory::StoreICInOptimizedCode(
344 isolate(), p.language_mode(), UNINITIALIZED); 408 isolate(), p.language_mode(), UNINITIALIZED);
409 // Load the type feedback vector from the closure.
410 Node* shared_info = effect = graph()->NewNode(
411 machine()->Load(MachineType::AnyTagged()), closure,
412 jsgraph()->IntPtrConstant(JSFunction::kSharedFunctionInfoOffset -
413 kHeapObjectTag),
414 effect, control);
415 Node* vector = effect = graph()->NewNode(
416 machine()->Load(MachineType::AnyTagged()), shared_info,
417 jsgraph()->IntPtrConstant(SharedFunctionInfo::kFeedbackVectorOffset -
418 kHeapObjectTag),
419 effect, control);
345 node->InsertInput(zone(), 1, jsgraph()->HeapConstant(p.name())); 420 node->InsertInput(zone(), 1, jsgraph()->HeapConstant(p.name()));
346 DCHECK(p.feedback().index() != -1);
347 node->InsertInput(zone(), 3, jsgraph()->SmiConstant(p.feedback().index())); 421 node->InsertInput(zone(), 3, jsgraph()->SmiConstant(p.feedback().index()));
348 ReplaceWithStubCall(node, callable, 422 node->ReplaceInput(4, vector);
349 CallDescriptor::kPatchableCallSite | flags); 423 node->ReplaceInput(7, effect);
424 ReplaceWithStubCall(node, callable, flags);
350 } 425 }
351 426
352 427
353 void JSGenericLowering::LowerJSStoreGlobal(Node* node) { 428 void JSGenericLowering::LowerJSStoreGlobal(Node* node) {
429 Node* closure = NodeProperties::GetValueInput(node, 1);
354 Node* context = NodeProperties::GetContextInput(node); 430 Node* context = NodeProperties::GetContextInput(node);
355 Node* effect = NodeProperties::GetEffectInput(node); 431 Node* effect = NodeProperties::GetEffectInput(node);
432 Node* control = NodeProperties::GetControlInput(node);
356 CallDescriptor::Flags flags = AdjustFrameStatesForCall(node); 433 CallDescriptor::Flags flags = AdjustFrameStatesForCall(node);
357 const StoreGlobalParameters& p = StoreGlobalParametersOf(node->op()); 434 const StoreGlobalParameters& p = StoreGlobalParametersOf(node->op());
358 Callable callable = CodeFactory::StoreICInOptimizedCode( 435 Callable callable = CodeFactory::StoreICInOptimizedCode(
359 isolate(), p.language_mode(), UNINITIALIZED); 436 isolate(), p.language_mode(), UNINITIALIZED);
437 // Load the type feedback vector from the closure.
438 Node* shared_info = effect = graph()->NewNode(
439 machine()->Load(MachineType::AnyTagged()), closure,
440 jsgraph()->IntPtrConstant(JSFunction::kSharedFunctionInfoOffset -
441 kHeapObjectTag),
442 effect, control);
443 Node* vector = effect = graph()->NewNode(
444 machine()->Load(MachineType::AnyTagged()), shared_info,
445 jsgraph()->IntPtrConstant(SharedFunctionInfo::kFeedbackVectorOffset -
446 kHeapObjectTag),
447 effect, control);
360 // Load global object from the context. 448 // Load global object from the context.
361 Node* native_context = 449 Node* native_context = effect =
362 graph()->NewNode(machine()->Load(MachineType::AnyTagged()), context, 450 graph()->NewNode(machine()->Load(MachineType::AnyTagged()), context,
363 jsgraph()->IntPtrConstant( 451 jsgraph()->IntPtrConstant(
364 Context::SlotOffset(Context::NATIVE_CONTEXT_INDEX)), 452 Context::SlotOffset(Context::NATIVE_CONTEXT_INDEX)),
365 effect, graph()->start()); 453 effect, control);
366 Node* global = graph()->NewNode( 454 Node* global = effect = graph()->NewNode(
367 machine()->Load(MachineType::AnyTagged()), native_context, 455 machine()->Load(MachineType::AnyTagged()), native_context,
368 jsgraph()->IntPtrConstant(Context::SlotOffset(Context::EXTENSION_INDEX)), 456 jsgraph()->IntPtrConstant(Context::SlotOffset(Context::EXTENSION_INDEX)),
369 effect, graph()->start()); 457 effect, control);
370 node->InsertInput(zone(), 0, global); 458 node->InsertInput(zone(), 0, global);
371 node->InsertInput(zone(), 1, jsgraph()->HeapConstant(p.name())); 459 node->InsertInput(zone(), 1, jsgraph()->HeapConstant(p.name()));
372 DCHECK(p.feedback().index() != -1);
373 node->InsertInput(zone(), 3, jsgraph()->SmiConstant(p.feedback().index())); 460 node->InsertInput(zone(), 3, jsgraph()->SmiConstant(p.feedback().index()));
374 ReplaceWithStubCall(node, callable, 461 node->ReplaceInput(4, vector);
375 CallDescriptor::kPatchableCallSite | flags); 462 node->ReplaceInput(7, effect);
463 ReplaceWithStubCall(node, callable, flags);
376 } 464 }
377 465
378 466
379 void JSGenericLowering::LowerJSDeleteProperty(Node* node) { 467 void JSGenericLowering::LowerJSDeleteProperty(Node* node) {
380 LanguageMode language_mode = OpParameter<LanguageMode>(node); 468 LanguageMode language_mode = OpParameter<LanguageMode>(node);
381 ReplaceWithRuntimeCall(node, is_strict(language_mode) 469 ReplaceWithRuntimeCall(node, is_strict(language_mode)
382 ? Runtime::kDeleteProperty_Strict 470 ? Runtime::kDeleteProperty_Strict
383 : Runtime::kDeleteProperty_Sloppy); 471 : Runtime::kDeleteProperty_Sloppy);
384 } 472 }
385 473
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after
801 } 889 }
802 890
803 891
804 MachineOperatorBuilder* JSGenericLowering::machine() const { 892 MachineOperatorBuilder* JSGenericLowering::machine() const {
805 return jsgraph()->machine(); 893 return jsgraph()->machine();
806 } 894 }
807 895
808 } // namespace compiler 896 } // namespace compiler
809 } // namespace internal 897 } // namespace internal
810 } // namespace v8 898 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/bytecode-graph-builder.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698