| Index: src/arm/macro-assembler-arm.cc
|
| diff --git a/src/arm/macro-assembler-arm.cc b/src/arm/macro-assembler-arm.cc
|
| index 7df785776dd50a7ed56993b9b7043e6ac1373b63..c520cc36e5ccba2e2b9e85f10650d4a8040d2d0b 100644
|
| --- a/src/arm/macro-assembler-arm.cc
|
| +++ b/src/arm/macro-assembler-arm.cc
|
| @@ -733,9 +733,11 @@ void MacroAssembler::VFPEnsureFPSCRState(Register scratch) {
|
| bind(&fpscr_done);
|
| }
|
|
|
| -void MacroAssembler::VFPCanonicalizeNaN(const DwVfpRegister value,
|
| +
|
| +void MacroAssembler::VFPCanonicalizeNaN(const DwVfpRegister dst,
|
| + const DwVfpRegister src,
|
| const Condition cond) {
|
| - vsub(value, value, kDoubleRegZero, cond);
|
| + vsub(dst, src, kDoubleRegZero, cond);
|
| }
|
|
|
|
|
| @@ -1020,7 +1022,8 @@ int MacroAssembler::ActivationFrameAlignment() {
|
|
|
|
|
| void MacroAssembler::LeaveExitFrame(bool save_doubles,
|
| - Register argument_count) {
|
| + Register argument_count,
|
| + bool restore_context) {
|
| // Optionally restore all double registers.
|
| if (save_doubles) {
|
| // Calculate the stack location of the saved doubles and restore them.
|
| @@ -1035,10 +1038,14 @@ void MacroAssembler::LeaveExitFrame(bool save_doubles,
|
| mov(ip, Operand(ExternalReference(Isolate::kCEntryFPAddress, isolate())));
|
| str(r3, MemOperand(ip));
|
|
|
| +
|
| // Restore current context from top and clear it in debug mode.
|
| - mov(ip, Operand(ExternalReference(Isolate::kContextAddress, isolate())));
|
| - ldr(cp, MemOperand(ip));
|
| + if (restore_context) {
|
| + mov(ip, Operand(ExternalReference(Isolate::kContextAddress, isolate())));
|
| + ldr(cp, MemOperand(ip));
|
| + }
|
| #ifdef DEBUG
|
| + mov(ip, Operand(ExternalReference(Isolate::kContextAddress, isolate())));
|
| str(r3, MemOperand(ip));
|
| #endif
|
|
|
| @@ -2280,12 +2287,14 @@ static int AddressOffset(ExternalReference ref0, ExternalReference ref1) {
|
| }
|
|
|
|
|
| -void MacroAssembler::CallApiFunctionAndReturn(ExternalReference function,
|
| - Address function_address,
|
| - ExternalReference thunk_ref,
|
| - Register thunk_last_arg,
|
| - int stack_space,
|
| - int return_value_offset) {
|
| +void MacroAssembler::CallApiFunctionAndReturn(
|
| + ExternalReference function,
|
| + Address function_address,
|
| + ExternalReference thunk_ref,
|
| + Register thunk_last_arg,
|
| + int stack_space,
|
| + MemOperand return_value_operand,
|
| + MemOperand* context_restore_operand) {
|
| ExternalReference next_address =
|
| ExternalReference::handle_scope_next_address(isolate());
|
| const int kNextOffset = 0;
|
| @@ -2349,12 +2358,13 @@ void MacroAssembler::CallApiFunctionAndReturn(ExternalReference function,
|
| }
|
|
|
| Label promote_scheduled_exception;
|
| + Label exception_handled;
|
| Label delete_allocated_handles;
|
| Label leave_exit_frame;
|
| Label return_value_loaded;
|
|
|
| // load value from ReturnValue
|
| - ldr(r0, MemOperand(fp, return_value_offset*kPointerSize));
|
| + ldr(r0, return_value_operand);
|
| bind(&return_value_loaded);
|
| // No more valid handles (the result handle was the last one). Restore
|
| // previous handle scope.
|
| @@ -2377,17 +2387,25 @@ void MacroAssembler::CallApiFunctionAndReturn(ExternalReference function,
|
| ldr(r5, MemOperand(ip));
|
| cmp(r4, r5);
|
| b(ne, &promote_scheduled_exception);
|
| + bind(&exception_handled);
|
|
|
| + bool restore_context = context_restore_operand != NULL;
|
| + if (restore_context) {
|
| + ldr(cp, *context_restore_operand);
|
| + }
|
| // LeaveExitFrame expects unwind space to be in a register.
|
| mov(r4, Operand(stack_space));
|
| - LeaveExitFrame(false, r4);
|
| + LeaveExitFrame(false, r4, !restore_context);
|
| mov(pc, lr);
|
|
|
| bind(&promote_scheduled_exception);
|
| - TailCallExternalReference(
|
| - ExternalReference(Runtime::kPromoteScheduledException, isolate()),
|
| - 0,
|
| - 1);
|
| + {
|
| + FrameScope frame(this, StackFrame::INTERNAL);
|
| + CallExternalReference(
|
| + ExternalReference(Runtime::kPromoteScheduledException, isolate()),
|
| + 0);
|
| + }
|
| + jmp(&exception_handled);
|
|
|
| // HandleScope limit has changed. Delete allocated extensions.
|
| bind(&delete_allocated_handles);
|
| @@ -3079,6 +3097,88 @@ void MacroAssembler::JumpIfNotHeapNumber(Register object,
|
| }
|
|
|
|
|
| +void MacroAssembler::LookupNumberStringCache(Register object,
|
| + Register result,
|
| + Register scratch1,
|
| + Register scratch2,
|
| + Register scratch3,
|
| + Label* not_found) {
|
| + // Use of registers. Register result is used as a temporary.
|
| + Register number_string_cache = result;
|
| + Register mask = scratch3;
|
| +
|
| + // Load the number string cache.
|
| + LoadRoot(number_string_cache, Heap::kNumberStringCacheRootIndex);
|
| +
|
| + // Make the hash mask from the length of the number string cache. It
|
| + // contains two elements (number and string) for each cache entry.
|
| + ldr(mask, FieldMemOperand(number_string_cache, FixedArray::kLengthOffset));
|
| + // Divide length by two (length is a smi).
|
| + mov(mask, Operand(mask, ASR, kSmiTagSize + 1));
|
| + sub(mask, mask, Operand(1)); // Make mask.
|
| +
|
| + // Calculate the entry in the number string cache. The hash value in the
|
| + // number string cache for smis is just the smi value, and the hash for
|
| + // doubles is the xor of the upper and lower words. See
|
| + // Heap::GetNumberStringCache.
|
| + Label is_smi;
|
| + Label load_result_from_cache;
|
| + JumpIfSmi(object, &is_smi);
|
| + CheckMap(object,
|
| + scratch1,
|
| + Heap::kHeapNumberMapRootIndex,
|
| + not_found,
|
| + DONT_DO_SMI_CHECK);
|
| +
|
| + STATIC_ASSERT(8 == kDoubleSize);
|
| + add(scratch1,
|
| + object,
|
| + Operand(HeapNumber::kValueOffset - kHeapObjectTag));
|
| + ldm(ia, scratch1, scratch1.bit() | scratch2.bit());
|
| + eor(scratch1, scratch1, Operand(scratch2));
|
| + and_(scratch1, scratch1, Operand(mask));
|
| +
|
| + // Calculate address of entry in string cache: each entry consists
|
| + // of two pointer sized fields.
|
| + add(scratch1,
|
| + number_string_cache,
|
| + Operand(scratch1, LSL, kPointerSizeLog2 + 1));
|
| +
|
| + Register probe = mask;
|
| + ldr(probe, FieldMemOperand(scratch1, FixedArray::kHeaderSize));
|
| + JumpIfSmi(probe, not_found);
|
| + sub(scratch2, object, Operand(kHeapObjectTag));
|
| + vldr(d0, scratch2, HeapNumber::kValueOffset);
|
| + sub(probe, probe, Operand(kHeapObjectTag));
|
| + vldr(d1, probe, HeapNumber::kValueOffset);
|
| + VFPCompareAndSetFlags(d0, d1);
|
| + b(ne, not_found); // The cache did not contain this value.
|
| + b(&load_result_from_cache);
|
| +
|
| + bind(&is_smi);
|
| + Register scratch = scratch1;
|
| + and_(scratch, mask, Operand(object, ASR, 1));
|
| + // Calculate address of entry in string cache: each entry consists
|
| + // of two pointer sized fields.
|
| + add(scratch,
|
| + number_string_cache,
|
| + Operand(scratch, LSL, kPointerSizeLog2 + 1));
|
| +
|
| + // Check if the entry is the smi we are looking for.
|
| + ldr(probe, FieldMemOperand(scratch, FixedArray::kHeaderSize));
|
| + cmp(object, probe);
|
| + b(ne, not_found);
|
| +
|
| + // Get the result from the cache.
|
| + bind(&load_result_from_cache);
|
| + ldr(result, FieldMemOperand(scratch, FixedArray::kHeaderSize + kPointerSize));
|
| + IncrementCounter(isolate()->counters()->number_to_string_native(),
|
| + 1,
|
| + scratch1,
|
| + scratch2);
|
| +}
|
| +
|
| +
|
| void MacroAssembler::JumpIfNonSmisNotBothSequentialAsciiStrings(
|
| Register first,
|
| Register second,
|
|
|