OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_X64. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_X64. |
6 #if defined(TARGET_ARCH_X64) | 6 #if defined(TARGET_ARCH_X64) |
7 | 7 |
8 #include "vm/intrinsifier.h" | 8 #include "vm/intrinsifier.h" |
9 | 9 |
10 #include "vm/assembler.h" | 10 #include "vm/assembler.h" |
(...skipping 2021 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2032 void Intrinsifier::OneByteString_equality(Assembler* assembler) { | 2032 void Intrinsifier::OneByteString_equality(Assembler* assembler) { |
2033 StringEquality(assembler, kOneByteStringCid); | 2033 StringEquality(assembler, kOneByteStringCid); |
2034 } | 2034 } |
2035 | 2035 |
2036 | 2036 |
2037 void Intrinsifier::TwoByteString_equality(Assembler* assembler) { | 2037 void Intrinsifier::TwoByteString_equality(Assembler* assembler) { |
2038 StringEquality(assembler, kTwoByteStringCid); | 2038 StringEquality(assembler, kTwoByteStringCid); |
2039 } | 2039 } |
2040 | 2040 |
2041 | 2041 |
2042 void Intrinsifier::JSRegExp_ExecuteMatch(Assembler* assembler) { | 2042 void Intrinsifier::RegExp_ExecuteMatch(Assembler* assembler) { |
2043 if (FLAG_interpret_irregexp) return; | 2043 if (FLAG_interpret_irregexp) return; |
2044 | 2044 |
2045 static const intptr_t kRegExpParamOffset = 3 * kWordSize; | 2045 static const intptr_t kRegExpParamOffset = 3 * kWordSize; |
2046 static const intptr_t kStringParamOffset = 2 * kWordSize; | 2046 static const intptr_t kStringParamOffset = 2 * kWordSize; |
2047 // start_index smi is located at offset 1. | 2047 // start_index smi is located at offset 1. |
2048 | 2048 |
2049 // Incoming registers: | 2049 // Incoming registers: |
2050 // RAX: Function. (Will be loaded with the specialized matcher function.) | 2050 // RAX: Function. (Will be loaded with the specialized matcher function.) |
2051 // RCX: Unknown. (Must be GC safe on tail call.) | 2051 // RCX: Unknown. (Must be GC safe on tail call.) |
2052 // R10: Arguments descriptor. (Will be preserved.) | 2052 // R10: Arguments descriptor. (Will be preserved.) |
2053 | 2053 |
2054 // Load the specialized function pointer into RAX. Leverage the fact the | 2054 // Load the specialized function pointer into RAX. Leverage the fact the |
2055 // string CIDs as well as stored function pointers are in sequence. | 2055 // string CIDs as well as stored function pointers are in sequence. |
2056 __ movq(RBX, Address(RSP, kRegExpParamOffset)); | 2056 __ movq(RBX, Address(RSP, kRegExpParamOffset)); |
2057 __ movq(RDI, Address(RSP, kStringParamOffset)); | 2057 __ movq(RDI, Address(RSP, kStringParamOffset)); |
2058 __ LoadClassId(RDI, RDI); | 2058 __ LoadClassId(RDI, RDI); |
2059 __ SubImmediate(RDI, Immediate(kOneByteStringCid)); | 2059 __ SubImmediate(RDI, Immediate(kOneByteStringCid)); |
2060 __ movq(RAX, FieldAddress(RBX, RDI, TIMES_8, | 2060 __ movq(RAX, FieldAddress(RBX, RDI, TIMES_8, |
2061 JSRegExp::function_offset(kOneByteStringCid))); | 2061 RegExp::function_offset(kOneByteStringCid))); |
2062 | 2062 |
2063 // Registers are now set up for the lazy compile stub. It expects the function | 2063 // Registers are now set up for the lazy compile stub. It expects the function |
2064 // in RAX, the argument descriptor in R10, and IC-Data in RCX. | 2064 // in RAX, the argument descriptor in R10, and IC-Data in RCX. |
2065 __ xorq(RCX, RCX); | 2065 __ xorq(RCX, RCX); |
2066 | 2066 |
2067 // Tail-call the function. | 2067 // Tail-call the function. |
2068 __ movq(CODE_REG, FieldAddress(RAX, Function::code_offset())); | 2068 __ movq(CODE_REG, FieldAddress(RAX, Function::code_offset())); |
2069 __ movq(RDI, FieldAddress(RAX, Function::entry_point_offset())); | 2069 __ movq(RDI, FieldAddress(RAX, Function::entry_point_offset())); |
2070 __ jmp(RDI); | 2070 __ jmp(RDI); |
2071 } | 2071 } |
(...skipping 28 matching lines...) Expand all Loading... |
2100 __ LoadIsolate(RAX); | 2100 __ LoadIsolate(RAX); |
2101 __ movq(RAX, Address(RAX, Isolate::current_tag_offset())); | 2101 __ movq(RAX, Address(RAX, Isolate::current_tag_offset())); |
2102 __ ret(); | 2102 __ ret(); |
2103 } | 2103 } |
2104 | 2104 |
2105 #undef __ | 2105 #undef __ |
2106 | 2106 |
2107 } // namespace dart | 2107 } // namespace dart |
2108 | 2108 |
2109 #endif // defined TARGET_ARCH_X64 | 2109 #endif // defined TARGET_ARCH_X64 |
OLD | NEW |