| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 Isolate* isolate, | 128 Isolate* isolate, |
| 129 CodeStubInterfaceDescriptor* descriptor) { | 129 CodeStubInterfaceDescriptor* descriptor) { |
| 130 static Register registers[] = { rdx, rax }; | 130 static Register registers[] = { rdx, rax }; |
| 131 descriptor->register_param_count_ = 2; | 131 descriptor->register_param_count_ = 2; |
| 132 descriptor->register_params_ = registers; | 132 descriptor->register_params_ = registers; |
| 133 descriptor->deoptimization_handler_ = | 133 descriptor->deoptimization_handler_ = |
| 134 FUNCTION_ADDR(KeyedLoadIC_MissFromStubFailure); | 134 FUNCTION_ADDR(KeyedLoadIC_MissFromStubFailure); |
| 135 } | 135 } |
| 136 | 136 |
| 137 | 137 |
| 138 void RegExpConstructResultStub::InitializeInterfaceDescriptor( |
| 139 Isolate* isolate, |
| 140 CodeStubInterfaceDescriptor* descriptor) { |
| 141 static Register registers[] = { rcx, rbx, rax }; |
| 142 descriptor->register_param_count_ = 3; |
| 143 descriptor->register_params_ = registers; |
| 144 descriptor->deoptimization_handler_ = |
| 145 Runtime::FunctionForId(Runtime::kRegExpConstructResult)->entry; |
| 146 } |
| 147 |
| 148 |
| 138 void LoadFieldStub::InitializeInterfaceDescriptor( | 149 void LoadFieldStub::InitializeInterfaceDescriptor( |
| 139 Isolate* isolate, | 150 Isolate* isolate, |
| 140 CodeStubInterfaceDescriptor* descriptor) { | 151 CodeStubInterfaceDescriptor* descriptor) { |
| 141 static Register registers[] = { rax }; | 152 static Register registers[] = { rax }; |
| 142 descriptor->register_param_count_ = 1; | 153 descriptor->register_param_count_ = 1; |
| 143 descriptor->register_params_ = registers; | 154 descriptor->register_params_ = registers; |
| 144 descriptor->deoptimization_handler_ = NULL; | 155 descriptor->deoptimization_handler_ = NULL; |
| 145 } | 156 } |
| 146 | 157 |
| 147 | 158 |
| (...skipping 1685 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1833 | 1844 |
| 1834 // (11) Sliced string. Replace subject with parent. Go to (5a). | 1845 // (11) Sliced string. Replace subject with parent. Go to (5a). |
| 1835 // Load offset into r14 and replace subject string with parent. | 1846 // Load offset into r14 and replace subject string with parent. |
| 1836 __ SmiToInteger32(r14, FieldOperand(rdi, SlicedString::kOffsetOffset)); | 1847 __ SmiToInteger32(r14, FieldOperand(rdi, SlicedString::kOffsetOffset)); |
| 1837 __ movp(rdi, FieldOperand(rdi, SlicedString::kParentOffset)); | 1848 __ movp(rdi, FieldOperand(rdi, SlicedString::kParentOffset)); |
| 1838 __ jmp(&check_underlying); | 1849 __ jmp(&check_underlying); |
| 1839 #endif // V8_INTERPRETED_REGEXP | 1850 #endif // V8_INTERPRETED_REGEXP |
| 1840 } | 1851 } |
| 1841 | 1852 |
| 1842 | 1853 |
| 1843 void RegExpConstructResultStub::Generate(MacroAssembler* masm) { | |
| 1844 const int kMaxInlineLength = 100; | |
| 1845 Label slowcase; | |
| 1846 Label done; | |
| 1847 StackArgumentsAccessor args(rsp, 3, ARGUMENTS_DONT_CONTAIN_RECEIVER); | |
| 1848 __ movp(r8, args.GetArgumentOperand(0)); | |
| 1849 __ JumpIfNotSmi(r8, &slowcase); | |
| 1850 __ SmiToInteger32(rbx, r8); | |
| 1851 __ cmpl(rbx, Immediate(kMaxInlineLength)); | |
| 1852 __ j(above, &slowcase); | |
| 1853 // Smi-tagging is equivalent to multiplying by 2. | |
| 1854 STATIC_ASSERT(kSmiTag == 0); | |
| 1855 STATIC_ASSERT(kSmiTagSize == 1); | |
| 1856 // Allocate RegExpResult followed by FixedArray with size in rbx. | |
| 1857 // JSArray: [Map][empty properties][Elements][Length-smi][index][input] | |
| 1858 // Elements: [Map][Length][..elements..] | |
| 1859 __ Allocate(JSRegExpResult::kSize + FixedArray::kHeaderSize, | |
| 1860 times_pointer_size, | |
| 1861 rbx, // In: Number of elements. | |
| 1862 rax, // Out: Start of allocation (tagged). | |
| 1863 rcx, // Out: End of allocation. | |
| 1864 rdx, // Scratch register | |
| 1865 &slowcase, | |
| 1866 TAG_OBJECT); | |
| 1867 // rax: Start of allocated area, object-tagged. | |
| 1868 // rbx: Number of array elements as int32. | |
| 1869 // r8: Number of array elements as smi. | |
| 1870 | |
| 1871 // Set JSArray map to global.regexp_result_map(). | |
| 1872 __ movp(rdx, ContextOperand(rsi, Context::GLOBAL_OBJECT_INDEX)); | |
| 1873 __ movp(rdx, FieldOperand(rdx, GlobalObject::kNativeContextOffset)); | |
| 1874 __ movp(rdx, ContextOperand(rdx, Context::REGEXP_RESULT_MAP_INDEX)); | |
| 1875 __ movp(FieldOperand(rax, HeapObject::kMapOffset), rdx); | |
| 1876 | |
| 1877 // Set empty properties FixedArray. | |
| 1878 __ LoadRoot(kScratchRegister, Heap::kEmptyFixedArrayRootIndex); | |
| 1879 __ movp(FieldOperand(rax, JSObject::kPropertiesOffset), kScratchRegister); | |
| 1880 | |
| 1881 // Set elements to point to FixedArray allocated right after the JSArray. | |
| 1882 __ lea(rcx, Operand(rax, JSRegExpResult::kSize)); | |
| 1883 __ movp(FieldOperand(rax, JSObject::kElementsOffset), rcx); | |
| 1884 | |
| 1885 // Set input, index and length fields from arguments. | |
| 1886 __ movp(r8, args.GetArgumentOperand(2)); | |
| 1887 __ movp(FieldOperand(rax, JSRegExpResult::kInputOffset), r8); | |
| 1888 __ movp(r8, args.GetArgumentOperand(1)); | |
| 1889 __ movp(FieldOperand(rax, JSRegExpResult::kIndexOffset), r8); | |
| 1890 __ movp(r8, args.GetArgumentOperand(0)); | |
| 1891 __ movp(FieldOperand(rax, JSArray::kLengthOffset), r8); | |
| 1892 | |
| 1893 // Fill out the elements FixedArray. | |
| 1894 // rax: JSArray. | |
| 1895 // rcx: FixedArray. | |
| 1896 // rbx: Number of elements in array as int32. | |
| 1897 | |
| 1898 // Set map. | |
| 1899 __ LoadRoot(kScratchRegister, Heap::kFixedArrayMapRootIndex); | |
| 1900 __ movp(FieldOperand(rcx, HeapObject::kMapOffset), kScratchRegister); | |
| 1901 // Set length. | |
| 1902 __ Integer32ToSmi(rdx, rbx); | |
| 1903 __ movp(FieldOperand(rcx, FixedArray::kLengthOffset), rdx); | |
| 1904 // Fill contents of fixed-array with undefined. | |
| 1905 __ LoadRoot(rdx, Heap::kUndefinedValueRootIndex); | |
| 1906 __ lea(rcx, FieldOperand(rcx, FixedArray::kHeaderSize)); | |
| 1907 // Fill fixed array elements with undefined. | |
| 1908 // rax: JSArray. | |
| 1909 // rbx: Number of elements in array that remains to be filled, as int32. | |
| 1910 // rcx: Start of elements in FixedArray. | |
| 1911 // rdx: undefined. | |
| 1912 Label loop; | |
| 1913 __ testl(rbx, rbx); | |
| 1914 __ bind(&loop); | |
| 1915 __ j(less_equal, &done); // Jump if rcx is negative or zero. | |
| 1916 __ subl(rbx, Immediate(1)); | |
| 1917 __ movp(Operand(rcx, rbx, times_pointer_size, 0), rdx); | |
| 1918 __ jmp(&loop); | |
| 1919 | |
| 1920 __ bind(&done); | |
| 1921 __ ret(3 * kPointerSize); | |
| 1922 | |
| 1923 __ bind(&slowcase); | |
| 1924 __ TailCallRuntime(Runtime::kRegExpConstructResult, 3, 1); | |
| 1925 } | |
| 1926 | |
| 1927 | |
| 1928 static int NegativeComparisonResult(Condition cc) { | 1854 static int NegativeComparisonResult(Condition cc) { |
| 1929 ASSERT(cc != equal); | 1855 ASSERT(cc != equal); |
| 1930 ASSERT((cc == less) || (cc == less_equal) | 1856 ASSERT((cc == less) || (cc == less_equal) |
| 1931 || (cc == greater) || (cc == greater_equal)); | 1857 || (cc == greater) || (cc == greater_equal)); |
| 1932 return (cc == greater || cc == greater_equal) ? LESS : GREATER; | 1858 return (cc == greater || cc == greater_equal) ? LESS : GREATER; |
| 1933 } | 1859 } |
| 1934 | 1860 |
| 1935 | 1861 |
| 1936 static void CheckInputType(MacroAssembler* masm, | 1862 static void CheckInputType(MacroAssembler* masm, |
| 1937 Register input, | 1863 Register input, |
| (...skipping 3334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5272 return_value_operand, | 5198 return_value_operand, |
| 5273 restore_context ? &context_restore_operand : NULL); | 5199 restore_context ? &context_restore_operand : NULL); |
| 5274 } | 5200 } |
| 5275 | 5201 |
| 5276 | 5202 |
| 5277 #undef __ | 5203 #undef __ |
| 5278 | 5204 |
| 5279 } } // namespace v8::internal | 5205 } } // namespace v8::internal |
| 5280 | 5206 |
| 5281 #endif // V8_TARGET_ARCH_X64 | 5207 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |