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 // Declares a Simulator for S390 instructions if we are not generating a native | 5 // Declares a Simulator for S390 instructions if we are not generating a native |
6 // S390 binary. This Simulator allows us to run and debug S390 code generation | 6 // S390 binary. This Simulator allows us to run and debug S390 code generation |
7 // on regular desktop machines. | 7 // on regular desktop machines. |
8 // V8 calls into generated code by "calling" the CALL_GENERATED_CODE macro, | 8 // V8 calls into generated code by "calling" the CALL_GENERATED_CODE macro, |
9 // which will start execution in the Simulator or forwards to the real entry | 9 // which will start execution in the Simulator or forwards to the real entry |
10 // on a S390 hardware platform. | 10 // on a S390 hardware platform. |
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
302 | 302 |
303 inline int64_t ReadDW(intptr_t addr); | 303 inline int64_t ReadDW(intptr_t addr); |
304 inline double ReadDouble(intptr_t addr); | 304 inline double ReadDouble(intptr_t addr); |
305 inline void WriteDW(intptr_t addr, int64_t value); | 305 inline void WriteDW(intptr_t addr, int64_t value); |
306 | 306 |
307 // S390 | 307 // S390 |
308 void Trace(Instruction* instr); | 308 void Trace(Instruction* instr); |
309 bool DecodeTwoByte(Instruction* instr); | 309 bool DecodeTwoByte(Instruction* instr); |
310 bool DecodeFourByte(Instruction* instr); | 310 bool DecodeFourByte(Instruction* instr); |
311 bool DecodeFourByteArithmetic(Instruction* instr); | 311 bool DecodeFourByteArithmetic(Instruction* instr); |
| 312 bool DecodeFourByteArithmetic64Bit(Instruction* instr); |
312 bool DecodeFourByteFloatingPoint(Instruction* instr); | 313 bool DecodeFourByteFloatingPoint(Instruction* instr); |
313 void DecodeFourByteFloatingPointIntConversion(Instruction* instr); | 314 void DecodeFourByteFloatingPointIntConversion(Instruction* instr); |
314 void DecodeFourByteFloatingPointRound(Instruction* instr); | 315 void DecodeFourByteFloatingPointRound(Instruction* instr); |
315 | 316 |
316 bool DecodeSixByte(Instruction* instr); | 317 bool DecodeSixByte(Instruction* instr); |
317 bool DecodeSixByteArithmetic(Instruction* instr); | 318 bool DecodeSixByteArithmetic(Instruction* instr); |
318 bool S390InstructionDecode(Instruction* instr); | 319 bool S390InstructionDecode(Instruction* instr); |
319 void DecodeSixByteBitShift(Instruction* instr); | 320 void DecodeSixByteBitShift(Instruction* instr); |
320 | 321 |
321 // Used by the CL**BR instructions. | 322 // Used by the CL**BR instructions. |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
388 } else if (lhs > rhs) { | 389 } else if (lhs > rhs) { |
389 condition_reg_ |= CC_GT; | 390 condition_reg_ |= CC_GT; |
390 } | 391 } |
391 | 392 |
392 // We get down here only for floating point | 393 // We get down here only for floating point |
393 // comparisons and the values are unordered | 394 // comparisons and the values are unordered |
394 // i.e. NaN | 395 // i.e. NaN |
395 if (condition_reg_ == 0) condition_reg_ = unordered; | 396 if (condition_reg_ == 0) condition_reg_ = unordered; |
396 } | 397 } |
397 | 398 |
| 399 // Used by arithmetic operations that use carry. |
| 400 template <typename T> |
| 401 void SetS390ConditionCodeCarry(T result, bool overflow) { |
| 402 condition_reg_ = 0; |
| 403 bool zero_result = (result == static_cast<T>(0)); |
| 404 if (zero_result && !overflow) { |
| 405 condition_reg_ |= 8; |
| 406 } else if (!zero_result && !overflow) { |
| 407 condition_reg_ |= 4; |
| 408 } else if (zero_result && overflow) { |
| 409 condition_reg_ |= 2; |
| 410 } else if (!zero_result && overflow) { |
| 411 condition_reg_ |= 1; |
| 412 } |
| 413 if (condition_reg_ == 0) UNREACHABLE(); |
| 414 } |
| 415 |
398 bool isNaN(double value) { return (value != value); } | 416 bool isNaN(double value) { return (value != value); } |
399 | 417 |
400 // Set the condition code for bitwise operations | 418 // Set the condition code for bitwise operations |
401 // CC0 is set if value == 0. | 419 // CC0 is set if value == 0. |
402 // CC1 is set if value != 0. | 420 // CC1 is set if value != 0. |
403 // CC2/CC3 are not set. | 421 // CC2/CC3 are not set. |
404 template <typename T> | 422 template <typename T> |
405 void SetS390BitWiseConditionCode(T value) { | 423 void SetS390BitWiseConditionCode(T value) { |
406 condition_reg_ = 0; | 424 condition_reg_ = 0; |
407 | 425 |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
525 static inline void UnregisterCTryCatch(v8::internal::Isolate* isolate) { | 543 static inline void UnregisterCTryCatch(v8::internal::Isolate* isolate) { |
526 Simulator::current(isolate)->PopAddress(); | 544 Simulator::current(isolate)->PopAddress(); |
527 } | 545 } |
528 }; | 546 }; |
529 | 547 |
530 } // namespace internal | 548 } // namespace internal |
531 } // namespace v8 | 549 } // namespace v8 |
532 | 550 |
533 #endif // !defined(USE_SIMULATOR) | 551 #endif // !defined(USE_SIMULATOR) |
534 #endif // V8_S390_SIMULATOR_S390_H_ | 552 #endif // V8_S390_SIMULATOR_S390_H_ |
OLD | NEW |