Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 1883 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1894 // String value -> false iff empty. | 1894 // String value -> false iff empty. |
| 1895 Label not_string; | 1895 Label not_string; |
| 1896 __ lbu(at, FieldMemOperand(map, Map::kInstanceTypeOffset)); | 1896 __ lbu(at, FieldMemOperand(map, Map::kInstanceTypeOffset)); |
| 1897 __ Branch(¬_string, ge , at, Operand(FIRST_NONSTRING_TYPE)); | 1897 __ Branch(¬_string, ge , at, Operand(FIRST_NONSTRING_TYPE)); |
| 1898 __ lw(at, FieldMemOperand(reg, String::kLengthOffset)); | 1898 __ lw(at, FieldMemOperand(reg, String::kLengthOffset)); |
| 1899 __ Branch(true_label, ne, at, Operand(zero_reg)); | 1899 __ Branch(true_label, ne, at, Operand(zero_reg)); |
| 1900 __ Branch(false_label); | 1900 __ Branch(false_label); |
| 1901 __ bind(¬_string); | 1901 __ bind(¬_string); |
| 1902 } | 1902 } |
| 1903 | 1903 |
| 1904 if (expected.Contains(ToBooleanStub::SYMBOL)) { | |
| 1905 // Symbol value -> true. | |
| 1906 __ lbu(at, FieldMemOperand(map, Map::kInstanceTypeOffset)); | |
| 1907 __ Branch(true_label, eq, at, Operand(SYMBOL_TYPE)); | |
|
Paul Lind
2013/03/23 01:23:40
We cannot use 'at' register in this Branch(), as '
palfia
2013/03/23 01:49:45
Thanks for fixing this! It escaped my attention, t
| |
| 1908 } | |
| 1909 | |
| 1904 if (expected.Contains(ToBooleanStub::HEAP_NUMBER)) { | 1910 if (expected.Contains(ToBooleanStub::HEAP_NUMBER)) { |
| 1905 CpuFeatureScope scope(masm(), FPU); | 1911 CpuFeatureScope scope(masm(), FPU); |
| 1906 // heap number -> false iff +0, -0, or NaN. | 1912 // heap number -> false iff +0, -0, or NaN. |
| 1907 DoubleRegister dbl_scratch = double_scratch0(); | 1913 DoubleRegister dbl_scratch = double_scratch0(); |
| 1908 Label not_heap_number; | 1914 Label not_heap_number; |
| 1909 __ LoadRoot(at, Heap::kHeapNumberMapRootIndex); | 1915 __ LoadRoot(at, Heap::kHeapNumberMapRootIndex); |
| 1910 __ Branch(¬_heap_number, ne, map, Operand(at)); | 1916 __ Branch(¬_heap_number, ne, map, Operand(at)); |
| 1911 __ ldc1(dbl_scratch, FieldMemOperand(reg, HeapNumber::kValueOffset)); | 1917 __ ldc1(dbl_scratch, FieldMemOperand(reg, HeapNumber::kValueOffset)); |
| 1912 __ BranchF(true_label, false_label, ne, dbl_scratch, kDoubleRegZero); | 1918 __ BranchF(true_label, false_label, ne, dbl_scratch, kDoubleRegZero); |
| 1913 // Falls through if dbl_scratch == 0. | 1919 // Falls through if dbl_scratch == 0. |
| (...skipping 3850 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5764 __ Branch(USE_DELAY_SLOT, false_label, | 5770 __ Branch(USE_DELAY_SLOT, false_label, |
| 5765 ge, scratch, Operand(FIRST_NONSTRING_TYPE)); | 5771 ge, scratch, Operand(FIRST_NONSTRING_TYPE)); |
| 5766 // input is an object so we can load the BitFieldOffset even if we take the | 5772 // input is an object so we can load the BitFieldOffset even if we take the |
| 5767 // other branch. | 5773 // other branch. |
| 5768 __ lbu(at, FieldMemOperand(input, Map::kBitFieldOffset)); | 5774 __ lbu(at, FieldMemOperand(input, Map::kBitFieldOffset)); |
| 5769 __ And(at, at, 1 << Map::kIsUndetectable); | 5775 __ And(at, at, 1 << Map::kIsUndetectable); |
| 5770 cmp1 = at; | 5776 cmp1 = at; |
| 5771 cmp2 = Operand(zero_reg); | 5777 cmp2 = Operand(zero_reg); |
| 5772 final_branch_condition = eq; | 5778 final_branch_condition = eq; |
| 5773 | 5779 |
| 5780 } else if (type_name->Equals(heap()->symbol_string())) { | |
| 5781 __ JumpIfSmi(input, false_label); | |
| 5782 __ GetObjectType(input, input, scratch); | |
| 5783 cmp1 = scratch; | |
| 5784 cmp2 = Operand(SYMBOL_TYPE); | |
| 5785 final_branch_condition = eq; | |
| 5786 | |
| 5774 } else if (type_name->Equals(heap()->boolean_string())) { | 5787 } else if (type_name->Equals(heap()->boolean_string())) { |
| 5775 __ LoadRoot(at, Heap::kTrueValueRootIndex); | 5788 __ LoadRoot(at, Heap::kTrueValueRootIndex); |
| 5776 __ Branch(USE_DELAY_SLOT, true_label, eq, at, Operand(input)); | 5789 __ Branch(USE_DELAY_SLOT, true_label, eq, at, Operand(input)); |
| 5777 __ LoadRoot(at, Heap::kFalseValueRootIndex); | 5790 __ LoadRoot(at, Heap::kFalseValueRootIndex); |
| 5778 cmp1 = at; | 5791 cmp1 = at; |
| 5779 cmp2 = Operand(input); | 5792 cmp2 = Operand(input); |
| 5780 final_branch_condition = eq; | 5793 final_branch_condition = eq; |
| 5781 | 5794 |
| 5782 } else if (FLAG_harmony_typeof && type_name->Equals(heap()->null_string())) { | 5795 } else if (FLAG_harmony_typeof && type_name->Equals(heap()->null_string())) { |
| 5783 __ LoadRoot(at, Heap::kNullValueRootIndex); | 5796 __ LoadRoot(at, Heap::kNullValueRootIndex); |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 5807 cmp1 = input; | 5820 cmp1 = input; |
| 5808 cmp2 = Operand(JS_FUNCTION_PROXY_TYPE); | 5821 cmp2 = Operand(JS_FUNCTION_PROXY_TYPE); |
| 5809 final_branch_condition = eq; | 5822 final_branch_condition = eq; |
| 5810 | 5823 |
| 5811 } else if (type_name->Equals(heap()->object_string())) { | 5824 } else if (type_name->Equals(heap()->object_string())) { |
| 5812 __ JumpIfSmi(input, false_label); | 5825 __ JumpIfSmi(input, false_label); |
| 5813 if (!FLAG_harmony_typeof) { | 5826 if (!FLAG_harmony_typeof) { |
| 5814 __ LoadRoot(at, Heap::kNullValueRootIndex); | 5827 __ LoadRoot(at, Heap::kNullValueRootIndex); |
| 5815 __ Branch(USE_DELAY_SLOT, true_label, eq, at, Operand(input)); | 5828 __ Branch(USE_DELAY_SLOT, true_label, eq, at, Operand(input)); |
| 5816 } | 5829 } |
| 5817 if (FLAG_harmony_symbols) { | 5830 // input is an object, it is safe to use GetObjectType in the delay slot. |
| 5818 // input is an object, it is safe to use GetObjectType in the delay slot. | 5831 __ GetObjectType(input, input, scratch); |
|
Paul Lind
2013/03/22 22:15:20
There is some tricky stuff with delay slots here t
| |
| 5819 __ GetObjectType(input, input, scratch); | 5832 __ Branch(USE_DELAY_SLOT, false_label, |
| 5820 __ Branch(USE_DELAY_SLOT, true_label, eq, scratch, Operand(SYMBOL_TYPE)); | 5833 lt, scratch, Operand(FIRST_NONCALLABLE_SPEC_OBJECT_TYPE)); |
| 5821 // Still an object, so the InstanceType can be loaded. | |
| 5822 __ lbu(scratch, FieldMemOperand(input, Map::kInstanceTypeOffset)); | |
| 5823 __ Branch(USE_DELAY_SLOT, false_label, | |
| 5824 lt, scratch, Operand(FIRST_NONCALLABLE_SPEC_OBJECT_TYPE)); | |
| 5825 } else { | |
| 5826 // input is an object, it is safe to use GetObjectType in the delay slot. | |
| 5827 __ GetObjectType(input, input, scratch); | |
| 5828 __ Branch(USE_DELAY_SLOT, false_label, | |
| 5829 lt, scratch, Operand(FIRST_NONCALLABLE_SPEC_OBJECT_TYPE)); | |
| 5830 } | |
| 5831 // Still an object, so the InstanceType can be loaded. | 5834 // Still an object, so the InstanceType can be loaded. |
| 5832 __ lbu(scratch, FieldMemOperand(input, Map::kInstanceTypeOffset)); | 5835 __ lbu(scratch, FieldMemOperand(input, Map::kInstanceTypeOffset)); |
| 5833 __ Branch(USE_DELAY_SLOT, false_label, | 5836 __ Branch(USE_DELAY_SLOT, false_label, |
| 5834 gt, scratch, Operand(LAST_NONCALLABLE_SPEC_OBJECT_TYPE)); | 5837 gt, scratch, Operand(LAST_NONCALLABLE_SPEC_OBJECT_TYPE)); |
| 5835 // Still an object, so the BitField can be loaded. | 5838 // Still an object, so the BitField can be loaded. |
| 5836 // Check for undetectable objects => false. | 5839 // Check for undetectable objects => false. |
| 5837 __ lbu(at, FieldMemOperand(input, Map::kBitFieldOffset)); | 5840 __ lbu(at, FieldMemOperand(input, Map::kBitFieldOffset)); |
| 5838 __ And(at, at, 1 << Map::kIsUndetectable); | 5841 __ And(at, at, 1 << Map::kIsUndetectable); |
| 5839 cmp1 = at; | 5842 cmp1 = at; |
| 5840 cmp2 = Operand(zero_reg); | 5843 cmp2 = Operand(zero_reg); |
| (...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6104 __ Subu(scratch, result, scratch); | 6107 __ Subu(scratch, result, scratch); |
| 6105 __ lw(result, FieldMemOperand(scratch, | 6108 __ lw(result, FieldMemOperand(scratch, |
| 6106 FixedArray::kHeaderSize - kPointerSize)); | 6109 FixedArray::kHeaderSize - kPointerSize)); |
| 6107 __ bind(&done); | 6110 __ bind(&done); |
| 6108 } | 6111 } |
| 6109 | 6112 |
| 6110 | 6113 |
| 6111 #undef __ | 6114 #undef __ |
| 6112 | 6115 |
| 6113 } } // namespace v8::internal | 6116 } } // namespace v8::internal |
| OLD | NEW |