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

Unified Diff: src/x64/code-stubs-x64.cc

Issue 1617503003: [Atomics] code stubs for atomic operations (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: src/x64/code-stubs-x64.cc
diff --git a/src/x64/code-stubs-x64.cc b/src/x64/code-stubs-x64.cc
index 7f976940b5a2213e505c3af0005405d9efb1dc8b..8fdbf837a2c62c3b58ba1b8563fe32298c053147 100644
--- a/src/x64/code-stubs-x64.cc
+++ b/src/x64/code-stubs-x64.cc
@@ -5424,6 +5424,79 @@ void CallApiGetterStub::Generate(MacroAssembler* masm) {
}
+void AtomicsLoadStub::Generate(MacroAssembler* masm) {
+ Register object = rdx;
+ Register index = rax;
+ Label table, i8, u8, i16, u16, i32, u32, f32, f64, u8c;
+
+ __ int3();
+ __ movp(rax, FieldOperand(object, JSTypedArray::kBufferOffset));
+ __ movp(rax, FieldOperand(object, JSArrayBuffer::kBackingStoreOffset));
+
+ __ movp(rcx, FieldOperand(object, JSObject::kElementsOffset));
+ __ movp(rcx, FieldOperand(rcx, HeapObject::kMapOffset));
+ __ movzxbl(rcx, FieldOperand(rcx, Map::kInstanceTypeOffset));
+ __ subb(rcx, Immediate(static_cast<int8_t>(FIXED_INT8_ARRAY_TYPE)));
+ __ Assert(below, kOffsetOutOfRange);
+ __ leaq(kScratchRegister, Operand(&table));
+ __ jmp(Operand(kScratchRegister, rcx, times_8, 0));
+
+ __ bind(&i8);
+ __ movl(rax, Immediate(1));
+ __ Integer32ToSmi(rax, rax);
+ __ Ret();
+
+ __ bind(&u8);
+ __ movl(rax, Immediate(2));
+ __ Integer32ToSmi(rax, rax);
+ __ Ret();
+
+ __ bind(&i16);
+ __ movl(rax, Immediate(3));
+ __ Integer32ToSmi(rax, rax);
+ __ Ret();
+
+ __ bind(&u16);
+ __ movl(rax, Immediate(4));
+ __ Integer32ToSmi(rax, rax);
+ __ Ret();
+
+ __ bind(&i32);
+ __ movl(rax, Immediate(5));
+ __ Integer32ToSmi(rax, rax);
+ __ Ret();
+
+ __ bind(&u32);
+ __ movl(rax, Immediate(6));
+ __ Integer32ToSmi(rax, rax);
+ __ Ret();
+
+ __ bind(&f32);
+ __ Abort(kNoReason);
+
+ __ bind(&f64);
+ __ Abort(kNoReason);
+
+ __ bind(&u8c);
+ __ movl(rax, Immediate(7));
+ __ Integer32ToSmi(rax, rax);
+ __ Ret();
+
+ __ bind(&table);
+ __ dq(&i8);
+ __ dq(&u8);
+ __ dq(&i16);
+ __ dq(&u16);
+ __ dq(&i32);
+ __ dq(&u32);
+ __ dq(&f32);
+ __ dq(&f64);
+ __ dq(&u8c);
+
+ __ Ret();
+}
+
+
#undef __
} // namespace internal

Powered by Google App Engine
This is Rietveld 408576698