| Index: src/x64/macro-assembler-x64.cc
|
| diff --git a/src/x64/macro-assembler-x64.cc b/src/x64/macro-assembler-x64.cc
|
| index 5180e6b051c0382855ed55c0df16c03780379290..0c605d826dd1f80fa4db3dec59fed95477c350c2 100644
|
| --- a/src/x64/macro-assembler-x64.cc
|
| +++ b/src/x64/macro-assembler-x64.cc
|
| @@ -685,22 +685,8 @@ static int Offset(ExternalReference ref0, ExternalReference ref1) {
|
| }
|
|
|
|
|
| -void MacroAssembler::PrepareCallApiFunction(int arg_stack_space,
|
| - bool returns_handle) {
|
| -#if defined(_WIN64) && !defined(__MINGW64__)
|
| - if (!returns_handle) {
|
| - EnterApiExitFrame(arg_stack_space);
|
| - return;
|
| - }
|
| - // We need to prepare a slot for result handle on stack and put
|
| - // a pointer to it into 1st arg register.
|
| - EnterApiExitFrame(arg_stack_space + 1);
|
| -
|
| - // rcx must be used to pass the pointer to the return value slot.
|
| - lea(rcx, StackSpaceOperand(arg_stack_space));
|
| -#else
|
| +void MacroAssembler::PrepareCallApiFunction(int arg_stack_space) {
|
| EnterApiExitFrame(arg_stack_space);
|
| -#endif
|
| }
|
|
|
|
|
| @@ -708,7 +694,6 @@ void MacroAssembler::CallApiFunctionAndReturn(Address function_address,
|
| Address thunk_address,
|
| Register thunk_last_arg,
|
| int stack_space,
|
| - bool returns_handle,
|
| int return_value_offset) {
|
| Label prologue;
|
| Label promote_scheduled_exception;
|
| @@ -781,23 +766,6 @@ void MacroAssembler::CallApiFunctionAndReturn(Address function_address,
|
| PopSafepointRegisters();
|
| }
|
|
|
| - // Can skip the result check for new-style callbacks
|
| - // TODO(dcarney): may need to pass this information down
|
| - // as some function_addresses might not have been registered
|
| - if (returns_handle) {
|
| - Label empty_result;
|
| -#if defined(_WIN64) && !defined(__MINGW64__)
|
| - // rax keeps a pointer to v8::Handle, unpack it.
|
| - movq(rax, Operand(rax, 0));
|
| -#endif
|
| - // Check if the result handle holds 0.
|
| - testq(rax, rax);
|
| - j(zero, &empty_result);
|
| - // It was non-zero. Dereference to get the result value.
|
| - movq(rax, Operand(rax, 0));
|
| - jmp(&prologue);
|
| - bind(&empty_result);
|
| - }
|
| // Load the value from ReturnValue
|
| movq(rax, Operand(rbp, return_value_offset * kPointerSize));
|
| bind(&prologue);
|
| @@ -990,7 +958,10 @@ void MacroAssembler::Set(const Operand& dst, int64_t x) {
|
| }
|
|
|
|
|
| -bool MacroAssembler::IsUnsafeInt(const int x) {
|
| +// ----------------------------------------------------------------------------
|
| +// Smi tagging, untagging and tag detection.
|
| +
|
| +bool MacroAssembler::IsUnsafeInt(const int32_t x) {
|
| static const int kMaxBits = 17;
|
| return !is_intn(x, kMaxBits);
|
| }
|
| @@ -998,7 +969,7 @@ bool MacroAssembler::IsUnsafeInt(const int x) {
|
|
|
| void MacroAssembler::SafeMove(Register dst, Smi* src) {
|
| ASSERT(!dst.is(kScratchRegister));
|
| - ASSERT(kSmiValueSize == 32); // JIT cookie can be converted to Smi.
|
| + ASSERT(SmiValuesAre32Bits()); // JIT cookie can be converted to Smi.
|
| if (IsUnsafeInt(src->value()) && jit_cookie() != 0) {
|
| Move(dst, Smi::FromInt(src->value() ^ jit_cookie()));
|
| Move(kScratchRegister, Smi::FromInt(jit_cookie()));
|
| @@ -1010,7 +981,7 @@ void MacroAssembler::SafeMove(Register dst, Smi* src) {
|
|
|
|
|
| void MacroAssembler::SafePush(Smi* src) {
|
| - ASSERT(kSmiValueSize == 32); // JIT cookie can be converted to Smi.
|
| + ASSERT(SmiValuesAre32Bits()); // JIT cookie can be converted to Smi.
|
| if (IsUnsafeInt(src->value()) && jit_cookie() != 0) {
|
| Push(Smi::FromInt(src->value() ^ jit_cookie()));
|
| Move(kScratchRegister, Smi::FromInt(jit_cookie()));
|
| @@ -1021,9 +992,6 @@ void MacroAssembler::SafePush(Smi* src) {
|
| }
|
|
|
|
|
| -// ----------------------------------------------------------------------------
|
| -// Smi tagging, untagging and tag detection.
|
| -
|
| Register MacroAssembler::GetSmiConstant(Smi* source) {
|
| int value = source->value();
|
| if (value == 0) {
|
| @@ -2228,6 +2196,49 @@ void MacroAssembler::AddSmiField(Register dst, const Operand& src) {
|
| }
|
|
|
|
|
| +void MacroAssembler::Push(Smi* source) {
|
| + intptr_t smi = reinterpret_cast<intptr_t>(source);
|
| + if (is_int32(smi)) {
|
| + push(Immediate(static_cast<int32_t>(smi)));
|
| + } else {
|
| + Register constant = GetSmiConstant(source);
|
| + push(constant);
|
| + }
|
| +}
|
| +
|
| +
|
| +void MacroAssembler::PushInt64AsTwoSmis(Register src, Register scratch) {
|
| + movq(scratch, src);
|
| + // High bits.
|
| + shr(src, Immediate(64 - kSmiShift));
|
| + shl(src, Immediate(kSmiShift));
|
| + push(src);
|
| + // Low bits.
|
| + shl(scratch, Immediate(kSmiShift));
|
| + push(scratch);
|
| +}
|
| +
|
| +
|
| +void MacroAssembler::PopInt64AsTwoSmis(Register dst, Register scratch) {
|
| + pop(scratch);
|
| + // Low bits.
|
| + shr(scratch, Immediate(kSmiShift));
|
| + pop(dst);
|
| + shr(dst, Immediate(kSmiShift));
|
| + // High bits.
|
| + shl(dst, Immediate(64 - kSmiShift));
|
| + or_(dst, scratch);
|
| +}
|
| +
|
| +
|
| +void MacroAssembler::Test(const Operand& src, Smi* source) {
|
| + testl(Operand(src, kIntSize), Immediate(source->value()));
|
| +}
|
| +
|
| +
|
| +// ----------------------------------------------------------------------------
|
| +
|
| +
|
| void MacroAssembler::JumpIfNotString(Register object,
|
| Register object_map,
|
| Label* not_string,
|
| @@ -2467,17 +2478,6 @@ void MacroAssembler::LoadGlobalCell(Register dst, Handle<Cell> cell) {
|
| }
|
|
|
|
|
| -void MacroAssembler::Push(Smi* source) {
|
| - intptr_t smi = reinterpret_cast<intptr_t>(source);
|
| - if (is_int32(smi)) {
|
| - push(Immediate(static_cast<int32_t>(smi)));
|
| - } else {
|
| - Register constant = GetSmiConstant(source);
|
| - push(constant);
|
| - }
|
| -}
|
| -
|
| -
|
| void MacroAssembler::Drop(int stack_elements) {
|
| if (stack_elements > 0) {
|
| addq(rsp, Immediate(stack_elements * kPointerSize));
|
| @@ -2485,11 +2485,6 @@ void MacroAssembler::Drop(int stack_elements) {
|
| }
|
|
|
|
|
| -void MacroAssembler::Test(const Operand& src, Smi* source) {
|
| - testl(Operand(src, kIntSize), Immediate(source->value()));
|
| -}
|
| -
|
| -
|
| void MacroAssembler::TestBit(const Operand& src, int bits) {
|
| int byte_offset = bits / kBitsPerByte;
|
| int bit_in_byte = bits & (kBitsPerByte - 1);
|
|
|