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

Side by Side Diff: src/compiler/simplified-operator.cc

Issue 2692753004: [turbofan] escape analysis supports arguments object and rest elements (Closed)
Patch Set: handle the case where Deoptimizer::function_ is a Smi Created 3 years, 9 months 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/simplified-operator.h ('k') | src/compiler/typer.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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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/simplified-operator.h" 5 #include "src/compiler/simplified-operator.h"
6 6
7 #include "src/base/lazy-instance.h" 7 #include "src/base/lazy-instance.h"
8 #include "src/compiler/opcodes.h" 8 #include "src/compiler/opcodes.h"
9 #include "src/compiler/operator.h" 9 #include "src/compiler/operator.h"
10 #include "src/compiler/types.h" 10 #include "src/compiler/types.h"
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after
381 op->opcode() == IrOpcode::kSpeculativeNumberShiftRightLogical || 381 op->opcode() == IrOpcode::kSpeculativeNumberShiftRightLogical ||
382 op->opcode() == IrOpcode::kSpeculativeNumberBitwiseAnd || 382 op->opcode() == IrOpcode::kSpeculativeNumberBitwiseAnd ||
383 op->opcode() == IrOpcode::kSpeculativeNumberBitwiseOr || 383 op->opcode() == IrOpcode::kSpeculativeNumberBitwiseOr ||
384 op->opcode() == IrOpcode::kSpeculativeNumberBitwiseXor || 384 op->opcode() == IrOpcode::kSpeculativeNumberBitwiseXor ||
385 op->opcode() == IrOpcode::kSpeculativeNumberEqual || 385 op->opcode() == IrOpcode::kSpeculativeNumberEqual ||
386 op->opcode() == IrOpcode::kSpeculativeNumberLessThan || 386 op->opcode() == IrOpcode::kSpeculativeNumberLessThan ||
387 op->opcode() == IrOpcode::kSpeculativeNumberLessThanOrEqual); 387 op->opcode() == IrOpcode::kSpeculativeNumberLessThanOrEqual);
388 return OpParameter<NumberOperationHint>(op); 388 return OpParameter<NumberOperationHint>(op);
389 } 389 }
390 390
391 int ParameterCountOf(const Operator* op) {
392 DCHECK(op->opcode() == IrOpcode::kNewUnmappedArgumentsElements ||
393 op->opcode() == IrOpcode::kNewRestParameterElements);
394 return OpParameter<int>(op);
395 }
396
397 PretenureFlag PretenureFlagOf(const Operator* op) { 391 PretenureFlag PretenureFlagOf(const Operator* op) {
398 DCHECK_EQ(IrOpcode::kAllocate, op->opcode()); 392 DCHECK_EQ(IrOpcode::kAllocate, op->opcode());
399 return OpParameter<PretenureFlag>(op); 393 return OpParameter<PretenureFlag>(op);
400 } 394 }
401 395
402 UnicodeEncoding UnicodeEncodingOf(const Operator* op) { 396 UnicodeEncoding UnicodeEncodingOf(const Operator* op) {
403 DCHECK(op->opcode() == IrOpcode::kStringFromCodePoint); 397 DCHECK(op->opcode() == IrOpcode::kStringFromCodePoint);
404 return OpParameter<UnicodeEncoding>(op); 398 return OpParameter<UnicodeEncoding>(op);
405 } 399 }
406 400
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
557 StringFromCodePointOperator<UnicodeEncoding::UTF32> 551 StringFromCodePointOperator<UnicodeEncoding::UTF32>
558 kStringFromCodePointOperatorUTF32; 552 kStringFromCodePointOperatorUTF32;
559 553
560 struct ArrayBufferWasNeuteredOperator final : public Operator { 554 struct ArrayBufferWasNeuteredOperator final : public Operator {
561 ArrayBufferWasNeuteredOperator() 555 ArrayBufferWasNeuteredOperator()
562 : Operator(IrOpcode::kArrayBufferWasNeutered, Operator::kEliminatable, 556 : Operator(IrOpcode::kArrayBufferWasNeutered, Operator::kEliminatable,
563 "ArrayBufferWasNeutered", 1, 1, 1, 1, 1, 0) {} 557 "ArrayBufferWasNeutered", 1, 1, 1, 1, 1, 0) {}
564 }; 558 };
565 ArrayBufferWasNeuteredOperator kArrayBufferWasNeutered; 559 ArrayBufferWasNeuteredOperator kArrayBufferWasNeutered;
566 560
561 struct ArgumentsFrameOperator final : public Operator {
562 ArgumentsFrameOperator()
563 : Operator(IrOpcode::kArgumentsFrame, Operator::kPure, "ArgumentsFrame",
564 0, 0, 0, 1, 0, 0) {}
565 };
566 ArgumentsFrameOperator kArgumentsFrame;
567
568 struct NewUnmappedArgumentsElementsOperator final : public Operator {
569 NewUnmappedArgumentsElementsOperator()
570 : Operator(IrOpcode::kNewUnmappedArgumentsElements,
571 Operator::kEliminatable, "NewUnmappedArgumentsElements", 2,
572 1, 0, 1, 1, 0) {}
573 };
574 NewUnmappedArgumentsElementsOperator kNewUnmappedArgumentsElements;
575
567 template <CheckForMinusZeroMode kMode> 576 template <CheckForMinusZeroMode kMode>
568 struct CheckedInt32MulOperator final 577 struct CheckedInt32MulOperator final
569 : public Operator1<CheckForMinusZeroMode> { 578 : public Operator1<CheckForMinusZeroMode> {
570 CheckedInt32MulOperator() 579 CheckedInt32MulOperator()
571 : Operator1<CheckForMinusZeroMode>( 580 : Operator1<CheckForMinusZeroMode>(
572 IrOpcode::kCheckedInt32Mul, 581 IrOpcode::kCheckedInt32Mul,
573 Operator::kFoldable | Operator::kNoThrow, "CheckedInt32Mul", 2, 1, 582 Operator::kFoldable | Operator::kNoThrow, "CheckedInt32Mul", 2, 1,
574 1, 1, 1, 0, kMode) {} 583 1, 1, 1, 0, kMode) {}
575 }; 584 };
576 CheckedInt32MulOperator<CheckForMinusZeroMode::kCheckForMinusZero> 585 CheckedInt32MulOperator<CheckForMinusZeroMode::kCheckForMinusZero>
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
701 710
702 711
703 SimplifiedOperatorBuilder::SimplifiedOperatorBuilder(Zone* zone) 712 SimplifiedOperatorBuilder::SimplifiedOperatorBuilder(Zone* zone)
704 : cache_(kCache.Get()), zone_(zone) {} 713 : cache_(kCache.Get()), zone_(zone) {}
705 714
706 #define GET_FROM_CACHE(Name, ...) \ 715 #define GET_FROM_CACHE(Name, ...) \
707 const Operator* SimplifiedOperatorBuilder::Name() { return &cache_.k##Name; } 716 const Operator* SimplifiedOperatorBuilder::Name() { return &cache_.k##Name; }
708 PURE_OP_LIST(GET_FROM_CACHE) 717 PURE_OP_LIST(GET_FROM_CACHE)
709 CHECKED_OP_LIST(GET_FROM_CACHE) 718 CHECKED_OP_LIST(GET_FROM_CACHE)
710 GET_FROM_CACHE(ArrayBufferWasNeutered) 719 GET_FROM_CACHE(ArrayBufferWasNeutered)
720 GET_FROM_CACHE(ArgumentsFrame)
721 GET_FROM_CACHE(NewUnmappedArgumentsElements)
711 #undef GET_FROM_CACHE 722 #undef GET_FROM_CACHE
712 723
713 const Operator* SimplifiedOperatorBuilder::CheckedInt32Mul( 724 const Operator* SimplifiedOperatorBuilder::CheckedInt32Mul(
714 CheckForMinusZeroMode mode) { 725 CheckForMinusZeroMode mode) {
715 switch (mode) { 726 switch (mode) {
716 case CheckForMinusZeroMode::kCheckForMinusZero: 727 case CheckForMinusZeroMode::kCheckForMinusZero:
717 return &cache_.kCheckedInt32MulCheckForMinusZeroOperator; 728 return &cache_.kCheckedInt32MulCheckForMinusZeroOperator;
718 case CheckForMinusZeroMode::kDontCheckForMinusZero: 729 case CheckForMinusZeroMode::kDontCheckForMinusZero:
719 return &cache_.kCheckedInt32MulDontCheckForMinusZeroOperator; 730 return &cache_.kCheckedInt32MulDontCheckForMinusZeroOperator;
720 } 731 }
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
798 const Operator* SimplifiedOperatorBuilder::TransitionElementsKind( 809 const Operator* SimplifiedOperatorBuilder::TransitionElementsKind(
799 ElementsTransition transition) { 810 ElementsTransition transition) {
800 return new (zone()) Operator1<ElementsTransition>( // -- 811 return new (zone()) Operator1<ElementsTransition>( // --
801 IrOpcode::kTransitionElementsKind, // opcode 812 IrOpcode::kTransitionElementsKind, // opcode
802 Operator::kNoDeopt | Operator::kNoThrow, // flags 813 Operator::kNoDeopt | Operator::kNoThrow, // flags
803 "TransitionElementsKind", // name 814 "TransitionElementsKind", // name
804 1, 1, 1, 0, 1, 0, // counts 815 1, 1, 1, 0, 1, 0, // counts
805 transition); // parameter 816 transition); // parameter
806 } 817 }
807 818
808 const Operator* SimplifiedOperatorBuilder::NewUnmappedArgumentsElements( 819 namespace {
809 int parameter_count) { 820
810 return new (zone()) Operator1<int>( // -- 821 struct ArgumentsLengthParameters {
811 IrOpcode::kNewUnmappedArgumentsElements, // opcode 822 int formal_parameter_count;
812 Operator::kEliminatable, // flags 823 bool is_rest_length;
813 "NewUnmappedArgumentsElements", // name 824 };
814 0, 1, 0, 1, 1, 0, // counts 825
815 parameter_count); // parameter 826 bool operator==(ArgumentsLengthParameters first,
827 ArgumentsLengthParameters second) {
828 return first.formal_parameter_count == second.formal_parameter_count &&
829 first.is_rest_length == second.is_rest_length;
816 } 830 }
817 831
818 const Operator* SimplifiedOperatorBuilder::NewRestParameterElements( 832 size_t hash_value(ArgumentsLengthParameters param) {
819 int parameter_count) { 833 return base::hash_combine(param.formal_parameter_count, param.is_rest_length);
820 return new (zone()) Operator1<int>( // -- 834 }
821 IrOpcode::kNewRestParameterElements, // opcode 835
822 Operator::kEliminatable, // flags 836 std::ostream& operator<<(std::ostream& os, ArgumentsLengthParameters param) {
823 "NewRestParameterElements", // name 837 return os << param.formal_parameter_count << ", "
824 0, 1, 0, 1, 1, 0, // counts 838 << (param.is_rest_length ? "rest length" : "not rest length");
825 parameter_count); // parameter 839 }
840
841 } // namespace
842
843 const Operator* SimplifiedOperatorBuilder::ArgumentsLength(
844 int formal_parameter_count, bool is_rest_length) {
845 return new (zone()) Operator1<ArgumentsLengthParameters>( // --
846 IrOpcode::kArgumentsLength, // opcode
847 Operator::kPure, // flags
848 "ArgumentsLength", // name
849 1, 0, 0, 1, 0, 0, // counts
850 ArgumentsLengthParameters{formal_parameter_count,
851 is_rest_length}); // parameter
852 }
853
854 int FormalParameterCountOf(const Operator* op) {
855 DCHECK(op->opcode() == IrOpcode::kArgumentsLength);
856 return OpParameter<ArgumentsLengthParameters>(op).formal_parameter_count;
857 }
858
859 bool IsRestLengthOf(const Operator* op) {
860 DCHECK(op->opcode() == IrOpcode::kArgumentsLength);
861 return OpParameter<ArgumentsLengthParameters>(op).is_rest_length;
826 } 862 }
827 863
828 const Operator* SimplifiedOperatorBuilder::Allocate(PretenureFlag pretenure) { 864 const Operator* SimplifiedOperatorBuilder::Allocate(PretenureFlag pretenure) {
829 switch (pretenure) { 865 switch (pretenure) {
830 case NOT_TENURED: 866 case NOT_TENURED:
831 return &cache_.kAllocateNotTenuredOperator; 867 return &cache_.kAllocateNotTenuredOperator;
832 case TENURED: 868 case TENURED:
833 return &cache_.kAllocateTenuredOperator; 869 return &cache_.kAllocateTenuredOperator;
834 } 870 }
835 UNREACHABLE(); 871 UNREACHABLE();
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
908 Operator::kNoDeopt | Operator::kNoThrow | properties, \ 944 Operator::kNoDeopt | Operator::kNoThrow | properties, \
909 #Name, value_input_count, 1, control_input_count, \ 945 #Name, value_input_count, 1, control_input_count, \
910 output_count, 1, 0, access); \ 946 output_count, 1, 0, access); \
911 } 947 }
912 ACCESS_OP_LIST(ACCESS) 948 ACCESS_OP_LIST(ACCESS)
913 #undef ACCESS 949 #undef ACCESS
914 950
915 } // namespace compiler 951 } // namespace compiler
916 } // namespace internal 952 } // namespace internal
917 } // namespace v8 953 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/simplified-operator.h ('k') | src/compiler/typer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698