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

Side by Side Diff: src/compiler/machine-operator.h

Issue 763963002: [turbofan] Add checked load/store operators. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Reapply fix. Created 6 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/js-typed-lowering.cc ('k') | src/compiler/machine-operator.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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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_MACHINE_OPERATOR_H_ 5 #ifndef V8_COMPILER_MACHINE_OPERATOR_H_
6 #define V8_COMPILER_MACHINE_OPERATOR_H_ 6 #define V8_COMPILER_MACHINE_OPERATOR_H_
7 7
8 #include "src/base/flags.h" 8 #include "src/base/flags.h"
9 #include "src/compiler/machine-type.h" 9 #include "src/compiler/machine-type.h"
10 10
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 bool operator==(StoreRepresentation, StoreRepresentation); 46 bool operator==(StoreRepresentation, StoreRepresentation);
47 bool operator!=(StoreRepresentation, StoreRepresentation); 47 bool operator!=(StoreRepresentation, StoreRepresentation);
48 48
49 size_t hash_value(StoreRepresentation); 49 size_t hash_value(StoreRepresentation);
50 50
51 std::ostream& operator<<(std::ostream&, StoreRepresentation); 51 std::ostream& operator<<(std::ostream&, StoreRepresentation);
52 52
53 StoreRepresentation const& StoreRepresentationOf(Operator const*); 53 StoreRepresentation const& StoreRepresentationOf(Operator const*);
54 54
55 55
56 // A CheckedLoad needs a MachineType.
57 typedef MachineType CheckedLoadRepresentation;
58
59 CheckedLoadRepresentation CheckedLoadRepresentationOf(Operator const*);
60
61
62 // A CheckedStore needs a MachineType.
63 typedef MachineType CheckedStoreRepresentation;
64
65 CheckedStoreRepresentation CheckedStoreRepresentationOf(Operator const*);
66
67
56 // Interface for building machine-level operators. These operators are 68 // Interface for building machine-level operators. These operators are
57 // machine-level but machine-independent and thus define a language suitable 69 // machine-level but machine-independent and thus define a language suitable
58 // for generating code to run on architectures such as ia32, x64, arm, etc. 70 // for generating code to run on architectures such as ia32, x64, arm, etc.
59 class MachineOperatorBuilder FINAL : public ZoneObject { 71 class MachineOperatorBuilder FINAL : public ZoneObject {
60 public: 72 public:
61 // Flags that specify which operations are available. This is useful 73 // Flags that specify which operations are available. This is useful
62 // for operations that are unsupported by some back-ends. 74 // for operations that are unsupported by some back-ends.
63 enum Flag { 75 enum Flag {
64 kNoFlags = 0u, 76 kNoFlags = 0u,
65 kFloat64Floor = 1u << 0, 77 kFloat64Floor = 1u << 0,
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 179
168 // load [base + index] 180 // load [base + index]
169 const Operator* Load(LoadRepresentation rep); 181 const Operator* Load(LoadRepresentation rep);
170 182
171 // store [base + index], value 183 // store [base + index], value
172 const Operator* Store(StoreRepresentation rep); 184 const Operator* Store(StoreRepresentation rep);
173 185
174 // Access to the machine stack. 186 // Access to the machine stack.
175 const Operator* LoadStackPointer(); 187 const Operator* LoadStackPointer();
176 188
189 // checked-load heap, index, length
190 const Operator* CheckedLoad(CheckedLoadRepresentation);
191 // checked-store heap, index, length, value
192 const Operator* CheckedStore(CheckedStoreRepresentation);
193
177 // Target machine word-size assumed by this builder. 194 // Target machine word-size assumed by this builder.
178 bool Is32() const { return word() == kRepWord32; } 195 bool Is32() const { return word() == kRepWord32; }
179 bool Is64() const { return word() == kRepWord64; } 196 bool Is64() const { return word() == kRepWord64; }
180 MachineType word() const { return word_; } 197 MachineType word() const { return word_; }
181 198
182 // Pseudo operators that translate to 32/64-bit operators depending on the 199 // Pseudo operators that translate to 32/64-bit operators depending on the
183 // word-size of the target machine assumed by this builder. 200 // word-size of the target machine assumed by this builder.
184 #define PSEUDO_OP_LIST(V) \ 201 #define PSEUDO_OP_LIST(V) \
185 V(Word, And) \ 202 V(Word, And) \
186 V(Word, Or) \ 203 V(Word, Or) \
(...skipping 29 matching lines...) Expand all
216 DISALLOW_COPY_AND_ASSIGN(MachineOperatorBuilder); 233 DISALLOW_COPY_AND_ASSIGN(MachineOperatorBuilder);
217 }; 234 };
218 235
219 236
220 DEFINE_OPERATORS_FOR_FLAGS(MachineOperatorBuilder::Flags) 237 DEFINE_OPERATORS_FOR_FLAGS(MachineOperatorBuilder::Flags)
221 } // namespace compiler 238 } // namespace compiler
222 } // namespace internal 239 } // namespace internal
223 } // namespace v8 240 } // namespace v8
224 241
225 #endif // V8_COMPILER_MACHINE_OPERATOR_H_ 242 #endif // V8_COMPILER_MACHINE_OPERATOR_H_
OLDNEW
« no previous file with comments | « src/compiler/js-typed-lowering.cc ('k') | src/compiler/machine-operator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698