OLD | NEW |
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_CRANKSHAFT_PPC_LITHIUM_CODEGEN_PPC_H_ | 5 #ifndef V8_CRANKSHAFT_S390_LITHIUM_CODEGEN_S390_H_ |
6 #define V8_CRANKSHAFT_PPC_LITHIUM_CODEGEN_PPC_H_ | 6 #define V8_CRANKSHAFT_S390_LITHIUM_CODEGEN_S390_H_ |
7 | 7 |
8 #include "src/ast/scopes.h" | 8 #include "src/ast/scopes.h" |
9 #include "src/crankshaft/lithium-codegen.h" | 9 #include "src/crankshaft/lithium-codegen.h" |
10 #include "src/crankshaft/ppc/lithium-gap-resolver-ppc.h" | 10 #include "src/crankshaft/s390/lithium-gap-resolver-s390.h" |
11 #include "src/crankshaft/ppc/lithium-ppc.h" | 11 #include "src/crankshaft/s390/lithium-s390.h" |
12 #include "src/deoptimizer.h" | 12 #include "src/deoptimizer.h" |
13 #include "src/safepoint-table.h" | 13 #include "src/safepoint-table.h" |
14 #include "src/utils.h" | 14 #include "src/utils.h" |
15 | 15 |
16 namespace v8 { | 16 namespace v8 { |
17 namespace internal { | 17 namespace internal { |
18 | 18 |
19 // Forward declarations. | 19 // Forward declarations. |
20 class LDeferredCode; | 20 class LDeferredCode; |
21 class SafepointGenerator; | 21 class SafepointGenerator; |
22 | 22 |
23 class LCodeGen : public LCodeGenBase { | 23 class LCodeGen : public LCodeGenBase { |
24 public: | 24 public: |
25 LCodeGen(LChunk* chunk, MacroAssembler* assembler, CompilationInfo* info) | 25 LCodeGen(LChunk* chunk, MacroAssembler* assembler, CompilationInfo* info) |
26 : LCodeGenBase(chunk, assembler, info), | 26 : LCodeGenBase(chunk, assembler, info), |
27 jump_table_(4, info->zone()), | 27 jump_table_(4, info->zone()), |
28 scope_(info->scope()), | 28 scope_(info->scope()), |
29 deferred_(8, info->zone()), | 29 deferred_(8, info->zone()), |
30 frame_is_built_(false), | 30 frame_is_built_(false), |
31 safepoints_(info->zone()), | 31 safepoints_(info->zone()), |
32 resolver_(this), | 32 resolver_(this), |
33 expected_safepoint_kind_(Safepoint::kSimple) { | 33 expected_safepoint_kind_(Safepoint::kSimple) { |
34 PopulateDeoptimizationLiteralsWithInlinedFunctions(); | 34 PopulateDeoptimizationLiteralsWithInlinedFunctions(); |
35 } | 35 } |
36 | 36 |
37 | |
38 int LookupDestination(int block_id) const { | 37 int LookupDestination(int block_id) const { |
39 return chunk()->LookupDestination(block_id); | 38 return chunk()->LookupDestination(block_id); |
40 } | 39 } |
41 | 40 |
42 bool IsNextEmittedBlock(int block_id) const { | 41 bool IsNextEmittedBlock(int block_id) const { |
43 return LookupDestination(block_id) == GetNextEmittedBlock(); | 42 return LookupDestination(block_id) == GetNextEmittedBlock(); |
44 } | 43 } |
45 | 44 |
46 bool NeedsEagerFrame() const { | 45 bool NeedsEagerFrame() const { |
47 return HasAllocatedStackSlots() || info()->is_non_deferred_calling() || | 46 return HasAllocatedStackSlots() || info()->is_non_deferred_calling() || |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 int* object_index_pointer, | 215 int* object_index_pointer, |
217 int* dematerialized_index_pointer); | 216 int* dematerialized_index_pointer); |
218 | 217 |
219 Register ToRegister(int index) const; | 218 Register ToRegister(int index) const; |
220 DoubleRegister ToDoubleRegister(int index) const; | 219 DoubleRegister ToDoubleRegister(int index) const; |
221 | 220 |
222 MemOperand BuildSeqStringOperand(Register string, LOperand* index, | 221 MemOperand BuildSeqStringOperand(Register string, LOperand* index, |
223 String::Encoding encoding); | 222 String::Encoding encoding); |
224 | 223 |
225 void EmitMathAbs(LMathAbs* instr); | 224 void EmitMathAbs(LMathAbs* instr); |
226 #if V8_TARGET_ARCH_PPC64 | 225 #if V8_TARGET_ARCH_S390X |
227 void EmitInteger32MathAbs(LMathAbs* instr); | 226 void EmitInteger32MathAbs(LMathAbs* instr); |
228 #endif | 227 #endif |
229 | 228 |
230 // Support for recording safepoint and position information. | 229 // Support for recording safepoint and position information. |
231 void RecordSafepoint(LPointerMap* pointers, Safepoint::Kind kind, | 230 void RecordSafepoint(LPointerMap* pointers, Safepoint::Kind kind, |
232 int arguments, Safepoint::DeoptMode mode); | 231 int arguments, Safepoint::DeoptMode mode); |
233 void RecordSafepoint(LPointerMap* pointers, Safepoint::DeoptMode mode); | 232 void RecordSafepoint(LPointerMap* pointers, Safepoint::DeoptMode mode); |
234 void RecordSafepoint(Safepoint::DeoptMode mode); | 233 void RecordSafepoint(Safepoint::DeoptMode mode); |
235 void RecordSafepointWithRegisters(LPointerMap* pointers, int arguments, | 234 void RecordSafepointWithRegisters(LPointerMap* pointers, int arguments, |
236 Safepoint::DeoptMode mode); | 235 Safepoint::DeoptMode mode); |
237 | 236 |
238 void RecordAndWritePosition(int position) override; | 237 void RecordAndWritePosition(int position) override; |
239 | 238 |
240 static Condition TokenToCondition(Token::Value op); | 239 static Condition TokenToCondition(Token::Value op); |
241 void EmitGoto(int block); | 240 void EmitGoto(int block); |
242 | 241 |
243 // EmitBranch expects to be the last instruction of a block. | 242 // EmitBranch expects to be the last instruction of a block. |
244 template <class InstrType> | 243 template <class InstrType> |
245 void EmitBranch(InstrType instr, Condition condition, CRegister cr = cr7); | 244 void EmitBranch(InstrType instr, Condition condition); |
246 template <class InstrType> | 245 template <class InstrType> |
247 void EmitTrueBranch(InstrType instr, Condition condition, CRegister cr = cr7); | 246 void EmitTrueBranch(InstrType instr, Condition condition); |
248 template <class InstrType> | 247 template <class InstrType> |
249 void EmitFalseBranch(InstrType instr, Condition condition, | 248 void EmitFalseBranch(InstrType instr, Condition condition); |
250 CRegister cr = cr7); | |
251 void EmitNumberUntagD(LNumberUntagD* instr, Register input, | 249 void EmitNumberUntagD(LNumberUntagD* instr, Register input, |
252 DoubleRegister result, NumberUntagDMode mode); | 250 DoubleRegister result, NumberUntagDMode mode); |
253 | 251 |
254 // Emits optimized code for typeof x == "y". Modifies input register. | 252 // Emits optimized code for typeof x == "y". Modifies input register. |
255 // Returns the condition on which a final split to | 253 // Returns the condition on which a final split to |
256 // true and false label should be made, to optimize fallthrough. | 254 // true and false label should be made, to optimize fallthrough. |
257 Condition EmitTypeofIs(Label* true_label, Label* false_label, Register input, | 255 Condition EmitTypeofIs(Label* true_label, Label* false_label, Register input, |
258 Handle<String> type_name); | 256 Handle<String> type_name); |
259 | 257 |
260 // Emits optimized code for %_IsString(x). Preserves input register. | 258 // Emits optimized code for %_IsString(x). Preserves input register. |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
316 private: | 314 private: |
317 LCodeGen* codegen_; | 315 LCodeGen* codegen_; |
318 }; | 316 }; |
319 | 317 |
320 friend class LDeferredCode; | 318 friend class LDeferredCode; |
321 friend class LEnvironment; | 319 friend class LEnvironment; |
322 friend class SafepointGenerator; | 320 friend class SafepointGenerator; |
323 DISALLOW_COPY_AND_ASSIGN(LCodeGen); | 321 DISALLOW_COPY_AND_ASSIGN(LCodeGen); |
324 }; | 322 }; |
325 | 323 |
326 | |
327 class LDeferredCode : public ZoneObject { | 324 class LDeferredCode : public ZoneObject { |
328 public: | 325 public: |
329 explicit LDeferredCode(LCodeGen* codegen) | 326 explicit LDeferredCode(LCodeGen* codegen) |
330 : codegen_(codegen), | 327 : codegen_(codegen), |
331 external_exit_(NULL), | 328 external_exit_(NULL), |
332 instruction_index_(codegen->current_instruction_) { | 329 instruction_index_(codegen->current_instruction_) { |
333 codegen->AddDeferredCode(this); | 330 codegen->AddDeferredCode(this); |
334 } | 331 } |
335 | 332 |
336 virtual ~LDeferredCode() {} | 333 virtual ~LDeferredCode() {} |
(...skipping 12 matching lines...) Expand all Loading... |
349 private: | 346 private: |
350 LCodeGen* codegen_; | 347 LCodeGen* codegen_; |
351 Label entry_; | 348 Label entry_; |
352 Label exit_; | 349 Label exit_; |
353 Label* external_exit_; | 350 Label* external_exit_; |
354 int instruction_index_; | 351 int instruction_index_; |
355 }; | 352 }; |
356 } // namespace internal | 353 } // namespace internal |
357 } // namespace v8 | 354 } // namespace v8 |
358 | 355 |
359 #endif // V8_CRANKSHAFT_PPC_LITHIUM_CODEGEN_PPC_H_ | 356 #endif // V8_CRANKSHAFT_S390_LITHIUM_CODEGEN_S390_H_ |
OLD | NEW |