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

Side by Side Diff: src/compiler/representation-change.h

Issue 1513543003: [turbofan] Make MachineType a pair of enums. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Moar rebase Created 5 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 | « src/compiler/register-allocator-verifier.cc ('k') | src/compiler/representation-change.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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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 #ifndef V8_COMPILER_REPRESENTATION_CHANGE_H_ 5 #ifndef V8_COMPILER_REPRESENTATION_CHANGE_H_
6 #define V8_COMPILER_REPRESENTATION_CHANGE_H_ 6 #define V8_COMPILER_REPRESENTATION_CHANGE_H_
7 7
8 #include "src/compiler/js-graph.h" 8 #include "src/compiler/js-graph.h"
9 #include "src/compiler/simplified-operator.h" 9 #include "src/compiler/simplified-operator.h"
10 10
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 RepresentationChanger(JSGraph* jsgraph, Isolate* isolate) 79 RepresentationChanger(JSGraph* jsgraph, Isolate* isolate)
80 : jsgraph_(jsgraph), 80 : jsgraph_(jsgraph),
81 isolate_(isolate), 81 isolate_(isolate),
82 testing_type_errors_(false), 82 testing_type_errors_(false),
83 type_error_(false) {} 83 type_error_(false) {}
84 84
85 // Changes representation from {output_type} to {use_rep}. The {truncation} 85 // Changes representation from {output_type} to {use_rep}. The {truncation}
86 // parameter is only used for sanity checking - if the changer cannot figure 86 // parameter is only used for sanity checking - if the changer cannot figure
87 // out signedness for the word32->float64 conversion, then we check that the 87 // out signedness for the word32->float64 conversion, then we check that the
88 // uses truncate to word32 (so they do not care about signedness). 88 // uses truncate to word32 (so they do not care about signedness).
89 Node* GetRepresentationFor(Node* node, MachineTypeUnion output_type, 89 Node* GetRepresentationFor(Node* node, MachineType output_type,
90 MachineTypeUnion use_rep, 90 MachineRepresentation use_rep,
91 Truncation truncation = Truncation::None()); 91 Truncation truncation = Truncation::None());
92 const Operator* Int32OperatorFor(IrOpcode::Value opcode); 92 const Operator* Int32OperatorFor(IrOpcode::Value opcode);
93 const Operator* Uint32OperatorFor(IrOpcode::Value opcode); 93 const Operator* Uint32OperatorFor(IrOpcode::Value opcode);
94 const Operator* Float64OperatorFor(IrOpcode::Value opcode); 94 const Operator* Float64OperatorFor(IrOpcode::Value opcode);
95 MachineType TypeFromUpperBound(Type* type); 95 MachineSemantic TypeFromUpperBound(Type* type);
96 96
97 MachineType TypeForBasePointer(const FieldAccess& access) { 97 MachineType TypeForBasePointer(const FieldAccess& access) {
98 return access.tag() != 0 ? kMachAnyTagged : kMachPtr; 98 return access.tag() != 0 ? MachineType::AnyTagged()
99 : MachineType::Pointer();
99 } 100 }
100 101
101 MachineType TypeForBasePointer(const ElementAccess& access) { 102 MachineType TypeForBasePointer(const ElementAccess& access) {
102 return access.tag() != 0 ? kMachAnyTagged : kMachPtr; 103 return access.tag() != 0 ? MachineType::AnyTagged()
104 : MachineType::Pointer();
103 } 105 }
104 106
105 private: 107 private:
106 JSGraph* jsgraph_; 108 JSGraph* jsgraph_;
107 Isolate* isolate_; 109 Isolate* isolate_;
108 110
109 friend class RepresentationChangerTester; // accesses the below fields. 111 friend class RepresentationChangerTester; // accesses the below fields.
110 112
111 bool testing_type_errors_; // If {true}, don't abort on a type error. 113 bool testing_type_errors_; // If {true}, don't abort on a type error.
112 bool type_error_; // Set when a type error is detected. 114 bool type_error_; // Set when a type error is detected.
113 115
114 Node* GetTaggedRepresentationFor(Node* node, MachineTypeUnion output_type); 116 Node* GetTaggedRepresentationFor(Node* node, MachineType output_type);
115 Node* GetFloat32RepresentationFor(Node* node, MachineTypeUnion output_type, 117 Node* GetFloat32RepresentationFor(Node* node, MachineType output_type,
116 Truncation truncation); 118 Truncation truncation);
117 Node* GetFloat64RepresentationFor(Node* node, MachineTypeUnion output_type, 119 Node* GetFloat64RepresentationFor(Node* node, MachineType output_type,
118 Truncation truncation); 120 Truncation truncation);
119 Node* GetWord32RepresentationFor(Node* node, MachineTypeUnion output_type); 121 Node* GetWord32RepresentationFor(Node* node, MachineType output_type);
120 Node* GetBitRepresentationFor(Node* node, MachineTypeUnion output_type); 122 Node* GetBitRepresentationFor(Node* node, MachineType output_type);
121 Node* GetWord64RepresentationFor(Node* node, MachineTypeUnion output_type); 123 Node* GetWord64RepresentationFor(Node* node, MachineType output_type);
122 Node* TypeError(Node* node, MachineTypeUnion output_type, 124 Node* TypeError(Node* node, MachineType output_type,
123 MachineTypeUnion use); 125 MachineRepresentation use);
124 Node* MakeTruncatedInt32Constant(double value); 126 Node* MakeTruncatedInt32Constant(double value);
125 Node* InsertChangeFloat32ToFloat64(Node* node); 127 Node* InsertChangeFloat32ToFloat64(Node* node);
126 Node* InsertChangeTaggedToFloat64(Node* node); 128 Node* InsertChangeTaggedToFloat64(Node* node);
127 129
128 JSGraph* jsgraph() const { return jsgraph_; } 130 JSGraph* jsgraph() const { return jsgraph_; }
129 Isolate* isolate() const { return isolate_; } 131 Isolate* isolate() const { return isolate_; }
130 Factory* factory() const { return isolate()->factory(); } 132 Factory* factory() const { return isolate()->factory(); }
131 SimplifiedOperatorBuilder* simplified() { return jsgraph()->simplified(); } 133 SimplifiedOperatorBuilder* simplified() { return jsgraph()->simplified(); }
132 MachineOperatorBuilder* machine() { return jsgraph()->machine(); } 134 MachineOperatorBuilder* machine() { return jsgraph()->machine(); }
133 }; 135 };
134 136
135 } // namespace compiler 137 } // namespace compiler
136 } // namespace internal 138 } // namespace internal
137 } // namespace v8 139 } // namespace v8
138 140
139 #endif // V8_COMPILER_REPRESENTATION_CHANGE_H_ 141 #endif // V8_COMPILER_REPRESENTATION_CHANGE_H_
OLDNEW
« no previous file with comments | « src/compiler/register-allocator-verifier.cc ('k') | src/compiler/representation-change.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698