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

Side by Side Diff: src/compiler/js-create-lowering.cc

Issue 2499573002: [turbofan] Fix a couple of invalid Uint32Constant/Int32Constant uses. (Closed)
Patch Set: Created 4 years, 1 month 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 | « src/compiler/js-builtin-reducer.cc ('k') | src/compiler/js-inlining.cc » ('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 2016 the V8 project authors. All rights reserved. 1 // Copyright 2016 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-create-lowering.h" 5 #include "src/compiler/js-create-lowering.h"
6 6
7 #include "src/allocation-site-scopes.h" 7 #include "src/allocation-site-scopes.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 493 matching lines...) Expand 10 before | Expand all | Expand 10 after
504 : DONT_OVERRIDE; 504 : DONT_OVERRIDE;
505 505
506 if (arity == 0) { 506 if (arity == 0) {
507 ArrayNoArgumentConstructorStub stub(isolate(), elements_kind, 507 ArrayNoArgumentConstructorStub stub(isolate(), elements_kind,
508 override_mode); 508 override_mode);
509 CallDescriptor* desc = Linkage::GetStubCallDescriptor( 509 CallDescriptor* desc = Linkage::GetStubCallDescriptor(
510 isolate(), graph()->zone(), stub.GetCallInterfaceDescriptor(), 1, 510 isolate(), graph()->zone(), stub.GetCallInterfaceDescriptor(), 1,
511 CallDescriptor::kNeedsFrameState); 511 CallDescriptor::kNeedsFrameState);
512 node->ReplaceInput(0, jsgraph()->HeapConstant(stub.GetCode())); 512 node->ReplaceInput(0, jsgraph()->HeapConstant(stub.GetCode()));
513 node->InsertInput(graph()->zone(), 2, jsgraph()->HeapConstant(site)); 513 node->InsertInput(graph()->zone(), 2, jsgraph()->HeapConstant(site));
514 node->InsertInput(graph()->zone(), 3, jsgraph()->Int32Constant(0)); 514 node->InsertInput(graph()->zone(), 3, jsgraph()->Constant(0));
515 node->InsertInput(graph()->zone(), 4, jsgraph()->UndefinedConstant()); 515 node->InsertInput(graph()->zone(), 4, jsgraph()->UndefinedConstant());
516 NodeProperties::ChangeOp(node, common()->Call(desc)); 516 NodeProperties::ChangeOp(node, common()->Call(desc));
517 return Changed(node); 517 return Changed(node);
518 } else if (arity == 1) { 518 } else if (arity == 1) {
519 AllocationSiteOverrideMode override_mode = 519 AllocationSiteOverrideMode override_mode =
520 (AllocationSite::GetMode(elements_kind) == TRACK_ALLOCATION_SITE) 520 (AllocationSite::GetMode(elements_kind) == TRACK_ALLOCATION_SITE)
521 ? DISABLE_ALLOCATION_SITES 521 ? DISABLE_ALLOCATION_SITES
522 : DONT_OVERRIDE; 522 : DONT_OVERRIDE;
523 523
524 if (IsHoleyElementsKind(elements_kind)) { 524 if (IsHoleyElementsKind(elements_kind)) {
525 ArraySingleArgumentConstructorStub stub(isolate(), elements_kind, 525 ArraySingleArgumentConstructorStub stub(isolate(), elements_kind,
526 override_mode); 526 override_mode);
527 CallDescriptor* desc = Linkage::GetStubCallDescriptor( 527 CallDescriptor* desc = Linkage::GetStubCallDescriptor(
528 isolate(), graph()->zone(), stub.GetCallInterfaceDescriptor(), 2, 528 isolate(), graph()->zone(), stub.GetCallInterfaceDescriptor(), 2,
529 CallDescriptor::kNeedsFrameState); 529 CallDescriptor::kNeedsFrameState);
530 node->ReplaceInput(0, jsgraph()->HeapConstant(stub.GetCode())); 530 node->ReplaceInput(0, jsgraph()->HeapConstant(stub.GetCode()));
531 node->InsertInput(graph()->zone(), 2, jsgraph()->HeapConstant(site)); 531 node->InsertInput(graph()->zone(), 2, jsgraph()->HeapConstant(site));
532 node->InsertInput(graph()->zone(), 3, jsgraph()->Int32Constant(1)); 532 node->InsertInput(graph()->zone(), 3, jsgraph()->Constant(1));
533 node->InsertInput(graph()->zone(), 4, jsgraph()->UndefinedConstant()); 533 node->InsertInput(graph()->zone(), 4, jsgraph()->UndefinedConstant());
534 NodeProperties::ChangeOp(node, common()->Call(desc)); 534 NodeProperties::ChangeOp(node, common()->Call(desc));
535 return Changed(node); 535 return Changed(node);
536 } 536 }
537 537
538 Node* effect = NodeProperties::GetEffectInput(node); 538 Node* effect = NodeProperties::GetEffectInput(node);
539 Node* control = NodeProperties::GetControlInput(node); 539 Node* control = NodeProperties::GetControlInput(node);
540 Node* length = NodeProperties::GetValueInput(node, 2); 540 Node* length = NodeProperties::GetValueInput(node, 2);
541 Node* equal = graph()->NewNode(simplified()->ReferenceEqual(), length, 541 Node* equal = graph()->NewNode(simplified()->ReferenceEqual(), length,
542 jsgraph()->ZeroConstant()); 542 jsgraph()->ZeroConstant());
(...skipping 10 matching lines...) Expand all
553 { 553 {
554 ArraySingleArgumentConstructorStub stub(isolate(), elements_kind, 554 ArraySingleArgumentConstructorStub stub(isolate(), elements_kind,
555 override_mode); 555 override_mode);
556 CallDescriptor* desc = Linkage::GetStubCallDescriptor( 556 CallDescriptor* desc = Linkage::GetStubCallDescriptor(
557 isolate(), graph()->zone(), stub.GetCallInterfaceDescriptor(), 2, 557 isolate(), graph()->zone(), stub.GetCallInterfaceDescriptor(), 2,
558 CallDescriptor::kNeedsFrameState); 558 CallDescriptor::kNeedsFrameState);
559 559
560 Node* inputs[] = {jsgraph()->HeapConstant(stub.GetCode()), 560 Node* inputs[] = {jsgraph()->HeapConstant(stub.GetCode()),
561 node->InputAt(1), 561 node->InputAt(1),
562 jsgraph()->HeapConstant(site), 562 jsgraph()->HeapConstant(site),
563 jsgraph()->Int32Constant(1), 563 jsgraph()->Constant(1),
564 jsgraph()->UndefinedConstant(), 564 jsgraph()->UndefinedConstant(),
565 length, 565 length,
566 context, 566 context,
567 frame_state, 567 frame_state,
568 effect, 568 effect,
569 if_equal}; 569 if_equal};
570 570
571 call_holey = 571 call_holey =
572 graph()->NewNode(common()->Call(desc), arraysize(inputs), inputs); 572 graph()->NewNode(common()->Call(desc), arraysize(inputs), inputs);
573 if_success_holey = graph()->NewNode(common()->IfSuccess(), call_holey); 573 if_success_holey = graph()->NewNode(common()->IfSuccess(), call_holey);
574 } 574 }
575 Node* if_not_equal = graph()->NewNode(common()->IfFalse(), branch); 575 Node* if_not_equal = graph()->NewNode(common()->IfFalse(), branch);
576 { 576 {
577 // Require elements kind to "go holey." 577 // Require elements kind to "go holey."
578 ArraySingleArgumentConstructorStub stub( 578 ArraySingleArgumentConstructorStub stub(
579 isolate(), GetHoleyElementsKind(elements_kind), override_mode); 579 isolate(), GetHoleyElementsKind(elements_kind), override_mode);
580 CallDescriptor* desc = Linkage::GetStubCallDescriptor( 580 CallDescriptor* desc = Linkage::GetStubCallDescriptor(
581 isolate(), graph()->zone(), stub.GetCallInterfaceDescriptor(), 2, 581 isolate(), graph()->zone(), stub.GetCallInterfaceDescriptor(), 2,
582 CallDescriptor::kNeedsFrameState); 582 CallDescriptor::kNeedsFrameState);
583 583
584 Node* inputs[] = {jsgraph()->HeapConstant(stub.GetCode()), 584 Node* inputs[] = {jsgraph()->HeapConstant(stub.GetCode()),
585 node->InputAt(1), 585 node->InputAt(1),
586 jsgraph()->HeapConstant(site), 586 jsgraph()->HeapConstant(site),
587 jsgraph()->Int32Constant(1), 587 jsgraph()->Constant(1),
588 jsgraph()->UndefinedConstant(), 588 jsgraph()->UndefinedConstant(),
589 length, 589 length,
590 context, 590 context,
591 frame_state, 591 frame_state,
592 effect, 592 effect,
593 if_not_equal}; 593 if_not_equal};
594 594
595 call_packed = 595 call_packed =
596 graph()->NewNode(common()->Call(desc), arraysize(inputs), inputs); 596 graph()->NewNode(common()->Call(desc), arraysize(inputs), inputs);
597 if_success_packed = graph()->NewNode(common()->IfSuccess(), call_packed); 597 if_success_packed = graph()->NewNode(common()->IfSuccess(), call_packed);
(...skipping 10 matching lines...) Expand all
608 return Changed(node); 608 return Changed(node);
609 } 609 }
610 610
611 DCHECK(arity > 1); 611 DCHECK(arity > 1);
612 ArrayNArgumentsConstructorStub stub(isolate()); 612 ArrayNArgumentsConstructorStub stub(isolate());
613 CallDescriptor* desc = Linkage::GetStubCallDescriptor( 613 CallDescriptor* desc = Linkage::GetStubCallDescriptor(
614 isolate(), graph()->zone(), stub.GetCallInterfaceDescriptor(), arity + 1, 614 isolate(), graph()->zone(), stub.GetCallInterfaceDescriptor(), arity + 1,
615 CallDescriptor::kNeedsFrameState); 615 CallDescriptor::kNeedsFrameState);
616 node->ReplaceInput(0, jsgraph()->HeapConstant(stub.GetCode())); 616 node->ReplaceInput(0, jsgraph()->HeapConstant(stub.GetCode()));
617 node->InsertInput(graph()->zone(), 2, jsgraph()->HeapConstant(site)); 617 node->InsertInput(graph()->zone(), 2, jsgraph()->HeapConstant(site));
618 node->InsertInput(graph()->zone(), 3, jsgraph()->Int32Constant(arity)); 618 node->InsertInput(graph()->zone(), 3, jsgraph()->Constant(arity));
619 node->InsertInput(graph()->zone(), 4, jsgraph()->UndefinedConstant()); 619 node->InsertInput(graph()->zone(), 4, jsgraph()->UndefinedConstant());
620 NodeProperties::ChangeOp(node, common()->Call(desc)); 620 NodeProperties::ChangeOp(node, common()->Call(desc));
621 return Changed(node); 621 return Changed(node);
622 } 622 }
623 623
624 Reduction JSCreateLowering::ReduceJSCreateArray(Node* node) { 624 Reduction JSCreateLowering::ReduceJSCreateArray(Node* node) {
625 DCHECK_EQ(IrOpcode::kJSCreateArray, node->opcode()); 625 DCHECK_EQ(IrOpcode::kJSCreateArray, node->opcode());
626 CreateArrayParameters const& p = CreateArrayParametersOf(node->op()); 626 CreateArrayParameters const& p = CreateArrayParametersOf(node->op());
627 Node* target = NodeProperties::GetValueInput(node, 0); 627 Node* target = NodeProperties::GetValueInput(node, 0);
628 Node* new_target = NodeProperties::GetValueInput(node, 1); 628 Node* new_target = NodeProperties::GetValueInput(node, 1);
(...skipping 623 matching lines...) Expand 10 before | Expand all | Expand 10 after
1252 return jsgraph()->simplified(); 1252 return jsgraph()->simplified();
1253 } 1253 }
1254 1254
1255 MachineOperatorBuilder* JSCreateLowering::machine() const { 1255 MachineOperatorBuilder* JSCreateLowering::machine() const {
1256 return jsgraph()->machine(); 1256 return jsgraph()->machine();
1257 } 1257 }
1258 1258
1259 } // namespace compiler 1259 } // namespace compiler
1260 } // namespace internal 1260 } // namespace internal
1261 } // namespace v8 1261 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/js-builtin-reducer.cc ('k') | src/compiler/js-inlining.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698