Index: src/arm/assembler-arm.cc |
=================================================================== |
--- src/arm/assembler-arm.cc (revision 7267) |
+++ src/arm/assembler-arm.cc (working copy) |
@@ -44,12 +44,12 @@ |
namespace v8 { |
namespace internal { |
-// Safe default is no features. |
-unsigned CpuFeatures::supported_ = 0; |
-unsigned CpuFeatures::enabled_ = 0; |
-unsigned CpuFeatures::found_by_runtime_probing_ = 0; |
+CpuFeatures::CpuFeatures() |
+ : supported_(0), |
+ enabled_(0), |
+ found_by_runtime_probing_(0) { |
+} |
- |
#ifdef __arm__ |
static uint64_t CpuFeaturesImpliedByCompiler() { |
uint64_t answer = 0; |
@@ -148,7 +148,7 @@ |
rm_ = no_reg; |
// Verify all Objects referred by code are NOT in new space. |
Object* obj = *handle; |
- ASSERT(!Heap::InNewSpace(obj)); |
+ ASSERT(!HEAP->InNewSpace(obj)); |
if (obj->IsHeapObject()) { |
imm32_ = reinterpret_cast<intptr_t>(handle.location()); |
rmode_ = RelocInfo::EMBEDDED_OBJECT; |
@@ -266,22 +266,22 @@ |
// Spare buffer. |
static const int kMinimalBufferSize = 4*KB; |
-static byte* spare_buffer_ = NULL; |
Assembler::Assembler(void* buffer, int buffer_size) |
: positions_recorder_(this), |
allow_peephole_optimization_(false), |
emit_debug_code_(FLAG_debug_code) { |
+ Isolate* isolate = Isolate::Current(); |
allow_peephole_optimization_ = FLAG_peephole_optimization; |
if (buffer == NULL) { |
// Do our own buffer management. |
if (buffer_size <= kMinimalBufferSize) { |
buffer_size = kMinimalBufferSize; |
- if (spare_buffer_ != NULL) { |
- buffer = spare_buffer_; |
- spare_buffer_ = NULL; |
+ if (isolate->assembler_spare_buffer() != NULL) { |
+ buffer = isolate->assembler_spare_buffer(); |
+ isolate->set_assembler_spare_buffer(NULL); |
} |
} |
if (buffer == NULL) { |
@@ -314,10 +314,12 @@ |
Assembler::~Assembler() { |
+ Isolate* isolate = Isolate::Current(); |
ASSERT(const_pool_blocked_nesting_ == 0); |
if (own_buffer_) { |
- if (spare_buffer_ == NULL && buffer_size_ == kMinimalBufferSize) { |
- spare_buffer_ = buffer_; |
+ if (isolate->assembler_spare_buffer() == NULL && |
+ buffer_size_ == kMinimalBufferSize) { |
+ isolate->set_assembler_spare_buffer(buffer_); |
} else { |
DeleteArray(buffer_); |
} |
@@ -714,7 +716,7 @@ |
*instr ^= kMovMvnFlip; |
return true; |
} else if ((*instr & kMovLeaveCCMask) == kMovLeaveCCPattern) { |
- if (CpuFeatures::IsSupported(ARMv7)) { |
+ if (Isolate::Current()->cpu_features()->IsSupported(ARMv7)) { |
if (imm32 < 0x10000) { |
*instr ^= kMovwLeaveCCFlip; |
*instr |= EncodeMovwImmediate(imm32); |
@@ -777,7 +779,8 @@ |
// constant pool is required. For a mov instruction not setting the |
// condition code additional instruction conventions can be used. |
if ((instr & ~kCondMask) == 13*B21) { // mov, S not set |
- if (must_use_constant_pool() || !CpuFeatures::IsSupported(ARMv7)) { |
+ if (must_use_constant_pool() || |
+ !Isolate::Current()->cpu_features()->IsSupported(ARMv7)) { |
// mov instruction will be an ldr from constant pool (one instruction). |
return true; |
} else { |
@@ -819,7 +822,8 @@ |
CHECK(!rn.is(ip)); // rn should never be ip, or will be trashed |
Condition cond = Instruction::ConditionField(instr); |
if ((instr & ~kCondMask) == 13*B21) { // mov, S not set |
- if (x.must_use_constant_pool() || !CpuFeatures::IsSupported(ARMv7)) { |
+ if (x.must_use_constant_pool() || |
+ !Isolate::Current()->cpu_features()->IsSupported(ARMv7)) { |
RecordRelocInfo(x.rmode_, x.imm32_); |
ldr(rd, MemOperand(pc, 0), cond); |
} else { |
@@ -1262,7 +1266,7 @@ |
const Operand& src, |
Condition cond) { |
// v6 and above. |
- ASSERT(CpuFeatures::IsSupported(ARMv7)); |
+ ASSERT(Isolate::Current()->cpu_features()->IsSupported(ARMv7)); |
ASSERT(!dst.is(pc) && !src.rm_.is(pc)); |
ASSERT((satpos >= 0) && (satpos <= 31)); |
ASSERT((src.shift_op_ == ASR) || (src.shift_op_ == LSL)); |
@@ -1290,7 +1294,7 @@ |
int width, |
Condition cond) { |
// v7 and above. |
- ASSERT(CpuFeatures::IsSupported(ARMv7)); |
+ ASSERT(Isolate::Current()->cpu_features()->IsSupported(ARMv7)); |
ASSERT(!dst.is(pc) && !src.is(pc)); |
ASSERT((lsb >= 0) && (lsb <= 31)); |
ASSERT((width >= 1) && (width <= (32 - lsb))); |
@@ -1310,7 +1314,7 @@ |
int width, |
Condition cond) { |
// v7 and above. |
- ASSERT(CpuFeatures::IsSupported(ARMv7)); |
+ ASSERT(Isolate::Current()->cpu_features()->IsSupported(ARMv7)); |
ASSERT(!dst.is(pc) && !src.is(pc)); |
ASSERT((lsb >= 0) && (lsb <= 31)); |
ASSERT((width >= 1) && (width <= (32 - lsb))); |
@@ -1325,7 +1329,7 @@ |
// bfc dst, #lsb, #width |
void Assembler::bfc(Register dst, int lsb, int width, Condition cond) { |
// v7 and above. |
- ASSERT(CpuFeatures::IsSupported(ARMv7)); |
+ ASSERT(Isolate::Current()->cpu_features()->IsSupported(ARMv7)); |
ASSERT(!dst.is(pc)); |
ASSERT((lsb >= 0) && (lsb <= 31)); |
ASSERT((width >= 1) && (width <= (32 - lsb))); |
@@ -1344,7 +1348,7 @@ |
int width, |
Condition cond) { |
// v7 and above. |
- ASSERT(CpuFeatures::IsSupported(ARMv7)); |
+ ASSERT(Isolate::Current()->cpu_features()->IsSupported(ARMv7)); |
ASSERT(!dst.is(pc) && !src.is(pc)); |
ASSERT((lsb >= 0) && (lsb <= 31)); |
ASSERT((width >= 1) && (width <= (32 - lsb))); |
@@ -1616,7 +1620,7 @@ |
void Assembler::ldrd(Register dst1, Register dst2, |
const MemOperand& src, Condition cond) { |
- ASSERT(CpuFeatures::IsEnabled(ARMv7)); |
+ ASSERT(Isolate::Current()->cpu_features()->IsEnabled(ARMv7)); |
ASSERT(src.rm().is(no_reg)); |
ASSERT(!dst1.is(lr)); // r14. |
ASSERT_EQ(0, dst1.code() % 2); |
@@ -1631,7 +1635,7 @@ |
ASSERT(!src1.is(lr)); // r14. |
ASSERT_EQ(0, src1.code() % 2); |
ASSERT_EQ(src1.code() + 1, src2.code()); |
- ASSERT(CpuFeatures::IsEnabled(ARMv7)); |
+ ASSERT(Isolate::Current()->cpu_features()->IsEnabled(ARMv7)); |
addrmod3(cond | B7 | B6 | B5 | B4, src1, dst); |
} |
@@ -1867,7 +1871,7 @@ |
// Instruction details available in ARM DDI 0406A, A8-628. |
// cond(31-28) | 1101(27-24)| U001(23-20) | Rbase(19-16) | |
// Vdst(15-12) | 1011(11-8) | offset |
- ASSERT(CpuFeatures::IsEnabled(VFP3)); |
+ ASSERT(Isolate::Current()->cpu_features()->IsEnabled(VFP3)); |
int u = 1; |
if (offset < 0) { |
offset = -offset; |
@@ -1909,7 +1913,7 @@ |
// Instruction details available in ARM DDI 0406A, A8-628. |
// cond(31-28) | 1101(27-24)| U001(23-20) | Rbase(19-16) | |
// Vdst(15-12) | 1010(11-8) | offset |
- ASSERT(CpuFeatures::IsEnabled(VFP3)); |
+ ASSERT(Isolate::Current()->cpu_features()->IsEnabled(VFP3)); |
int u = 1; |
if (offset < 0) { |
offset = -offset; |
@@ -1953,7 +1957,7 @@ |
// Instruction details available in ARM DDI 0406A, A8-786. |
// cond(31-28) | 1101(27-24)| U000(23-20) | | Rbase(19-16) | |
// Vsrc(15-12) | 1011(11-8) | (offset/4) |
- ASSERT(CpuFeatures::IsEnabled(VFP3)); |
+ ASSERT(Isolate::Current()->cpu_features()->IsEnabled(VFP3)); |
int u = 1; |
if (offset < 0) { |
offset = -offset; |
@@ -1994,7 +1998,7 @@ |
// Instruction details available in ARM DDI 0406A, A8-786. |
// cond(31-28) | 1101(27-24)| U000(23-20) | Rbase(19-16) | |
// Vdst(15-12) | 1010(11-8) | (offset/4) |
- ASSERT(CpuFeatures::IsEnabled(VFP3)); |
+ ASSERT(Isolate::Current()->cpu_features()->IsEnabled(VFP3)); |
int u = 1; |
if (offset < 0) { |
offset = -offset; |
@@ -2040,7 +2044,7 @@ |
// Only works for little endian floating point formats. |
// We don't support VFP on the mixed endian floating point platform. |
static bool FitsVMOVDoubleImmediate(double d, uint32_t *encoding) { |
- ASSERT(CpuFeatures::IsEnabled(VFP3)); |
+ ASSERT(Isolate::Current()->cpu_features()->IsEnabled(VFP3)); |
// VMOV can accept an immediate of the form: |
// |
@@ -2093,7 +2097,7 @@ |
const Condition cond) { |
// Dd = immediate |
// Instruction details available in ARM DDI 0406B, A8-640. |
- ASSERT(CpuFeatures::IsEnabled(VFP3)); |
+ ASSERT(Isolate::Current()->cpu_features()->IsEnabled(VFP3)); |
uint32_t enc; |
if (FitsVMOVDoubleImmediate(imm, &enc)) { |
@@ -2130,7 +2134,7 @@ |
const Condition cond) { |
// Sd = Sm |
// Instruction details available in ARM DDI 0406B, A8-642. |
- ASSERT(CpuFeatures::IsEnabled(VFP3)); |
+ ASSERT(Isolate::Current()->cpu_features()->IsEnabled(VFP3)); |
int sd, d, sm, m; |
dst.split_code(&sd, &d); |
src.split_code(&sm, &m); |
@@ -2143,7 +2147,7 @@ |
const Condition cond) { |
// Dd = Dm |
// Instruction details available in ARM DDI 0406B, A8-642. |
- ASSERT(CpuFeatures::IsEnabled(VFP3)); |
+ ASSERT(Isolate::Current()->cpu_features()->IsEnabled(VFP3)); |
emit(cond | 0xE*B24 | 0xB*B20 | |
dst.code()*B12 | 0x5*B9 | B8 | B6 | src.code()); |
} |
@@ -2157,7 +2161,7 @@ |
// Instruction details available in ARM DDI 0406A, A8-646. |
// cond(31-28) | 1100(27-24)| 010(23-21) | op=0(20) | Rt2(19-16) | |
// Rt(15-12) | 1011(11-8) | 00(7-6) | M(5) | 1(4) | Vm |
- ASSERT(CpuFeatures::IsEnabled(VFP3)); |
+ ASSERT(Isolate::Current()->cpu_features()->IsEnabled(VFP3)); |
ASSERT(!src1.is(pc) && !src2.is(pc)); |
emit(cond | 0xC*B24 | B22 | src2.code()*B16 | |
src1.code()*B12 | 0xB*B8 | B4 | dst.code()); |
@@ -2172,7 +2176,7 @@ |
// Instruction details available in ARM DDI 0406A, A8-646. |
// cond(31-28) | 1100(27-24)| 010(23-21) | op=1(20) | Rt2(19-16) | |
// Rt(15-12) | 1011(11-8) | 00(7-6) | M(5) | 1(4) | Vm |
- ASSERT(CpuFeatures::IsEnabled(VFP3)); |
+ ASSERT(Isolate::Current()->cpu_features()->IsEnabled(VFP3)); |
ASSERT(!dst1.is(pc) && !dst2.is(pc)); |
emit(cond | 0xC*B24 | B22 | B20 | dst2.code()*B16 | |
dst1.code()*B12 | 0xB*B8 | B4 | src.code()); |
@@ -2186,7 +2190,7 @@ |
// Instruction details available in ARM DDI 0406A, A8-642. |
// cond(31-28) | 1110(27-24)| 000(23-21) | op=0(20) | Vn(19-16) | |
// Rt(15-12) | 1010(11-8) | N(7)=0 | 00(6-5) | 1(4) | 0000(3-0) |
- ASSERT(CpuFeatures::IsEnabled(VFP3)); |
+ ASSERT(Isolate::Current()->cpu_features()->IsEnabled(VFP3)); |
ASSERT(!src.is(pc)); |
int sn, n; |
dst.split_code(&sn, &n); |
@@ -2201,7 +2205,7 @@ |
// Instruction details available in ARM DDI 0406A, A8-642. |
// cond(31-28) | 1110(27-24)| 000(23-21) | op=1(20) | Vn(19-16) | |
// Rt(15-12) | 1010(11-8) | N(7)=0 | 00(6-5) | 1(4) | 0000(3-0) |
- ASSERT(CpuFeatures::IsEnabled(VFP3)); |
+ ASSERT(Isolate::Current()->cpu_features()->IsEnabled(VFP3)); |
ASSERT(!dst.is(pc)); |
int sn, n; |
src.split_code(&sn, &n); |
@@ -2326,7 +2330,7 @@ |
const SwVfpRegister src, |
VFPConversionMode mode, |
const Condition cond) { |
- ASSERT(CpuFeatures::IsEnabled(VFP3)); |
+ ASSERT(Isolate::Current()->cpu_features()->IsEnabled(VFP3)); |
emit(EncodeVCVT(F64, dst.code(), S32, src.code(), mode, cond)); |
} |
@@ -2335,7 +2339,7 @@ |
const SwVfpRegister src, |
VFPConversionMode mode, |
const Condition cond) { |
- ASSERT(CpuFeatures::IsEnabled(VFP3)); |
+ ASSERT(Isolate::Current()->cpu_features()->IsEnabled(VFP3)); |
emit(EncodeVCVT(F32, dst.code(), S32, src.code(), mode, cond)); |
} |
@@ -2344,7 +2348,7 @@ |
const SwVfpRegister src, |
VFPConversionMode mode, |
const Condition cond) { |
- ASSERT(CpuFeatures::IsEnabled(VFP3)); |
+ ASSERT(Isolate::Current()->cpu_features()->IsEnabled(VFP3)); |
emit(EncodeVCVT(F64, dst.code(), U32, src.code(), mode, cond)); |
} |
@@ -2353,7 +2357,7 @@ |
const DwVfpRegister src, |
VFPConversionMode mode, |
const Condition cond) { |
- ASSERT(CpuFeatures::IsEnabled(VFP3)); |
+ ASSERT(Isolate::Current()->cpu_features()->IsEnabled(VFP3)); |
emit(EncodeVCVT(S32, dst.code(), F64, src.code(), mode, cond)); |
} |
@@ -2362,7 +2366,7 @@ |
const DwVfpRegister src, |
VFPConversionMode mode, |
const Condition cond) { |
- ASSERT(CpuFeatures::IsEnabled(VFP3)); |
+ ASSERT(Isolate::Current()->cpu_features()->IsEnabled(VFP3)); |
emit(EncodeVCVT(U32, dst.code(), F64, src.code(), mode, cond)); |
} |
@@ -2371,7 +2375,7 @@ |
const SwVfpRegister src, |
VFPConversionMode mode, |
const Condition cond) { |
- ASSERT(CpuFeatures::IsEnabled(VFP3)); |
+ ASSERT(Isolate::Current()->cpu_features()->IsEnabled(VFP3)); |
emit(EncodeVCVT(F64, dst.code(), F32, src.code(), mode, cond)); |
} |
@@ -2380,7 +2384,7 @@ |
const DwVfpRegister src, |
VFPConversionMode mode, |
const Condition cond) { |
- ASSERT(CpuFeatures::IsEnabled(VFP3)); |
+ ASSERT(Isolate::Current()->cpu_features()->IsEnabled(VFP3)); |
emit(EncodeVCVT(F32, dst.code(), F64, src.code(), mode, cond)); |
} |
@@ -2410,7 +2414,7 @@ |
// Instruction details available in ARM DDI 0406A, A8-536. |
// cond(31-28) | 11100(27-23)| D=?(22) | 11(21-20) | Vn(19-16) | |
// Vd(15-12) | 101(11-9) | sz(8)=1 | N(7)=0 | 0(6) | M=?(5) | 0(4) | Vm(3-0) |
- ASSERT(CpuFeatures::IsEnabled(VFP3)); |
+ ASSERT(Isolate::Current()->cpu_features()->IsEnabled(VFP3)); |
emit(cond | 0xE*B24 | 0x3*B20 | src1.code()*B16 | |
dst.code()*B12 | 0x5*B9 | B8 | src2.code()); |
} |
@@ -2425,7 +2429,7 @@ |
// Instruction details available in ARM DDI 0406A, A8-784. |
// cond(31-28) | 11100(27-23)| D=?(22) | 11(21-20) | Vn(19-16) | |
// Vd(15-12) | 101(11-9) | sz(8)=1 | N(7)=0 | 1(6) | M=?(5) | 0(4) | Vm(3-0) |
- ASSERT(CpuFeatures::IsEnabled(VFP3)); |
+ ASSERT(Isolate::Current()->cpu_features()->IsEnabled(VFP3)); |
emit(cond | 0xE*B24 | 0x3*B20 | src1.code()*B16 | |
dst.code()*B12 | 0x5*B9 | B8 | B6 | src2.code()); |
} |
@@ -2440,7 +2444,7 @@ |
// Instruction details available in ARM DDI 0406A, A8-784. |
// cond(31-28) | 11100(27-23)| D=?(22) | 10(21-20) | Vn(19-16) | |
// Vd(15-12) | 101(11-9) | sz(8)=1 | N(7)=0 | 0(6) | M=?(5) | 0(4) | Vm(3-0) |
- ASSERT(CpuFeatures::IsEnabled(VFP3)); |
+ ASSERT(Isolate::Current()->cpu_features()->IsEnabled(VFP3)); |
emit(cond | 0xE*B24 | 0x2*B20 | src1.code()*B16 | |
dst.code()*B12 | 0x5*B9 | B8 | src2.code()); |
} |
@@ -2455,7 +2459,7 @@ |
// Instruction details available in ARM DDI 0406A, A8-584. |
// cond(31-28) | 11101(27-23)| D=?(22) | 00(21-20) | Vn(19-16) | |
// Vd(15-12) | 101(11-9) | sz(8)=1 | N(7)=? | 0(6) | M=?(5) | 0(4) | Vm(3-0) |
- ASSERT(CpuFeatures::IsEnabled(VFP3)); |
+ ASSERT(Isolate::Current()->cpu_features()->IsEnabled(VFP3)); |
emit(cond | 0xE*B24 | B23 | src1.code()*B16 | |
dst.code()*B12 | 0x5*B9 | B8 | src2.code()); |
} |
@@ -2468,7 +2472,7 @@ |
// Instruction details available in ARM DDI 0406A, A8-570. |
// cond(31-28) | 11101 (27-23)| D=?(22) | 11 (21-20) | 0100 (19-16) | |
// Vd(15-12) | 101(11-9) | sz(8)=1 | E(7)=0 | 1(6) | M(5)=? | 0(4) | Vm(3-0) |
- ASSERT(CpuFeatures::IsEnabled(VFP3)); |
+ ASSERT(Isolate::Current()->cpu_features()->IsEnabled(VFP3)); |
emit(cond | 0xE*B24 |B23 | 0x3*B20 | B18 | |
src1.code()*B12 | 0x5*B9 | B8 | B6 | src2.code()); |
} |
@@ -2481,7 +2485,7 @@ |
// Instruction details available in ARM DDI 0406A, A8-570. |
// cond(31-28) | 11101 (27-23)| D=?(22) | 11 (21-20) | 0101 (19-16) | |
// Vd(15-12) | 101(11-9) | sz(8)=1 | E(7)=0 | 1(6) | M(5)=? | 0(4) | 0000(3-0) |
- ASSERT(CpuFeatures::IsEnabled(VFP3)); |
+ ASSERT(Isolate::Current()->cpu_features()->IsEnabled(VFP3)); |
ASSERT(src2 == 0.0); |
emit(cond | 0xE*B24 |B23 | 0x3*B20 | B18 | B16 | |
src1.code()*B12 | 0x5*B9 | B8 | B6); |
@@ -2492,7 +2496,7 @@ |
// Instruction details available in ARM DDI 0406A, A8-652. |
// cond(31-28) | 1110 (27-24) | 1110(23-20)| 0001 (19-16) | |
// Rt(15-12) | 1010 (11-8) | 0(7) | 00 (6-5) | 1(4) | 0000(3-0) |
- ASSERT(CpuFeatures::IsEnabled(VFP3)); |
+ ASSERT(Isolate::Current()->cpu_features()->IsEnabled(VFP3)); |
emit(cond | 0xE*B24 | 0xE*B20 | B16 | |
dst.code()*B12 | 0xA*B8 | B4); |
} |
@@ -2502,7 +2506,7 @@ |
// Instruction details available in ARM DDI 0406A, A8-652. |
// cond(31-28) | 1110 (27-24) | 1111(23-20)| 0001 (19-16) | |
// Rt(15-12) | 1010 (11-8) | 0(7) | 00 (6-5) | 1(4) | 0000(3-0) |
- ASSERT(CpuFeatures::IsEnabled(VFP3)); |
+ ASSERT(Isolate::Current()->cpu_features()->IsEnabled(VFP3)); |
emit(cond | 0xE*B24 | 0xF*B20 | B16 | |
dst.code()*B12 | 0xA*B8 | B4); |
} |
@@ -2513,7 +2517,7 @@ |
const Condition cond) { |
// cond(31-28) | 11101 (27-23)| D=?(22) | 11 (21-20) | 0001 (19-16) | |
// Vd(15-12) | 101(11-9) | sz(8)=1 | 11 (7-6) | M(5)=? | 0(4) | Vm(3-0) |
- ASSERT(CpuFeatures::IsEnabled(VFP3)); |
+ ASSERT(Isolate::Current()->cpu_features()->IsEnabled(VFP3)); |
emit(cond | 0xE*B24 | B23 | 0x3*B20 | B16 | |
dst.code()*B12 | 0x5*B9 | B8 | 3*B6 | src.code()); |
} |