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

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

Issue 12212162: Properly support undefined->0 conversion in ia32 bitwise BinaryOpStubs (regression fix for r13624) (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 10 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 | Annotate | Revision Log
« 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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 2749 matching lines...) Expand 10 before | Expand all | Expand 10 after
2760 __ bind(&check_undefined_arg1); 2760 __ bind(&check_undefined_arg1);
2761 Factory* factory = masm->isolate()->factory(); 2761 Factory* factory = masm->isolate()->factory();
2762 __ cmp(edx, factory->undefined_value()); 2762 __ cmp(edx, factory->undefined_value());
2763 __ j(not_equal, conversion_failure); 2763 __ j(not_equal, conversion_failure);
2764 __ mov(edx, Immediate(0)); 2764 __ mov(edx, Immediate(0));
2765 __ jmp(&load_arg2); 2765 __ jmp(&load_arg2);
2766 2766
2767 __ bind(&arg1_is_object); 2767 __ bind(&arg1_is_object);
2768 __ mov(ebx, FieldOperand(edx, HeapObject::kMapOffset)); 2768 __ mov(ebx, FieldOperand(edx, HeapObject::kMapOffset));
2769 __ cmp(ebx, factory->heap_number_map()); 2769 __ cmp(ebx, factory->heap_number_map());
2770 __ j(not_equal, &check_undefined_arg1);
2771
2772 // Get the untagged integer version of the edx heap number in ecx.
2770 if (left_type == BinaryOpIC::INT32 && CpuFeatures::IsSupported(SSE2)) { 2773 if (left_type == BinaryOpIC::INT32 && CpuFeatures::IsSupported(SSE2)) {
2771 CpuFeatures::Scope use_sse2(SSE2); 2774 CpuFeatures::Scope use_sse2(SSE2);
2772 __ j(not_equal, conversion_failure);
2773 // Get the untagged integer version of the edx heap number in ecx.
2774 ConvertHeapNumberToInt32(masm, edx, conversion_failure); 2775 ConvertHeapNumberToInt32(masm, edx, conversion_failure);
2775 } else { 2776 } else {
2776 __ j(not_equal, &check_undefined_arg1);
2777 // Get the untagged integer version of the edx heap number in ecx.
2778 IntegerConvert(masm, edx, use_sse3, conversion_failure); 2777 IntegerConvert(masm, edx, use_sse3, conversion_failure);
2779 } 2778 }
2780 __ mov(edx, ecx); 2779 __ mov(edx, ecx);
2781 2780
2782 // Here edx has the untagged integer, eax has a Smi or a heap number. 2781 // Here edx has the untagged integer, eax has a Smi or a heap number.
2783 __ bind(&load_arg2); 2782 __ bind(&load_arg2);
2784 2783
2785 // Test if arg2 is a Smi. 2784 // Test if arg2 is a Smi.
2786 if (right_type == BinaryOpIC::SMI) { 2785 if (right_type == BinaryOpIC::SMI) {
2787 __ JumpIfNotSmi(eax, conversion_failure); 2786 __ JumpIfNotSmi(eax, conversion_failure);
2788 } else { 2787 } else {
2789 __ JumpIfNotSmi(eax, &arg2_is_object, Label::kNear); 2788 __ JumpIfNotSmi(eax, &arg2_is_object, Label::kNear);
2790 } 2789 }
2791 2790
2792 __ SmiUntag(eax); 2791 __ SmiUntag(eax);
2793 __ mov(ecx, eax); 2792 __ mov(ecx, eax);
2794 __ jmp(&done); 2793 __ jmp(&done);
2795 2794
2796 // If the argument is undefined it converts to zero (ECMA-262, section 9.5). 2795 // If the argument is undefined it converts to zero (ECMA-262, section 9.5).
2797 __ bind(&check_undefined_arg2); 2796 __ bind(&check_undefined_arg2);
2798 __ cmp(eax, factory->undefined_value()); 2797 __ cmp(eax, factory->undefined_value());
2799 __ j(not_equal, conversion_failure); 2798 __ j(not_equal, conversion_failure);
2800 __ mov(ecx, Immediate(0)); 2799 __ mov(ecx, Immediate(0));
2801 __ jmp(&done); 2800 __ jmp(&done);
2802 2801
2803 __ bind(&arg2_is_object); 2802 __ bind(&arg2_is_object);
2804 __ mov(ebx, FieldOperand(eax, HeapObject::kMapOffset)); 2803 __ mov(ebx, FieldOperand(eax, HeapObject::kMapOffset));
2805 __ cmp(ebx, factory->heap_number_map()); 2804 __ cmp(ebx, factory->heap_number_map());
2805 __ j(not_equal, &check_undefined_arg2);
2806 // Get the untagged integer version of the eax heap number in ecx.
2807
2806 if (right_type == BinaryOpIC::INT32 && CpuFeatures::IsSupported(SSE2)) { 2808 if (right_type == BinaryOpIC::INT32 && CpuFeatures::IsSupported(SSE2)) {
2807 CpuFeatures::Scope use_sse2(SSE2); 2809 CpuFeatures::Scope use_sse2(SSE2);
2808 __ j(not_equal, conversion_failure);
2809 // Get the untagged integer version of the eax heap number in ecx.
2810 ConvertHeapNumberToInt32(masm, eax, conversion_failure); 2810 ConvertHeapNumberToInt32(masm, eax, conversion_failure);
2811 } else { 2811 } else {
2812 __ j(not_equal, &check_undefined_arg2);
2813 // Get the untagged integer version of the eax heap number in ecx.
2814 IntegerConvert(masm, eax, use_sse3, conversion_failure); 2812 IntegerConvert(masm, eax, use_sse3, conversion_failure);
2815 } 2813 }
2816 2814
2817 __ bind(&done); 2815 __ bind(&done);
2818 __ mov(eax, edx); 2816 __ mov(eax, edx);
2819 } 2817 }
2820 2818
2821 2819
2822 void FloatingPointHelper::LoadFloatOperand(MacroAssembler* masm, 2820 void FloatingPointHelper::LoadFloatOperand(MacroAssembler* masm,
2823 Register number) { 2821 Register number) {
(...skipping 4874 matching lines...) Expand 10 before | Expand all | Expand 10 after
7698 // Restore ecx. 7696 // Restore ecx.
7699 __ pop(ecx); 7697 __ pop(ecx);
7700 __ ret(0); 7698 __ ret(0);
7701 } 7699 }
7702 7700
7703 #undef __ 7701 #undef __
7704 7702
7705 } } // namespace v8::internal 7703 } } // namespace v8::internal
7706 7704
7707 #endif // V8_TARGET_ARCH_IA32 7705 #endif // V8_TARGET_ARCH_IA32
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