OLD | NEW |
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 1838 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1849 LikelySmiBinaryOperation(op, operand, &constant_operand, | 1849 LikelySmiBinaryOperation(op, operand, &constant_operand, |
1850 overwrite_mode); | 1850 overwrite_mode); |
1851 } | 1851 } |
1852 break; | 1852 break; |
1853 } | 1853 } |
1854 } | 1854 } |
1855 ASSERT(!operand->is_valid()); | 1855 ASSERT(!operand->is_valid()); |
1856 } | 1856 } |
1857 | 1857 |
1858 | 1858 |
1859 class CompareStub: public CodeStub { | |
1860 public: | |
1861 CompareStub(Condition cc, bool strict) : cc_(cc), strict_(strict) { } | |
1862 | |
1863 void Generate(MacroAssembler* masm); | |
1864 | |
1865 private: | |
1866 Condition cc_; | |
1867 bool strict_; | |
1868 | |
1869 Major MajorKey() { return Compare; } | |
1870 | |
1871 int MinorKey() { | |
1872 // Encode the three parameters in a unique 16 bit value. | |
1873 ASSERT(static_cast<int>(cc_) < (1 << 15)); | |
1874 return (static_cast<int>(cc_) << 1) | (strict_ ? 1 : 0); | |
1875 } | |
1876 | |
1877 // Branch to the label if the given object isn't a symbol. | |
1878 void BranchIfNonSymbol(MacroAssembler* masm, | |
1879 Label* label, | |
1880 Register object, | |
1881 Register scratch); | |
1882 | |
1883 #ifdef DEBUG | |
1884 void Print() { | |
1885 PrintF("CompareStub (cc %d), (strict %s)\n", | |
1886 static_cast<int>(cc_), | |
1887 strict_ ? "true" : "false"); | |
1888 } | |
1889 #endif | |
1890 }; | |
1891 | |
1892 | |
1893 void CodeGenerator::Comparison(Condition cc, | 1859 void CodeGenerator::Comparison(Condition cc, |
1894 bool strict, | 1860 bool strict, |
1895 ControlDestination* dest) { | 1861 ControlDestination* dest) { |
1896 // Strict only makes sense for equality comparisons. | 1862 // Strict only makes sense for equality comparisons. |
1897 ASSERT(!strict || cc == equal); | 1863 ASSERT(!strict || cc == equal); |
1898 | 1864 |
1899 Result left_side; | 1865 Result left_side; |
1900 Result right_side; | 1866 Result right_side; |
1901 // Implement '>' and '<=' by reversal to obtain ECMA-262 conversion order. | 1867 // Implement '>' and '<=' by reversal to obtain ECMA-262 conversion order. |
1902 if (cc == greater || cc == less_equal) { | 1868 if (cc == greater || cc == less_equal) { |
(...skipping 5943 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7846 __ bind(&is_not_instance); | 7812 __ bind(&is_not_instance); |
7847 __ Set(eax, Immediate(Smi::FromInt(1))); | 7813 __ Set(eax, Immediate(Smi::FromInt(1))); |
7848 __ ret(2 * kPointerSize); | 7814 __ ret(2 * kPointerSize); |
7849 | 7815 |
7850 // Slow-case: Go through the JavaScript implementation. | 7816 // Slow-case: Go through the JavaScript implementation. |
7851 __ bind(&slow); | 7817 __ bind(&slow); |
7852 __ InvokeBuiltin(Builtins::INSTANCE_OF, JUMP_FUNCTION); | 7818 __ InvokeBuiltin(Builtins::INSTANCE_OF, JUMP_FUNCTION); |
7853 } | 7819 } |
7854 | 7820 |
7855 | 7821 |
| 7822 int CompareStub::MinorKey() { |
| 7823 // Encode the two parameters in a unique 16 bit value. |
| 7824 ASSERT(static_cast<unsigned>(cc_) < (1 << 15)); |
| 7825 return (static_cast<unsigned>(cc_) << 1) | (strict_ ? 1 : 0); |
| 7826 } |
| 7827 |
7856 #undef __ | 7828 #undef __ |
7857 | 7829 |
7858 } } // namespace v8::internal | 7830 } } // namespace v8::internal |
OLD | NEW |