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 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
405 // Try to specialize JSCallConstruct {node}s with constant {target}s. | 405 // Try to specialize JSCallConstruct {node}s with constant {target}s. |
406 HeapObjectMatcher m(target); | 406 HeapObjectMatcher m(target); |
407 if (m.HasValue()) { | 407 if (m.HasValue()) { |
408 if (m.Value()->IsJSFunction()) { | 408 if (m.Value()->IsJSFunction()) { |
409 Handle<JSFunction> function = Handle<JSFunction>::cast(m.Value()); | 409 Handle<JSFunction> function = Handle<JSFunction>::cast(m.Value()); |
410 | 410 |
411 // Raise a TypeError if the {target} is not a constructor. | 411 // Raise a TypeError if the {target} is not a constructor. |
412 if (!function->IsConstructor()) { | 412 if (!function->IsConstructor()) { |
413 NodeProperties::ReplaceValueInputs(node, target); | 413 NodeProperties::ReplaceValueInputs(node, target); |
414 NodeProperties::ChangeOp( | 414 NodeProperties::ChangeOp( |
415 node, javascript()->CallRuntime(Runtime::kThrowCalledNonCallable)); | 415 node, javascript()->CallRuntime( |
| 416 Runtime::kThrowConstructedNonConstructable)); |
416 return Changed(node); | 417 return Changed(node); |
417 } | 418 } |
418 | 419 |
419 // Check for the ArrayConstructor. | 420 // Check for the ArrayConstructor. |
420 if (*function == function->native_context()->array_function()) { | 421 if (*function == function->native_context()->array_function()) { |
421 // Check if we have an allocation site. | 422 // Check if we have an allocation site. |
422 Handle<AllocationSite> site; | 423 Handle<AllocationSite> site; |
423 if (p.feedback().IsValid()) { | 424 if (p.feedback().IsValid()) { |
424 CallICNexus nexus(p.feedback().vector(), p.feedback().slot()); | 425 CallICNexus nexus(p.feedback().vector(), p.feedback().slot()); |
425 Handle<Object> feedback(nexus.GetFeedback(), isolate()); | 426 Handle<Object> feedback(nexus.GetFeedback(), isolate()); |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
515 return jsgraph()->javascript(); | 516 return jsgraph()->javascript(); |
516 } | 517 } |
517 | 518 |
518 SimplifiedOperatorBuilder* JSCallReducer::simplified() const { | 519 SimplifiedOperatorBuilder* JSCallReducer::simplified() const { |
519 return jsgraph()->simplified(); | 520 return jsgraph()->simplified(); |
520 } | 521 } |
521 | 522 |
522 } // namespace compiler | 523 } // namespace compiler |
523 } // namespace internal | 524 } // namespace internal |
524 } // namespace v8 | 525 } // namespace v8 |
OLD | NEW |