Revision f230a1cf deps/v8/src/mips/assembler-mips.h

View differences:

deps/v8/src/mips/assembler-mips.h
72 72
// Core register.
73 73
struct Register {
74 74
  static const int kNumRegisters = v8::internal::kNumRegisters;
75
  static const int kMaxNumAllocatableRegisters = 14;  // v0 through t7.
75
  static const int kMaxNumAllocatableRegisters = 14;  // v0 through t6 and cp.
76 76
  static const int kSizeInBytes = 4;
77
  static const int kCpRegister = 23;  // cp (s7) is the 23rd register.
77 78

  
78 79
  inline static int NumAllocatableRegisters();
79 80

  
80 81
  static int ToAllocationIndex(Register reg) {
81
    return reg.code() - 2;  // zero_reg and 'at' are skipped.
82
    ASSERT((reg.code() - 2) < (kMaxNumAllocatableRegisters - 1) ||
83
           reg.is(from_code(kCpRegister)));
84
    return reg.is(from_code(kCpRegister)) ?
85
           kMaxNumAllocatableRegisters - 1 :  // Return last index for 'cp'.
86
           reg.code() - 2;  // zero_reg and 'at' are skipped.
82 87
  }
83 88

  
84 89
  static Register FromAllocationIndex(int index) {
85 90
    ASSERT(index >= 0 && index < kMaxNumAllocatableRegisters);
86
    return from_code(index + 2);  // zero_reg and 'at' are skipped.
91
    return index == kMaxNumAllocatableRegisters - 1 ?
92
           from_code(kCpRegister) :  // Last index is always the 'cp' register.
93
           from_code(index + 2);  // zero_reg and 'at' are skipped.
87 94
  }
88 95

  
89 96
  static const char* AllocationIndexToString(int index) {
......
102 109
      "t4",
103 110
      "t5",
104 111
      "t6",
105
      "t7",
112
      "s7",
106 113
    };
107 114
    return names[index];
108 115
  }
......
404 411
  // Check whether a feature is supported by the target CPU.
405 412
  static bool IsSupported(CpuFeature f) {
406 413
    ASSERT(initialized_);
407
    return (supported_ & (1u << f)) != 0;
414
    return Check(f, supported_);
408 415
  }
409 416

  
410 417
  static bool IsFoundByRuntimeProbingOnly(CpuFeature f) {
411 418
    ASSERT(initialized_);
412
    return (found_by_runtime_probing_only_ &
413
            (static_cast<uint64_t>(1) << f)) != 0;
419
    return Check(f, found_by_runtime_probing_only_);
414 420
  }
415 421

  
416 422
  static bool IsSafeForSnapshot(CpuFeature f) {
417
    return (IsSupported(f) &&
423
    return Check(f, cross_compile_) ||
424
           (IsSupported(f) &&
418 425
            (!Serializer::enabled() || !IsFoundByRuntimeProbingOnly(f)));
419 426
  }
420 427

  
428
  static bool VerifyCrossCompiling() {
429
    return cross_compile_ == 0;
430
  }
431

  
432
  static bool VerifyCrossCompiling(CpuFeature f) {
433
    unsigned mask = flag2set(f);
434
    return cross_compile_ == 0 ||
435
           (cross_compile_ & mask) == mask;
436
  }
437

  
421 438
 private:
439
  static bool Check(CpuFeature f, unsigned set) {
440
    return (set & flag2set(f)) != 0;
441
  }
442

  
443
  static unsigned flag2set(CpuFeature f) {
444
    return 1u << f;
445
  }
446

  
422 447
#ifdef DEBUG
423 448
  static bool initialized_;
424 449
#endif
425 450
  static unsigned supported_;
426 451
  static unsigned found_by_runtime_probing_only_;
427 452

  
453
  static unsigned cross_compile_;
454

  
428 455
  friend class ExternalReference;
456
  friend class PlatformFeatureScope;
429 457
  DISALLOW_COPY_AND_ASSIGN(CpuFeatures);
430 458
};
431 459

  

Also available in: Unified diff