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-call-reducer.h" | 5 #include "src/compiler/js-call-reducer.h" |
6 | 6 |
7 #include "src/compiler/js-graph.h" | 7 #include "src/compiler/js-graph.h" |
8 #include "src/compiler/node-matchers.h" | 8 #include "src/compiler/node-matchers.h" |
9 #include "src/compiler/simplified-operator.h" | 9 #include "src/compiler/simplified-operator.h" |
10 #include "src/objects-inl.h" | 10 #include "src/objects-inl.h" |
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 // TODO(bmeurer): Also support proxies here. | 274 // TODO(bmeurer): Also support proxies here. |
275 return NoChange(); | 275 return NoChange(); |
276 } | 276 } |
277 | 277 |
278 // Not much we can do if deoptimization support is disabled. | 278 // Not much we can do if deoptimization support is disabled. |
279 if (!(flags() & kDeoptimizationEnabled)) return NoChange(); | 279 if (!(flags() & kDeoptimizationEnabled)) return NoChange(); |
280 | 280 |
281 // Extract feedback from the {node} using the CallICNexus. | 281 // Extract feedback from the {node} using the CallICNexus. |
282 if (!p.feedback().IsValid()) return NoChange(); | 282 if (!p.feedback().IsValid()) return NoChange(); |
283 CallICNexus nexus(p.feedback().vector(), p.feedback().slot()); | 283 CallICNexus nexus(p.feedback().vector(), p.feedback().slot()); |
| 284 if (nexus.IsUninitialized() && (flags() & kBailoutOnUninitialized)) { |
| 285 Node* frame_state = NodeProperties::FindFrameStateBefore(node); |
| 286 Node* deoptimize = graph()->NewNode( |
| 287 common()->Deoptimize( |
| 288 DeoptimizeKind::kSoft, |
| 289 DeoptimizeReason::kInsufficientTypeFeedbackForCall), |
| 290 frame_state, effect, control); |
| 291 // TODO(bmeurer): This should be on the AdvancedReducer somehow. |
| 292 NodeProperties::MergeControlToEnd(graph(), common(), deoptimize); |
| 293 Revisit(graph()->end()); |
| 294 node->TrimInputCount(0); |
| 295 NodeProperties::ChangeOp(node, common()->Dead()); |
| 296 return Changed(node); |
| 297 } |
284 Handle<Object> feedback(nexus.GetFeedback(), isolate()); | 298 Handle<Object> feedback(nexus.GetFeedback(), isolate()); |
285 if (feedback->IsAllocationSite()) { | 299 if (feedback->IsAllocationSite()) { |
286 // Retrieve the Array function from the {node}. | 300 // Retrieve the Array function from the {node}. |
287 Node* array_function; | 301 Node* array_function; |
288 Handle<Context> native_context; | 302 Handle<Context> native_context; |
289 if (GetNativeContext(node).ToHandle(&native_context)) { | 303 if (GetNativeContext(node).ToHandle(&native_context)) { |
290 array_function = jsgraph()->HeapConstant( | 304 array_function = jsgraph()->HeapConstant( |
291 handle(native_context->array_function(), isolate())); | 305 handle(native_context->array_function(), isolate())); |
292 } else { | 306 } else { |
293 Node* native_context = effect = graph()->NewNode( | 307 Node* native_context = effect = graph()->NewNode( |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
478 return jsgraph()->javascript(); | 492 return jsgraph()->javascript(); |
479 } | 493 } |
480 | 494 |
481 SimplifiedOperatorBuilder* JSCallReducer::simplified() const { | 495 SimplifiedOperatorBuilder* JSCallReducer::simplified() const { |
482 return jsgraph()->simplified(); | 496 return jsgraph()->simplified(); |
483 } | 497 } |
484 | 498 |
485 } // namespace compiler | 499 } // namespace compiler |
486 } // namespace internal | 500 } // namespace internal |
487 } // namespace v8 | 501 } // namespace v8 |
OLD | NEW |