| 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" |
| 11 #include "src/compiler/access-info.h" | 11 #include "src/compiler/access-info.h" |
| 12 #include "src/compiler/frame-states.h" |
| 12 #include "src/compiler/js-graph.h" | 13 #include "src/compiler/js-graph.h" |
| 13 #include "src/compiler/js-operator.h" | 14 #include "src/compiler/js-operator.h" |
| 14 #include "src/compiler/linkage.h" | 15 #include "src/compiler/linkage.h" |
| 15 #include "src/compiler/node-matchers.h" | 16 #include "src/compiler/node-matchers.h" |
| 16 #include "src/compiler/type-cache.h" | 17 #include "src/compiler/type-cache.h" |
| 17 #include "src/feedback-vector.h" | 18 #include "src/feedback-vector.h" |
| 18 #include "src/field-index-inl.h" | 19 #include "src/field-index-inl.h" |
| 19 #include "src/isolate-inl.h" | 20 #include "src/isolate-inl.h" |
| 20 | 21 |
| 21 namespace v8 { | 22 namespace v8 { |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 | 160 |
| 160 return NoChange(); | 161 return NoChange(); |
| 161 } | 162 } |
| 162 | 163 |
| 163 Reduction JSNativeContextSpecialization::ReduceJSInstanceOf(Node* node) { | 164 Reduction JSNativeContextSpecialization::ReduceJSInstanceOf(Node* node) { |
| 164 DCHECK_EQ(IrOpcode::kJSInstanceOf, node->opcode()); | 165 DCHECK_EQ(IrOpcode::kJSInstanceOf, node->opcode()); |
| 165 Node* object = NodeProperties::GetValueInput(node, 0); | 166 Node* object = NodeProperties::GetValueInput(node, 0); |
| 166 Node* constructor = NodeProperties::GetValueInput(node, 1); | 167 Node* constructor = NodeProperties::GetValueInput(node, 1); |
| 167 Node* context = NodeProperties::GetContextInput(node); | 168 Node* context = NodeProperties::GetContextInput(node); |
| 168 Node* effect = NodeProperties::GetEffectInput(node); | 169 Node* effect = NodeProperties::GetEffectInput(node); |
| 170 Node* outer_frame_state = NodeProperties::GetFrameStateInput(node); |
| 169 Node* control = NodeProperties::GetControlInput(node); | 171 Node* control = NodeProperties::GetControlInput(node); |
| 170 | 172 |
| 171 // Check if the right hand side is a known {receiver}. | 173 // Check if the right hand side is a known {receiver}. |
| 172 HeapObjectMatcher m(constructor); | 174 HeapObjectMatcher m(constructor); |
| 173 if (!m.HasValue() || !m.Value()->IsJSObject()) return NoChange(); | 175 if (!m.HasValue() || !m.Value()->IsJSObject()) return NoChange(); |
| 174 Handle<JSObject> receiver = Handle<JSObject>::cast(m.Value()); | 176 Handle<JSObject> receiver = Handle<JSObject>::cast(m.Value()); |
| 175 Handle<Map> receiver_map(receiver->map(), isolate()); | 177 Handle<Map> receiver_map(receiver->map(), isolate()); |
| 176 | 178 |
| 177 // Compute property access info for @@hasInstance on {receiver}. | 179 // Compute property access info for @@hasInstance on {receiver}. |
| 178 PropertyAccessInfo access_info; | 180 PropertyAccessInfo access_info; |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 228 FieldIndex field_index = access_info.field_index(); | 230 FieldIndex field_index = access_info.field_index(); |
| 229 constant = JSObject::FastPropertyAt(holder, Representation::Tagged(), | 231 constant = JSObject::FastPropertyAt(holder, Representation::Tagged(), |
| 230 field_index); | 232 field_index); |
| 231 } | 233 } |
| 232 DCHECK(constant->IsCallable()); | 234 DCHECK(constant->IsCallable()); |
| 233 | 235 |
| 234 // Monomorphic property access. | 236 // Monomorphic property access. |
| 235 effect = BuildCheckMaps(constructor, effect, control, | 237 effect = BuildCheckMaps(constructor, effect, control, |
| 236 access_info.receiver_maps()); | 238 access_info.receiver_maps()); |
| 237 | 239 |
| 240 Node* frame_state; |
| 241 std::tie(frame_state, effect) = CreateStubBuiltinContinuationFrameState( |
| 242 jsgraph(), Builtins::kToBooleanLazyDeoptContinuation, context, nullptr, |
| 243 0, effect, control, outer_frame_state, DONT_CREATE_CHECKPOINT); |
| 244 |
| 238 // Call the @@hasInstance handler. | 245 // Call the @@hasInstance handler. |
| 239 Node* target = jsgraph()->Constant(constant); | 246 Node* target = jsgraph()->Constant(constant); |
| 240 node->InsertInput(graph()->zone(), 0, target); | 247 node->InsertInput(graph()->zone(), 0, target); |
| 241 node->ReplaceInput(1, constructor); | 248 node->ReplaceInput(1, constructor); |
| 242 node->ReplaceInput(2, object); | 249 node->ReplaceInput(2, object); |
| 250 node->ReplaceInput(4, frame_state); |
| 243 node->ReplaceInput(5, effect); | 251 node->ReplaceInput(5, effect); |
| 244 NodeProperties::ChangeOp( | 252 NodeProperties::ChangeOp( |
| 245 node, | 253 node, |
| 246 javascript()->Call(3, 0.0f, VectorSlotPair(), | 254 javascript()->Call(3, 0.0f, VectorSlotPair(), |
| 247 ConvertReceiverMode::kNotNullOrUndefined)); | 255 ConvertReceiverMode::kNotNullOrUndefined)); |
| 248 | 256 |
| 249 // Rewire the value uses of {node} to ToBoolean conversion of the result. | 257 // Rewire the value uses of {node} to ToBoolean conversion of the result. |
| 250 Node* value = graph()->NewNode(javascript()->ToBoolean(ToBooleanHint::kAny), | 258 Node* value = graph()->NewNode(javascript()->ToBoolean(ToBooleanHint::kAny), |
| 251 node, context); | 259 node, context); |
| 252 for (Edge edge : node->use_edges()) { | 260 for (Edge edge : node->use_edges()) { |
| (...skipping 2318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2571 return jsgraph()->javascript(); | 2579 return jsgraph()->javascript(); |
| 2572 } | 2580 } |
| 2573 | 2581 |
| 2574 SimplifiedOperatorBuilder* JSNativeContextSpecialization::simplified() const { | 2582 SimplifiedOperatorBuilder* JSNativeContextSpecialization::simplified() const { |
| 2575 return jsgraph()->simplified(); | 2583 return jsgraph()->simplified(); |
| 2576 } | 2584 } |
| 2577 | 2585 |
| 2578 } // namespace compiler | 2586 } // namespace compiler |
| 2579 } // namespace internal | 2587 } // namespace internal |
| 2580 } // namespace v8 | 2588 } // namespace v8 |
| OLD | NEW |