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

Side by Side Diff: src/x64/codegen-x64.cc

Issue 2861011: X64: Fix bug in LoadSSE2NumberOperands. It can be called with two smis! (Closed)
Patch Set: Created 10 years, 6 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 | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 9914 matching lines...) Expand 10 before | Expand all | Expand 10 after
9925 9925
9926 void FloatingPointHelper::LoadSSE2SmiOperands(MacroAssembler* masm) { 9926 void FloatingPointHelper::LoadSSE2SmiOperands(MacroAssembler* masm) {
9927 __ SmiToInteger32(kScratchRegister, rdx); 9927 __ SmiToInteger32(kScratchRegister, rdx);
9928 __ cvtlsi2sd(xmm0, kScratchRegister); 9928 __ cvtlsi2sd(xmm0, kScratchRegister);
9929 __ SmiToInteger32(kScratchRegister, rax); 9929 __ SmiToInteger32(kScratchRegister, rax);
9930 __ cvtlsi2sd(xmm1, kScratchRegister); 9930 __ cvtlsi2sd(xmm1, kScratchRegister);
9931 } 9931 }
9932 9932
9933 9933
9934 void FloatingPointHelper::LoadSSE2NumberOperands(MacroAssembler* masm) { 9934 void FloatingPointHelper::LoadSSE2NumberOperands(MacroAssembler* masm) {
9935 if (FLAG_debug_code) {
9936 // Both arguments can not be smis. That case is handled by smi-only code.
9937 Label ok;
9938 __ JumpIfNotBothSmi(rax, rdx, &ok);
9939 __ Abort("Both arguments smi but not handled by smi-code.");
9940 __ bind(&ok);
9941 }
9942 Label load_smi_rdx, load_nonsmi_rax, load_smi_rax, done; 9935 Label load_smi_rdx, load_nonsmi_rax, load_smi_rax, done;
9943 // Load operand in rdx into xmm0. 9936 // Load operand in rdx into xmm0.
9944 __ JumpIfSmi(rdx, &load_smi_rdx); 9937 __ JumpIfSmi(rdx, &load_smi_rdx);
9945 __ movsd(xmm0, FieldOperand(rdx, HeapNumber::kValueOffset)); 9938 __ movsd(xmm0, FieldOperand(rdx, HeapNumber::kValueOffset));
9946 // Load operand in rax into xmm1. 9939 // Load operand in rax into xmm1.
9947 __ JumpIfSmi(rax, &load_smi_rax); 9940 __ JumpIfSmi(rax, &load_smi_rax);
9948 __ bind(&load_nonsmi_rax); 9941 __ bind(&load_nonsmi_rax);
9949 __ movsd(xmm1, FieldOperand(rax, HeapNumber::kValueOffset)); 9942 __ movsd(xmm1, FieldOperand(rax, HeapNumber::kValueOffset));
9950 __ jmp(&done); 9943 __ jmp(&done);
9951 9944
9952 __ bind(&load_smi_rdx); 9945 __ bind(&load_smi_rdx);
9953 __ SmiToInteger32(kScratchRegister, rdx); 9946 __ SmiToInteger32(kScratchRegister, rdx);
9954 __ cvtlsi2sd(xmm0, kScratchRegister); 9947 __ cvtlsi2sd(xmm0, kScratchRegister);
9955 __ jmp(&load_nonsmi_rax); 9948 __ JumpIfNotSmi(rax, &load_nonsmi_rax);
9956 9949
9957 __ bind(&load_smi_rax); 9950 __ bind(&load_smi_rax);
9958 __ SmiToInteger32(kScratchRegister, rax); 9951 __ SmiToInteger32(kScratchRegister, rax);
9959 __ cvtlsi2sd(xmm1, kScratchRegister); 9952 __ cvtlsi2sd(xmm1, kScratchRegister);
9960 9953
9961 __ bind(&done); 9954 __ bind(&done);
9962 } 9955 }
9963 9956
9964 9957
9965 void FloatingPointHelper::LoadSSE2UnknownOperands(MacroAssembler* masm, 9958 void FloatingPointHelper::LoadSSE2UnknownOperands(MacroAssembler* masm,
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
10051 // Both arguments can not be smis. That case is handled by smi-only code. 10044 // Both arguments can not be smis. That case is handled by smi-only code.
10052 Label ok; 10045 Label ok;
10053 __ JumpIfNotBothSmi(rax, rdx, &ok); 10046 __ JumpIfNotBothSmi(rax, rdx, &ok);
10054 __ Abort("Both arguments smi but not handled by smi-code."); 10047 __ Abort("Both arguments smi but not handled by smi-code.");
10055 __ bind(&ok); 10048 __ bind(&ok);
10056 } 10049 }
10057 // Check float operands. 10050 // Check float operands.
10058 Label done; 10051 Label done;
10059 Label rax_is_object; 10052 Label rax_is_object;
10060 Label rdx_is_object; 10053 Label rdx_is_object;
10061 Label rax_is_smi;
10062 Label rdx_is_smi;
10063 10054
10064 __ JumpIfNotSmi(rdx, &rdx_is_object); 10055 __ JumpIfNotSmi(rdx, &rdx_is_object);
10065 __ SmiToInteger32(rdx, rdx); 10056 __ SmiToInteger32(rdx, rdx);
10066 10057
10067 __ bind(&rax_is_object); 10058 __ bind(&rax_is_object);
10068 IntegerConvert(masm, rcx, rax); // Uses rdi, rcx and rbx. 10059 IntegerConvert(masm, rcx, rax); // Uses rdi, rcx and rbx.
10069 __ jmp(&done); 10060 __ jmp(&done);
10070 10061
10071 __ bind(&rdx_is_object); 10062 __ bind(&rdx_is_object);
10072 IntegerConvert(masm, rdx, rdx); // Uses rdi, rcx and rbx. 10063 IntegerConvert(masm, rdx, rdx); // Uses rdi, rcx and rbx.
10073 __ JumpIfNotSmi(rax, &rax_is_object); 10064 __ JumpIfNotSmi(rax, &rax_is_object);
10074 __ bind(&rax_is_smi);
10075 __ SmiToInteger32(rcx, rax); 10065 __ SmiToInteger32(rcx, rax);
10076 10066
10077 __ bind(&done); 10067 __ bind(&done);
10078 __ movl(rax, rdx); 10068 __ movl(rax, rdx);
10079 } 10069 }
10080 10070
10081 10071
10082 const char* GenericBinaryOpStub::GetName() { 10072 const char* GenericBinaryOpStub::GetName() {
10083 if (name_ != NULL) return name_; 10073 if (name_ != NULL) return name_;
10084 const int len = 100; 10074 const int len = 100;
(...skipping 1836 matching lines...) Expand 10 before | Expand all | Expand 10 after
11921 } 11911 }
11922 11912
11923 #endif 11913 #endif
11924 11914
11925 11915
11926 #undef __ 11916 #undef __
11927 11917
11928 } } // namespace v8::internal 11918 } } // namespace v8::internal
11929 11919
11930 #endif // V8_TARGET_ARCH_X64 11920 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698