Chromium Code Reviews| 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 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 168 | 168 |
| 169 return NoChange(); | 169 return NoChange(); |
| 170 } | 170 } |
| 171 | 171 |
| 172 Reduction JSNativeContextSpecialization::ReduceJSInstanceOf(Node* node) { | 172 Reduction JSNativeContextSpecialization::ReduceJSInstanceOf(Node* node) { |
| 173 DCHECK_EQ(IrOpcode::kJSInstanceOf, node->opcode()); | 173 DCHECK_EQ(IrOpcode::kJSInstanceOf, node->opcode()); |
| 174 Node* object = NodeProperties::GetValueInput(node, 0); | 174 Node* object = NodeProperties::GetValueInput(node, 0); |
| 175 Node* constructor = NodeProperties::GetValueInput(node, 1); | 175 Node* constructor = NodeProperties::GetValueInput(node, 1); |
| 176 Node* context = NodeProperties::GetContextInput(node); | 176 Node* context = NodeProperties::GetContextInput(node); |
| 177 Node* effect = NodeProperties::GetEffectInput(node); | 177 Node* effect = NodeProperties::GetEffectInput(node); |
| 178 Node* outer_frame_state = NodeProperties::GetFrameStateInput(node); | |
|
Michael Starzinger
2017/06/22 14:16:11
nit: s/outer_frame_state/frame_state/
danno
2017/06/22 15:04:00
Done.
| |
| 178 Node* control = NodeProperties::GetControlInput(node); | 179 Node* control = NodeProperties::GetControlInput(node); |
| 179 | 180 |
| 180 // Check if the right hand side is a known {receiver}. | 181 // Check if the right hand side is a known {receiver}. |
| 181 HeapObjectMatcher m(constructor); | 182 HeapObjectMatcher m(constructor); |
| 182 if (!m.HasValue() || !m.Value()->IsJSObject()) return NoChange(); | 183 if (!m.HasValue() || !m.Value()->IsJSObject()) return NoChange(); |
| 183 Handle<JSObject> receiver = Handle<JSObject>::cast(m.Value()); | 184 Handle<JSObject> receiver = Handle<JSObject>::cast(m.Value()); |
| 184 Handle<Map> receiver_map(receiver->map(), isolate()); | 185 Handle<Map> receiver_map(receiver->map(), isolate()); |
| 185 | 186 |
| 186 // Compute property access info for @@hasInstance on {receiver}. | 187 // Compute property access info for @@hasInstance on {receiver}. |
| 187 PropertyAccessInfo access_info; | 188 PropertyAccessInfo access_info; |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 237 FieldIndex field_index = access_info.field_index(); | 238 FieldIndex field_index = access_info.field_index(); |
| 238 constant = JSObject::FastPropertyAt(holder, Representation::Tagged(), | 239 constant = JSObject::FastPropertyAt(holder, Representation::Tagged(), |
| 239 field_index); | 240 field_index); |
| 240 } | 241 } |
| 241 DCHECK(constant->IsCallable()); | 242 DCHECK(constant->IsCallable()); |
| 242 | 243 |
| 243 // Monomorphic property access. | 244 // Monomorphic property access. |
| 244 effect = BuildCheckMaps(constructor, effect, control, | 245 effect = BuildCheckMaps(constructor, effect, control, |
| 245 access_info.receiver_maps()); | 246 access_info.receiver_maps()); |
| 246 | 247 |
| 248 Node* frame_state = CreateStubBuiltinContinuationFrameState( | |
|
Michael Starzinger
2017/06/22 14:16:11
nit: s/frame_state/continuation_frame_state/
Michael Starzinger
2017/06/22 14:16:11
nit: Please add a comment explaining the reasoning
danno
2017/06/22 15:04:00
Done.
danno
2017/06/22 15:04:00
Done.
| |
| 249 jsgraph(), Builtins::kToBooleanLazyDeoptContinuation, context, nullptr, | |
| 250 0, outer_frame_state, ContinuationFrameStateMode::LAZY); | |
| 251 | |
| 247 // Call the @@hasInstance handler. | 252 // Call the @@hasInstance handler. |
| 248 Node* target = jsgraph()->Constant(constant); | 253 Node* target = jsgraph()->Constant(constant); |
| 249 node->InsertInput(graph()->zone(), 0, target); | 254 node->InsertInput(graph()->zone(), 0, target); |
| 250 node->ReplaceInput(1, constructor); | 255 node->ReplaceInput(1, constructor); |
| 251 node->ReplaceInput(2, object); | 256 node->ReplaceInput(2, object); |
| 257 node->ReplaceInput(4, frame_state); | |
| 252 node->ReplaceInput(5, effect); | 258 node->ReplaceInput(5, effect); |
| 253 NodeProperties::ChangeOp( | 259 NodeProperties::ChangeOp( |
| 254 node, javascript()->Call(3, CallFrequency(), VectorSlotPair(), | 260 node, javascript()->Call(3, CallFrequency(), VectorSlotPair(), |
| 255 ConvertReceiverMode::kNotNullOrUndefined)); | 261 ConvertReceiverMode::kNotNullOrUndefined)); |
| 256 | 262 |
| 257 // Rewire the value uses of {node} to ToBoolean conversion of the result. | 263 // Rewire the value uses of {node} to ToBoolean conversion of the result. |
| 258 Node* value = graph()->NewNode(javascript()->ToBoolean(ToBooleanHint::kAny), | 264 Node* value = graph()->NewNode(javascript()->ToBoolean(ToBooleanHint::kAny), |
| 259 node, context); | 265 node, context); |
| 260 for (Edge edge : node->use_edges()) { | 266 for (Edge edge : node->use_edges()) { |
| 261 if (NodeProperties::IsValueEdge(edge) && edge.from() != value) { | 267 if (NodeProperties::IsValueEdge(edge) && edge.from() != value) { |
| (...skipping 2352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2614 return jsgraph()->javascript(); | 2620 return jsgraph()->javascript(); |
| 2615 } | 2621 } |
| 2616 | 2622 |
| 2617 SimplifiedOperatorBuilder* JSNativeContextSpecialization::simplified() const { | 2623 SimplifiedOperatorBuilder* JSNativeContextSpecialization::simplified() const { |
| 2618 return jsgraph()->simplified(); | 2624 return jsgraph()->simplified(); |
| 2619 } | 2625 } |
| 2620 | 2626 |
| 2621 } // namespace compiler | 2627 } // namespace compiler |
| 2622 } // namespace internal | 2628 } // namespace internal |
| 2623 } // namespace v8 | 2629 } // namespace v8 |
| OLD | NEW |