| Index: src/arm/macro-assembler-arm.cc
|
| diff --git a/src/arm/macro-assembler-arm.cc b/src/arm/macro-assembler-arm.cc
|
| index 2ba98f48780252777efc1bc4009039c66d737bcf..3a1a8b6a6f1a3510edd2b7c8d6a3582ae9bede81 100644
|
| --- a/src/arm/macro-assembler-arm.cc
|
| +++ b/src/arm/macro-assembler-arm.cc
|
| @@ -39,14 +39,11 @@
|
| namespace v8 {
|
| namespace internal {
|
|
|
| -MacroAssembler::MacroAssembler(Isolate* arg_isolate, void* buffer, int size)
|
| - : Assembler(arg_isolate, buffer, size),
|
| +MacroAssembler::MacroAssembler(void* buffer, int size)
|
| + : Assembler(buffer, size),
|
| generating_stub_(false),
|
| - allow_stub_calls_(true) {
|
| - if (isolate() != NULL) {
|
| - code_object_ = Handle<Object>(isolate()->heap()->undefined_value(),
|
| - isolate());
|
| - }
|
| + allow_stub_calls_(true),
|
| + code_object_(HEAP->undefined_value()) {
|
| }
|
|
|
|
|
| @@ -295,7 +292,7 @@ void MacroAssembler::And(Register dst, Register src1, const Operand& src2,
|
|
|
| } else if (!src2.is_single_instruction() &&
|
| !src2.must_use_constant_pool() &&
|
| - CpuFeatures::IsSupported(ARMv7) &&
|
| + Isolate::Current()->cpu_features()->IsSupported(ARMv7) &&
|
| IsPowerOf2(src2.immediate() + 1)) {
|
| ubfx(dst, src1, 0, WhichPowerOf2(src2.immediate() + 1), cond);
|
|
|
| @@ -308,7 +305,7 @@ void MacroAssembler::And(Register dst, Register src1, const Operand& src2,
|
| void MacroAssembler::Ubfx(Register dst, Register src1, int lsb, int width,
|
| Condition cond) {
|
| ASSERT(lsb < 32);
|
| - if (!CpuFeatures::IsSupported(ARMv7)) {
|
| + if (!Isolate::Current()->cpu_features()->IsSupported(ARMv7)) {
|
| int mask = (1 << (width + lsb)) - 1 - ((1 << lsb) - 1);
|
| and_(dst, src1, Operand(mask), LeaveCC, cond);
|
| if (lsb != 0) {
|
| @@ -323,7 +320,7 @@ void MacroAssembler::Ubfx(Register dst, Register src1, int lsb, int width,
|
| void MacroAssembler::Sbfx(Register dst, Register src1, int lsb, int width,
|
| Condition cond) {
|
| ASSERT(lsb < 32);
|
| - if (!CpuFeatures::IsSupported(ARMv7)) {
|
| + if (!Isolate::Current()->cpu_features()->IsSupported(ARMv7)) {
|
| int mask = (1 << (width + lsb)) - 1 - ((1 << lsb) - 1);
|
| and_(dst, src1, Operand(mask), LeaveCC, cond);
|
| int shift_up = 32 - lsb - width;
|
| @@ -351,7 +348,7 @@ void MacroAssembler::Bfi(Register dst,
|
| ASSERT(lsb + width < 32);
|
| ASSERT(!scratch.is(dst));
|
| if (width == 0) return;
|
| - if (!CpuFeatures::IsSupported(ARMv7)) {
|
| + if (!Isolate::Current()->cpu_features()->IsSupported(ARMv7)) {
|
| int mask = (1 << (width + lsb)) - 1 - ((1 << lsb) - 1);
|
| bic(dst, dst, Operand(mask));
|
| and_(scratch, src, Operand((1 << width) - 1));
|
| @@ -365,7 +362,7 @@ void MacroAssembler::Bfi(Register dst,
|
|
|
| void MacroAssembler::Bfc(Register dst, int lsb, int width, Condition cond) {
|
| ASSERT(lsb < 32);
|
| - if (!CpuFeatures::IsSupported(ARMv7)) {
|
| + if (!Isolate::Current()->cpu_features()->IsSupported(ARMv7)) {
|
| int mask = (1 << (width + lsb)) - 1 - ((1 << lsb) - 1);
|
| bic(dst, dst, Operand(mask));
|
| } else {
|
| @@ -376,7 +373,7 @@ void MacroAssembler::Bfc(Register dst, int lsb, int width, Condition cond) {
|
|
|
| void MacroAssembler::Usat(Register dst, int satpos, const Operand& src,
|
| Condition cond) {
|
| - if (!CpuFeatures::IsSupported(ARMv7)) {
|
| + if (!Isolate::Current()->cpu_features()->IsSupported(ARMv7)) {
|
| ASSERT(!dst.is(pc) && !src.rm().is(pc));
|
| ASSERT((satpos >= 0) && (satpos <= 31));
|
|
|
| @@ -622,7 +619,7 @@ void MacroAssembler::Ldrd(Register dst1, Register dst2,
|
| ASSERT_EQ(dst1.code() + 1, dst2.code());
|
|
|
| // Generate two ldr instructions if ldrd is not available.
|
| - if (CpuFeatures::IsSupported(ARMv7)) {
|
| + if (Isolate::Current()->cpu_features()->IsSupported(ARMv7)) {
|
| CpuFeatures::Scope scope(ARMv7);
|
| ldrd(dst1, dst2, src, cond);
|
| } else {
|
| @@ -647,7 +644,7 @@ void MacroAssembler::Strd(Register src1, Register src2,
|
| ASSERT_EQ(src1.code() + 1, src2.code());
|
|
|
| // Generate two str instructions if strd is not available.
|
| - if (CpuFeatures::IsSupported(ARMv7)) {
|
| + if (Isolate::Current()->cpu_features()->IsSupported(ARMv7)) {
|
| CpuFeatures::Scope scope(ARMv7);
|
| strd(src1, src2, dst, cond);
|
| } else {
|
| @@ -1802,10 +1799,9 @@ MaybeObject* MacroAssembler::TryCallApiFunctionAndReturn(
|
| bind(&delete_allocated_handles);
|
| str(r5, MemOperand(r7, kLimitOffset));
|
| mov(r4, r0);
|
| - PrepareCallCFunction(1, r5);
|
| - mov(r0, Operand(ExternalReference::isolate_address()));
|
| + PrepareCallCFunction(0, r5);
|
| CallCFunction(
|
| - ExternalReference::delete_handle_scope_extensions(isolate()), 1);
|
| + ExternalReference::delete_handle_scope_extensions(isolate()), 0);
|
| mov(r0, r4);
|
| jmp(&leave_exit_frame);
|
|
|
| @@ -1906,7 +1902,7 @@ void MacroAssembler::ConvertToInt32(Register source,
|
| Register scratch2,
|
| DwVfpRegister double_scratch,
|
| Label *not_int32) {
|
| - if (CpuFeatures::IsSupported(VFP3)) {
|
| + if (Isolate::Current()->cpu_features()->IsSupported(VFP3)) {
|
| CpuFeatures::Scope scope(VFP3);
|
| sub(scratch, source, Operand(kHeapObjectTag));
|
| vldr(double_scratch, scratch, HeapNumber::kValueOffset);
|
| @@ -2002,7 +1998,7 @@ void MacroAssembler::EmitVFPTruncate(VFPRoundingMode rounding_mode,
|
| Register scratch1,
|
| Register scratch2,
|
| CheckForInexactConversion check_inexact) {
|
| - ASSERT(CpuFeatures::IsSupported(VFP3));
|
| + ASSERT(Isolate::Current()->cpu_features()->IsSupported(VFP3));
|
| CpuFeatures::Scope scope(VFP3);
|
| Register prev_fpscr = scratch1;
|
| Register scratch = scratch2;
|
| @@ -2160,7 +2156,7 @@ void MacroAssembler::EmitECMATruncate(Register result,
|
| void MacroAssembler::GetLeastBitsFromSmi(Register dst,
|
| Register src,
|
| int num_least_bits) {
|
| - if (CpuFeatures::IsSupported(ARMv7)) {
|
| + if (Isolate::Current()->cpu_features()->IsSupported(ARMv7)) {
|
| ubfx(dst, src, kSmiTagSize, num_least_bits);
|
| } else {
|
| mov(dst, Operand(src, ASR, kSmiTagSize));
|
| @@ -2801,6 +2797,9 @@ static const int kRegisterPassedArguments = 4;
|
| void MacroAssembler::PrepareCallCFunction(int num_arguments, Register scratch) {
|
| int frame_alignment = ActivationFrameAlignment();
|
|
|
| + // Reserve space for Isolate address which is always passed as last parameter
|
| + num_arguments += 1;
|
| +
|
| // Up to four simple arguments are passed in registers r0..r3.
|
| int stack_passed_arguments = (num_arguments <= kRegisterPassedArguments) ?
|
| 0 : num_arguments - kRegisterPassedArguments;
|
| @@ -2837,6 +2836,19 @@ void MacroAssembler::CallCFunctionHelper(Register function,
|
| ExternalReference function_reference,
|
| Register scratch,
|
| int num_arguments) {
|
| + // Push Isolate address as the last argument.
|
| + if (num_arguments < kRegisterPassedArguments) {
|
| + Register arg_to_reg[] = {r0, r1, r2, r3};
|
| + Register r = arg_to_reg[num_arguments];
|
| + mov(r, Operand(ExternalReference::isolate_address()));
|
| + } else {
|
| + int stack_passed_arguments = num_arguments - kRegisterPassedArguments;
|
| + // Push Isolate address on the stack after the arguments.
|
| + mov(scratch, Operand(ExternalReference::isolate_address()));
|
| + str(scratch, MemOperand(sp, stack_passed_arguments * kPointerSize));
|
| + }
|
| + num_arguments += 1;
|
| +
|
| // Make sure that the stack is aligned before calling a C function unless
|
| // running in the simulator. The simulator has its own alignment check which
|
| // provides more information.
|
| @@ -2899,7 +2911,7 @@ CodePatcher::CodePatcher(byte* address, int instructions)
|
| : address_(address),
|
| instructions_(instructions),
|
| size_(instructions * Assembler::kInstrSize),
|
| - masm_(Isolate::Current(), address, size_ + Assembler::kGap) {
|
| + masm_(address, size_ + Assembler::kGap) {
|
| // Create a new macro assembler pointing to the address of the code to patch.
|
| // The size is adjusted with kGap on order for the assembler to generate size
|
| // bytes of instructions without failing with buffer size constraints.
|
|
|