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

Side by Side Diff: src/x64/lithium-codegen-x64.h

Issue 6201006: X64 Crankshaft: Ported lots of boilerplate code. (Closed)
Patch Set: Addressed review comments. Updated to match newest ia32 version. Created 9 years, 11 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/x64/assembler-x64.cc ('k') | src/x64/lithium-codegen-x64.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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 12 matching lines...) Expand all
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 27
28 #ifndef V8_X64_LITHIUM_CODEGEN_X64_H_ 28 #ifndef V8_X64_LITHIUM_CODEGEN_X64_H_
29 #define V8_X64_LITHIUM_CODEGEN_X64_H_ 29 #define V8_X64_LITHIUM_CODEGEN_X64_H_
30 30
31 #include "x64/lithium-x64.h" 31 #include "x64/lithium-x64.h"
32 32
33 #include "checks.h"
33 #include "deoptimizer.h" 34 #include "deoptimizer.h"
34 #include "safepoint-table.h" 35 #include "safepoint-table.h"
35 #include "scopes.h" 36 #include "scopes.h"
36 37
37 namespace v8 { 38 namespace v8 {
38 namespace internal { 39 namespace internal {
39 40
40 // Forward declarations. 41 // Forward declarations.
41 class LDeferredCode; 42 class LDeferredCode;
42 class SafepointGenerator; 43 class SafepointGenerator;
(...skipping 13 matching lines...) Expand all
56 scope_(chunk->graph()->info()->scope()), 57 scope_(chunk->graph()->info()->scope()),
57 status_(UNUSED), 58 status_(UNUSED),
58 deferred_(8), 59 deferred_(8),
59 osr_pc_offset_(-1) { 60 osr_pc_offset_(-1) {
60 PopulateDeoptimizationLiteralsWithInlinedFunctions(); 61 PopulateDeoptimizationLiteralsWithInlinedFunctions();
61 } 62 }
62 63
63 // Try to generate code for the entire chunk, but it may fail if the 64 // Try to generate code for the entire chunk, but it may fail if the
64 // chunk contains constructs we cannot handle. Returns true if the 65 // chunk contains constructs we cannot handle. Returns true if the
65 // code generation attempt succeeded. 66 // code generation attempt succeeded.
66 bool GenerateCode() { 67 bool GenerateCode();
67 UNIMPLEMENTED();
68 return false;
69 }
70
71 68
72 // Finish the code by setting stack height, safepoint, and bailout 69 // Finish the code by setting stack height, safepoint, and bailout
73 // information on it. 70 // information on it.
74 void FinishCode(Handle<Code> code) { UNIMPLEMENTED(); } 71 void FinishCode(Handle<Code> code);
72
73 // Deferred code support.
74 void DoDeferredNumberTagD(LNumberTagD* instr);
75 void DoDeferredNumberTagI(LNumberTagI* instr);
76 void DoDeferredTaggedToI(LTaggedToI* instr);
77 void DoDeferredMathAbsTaggedHeapNumber(LUnaryMathOperation* instr);
78 void DoDeferredStackCheck(LGoto* instr);
79 void DoDeferredLInstanceOfKnownGlobal(LInstanceOfKnownGlobal* instr,
80 Label* map_check);
75 81
76 // Parallel move support. 82 // Parallel move support.
77 void DoParallelMove(LParallelMove* move); 83 void DoParallelMove(LParallelMove* move);
78 84
79 // Emit frame translation commands for an environment. 85 // Emit frame translation commands for an environment.
80 void WriteTranslation(LEnvironment* environment, Translation* translation); 86 void WriteTranslation(LEnvironment* environment, Translation* translation);
81 87
82 // Declare methods that deal with the individual node types. 88 // Declare methods that deal with the individual node types.
83 #define DECLARE_DO(type) void Do##type(L##type* node); 89 #define DECLARE_DO(type) void Do##type(L##type* node);
84 LITHIUM_CONCRETE_INSTRUCTION_LIST(DECLARE_DO) 90 LITHIUM_CONCRETE_INSTRUCTION_LIST(DECLARE_DO)
(...skipping 10 matching lines...) Expand all
95 bool is_unused() const { return status_ == UNUSED; } 101 bool is_unused() const { return status_ == UNUSED; }
96 bool is_generating() const { return status_ == GENERATING; } 102 bool is_generating() const { return status_ == GENERATING; }
97 bool is_done() const { return status_ == DONE; } 103 bool is_done() const { return status_ == DONE; }
98 bool is_aborted() const { return status_ == ABORTED; } 104 bool is_aborted() const { return status_ == ABORTED; }
99 105
100 LChunk* chunk() const { return chunk_; } 106 LChunk* chunk() const { return chunk_; }
101 Scope* scope() const { return scope_; } 107 Scope* scope() const { return scope_; }
102 HGraph* graph() const { return chunk_->graph(); } 108 HGraph* graph() const { return chunk_->graph(); }
103 MacroAssembler* masm() const { return masm_; } 109 MacroAssembler* masm() const { return masm_; }
104 110
105 int GetNextEmittedBlock(int block) { 111 int GetNextEmittedBlock(int block);
106 UNIMPLEMENTED(); 112 LInstruction* GetNextInstruction();
107 return 0;
108 }
109 LInstruction* GetNextInstruction() {
110 UNIMPLEMENTED();
111 return NULL;
112 }
113 113
114 void EmitClassOfTest(Label* if_true, 114 void EmitClassOfTest(Label* if_true,
115 Label* if_false, 115 Label* if_false,
116 Handle<String> class_name, 116 Handle<String> class_name,
117 Register input, 117 Register input,
118 Register temporary, 118 Register temporary,
119 Register temporary2) { UNIMPLEMENTED(); } 119 Register temporary2);
120 120
121 int StackSlotCount() const { return chunk()->spill_slot_count(); } 121 int StackSlotCount() const { return chunk()->spill_slot_count(); }
122 int ParameterCount() const { return scope()->num_parameters(); } 122 int ParameterCount() const { return scope()->num_parameters(); }
123 123
124 void Abort(const char* format, ...) { UNIMPLEMENTED(); } 124 void Abort(const char* format, ...);
125 void Comment(const char* format, ...) { UNIMPLEMENTED(); } 125 void Comment(const char* format, ...);
126 126
127 void AddDeferredCode(LDeferredCode* code) { deferred_.Add(code); } 127 void AddDeferredCode(LDeferredCode* code) { deferred_.Add(code); }
128 128
129 // Code generation passes. Returns true if code generation should 129 // Code generation passes. Returns true if code generation should
130 // continue. 130 // continue.
131 bool GeneratePrologue() { 131 bool GeneratePrologue();
132 UNIMPLEMENTED(); 132 bool GenerateBody();
133 return true; 133 bool GenerateDeferredCode();
134 } 134 bool GenerateSafepointTable();
135 bool GenerateBody() {
136 UNIMPLEMENTED();
137 return true;
138 }
139 bool GenerateDeferredCode() {
140 UNIMPLEMENTED();
141 return true;
142 }
143 bool GenerateSafepointTable() {
144 UNIMPLEMENTED();
145 return true;
146 }
147 135
148 void CallCode(Handle<Code> code, 136 void CallCode(Handle<Code> code,
149 RelocInfo::Mode mode, 137 RelocInfo::Mode mode,
150 LInstruction* instr) { UNIMPLEMENTED(); } 138 LInstruction* instr);
151 void CallRuntime(Runtime::Function* function, 139 void CallRuntime(Runtime::Function* function,
152 int num_arguments, 140 int num_arguments,
153 LInstruction* instr) { UNIMPLEMENTED(); } 141 LInstruction* instr);
154 void CallRuntime(Runtime::FunctionId id, 142 void CallRuntime(Runtime::FunctionId id,
155 int num_arguments, 143 int num_arguments,
156 LInstruction* instr) { 144 LInstruction* instr) {
157 Runtime::Function* function = Runtime::FunctionForId(id); 145 Runtime::Function* function = Runtime::FunctionForId(id);
158 CallRuntime(function, num_arguments, instr); 146 CallRuntime(function, num_arguments, instr);
159 } 147 }
160 148
161 void DeoptimizeIf(Condition cc, LEnvironment* environment) { 149 // Generate a direct call to a known function. Expects the function
162 UNIMPLEMENTED(); 150 // to be in edi.
163 } 151 void CallKnownFunction(Handle<JSFunction> function,
152 int arity,
153 LInstruction* instr);
154
155 void LoadPrototype(Register result, Handle<JSObject> prototype);
156
157 void RegisterLazyDeoptimization(LInstruction* instr);
158 void RegisterEnvironmentForDeoptimization(LEnvironment* environment);
159 void DeoptimizeIf(Condition cc, LEnvironment* environment);
164 160
165 void AddToTranslation(Translation* translation, 161 void AddToTranslation(Translation* translation,
166 LOperand* op, 162 LOperand* op,
167 bool is_tagged) { UNIMPLEMENTED(); } 163 bool is_tagged);
164 void PopulateDeoptimizationData(Handle<Code> code);
165 int DefineDeoptimizationLiteral(Handle<Object> literal);
168 166
169 int DefineDeoptimizationLiteral(Handle<Object> literal) { 167 void PopulateDeoptimizationLiteralsWithInlinedFunctions();
170 UNIMPLEMENTED(); 168
171 return 0; 169 Register ToRegister(int index) const;
172 } 170 XMMRegister ToDoubleRegister(int index) const;
173 void PopulateDeoptimizationLiteralsWithInlinedFunctions() { UNIMPLEMENTED(); } 171 Register ToRegister(LOperand* op) const;
172 XMMRegister ToDoubleRegister(LOperand* op) const;
173 int ToInteger32(LConstantOperand* op) const;
174 Operand ToOperand(LOperand* op) const;
175
176 // Specific math operations - used from DoUnaryMathOperation.
177 void DoMathAbs(LUnaryMathOperation* instr);
178 void DoMathFloor(LUnaryMathOperation* instr);
179 void DoMathRound(LUnaryMathOperation* instr);
180 void DoMathSqrt(LUnaryMathOperation* instr);
181 void DoMathPowHalf(LUnaryMathOperation* instr);
182 void DoMathLog(LUnaryMathOperation* instr);
183 void DoMathCos(LUnaryMathOperation* instr);
184 void DoMathSin(LUnaryMathOperation* instr);
185
186 // Support for recording safepoint and position information.
187 void RecordSafepoint(LPointerMap* pointers, int deoptimization_index);
188 void RecordSafepointWithRegisters(LPointerMap* pointers,
189 int arguments,
190 int deoptimization_index);
191 void RecordPosition(int position);
192
193 static Condition TokenToCondition(Token::Value op, bool is_unsigned);
194 void EmitGoto(int block, LDeferredCode* deferred_stack_check = NULL);
195 void EmitBranch(int left_block, int right_block, Condition cc);
196 void EmitCmpI(LOperand* left, LOperand* right);
197 void EmitNumberUntagD(Register input, XMMRegister result, LEnvironment* env);
198
199 // Emits optimized code for typeof x == "y". Modifies input register.
200 // Returns the condition on which a final split to
201 // true and false label should be made, to optimize fallthrough.
202 Condition EmitTypeofIs(Label* true_label, Label* false_label,
203 Register input, Handle<String> type_name);
204
205 // Emits optimized code for %_IsObject(x). Preserves input register.
206 // Returns the condition on which a final split to
207 // true and false label should be made, to optimize fallthrough.
208 Condition EmitIsObject(Register input,
209 Register temp1,
210 Register temp2,
211 Label* is_not_object,
212 Label* is_object);
174 213
175 LChunk* const chunk_; 214 LChunk* const chunk_;
176 MacroAssembler* const masm_; 215 MacroAssembler* const masm_;
177 CompilationInfo* const info_; 216 CompilationInfo* const info_;
178 217
179 int current_block_; 218 int current_block_;
180 int current_instruction_; 219 int current_instruction_;
181 const ZoneList<LInstruction*>* instructions_; 220 const ZoneList<LInstruction*>* instructions_;
182 ZoneList<LEnvironment*> deoptimizations_; 221 ZoneList<LEnvironment*> deoptimizations_;
183 ZoneList<Handle<Object> > deoptimization_literals_; 222 ZoneList<Handle<Object> > deoptimization_literals_;
184 int inlined_function_count_; 223 int inlined_function_count_;
185 Scope* const scope_; 224 Scope* const scope_;
186 Status status_; 225 Status status_;
187 TranslationBuffer translations_; 226 TranslationBuffer translations_;
188 ZoneList<LDeferredCode*> deferred_; 227 ZoneList<LDeferredCode*> deferred_;
189 int osr_pc_offset_; 228 int osr_pc_offset_;
190 229
191 // Builder that keeps track of safepoints in the code. The table 230 // Builder that keeps track of safepoints in the code. The table
192 // itself is emitted at the end of the generated code. 231 // itself is emitted at the end of the generated code.
193 SafepointTableBuilder safepoints_; 232 SafepointTableBuilder safepoints_;
194 233
234 // Compiler from a set of parallel moves to a sequential list of moves.
235 LGapResolver resolver_;
236
195 friend class LDeferredCode; 237 friend class LDeferredCode;
196 friend class LEnvironment; 238 friend class LEnvironment;
197 friend class SafepointGenerator; 239 friend class SafepointGenerator;
198 DISALLOW_COPY_AND_ASSIGN(LCodeGen); 240 DISALLOW_COPY_AND_ASSIGN(LCodeGen);
199 }; 241 };
200 242
201 243
202 class LDeferredCode: public ZoneObject { 244 class LDeferredCode: public ZoneObject {
203 public: 245 public:
204 explicit LDeferredCode(LCodeGen* codegen) 246 explicit LDeferredCode(LCodeGen* codegen)
(...skipping 15 matching lines...) Expand all
220 private: 262 private:
221 LCodeGen* codegen_; 263 LCodeGen* codegen_;
222 Label entry_; 264 Label entry_;
223 Label exit_; 265 Label exit_;
224 Label* external_exit_; 266 Label* external_exit_;
225 }; 267 };
226 268
227 } } // namespace v8::internal 269 } } // namespace v8::internal
228 270
229 #endif // V8_X64_LITHIUM_CODEGEN_X64_H_ 271 #endif // V8_X64_LITHIUM_CODEGEN_X64_H_
OLDNEW
« no previous file with comments | « src/x64/assembler-x64.cc ('k') | src/x64/lithium-codegen-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698