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

Unified Diff: src/ia32/code-stubs-ia32.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 side-by-side diff with in-line comments
Download patch
Index: src/ia32/code-stubs-ia32.cc
diff --git a/src/ia32/code-stubs-ia32.cc b/src/ia32/code-stubs-ia32.cc
index 52f1d94e966752dbcd677be3eac7163f9e5257c8..3c865433d0d50beb5ad06f82c61446a7badd6af1 100644
--- a/src/ia32/code-stubs-ia32.cc
+++ b/src/ia32/code-stubs-ia32.cc
@@ -5902,59 +5902,6 @@ void TypedArrayJumpTableEpilogue(MacroAssembler* masm, Label* table, Label* i8,
__ Abort(kNoReason);
}
-void ReturnInteger32(MacroAssembler* masm, XMMRegister dst, Register value,
- Register scratch, Label* use_heap_number) {
- Label not_smi;
- if (!value.is(eax)) {
- __ mov(eax, value);
- }
- __ JumpIfNotValidSmiValue(eax, scratch, &not_smi, Label::kNear);
- __ SmiTag(eax);
- __ Ret();
-
- __ bind(&not_smi);
- __ Cvtsi2sd(dst, eax);
- __ jmp(use_heap_number);
-}
-
-void ReturnUnsignedInteger32(MacroAssembler* masm, XMMRegister dst,
- Register value, XMMRegister scratch,
- Label* use_heap_number) {
- Label not_smi;
- if (!value.is(eax)) {
- __ mov(eax, value);
- }
- __ JumpIfUIntNotValidSmiValue(eax, &not_smi, Label::kNear);
- __ SmiTag(eax);
- __ Ret();
-
- __ bind(&not_smi);
- // Convert [0, 2**32-1] -> [-2**31, 2**31-1].
- __ add(eax, Immediate(-0x7fffffff - 1)); // -0x80000000 parses incorrectly.
- __ Cvtsi2sd(dst, eax);
- __ mov(eax, Immediate(0x4f000000)); // 2**31 as IEEE float
- __ movd(scratch, eax);
- __ cvtss2sd(scratch, scratch);
- __ addsd(dst, scratch);
- __ jmp(use_heap_number);
-}
-
-void ReturnAllocatedHeapNumber(MacroAssembler* masm, XMMRegister value,
- Register scratch, Register scratch2) {
- Label call_runtime;
- __ AllocateHeapNumber(eax, scratch, scratch2, &call_runtime);
- __ movsd(FieldOperand(eax, HeapNumber::kValueOffset), value);
- __ Ret();
-
- __ bind(&call_runtime);
- {
- FrameScope scope(masm, StackFrame::INTERNAL);
- __ CallRuntimeSaveDoubles(Runtime::kAllocateHeapNumber);
- __ movsd(FieldOperand(eax, HeapNumber::kValueOffset), value);
- }
- __ Ret();
-}
-
} // anonymous namespace
void AtomicsLoadStub::Generate(MacroAssembler* masm) {
@@ -5971,39 +5918,30 @@ void AtomicsLoadStub::Generate(MacroAssembler* masm) {
__ bind(&i8);
__ mov_b(eax, Operand(backing_store, index, times_1, 0));
__ movsx_b(eax, eax);
- __ SmiTag(eax);
__ Ret();
__ bind(&u8);
__ mov_b(eax, Operand(backing_store, index, times_1, 0));
__ movzx_b(eax, eax);
- __ SmiTag(eax);
__ Ret();
__ bind(&i16);
__ mov_w(eax, Operand(backing_store, index, times_2, 0));
__ movsx_w(eax, eax);
- __ SmiTag(eax);
__ Ret();
__ bind(&u16);
__ mov_w(eax, Operand(backing_store, index, times_2, 0));
__ movzx_w(eax, eax);
- __ SmiTag(eax);
__ Ret();
- Label use_heap_number;
-
__ bind(&i32);
__ mov(eax, Operand(backing_store, index, times_4, 0));
- ReturnInteger32(masm, xmm0, eax, ecx, &use_heap_number);
+ __ Ret();
__ bind(&u32);
__ mov(eax, Operand(backing_store, index, times_4, 0));
- ReturnUnsignedInteger32(masm, xmm0, eax, xmm1, &use_heap_number);
-
- __ bind(&use_heap_number);
- ReturnAllocatedHeapNumber(masm, xmm0, ecx, edx);
+ __ Ret();
TypedArrayJumpTableEpilogue(masm, &table, &i8, &u8, &i16, &u16, &i32, &u32,
&u8);
« src/builtins.cc ('K') | « src/builtins.cc ('k') | src/x64/code-stubs-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698