Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(282)

Side by Side Diff: src/compiler/js-call-reducer.cc

Issue 2523803003: [turbofan] Fix exception message for non-constructables. (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | test/message/call-non-constructable.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « no previous file | test/message/call-non-constructable.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698