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

Side by Side Diff: src/compiler/code-stub-assembler.h

Issue 1735803003: [turbofan] Adds an Allocate macro to the CodeStubAssembler. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Update. Created 4 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/code-stubs-hydrogen.cc ('k') | src/compiler/code-stub-assembler.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 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 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_CODE_STUB_ASSEMBLER_H_ 5 #ifndef V8_COMPILER_CODE_STUB_ASSEMBLER_H_
6 #define V8_COMPILER_CODE_STUB_ASSEMBLER_H_ 6 #define V8_COMPILER_CODE_STUB_ASSEMBLER_H_
7 7
8 #include <map> 8 #include <map>
9 9
10 // Clients of this interface shouldn't depend on lots of compiler internals. 10 // Clients of this interface shouldn't depend on lots of compiler internals.
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 Node* value() const; 104 Node* value() const;
105 MachineRepresentation rep() const; 105 MachineRepresentation rep() const;
106 bool IsBound() const; 106 bool IsBound() const;
107 107
108 private: 108 private:
109 friend class CodeStubAssembler; 109 friend class CodeStubAssembler;
110 class Impl; 110 class Impl;
111 Impl* impl_; 111 Impl* impl_;
112 }; 112 };
113 113
114 enum AllocationFlag : uint8_t {
115 kNone = 0,
116 kDoubleAlignment = 1,
117 kPretenured = 1 << 1
118 };
119
120 typedef base::Flags<AllocationFlag> AllocationFlags;
121
114 // =========================================================================== 122 // ===========================================================================
115 // Base Assembler 123 // Base Assembler
116 // =========================================================================== 124 // ===========================================================================
117 125
118 // Constants. 126 // Constants.
119 Node* Int32Constant(int value); 127 Node* Int32Constant(int value);
120 Node* IntPtrConstant(intptr_t value); 128 Node* IntPtrConstant(intptr_t value);
121 Node* NumberConstant(double value); 129 Node* NumberConstant(double value);
122 Node* SmiConstant(Smi* value); 130 Node* SmiConstant(Smi* value);
123 Node* HeapConstant(Handle<HeapObject> object); 131 Node* HeapConstant(Handle<HeapObject> object);
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 // Load a field from an object on the heap. 242 // Load a field from an object on the heap.
235 Node* LoadObjectField(Node* object, int offset); 243 Node* LoadObjectField(Node* object, int offset);
236 // Load the HeapNumber value from a HeapNumber object. 244 // Load the HeapNumber value from a HeapNumber object.
237 Node* LoadHeapNumberValue(Node* object); 245 Node* LoadHeapNumberValue(Node* object);
238 246
239 // Load an array element from a FixedArray. 247 // Load an array element from a FixedArray.
240 Node* LoadFixedArrayElementSmiIndex(Node* object, Node* smi_index, 248 Node* LoadFixedArrayElementSmiIndex(Node* object, Node* smi_index,
241 int additional_offset = 0); 249 int additional_offset = 0);
242 Node* LoadFixedArrayElementConstantIndex(Node* object, int index); 250 Node* LoadFixedArrayElementConstantIndex(Node* object, int index);
243 251
252 // Allocate an object of the given size.
253 Node* Allocate(int size, AllocationFlags flags);
254
244 // Store an array element to a FixedArray. 255 // Store an array element to a FixedArray.
245 Node* StoreFixedArrayElementNoWriteBarrier(Node* object, Node* index, 256 Node* StoreFixedArrayElementNoWriteBarrier(Node* object, Node* index,
246 Node* value); 257 Node* value);
247 Node* LoadInstanceType(Node* object); 258 Node* LoadInstanceType(Node* object);
248 259
249 // Returns a node that is true if the given bit is set in |word32|. 260 // Returns a node that is true if the given bit is set in |word32|.
250 template <typename T> 261 template <typename T>
251 Node* BitFieldDecode(Node* word32) { 262 Node* BitFieldDecode(Node* word32) {
252 return BitFieldDecode(word32, T::kShift, T::kMask); 263 return BitFieldDecode(word32, T::kShift, T::kMask);
253 } 264 }
(...skipping 11 matching lines...) Expand all
265 virtual void CallEpilogue(); 276 virtual void CallEpilogue();
266 277
267 private: 278 private:
268 friend class CodeStubAssemblerTester; 279 friend class CodeStubAssemblerTester;
269 280
270 Node* CallN(CallDescriptor* descriptor, Node* code_target, Node** args); 281 Node* CallN(CallDescriptor* descriptor, Node* code_target, Node** args);
271 Node* TailCallN(CallDescriptor* descriptor, Node* code_target, Node** args); 282 Node* TailCallN(CallDescriptor* descriptor, Node* code_target, Node** args);
272 283
273 Node* SmiShiftBitsConstant(); 284 Node* SmiShiftBitsConstant();
274 285
286 Node* AllocateRawAligned(Node* size_in_bytes, AllocationFlags flags,
287 Node* top_address, Node* limit_address);
288 Node* AllocateRawUnaligned(Node* size_in_bytes, AllocationFlags flags,
289 Node* top_adddress, Node* limit_address);
290
275 base::SmartPointer<RawMachineAssembler> raw_assembler_; 291 base::SmartPointer<RawMachineAssembler> raw_assembler_;
276 Code::Flags flags_; 292 Code::Flags flags_;
277 const char* name_; 293 const char* name_;
278 bool code_generated_; 294 bool code_generated_;
279 ZoneVector<Variable::Impl*> variables_; 295 ZoneVector<Variable::Impl*> variables_;
280 296
281 DISALLOW_COPY_AND_ASSIGN(CodeStubAssembler); 297 DISALLOW_COPY_AND_ASSIGN(CodeStubAssembler);
282 }; 298 };
283 299
300 DEFINE_OPERATORS_FOR_FLAGS(CodeStubAssembler::AllocationFlags);
301
284 class CodeStubAssembler::Label { 302 class CodeStubAssembler::Label {
285 public: 303 public:
286 explicit Label(CodeStubAssembler* assembler); 304 explicit Label(CodeStubAssembler* assembler);
287 Label(CodeStubAssembler* assembler, int merged_variable_count, 305 Label(CodeStubAssembler* assembler, int merged_variable_count,
288 CodeStubAssembler::Variable** merged_variables); 306 CodeStubAssembler::Variable** merged_variables);
289 Label(CodeStubAssembler* assembler, 307 Label(CodeStubAssembler* assembler,
290 CodeStubAssembler::Variable* merged_variable); 308 CodeStubAssembler::Variable* merged_variable);
291 ~Label() {} 309 ~Label() {}
292 310
293 private: 311 private:
(...skipping 12 matching lines...) Expand all
306 // Map of variables to the list of value nodes that have been added from each 324 // Map of variables to the list of value nodes that have been added from each
307 // merge path in their order of merging. 325 // merge path in their order of merging.
308 std::map<Variable::Impl*, std::vector<Node*>> variable_merges_; 326 std::map<Variable::Impl*, std::vector<Node*>> variable_merges_;
309 }; 327 };
310 328
311 } // namespace compiler 329 } // namespace compiler
312 } // namespace internal 330 } // namespace internal
313 } // namespace v8 331 } // namespace v8
314 332
315 #endif // V8_COMPILER_CODE_STUB_ASSEMBLER_H_ 333 #endif // V8_COMPILER_CODE_STUB_ASSEMBLER_H_
OLDNEW
« no previous file with comments | « src/code-stubs-hydrogen.cc ('k') | src/compiler/code-stub-assembler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698