Index: src/x64/code-stubs-x64.cc |
diff --git a/src/x64/code-stubs-x64.cc b/src/x64/code-stubs-x64.cc |
index 81fa29b911a0eea55090215bf75df2b6356cb7a6..8604c83634f226d3eb7384f3aa4b9bde95604f7f 100644 |
--- a/src/x64/code-stubs-x64.cc |
+++ b/src/x64/code-stubs-x64.cc |
@@ -5564,170 +5564,6 @@ void CallApiGetterStub::Generate(MacroAssembler* masm) { |
NULL); |
} |
-namespace { |
- |
-void GetTypedArrayBackingStore(MacroAssembler* masm, Register backing_store, |
- Register object, Register scratch) { |
- Label offset_is_not_smi, done; |
- __ movp(scratch, FieldOperand(object, JSTypedArray::kBufferOffset)); |
- __ movp(backing_store, |
- FieldOperand(scratch, JSArrayBuffer::kBackingStoreOffset)); |
- |
- __ movp(scratch, FieldOperand(object, JSArrayBufferView::kByteOffsetOffset)); |
- __ JumpIfNotSmi(scratch, &offset_is_not_smi, Label::kNear); |
- // offset is smi |
- __ SmiToInteger32(scratch, scratch); |
- __ addp(backing_store, scratch); |
- __ jmp(&done, Label::kNear); |
- |
- // offset is a heap number |
- __ bind(&offset_is_not_smi); |
- __ Movsd(xmm0, FieldOperand(scratch, HeapNumber::kValueOffset)); |
- __ Cvttsd2siq(scratch, xmm0); |
- __ addp(backing_store, scratch); |
- __ bind(&done); |
-} |
- |
-void TypedArrayJumpTablePrologue(MacroAssembler* masm, Register object, |
- Register scratch, Register scratch2, |
- Label* table) { |
- __ movp(scratch, FieldOperand(object, JSObject::kElementsOffset)); |
- __ movp(scratch, FieldOperand(scratch, HeapObject::kMapOffset)); |
- __ movzxbl(scratch, FieldOperand(scratch, Map::kInstanceTypeOffset)); |
- __ subl(scratch, Immediate(static_cast<uint8_t>(FIXED_INT8_ARRAY_TYPE))); |
- __ Assert(above_equal, kOffsetOutOfRange); |
- __ leaq(scratch2, Operand(table)); |
- __ jmp(Operand(scratch2, scratch, times_8, 0)); |
-} |
- |
-void TypedArrayJumpTableEpilogue(MacroAssembler* masm, Label* table, Label* i8, |
- Label* u8, Label* i16, Label* u16, Label* i32, |
- Label* u32, Label* u8c) { |
- STATIC_ASSERT(FIXED_UINT8_ARRAY_TYPE == FIXED_INT8_ARRAY_TYPE + 1); |
- STATIC_ASSERT(FIXED_INT16_ARRAY_TYPE == FIXED_INT8_ARRAY_TYPE + 2); |
- STATIC_ASSERT(FIXED_UINT16_ARRAY_TYPE == FIXED_INT8_ARRAY_TYPE + 3); |
- STATIC_ASSERT(FIXED_INT32_ARRAY_TYPE == FIXED_INT8_ARRAY_TYPE + 4); |
- STATIC_ASSERT(FIXED_UINT32_ARRAY_TYPE == FIXED_INT8_ARRAY_TYPE + 5); |
- STATIC_ASSERT(FIXED_FLOAT32_ARRAY_TYPE == FIXED_INT8_ARRAY_TYPE + 6); |
- STATIC_ASSERT(FIXED_FLOAT64_ARRAY_TYPE == FIXED_INT8_ARRAY_TYPE + 7); |
- STATIC_ASSERT(FIXED_UINT8_CLAMPED_ARRAY_TYPE == FIXED_INT8_ARRAY_TYPE + 8); |
- |
- Label abort; |
- __ bind(table); |
- __ dq(i8); // Int8Array |
- __ dq(u8); // Uint8Array |
- __ dq(i16); // Int16Array |
- __ dq(u16); // Uint16Array |
- __ dq(i32); // Int32Array |
- __ dq(u32); // Uint32Array |
- __ dq(&abort); // Float32Array |
- __ dq(&abort); // Float64Array |
- __ dq(u8c); // Uint8ClampedArray |
- |
- __ bind(&abort); |
- __ Abort(kNoReason); |
-} |
- |
-void ReturnInteger32(MacroAssembler* masm, XMMRegister dst, Register value, |
- Label* use_heap_number) { |
- Label not_smi; |
- if (!value.is(rax)) { |
- __ movp(rax, value); |
- } |
- __ JumpIfNotValidSmiValue(rax, ¬_smi, Label::kNear); |
- __ Integer32ToSmi(rax, rax); |
- __ Ret(); |
- |
- __ bind(¬_smi); |
- __ Cvtlsi2sd(dst, rax); |
- __ jmp(use_heap_number); |
-} |
- |
-void ReturnUnsignedInteger32(MacroAssembler* masm, XMMRegister dst, |
- Register value, Label* use_heap_number) { |
- Label not_smi; |
- if (!value.is(rax)) { |
- __ movp(rax, value); |
- } |
- __ JumpIfUIntNotValidSmiValue(rax, ¬_smi, Label::kNear); |
- __ Integer32ToSmi(rax, rax); |
- __ Ret(); |
- |
- __ bind(¬_smi); |
- __ Cvtqsi2sd(dst, rax); |
- __ jmp(use_heap_number); |
-} |
- |
-void ReturnAllocatedHeapNumber(MacroAssembler* masm, XMMRegister value, |
- Register scratch) { |
- Label call_runtime; |
- __ AllocateHeapNumber(rax, scratch, &call_runtime); |
- __ Movsd(FieldOperand(rax, HeapNumber::kValueOffset), value); |
- __ Ret(); |
- |
- __ bind(&call_runtime); |
- { |
- FrameScope scope(masm, StackFrame::INTERNAL); |
- __ CallRuntimeSaveDoubles(Runtime::kAllocateHeapNumber); |
- __ Movsd(FieldOperand(rax, HeapNumber::kValueOffset), value); |
- } |
- __ Ret(); |
-} |
- |
-} // anonymous namespace |
- |
-void AtomicsLoadStub::Generate(MacroAssembler* masm) { |
- Register object = rdx; |
- Register index = rax; // Index is an untagged word32. |
- Register backing_store = rbx; |
- Label table; |
- |
- GetTypedArrayBackingStore(masm, backing_store, object, kScratchRegister); |
- TypedArrayJumpTablePrologue(masm, object, rcx, kScratchRegister, &table); |
- |
- Label i8, u8, i16, u16, i32, u32; |
- |
- __ bind(&i8); |
- __ movb(rax, Operand(backing_store, index, times_1, 0)); |
- __ movsxbl(rax, rax); |
- __ Integer32ToSmi(rax, rax); |
- __ Ret(); |
- |
- __ bind(&u8); |
- __ movb(rax, Operand(backing_store, index, times_1, 0)); |
- __ movzxbl(rax, rax); |
- __ Integer32ToSmi(rax, rax); |
- __ Ret(); |
- |
- __ bind(&i16); |
- __ movw(rax, Operand(backing_store, index, times_2, 0)); |
- __ movsxwl(rax, rax); |
- __ Integer32ToSmi(rax, rax); |
- __ Ret(); |
- |
- __ bind(&u16); |
- __ movw(rax, Operand(backing_store, index, times_2, 0)); |
- __ movzxwl(rax, rax); |
- __ Integer32ToSmi(rax, rax); |
- __ Ret(); |
- |
- Label use_heap_number; |
- |
- __ bind(&i32); |
- __ movl(rax, Operand(backing_store, index, times_4, 0)); |
- ReturnInteger32(masm, xmm0, rax, &use_heap_number); |
- |
- __ bind(&u32); |
- __ movl(rax, Operand(backing_store, index, times_4, 0)); |
- ReturnUnsignedInteger32(masm, xmm0, rax, &use_heap_number); |
- |
- __ bind(&use_heap_number); |
- ReturnAllocatedHeapNumber(masm, xmm0, rcx); |
- |
- TypedArrayJumpTableEpilogue(masm, &table, &i8, &u8, &i16, &u16, &i32, &u32, |
- &u8); |
-} |
- |
#undef __ |
} // namespace internal |