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

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

Issue 2562393002: [wasm] Introduce the TrapIf and TrapUnless operators to generate trap code. (Closed)
Patch Set: Rename UseSourcePosition to IsSourcePositionUsed Created 4 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/arm64/instruction-selector-arm64.cc ('k') | src/compiler/code-generator.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_CODE_GENERATOR_H_ 5 #ifndef V8_COMPILER_CODE_GENERATOR_H_
6 #define V8_COMPILER_CODE_GENERATOR_H_ 6 #define V8_COMPILER_CODE_GENERATOR_H_
7 7
8 #include "src/compiler/gap-resolver.h" 8 #include "src/compiler/gap-resolver.h"
9 #include "src/compiler/instruction.h" 9 #include "src/compiler/instruction.h"
10 #include "src/compiler/unwinding-info-writer.h" 10 #include "src/compiler/unwinding-info-writer.h"
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 InstructionSequence* code() const { return code_; } 63 InstructionSequence* code() const { return code_; }
64 FrameAccessState* frame_access_state() const { return frame_access_state_; } 64 FrameAccessState* frame_access_state() const { return frame_access_state_; }
65 const Frame* frame() const { return frame_access_state_->frame(); } 65 const Frame* frame() const { return frame_access_state_->frame(); }
66 Isolate* isolate() const; 66 Isolate* isolate() const;
67 Linkage* linkage() const { return linkage_; } 67 Linkage* linkage() const { return linkage_; }
68 68
69 Label* GetLabel(RpoNumber rpo) { return &labels_[rpo.ToSize()]; } 69 Label* GetLabel(RpoNumber rpo) { return &labels_[rpo.ToSize()]; }
70 70
71 void AddProtectedInstruction(int instr_offset, int landing_offset); 71 void AddProtectedInstruction(int instr_offset, int landing_offset);
72 72
73 void AssembleSourcePosition(Instruction* instr);
74
75 // Record a safepoint with the given pointer map.
76 void RecordSafepoint(ReferenceMap* references, Safepoint::Kind kind,
77 int arguments, Safepoint::DeoptMode deopt_mode);
78
73 private: 79 private:
74 MacroAssembler* masm() { return &masm_; } 80 MacroAssembler* masm() { return &masm_; }
75 GapResolver* resolver() { return &resolver_; } 81 GapResolver* resolver() { return &resolver_; }
76 SafepointTableBuilder* safepoints() { return &safepoints_; } 82 SafepointTableBuilder* safepoints() { return &safepoints_; }
77 Zone* zone() const { return code()->zone(); } 83 Zone* zone() const { return code()->zone(); }
78 CompilationInfo* info() const { return info_; } 84 CompilationInfo* info() const { return info_; }
79 85
80 // Create the FrameAccessState object. The Frame is immutable from here on. 86 // Create the FrameAccessState object. The Frame is immutable from here on.
81 void CreateFrameAccessState(Frame* frame); 87 void CreateFrameAccessState(Frame* frame);
82 88
83 // Architecture - specific frame finalization. 89 // Architecture - specific frame finalization.
84 void FinishFrame(Frame* frame); 90 void FinishFrame(Frame* frame);
85 91
86 // Checks if {block} will appear directly after {current_block_} when 92 // Checks if {block} will appear directly after {current_block_} when
87 // assembling code, in which case, a fall-through can be used. 93 // assembling code, in which case, a fall-through can be used.
88 bool IsNextInAssemblyOrder(RpoNumber block) const; 94 bool IsNextInAssemblyOrder(RpoNumber block) const;
89 95
90 // Record a safepoint with the given pointer map.
91 void RecordSafepoint(ReferenceMap* references, Safepoint::Kind kind,
92 int arguments, Safepoint::DeoptMode deopt_mode);
93
94 // Check if a heap object can be materialized by loading from a heap root, 96 // Check if a heap object can be materialized by loading from a heap root,
95 // which is cheaper on some platforms than materializing the actual heap 97 // which is cheaper on some platforms than materializing the actual heap
96 // object constant. 98 // object constant.
97 bool IsMaterializableFromRoot(Handle<HeapObject> object, 99 bool IsMaterializableFromRoot(Handle<HeapObject> object,
98 Heap::RootListIndex* index_return); 100 Heap::RootListIndex* index_return);
99 101
100 enum CodeGenResult { kSuccess, kTooManyDeoptimizationBailouts }; 102 enum CodeGenResult { kSuccess, kTooManyDeoptimizationBailouts };
101 103
102 // Assemble instructions for the specified block. 104 // Assemble instructions for the specified block.
103 CodeGenResult AssembleBlock(const InstructionBlock* block); 105 CodeGenResult AssembleBlock(const InstructionBlock* block);
104 106
105 // Assemble code for the specified instruction. 107 // Assemble code for the specified instruction.
106 CodeGenResult AssembleInstruction(Instruction* instr, 108 CodeGenResult AssembleInstruction(Instruction* instr,
107 const InstructionBlock* block); 109 const InstructionBlock* block);
108 void AssembleSourcePosition(Instruction* instr);
109 void AssembleGaps(Instruction* instr); 110 void AssembleGaps(Instruction* instr);
110 111
111 // Returns true if a instruction is a tail call that needs to adjust the stack 112 // Returns true if a instruction is a tail call that needs to adjust the stack
112 // pointer before execution. The stack slot index to the empty slot above the 113 // pointer before execution. The stack slot index to the empty slot above the
113 // adjusted stack pointer is returned in |slot|. 114 // adjusted stack pointer is returned in |slot|.
114 bool GetSlotAboveSPBeforeTailCall(Instruction* instr, int* slot); 115 bool GetSlotAboveSPBeforeTailCall(Instruction* instr, int* slot);
115 116
116 // =========================================================================== 117 // ===========================================================================
117 // ============= Architecture-specific code generation methods. ============== 118 // ============= Architecture-specific code generation methods. ==============
118 // =========================================================================== 119 // ===========================================================================
119 120
120 CodeGenResult AssembleArchInstruction(Instruction* instr); 121 CodeGenResult AssembleArchInstruction(Instruction* instr);
121 void AssembleArchJump(RpoNumber target); 122 void AssembleArchJump(RpoNumber target);
122 void AssembleArchBranch(Instruction* instr, BranchInfo* branch); 123 void AssembleArchBranch(Instruction* instr, BranchInfo* branch);
123 void AssembleArchBoolean(Instruction* instr, FlagsCondition condition); 124 void AssembleArchBoolean(Instruction* instr, FlagsCondition condition);
125 void AssembleArchTrap(Instruction* instr, FlagsCondition condition);
124 void AssembleArchLookupSwitch(Instruction* instr); 126 void AssembleArchLookupSwitch(Instruction* instr);
125 void AssembleArchTableSwitch(Instruction* instr); 127 void AssembleArchTableSwitch(Instruction* instr);
126 128
127 CodeGenResult AssembleDeoptimizerCall(int deoptimization_id, 129 CodeGenResult AssembleDeoptimizerCall(int deoptimization_id,
128 Deoptimizer::BailoutType bailout_type, 130 Deoptimizer::BailoutType bailout_type,
129 SourcePosition pos); 131 SourcePosition pos);
130 132
131 // Generates an architecture-specific, descriptor-specific prologue 133 // Generates an architecture-specific, descriptor-specific prologue
132 // to set up a stack frame. 134 // to set up a stack frame.
133 void AssembleConstructFrame(); 135 void AssembleConstructFrame();
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 int optimized_out_literal_id_; 290 int optimized_out_literal_id_;
289 SourcePositionTableBuilder source_position_table_builder_; 291 SourcePositionTableBuilder source_position_table_builder_;
290 ZoneVector<trap_handler::ProtectedInstructionData>* protected_instructions_; 292 ZoneVector<trap_handler::ProtectedInstructionData>* protected_instructions_;
291 }; 293 };
292 294
293 } // namespace compiler 295 } // namespace compiler
294 } // namespace internal 296 } // namespace internal
295 } // namespace v8 297 } // namespace v8
296 298
297 #endif // V8_COMPILER_CODE_GENERATOR_H 299 #endif // V8_COMPILER_CODE_GENERATOR_H
OLDNEW
« no previous file with comments | « src/compiler/arm64/instruction-selector-arm64.cc ('k') | src/compiler/code-generator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698