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

View differences:

deps/v8/src/arm/assembler-arm.h
64 64
  // Check whether a feature is supported by the target CPU.
65 65
  static bool IsSupported(CpuFeature f) {
66 66
    ASSERT(initialized_);
67
    return (supported_ & (1u << f)) != 0;
67
    return Check(f, supported_);
68 68
  }
69 69

  
70 70
  static bool IsFoundByRuntimeProbingOnly(CpuFeature f) {
71 71
    ASSERT(initialized_);
72
    return (found_by_runtime_probing_only_ &
73
            (static_cast<uint64_t>(1) << f)) != 0;
72
    return Check(f, found_by_runtime_probing_only_);
74 73
  }
75 74

  
76 75
  static bool IsSafeForSnapshot(CpuFeature f) {
77
    return (IsSupported(f) &&
76
    return Check(f, cross_compile_) ||
77
           (IsSupported(f) &&
78 78
            (!Serializer::enabled() || !IsFoundByRuntimeProbingOnly(f)));
79 79
  }
80 80

  
81 81
  static unsigned cache_line_size() { return cache_line_size_; }
82 82

  
83
  static bool VerifyCrossCompiling() {
84
    return cross_compile_ == 0;
85
  }
86

  
87
  static bool VerifyCrossCompiling(CpuFeature f) {
88
    unsigned mask = flag2set(f);
89
    return cross_compile_ == 0 ||
90
           (cross_compile_ & mask) == mask;
91
  }
92

  
83 93
 private:
94
  static bool Check(CpuFeature f, unsigned set) {
95
    return (set & flag2set(f)) != 0;
96
  }
97

  
98
  static unsigned flag2set(CpuFeature f) {
99
    return 1u << f;
100
  }
101

  
84 102
#ifdef DEBUG
85 103
  static bool initialized_;
86 104
#endif
......
88 106
  static unsigned found_by_runtime_probing_only_;
89 107
  static unsigned cache_line_size_;
90 108

  
109
  static unsigned cross_compile_;
110

  
91 111
  friend class ExternalReference;
112
  friend class PlatformFeatureScope;
92 113
  DISALLOW_COPY_AND_ASSIGN(CpuFeatures);
93 114
};
94 115

  
......
114 135
// mode. This way we get the compile-time error checking in debug mode
115 136
// and best performance in optimized code.
116 137

  
138
// These constants are used in several locations, including static initializers
139
const int kRegister_no_reg_Code = -1;
140
const int kRegister_r0_Code = 0;
141
const int kRegister_r1_Code = 1;
142
const int kRegister_r2_Code = 2;
143
const int kRegister_r3_Code = 3;
144
const int kRegister_r4_Code = 4;
145
const int kRegister_r5_Code = 5;
146
const int kRegister_r6_Code = 6;
147
const int kRegister_r7_Code = 7;
148
const int kRegister_r8_Code = 8;
149
const int kRegister_r9_Code = 9;
150
const int kRegister_r10_Code = 10;
151
const int kRegister_fp_Code = 11;
152
const int kRegister_ip_Code = 12;
153
const int kRegister_sp_Code = 13;
154
const int kRegister_lr_Code = 14;
155
const int kRegister_pc_Code = 15;
156

  
117 157
// Core register
118 158
struct Register {
119 159
  static const int kNumRegisters = 16;
120
  static const int kMaxNumAllocatableRegisters = 8;
160
  static const int kMaxNumAllocatableRegisters =
161
      FLAG_enable_ool_constant_pool ? 8 : 9;
121 162
  static const int kSizeInBytes = 4;
122 163

  
123 164
  inline static int NumAllocatableRegisters();
124 165

  
125 166
  static int ToAllocationIndex(Register reg) {
167
    if (FLAG_enable_ool_constant_pool && (reg.code() >= kRegister_r8_Code)) {
168
      return reg.code() - 1;
169
    }
126 170
    ASSERT(reg.code() < kMaxNumAllocatableRegisters);
127 171
    return reg.code();
128 172
  }
129 173

  
130 174
  static Register FromAllocationIndex(int index) {
131 175
    ASSERT(index >= 0 && index < kMaxNumAllocatableRegisters);
176
    if (FLAG_enable_ool_constant_pool && (index >= 7)) {
177
      return from_code(index + 1);
178
    }
132 179
    return from_code(index);
133 180
  }
134 181

  
......
143 190
      "r5",
144 191
      "r6",
145 192
      "r7",
193
      "r8",
146 194
    };
195
    if (FLAG_enable_ool_constant_pool && (index >= 7)) {
196
      return names[index + 1];
197
    }
147 198
    return names[index];
148 199
  }
149 200

  
......
172 223
  int code_;
173 224
};
174 225

  
175
// These constants are used in several locations, including static initializers
176
const int kRegister_no_reg_Code = -1;
177
const int kRegister_r0_Code = 0;
178
const int kRegister_r1_Code = 1;
179
const int kRegister_r2_Code = 2;
180
const int kRegister_r3_Code = 3;
181
const int kRegister_r4_Code = 4;
182
const int kRegister_r5_Code = 5;
183
const int kRegister_r6_Code = 6;
184
const int kRegister_r7_Code = 7;
185
const int kRegister_r8_Code = 8;
186
const int kRegister_r9_Code = 9;
187
const int kRegister_r10_Code = 10;
188
const int kRegister_fp_Code = 11;
189
const int kRegister_ip_Code = 12;
190
const int kRegister_sp_Code = 13;
191
const int kRegister_lr_Code = 14;
192
const int kRegister_pc_Code = 15;
193

  
194 226
const Register no_reg = { kRegister_no_reg_Code };
195 227

  
196 228
const Register r0  = { kRegister_r0_Code };
......
200 232
const Register r4  = { kRegister_r4_Code };
201 233
const Register r5  = { kRegister_r5_Code };
202 234
const Register r6  = { kRegister_r6_Code };
235
// Used as constant pool pointer register if FLAG_enable_ool_constant_pool.
203 236
const Register r7  = { kRegister_r7_Code };
204 237
// Used as context register.
205 238
const Register r8  = { kRegister_r8_Code };

Also available in: Unified diff