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

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

Issue 508020: Check for undefined in the binary operation stub when convertion to... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 years 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 | test/mjsunit/bitwise-operations-undefined.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2006-2009 the V8 project authors. All rights reserved. 1 // Copyright 2006-2009 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 7535 matching lines...) Expand 10 before | Expand all | Expand 10 after
7546 } 7546 }
7547 } 7547 }
7548 7548
7549 7549
7550 // Input: edx, eax are the left and right objects of a bit op. 7550 // Input: edx, eax are the left and right objects of a bit op.
7551 // Output: eax, ecx are left and right integers for a bit op. 7551 // Output: eax, ecx are left and right integers for a bit op.
7552 void FloatingPointHelper::LoadAsIntegers(MacroAssembler* masm, 7552 void FloatingPointHelper::LoadAsIntegers(MacroAssembler* masm,
7553 bool use_sse3, 7553 bool use_sse3,
7554 Label* conversion_failure) { 7554 Label* conversion_failure) {
7555 // Check float operands. 7555 // Check float operands.
7556 Label arg1_is_object, arg2_is_object, load_arg2; 7556 Label arg1_is_object, check_undefined_arg1;
7557 Label done; 7557 Label arg2_is_object, check_undefined_arg2;
7558 Label load_arg2, done;
7558 7559
7559 __ test(edx, Immediate(kSmiTagMask)); 7560 __ test(edx, Immediate(kSmiTagMask));
7560 __ j(not_zero, &arg1_is_object); 7561 __ j(not_zero, &arg1_is_object);
7561 __ SmiUntag(edx); 7562 __ SmiUntag(edx);
7562 __ jmp(&load_arg2); 7563 __ jmp(&load_arg2);
7563 7564
7565 // If the argument is undefined it converts to zero (ECMA-262, section 9.5).
7566 __ bind(&check_undefined_arg1);
7567 __ cmp(edx, Factory::undefined_value());
7568 __ j(not_equal, conversion_failure);
7569 __ mov(edx, Immediate(0));
7570 __ jmp(&load_arg2);
7571
7564 __ bind(&arg1_is_object); 7572 __ bind(&arg1_is_object);
7565 __ mov(ebx, FieldOperand(edx, HeapObject::kMapOffset)); 7573 __ mov(ebx, FieldOperand(edx, HeapObject::kMapOffset));
7566 __ cmp(ebx, Factory::heap_number_map()); 7574 __ cmp(ebx, Factory::heap_number_map());
7567 __ j(not_equal, conversion_failure); 7575 __ j(not_equal, &check_undefined_arg1);
7568 // Get the untagged integer version of the edx heap number in ecx. 7576 // Get the untagged integer version of the edx heap number in ecx.
7569 IntegerConvert(masm, edx, use_sse3, conversion_failure); 7577 IntegerConvert(masm, edx, use_sse3, conversion_failure);
7570 __ mov(edx, ecx); 7578 __ mov(edx, ecx);
7571 7579
7572 // Here edx has the untagged integer, eax has a Smi or a heap number. 7580 // Here edx has the untagged integer, eax has a Smi or a heap number.
7573 __ bind(&load_arg2); 7581 __ bind(&load_arg2);
7574 // Test if arg2 is a Smi. 7582 // Test if arg2 is a Smi.
7575 __ test(eax, Immediate(kSmiTagMask)); 7583 __ test(eax, Immediate(kSmiTagMask));
7576 __ j(not_zero, &arg2_is_object); 7584 __ j(not_zero, &arg2_is_object);
7577 __ SmiUntag(eax); 7585 __ SmiUntag(eax);
7578 __ mov(ecx, eax); 7586 __ mov(ecx, eax);
7579 __ jmp(&done); 7587 __ jmp(&done);
7580 7588
7589 // If the argument is undefined it converts to zero (ECMA-262, section 9.5).
7590 __ bind(&check_undefined_arg2);
7591 __ cmp(eax, Factory::undefined_value());
7592 __ j(not_equal, conversion_failure);
7593 __ mov(ecx, Immediate(0));
7594 __ jmp(&done);
7595
7581 __ bind(&arg2_is_object); 7596 __ bind(&arg2_is_object);
7582 __ mov(ebx, FieldOperand(eax, HeapObject::kMapOffset)); 7597 __ mov(ebx, FieldOperand(eax, HeapObject::kMapOffset));
7583 __ cmp(ebx, Factory::heap_number_map()); 7598 __ cmp(ebx, Factory::heap_number_map());
7584 __ j(not_equal, conversion_failure); 7599 __ j(not_equal, &check_undefined_arg2);
7585 // Get the untagged integer version of the eax heap number in ecx. 7600 // Get the untagged integer version of the eax heap number in ecx.
7586 IntegerConvert(masm, eax, use_sse3, conversion_failure); 7601 IntegerConvert(masm, eax, use_sse3, conversion_failure);
7587 __ bind(&done); 7602 __ bind(&done);
7588 __ mov(eax, edx); 7603 __ mov(eax, edx);
7589 } 7604 }
7590 7605
7591 7606
7592 void FloatingPointHelper::LoadFloatOperand(MacroAssembler* masm, 7607 void FloatingPointHelper::LoadFloatOperand(MacroAssembler* masm,
7593 Register number) { 7608 Register number) {
7594 Label load_smi, done; 7609 Label load_smi, done;
(...skipping 1331 matching lines...) Expand 10 before | Expand all | Expand 10 after
8926 __ add(Operand(dest), Immediate(2)); 8941 __ add(Operand(dest), Immediate(2));
8927 } 8942 }
8928 __ sub(Operand(count), Immediate(1)); 8943 __ sub(Operand(count), Immediate(1));
8929 __ j(not_zero, &loop); 8944 __ j(not_zero, &loop);
8930 } 8945 }
8931 8946
8932 8947
8933 #undef __ 8948 #undef __
8934 8949
8935 } } // namespace v8::internal 8950 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/bitwise-operations-undefined.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698