| Index: src/compiler/js-native-context-specialization.cc
|
| diff --git a/src/compiler/js-native-context-specialization.cc b/src/compiler/js-native-context-specialization.cc
|
| index cfe4d9ac26980888fa3fa7f936d33321598535ee..2c11794dbabfd84b85e7dfedd4284f7532349263 100644
|
| --- a/src/compiler/js-native-context-specialization.cc
|
| +++ b/src/compiler/js-native-context-specialization.cc
|
| @@ -461,21 +461,49 @@ Reduction JSNativeContextSpecialization::ReduceNamedAccess(
|
| }
|
|
|
|
|
| +Reduction JSNativeContextSpecialization::ReduceNamedAccess(
|
| + Node* node, Node* value, FeedbackNexus const& nexus, Handle<Name> name,
|
| + AccessMode access_mode, LanguageMode language_mode) {
|
| + DCHECK(node->opcode() == IrOpcode::kJSLoadNamed ||
|
| + node->opcode() == IrOpcode::kJSStoreNamed);
|
| +
|
| + // Check if the {nexus} reports type feedback for the IC.
|
| + if (nexus.IsUninitialized()) {
|
| + if ((flags() & kDeoptimizationEnabled) &&
|
| + (flags() & kBailoutOnUninitialized)) {
|
| + // TODO(turbofan): Implement all eager bailout points correctly in
|
| + // the graph builder.
|
| + Node* frame_state = NodeProperties::GetFrameStateInput(node, 1);
|
| + if (!OpParameter<FrameStateInfo>(frame_state).bailout_id().IsNone()) {
|
| + return ReduceSoftDeoptimize(node);
|
| + }
|
| + }
|
| + return NoChange();
|
| + }
|
| +
|
| + // Extract receiver maps from the IC using the {nexus}.
|
| + MapHandleList receiver_maps;
|
| + if (nexus.ExtractMaps(&receiver_maps) == 0) return NoChange();
|
| + DCHECK_LT(0, receiver_maps.length());
|
| +
|
| + // Try to lower the named access based on the {receiver_maps}.
|
| + return ReduceNamedAccess(node, value, receiver_maps, name, access_mode,
|
| + language_mode);
|
| +}
|
| +
|
| +
|
| Reduction JSNativeContextSpecialization::ReduceJSLoadNamed(Node* node) {
|
| DCHECK_EQ(IrOpcode::kJSLoadNamed, node->opcode());
|
| NamedAccess const& p = NamedAccessOf(node->op());
|
| Node* const value = jsgraph()->Dead();
|
|
|
| // Extract receiver maps from the LOAD_IC using the LoadICNexus.
|
| - MapHandleList receiver_maps;
|
| if (!p.feedback().IsValid()) return NoChange();
|
| LoadICNexus nexus(p.feedback().vector(), p.feedback().slot());
|
| - if (nexus.ExtractMaps(&receiver_maps) == 0) return NoChange();
|
| - DCHECK_LT(0, receiver_maps.length());
|
|
|
| // Try to lower the named access based on the {receiver_maps}.
|
| - return ReduceNamedAccess(node, value, receiver_maps, p.name(),
|
| - AccessMode::kLoad, p.language_mode());
|
| + return ReduceNamedAccess(node, value, nexus, p.name(), AccessMode::kLoad,
|
| + p.language_mode());
|
| }
|
|
|
|
|
| @@ -485,15 +513,12 @@ Reduction JSNativeContextSpecialization::ReduceJSStoreNamed(Node* node) {
|
| Node* const value = NodeProperties::GetValueInput(node, 1);
|
|
|
| // Extract receiver maps from the STORE_IC using the StoreICNexus.
|
| - MapHandleList receiver_maps;
|
| if (!p.feedback().IsValid()) return NoChange();
|
| StoreICNexus nexus(p.feedback().vector(), p.feedback().slot());
|
| - if (nexus.ExtractMaps(&receiver_maps) == 0) return NoChange();
|
| - DCHECK_LT(0, receiver_maps.length());
|
|
|
| // Try to lower the named access based on the {receiver_maps}.
|
| - return ReduceNamedAccess(node, value, receiver_maps, p.name(),
|
| - AccessMode::kStore, p.language_mode());
|
| + return ReduceNamedAccess(node, value, nexus, p.name(), AccessMode::kStore,
|
| + p.language_mode());
|
| }
|
|
|
|
|
| @@ -901,6 +926,20 @@ Reduction JSNativeContextSpecialization::ReduceKeyedAccess(
|
| DCHECK(node->opcode() == IrOpcode::kJSLoadProperty ||
|
| node->opcode() == IrOpcode::kJSStoreProperty);
|
|
|
| + // Check if the {nexus} reports type feedback for the IC.
|
| + if (nexus.IsUninitialized()) {
|
| + if ((flags() & kDeoptimizationEnabled) &&
|
| + (flags() & kBailoutOnUninitialized)) {
|
| + // TODO(turbofan): Implement all eager bailout points correctly in
|
| + // the graph builder.
|
| + Node* frame_state = NodeProperties::GetFrameStateInput(node, 1);
|
| + if (!OpParameter<FrameStateInfo>(frame_state).bailout_id().IsNone()) {
|
| + return ReduceSoftDeoptimize(node);
|
| + }
|
| + }
|
| + return NoChange();
|
| + }
|
| +
|
| // Extract receiver maps from the {nexus}.
|
| MapHandleList receiver_maps;
|
| if (nexus.ExtractMaps(&receiver_maps) == 0) return NoChange();
|
| @@ -940,6 +979,22 @@ Reduction JSNativeContextSpecialization::ReduceKeyedAccess(
|
| }
|
|
|
|
|
| +Reduction JSNativeContextSpecialization::ReduceSoftDeoptimize(Node* node) {
|
| + Node* frame_state = NodeProperties::GetFrameStateInput(node, 1);
|
| + Node* effect = NodeProperties::GetEffectInput(node);
|
| + Node* control = NodeProperties::GetControlInput(node);
|
| + Node* deoptimize =
|
| + graph()->NewNode(common()->Deoptimize(DeoptimizeKind::kSoft), frame_state,
|
| + effect, control);
|
| + // TODO(bmeurer): This should be on the AdvancedReducer somehow.
|
| + NodeProperties::MergeControlToEnd(graph(), common(), deoptimize);
|
| + Revisit(graph()->end());
|
| + node->TrimInputCount(0);
|
| + NodeProperties::ChangeOp(node, common()->Dead());
|
| + return Changed(node);
|
| +}
|
| +
|
| +
|
| Reduction JSNativeContextSpecialization::ReduceJSLoadProperty(Node* node) {
|
| DCHECK_EQ(IrOpcode::kJSLoadProperty, node->opcode());
|
| PropertyAccess const& p = PropertyAccessOf(node->op());
|
|
|