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

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

Issue 1893383002: Complete separation of CodeAssembler and CodeStubAssembler (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Review feedback Created 4 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/code-stub-assembler.cc ('k') | src/compiler/code-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_ASSEMBLER_H_ 5 #ifndef V8_COMPILER_CODE_ASSEMBLER_H_
6 #define V8_COMPILER_CODE_ASSEMBLER_H_ 6 #define V8_COMPILER_CODE_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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 V(Float64LessThan) \ 45 V(Float64LessThan) \
46 V(Float64LessThanOrEqual) \ 46 V(Float64LessThanOrEqual) \
47 V(Float64GreaterThan) \ 47 V(Float64GreaterThan) \
48 V(Float64GreaterThanOrEqual) \ 48 V(Float64GreaterThanOrEqual) \
49 V(Int32GreaterThan) \ 49 V(Int32GreaterThan) \
50 V(Int32GreaterThanOrEqual) \ 50 V(Int32GreaterThanOrEqual) \
51 V(Int32LessThan) \ 51 V(Int32LessThan) \
52 V(Int32LessThanOrEqual) \ 52 V(Int32LessThanOrEqual) \
53 V(IntPtrLessThan) \ 53 V(IntPtrLessThan) \
54 V(IntPtrLessThanOrEqual) \ 54 V(IntPtrLessThanOrEqual) \
55 V(IntPtrEqual) \
55 V(Uint32LessThan) \ 56 V(Uint32LessThan) \
56 V(UintPtrGreaterThanOrEqual) \ 57 V(UintPtrGreaterThanOrEqual) \
57 V(WordEqual) \ 58 V(WordEqual) \
58 V(WordNotEqual) \ 59 V(WordNotEqual) \
59 V(Word32Equal) \ 60 V(Word32Equal) \
60 V(Word32NotEqual) \ 61 V(Word32NotEqual) \
61 V(Word64Equal) \ 62 V(Word64Equal) \
62 V(Word64NotEqual) 63 V(Word64NotEqual)
63 64
64 #define CODE_ASSEMBLER_BINARY_OP_LIST(V) \ 65 #define CODE_ASSEMBLER_BINARY_OP_LIST(V) \
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 185
185 // Constants. 186 // Constants.
186 Node* Int32Constant(int value); 187 Node* Int32Constant(int value);
187 Node* IntPtrConstant(intptr_t value); 188 Node* IntPtrConstant(intptr_t value);
188 Node* NumberConstant(double value); 189 Node* NumberConstant(double value);
189 Node* SmiConstant(Smi* value); 190 Node* SmiConstant(Smi* value);
190 Node* HeapConstant(Handle<HeapObject> object); 191 Node* HeapConstant(Handle<HeapObject> object);
191 Node* BooleanConstant(bool value); 192 Node* BooleanConstant(bool value);
192 Node* ExternalConstant(ExternalReference address); 193 Node* ExternalConstant(ExternalReference address);
193 Node* Float64Constant(double value); 194 Node* Float64Constant(double value);
194 Node* BooleanMapConstant();
195 Node* EmptyStringConstant();
196 Node* HeapNumberMapConstant();
197 Node* NaNConstant(); 195 Node* NaNConstant();
198 Node* NoContextConstant();
199 Node* NullConstant();
200 Node* UndefinedConstant();
201 196
202 Node* Parameter(int value); 197 Node* Parameter(int value);
203 void Return(Node* value); 198 void Return(Node* value);
204 199
205 void Bind(Label* label); 200 void Bind(Label* label);
206 void Goto(Label* label); 201 void Goto(Label* label);
207 void GotoIf(Node* condition, Label* true_label); 202 void GotoIf(Node* condition, Label* true_label);
208 void GotoUnless(Node* condition, Label* false_label); 203 void GotoUnless(Node* condition, Label* false_label);
209 void Branch(Node* condition, Label* true_label, Label* false_label); 204 void Branch(Node* condition, Label* true_label, Label* false_label);
210 205
211 void Switch(Node* index, Label* default_label, int32_t* case_values, 206 void Switch(Node* index, Label* default_label, int32_t* case_values,
212 Label** case_labels, size_t case_count); 207 Label** case_labels, size_t case_count);
213 208
214 // Access to the frame pointer 209 // Access to the frame pointer
215 Node* LoadFramePointer(); 210 Node* LoadFramePointer();
216 Node* LoadParentFramePointer(); 211 Node* LoadParentFramePointer();
217 212
218 // Access to the stack pointer 213 // Access to the stack pointer
219 Node* LoadStackPointer(); 214 Node* LoadStackPointer();
220 215
221 // Load raw memory location. 216 // Load raw memory location.
222 Node* Load(MachineType rep, Node* base); 217 Node* Load(MachineType rep, Node* base);
223 Node* Load(MachineType rep, Node* base, Node* index); 218 Node* Load(MachineType rep, Node* base, Node* index);
224 Node* AtomicLoad(MachineType rep, Node* base, Node* index); 219 Node* AtomicLoad(MachineType rep, Node* base, Node* index);
225 220
221 // Load a value from the root array.
222 Node* LoadRoot(Heap::RootListIndex root_index);
223
226 // Store value to raw memory location. 224 // Store value to raw memory location.
227 Node* Store(MachineRepresentation rep, Node* base, Node* value); 225 Node* Store(MachineRepresentation rep, Node* base, Node* value);
228 Node* Store(MachineRepresentation rep, Node* base, Node* index, Node* value); 226 Node* Store(MachineRepresentation rep, Node* base, Node* index, Node* value);
229 Node* StoreNoWriteBarrier(MachineRepresentation rep, Node* base, Node* value); 227 Node* StoreNoWriteBarrier(MachineRepresentation rep, Node* base, Node* value);
230 Node* StoreNoWriteBarrier(MachineRepresentation rep, Node* base, Node* index, 228 Node* StoreNoWriteBarrier(MachineRepresentation rep, Node* base, Node* index,
231 Node* value); 229 Node* value);
232 230
233 // Basic arithmetic operations. 231 // Basic arithmetic operations.
234 #define DECLARE_CODE_ASSEMBLER_BINARY_OP(name) Node* name(Node* a, Node* b); 232 #define DECLARE_CODE_ASSEMBLER_BINARY_OP(name) Node* name(Node* a, Node* b);
235 CODE_ASSEMBLER_BINARY_OP_LIST(DECLARE_CODE_ASSEMBLER_BINARY_OP) 233 CODE_ASSEMBLER_BINARY_OP_LIST(DECLARE_CODE_ASSEMBLER_BINARY_OP)
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 Node* TailCallStub(const CallInterfaceDescriptor& descriptor, Node* target, 298 Node* TailCallStub(const CallInterfaceDescriptor& descriptor, Node* target,
301 Node* context, Node* arg1, Node* arg2, 299 Node* context, Node* arg1, Node* arg2,
302 size_t result_size = 1); 300 size_t result_size = 1);
303 Node* TailCallStub(const CallInterfaceDescriptor& descriptor, Node* target, 301 Node* TailCallStub(const CallInterfaceDescriptor& descriptor, Node* target,
304 Node* context, Node* arg1, Node* arg2, Node* arg3, 302 Node* context, Node* arg1, Node* arg2, Node* arg3,
305 size_t result_size = 1); 303 size_t result_size = 1);
306 304
307 Node* TailCallBytecodeDispatch(const CallInterfaceDescriptor& descriptor, 305 Node* TailCallBytecodeDispatch(const CallInterfaceDescriptor& descriptor,
308 Node* code_target_address, Node** args); 306 Node* code_target_address, Node** args);
309 307
310 // ===========================================================================
311 // Macros
312 // ===========================================================================
313
314 // Tag a Word as a Smi value.
315 Node* SmiTag(Node* value);
316 // Untag a Smi value as a Word.
317 Node* SmiUntag(Node* value);
318
319 // Load a value from the root array.
320 Node* LoadRoot(Heap::RootListIndex root_index);
321
322 // Allocate an object of the given size.
323 Node* Allocate(int size, AllocationFlags flags = kNone);
324 Node* InnerAllocate(Node* previous, int offset);
325
326 // Branching helpers. 308 // Branching helpers.
327 void BranchIf(Node* condition, Label* if_true, Label* if_false); 309 void BranchIf(Node* condition, Label* if_true, Label* if_false);
328 310
329 #define BRANCH_HELPER(name) \ 311 #define BRANCH_HELPER(name) \
330 void BranchIf##name(Node* a, Node* b, Label* if_true, Label* if_false) { \ 312 void BranchIf##name(Node* a, Node* b, Label* if_true, Label* if_false) { \
331 BranchIf(name(a, b), if_true, if_false); \ 313 BranchIf(name(a, b), if_true, if_false); \
332 } 314 }
333 CODE_ASSEMBLER_COMPARE_BINARY_OP_LIST(BRANCH_HELPER) 315 CODE_ASSEMBLER_COMPARE_BINARY_OP_LIST(BRANCH_HELPER)
334 #undef BRANCH_HELPER 316 #undef BRANCH_HELPER
335 317
(...skipping 14 matching lines...) Expand all
350 332
351 private: 333 private:
352 friend class CodeAssemblerTester; 334 friend class CodeAssemblerTester;
353 335
354 CodeAssembler(Isolate* isolate, Zone* zone, CallDescriptor* call_descriptor, 336 CodeAssembler(Isolate* isolate, Zone* zone, CallDescriptor* call_descriptor,
355 Code::Flags flags, const char* name); 337 Code::Flags flags, const char* name);
356 338
357 Node* CallN(CallDescriptor* descriptor, Node* code_target, Node** args); 339 Node* CallN(CallDescriptor* descriptor, Node* code_target, Node** args);
358 Node* TailCallN(CallDescriptor* descriptor, Node* code_target, Node** args); 340 Node* TailCallN(CallDescriptor* descriptor, Node* code_target, Node** args);
359 341
360 Node* AllocateRawAligned(Node* size_in_bytes, AllocationFlags flags,
361 Node* top_address, Node* limit_address);
362 Node* AllocateRawUnaligned(Node* size_in_bytes, AllocationFlags flags,
363 Node* top_adddress, Node* limit_address);
364
365 base::SmartPointer<RawMachineAssembler> raw_assembler_; 342 base::SmartPointer<RawMachineAssembler> raw_assembler_;
366 Code::Flags flags_; 343 Code::Flags flags_;
367 const char* name_; 344 const char* name_;
368 bool code_generated_; 345 bool code_generated_;
369 ZoneVector<Variable::Impl*> variables_; 346 ZoneVector<Variable::Impl*> variables_;
370 347
371 DISALLOW_COPY_AND_ASSIGN(CodeAssembler); 348 DISALLOW_COPY_AND_ASSIGN(CodeAssembler);
372 }; 349 };
373 350
374 DEFINE_OPERATORS_FOR_FLAGS(CodeAssembler::AllocationFlags); 351 DEFINE_OPERATORS_FOR_FLAGS(CodeAssembler::AllocationFlags);
(...skipping 30 matching lines...) Expand all
405 // Map of variables to the list of value nodes that have been added from each 382 // Map of variables to the list of value nodes that have been added from each
406 // merge path in their order of merging. 383 // merge path in their order of merging.
407 std::map<Variable::Impl*, std::vector<Node*>> variable_merges_; 384 std::map<Variable::Impl*, std::vector<Node*>> variable_merges_;
408 }; 385 };
409 386
410 } // namespace compiler 387 } // namespace compiler
411 } // namespace internal 388 } // namespace internal
412 } // namespace v8 389 } // namespace v8
413 390
414 #endif // V8_COMPILER_CODE_ASSEMBLER_H_ 391 #endif // V8_COMPILER_CODE_ASSEMBLER_H_
OLDNEW
« no previous file with comments | « src/code-stub-assembler.cc ('k') | src/compiler/code-assembler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698