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

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

Issue 2802028: Let relational comparison operators quickly compare a string with itself. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 10 years, 5 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 | src/x64/codegen-x64.cc » ('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 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 11671 matching lines...) Expand 10 before | Expand all | Expand 10 after
11682 // Test for NaN. Sadly, we can't just compare to Factory::nan_value(), 11682 // Test for NaN. Sadly, we can't just compare to Factory::nan_value(),
11683 // so we do the second best thing - test it ourselves. 11683 // so we do the second best thing - test it ourselves.
11684 // Note: if cc_ != equal, never_nan_nan_ is not used. 11684 // Note: if cc_ != equal, never_nan_nan_ is not used.
11685 if (never_nan_nan_ && (cc_ == equal)) { 11685 if (never_nan_nan_ && (cc_ == equal)) {
11686 __ Set(eax, Immediate(Smi::FromInt(EQUAL))); 11686 __ Set(eax, Immediate(Smi::FromInt(EQUAL)));
11687 __ ret(0); 11687 __ ret(0);
11688 } else { 11688 } else {
11689 Label heap_number; 11689 Label heap_number;
11690 __ cmp(FieldOperand(edx, HeapObject::kMapOffset), 11690 __ cmp(FieldOperand(edx, HeapObject::kMapOffset),
11691 Immediate(Factory::heap_number_map())); 11691 Immediate(Factory::heap_number_map()));
11692 if (cc_ == equal) { 11692 __ j(equal, &heap_number);
11693 __ j(equal, &heap_number); 11693 if (cc_ != equal) {
11694 // Identical objects are equal for operators ==, !=, and ===. 11694 // Call runtime on identical JSObjects. Otherwise return equal.
11695 __ Set(eax, Immediate(Smi::FromInt(EQUAL))); 11695 __ CmpObjectType(eax, FIRST_JS_OBJECT_TYPE, ecx);
11696 __ ret(0); 11696 __ j(above_equal, &not_identical);
11697 } else {
11698 // Identical objects must call ToPrimitive for <, <=, >, and >=.
11699 __ j(not_equal, &not_identical);
11700 } 11697 }
11698 __ Set(eax, Immediate(Smi::FromInt(EQUAL)));
11699 __ ret(0);
11700
11701 __ bind(&heap_number); 11701 __ bind(&heap_number);
11702 // It is a heap number, so return non-equal if it's NaN and equal if 11702 // It is a heap number, so return non-equal if it's NaN and equal if
11703 // it's not NaN. 11703 // it's not NaN.
11704 // The representation of NaN values has all exponent bits (52..62) set, 11704 // The representation of NaN values has all exponent bits (52..62) set,
11705 // and not all mantissa bits (0..51) clear. 11705 // and not all mantissa bits (0..51) clear.
11706 // We only accept QNaNs, which have bit 51 set. 11706 // We only accept QNaNs, which have bit 51 set.
11707 // Read top bits of double representation (second word of value). 11707 // Read top bits of double representation (second word of value).
11708 11708
11709 // Value is a QNaN if value & kQuietNaNMask == kQuietNaNMask, i.e., 11709 // Value is a QNaN if value & kQuietNaNMask == kQuietNaNMask, i.e.,
11710 // all bits in the mask are set. We only need to check the word 11710 // all bits in the mask are set. We only need to check the word
(...skipping 2059 matching lines...) Expand 10 before | Expand all | Expand 10 after
13770 masm.GetCode(&desc); 13770 masm.GetCode(&desc);
13771 // Call the function from C++. 13771 // Call the function from C++.
13772 return FUNCTION_CAST<MemCopyFunction>(buffer); 13772 return FUNCTION_CAST<MemCopyFunction>(buffer);
13773 } 13773 }
13774 13774
13775 #undef __ 13775 #undef __
13776 13776
13777 } } // namespace v8::internal 13777 } } // namespace v8::internal
13778 13778
13779 #endif // V8_TARGET_ARCH_IA32 13779 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « no previous file | src/x64/codegen-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698