Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(557)

Side by Side Diff: src/arm/code-stubs-arm.cc

Issue 1884883003: Revert of [Atomics] code stubs for atomic operations (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | src/arm/interface-descriptors-arm.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #if V8_TARGET_ARCH_ARM 5 #if V8_TARGET_ARCH_ARM
6 6
7 #include "src/code-stubs.h" 7 #include "src/code-stubs.h"
8 #include "src/api-arguments.h" 8 #include "src/api-arguments.h"
9 #include "src/base/bits.h" 9 #include "src/base/bits.h"
10 #include "src/bootstrapper.h" 10 #include "src/bootstrapper.h"
(...skipping 5534 matching lines...) Expand 10 before | Expand all | Expand 10 after
5545 ExternalReference thunk_ref = 5545 ExternalReference thunk_ref =
5546 ExternalReference::invoke_accessor_getter_callback(isolate()); 5546 ExternalReference::invoke_accessor_getter_callback(isolate());
5547 5547
5548 // +3 is to skip prolog, return address and name handle. 5548 // +3 is to skip prolog, return address and name handle.
5549 MemOperand return_value_operand( 5549 MemOperand return_value_operand(
5550 fp, (PropertyCallbackArguments::kReturnValueOffset + 3) * kPointerSize); 5550 fp, (PropertyCallbackArguments::kReturnValueOffset + 3) * kPointerSize);
5551 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, 5551 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref,
5552 kStackUnwindSpace, NULL, return_value_operand, NULL); 5552 kStackUnwindSpace, NULL, return_value_operand, NULL);
5553 } 5553 }
5554 5554
5555 namespace {
5556
5557 void GetTypedArrayBackingStore(MacroAssembler* masm, Register backing_store,
5558 Register object, Register scratch,
5559 LowDwVfpRegister double_scratch) {
5560 Label offset_is_not_smi, done;
5561 __ ldr(scratch, FieldMemOperand(object, JSTypedArray::kBufferOffset));
5562 __ ldr(backing_store,
5563 FieldMemOperand(scratch, JSArrayBuffer::kBackingStoreOffset));
5564 __ ldr(scratch,
5565 FieldMemOperand(object, JSArrayBufferView::kByteOffsetOffset));
5566 __ JumpIfNotSmi(scratch, &offset_is_not_smi);
5567 // offset is smi
5568 __ add(backing_store, backing_store, Operand::SmiUntag(scratch));
5569 __ jmp(&done);
5570
5571 // offset is a heap number
5572 __ bind(&offset_is_not_smi);
5573 __ vldr(double_scratch, scratch, HeapNumber::kValueOffset - kHeapObjectTag);
5574 __ vcvt_u32_f64(double_scratch.low(), double_scratch);
5575 __ vmov(scratch, double_scratch.low());
5576 __ add(backing_store, backing_store, scratch);
5577 __ bind(&done);
5578 }
5579
5580 void TypedArrayJumpTable(MacroAssembler* masm, Register object,
5581 Register scratch, Label* i8, Label* u8, Label* i16,
5582 Label* u16, Label* i32, Label* u32, Label* u8c) {
5583 STATIC_ASSERT(FIXED_UINT8_ARRAY_TYPE == FIXED_INT8_ARRAY_TYPE + 1);
5584 STATIC_ASSERT(FIXED_INT16_ARRAY_TYPE == FIXED_INT8_ARRAY_TYPE + 2);
5585 STATIC_ASSERT(FIXED_UINT16_ARRAY_TYPE == FIXED_INT8_ARRAY_TYPE + 3);
5586 STATIC_ASSERT(FIXED_INT32_ARRAY_TYPE == FIXED_INT8_ARRAY_TYPE + 4);
5587 STATIC_ASSERT(FIXED_UINT32_ARRAY_TYPE == FIXED_INT8_ARRAY_TYPE + 5);
5588 STATIC_ASSERT(FIXED_FLOAT32_ARRAY_TYPE == FIXED_INT8_ARRAY_TYPE + 6);
5589 STATIC_ASSERT(FIXED_FLOAT64_ARRAY_TYPE == FIXED_INT8_ARRAY_TYPE + 7);
5590 STATIC_ASSERT(FIXED_UINT8_CLAMPED_ARRAY_TYPE == FIXED_INT8_ARRAY_TYPE + 8);
5591
5592 __ ldr(scratch, FieldMemOperand(object, JSObject::kElementsOffset));
5593 __ ldr(scratch, FieldMemOperand(scratch, HeapObject::kMapOffset));
5594 __ ldrb(scratch, FieldMemOperand(scratch, Map::kInstanceTypeOffset));
5595 __ sub(scratch, scratch, Operand(static_cast<uint8_t>(FIXED_INT8_ARRAY_TYPE)),
5596 SetCC);
5597 __ Assert(ge, kOffsetOutOfRange);
5598
5599 Label abort;
5600
5601 {
5602 Assembler::BlockConstPoolScope scope(masm);
5603 __ add(pc, pc, Operand(scratch, LSL, 2));
5604 __ nop();
5605 __ b(i8); // Int8Array
5606 __ b(u8); // Uint8Array
5607 __ b(i16); // Int16Array
5608 __ b(u16); // Uint16Array
5609 __ b(i32); // Int32Array
5610 __ b(u32); // Uint32Array
5611 __ b(&abort); // Float32Array
5612 __ b(&abort); // Float64Array
5613 __ b(u8c); // Uint8ClampedArray
5614 }
5615
5616 __ bind(&abort);
5617 __ Abort(kNoReason);
5618 }
5619
5620 void ReturnInteger32(MacroAssembler* masm, DwVfpRegister dst, Register value,
5621 SwVfpRegister single_scratch, Label* use_heap_number) {
5622 Label not_smi;
5623 __ TrySmiTag(r0, value, &not_smi);
5624 __ Ret();
5625
5626 __ bind(&not_smi);
5627 __ vmov(single_scratch, value);
5628 __ vcvt_f64_s32(dst, single_scratch);
5629 __ jmp(use_heap_number);
5630 }
5631
5632 void ReturnUnsignedInteger32(MacroAssembler* masm, DwVfpRegister dst,
5633 Register value, SwVfpRegister single_scratch,
5634 Label* use_heap_number) {
5635 Label not_smi;
5636 __ cmp(value, Operand(0x40000000U));
5637 __ b(cs, &not_smi);
5638 __ SmiTag(r0, value);
5639 __ Ret();
5640
5641 __ bind(&not_smi);
5642 __ vmov(single_scratch, value);
5643 __ vcvt_f64_u32(dst, single_scratch);
5644 __ jmp(use_heap_number);
5645 }
5646
5647 void ReturnAllocatedHeapNumber(MacroAssembler* masm, DwVfpRegister value,
5648 Register scratch, Register scratch2,
5649 Register scratch3) {
5650 Label call_runtime;
5651 __ LoadRoot(scratch3, Heap::kHeapNumberMapRootIndex);
5652 __ AllocateHeapNumber(r0, scratch, scratch2, scratch3, &call_runtime);
5653 __ vstr(value, FieldMemOperand(r0, HeapNumber::kValueOffset));
5654 __ Ret();
5655
5656 __ bind(&call_runtime);
5657 {
5658 FrameScope scope(masm, StackFrame::INTERNAL);
5659 __ CallRuntimeSaveDoubles(Runtime::kAllocateHeapNumber);
5660 __ vstr(value, FieldMemOperand(r0, HeapNumber::kValueOffset));
5661 }
5662 __ Ret();
5663 }
5664
5665 } // anonymous namespace
5666
5667 void AtomicsLoadStub::Generate(MacroAssembler* masm) {
5668 Register object = r1;
5669 Register index = r0; // Index is an untagged word32.
5670 Register backing_store = r2;
5671 Label i8, u8, i16, u16, i32, u32;
5672
5673 GetTypedArrayBackingStore(masm, backing_store, object, r3, d0);
5674 TypedArrayJumpTable(masm, object, r3, &i8, &u8, &i16, &u16, &i32, &u32, &u8);
5675
5676 __ bind(&i8);
5677 __ ldrsb(r0, MemOperand(backing_store, index));
5678 __ dmb(ISH);
5679 __ SmiTag(r0);
5680 __ Ret();
5681
5682 __ bind(&u8);
5683 __ ldrb(r0, MemOperand(backing_store, index));
5684 __ dmb(ISH);
5685 __ SmiTag(r0);
5686 __ Ret();
5687
5688 __ bind(&i16);
5689 __ ldrsh(r0, MemOperand(backing_store, index, LSL, 1));
5690 __ dmb(ISH);
5691 __ SmiTag(r0);
5692 __ Ret();
5693
5694 __ bind(&u16);
5695 __ ldrh(r0, MemOperand(backing_store, index, LSL, 1));
5696 __ dmb(ISH);
5697 __ SmiTag(r0);
5698 __ Ret();
5699
5700 Label use_heap_number;
5701
5702 __ bind(&i32);
5703 __ ldr(r0, MemOperand(backing_store, index, LSL, 2));
5704 __ dmb(ISH);
5705 ReturnInteger32(masm, d0, r0, s2, &use_heap_number);
5706
5707 __ bind(&u32);
5708 __ ldr(r0, MemOperand(backing_store, index, LSL, 2));
5709 __ dmb(ISH);
5710 ReturnUnsignedInteger32(masm, d0, r0, s2, &use_heap_number);
5711
5712 __ bind(&use_heap_number);
5713 ReturnAllocatedHeapNumber(masm, d0, r1, r2, r3);
5714 }
5715 5555
5716 #undef __ 5556 #undef __
5717 5557
5718 } // namespace internal 5558 } // namespace internal
5719 } // namespace v8 5559 } // namespace v8
5720 5560
5721 #endif // V8_TARGET_ARCH_ARM 5561 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « no previous file | src/arm/interface-descriptors-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698