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> | |
JoranSiu
2016/03/31 13:27:57
Not sure if this needs to be a template function,
bcleung
2016/03/31 19:12:39
This function will be used with unsigned int input
| |
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 | |
414 // We get down here only for floating point | |
JoranSiu
2016/03/31 13:27:57
Are there any floating point operations that would
bcleung
2016/03/31 19:12:39
According to principles of operation, no floating-
| |
415 // comparisons and the values are unordered | |
416 // i.e. NaN | |
417 if (condition_reg_ == 0) condition_reg_ = unordered; | |
418 } | |
419 | |
398 bool isNaN(double value) { return (value != value); } | 420 bool isNaN(double value) { return (value != value); } |
399 | 421 |
400 // Set the condition code for bitwise operations | 422 // Set the condition code for bitwise operations |
401 // CC0 is set if value == 0. | 423 // CC0 is set if value == 0. |
402 // CC1 is set if value != 0. | 424 // CC1 is set if value != 0. |
403 // CC2/CC3 are not set. | 425 // CC2/CC3 are not set. |
404 template <typename T> | 426 template <typename T> |
405 void SetS390BitWiseConditionCode(T value) { | 427 void SetS390BitWiseConditionCode(T value) { |
406 condition_reg_ = 0; | 428 condition_reg_ = 0; |
407 | 429 |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
525 static inline void UnregisterCTryCatch(v8::internal::Isolate* isolate) { | 547 static inline void UnregisterCTryCatch(v8::internal::Isolate* isolate) { |
526 Simulator::current(isolate)->PopAddress(); | 548 Simulator::current(isolate)->PopAddress(); |
527 } | 549 } |
528 }; | 550 }; |
529 | 551 |
530 } // namespace internal | 552 } // namespace internal |
531 } // namespace v8 | 553 } // namespace v8 |
532 | 554 |
533 #endif // !defined(USE_SIMULATOR) | 555 #endif // !defined(USE_SIMULATOR) |
534 #endif // V8_S390_SIMULATOR_S390_H_ | 556 #endif // V8_S390_SIMULATOR_S390_H_ |
OLD | NEW |