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

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

Issue 1883903002: [Atomics] Handle conversion to SMI in builtin, not code stub. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: properly handle signed vs. unsigned 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
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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_ARM64 5 #if V8_TARGET_ARCH_ARM64
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/bootstrapper.h" 9 #include "src/bootstrapper.h"
10 #include "src/codegen.h" 10 #include "src/codegen.h"
(...skipping 5989 matching lines...) Expand 10 before | Expand all | Expand 10 after
6000 __ B(u32); // Uint32Array 6000 __ B(u32); // Uint32Array
6001 __ B(&abort); // Float32Array 6001 __ B(&abort); // Float32Array
6002 __ B(&abort); // Float64Array 6002 __ B(&abort); // Float64Array
6003 __ B(u8c); // Uint8ClampedArray 6003 __ B(u8c); // Uint8ClampedArray
6004 __ EndBlockPools(); 6004 __ EndBlockPools();
6005 6005
6006 __ Bind(&abort); 6006 __ Bind(&abort);
6007 __ Abort(kNoReason); 6007 __ Abort(kNoReason);
6008 } 6008 }
6009 6009
6010 void ReturnUnsignedInteger32(MacroAssembler* masm, FPRegister dst,
6011 Register value, Register scratch,
6012 Register scratch2) {
6013 Label not_smi, call_runtime;
6014 __ Tbnz(value, 31, &not_smi);
6015 __ SmiTag(x0, value);
6016 __ Ret();
6017
6018 __ Bind(&not_smi);
6019 __ Ucvtf(dst, value);
6020 __ AllocateHeapNumber(x0, &call_runtime, scratch, scratch2, dst);
6021 __ Ret();
6022
6023 __ Bind(&call_runtime);
6024 {
6025 FrameScope scope(masm, StackFrame::INTERNAL);
6026 __ CallRuntimeSaveDoubles(Runtime::kAllocateHeapNumber);
6027 __ Str(value, FieldMemOperand(x0, HeapNumber::kValueOffset));
6028 }
6029 __ Ret();
6030 }
6031
6032 } // anonymous namespace 6010 } // anonymous namespace
6033 6011
6034 void AtomicsLoadStub::Generate(MacroAssembler* masm) { 6012 void AtomicsLoadStub::Generate(MacroAssembler* masm) {
6035 Register object = x1; 6013 Register object = x1;
6036 Register index = x0; // Index is an untagged word32. 6014 Register index = x0; // Index is an untagged word32.
6037 Register backing_store = x2; 6015 Register backing_store = x2;
6038 Label i8, u8, i16, u16, i32, u32; 6016 Label i8, u8, i16, u16, i32, u32;
6039 6017
6040 GetTypedArrayBackingStore(masm, backing_store, object, x3, d0); 6018 GetTypedArrayBackingStore(masm, backing_store, object, x3, d0);
6041 TypedArrayJumpTable(masm, object, x3, x4, &i8, &u8, &i16, &u16, &i32, &u32, 6019 TypedArrayJumpTable(masm, object, x3, x4, &i8, &u8, &i16, &u16, &i32, &u32,
6042 &u8); 6020 &u8);
6043 6021
6044 __ Bind(&i8); 6022 __ Bind(&i8);
6045 __ Ldrsb(x0, MemOperand(backing_store, index)); 6023 __ Ldrsb(x0, MemOperand(backing_store, index));
6046 __ Dmb(InnerShareable, BarrierAll); 6024 __ Dmb(InnerShareable, BarrierAll);
6047 __ SmiTag(x0);
6048 __ Ret(); 6025 __ Ret();
6049 6026
6050 __ Bind(&u8); 6027 __ Bind(&u8);
6051 __ Ldrb(x0, MemOperand(backing_store, index)); 6028 __ Ldrb(x0, MemOperand(backing_store, index));
6052 __ Dmb(InnerShareable, BarrierAll); 6029 __ Dmb(InnerShareable, BarrierAll);
6053 __ SmiTag(x0);
6054 __ Ret(); 6030 __ Ret();
6055 6031
6056 __ Bind(&i16); 6032 __ Bind(&i16);
6057 __ Ldrsh(x0, MemOperand(backing_store, index, UXTW, 1)); 6033 __ Ldrsh(x0, MemOperand(backing_store, index, UXTW, 1));
6058 __ Dmb(InnerShareable, BarrierAll); 6034 __ Dmb(InnerShareable, BarrierAll);
6059 __ SmiTag(x0);
6060 __ Ret(); 6035 __ Ret();
6061 6036
6062 __ Bind(&u16); 6037 __ Bind(&u16);
6063 __ Ldrh(x0, MemOperand(backing_store, index, UXTW, 1)); 6038 __ Ldrh(x0, MemOperand(backing_store, index, UXTW, 1));
6064 __ Dmb(InnerShareable, BarrierAll); 6039 __ Dmb(InnerShareable, BarrierAll);
6065 __ SmiTag(x0);
6066 __ Ret(); 6040 __ Ret();
6067 6041
6068 __ Bind(&i32); 6042 __ Bind(&i32);
6069 __ Ldrsw(x0, MemOperand(backing_store, index, UXTW, 2)); 6043 __ Ldrsw(x0, MemOperand(backing_store, index, UXTW, 2));
6070 __ Dmb(InnerShareable, BarrierAll); 6044 __ Dmb(InnerShareable, BarrierAll);
6071 DCHECK(SmiValuesAre32Bits());
6072 __ SmiTag(x0);
6073 __ Ret(); 6045 __ Ret();
6074 6046
6075 __ Bind(&u32); 6047 __ Bind(&u32);
6076 __ Ldr(w0, MemOperand(backing_store, index, UXTW, 2)); 6048 __ Ldr(w0, MemOperand(backing_store, index, UXTW, 2));
6077 __ Dmb(InnerShareable, BarrierAll); 6049 __ Dmb(InnerShareable, BarrierAll);
6078 ReturnUnsignedInteger32(masm, d0, x0, x1, x2); 6050 __ Ret();
6079 } 6051 }
6080 6052
6081 #undef __ 6053 #undef __
6082 6054
6083 } // namespace internal 6055 } // namespace internal
6084 } // namespace v8 6056 } // namespace v8
6085 6057
6086 #endif // V8_TARGET_ARCH_ARM64 6058 #endif // V8_TARGET_ARCH_ARM64
OLDNEW
« no previous file with comments | « src/arm/code-stubs-arm.cc ('k') | src/builtins.cc » ('j') | src/builtins.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698