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

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

Issue 2246463002: [compiler] Remove compiler internals from CodeAssembler. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 4 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.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 #include <memory> 9 #include <memory>
10 10
(...skipping 11 matching lines...) Expand all
22 22
23 class Callable; 23 class Callable;
24 class CallInterfaceDescriptor; 24 class CallInterfaceDescriptor;
25 class Isolate; 25 class Isolate;
26 class Factory; 26 class Factory;
27 class Zone; 27 class Zone;
28 28
29 namespace compiler { 29 namespace compiler {
30 30
31 class CallDescriptor; 31 class CallDescriptor;
32 class Graph;
33 class Node; 32 class Node;
34 class Operator;
35 class RawMachineAssembler; 33 class RawMachineAssembler;
36 class RawMachineLabel; 34 class RawMachineLabel;
37 class Schedule;
38 35
39 #define CODE_ASSEMBLER_COMPARE_BINARY_OP_LIST(V) \ 36 #define CODE_ASSEMBLER_COMPARE_BINARY_OP_LIST(V) \
40 V(Float32Equal) \ 37 V(Float32Equal) \
41 V(Float32LessThan) \ 38 V(Float32LessThan) \
42 V(Float32LessThanOrEqual) \ 39 V(Float32LessThanOrEqual) \
43 V(Float32GreaterThan) \ 40 V(Float32GreaterThan) \
44 V(Float32GreaterThanOrEqual) \ 41 V(Float32GreaterThanOrEqual) \
45 V(Float64Equal) \ 42 V(Float64Equal) \
46 V(Float64LessThan) \ 43 V(Float64LessThan) \
47 V(Float64LessThanOrEqual) \ 44 V(Float64LessThanOrEqual) \
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 MachineRepresentation rep() const; 197 MachineRepresentation rep() const;
201 bool IsBound() const; 198 bool IsBound() const;
202 199
203 private: 200 private:
204 friend class CodeAssembler; 201 friend class CodeAssembler;
205 class Impl; 202 class Impl;
206 Impl* impl_; 203 Impl* impl_;
207 CodeAssembler* assembler_; 204 CodeAssembler* assembler_;
208 }; 205 };
209 206
210 enum AllocationFlag : uint8_t {
211 kNone = 0,
212 kDoubleAlignment = 1,
213 kPretenured = 1 << 1
214 };
215
216 typedef base::Flags<AllocationFlag> AllocationFlags;
217
218 // =========================================================================== 207 // ===========================================================================
219 // Base Assembler 208 // Base Assembler
220 // =========================================================================== 209 // ===========================================================================
221 210
222 // Constants. 211 // Constants.
223 Node* Int32Constant(int32_t value); 212 Node* Int32Constant(int32_t value);
224 Node* Int64Constant(int64_t value); 213 Node* Int64Constant(int64_t value);
225 Node* IntPtrConstant(intptr_t value); 214 Node* IntPtrConstant(intptr_t value);
226 Node* NumberConstant(double value); 215 Node* NumberConstant(double value);
227 Node* SmiConstant(Smi* value); 216 Node* SmiConstant(Smi* value);
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
426 } 415 }
427 CODE_ASSEMBLER_COMPARE_BINARY_OP_LIST(BRANCH_HELPER) 416 CODE_ASSEMBLER_COMPARE_BINARY_OP_LIST(BRANCH_HELPER)
428 #undef BRANCH_HELPER 417 #undef BRANCH_HELPER
429 418
430 // Helpers which delegate to RawMachineAssembler. 419 // Helpers which delegate to RawMachineAssembler.
431 Factory* factory() const; 420 Factory* factory() const;
432 Isolate* isolate() const; 421 Isolate* isolate() const;
433 Zone* zone() const; 422 Zone* zone() const;
434 423
435 protected: 424 protected:
436 // Protected helpers which delegate to RawMachineAssembler.
437 Graph* graph() const;
438
439 Node* SmiShiftBitsConstant();
440
441 // Enables subclasses to perform operations before and after a call. 425 // Enables subclasses to perform operations before and after a call.
442 virtual void CallPrologue(); 426 virtual void CallPrologue();
443 virtual void CallEpilogue(); 427 virtual void CallEpilogue();
444 428
445 private: 429 private:
446 CodeAssembler(Isolate* isolate, Zone* zone, CallDescriptor* call_descriptor, 430 CodeAssembler(Isolate* isolate, Zone* zone, CallDescriptor* call_descriptor,
447 Code::Flags flags, const char* name); 431 Code::Flags flags, const char* name);
448 432
449 Node* CallN(CallDescriptor* descriptor, Node* code_target, Node** args); 433 Node* CallN(CallDescriptor* descriptor, Node* code_target, Node** args);
450 Node* TailCallN(CallDescriptor* descriptor, Node* code_target, Node** args); 434 Node* TailCallN(CallDescriptor* descriptor, Node* code_target, Node** args);
451 435
452 std::unique_ptr<RawMachineAssembler> raw_assembler_; 436 std::unique_ptr<RawMachineAssembler> raw_assembler_;
453 Code::Flags flags_; 437 Code::Flags flags_;
454 const char* name_; 438 const char* name_;
455 bool code_generated_; 439 bool code_generated_;
456 ZoneSet<Variable::Impl*> variables_; 440 ZoneSet<Variable::Impl*> variables_;
457 441
458 DISALLOW_COPY_AND_ASSIGN(CodeAssembler); 442 DISALLOW_COPY_AND_ASSIGN(CodeAssembler);
459 }; 443 };
460 444
461 DEFINE_OPERATORS_FOR_FLAGS(CodeAssembler::AllocationFlags);
462
463 class CodeAssembler::Label { 445 class CodeAssembler::Label {
464 public: 446 public:
465 enum Type { kDeferred, kNonDeferred }; 447 enum Type { kDeferred, kNonDeferred };
466 448
467 explicit Label( 449 explicit Label(
468 CodeAssembler* assembler, 450 CodeAssembler* assembler,
469 CodeAssembler::Label::Type type = CodeAssembler::Label::kNonDeferred) 451 CodeAssembler::Label::Type type = CodeAssembler::Label::kNonDeferred)
470 : CodeAssembler::Label(assembler, 0, nullptr, type) {} 452 : CodeAssembler::Label(assembler, 0, nullptr, type) {}
471 Label(CodeAssembler* assembler, CodeAssembler::Variable* merged_variable, 453 Label(CodeAssembler* assembler, CodeAssembler::Variable* merged_variable,
472 CodeAssembler::Label::Type type = CodeAssembler::Label::kNonDeferred) 454 CodeAssembler::Label::Type type = CodeAssembler::Label::kNonDeferred)
(...skipping 19 matching lines...) Expand all
492 // Map of variables to the list of value nodes that have been added from each 474 // Map of variables to the list of value nodes that have been added from each
493 // merge path in their order of merging. 475 // merge path in their order of merging.
494 std::map<Variable::Impl*, std::vector<Node*>> variable_merges_; 476 std::map<Variable::Impl*, std::vector<Node*>> variable_merges_;
495 }; 477 };
496 478
497 } // namespace compiler 479 } // namespace compiler
498 } // namespace internal 480 } // namespace internal
499 } // namespace v8 481 } // namespace v8
500 482
501 #endif // V8_COMPILER_CODE_ASSEMBLER_H_ 483 #endif // V8_COMPILER_CODE_ASSEMBLER_H_
OLDNEW
« no previous file with comments | « src/code-stubs.cc ('k') | src/compiler/code-assembler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698