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 3 // found in the LICENSE file. 4 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 7 // on regular desktop machines. 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 10 // on a S390 hardware platform. 11 12 #ifndef V8_S390_SIMULATOR_S390_H_ 13 #define V8_S390_SIMULATOR_S390_H_ 14 15 #include "src/allocation.h" 16 17 #if !defined(USE_SIMULATOR) 18 // Running without a simulator on a native s390 platform. 19 20 namespace v8 { 21 namespace internal { 22 23 // When running without a simulator we call the entry directly. 24 #define CALL_GENERATED_CODE(isolate, entry, p0, p1, p2, p3, p4) \ 25 (entry(p0, p1, p2, p3, p4)) 26 27 typedef int (*s390_regexp_matcher)(String*, int, const byte*, const byte*, int*, 28 int, Address, int, void*, Isolate*); 29 30 // Call the generated regexp code directly. The code at the entry address 31 // should act as a function matching the type ppc_regexp_matcher. 32 // The ninth argument is a dummy that reserves the space used for 33 // the return address added by the ExitFrame in native calls. 34 #define CALL_GENERATED_REGEXP_CODE(isolate, entry, p0, p1, p2, p3, p4, p5, p6, \ 35 p7, p8) \ 36 (FUNCTION_CAST<s390_regexp_matcher>(entry)(p0, p1, p2, p3, p4, p5, p6, p7, \ 37 NULL, p8)) 38 39 // The stack limit beyond which we will throw stack overflow errors in 40 // generated code. Because generated code on s390 uses the C stack, we 41 // just use the C stack limit. 42 class SimulatorStack : public v8::internal::AllStatic { 43 public: 44 static inline uintptr_t JsLimitFromCLimit(v8::internal::Isolate* isolate, 45 uintptr_t c_limit) { 46 USE(isolate); 47 return c_limit; 48 } 49 50 static inline uintptr_t RegisterCTryCatch(v8::internal::Isolate* isolate, 51 uintptr_t try_catch_address) { 52 USE(isolate); 53 return try_catch_address; 54 } 55 56 static inline void UnregisterCTryCatch(v8::internal::Isolate* isolate) { 57 USE(isolate); 58 } 59 }; 60 } // namespace internal 61 } // namespace v8 62 63 #else // !defined(USE_SIMULATOR) 64 // Running with a simulator. 65 66 #include "src/assembler.h" 67 #include "src/base/hashmap.h" 68 #include "src/s390/constants-s390.h" 69 70 namespace v8 { 71 namespace internal { 72 73 class CachePage { 74 public: 75 static const int LINE_VALID = 0; 76 static const int LINE_INVALID = 1; 77 78 static const int kPageShift = 12; 79 static const int kPageSize = 1 << kPageShift; 80 static const int kPageMask = kPageSize - 1; 81 static const int kLineShift = 2; // The cache line is only 4 bytes right now. 82 static const int kLineLength = 1 << kLineShift; 83 static const int kLineMask = kLineLength - 1; 84 85 CachePage() { memset(&validity_map_, LINE_INVALID, sizeof(validity_map_)); } 86 87 char* ValidityByte(int offset) { 88 return &validity_map_[offset >> kLineShift]; 89 } 90 91 char* CachedData(int offset) { return &data_[offset]; } 92 93 private: 94 char data_[kPageSize]; // The cached data. 95 static const int kValidityMapSize = kPageSize >> kLineShift; 96 char validity_map_[kValidityMapSize]; // One byte per line. 97 }; 98 99 class Simulator { 100 public: 101 friend class S390Debugger; 102 enum Register { 103 no_reg = -1, 104 r0 = 0, 105 r1 = 1, 106 r2 = 2, 107 r3 = 3, 108 r4 = 4, 109 r5 = 5, 110 r6 = 6, 111 r7 = 7, 112 r8 = 8, 113 r9 = 9, 114 r10 = 10, 115 r11 = 11, 116 r12 = 12, 117 r13 = 13, 118 r14 = 14, 119 r15 = 15, 120 fp = r11, 121 ip = r12, 122 cp = r13, 123 ra = r14, 124 sp = r15, // name aliases 125 kNumGPRs = 16, 126 d0 = 0, 127 d1, 128 d2, 129 d3, 130 d4, 131 d5, 132 d6, 133 d7, 134 d8, 135 d9, 136 d10, 137 d11, 138 d12, 139 d13, 140 d14, 141 d15, 142 kNumFPRs = 16 143 }; 144 145 explicit Simulator(Isolate* isolate); 146 ~Simulator(); 147 148 // The currently executing Simulator instance. Potentially there can be one 149 // for each native thread. 150 static Simulator* current(v8::internal::Isolate* isolate); 151 152 // Accessors for register state. 153 void set_register(int reg, uint64_t value); 154 uint64_t get_register(int reg) const; 155 template <typename T> 156 T get_low_register(int reg) const; 157 template <typename T> 158 T get_high_register(int reg) const; 159 void set_low_register(int reg, uint32_t value); 160 void set_high_register(int reg, uint32_t value); 161 162 double get_double_from_register_pair(int reg); 163 void set_d_register_from_double(int dreg, const double dbl) { 164 DCHECK(dreg >= 0 && dreg < kNumFPRs); 165 *bit_cast<double*>(&fp_registers_[dreg]) = dbl; 166 } 167 168 double get_double_from_d_register(int dreg) { 169 DCHECK(dreg >= 0 && dreg < kNumFPRs); 170 return *bit_cast<double*>(&fp_registers_[dreg]); 171 } 172 void set_d_register(int dreg, int64_t value) { 173 DCHECK(dreg >= 0 && dreg < kNumFPRs); 174 fp_registers_[dreg] = value; 175 } 176 int64_t get_d_register(int dreg) { 177 DCHECK(dreg >= 0 && dreg < kNumFPRs); 178 return fp_registers_[dreg]; 179 } 180 181 void set_d_register_from_float32(int dreg, const float f) { 182 DCHECK(dreg >= 0 && dreg < kNumFPRs); 183 184 int32_t f_int = *bit_cast<int32_t*>(&f); 185 int64_t finalval = static_cast<int64_t>(f_int) << 32; 186 set_d_register(dreg, finalval); 187 } 188 189 float get_float32_from_d_register(int dreg) { 190 DCHECK(dreg >= 0 && dreg < kNumFPRs); 191 192 int64_t regval = get_d_register(dreg) >> 32; 193 int32_t regval32 = static_cast<int32_t>(regval); 194 return *bit_cast<float*>(®val32); 195 } 196 197 // Special case of set_register and get_register to access the raw PC value. 198 void set_pc(intptr_t value); 199 intptr_t get_pc() const; 200 201 Address get_sp() const { 202 return reinterpret_cast<Address>(static_cast<intptr_t>(get_register(sp))); 203 } 204 205 // Accessor to the internal simulator stack area. 206 uintptr_t StackLimit(uintptr_t c_limit) const; 207 208 // Executes S390 instructions until the PC reaches end_sim_pc. 209 void Execute(); 210 211 // Call on program start. 212 static void Initialize(Isolate* isolate); 213 214 static void TearDown(base::CustomMatcherHashMap* i_cache, Redirection* first); 215 216 // V8 generally calls into generated JS code with 5 parameters and into 217 // generated RegExp code with 7 parameters. This is a convenience function, 218 // which sets up the simulator state and grabs the result on return. 219 intptr_t Call(byte* entry, int argument_count, ...); 220 // Alternative: call a 2-argument double function. 221 void CallFP(byte* entry, double d0, double d1); 222 int32_t CallFPReturnsInt(byte* entry, double d0, double d1); 223 double CallFPReturnsDouble(byte* entry, double d0, double d1); 224 225 // Push an address onto the JS stack. 226 uintptr_t PushAddress(uintptr_t address); 227 228 // Pop an address from the JS stack. 229 uintptr_t PopAddress(); 230 231 // Debugger input. 232 void set_last_debugger_input(char* input); 233 char* last_debugger_input() { return last_debugger_input_; } 234 235 // ICache checking. 236 static void FlushICache(base::CustomMatcherHashMap* i_cache, void* start, 237 size_t size); 238 239 // Returns true if pc register contains one of the 'special_values' defined 240 // below (bad_lr, end_sim_pc). 241 bool has_bad_pc() const; 242 243 private: 244 enum special_values { 245 // Known bad pc value to ensure that the simulator does not execute 246 // without being properly setup. 247 bad_lr = -1, 248 // A pc value used to signal the simulator to stop execution. Generally 249 // the lr is set to this value on transition from native C code to 250 // simulated execution, so that the simulator can "return" to the native 251 // C code. 252 end_sim_pc = -2 253 }; 254 255 // Unsupported instructions use Format to print an error and stop execution. 256 void Format(Instruction* instr, const char* format); 257 258 // Helper functions to set the conditional flags in the architecture state. 259 bool CarryFrom(int32_t left, int32_t right, int32_t carry = 0); 260 bool BorrowFrom(int32_t left, int32_t right); 261 template <typename T1> 262 inline bool OverflowFromSigned(T1 alu_out, T1 left, T1 right, bool addition); 263 264 // Helper functions to decode common "addressing" modes 265 int32_t GetShiftRm(Instruction* instr, bool* carry_out); 266 int32_t GetImm(Instruction* instr, bool* carry_out); 267 void ProcessPUW(Instruction* instr, int num_regs, int operand_size, 268 intptr_t* start_address, intptr_t* end_address); 269 void HandleRList(Instruction* instr, bool load); 270 void HandleVList(Instruction* inst); 271 void SoftwareInterrupt(Instruction* instr); 272 273 // Stop helper functions. 274 inline bool isStopInstruction(Instruction* instr); 275 inline bool isWatchedStop(uint32_t bkpt_code); 276 inline bool isEnabledStop(uint32_t bkpt_code); 277 inline void EnableStop(uint32_t bkpt_code); 278 inline void DisableStop(uint32_t bkpt_code); 279 inline void IncreaseStopCounter(uint32_t bkpt_code); 280 void PrintStopInfo(uint32_t code); 281 282 // Byte Reverse 283 inline int16_t ByteReverse(int16_t hword); 284 inline int32_t ByteReverse(int32_t word); 285 inline int64_t ByteReverse(int64_t dword); 286 287 // Read and write memory. 288 inline uint8_t ReadBU(intptr_t addr); 289 inline int8_t ReadB(intptr_t addr); 290 inline void WriteB(intptr_t addr, uint8_t value); 291 inline void WriteB(intptr_t addr, int8_t value); 292 293 inline uint16_t ReadHU(intptr_t addr, Instruction* instr); 294 inline int16_t ReadH(intptr_t addr, Instruction* instr); 295 // Note: Overloaded on the sign of the value. 296 inline void WriteH(intptr_t addr, uint16_t value, Instruction* instr); 297 inline void WriteH(intptr_t addr, int16_t value, Instruction* instr); 298 299 inline uint32_t ReadWU(intptr_t addr, Instruction* instr); 300 inline int32_t ReadW(intptr_t addr, Instruction* instr); 301 inline int64_t ReadW64(intptr_t addr, Instruction* instr); 302 inline void WriteW(intptr_t addr, uint32_t value, Instruction* instr); 303 inline void WriteW(intptr_t addr, int32_t value, Instruction* instr); 304 305 inline int64_t ReadDW(intptr_t addr); 306 inline double ReadDouble(intptr_t addr); 307 inline void WriteDW(intptr_t addr, int64_t value); 308 309 // S390 310 void Trace(Instruction* instr); 311 bool DecodeTwoByte(Instruction* instr); 312 bool DecodeFourByte(Instruction* instr); 313 bool DecodeFourByteArithmetic(Instruction* instr); 314 bool DecodeFourByteArithmetic64Bit(Instruction* instr); 315 bool DecodeFourByteFloatingPoint(Instruction* instr); 316 void DecodeFourByteFloatingPointIntConversion(Instruction* instr); 317 void DecodeFourByteFloatingPointRound(Instruction* instr); 318 319 bool DecodeSixByte(Instruction* instr); 320 bool DecodeSixByteArithmetic(Instruction* instr); 321 bool S390InstructionDecode(Instruction* instr); 322 void DecodeSixByteBitShift(Instruction* instr); 323 324 // Used by the CL**BR instructions. 325 template <typename T1, typename T2> 326 void SetS390RoundConditionCode(T1 r2_val, T2 max, T2 min) { 327 condition_reg_ = 0; 328 double r2_dval = static_cast<double>(r2_val); 329 double dbl_min = static_cast<double>(min); 330 double dbl_max = static_cast<double>(max); 331 332 if (r2_dval == 0.0) 333 condition_reg_ = 8; 334 else if (r2_dval < 0.0 && r2_dval >= dbl_min && std::isfinite(r2_dval)) 335 condition_reg_ = 4; 336 else if (r2_dval > 0.0 && r2_dval <= dbl_max && std::isfinite(r2_dval)) 337 condition_reg_ = 2; 338 else 339 condition_reg_ = 1; 340 } 341 342 template <typename T1> 343 void SetS390RoundConditionCode(T1 r2_val, int64_t max, int64_t min) { 344 condition_reg_ = 0; 345 double r2_dval = static_cast<double>(r2_val); 346 double dbl_min = static_cast<double>(min); 347 double dbl_max = static_cast<double>(max); 348 349 // Note that the IEEE 754 floating-point representations (both 32 and 350 // 64 bit) cannot exactly represent INT64_MAX. The closest it can get 351 // is INT64_max + 1. IEEE 754 FP can, though, represent INT64_MIN 352 // exactly. 353 354 // This is not an issue for INT32, as IEEE754 64-bit can represent 355 // INT32_MAX and INT32_MIN with exact precision. 356 357 if (r2_dval == 0.0) 358 condition_reg_ = 8; 359 else if (r2_dval < 0.0 && r2_dval >= dbl_min && std::isfinite(r2_dval)) 360 condition_reg_ = 4; 361 else if (r2_dval > 0.0 && r2_dval < dbl_max && std::isfinite(r2_dval)) 362 condition_reg_ = 2; 363 else 364 condition_reg_ = 1; 365 } 366 367 // Used by the CL**BR instructions. 368 template <typename T1, typename T2, typename T3> 369 void SetS390ConvertConditionCode(T1 src, T2 dst, T3 max) { 370 condition_reg_ = 0; 371 if (src == static_cast<T1>(0.0)) { 372 condition_reg_ |= 8; 373 } else if (src < static_cast<T1>(0.0) && static_cast<T2>(src) == 0 && 374 std::isfinite(src)) { 375 condition_reg_ |= 4; 376 } else if (src > static_cast<T1>(0.0) && std::isfinite(src) && 377 src < static_cast<T1>(max)) { 378 condition_reg_ |= 2; 379 } else { 380 condition_reg_ |= 1; 381 } 382 } 383 384 template <typename T> 385 void SetS390ConditionCode(T lhs, T rhs) { 386 condition_reg_ = 0; 387 if (lhs == rhs) { 388 condition_reg_ |= CC_EQ; 389 } else if (lhs < rhs) { 390 condition_reg_ |= CC_LT; 391 } else if (lhs > rhs) { 392 condition_reg_ |= CC_GT; 393 } 394 395 // We get down here only for floating point 396 // comparisons and the values are unordered 397 // i.e. NaN 398 if (condition_reg_ == 0) condition_reg_ = unordered; 399 } 400 401 // Used by arithmetic operations that use carry. 402 template <typename T> 403 void SetS390ConditionCodeCarry(T result, bool overflow) { 404 condition_reg_ = 0; 405 bool zero_result = (result == static_cast<T>(0)); 406 if (zero_result && !overflow) { 407 condition_reg_ |= 8; 408 } else if (!zero_result && !overflow) { 409 condition_reg_ |= 4; 410 } else if (zero_result && overflow) { 411 condition_reg_ |= 2; 412 } else if (!zero_result && overflow) { 413 condition_reg_ |= 1; 414 } 415 if (condition_reg_ == 0) UNREACHABLE(); 416 } 417 418 bool isNaN(double value) { return (value != value); } 419 420 // Set the condition code for bitwise operations 421 // CC0 is set if value == 0. 422 // CC1 is set if value != 0. 423 // CC2/CC3 are not set. 424 template <typename T> 425 void SetS390BitWiseConditionCode(T value) { 426 condition_reg_ = 0; 427 428 if (value == 0) 429 condition_reg_ |= CC_EQ; 430 else 431 condition_reg_ |= CC_LT; 432 } 433 434 void SetS390OverflowCode(bool isOF) { 435 if (isOF) condition_reg_ = CC_OF; 436 } 437 438 bool TestConditionCode(Condition mask) { 439 // Check for unconditional branch 440 if (mask == 0xf) return true; 441 442 return (condition_reg_ & mask) != 0; 443 } 444 445 // Executes one instruction. 446 void ExecuteInstruction(Instruction* instr, bool auto_incr_pc = true); 447 448 // ICache. 449 static void CheckICache(base::CustomMatcherHashMap* i_cache, 450 Instruction* instr); 451 static void FlushOnePage(base::CustomMatcherHashMap* i_cache, intptr_t start, 452 int size); 453 static CachePage* GetCachePage(base::CustomMatcherHashMap* i_cache, 454 void* page); 455 456 // Runtime call support. 457 static void* RedirectExternalReference( 458 Isolate* isolate, void* external_function, 459 v8::internal::ExternalReference::Type type); 460 461 // Handle arguments and return value for runtime FP functions. 462 void GetFpArgs(double* x, double* y, intptr_t* z); 463 void SetFpResult(const double& result); 464 void TrashCallerSaveRegisters(); 465 466 void CallInternal(byte* entry, int reg_arg_count = 3); 467 468 // Architecture state. 469 // On z9 and higher and supported Linux on z Systems platforms, all registers 470 // are 64-bit, even in 31-bit mode. 471 uint64_t registers_[kNumGPRs]; 472 int64_t fp_registers_[kNumFPRs]; 473 474 // Condition Code register. In S390, the last 4 bits are used. 475 int32_t condition_reg_; 476 // Special register to track PC. 477 intptr_t special_reg_pc_; 478 479 // Simulator support. 480 char* stack_; 481 static const size_t stack_protection_size_ = 256 * kPointerSize; 482 bool pc_modified_; 483 int64_t icount_; 484 485 // Debugger input. 486 char* last_debugger_input_; 487 488 // Icache simulation 489 base::CustomMatcherHashMap* i_cache_; 490 491 // Registered breakpoints. 492 Instruction* break_pc_; 493 Instr break_instr_; 494 495 v8::internal::Isolate* isolate_; 496 497 // A stop is watched if its code is less than kNumOfWatchedStops. 498 // Only watched stops support enabling/disabling and the counter feature. 499 static const uint32_t kNumOfWatchedStops = 256; 500 501 // Breakpoint is disabled if bit 31 is set. 502 static const uint32_t kStopDisabledBit = 1 << 31; 503 504 // A stop is enabled, meaning the simulator will stop when meeting the 505 // instruction, if bit 31 of watched_stops_[code].count is unset. 506 // The value watched_stops_[code].count & ~(1 << 31) indicates how many times 507 // the breakpoint was hit or gone through. 508 struct StopCountAndDesc { 509 uint32_t count; 510 char* desc; 511 }; 512 StopCountAndDesc watched_stops_[kNumOfWatchedStops]; 513 void DebugStart(); 514 515 int DecodeInstructionOriginal(Instruction* instr); 516 int DecodeInstruction(Instruction* instr); 517 int Evaluate_Unknown(Instruction* instr); 518 #define MAX_NUM_OPCODES (1 << 16) 519 typedef int (Simulator::*EvaluateFuncType)(Instruction*); 520 521 static EvaluateFuncType EvalTable[MAX_NUM_OPCODES]; 522 static void EvalTableInit(); 523 524 #define EVALUATE(name) int Evaluate_##name(Instruction* instr) 525 EVALUATE(BKPT); 526 EVALUATE(SPM); 527 EVALUATE(BALR); 528 EVALUATE(BCTR); 529 EVALUATE(BCR); 530 EVALUATE(SVC); 531 EVALUATE(BSM); 532 EVALUATE(BASSM); 533 EVALUATE(BASR); 534 EVALUATE(MVCL); 535 EVALUATE(CLCL); 536 EVALUATE(LPR); 537 EVALUATE(LNR); 538 EVALUATE(LTR); 539 EVALUATE(LCR); 540 EVALUATE(NR); 541 EVALUATE(CLR); 542 EVALUATE(OR); 543 EVALUATE(XR); 544 EVALUATE(LR); 545 EVALUATE(CR); 546 EVALUATE(AR); 547 EVALUATE(SR); 548 EVALUATE(MR); 549 EVALUATE(DR); 550 EVALUATE(ALR); 551 EVALUATE(SLR); 552 EVALUATE(LDR); 553 EVALUATE(CDR); 554 EVALUATE(LER); 555 EVALUATE(STH); 556 EVALUATE(LA); 557 EVALUATE(STC); 558 EVALUATE(IC_z); 559 EVALUATE(EX); 560 EVALUATE(BAL); 561 EVALUATE(BCT); 562 EVALUATE(BC); 563 EVALUATE(LH); 564 EVALUATE(CH); 565 EVALUATE(AH); 566 EVALUATE(SH); 567 EVALUATE(MH); 568 EVALUATE(BAS); 569 EVALUATE(CVD); 570 EVALUATE(CVB); 571 EVALUATE(ST); 572 EVALUATE(LAE); 573 EVALUATE(N); 574 EVALUATE(CL); 575 EVALUATE(O); 576 EVALUATE(X); 577 EVALUATE(L); 578 EVALUATE(C); 579 EVALUATE(A); 580 EVALUATE(S); 581 EVALUATE(M); 582 EVALUATE(D); 583 EVALUATE(AL); 584 EVALUATE(SL); 585 EVALUATE(STD); 586 EVALUATE(LD); 587 EVALUATE(CD); 588 EVALUATE(STE); 589 EVALUATE(MS); 590 EVALUATE(LE); 591 EVALUATE(BRXH); 592 EVALUATE(BRXLE); 593 EVALUATE(BXH); 594 EVALUATE(BXLE); 595 EVALUATE(SRL); 596 EVALUATE(SLL); 597 EVALUATE(SRA); 598 EVALUATE(SLA); 599 EVALUATE(SRDL); 600 EVALUATE(SLDL); 601 EVALUATE(SRDA); 602 EVALUATE(SLDA); 603 EVALUATE(STM); 604 EVALUATE(TM); 605 EVALUATE(MVI); 606 EVALUATE(TS); 607 EVALUATE(NI); 608 EVALUATE(CLI); 609 EVALUATE(OI); 610 EVALUATE(XI); 611 EVALUATE(LM); 612 EVALUATE(MVCLE); 613 EVALUATE(CLCLE); 614 EVALUATE(MC); 615 EVALUATE(CDS); 616 EVALUATE(STCM); 617 EVALUATE(ICM); 618 EVALUATE(BPRP); 619 EVALUATE(BPP); 620 EVALUATE(TRTR); 621 EVALUATE(MVN); 622 EVALUATE(MVC); 623 EVALUATE(MVZ); 624 EVALUATE(NC); 625 EVALUATE(CLC); 626 EVALUATE(OC); 627 EVALUATE(XC); 628 EVALUATE(MVCP); 629 EVALUATE(TR); 630 EVALUATE(TRT); 631 EVALUATE(ED); 632 EVALUATE(EDMK); 633 EVALUATE(PKU); 634 EVALUATE(UNPKU); 635 EVALUATE(MVCIN); 636 EVALUATE(PKA); 637 EVALUATE(UNPKA); 638 EVALUATE(PLO); 639 EVALUATE(LMD); 640 EVALUATE(SRP); 641 EVALUATE(MVO); 642 EVALUATE(PACK); 643 EVALUATE(UNPK); 644 EVALUATE(ZAP); 645 EVALUATE(AP); 646 EVALUATE(SP); 647 EVALUATE(MP); 648 EVALUATE(DP); 649 EVALUATE(UPT); 650 EVALUATE(PFPO); 651 EVALUATE(IIHH); 652 EVALUATE(IIHL); 653 EVALUATE(IILH); 654 EVALUATE(IILL); 655 EVALUATE(NIHH); 656 EVALUATE(NIHL); 657 EVALUATE(NILH); 658 EVALUATE(NILL); 659 EVALUATE(OIHH); 660 EVALUATE(OIHL); 661 EVALUATE(OILH); 662 EVALUATE(OILL); 663 EVALUATE(LLIHH); 664 EVALUATE(LLIHL); 665 EVALUATE(LLILH); 666 EVALUATE(LLILL); 667 EVALUATE(TMLH); 668 EVALUATE(TMLL); 669 EVALUATE(TMHH); 670 EVALUATE(TMHL); 671 EVALUATE(BRC); 672 EVALUATE(BRAS); 673 EVALUATE(BRCT); 674 EVALUATE(BRCTG); 675 EVALUATE(LHI); 676 EVALUATE(LGHI); 677 EVALUATE(AHI); 678 EVALUATE(AGHI); 679 EVALUATE(MHI); 680 EVALUATE(MGHI); 681 EVALUATE(CHI); 682 EVALUATE(CGHI); 683 EVALUATE(LARL); 684 EVALUATE(LGFI); 685 EVALUATE(BRCL); 686 EVALUATE(BRASL); 687 EVALUATE(XIHF); 688 EVALUATE(XILF); 689 EVALUATE(IIHF); 690 EVALUATE(IILF); 691 EVALUATE(NIHF); 692 EVALUATE(NILF); 693 EVALUATE(OIHF); 694 EVALUATE(OILF); 695 EVALUATE(LLIHF); 696 EVALUATE(LLILF); 697 EVALUATE(MSGFI); 698 EVALUATE(MSFI); 699 EVALUATE(SLGFI); 700 EVALUATE(SLFI); 701 EVALUATE(AGFI); 702 EVALUATE(AFI); 703 EVALUATE(ALGFI); 704 EVALUATE(ALFI); 705 EVALUATE(CGFI); 706 EVALUATE(CFI); 707 EVALUATE(CLGFI); 708 EVALUATE(CLFI); 709 EVALUATE(LLHRL); 710 EVALUATE(LGHRL); 711 EVALUATE(LHRL); 712 EVALUATE(LLGHRL); 713 EVALUATE(STHRL); 714 EVALUATE(LGRL); 715 EVALUATE(STGRL); 716 EVALUATE(LGFRL); 717 EVALUATE(LRL); 718 EVALUATE(LLGFRL); 719 EVALUATE(STRL); 720 EVALUATE(EXRL); 721 EVALUATE(PFDRL); 722 EVALUATE(CGHRL); 723 EVALUATE(CHRL); 724 EVALUATE(CGRL); 725 EVALUATE(CGFRL); 726 EVALUATE(ECTG); 727 EVALUATE(CSST); 728 EVALUATE(LPD); 729 EVALUATE(LPDG); 730 EVALUATE(BRCTH); 731 EVALUATE(AIH); 732 EVALUATE(ALSIH); 733 EVALUATE(ALSIHN); 734 EVALUATE(CIH); 735 EVALUATE(STCK); 736 EVALUATE(CFC); 737 EVALUATE(IPM); 738 EVALUATE(HSCH); 739 EVALUATE(MSCH); 740 EVALUATE(SSCH); 741 EVALUATE(STSCH); 742 EVALUATE(TSCH); 743 EVALUATE(TPI); 744 EVALUATE(SAL); 745 EVALUATE(RSCH); 746 EVALUATE(STCRW); 747 EVALUATE(STCPS); 748 EVALUATE(RCHP); 749 EVALUATE(SCHM); 750 EVALUATE(CKSM); 751 EVALUATE(SAR); 752 EVALUATE(EAR); 753 EVALUATE(MSR); 754 EVALUATE(MVST); 755 EVALUATE(CUSE); 756 EVALUATE(SRST); 757 EVALUATE(XSCH); 758 EVALUATE(STCKE); 759 EVALUATE(STCKF); 760 EVALUATE(SRNM); 761 EVALUATE(STFPC); 762 EVALUATE(LFPC); 763 EVALUATE(TRE); 764 EVALUATE(CUUTF); 765 EVALUATE(CUTFU); 766 EVALUATE(STFLE); 767 EVALUATE(SRNMB); 768 EVALUATE(SRNMT); 769 EVALUATE(LFAS); 770 EVALUATE(PPA); 771 EVALUATE(ETND); 772 EVALUATE(TEND); 773 EVALUATE(NIAI); 774 EVALUATE(TABORT); 775 EVALUATE(TRAP4); 776 EVALUATE(LPEBR); 777 EVALUATE(LNEBR); 778 EVALUATE(LTEBR); 779 EVALUATE(LCEBR); 780 EVALUATE(LDEBR); 781 EVALUATE(LXDBR); 782 EVALUATE(LXEBR); 783 EVALUATE(MXDBR); 784 EVALUATE(KEBR); 785 EVALUATE(CEBR); 786 EVALUATE(AEBR); 787 EVALUATE(SEBR); 788 EVALUATE(MDEBR); 789 EVALUATE(DEBR); 790 EVALUATE(MAEBR); 791 EVALUATE(MSEBR); 792 EVALUATE(LPDBR); 793 EVALUATE(LNDBR); 794 EVALUATE(LTDBR); 795 EVALUATE(LCDBR); 796 EVALUATE(SQEBR); 797 EVALUATE(SQDBR); 798 EVALUATE(SQXBR); 799 EVALUATE(MEEBR); 800 EVALUATE(KDBR); 801 EVALUATE(CDBR); 802 EVALUATE(ADBR); 803 EVALUATE(SDBR); 804 EVALUATE(MDBR); 805 EVALUATE(DDBR); 806 EVALUATE(MADBR); 807 EVALUATE(MSDBR); 808 EVALUATE(LPXBR); 809 EVALUATE(LNXBR); 810 EVALUATE(LTXBR); 811 EVALUATE(LCXBR); 812 EVALUATE(LEDBRA); 813 EVALUATE(LDXBRA); 814 EVALUATE(LEXBRA); 815 EVALUATE(FIXBRA); 816 EVALUATE(KXBR); 817 EVALUATE(CXBR); 818 EVALUATE(AXBR); 819 EVALUATE(SXBR); 820 EVALUATE(MXBR); 821 EVALUATE(DXBR); 822 EVALUATE(TBEDR); 823 EVALUATE(TBDR); 824 EVALUATE(DIEBR); 825 EVALUATE(FIEBRA); 826 EVALUATE(THDER); 827 EVALUATE(THDR); 828 EVALUATE(DIDBR); 829 EVALUATE(FIDBRA); 830 EVALUATE(LXR); 831 EVALUATE(LPDFR); 832 EVALUATE(LNDFR); 833 EVALUATE(LCDFR); 834 EVALUATE(LZER); 835 EVALUATE(LZDR); 836 EVALUATE(LZXR); 837 EVALUATE(SFPC); 838 EVALUATE(SFASR); 839 EVALUATE(EFPC); 840 EVALUATE(CELFBR); 841 EVALUATE(CDLFBR); 842 EVALUATE(CXLFBR); 843 EVALUATE(CEFBRA); 844 EVALUATE(CDFBRA); 845 EVALUATE(CXFBRA); 846 EVALUATE(CFEBRA); 847 EVALUATE(CFDBRA); 848 EVALUATE(CFXBRA); 849 EVALUATE(CLFEBR); 850 EVALUATE(CLFDBR); 851 EVALUATE(CLFXBR); 852 EVALUATE(CELGBR); 853 EVALUATE(CDLGBR); 854 EVALUATE(CXLGBR); 855 EVALUATE(CEGBRA); 856 EVALUATE(CDGBRA); 857 EVALUATE(CXGBRA); 858 EVALUATE(CGEBRA); 859 EVALUATE(CGDBRA); 860 EVALUATE(CGXBRA); 861 EVALUATE(CLGEBR); 862 EVALUATE(CLGDBR); 863 EVALUATE(CFER); 864 EVALUATE(CFDR); 865 EVALUATE(CFXR); 866 EVALUATE(LDGR); 867 EVALUATE(CGER); 868 EVALUATE(CGDR); 869 EVALUATE(CGXR); 870 EVALUATE(LGDR); 871 EVALUATE(MDTR); 872 EVALUATE(MDTRA); 873 EVALUATE(DDTRA); 874 EVALUATE(ADTRA); 875 EVALUATE(SDTRA); 876 EVALUATE(LDETR); 877 EVALUATE(LEDTR); 878 EVALUATE(LTDTR); 879 EVALUATE(FIDTR); 880 EVALUATE(MXTRA); 881 EVALUATE(DXTRA); 882 EVALUATE(AXTRA); 883 EVALUATE(SXTRA); 884 EVALUATE(LXDTR); 885 EVALUATE(LDXTR); 886 EVALUATE(LTXTR); 887 EVALUATE(FIXTR); 888 EVALUATE(KDTR); 889 EVALUATE(CGDTRA); 890 EVALUATE(CUDTR); 891 EVALUATE(CDTR); 892 EVALUATE(EEDTR); 893 EVALUATE(ESDTR); 894 EVALUATE(KXTR); 895 EVALUATE(CGXTRA); 896 EVALUATE(CUXTR); 897 EVALUATE(CSXTR); 898 EVALUATE(CXTR); 899 EVALUATE(EEXTR); 900 EVALUATE(ESXTR); 901 EVALUATE(CDGTRA); 902 EVALUATE(CDUTR); 903 EVALUATE(CDSTR); 904 EVALUATE(CEDTR); 905 EVALUATE(QADTR); 906 EVALUATE(IEDTR); 907 EVALUATE(RRDTR); 908 EVALUATE(CXGTRA); 909 EVALUATE(CXUTR); 910 EVALUATE(CXSTR); 911 EVALUATE(CEXTR); 912 EVALUATE(QAXTR); 913 EVALUATE(IEXTR); 914 EVALUATE(RRXTR); 915 EVALUATE(LPGR); 916 EVALUATE(LNGR); 917 EVALUATE(LTGR); 918 EVALUATE(LCGR); 919 EVALUATE(LGR); 920 EVALUATE(LGBR); 921 EVALUATE(LGHR); 922 EVALUATE(AGR); 923 EVALUATE(SGR); 924 EVALUATE(ALGR); 925 EVALUATE(SLGR); 926 EVALUATE(MSGR); 927 EVALUATE(DSGR); 928 EVALUATE(LRVGR); 929 EVALUATE(LPGFR); 930 EVALUATE(LNGFR); 931 EVALUATE(LTGFR); 932 EVALUATE(LCGFR); 933 EVALUATE(LGFR); 934 EVALUATE(LLGFR); 935 EVALUATE(LLGTR); 936 EVALUATE(AGFR); 937 EVALUATE(SGFR); 938 EVALUATE(ALGFR); 939 EVALUATE(SLGFR); 940 EVALUATE(MSGFR); 941 EVALUATE(DSGFR); 942 EVALUATE(KMAC); 943 EVALUATE(LRVR); 944 EVALUATE(CGR); 945 EVALUATE(CLGR); 946 EVALUATE(LBR); 947 EVALUATE(LHR); 948 EVALUATE(KMF); 949 EVALUATE(KMO); 950 EVALUATE(PCC); 951 EVALUATE(KMCTR); 952 EVALUATE(KM); 953 EVALUATE(KMC); 954 EVALUATE(CGFR); 955 EVALUATE(KIMD); 956 EVALUATE(KLMD); 957 EVALUATE(CFDTR); 958 EVALUATE(CLGDTR); 959 EVALUATE(CLFDTR); 960 EVALUATE(BCTGR); 961 EVALUATE(CFXTR); 962 EVALUATE(CLFXTR); 963 EVALUATE(CDFTR); 964 EVALUATE(CDLGTR); 965 EVALUATE(CDLFTR); 966 EVALUATE(CXFTR); 967 EVALUATE(CXLGTR); 968 EVALUATE(CXLFTR); 969 EVALUATE(CGRT); 970 EVALUATE(NGR); 971 EVALUATE(OGR); 972 EVALUATE(XGR); 973 EVALUATE(FLOGR); 974 EVALUATE(LLGCR); 975 EVALUATE(LLGHR); 976 EVALUATE(MLGR); 977 EVALUATE(DLGR); 978 EVALUATE(ALCGR); 979 EVALUATE(SLBGR); 980 EVALUATE(EPSW); 981 EVALUATE(TRTT); 982 EVALUATE(TRTO); 983 EVALUATE(TROT); 984 EVALUATE(TROO); 985 EVALUATE(LLCR); 986 EVALUATE(LLHR); 987 EVALUATE(MLR); 988 EVALUATE(DLR); 989 EVALUATE(ALCR); 990 EVALUATE(SLBR); 991 EVALUATE(CU14); 992 EVALUATE(CU24); 993 EVALUATE(CU41); 994 EVALUATE(CU42); 995 EVALUATE(TRTRE); 996 EVALUATE(SRSTU); 997 EVALUATE(TRTE); 998 EVALUATE(AHHHR); 999 EVALUATE(SHHHR); 1000 EVALUATE(ALHHHR); 1001 EVALUATE(SLHHHR); 1002 EVALUATE(CHHR); 1003 EVALUATE(AHHLR); 1004 EVALUATE(SHHLR); 1005 EVALUATE(ALHHLR); 1006 EVALUATE(SLHHLR); 1007 EVALUATE(CHLR); 1008 EVALUATE(POPCNT_Z); 1009 EVALUATE(LOCGR); 1010 EVALUATE(NGRK); 1011 EVALUATE(OGRK); 1012 EVALUATE(XGRK); 1013 EVALUATE(AGRK); 1014 EVALUATE(SGRK); 1015 EVALUATE(ALGRK); 1016 EVALUATE(SLGRK); 1017 EVALUATE(LOCR); 1018 EVALUATE(NRK); 1019 EVALUATE(ORK); 1020 EVALUATE(XRK); 1021 EVALUATE(ARK); 1022 EVALUATE(SRK); 1023 EVALUATE(ALRK); 1024 EVALUATE(SLRK); 1025 EVALUATE(LTG); 1026 EVALUATE(LG); 1027 EVALUATE(CVBY); 1028 EVALUATE(AG); 1029 EVALUATE(SG); 1030 EVALUATE(ALG); 1031 EVALUATE(SLG); 1032 EVALUATE(MSG); 1033 EVALUATE(DSG); 1034 EVALUATE(CVBG); 1035 EVALUATE(LRVG); 1036 EVALUATE(LT); 1037 EVALUATE(LGF); 1038 EVALUATE(LGH); 1039 EVALUATE(LLGF); 1040 EVALUATE(LLGT); 1041 EVALUATE(AGF); 1042 EVALUATE(SGF); 1043 EVALUATE(ALGF); 1044 EVALUATE(SLGF); 1045 EVALUATE(MSGF); 1046 EVALUATE(DSGF); 1047 EVALUATE(LRV); 1048 EVALUATE(LRVH); 1049 EVALUATE(CG); 1050 EVALUATE(CLG); 1051 EVALUATE(STG); 1052 EVALUATE(NTSTG); 1053 EVALUATE(CVDY); 1054 EVALUATE(CVDG); 1055 EVALUATE(STRVG); 1056 EVALUATE(CGF); 1057 EVALUATE(CLGF); 1058 EVALUATE(LTGF); 1059 EVALUATE(CGH); 1060 EVALUATE(PFD); 1061 EVALUATE(STRV); 1062 EVALUATE(STRVH); 1063 EVALUATE(BCTG); 1064 EVALUATE(STY); 1065 EVALUATE(MSY); 1066 EVALUATE(NY); 1067 EVALUATE(CLY); 1068 EVALUATE(OY); 1069 EVALUATE(XY); 1070 EVALUATE(LY); 1071 EVALUATE(CY); 1072 EVALUATE(AY); 1073 EVALUATE(SY); 1074 EVALUATE(MFY); 1075 EVALUATE(ALY); 1076 EVALUATE(SLY); 1077 EVALUATE(STHY); 1078 EVALUATE(LAY); 1079 EVALUATE(STCY); 1080 EVALUATE(ICY); 1081 EVALUATE(LAEY); 1082 EVALUATE(LB); 1083 EVALUATE(LGB); 1084 EVALUATE(LHY); 1085 EVALUATE(CHY); 1086 EVALUATE(AHY); 1087 EVALUATE(SHY); 1088 EVALUATE(MHY); 1089 EVALUATE(NG); 1090 EVALUATE(OG); 1091 EVALUATE(XG); 1092 EVALUATE(LGAT); 1093 EVALUATE(MLG); 1094 EVALUATE(DLG); 1095 EVALUATE(ALCG); 1096 EVALUATE(SLBG); 1097 EVALUATE(STPQ); 1098 EVALUATE(LPQ); 1099 EVALUATE(LLGC); 1100 EVALUATE(LLGH); 1101 EVALUATE(LLC); 1102 EVALUATE(LLH); 1103 EVALUATE(ML); 1104 EVALUATE(DL); 1105 EVALUATE(ALC); 1106 EVALUATE(SLB); 1107 EVALUATE(LLGTAT); 1108 EVALUATE(LLGFAT); 1109 EVALUATE(LAT); 1110 EVALUATE(LBH); 1111 EVALUATE(LLCH); 1112 EVALUATE(STCH); 1113 EVALUATE(LHH); 1114 EVALUATE(LLHH); 1115 EVALUATE(STHH); 1116 EVALUATE(LFHAT); 1117 EVALUATE(LFH); 1118 EVALUATE(STFH); 1119 EVALUATE(CHF); 1120 EVALUATE(MVCDK); 1121 EVALUATE(MVHHI); 1122 EVALUATE(MVGHI); 1123 EVALUATE(MVHI); 1124 EVALUATE(CHHSI); 1125 EVALUATE(CGHSI); 1126 EVALUATE(CHSI); 1127 EVALUATE(CLFHSI); 1128 EVALUATE(TBEGIN); 1129 EVALUATE(TBEGINC); 1130 EVALUATE(LMG); 1131 EVALUATE(SRAG); 1132 EVALUATE(SLAG); 1133 EVALUATE(SRLG); 1134 EVALUATE(SLLG); 1135 EVALUATE(CSY); 1136 EVALUATE(RLLG); 1137 EVALUATE(RLL); 1138 EVALUATE(STMG); 1139 EVALUATE(STMH); 1140 EVALUATE(STCMH); 1141 EVALUATE(STCMY); 1142 EVALUATE(CDSY); 1143 EVALUATE(CDSG); 1144 EVALUATE(BXHG); 1145 EVALUATE(BXLEG); 1146 EVALUATE(ECAG); 1147 EVALUATE(TMY); 1148 EVALUATE(MVIY); 1149 EVALUATE(NIY); 1150 EVALUATE(CLIY); 1151 EVALUATE(OIY); 1152 EVALUATE(XIY); 1153 EVALUATE(ASI); 1154 EVALUATE(ALSI); 1155 EVALUATE(AGSI); 1156 EVALUATE(ALGSI); 1157 EVALUATE(ICMH); 1158 EVALUATE(ICMY); 1159 EVALUATE(MVCLU); 1160 EVALUATE(CLCLU); 1161 EVALUATE(STMY); 1162 EVALUATE(LMH); 1163 EVALUATE(LMY); 1164 EVALUATE(TP); 1165 EVALUATE(SRAK); 1166 EVALUATE(SLAK); 1167 EVALUATE(SRLK); 1168 EVALUATE(SLLK); 1169 EVALUATE(LOCG); 1170 EVALUATE(STOCG); 1171 EVALUATE(LANG); 1172 EVALUATE(LAOG); 1173 EVALUATE(LAXG); 1174 EVALUATE(LAAG); 1175 EVALUATE(LAALG); 1176 EVALUATE(LOC); 1177 EVALUATE(STOC); 1178 EVALUATE(LAN); 1179 EVALUATE(LAO); 1180 EVALUATE(LAX); 1181 EVALUATE(LAA); 1182 EVALUATE(LAAL); 1183 EVALUATE(BRXHG); 1184 EVALUATE(BRXLG); 1185 EVALUATE(RISBLG); 1186 EVALUATE(RNSBG); 1187 EVALUATE(RISBG); 1188 EVALUATE(ROSBG); 1189 EVALUATE(RXSBG); 1190 EVALUATE(RISBGN); 1191 EVALUATE(RISBHG); 1192 EVALUATE(CGRJ); 1193 EVALUATE(CGIT); 1194 EVALUATE(CIT); 1195 EVALUATE(CLFIT); 1196 EVALUATE(CGIJ); 1197 EVALUATE(CIJ); 1198 EVALUATE(AHIK); 1199 EVALUATE(AGHIK); 1200 EVALUATE(ALHSIK); 1201 EVALUATE(ALGHSIK); 1202 EVALUATE(CGRB); 1203 EVALUATE(CGIB); 1204 EVALUATE(CIB); 1205 EVALUATE(LDEB); 1206 EVALUATE(LXDB); 1207 EVALUATE(LXEB); 1208 EVALUATE(MXDB); 1209 EVALUATE(KEB); 1210 EVALUATE(CEB); 1211 EVALUATE(AEB); 1212 EVALUATE(SEB); 1213 EVALUATE(MDEB); 1214 EVALUATE(DEB); 1215 EVALUATE(MAEB); 1216 EVALUATE(MSEB); 1217 EVALUATE(TCEB); 1218 EVALUATE(TCDB); 1219 EVALUATE(TCXB); 1220 EVALUATE(SQEB); 1221 EVALUATE(SQDB); 1222 EVALUATE(MEEB); 1223 EVALUATE(KDB); 1224 EVALUATE(CDB); 1225 EVALUATE(ADB); 1226 EVALUATE(SDB); 1227 EVALUATE(MDB); 1228 EVALUATE(DDB); 1229 EVALUATE(MADB); 1230 EVALUATE(MSDB); 1231 EVALUATE(SLDT); 1232 EVALUATE(SRDT); 1233 EVALUATE(SLXT); 1234 EVALUATE(SRXT); 1235 EVALUATE(TDCET); 1236 EVALUATE(TDGET); 1237 EVALUATE(TDCDT); 1238 EVALUATE(TDGDT); 1239 EVALUATE(TDCXT); 1240 EVALUATE(TDGXT); 1241 EVALUATE(LEY); 1242 EVALUATE(LDY); 1243 EVALUATE(STEY); 1244 EVALUATE(STDY); 1245 EVALUATE(CZDT); 1246 EVALUATE(CZXT); 1247 EVALUATE(CDZT); 1248 EVALUATE(CXZT); 1249 #undef EVALUATE 1250 }; 1251 1252 // When running with the simulator transition into simulated execution at this 1253 // point. 1254 #define CALL_GENERATED_CODE(isolate, entry, p0, p1, p2, p3, p4) \ 1255 reinterpret_cast<Object*>(Simulator::current(isolate)->Call( \ 1256 FUNCTION_ADDR(entry), 5, (intptr_t)p0, (intptr_t)p1, (intptr_t)p2, \ 1257 (intptr_t)p3, (intptr_t)p4)) 1258 1259 #define CALL_GENERATED_REGEXP_CODE(isolate, entry, p0, p1, p2, p3, p4, p5, p6, \ 1260 p7, p8) \ 1261 Simulator::current(isolate)->Call(entry, 10, (intptr_t)p0, (intptr_t)p1, \ 1262 (intptr_t)p2, (intptr_t)p3, (intptr_t)p4, \ 1263 (intptr_t)p5, (intptr_t)p6, (intptr_t)p7, \ 1264 (intptr_t)NULL, (intptr_t)p8) 1265 1266 // The simulator has its own stack. Thus it has a different stack limit from 1267 // the C-based native code. The JS-based limit normally points near the end of 1268 // the simulator stack. When the C-based limit is exhausted we reflect that by 1269 // lowering the JS-based limit as well, to make stack checks trigger. 1270 class SimulatorStack : public v8::internal::AllStatic { 1271 public: 1272 static inline uintptr_t JsLimitFromCLimit(v8::internal::Isolate* isolate, 1273 uintptr_t c_limit) { 1274 return Simulator::current(isolate)->StackLimit(c_limit); 1275 } 1276 1277 static inline uintptr_t RegisterCTryCatch(v8::internal::Isolate* isolate, 1278 uintptr_t try_catch_address) { 1279 Simulator* sim = Simulator::current(isolate); 1280 return sim->PushAddress(try_catch_address); 1281 } 1282 1283 static inline void UnregisterCTryCatch(v8::internal::Isolate* isolate) { 1284 Simulator::current(isolate)->PopAddress(); 1285 } 1286 }; 1287 1288 } // namespace internal 1289 } // namespace v8 1290 1291 #endif // !defined(USE_SIMULATOR) 1292 #endif // V8_S390_SIMULATOR_S390_H_ 1293