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

Side by Side Diff: src/compiler/js-native-context-specialization.cc

Issue 2161543002: [turbofan] Add support for eager/soft deoptimization reasons. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Do the ports properly Created 4 years, 5 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
OLDNEW
1 // Copyright 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 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/js-native-context-specialization.h" 5 #include "src/compiler/js-native-context-specialization.h"
6 6
7 #include "src/accessors.h" 7 #include "src/accessors.h"
8 #include "src/code-factory.h" 8 #include "src/code-factory.h"
9 #include "src/compilation-dependencies.h" 9 #include "src/compilation-dependencies.h"
10 #include "src/compiler/access-builder.h" 10 #include "src/compiler/access-builder.h"
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after
392 AccessMode access_mode, LanguageMode language_mode) { 392 AccessMode access_mode, LanguageMode language_mode) {
393 DCHECK(node->opcode() == IrOpcode::kJSLoadNamed || 393 DCHECK(node->opcode() == IrOpcode::kJSLoadNamed ||
394 node->opcode() == IrOpcode::kJSStoreNamed); 394 node->opcode() == IrOpcode::kJSStoreNamed);
395 Node* const receiver = NodeProperties::GetValueInput(node, 0); 395 Node* const receiver = NodeProperties::GetValueInput(node, 0);
396 Node* const effect = NodeProperties::GetEffectInput(node); 396 Node* const effect = NodeProperties::GetEffectInput(node);
397 397
398 // Check if the {nexus} reports type feedback for the IC. 398 // Check if the {nexus} reports type feedback for the IC.
399 if (nexus.IsUninitialized()) { 399 if (nexus.IsUninitialized()) {
400 if ((flags() & kDeoptimizationEnabled) && 400 if ((flags() & kDeoptimizationEnabled) &&
401 (flags() & kBailoutOnUninitialized)) { 401 (flags() & kBailoutOnUninitialized)) {
402 return ReduceSoftDeoptimize(node); 402 return ReduceSoftDeoptimize(
403 node,
404 DeoptimizeReason::kInsufficientTypeFeedbackForGenericNamedAccess);
403 } 405 }
404 return NoChange(); 406 return NoChange();
405 } 407 }
406 408
407 // Extract receiver maps from the IC using the {nexus}. 409 // Extract receiver maps from the IC using the {nexus}.
408 MapHandleList receiver_maps; 410 MapHandleList receiver_maps;
409 if (!ExtractReceiverMaps(receiver, effect, nexus, &receiver_maps)) { 411 if (!ExtractReceiverMaps(receiver, effect, nexus, &receiver_maps)) {
410 return NoChange(); 412 return NoChange();
411 } else if (receiver_maps.length() == 0) { 413 } else if (receiver_maps.length() == 0) {
412 if ((flags() & kDeoptimizationEnabled) && 414 if ((flags() & kDeoptimizationEnabled) &&
413 (flags() & kBailoutOnUninitialized)) { 415 (flags() & kBailoutOnUninitialized)) {
414 return ReduceSoftDeoptimize(node); 416 return ReduceSoftDeoptimize(
417 node,
418 DeoptimizeReason::kInsufficientTypeFeedbackForGenericNamedAccess);
415 } 419 }
416 return NoChange(); 420 return NoChange();
417 } 421 }
418 422
419 // Try to lower the named access based on the {receiver_maps}. 423 // Try to lower the named access based on the {receiver_maps}.
420 return ReduceNamedAccess(node, value, receiver_maps, name, access_mode, 424 return ReduceNamedAccess(node, value, receiver_maps, name, access_mode,
421 language_mode); 425 language_mode);
422 } 426 }
423 427
424 428
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after
823 KeyedAccessStoreMode store_mode) { 827 KeyedAccessStoreMode store_mode) {
824 DCHECK(node->opcode() == IrOpcode::kJSLoadProperty || 828 DCHECK(node->opcode() == IrOpcode::kJSLoadProperty ||
825 node->opcode() == IrOpcode::kJSStoreProperty); 829 node->opcode() == IrOpcode::kJSStoreProperty);
826 Node* const receiver = NodeProperties::GetValueInput(node, 0); 830 Node* const receiver = NodeProperties::GetValueInput(node, 0);
827 Node* const effect = NodeProperties::GetEffectInput(node); 831 Node* const effect = NodeProperties::GetEffectInput(node);
828 832
829 // Check if the {nexus} reports type feedback for the IC. 833 // Check if the {nexus} reports type feedback for the IC.
830 if (nexus.IsUninitialized()) { 834 if (nexus.IsUninitialized()) {
831 if ((flags() & kDeoptimizationEnabled) && 835 if ((flags() & kDeoptimizationEnabled) &&
832 (flags() & kBailoutOnUninitialized)) { 836 (flags() & kBailoutOnUninitialized)) {
833 return ReduceSoftDeoptimize(node); 837 return ReduceSoftDeoptimize(
838 node,
839 DeoptimizeReason::kInsufficientTypeFeedbackForGenericKeyedAccess);
834 } 840 }
835 return NoChange(); 841 return NoChange();
836 } 842 }
837 843
838 // Extract receiver maps from the {nexus}. 844 // Extract receiver maps from the {nexus}.
839 MapHandleList receiver_maps; 845 MapHandleList receiver_maps;
840 if (!ExtractReceiverMaps(receiver, effect, nexus, &receiver_maps)) { 846 if (!ExtractReceiverMaps(receiver, effect, nexus, &receiver_maps)) {
841 return NoChange(); 847 return NoChange();
842 } else if (receiver_maps.length() == 0) { 848 } else if (receiver_maps.length() == 0) {
843 if ((flags() & kDeoptimizationEnabled) && 849 if ((flags() & kDeoptimizationEnabled) &&
844 (flags() & kBailoutOnUninitialized)) { 850 (flags() & kBailoutOnUninitialized)) {
845 return ReduceSoftDeoptimize(node); 851 return ReduceSoftDeoptimize(
852 node,
853 DeoptimizeReason::kInsufficientTypeFeedbackForGenericKeyedAccess);
846 } 854 }
847 return NoChange(); 855 return NoChange();
848 } 856 }
849 857
850 // Optimize access for constant {index}. 858 // Optimize access for constant {index}.
851 HeapObjectMatcher mindex(index); 859 HeapObjectMatcher mindex(index);
852 if (mindex.HasValue() && mindex.Value()->IsPrimitive()) { 860 if (mindex.HasValue() && mindex.Value()->IsPrimitive()) {
853 // Keyed access requires a ToPropertyKey on the {index} first before 861 // Keyed access requires a ToPropertyKey on the {index} first before
854 // looking up the property on the object (see ES6 section 12.3.2.1). 862 // looking up the property on the object (see ES6 section 12.3.2.1).
855 // We can only do this for non-observable ToPropertyKey invocations, 863 // We can only do this for non-observable ToPropertyKey invocations,
(...skipping 17 matching lines...) Expand all
873 return ReduceNamedAccess(node, value, receiver_maps, 881 return ReduceNamedAccess(node, value, receiver_maps,
874 handle(name, isolate()), access_mode, 882 handle(name, isolate()), access_mode,
875 language_mode, index); 883 language_mode, index);
876 } 884 }
877 885
878 // Try to lower the element access based on the {receiver_maps}. 886 // Try to lower the element access based on the {receiver_maps}.
879 return ReduceElementAccess(node, index, value, receiver_maps, access_mode, 887 return ReduceElementAccess(node, index, value, receiver_maps, access_mode,
880 language_mode, store_mode); 888 language_mode, store_mode);
881 } 889 }
882 890
883 891 Reduction JSNativeContextSpecialization::ReduceSoftDeoptimize(
884 Reduction JSNativeContextSpecialization::ReduceSoftDeoptimize(Node* node) { 892 Node* node, DeoptimizeReason reason) {
885 Node* effect = NodeProperties::GetEffectInput(node); 893 Node* effect = NodeProperties::GetEffectInput(node);
886 Node* control = NodeProperties::GetControlInput(node); 894 Node* control = NodeProperties::GetControlInput(node);
887 Node* frame_state = NodeProperties::FindFrameStateBefore(node); 895 Node* frame_state = NodeProperties::FindFrameStateBefore(node);
888 Node* deoptimize = 896 Node* deoptimize =
889 graph()->NewNode(common()->Deoptimize(DeoptimizeKind::kSoft), frame_state, 897 graph()->NewNode(common()->Deoptimize(DeoptimizeKind::kSoft, reason),
890 effect, control); 898 frame_state, effect, control);
891 // TODO(bmeurer): This should be on the AdvancedReducer somehow. 899 // TODO(bmeurer): This should be on the AdvancedReducer somehow.
892 NodeProperties::MergeControlToEnd(graph(), common(), deoptimize); 900 NodeProperties::MergeControlToEnd(graph(), common(), deoptimize);
893 Revisit(graph()->end()); 901 Revisit(graph()->end());
894 node->TrimInputCount(0); 902 node->TrimInputCount(0);
895 NodeProperties::ChangeOp(node, common()->Dead()); 903 NodeProperties::ChangeOp(node, common()->Dead());
896 return Changed(node); 904 return Changed(node);
897 } 905 }
898 906
899 907
900 Reduction JSNativeContextSpecialization::ReduceJSLoadProperty(Node* node) { 908 Reduction JSNativeContextSpecialization::ReduceJSLoadProperty(Node* node) {
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
1066 } 1074 }
1067 1075
1068 1076
1069 SimplifiedOperatorBuilder* JSNativeContextSpecialization::simplified() const { 1077 SimplifiedOperatorBuilder* JSNativeContextSpecialization::simplified() const {
1070 return jsgraph()->simplified(); 1078 return jsgraph()->simplified();
1071 } 1079 }
1072 1080
1073 } // namespace compiler 1081 } // namespace compiler
1074 } // namespace internal 1082 } // namespace internal
1075 } // namespace v8 1083 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/js-native-context-specialization.h ('k') | src/compiler/mips/code-generator-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698