| OLD | NEW |
| 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 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 428 AccessMode access_mode, LanguageMode language_mode) { | 428 AccessMode access_mode, LanguageMode language_mode) { |
| 429 DCHECK(node->opcode() == IrOpcode::kJSLoadNamed || | 429 DCHECK(node->opcode() == IrOpcode::kJSLoadNamed || |
| 430 node->opcode() == IrOpcode::kJSStoreNamed); | 430 node->opcode() == IrOpcode::kJSStoreNamed); |
| 431 Node* const receiver = NodeProperties::GetValueInput(node, 0); | 431 Node* const receiver = NodeProperties::GetValueInput(node, 0); |
| 432 Node* const effect = NodeProperties::GetEffectInput(node); | 432 Node* const effect = NodeProperties::GetEffectInput(node); |
| 433 | 433 |
| 434 // Check if the {nexus} reports type feedback for the IC. | 434 // Check if the {nexus} reports type feedback for the IC. |
| 435 if (nexus.IsUninitialized()) { | 435 if (nexus.IsUninitialized()) { |
| 436 if ((flags() & kDeoptimizationEnabled) && | 436 if ((flags() & kDeoptimizationEnabled) && |
| 437 (flags() & kBailoutOnUninitialized)) { | 437 (flags() & kBailoutOnUninitialized)) { |
| 438 // TODO(turbofan): Implement all eager bailout points correctly in | 438 return ReduceSoftDeoptimize(node); |
| 439 // the graph builder. | |
| 440 Node* frame_state = NodeProperties::GetFrameStateInput(node, 1); | |
| 441 if (!OpParameter<FrameStateInfo>(frame_state).bailout_id().IsNone()) { | |
| 442 return ReduceSoftDeoptimize(node); | |
| 443 } | |
| 444 } | 439 } |
| 445 return NoChange(); | 440 return NoChange(); |
| 446 } | 441 } |
| 447 | 442 |
| 448 // Extract receiver maps from the IC using the {nexus}. | 443 // Extract receiver maps from the IC using the {nexus}. |
| 449 MapHandleList receiver_maps; | 444 MapHandleList receiver_maps; |
| 450 if (!ExtractReceiverMaps(receiver, effect, nexus, &receiver_maps)) { | 445 if (!ExtractReceiverMaps(receiver, effect, nexus, &receiver_maps)) { |
| 451 return NoChange(); | 446 return NoChange(); |
| 452 } else if (receiver_maps.length() == 0) { | 447 } else if (receiver_maps.length() == 0) { |
| 453 if ((flags() & kDeoptimizationEnabled) && | 448 if ((flags() & kDeoptimizationEnabled) && |
| 454 (flags() & kBailoutOnUninitialized)) { | 449 (flags() & kBailoutOnUninitialized)) { |
| 455 // TODO(turbofan): Implement all eager bailout points correctly in | 450 return ReduceSoftDeoptimize(node); |
| 456 // the graph builder. | |
| 457 Node* frame_state = NodeProperties::GetFrameStateInput(node, 1); | |
| 458 if (!OpParameter<FrameStateInfo>(frame_state).bailout_id().IsNone()) { | |
| 459 return ReduceSoftDeoptimize(node); | |
| 460 } | |
| 461 } | 451 } |
| 462 return NoChange(); | 452 return NoChange(); |
| 463 } | 453 } |
| 464 | 454 |
| 465 // Try to lower the named access based on the {receiver_maps}. | 455 // Try to lower the named access based on the {receiver_maps}. |
| 466 return ReduceNamedAccess(node, value, receiver_maps, name, access_mode, | 456 return ReduceNamedAccess(node, value, receiver_maps, name, access_mode, |
| 467 language_mode); | 457 language_mode); |
| 468 } | 458 } |
| 469 | 459 |
| 470 | 460 |
| (...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 910 KeyedAccessStoreMode store_mode) { | 900 KeyedAccessStoreMode store_mode) { |
| 911 DCHECK(node->opcode() == IrOpcode::kJSLoadProperty || | 901 DCHECK(node->opcode() == IrOpcode::kJSLoadProperty || |
| 912 node->opcode() == IrOpcode::kJSStoreProperty); | 902 node->opcode() == IrOpcode::kJSStoreProperty); |
| 913 Node* const receiver = NodeProperties::GetValueInput(node, 0); | 903 Node* const receiver = NodeProperties::GetValueInput(node, 0); |
| 914 Node* const effect = NodeProperties::GetEffectInput(node); | 904 Node* const effect = NodeProperties::GetEffectInput(node); |
| 915 | 905 |
| 916 // Check if the {nexus} reports type feedback for the IC. | 906 // Check if the {nexus} reports type feedback for the IC. |
| 917 if (nexus.IsUninitialized()) { | 907 if (nexus.IsUninitialized()) { |
| 918 if ((flags() & kDeoptimizationEnabled) && | 908 if ((flags() & kDeoptimizationEnabled) && |
| 919 (flags() & kBailoutOnUninitialized)) { | 909 (flags() & kBailoutOnUninitialized)) { |
| 920 // TODO(turbofan): Implement all eager bailout points correctly in | 910 return ReduceSoftDeoptimize(node); |
| 921 // the graph builder. | |
| 922 Node* frame_state = NodeProperties::GetFrameStateInput(node, 1); | |
| 923 if (!OpParameter<FrameStateInfo>(frame_state).bailout_id().IsNone()) { | |
| 924 return ReduceSoftDeoptimize(node); | |
| 925 } | |
| 926 } | 911 } |
| 927 return NoChange(); | 912 return NoChange(); |
| 928 } | 913 } |
| 929 | 914 |
| 930 // Extract receiver maps from the {nexus}. | 915 // Extract receiver maps from the {nexus}. |
| 931 MapHandleList receiver_maps; | 916 MapHandleList receiver_maps; |
| 932 if (!ExtractReceiverMaps(receiver, effect, nexus, &receiver_maps)) { | 917 if (!ExtractReceiverMaps(receiver, effect, nexus, &receiver_maps)) { |
| 933 return NoChange(); | 918 return NoChange(); |
| 934 } else if (receiver_maps.length() == 0) { | 919 } else if (receiver_maps.length() == 0) { |
| 935 if ((flags() & kDeoptimizationEnabled) && | 920 if ((flags() & kDeoptimizationEnabled) && |
| 936 (flags() & kBailoutOnUninitialized)) { | 921 (flags() & kBailoutOnUninitialized)) { |
| 937 // TODO(turbofan): Implement all eager bailout points correctly in | 922 return ReduceSoftDeoptimize(node); |
| 938 // the graph builder. | |
| 939 Node* frame_state = NodeProperties::GetFrameStateInput(node, 1); | |
| 940 if (!OpParameter<FrameStateInfo>(frame_state).bailout_id().IsNone()) { | |
| 941 return ReduceSoftDeoptimize(node); | |
| 942 } | |
| 943 } | 923 } |
| 944 return NoChange(); | 924 return NoChange(); |
| 945 } | 925 } |
| 946 | 926 |
| 947 // Optimize access for constant {index}. | 927 // Optimize access for constant {index}. |
| 948 HeapObjectMatcher mindex(index); | 928 HeapObjectMatcher mindex(index); |
| 949 if (mindex.HasValue() && mindex.Value()->IsPrimitive()) { | 929 if (mindex.HasValue() && mindex.Value()->IsPrimitive()) { |
| 950 // Keyed access requires a ToPropertyKey on the {index} first before | 930 // Keyed access requires a ToPropertyKey on the {index} first before |
| 951 // looking up the property on the object (see ES6 section 12.3.2.1). | 931 // looking up the property on the object (see ES6 section 12.3.2.1). |
| 952 // We can only do this for non-observable ToPropertyKey invocations, | 932 // We can only do this for non-observable ToPropertyKey invocations, |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1163 } | 1143 } |
| 1164 | 1144 |
| 1165 | 1145 |
| 1166 SimplifiedOperatorBuilder* JSNativeContextSpecialization::simplified() const { | 1146 SimplifiedOperatorBuilder* JSNativeContextSpecialization::simplified() const { |
| 1167 return jsgraph()->simplified(); | 1147 return jsgraph()->simplified(); |
| 1168 } | 1148 } |
| 1169 | 1149 |
| 1170 } // namespace compiler | 1150 } // namespace compiler |
| 1171 } // namespace internal | 1151 } // namespace internal |
| 1172 } // namespace v8 | 1152 } // namespace v8 |
| OLD | NEW |