OLD | NEW |
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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 current_instruction_(-1), | 51 current_instruction_(-1), |
52 instructions_(chunk->instructions()), | 52 instructions_(chunk->instructions()), |
53 deoptimizations_(4), | 53 deoptimizations_(4), |
54 deopt_jump_table_(4), | 54 deopt_jump_table_(4), |
55 deoptimization_literals_(8), | 55 deoptimization_literals_(8), |
56 inlined_function_count_(0), | 56 inlined_function_count_(0), |
57 scope_(info->scope()), | 57 scope_(info->scope()), |
58 status_(UNUSED), | 58 status_(UNUSED), |
59 deferred_(8), | 59 deferred_(8), |
60 osr_pc_offset_(-1), | 60 osr_pc_offset_(-1), |
| 61 last_lazy_deopt_pc_(0), |
61 resolver_(this), | 62 resolver_(this), |
62 expected_safepoint_kind_(Safepoint::kSimple) { | 63 expected_safepoint_kind_(Safepoint::kSimple) { |
63 PopulateDeoptimizationLiteralsWithInlinedFunctions(); | 64 PopulateDeoptimizationLiteralsWithInlinedFunctions(); |
64 } | 65 } |
65 | 66 |
66 | 67 |
67 // Simple accessors. | 68 // Simple accessors. |
68 MacroAssembler* masm() const { return masm_; } | 69 MacroAssembler* masm() const { return masm_; } |
69 CompilationInfo* info() const { return info_; } | 70 CompilationInfo* info() const { return info_; } |
70 Isolate* isolate() const { return info_->isolate(); } | 71 Isolate* isolate() const { return info_->isolate(); } |
(...skipping 23 matching lines...) Expand all Loading... |
94 | 95 |
95 // Try to generate code for the entire chunk, but it may fail if the | 96 // Try to generate code for the entire chunk, but it may fail if the |
96 // chunk contains constructs we cannot handle. Returns true if the | 97 // chunk contains constructs we cannot handle. Returns true if the |
97 // code generation attempt succeeded. | 98 // code generation attempt succeeded. |
98 bool GenerateCode(); | 99 bool GenerateCode(); |
99 | 100 |
100 // Finish the code by setting stack height, safepoint, and bailout | 101 // Finish the code by setting stack height, safepoint, and bailout |
101 // information on it. | 102 // information on it. |
102 void FinishCode(Handle<Code> code); | 103 void FinishCode(Handle<Code> code); |
103 | 104 |
104 // Deferred code support. | |
105 template<int T> | |
106 void DoDeferredBinaryOpStub(LTemplateInstruction<1, 2, T>* instr, | |
107 Token::Value op); | |
108 void DoDeferredNumberTagD(LNumberTagD* instr); | 105 void DoDeferredNumberTagD(LNumberTagD* instr); |
109 void DoDeferredNumberTagI(LNumberTagI* instr); | 106 void DoDeferredNumberTagI(LNumberTagI* instr); |
110 void DoDeferredTaggedToI(LTaggedToI* instr); | 107 void DoDeferredTaggedToI(LTaggedToI* instr); |
111 void DoDeferredMathAbsTaggedHeapNumber(LUnaryMathOperation* instr); | 108 void DoDeferredMathAbsTaggedHeapNumber(LUnaryMathOperation* instr); |
112 void DoDeferredStackCheck(LStackCheck* instr); | 109 void DoDeferredStackCheck(LStackCheck* instr); |
113 void DoDeferredStringCharCodeAt(LStringCharCodeAt* instr); | 110 void DoDeferredStringCharCodeAt(LStringCharCodeAt* instr); |
114 void DoDeferredStringCharFromCode(LStringCharFromCode* instr); | 111 void DoDeferredStringCharFromCode(LStringCharFromCode* instr); |
115 void DoDeferredLInstanceOfKnownGlobal(LInstanceOfKnownGlobal* instr, | 112 void DoDeferredInstanceOfKnownGlobal(LInstanceOfKnownGlobal* instr, |
116 Label* map_check); | 113 Label* map_check); |
117 | 114 |
118 // Parallel move support. | 115 // Parallel move support. |
119 void DoParallelMove(LParallelMove* move); | 116 void DoParallelMove(LParallelMove* move); |
120 void DoGap(LGap* instr); | 117 void DoGap(LGap* instr); |
121 | 118 |
122 // Emit frame translation commands for an environment. | 119 // Emit frame translation commands for an environment. |
123 void WriteTranslation(LEnvironment* environment, Translation* translation); | 120 void WriteTranslation(LEnvironment* environment, Translation* translation); |
124 | 121 |
125 // Declare methods that deal with the individual node types. | 122 // Declare methods that deal with the individual node types. |
126 #define DECLARE_DO(type) void Do##type(L##type* node); | 123 #define DECLARE_DO(type) void Do##type(L##type* node); |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 | 206 |
210 // Generate a direct call to a known function. Expects the function | 207 // Generate a direct call to a known function. Expects the function |
211 // to be in a1. | 208 // to be in a1. |
212 void CallKnownFunction(Handle<JSFunction> function, | 209 void CallKnownFunction(Handle<JSFunction> function, |
213 int arity, | 210 int arity, |
214 LInstruction* instr, | 211 LInstruction* instr, |
215 CallKind call_kind); | 212 CallKind call_kind); |
216 | 213 |
217 void LoadHeapObject(Register result, Handle<HeapObject> object); | 214 void LoadHeapObject(Register result, Handle<HeapObject> object); |
218 | 215 |
219 void RegisterLazyDeoptimization(LInstruction* instr, | 216 void RecordSafepointWithLazyDeopt(LInstruction* instr, |
220 SafepointMode safepoint_mode); | 217 SafepointMode safepoint_mode); |
221 | 218 |
222 void RegisterEnvironmentForDeoptimization(LEnvironment* environment); | 219 void RegisterEnvironmentForDeoptimization(LEnvironment* environment, |
| 220 Safepoint::DeoptMode mode); |
223 void DeoptimizeIf(Condition cc, | 221 void DeoptimizeIf(Condition cc, |
224 LEnvironment* environment, | 222 LEnvironment* environment, |
225 Register src1, | 223 Register src1, |
226 const Operand& src2); | 224 const Operand& src2); |
227 | 225 |
228 void AddToTranslation(Translation* translation, | 226 void AddToTranslation(Translation* translation, |
229 LOperand* op, | 227 LOperand* op, |
230 bool is_tagged); | 228 bool is_tagged); |
231 void PopulateDeoptimizationData(Handle<Code> code); | 229 void PopulateDeoptimizationData(Handle<Code> code); |
232 int DefineDeoptimizationLiteral(Handle<Object> literal); | 230 int DefineDeoptimizationLiteral(Handle<Object> literal); |
(...skipping 11 matching lines...) Expand all Loading... |
244 void DoMathSqrt(LUnaryMathOperation* instr); | 242 void DoMathSqrt(LUnaryMathOperation* instr); |
245 void DoMathPowHalf(LUnaryMathOperation* instr); | 243 void DoMathPowHalf(LUnaryMathOperation* instr); |
246 void DoMathLog(LUnaryMathOperation* instr); | 244 void DoMathLog(LUnaryMathOperation* instr); |
247 void DoMathCos(LUnaryMathOperation* instr); | 245 void DoMathCos(LUnaryMathOperation* instr); |
248 void DoMathSin(LUnaryMathOperation* instr); | 246 void DoMathSin(LUnaryMathOperation* instr); |
249 | 247 |
250 // Support for recording safepoint and position information. | 248 // Support for recording safepoint and position information. |
251 void RecordSafepoint(LPointerMap* pointers, | 249 void RecordSafepoint(LPointerMap* pointers, |
252 Safepoint::Kind kind, | 250 Safepoint::Kind kind, |
253 int arguments, | 251 int arguments, |
254 int deoptimization_index); | 252 Safepoint::DeoptMode mode); |
255 void RecordSafepoint(LPointerMap* pointers, int deoptimization_index); | 253 void RecordSafepoint(LPointerMap* pointers, Safepoint::DeoptMode mode); |
256 void RecordSafepoint(int deoptimization_index); | 254 void RecordSafepoint(Safepoint::DeoptMode mode); |
257 void RecordSafepointWithRegisters(LPointerMap* pointers, | 255 void RecordSafepointWithRegisters(LPointerMap* pointers, |
258 int arguments, | 256 int arguments, |
259 int deoptimization_index); | 257 Safepoint::DeoptMode mode); |
260 void RecordSafepointWithRegistersAndDoubles(LPointerMap* pointers, | 258 void RecordSafepointWithRegistersAndDoubles(LPointerMap* pointers, |
261 int arguments, | 259 int arguments, |
262 int deoptimization_index); | 260 Safepoint::DeoptMode mode); |
263 void RecordPosition(int position); | 261 void RecordPosition(int position); |
264 int LastSafepointEnd() { | |
265 return static_cast<int>(safepoints_.GetPcAfterGap()); | |
266 } | |
267 | 262 |
268 static Condition TokenToCondition(Token::Value op, bool is_unsigned); | 263 static Condition TokenToCondition(Token::Value op, bool is_unsigned); |
269 void EmitGoto(int block); | 264 void EmitGoto(int block); |
270 void EmitBranch(int left_block, | 265 void EmitBranch(int left_block, |
271 int right_block, | 266 int right_block, |
272 Condition cc, | 267 Condition cc, |
273 Register src1, | 268 Register src1, |
274 const Operand& src2); | 269 const Operand& src2); |
275 void EmitBranchF(int left_block, | 270 void EmitBranchF(int left_block, |
276 int right_block, | 271 int right_block, |
(...skipping 16 matching lines...) Expand all Loading... |
293 Register input, | 288 Register input, |
294 Handle<String> type_name, | 289 Handle<String> type_name, |
295 Register& cmp1, | 290 Register& cmp1, |
296 Operand& cmp2); | 291 Operand& cmp2); |
297 | 292 |
298 // Emits optimized code for %_IsObject(x). Preserves input register. | 293 // Emits optimized code for %_IsObject(x). Preserves input register. |
299 // Returns the condition on which a final split to | 294 // Returns the condition on which a final split to |
300 // true and false label should be made, to optimize fallthrough. | 295 // true and false label should be made, to optimize fallthrough. |
301 Condition EmitIsObject(Register input, | 296 Condition EmitIsObject(Register input, |
302 Register temp1, | 297 Register temp1, |
| 298 Register temp2, |
303 Label* is_not_object, | 299 Label* is_not_object, |
304 Label* is_object); | 300 Label* is_object); |
305 | 301 |
306 // Emits optimized code for %_IsConstructCall(). | 302 // Emits optimized code for %_IsConstructCall(). |
307 // Caller should branch on equal condition. | 303 // Caller should branch on equal condition. |
308 void EmitIsConstructCall(Register temp1, Register temp2); | 304 void EmitIsConstructCall(Register temp1, Register temp2); |
309 | 305 |
310 void EmitLoadFieldOrConstantFunction(Register result, | 306 void EmitLoadFieldOrConstantFunction(Register result, |
311 Register object, | 307 Register object, |
312 Handle<Map> type, | 308 Handle<Map> type, |
313 Handle<String> name); | 309 Handle<String> name); |
314 | 310 |
315 struct JumpTableEntry { | 311 struct JumpTableEntry { |
316 explicit inline JumpTableEntry(Address entry) | 312 explicit inline JumpTableEntry(Address entry) |
317 : label(), | 313 : label(), |
318 address(entry) { } | 314 address(entry) { } |
319 Label label; | 315 Label label; |
320 Address address; | 316 Address address; |
321 }; | 317 }; |
322 | 318 |
| 319 void EnsureSpaceForLazyDeopt(); |
| 320 |
323 LChunk* const chunk_; | 321 LChunk* const chunk_; |
324 MacroAssembler* const masm_; | 322 MacroAssembler* const masm_; |
325 CompilationInfo* const info_; | 323 CompilationInfo* const info_; |
326 | 324 |
327 int current_block_; | 325 int current_block_; |
328 int current_instruction_; | 326 int current_instruction_; |
329 const ZoneList<LInstruction*>* instructions_; | 327 const ZoneList<LInstruction*>* instructions_; |
330 ZoneList<LEnvironment*> deoptimizations_; | 328 ZoneList<LEnvironment*> deoptimizations_; |
331 ZoneList<JumpTableEntry> deopt_jump_table_; | 329 ZoneList<JumpTableEntry> deopt_jump_table_; |
332 ZoneList<Handle<Object> > deoptimization_literals_; | 330 ZoneList<Handle<Object> > deoptimization_literals_; |
333 int inlined_function_count_; | 331 int inlined_function_count_; |
334 Scope* const scope_; | 332 Scope* const scope_; |
335 Status status_; | 333 Status status_; |
336 TranslationBuffer translations_; | 334 TranslationBuffer translations_; |
337 ZoneList<LDeferredCode*> deferred_; | 335 ZoneList<LDeferredCode*> deferred_; |
338 int osr_pc_offset_; | 336 int osr_pc_offset_; |
| 337 int last_lazy_deopt_pc_; |
339 | 338 |
340 // Builder that keeps track of safepoints in the code. The table | 339 // Builder that keeps track of safepoints in the code. The table |
341 // itself is emitted at the end of the generated code. | 340 // itself is emitted at the end of the generated code. |
342 SafepointTableBuilder safepoints_; | 341 SafepointTableBuilder safepoints_; |
343 | 342 |
344 // Compiler from a set of parallel moves to a sequential list of moves. | 343 // Compiler from a set of parallel moves to a sequential list of moves. |
345 LGapResolver resolver_; | 344 LGapResolver resolver_; |
346 | 345 |
347 Safepoint::Kind expected_safepoint_kind_; | 346 Safepoint::Kind expected_safepoint_kind_; |
348 | 347 |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
419 LCodeGen* codegen_; | 418 LCodeGen* codegen_; |
420 Label entry_; | 419 Label entry_; |
421 Label exit_; | 420 Label exit_; |
422 Label* external_exit_; | 421 Label* external_exit_; |
423 int instruction_index_; | 422 int instruction_index_; |
424 }; | 423 }; |
425 | 424 |
426 } } // namespace v8::internal | 425 } } // namespace v8::internal |
427 | 426 |
428 #endif // V8_MIPS_LITHIUM_CODEGEN_MIPS_H_ | 427 #endif // V8_MIPS_LITHIUM_CODEGEN_MIPS_H_ |
OLD | NEW |