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

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

Issue 2797993006: [turbofan] Add type to the allocation operator. (Closed)
Patch Set: Remove caching Created 3 years, 8 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 size_t hash_value(AllocateParameters info) {
392 return base::hash_combine(info.type(), info.pretenure());
393 }
394
395 V8_EXPORT_PRIVATE std::ostream& operator<<(std::ostream& os,
396 AllocateParameters info) {
397 info.type()->PrintTo(os);
398 return os << ", " << info.pretenure();
399 }
400
401 bool operator==(AllocateParameters const& lhs, AllocateParameters const& rhs) {
402 return lhs.pretenure() == rhs.pretenure() && lhs.type() == rhs.type();
403 }
404
405 bool operator!=(AllocateParameters const& lhs, AllocateParameters const& rhs) {
406 return !(lhs == rhs);
407 }
408
391 PretenureFlag PretenureFlagOf(const Operator* op) { 409 PretenureFlag PretenureFlagOf(const Operator* op) {
392 DCHECK_EQ(IrOpcode::kAllocate, op->opcode()); 410 DCHECK_EQ(IrOpcode::kAllocate, op->opcode());
393 return OpParameter<PretenureFlag>(op); 411 return OpParameter<AllocateParameters>(op).pretenure();
412 }
413
414 Type* AllocateTypeOf(const Operator* op) {
415 DCHECK_EQ(IrOpcode::kAllocate, op->opcode());
416 return OpParameter<AllocateParameters>(op).type();
394 } 417 }
395 418
396 UnicodeEncoding UnicodeEncodingOf(const Operator* op) { 419 UnicodeEncoding UnicodeEncodingOf(const Operator* op) {
397 DCHECK(op->opcode() == IrOpcode::kStringFromCodePoint); 420 DCHECK(op->opcode() == IrOpcode::kStringFromCodePoint);
398 return OpParameter<UnicodeEncoding>(op); 421 return OpParameter<UnicodeEncoding>(op);
399 } 422 }
400 423
401 #define PURE_OP_LIST(V) \ 424 #define PURE_OP_LIST(V) \
402 V(BooleanNot, Operator::kNoProperties, 1, 0) \ 425 V(BooleanNot, Operator::kNoProperties, 1, 0) \
403 V(NumberEqual, Operator::kCommutative, 2, 0) \ 426 V(NumberEqual, Operator::kCommutative, 2, 0) \
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
639 : Operator1<CheckFloat64HoleMode>( 662 : Operator1<CheckFloat64HoleMode>(
640 IrOpcode::kCheckFloat64Hole, 663 IrOpcode::kCheckFloat64Hole,
641 Operator::kFoldable | Operator::kNoThrow, "CheckFloat64Hole", 1, 664 Operator::kFoldable | Operator::kNoThrow, "CheckFloat64Hole", 1,
642 1, 1, 1, 1, 0, kMode) {} 665 1, 1, 1, 1, 0, kMode) {}
643 }; 666 };
644 CheckFloat64HoleNaNOperator<CheckFloat64HoleMode::kAllowReturnHole> 667 CheckFloat64HoleNaNOperator<CheckFloat64HoleMode::kAllowReturnHole>
645 kCheckFloat64HoleAllowReturnHoleOperator; 668 kCheckFloat64HoleAllowReturnHoleOperator;
646 CheckFloat64HoleNaNOperator<CheckFloat64HoleMode::kNeverReturnHole> 669 CheckFloat64HoleNaNOperator<CheckFloat64HoleMode::kNeverReturnHole>
647 kCheckFloat64HoleNeverReturnHoleOperator; 670 kCheckFloat64HoleNeverReturnHoleOperator;
648 671
649 template <PretenureFlag kPretenure>
650 struct AllocateOperator final : public Operator1<PretenureFlag> {
651 AllocateOperator()
652 : Operator1<PretenureFlag>(
653 IrOpcode::kAllocate,
654 Operator::kNoDeopt | Operator::kNoThrow | Operator::kNoWrite,
655 "Allocate", 1, 1, 1, 1, 1, 0, kPretenure) {}
656 };
657 AllocateOperator<NOT_TENURED> kAllocateNotTenuredOperator;
658 AllocateOperator<TENURED> kAllocateTenuredOperator;
659
660 struct EnsureWritableFastElementsOperator final : public Operator { 672 struct EnsureWritableFastElementsOperator final : public Operator {
661 EnsureWritableFastElementsOperator() 673 EnsureWritableFastElementsOperator()
662 : Operator( // -- 674 : Operator( // --
663 IrOpcode::kEnsureWritableFastElements, // opcode 675 IrOpcode::kEnsureWritableFastElements, // opcode
664 Operator::kNoDeopt | Operator::kNoThrow, // flags 676 Operator::kNoDeopt | Operator::kNoThrow, // flags
665 "EnsureWritableFastElements", // name 677 "EnsureWritableFastElements", // name
666 2, 1, 1, 1, 1, 0) {} // counts 678 2, 1, 1, 1, 1, 0) {} // counts
667 }; 679 };
668 EnsureWritableFastElementsOperator kEnsureWritableFastElements; 680 EnsureWritableFastElementsOperator kEnsureWritableFastElements;
669 681
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
857 int FormalParameterCountOf(const Operator* op) { 869 int FormalParameterCountOf(const Operator* op) {
858 DCHECK(op->opcode() == IrOpcode::kArgumentsLength); 870 DCHECK(op->opcode() == IrOpcode::kArgumentsLength);
859 return OpParameter<ArgumentsLengthParameters>(op).formal_parameter_count; 871 return OpParameter<ArgumentsLengthParameters>(op).formal_parameter_count;
860 } 872 }
861 873
862 bool IsRestLengthOf(const Operator* op) { 874 bool IsRestLengthOf(const Operator* op) {
863 DCHECK(op->opcode() == IrOpcode::kArgumentsLength); 875 DCHECK(op->opcode() == IrOpcode::kArgumentsLength);
864 return OpParameter<ArgumentsLengthParameters>(op).is_rest_length; 876 return OpParameter<ArgumentsLengthParameters>(op).is_rest_length;
865 } 877 }
866 878
867 const Operator* SimplifiedOperatorBuilder::Allocate(PretenureFlag pretenure) { 879 const Operator* SimplifiedOperatorBuilder::Allocate(Type* type,
868 switch (pretenure) { 880 PretenureFlag pretenure) {
869 case NOT_TENURED: 881 return new (zone()) Operator1<AllocateParameters>(
870 return &cache_.kAllocateNotTenuredOperator; 882 IrOpcode::kAllocate,
871 case TENURED: 883 Operator::kNoDeopt | Operator::kNoThrow | Operator::kNoWrite, "Allocate",
872 return &cache_.kAllocateTenuredOperator; 884 1, 1, 1, 1, 1, 0, AllocateParameters(type, pretenure));
873 }
874 UNREACHABLE();
875 return nullptr;
876 } 885 }
877 886
878 887
879 const Operator* SimplifiedOperatorBuilder::LoadBuffer(BufferAccess access) { 888 const Operator* SimplifiedOperatorBuilder::LoadBuffer(BufferAccess access) {
880 switch (access.external_array_type()) { 889 switch (access.external_array_type()) {
881 #define LOAD_BUFFER(Type, type, TYPE, ctype, size) \ 890 #define LOAD_BUFFER(Type, type, TYPE, ctype, size) \
882 case kExternal##Type##Array: \ 891 case kExternal##Type##Array: \
883 return &cache_.kLoadBuffer##Type; 892 return &cache_.kLoadBuffer##Type;
884 TYPED_ARRAYS(LOAD_BUFFER) 893 TYPED_ARRAYS(LOAD_BUFFER)
885 #undef LOAD_BUFFER 894 #undef LOAD_BUFFER
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
947 Operator::kNoDeopt | Operator::kNoThrow | properties, \ 956 Operator::kNoDeopt | Operator::kNoThrow | properties, \
948 #Name, value_input_count, 1, control_input_count, \ 957 #Name, value_input_count, 1, control_input_count, \
949 output_count, 1, 0, access); \ 958 output_count, 1, 0, access); \
950 } 959 }
951 ACCESS_OP_LIST(ACCESS) 960 ACCESS_OP_LIST(ACCESS)
952 #undef ACCESS 961 #undef ACCESS
953 962
954 } // namespace compiler 963 } // namespace compiler
955 } // namespace internal 964 } // namespace internal
956 } // namespace v8 965 } // 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