| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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_MIPS_CONSTANTS_H_ | 5 #ifndef V8_MIPS_CONSTANTS_H_ |
| 6 #define V8_MIPS_CONSTANTS_H_ | 6 #define V8_MIPS_CONSTANTS_H_ |
| 7 #include "src/globals.h" | 7 #include "src/globals.h" |
| 8 // UNIMPLEMENTED_ macro for MIPS. | 8 // UNIMPLEMENTED_ macro for MIPS. |
| 9 #ifdef DEBUG | 9 #ifdef DEBUG |
| 10 #define UNIMPLEMENTED_MIPS() \ | 10 #define UNIMPLEMENTED_MIPS() \ |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 | 235 |
| 236 // On MIPS Simulator breakpoints can have different codes: | 236 // On MIPS Simulator breakpoints can have different codes: |
| 237 // - Breaks between 0 and kMaxWatchpointCode are treated as simple watchpoints, | 237 // - Breaks between 0 and kMaxWatchpointCode are treated as simple watchpoints, |
| 238 // the simulator will run through them and print the registers. | 238 // the simulator will run through them and print the registers. |
| 239 // - Breaks between kMaxWatchpointCode and kMaxStopCode are treated as stop() | 239 // - Breaks between kMaxWatchpointCode and kMaxStopCode are treated as stop() |
| 240 // instructions (see Assembler::stop()). | 240 // instructions (see Assembler::stop()). |
| 241 // - Breaks larger than kMaxStopCode are simple breaks, dropping you into the | 241 // - Breaks larger than kMaxStopCode are simple breaks, dropping you into the |
| 242 // debugger. | 242 // debugger. |
| 243 const uint32_t kMaxWatchpointCode = 31; | 243 const uint32_t kMaxWatchpointCode = 31; |
| 244 const uint32_t kMaxStopCode = 127; | 244 const uint32_t kMaxStopCode = 127; |
| 245 const int32_t kMaxInt19 = 262143; |
| 246 const int32_t kMinInt19 = -262144; |
| 245 STATIC_ASSERT(kMaxWatchpointCode < kMaxStopCode); | 247 STATIC_ASSERT(kMaxWatchpointCode < kMaxStopCode); |
| 246 | 248 |
| 247 | 249 |
| 248 // ----- Fields offset and length. | 250 // ----- Fields offset and length. |
| 249 const int kOpcodeShift = 26; | 251 const int kOpcodeShift = 26; |
| 250 const int kOpcodeBits = 6; | 252 const int kOpcodeBits = 6; |
| 251 const int kRsShift = 21; | 253 const int kRsShift = 21; |
| 252 const int kRsBits = 5; | 254 const int kRsBits = 5; |
| 253 const int kRtShift = 16; | 255 const int kRtShift = 16; |
| 254 const int kRtBits = 5; | 256 const int kRtBits = 5; |
| 255 const int kRdShift = 11; | 257 const int kRdShift = 11; |
| 256 const int kRdBits = 5; | 258 const int kRdBits = 5; |
| 257 const int kSaShift = 6; | 259 const int kSaShift = 6; |
| 258 const int kSaBits = 5; | 260 const int kSaBits = 5; |
| 259 const int kFunctionShift = 0; | 261 const int kFunctionShift = 0; |
| 260 const int kFunctionBits = 6; | 262 const int kFunctionBits = 6; |
| 261 const int kLuiShift = 16; | 263 const int kLuiShift = 16; |
| 264 const int kBp2Shift = 6; |
| 265 const int kBp2Bits = 2; |
| 262 | 266 |
| 263 const int kImm16Shift = 0; | 267 const int kImm16Shift = 0; |
| 264 const int kImm16Bits = 16; | 268 const int kImm16Bits = 16; |
| 269 const int kImm18Shift = 0; |
| 270 const int kImm18Bits = 18; |
| 271 const int kImm19Shift = 0; |
| 272 const int kImm19Bits = 19; |
| 265 const int kImm21Shift = 0; | 273 const int kImm21Shift = 0; |
| 266 const int kImm21Bits = 21; | 274 const int kImm21Bits = 21; |
| 267 const int kImm26Shift = 0; | 275 const int kImm26Shift = 0; |
| 268 const int kImm26Bits = 26; | 276 const int kImm26Bits = 26; |
| 269 const int kImm28Shift = 0; | 277 const int kImm28Shift = 0; |
| 270 const int kImm28Bits = 28; | 278 const int kImm28Bits = 28; |
| 271 const int kImm32Shift = 0; | 279 const int kImm32Shift = 0; |
| 272 const int kImm32Bits = 32; | 280 const int kImm32Bits = 32; |
| 273 | 281 |
| 274 // In branches and jumps immediate fields point to words, not bytes, | 282 // In branches and jumps immediate fields point to words, not bytes, |
| (...skipping 12 matching lines...) Expand all Loading... |
| 287 const int kFCccBits = 3; | 295 const int kFCccBits = 3; |
| 288 const int kFBccShift = 18; | 296 const int kFBccShift = 18; |
| 289 const int kFBccBits = 3; | 297 const int kFBccBits = 3; |
| 290 const int kFBtrueShift = 16; | 298 const int kFBtrueShift = 16; |
| 291 const int kFBtrueBits = 1; | 299 const int kFBtrueBits = 1; |
| 292 | 300 |
| 293 // ----- Miscellaneous useful masks. | 301 // ----- Miscellaneous useful masks. |
| 294 // Instruction bit masks. | 302 // Instruction bit masks. |
| 295 const int kOpcodeMask = ((1 << kOpcodeBits) - 1) << kOpcodeShift; | 303 const int kOpcodeMask = ((1 << kOpcodeBits) - 1) << kOpcodeShift; |
| 296 const int kImm16Mask = ((1 << kImm16Bits) - 1) << kImm16Shift; | 304 const int kImm16Mask = ((1 << kImm16Bits) - 1) << kImm16Shift; |
| 305 const int kImm18Mask = ((1 << kImm18Bits) - 1) << kImm18Shift; |
| 306 const int kImm19Mask = ((1 << kImm19Bits) - 1) << kImm19Shift; |
| 307 const int kImm21Mask = ((1 << kImm21Bits) - 1) << kImm21Shift; |
| 297 const int kImm26Mask = ((1 << kImm26Bits) - 1) << kImm26Shift; | 308 const int kImm26Mask = ((1 << kImm26Bits) - 1) << kImm26Shift; |
| 298 const int kImm28Mask = ((1 << kImm28Bits) - 1) << kImm28Shift; | 309 const int kImm28Mask = ((1 << kImm28Bits) - 1) << kImm28Shift; |
| 299 const int kRsFieldMask = ((1 << kRsBits) - 1) << kRsShift; | 310 const int kRsFieldMask = ((1 << kRsBits) - 1) << kRsShift; |
| 300 const int kRtFieldMask = ((1 << kRtBits) - 1) << kRtShift; | 311 const int kRtFieldMask = ((1 << kRtBits) - 1) << kRtShift; |
| 301 const int kRdFieldMask = ((1 << kRdBits) - 1) << kRdShift; | 312 const int kRdFieldMask = ((1 << kRdBits) - 1) << kRdShift; |
| 302 const int kSaFieldMask = ((1 << kSaBits) - 1) << kSaShift; | 313 const int kSaFieldMask = ((1 << kSaBits) - 1) << kSaShift; |
| 303 const int kFunctionFieldMask = ((1 << kFunctionBits) - 1) << kFunctionShift; | 314 const int kFunctionFieldMask = ((1 << kFunctionBits) - 1) << kFunctionShift; |
| 304 // Misc masks. | 315 // Misc masks. |
| 305 const int kHiMask = 0xffff << 16; | 316 const int kHiMask = 0xffff << 16; |
| 306 const int kLoMask = 0xffff; | 317 const int kLoMask = 0xffff; |
| 307 const int kSignMask = 0x80000000; | 318 const int kSignMask = 0x80000000; |
| 308 const int kJumpAddrMask = (1 << (kImm26Bits + kImmFieldShift)) - 1; | 319 const int kJumpAddrMask = (1 << (kImm26Bits + kImmFieldShift)) - 1; |
| 309 | 320 |
| 310 // ----- MIPS Opcodes and Function Fields. | 321 // ----- MIPS Opcodes and Function Fields. |
| 311 // We use this presentation to stay close to the table representation in | 322 // We use this presentation to stay close to the table representation in |
| 312 // MIPS32 Architecture For Programmers, Volume II: The MIPS32 Instruction Set. | 323 // MIPS32 Architecture For Programmers, Volume II: The MIPS32 Instruction Set. |
| 313 enum Opcode { | 324 enum Opcode { |
| 314 SPECIAL = 0 << kOpcodeShift, | 325 SPECIAL = 0 << kOpcodeShift, |
| 315 REGIMM = 1 << kOpcodeShift, | 326 REGIMM = 1 << kOpcodeShift, |
| 316 | 327 |
| 317 J = ((0 << 3) + 2) << kOpcodeShift, | 328 J = ((0 << 3) + 2) << kOpcodeShift, |
| 318 JAL = ((0 << 3) + 3) << kOpcodeShift, | 329 JAL = ((0 << 3) + 3) << kOpcodeShift, |
| 319 BEQ = ((0 << 3) + 4) << kOpcodeShift, | 330 BEQ = ((0 << 3) + 4) << kOpcodeShift, |
| 320 BNE = ((0 << 3) + 5) << kOpcodeShift, | 331 BNE = ((0 << 3) + 5) << kOpcodeShift, |
| 321 BLEZ = ((0 << 3) + 6) << kOpcodeShift, | 332 BLEZ = ((0 << 3) + 6) << kOpcodeShift, |
| 322 BGTZ = ((0 << 3) + 7) << kOpcodeShift, | 333 BGTZ = ((0 << 3) + 7) << kOpcodeShift, |
| 323 | 334 |
| 324 ADDI = ((1 << 3) + 0) << kOpcodeShift, | 335 ADDI = ((1 << 3) + 0) << kOpcodeShift, |
| 325 ADDIU = ((1 << 3) + 1) << kOpcodeShift, | 336 ADDIU = ((1 << 3) + 1) << kOpcodeShift, |
| 326 SLTI = ((1 << 3) + 2) << kOpcodeShift, | 337 SLTI = ((1 << 3) + 2) << kOpcodeShift, |
| 327 SLTIU = ((1 << 3) + 3) << kOpcodeShift, | 338 SLTIU = ((1 << 3) + 3) << kOpcodeShift, |
| 328 ANDI = ((1 << 3) + 4) << kOpcodeShift, | 339 ANDI = ((1 << 3) + 4) << kOpcodeShift, |
| 329 ORI = ((1 << 3) + 5) << kOpcodeShift, | 340 ORI = ((1 << 3) + 5) << kOpcodeShift, |
| 330 XORI = ((1 << 3) + 6) << kOpcodeShift, | 341 XORI = ((1 << 3) + 6) << kOpcodeShift, |
| 331 LUI = ((1 << 3) + 7) << kOpcodeShift, // LUI/AUI family. | 342 LUI = ((1 << 3) + 7) << kOpcodeShift, // LUI/AUI family. |
| 332 | 343 |
| 333 BEQC = ((2 << 3) + 0) << kOpcodeShift, | 344 BEQC = ((2 << 3) + 0) << kOpcodeShift, |
| 334 COP1 = ((2 << 3) + 1) << kOpcodeShift, // Coprocessor 1 class. | 345 COP1 = ((2 << 3) + 1) << kOpcodeShift, // Coprocessor 1 class. |
| 335 BEQL = ((2 << 3) + 4) << kOpcodeShift, | 346 BEQL = ((2 << 3) + 4) << kOpcodeShift, |
| 336 BNEL = ((2 << 3) + 5) << kOpcodeShift, | 347 BNEL = ((2 << 3) + 5) << kOpcodeShift, |
| 337 BLEZL = ((2 << 3) + 6) << kOpcodeShift, | 348 BLEZL = ((2 << 3) + 6) << kOpcodeShift, |
| 338 BGTZL = ((2 << 3) + 7) << kOpcodeShift, | 349 BGTZL = ((2 << 3) + 7) << kOpcodeShift, |
| 339 | 350 |
| 340 DADDI = ((3 << 3) + 0) << kOpcodeShift, // This is also BNEC. | 351 DADDI = ((3 << 3) + 0) << kOpcodeShift, // This is also BNEC. |
| 341 SPECIAL2 = ((3 << 3) + 4) << kOpcodeShift, | 352 SPECIAL2 = ((3 << 3) + 4) << kOpcodeShift, |
| 342 SPECIAL3 = ((3 << 3) + 7) << kOpcodeShift, | 353 SPECIAL3 = ((3 << 3) + 7) << kOpcodeShift, |
| 343 | 354 |
| 344 LB = ((4 << 3) + 0) << kOpcodeShift, | 355 LB = ((4 << 3) + 0) << kOpcodeShift, |
| 345 LH = ((4 << 3) + 1) << kOpcodeShift, | 356 LH = ((4 << 3) + 1) << kOpcodeShift, |
| 346 LWL = ((4 << 3) + 2) << kOpcodeShift, | 357 LWL = ((4 << 3) + 2) << kOpcodeShift, |
| 347 LW = ((4 << 3) + 3) << kOpcodeShift, | 358 LW = ((4 << 3) + 3) << kOpcodeShift, |
| 348 LBU = ((4 << 3) + 4) << kOpcodeShift, | 359 LBU = ((4 << 3) + 4) << kOpcodeShift, |
| 349 LHU = ((4 << 3) + 5) << kOpcodeShift, | 360 LHU = ((4 << 3) + 5) << kOpcodeShift, |
| 350 LWR = ((4 << 3) + 6) << kOpcodeShift, | 361 LWR = ((4 << 3) + 6) << kOpcodeShift, |
| 351 SB = ((5 << 3) + 0) << kOpcodeShift, | 362 SB = ((5 << 3) + 0) << kOpcodeShift, |
| 352 SH = ((5 << 3) + 1) << kOpcodeShift, | 363 SH = ((5 << 3) + 1) << kOpcodeShift, |
| 353 SWL = ((5 << 3) + 2) << kOpcodeShift, | 364 SWL = ((5 << 3) + 2) << kOpcodeShift, |
| 354 SW = ((5 << 3) + 3) << kOpcodeShift, | 365 SW = ((5 << 3) + 3) << kOpcodeShift, |
| 355 SWR = ((5 << 3) + 6) << kOpcodeShift, | 366 SWR = ((5 << 3) + 6) << kOpcodeShift, |
| 356 | 367 |
| 357 LWC1 = ((6 << 3) + 1) << kOpcodeShift, | 368 LWC1 = ((6 << 3) + 1) << kOpcodeShift, |
| 358 LDC1 = ((6 << 3) + 5) << kOpcodeShift, | 369 LDC1 = ((6 << 3) + 5) << kOpcodeShift, |
| 359 BEQZC = ((6 << 3) + 6) << kOpcodeShift, | 370 POP66 = ((6 << 3) + 6) << kOpcodeShift, |
| 360 | 371 |
| 361 PREF = ((6 << 3) + 3) << kOpcodeShift, | 372 PREF = ((6 << 3) + 3) << kOpcodeShift, |
| 362 | 373 |
| 363 SWC1 = ((7 << 3) + 1) << kOpcodeShift, | 374 SWC1 = ((7 << 3) + 1) << kOpcodeShift, |
| 364 SDC1 = ((7 << 3) + 5) << kOpcodeShift, | 375 PCREL = ((7 << 3) + 3) << kOpcodeShift, |
| 365 BNEZC = ((7 << 3) + 6) << kOpcodeShift, | 376 SDC1 = ((7 << 3) + 5) << kOpcodeShift, |
| 377 POP76 = ((7 << 3) + 6) << kOpcodeShift, |
| 366 | 378 |
| 367 COP1X = ((1 << 4) + 3) << kOpcodeShift | 379 COP1X = ((1 << 4) + 3) << kOpcodeShift |
| 368 }; | 380 }; |
| 369 | 381 |
| 370 enum SecondaryField { | 382 enum SecondaryField { |
| 371 // SPECIAL Encoding of Function Field. | 383 // SPECIAL Encoding of Function Field. |
| 372 SLL = ((0 << 3) + 0), | 384 SLL = ((0 << 3) + 0), |
| 373 MOVCI = ((0 << 3) + 1), | 385 MOVCI = ((0 << 3) + 1), |
| 374 SRL = ((0 << 3) + 2), | 386 SRL = ((0 << 3) + 2), |
| 375 SRA = ((0 << 3) + 3), | 387 SRA = ((0 << 3) + 3), |
| 376 SLLV = ((0 << 3) + 4), | 388 SLLV = ((0 << 3) + 4), |
| 377 SRLV = ((0 << 3) + 6), | 389 SRLV = ((0 << 3) + 6), |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 428 DIV_MOD_U = ((3 << 3) + 3), | 440 DIV_MOD_U = ((3 << 3) + 3), |
| 429 | 441 |
| 430 // SPECIAL2 Encoding of Function Field. | 442 // SPECIAL2 Encoding of Function Field. |
| 431 MUL = ((0 << 3) + 2), | 443 MUL = ((0 << 3) + 2), |
| 432 CLZ = ((4 << 3) + 0), | 444 CLZ = ((4 << 3) + 0), |
| 433 CLO = ((4 << 3) + 1), | 445 CLO = ((4 << 3) + 1), |
| 434 | 446 |
| 435 // SPECIAL3 Encoding of Function Field. | 447 // SPECIAL3 Encoding of Function Field. |
| 436 EXT = ((0 << 3) + 0), | 448 EXT = ((0 << 3) + 0), |
| 437 INS = ((0 << 3) + 4), | 449 INS = ((0 << 3) + 4), |
| 438 BITSWAP = ((4 << 3) + 0), | 450 BSHFL = ((4 << 3) + 0), |
| 451 |
| 452 // SPECIAL3 Encoding of sa Field |
| 453 BITSWAP = ((0 << 3) + 0), |
| 454 ALIGN = ((0 << 3) + 2), |
| 455 WSBH = ((0 << 3) + 2), |
| 456 SEB = ((2 << 3) + 0), |
| 457 SEH = ((3 << 3) + 0), |
| 439 | 458 |
| 440 // REGIMM encoding of rt Field. | 459 // REGIMM encoding of rt Field. |
| 441 BLTZ = ((0 << 3) + 0) << 16, | 460 BLTZ = ((0 << 3) + 0) << 16, |
| 442 BGEZ = ((0 << 3) + 1) << 16, | 461 BGEZ = ((0 << 3) + 1) << 16, |
| 443 BLTZAL = ((2 << 3) + 0) << 16, | 462 BLTZAL = ((2 << 3) + 0) << 16, |
| 444 BGEZAL = ((2 << 3) + 1) << 16, | 463 BGEZAL = ((2 << 3) + 1) << 16, |
| 445 BGEZALL = ((2 << 3) + 3) << 16, | 464 BGEZALL = ((2 << 3) + 3) << 16, |
| 446 | 465 |
| 447 // COP1 Encoding of rs Field. | 466 // COP1 Encoding of rs Field. |
| 448 MFC1 = ((0 << 3) + 0) << 21, | 467 MFC1 = ((0 << 3) + 0) << 21, |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 564 SEL = ((2 << 3) + 0), | 583 SEL = ((2 << 3) + 0), |
| 565 MOVZ_C = ((2 << 3) + 2), | 584 MOVZ_C = ((2 << 3) + 2), |
| 566 MOVN_C = ((2 << 3) + 3), | 585 MOVN_C = ((2 << 3) + 3), |
| 567 SELEQZ_C = ((2 << 3) + 4), // COP1 on FPR registers. | 586 SELEQZ_C = ((2 << 3) + 4), // COP1 on FPR registers. |
| 568 MOVF = ((2 << 3) + 1), // Function field for MOVT.fmt and MOVF.fmt | 587 MOVF = ((2 << 3) + 1), // Function field for MOVT.fmt and MOVF.fmt |
| 569 SELNEZ_C = ((2 << 3) + 7), // COP1 on FPR registers. | 588 SELNEZ_C = ((2 << 3) + 7), // COP1 on FPR registers. |
| 570 // COP1 Encoding of Function Field When rs=PS. | 589 // COP1 Encoding of Function Field When rs=PS. |
| 571 // COP1X Encoding of Function Field. | 590 // COP1X Encoding of Function Field. |
| 572 MADD_D = ((4 << 3) + 1), | 591 MADD_D = ((4 << 3) + 1), |
| 573 | 592 |
| 593 // PCREL Encoding of rt field |
| 594 ADDIUPC = ((0 << 2) + 0), |
| 595 LWPC = ((0 << 2) + 1), |
| 596 AUIPC = ((3 << 3) + 6), |
| 597 ALUIPC = ((3 << 3) + 7), |
| 598 |
| 599 // POP66 Encoding of rs field |
| 600 JIC = ((0 << 5) + 0), |
| 601 |
| 602 // POP76 Encoding of rs field |
| 603 JIALC = ((0 << 5) + 0), |
| 604 |
| 574 NULLSF = 0 | 605 NULLSF = 0 |
| 575 }; | 606 }; |
| 576 | 607 |
| 577 | 608 |
| 578 // ----- Emulated conditions. | 609 // ----- Emulated conditions. |
| 579 // On MIPS we use this enum to abstract from conditional branch instructions. | 610 // On MIPS we use this enum to abstract from conditional branch instructions. |
| 580 // The 'U' prefix is used to specify unsigned comparisons. | 611 // The 'U' prefix is used to specify unsigned comparisons. |
| 581 // Opposite conditions must be paired as odd/even numbers | 612 // Opposite conditions must be paired as odd/even numbers |
| 582 // because 'NegateCondition' function flips LSB to negate condition. | 613 // because 'NegateCondition' function flips LSB to negate condition. |
| 583 enum Condition { | 614 enum Condition { |
| (...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 874 } | 905 } |
| 875 | 906 |
| 876 inline int FtValue() const { | 907 inline int FtValue() const { |
| 877 return Bits(kFtShift + kFtBits - 1, kFtShift); | 908 return Bits(kFtShift + kFtBits - 1, kFtShift); |
| 878 } | 909 } |
| 879 | 910 |
| 880 inline int FrValue() const { | 911 inline int FrValue() const { |
| 881 return Bits(kFrShift + kFrBits -1, kFrShift); | 912 return Bits(kFrShift + kFrBits -1, kFrShift); |
| 882 } | 913 } |
| 883 | 914 |
| 915 inline int Bp2Value() const { |
| 916 DCHECK(InstructionType() == kRegisterType); |
| 917 return Bits(kBp2Shift + kBp2Bits - 1, kBp2Shift); |
| 918 } |
| 919 |
| 884 // Float Compare condition code instruction bits. | 920 // Float Compare condition code instruction bits. |
| 885 inline int FCccValue() const { | 921 inline int FCccValue() const { |
| 886 return Bits(kFCccShift + kFCccBits - 1, kFCccShift); | 922 return Bits(kFCccShift + kFCccBits - 1, kFCccShift); |
| 887 } | 923 } |
| 888 | 924 |
| 889 // Float Branch condition code instruction bits. | 925 // Float Branch condition code instruction bits. |
| 890 inline int FBccValue() const { | 926 inline int FBccValue() const { |
| 891 return Bits(kFBccShift + kFBccBits - 1, kFBccShift); | 927 return Bits(kFBccShift + kFBccBits - 1, kFBccShift); |
| 892 } | 928 } |
| 893 | 929 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 917 InstructionType() == kImmediateType); | 953 InstructionType() == kImmediateType); |
| 918 return InstructionBits() & kRtFieldMask; | 954 return InstructionBits() & kRtFieldMask; |
| 919 } | 955 } |
| 920 | 956 |
| 921 inline int RdFieldRaw() const { | 957 inline int RdFieldRaw() const { |
| 922 DCHECK(InstructionType() == kRegisterType); | 958 DCHECK(InstructionType() == kRegisterType); |
| 923 return InstructionBits() & kRdFieldMask; | 959 return InstructionBits() & kRdFieldMask; |
| 924 } | 960 } |
| 925 | 961 |
| 926 inline int SaFieldRaw() const { | 962 inline int SaFieldRaw() const { |
| 927 DCHECK(InstructionType() == kRegisterType); | 963 // DCHECK(InstructionType() == kRegisterType); |
| 928 return InstructionBits() & kSaFieldMask; | 964 return InstructionBits() & kSaFieldMask; |
| 929 } | 965 } |
| 930 | 966 |
| 931 inline int FunctionFieldRaw() const { | 967 inline int FunctionFieldRaw() const { |
| 932 return InstructionBits() & kFunctionFieldMask; | 968 return InstructionBits() & kFunctionFieldMask; |
| 933 } | 969 } |
| 934 | 970 |
| 935 // Get the secondary field according to the opcode. | 971 // Get the secondary field according to the opcode. |
| 936 inline int SecondaryValue() const { | 972 inline int SecondaryValue() const { |
| 937 Opcode op = OpcodeFieldRaw(); | 973 Opcode op = OpcodeFieldRaw(); |
| 938 switch (op) { | 974 switch (op) { |
| 939 case SPECIAL: | 975 case SPECIAL: |
| 940 case SPECIAL2: | 976 case SPECIAL2: |
| 941 return FunctionValue(); | 977 return FunctionValue(); |
| 942 case COP1: | 978 case COP1: |
| 943 return RsValue(); | 979 return RsValue(); |
| 944 case REGIMM: | 980 case REGIMM: |
| 945 return RtValue(); | 981 return RtValue(); |
| 946 default: | 982 default: |
| 947 return NULLSF; | 983 return NULLSF; |
| 948 } | 984 } |
| 949 } | 985 } |
| 950 | 986 |
| 951 inline int32_t Imm16Value() const { | 987 inline int32_t Imm16Value() const { |
| 952 DCHECK(InstructionType() == kImmediateType); | 988 DCHECK(InstructionType() == kImmediateType); |
| 953 return Bits(kImm16Shift + kImm16Bits - 1, kImm16Shift); | 989 return Bits(kImm16Shift + kImm16Bits - 1, kImm16Shift); |
| 954 } | 990 } |
| 955 | 991 |
| 992 inline int32_t Imm18Value() const { |
| 993 DCHECK(InstructionType() == kImmediateType); |
| 994 return Bits(kImm18Shift + kImm18Bits - 1, kImm18Shift); |
| 995 } |
| 996 |
| 997 inline int32_t Imm19Value() const { |
| 998 DCHECK(InstructionType() == kImmediateType); |
| 999 return Bits(kImm19Shift + kImm19Bits - 1, kImm19Shift); |
| 1000 } |
| 1001 |
| 956 inline int32_t Imm21Value() const { | 1002 inline int32_t Imm21Value() const { |
| 957 DCHECK(InstructionType() == kImmediateType); | 1003 DCHECK(InstructionType() == kImmediateType); |
| 958 return Bits(kImm21Shift + kImm21Bits - 1, kImm21Shift); | 1004 return Bits(kImm21Shift + kImm21Bits - 1, kImm21Shift); |
| 959 } | 1005 } |
| 960 | 1006 |
| 961 inline int32_t Imm26Value() const { | 1007 inline int32_t Imm26Value() const { |
| 962 DCHECK(InstructionType() == kJumpType); | 1008 DCHECK(InstructionType() == kJumpType); |
| 963 return Bits(kImm26Shift + kImm26Bits - 1, kImm26Shift); | 1009 return Bits(kImm26Shift + kImm26Bits - 1, kImm26Shift); |
| 964 } | 1010 } |
| 965 | 1011 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 994 // JS argument slots size. | 1040 // JS argument slots size. |
| 995 const int kJSArgsSlotsSize = 0 * Instruction::kInstrSize; | 1041 const int kJSArgsSlotsSize = 0 * Instruction::kInstrSize; |
| 996 // Assembly builtins argument slots size. | 1042 // Assembly builtins argument slots size. |
| 997 const int kBArgsSlotsSize = 0 * Instruction::kInstrSize; | 1043 const int kBArgsSlotsSize = 0 * Instruction::kInstrSize; |
| 998 | 1044 |
| 999 const int kBranchReturnOffset = 2 * Instruction::kInstrSize; | 1045 const int kBranchReturnOffset = 2 * Instruction::kInstrSize; |
| 1000 | 1046 |
| 1001 } } // namespace v8::internal | 1047 } } // namespace v8::internal |
| 1002 | 1048 |
| 1003 #endif // #ifndef V8_MIPS_CONSTANTS_H_ | 1049 #endif // #ifndef V8_MIPS_CONSTANTS_H_ |
| OLD | NEW |