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" |
| 11 #include "vm/dart_entry.h" |
11 #include "vm/flow_graph_compiler.h" | 12 #include "vm/flow_graph_compiler.h" |
12 #include "vm/instructions.h" | 13 #include "vm/instructions.h" |
13 #include "vm/object_store.h" | 14 #include "vm/object_store.h" |
| 15 #include "vm/regexp_assembler.h" |
14 #include "vm/symbols.h" | 16 #include "vm/symbols.h" |
15 | 17 |
16 namespace dart { | 18 namespace dart { |
17 | 19 |
18 DECLARE_FLAG(bool, enable_type_checks); | 20 DECLARE_FLAG(bool, enable_type_checks); |
19 | 21 |
20 // When entering intrinsics code: | 22 // When entering intrinsics code: |
21 // RBX: IC Data | 23 // RBX: IC Data |
22 // R10: Arguments descriptor | 24 // R10: Arguments descriptor |
23 // TOS: Return address | 25 // TOS: Return address |
(...skipping 1886 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1910 void Intrinsifier::OneByteString_equality(Assembler* assembler) { | 1912 void Intrinsifier::OneByteString_equality(Assembler* assembler) { |
1911 StringEquality(assembler, kOneByteStringCid); | 1913 StringEquality(assembler, kOneByteStringCid); |
1912 } | 1914 } |
1913 | 1915 |
1914 | 1916 |
1915 void Intrinsifier::TwoByteString_equality(Assembler* assembler) { | 1917 void Intrinsifier::TwoByteString_equality(Assembler* assembler) { |
1916 StringEquality(assembler, kTwoByteStringCid); | 1918 StringEquality(assembler, kTwoByteStringCid); |
1917 } | 1919 } |
1918 | 1920 |
1919 | 1921 |
| 1922 void Intrinsifier::JSRegExp_ExecuteMatch(Assembler* assembler) { |
| 1923 if (FLAG_use_jscre) { |
| 1924 return; |
| 1925 } |
| 1926 static const intptr_t kRegExpParamOffset = 3 * kWordSize; |
| 1927 static const intptr_t kStringParamOffset = 2 * kWordSize; |
| 1928 // start_index smi is located at offset 1. |
| 1929 |
| 1930 // Incoming registers: |
| 1931 // RAX: Function. (Will be loaded with the specialized matcher function.) |
| 1932 // RCX: IC-Data. (Will be preserved.) |
| 1933 // R10: Arguments descriptor. (Will be preserved.) |
| 1934 |
| 1935 // Load the specialized function pointer into RAX. Leverage the fact the |
| 1936 // string CIDs as well as stored function pointers are in sequence. |
| 1937 __ movq(RBX, Address(RSP, kRegExpParamOffset)); |
| 1938 __ movq(RDI, Address(RSP, kStringParamOffset)); |
| 1939 __ LoadClassId(RDI, RDI); |
| 1940 __ SubImmediate(RDI, Immediate(kOneByteStringCid), PP); |
| 1941 __ movq(RAX, FieldAddress(RBX, RDI, TIMES_8, |
| 1942 JSRegExp::function_offset(kOneByteStringCid))); |
| 1943 |
| 1944 // Registers are now set up for the lazy compile stub. It expects the function |
| 1945 // in RAX, the argument descriptor in R10, and IC-Data in RCX. |
| 1946 static const intptr_t arg_count = RegExpMacroAssembler::kParamCount; |
| 1947 __ LoadObject(R10, Array::Handle(ArgumentsDescriptor::New(arg_count)), PP); |
| 1948 |
| 1949 // Tail-call the function. |
| 1950 __ movq(RDI, FieldAddress(RAX, Function::instructions_offset())); |
| 1951 __ addq(RDI, Immediate(Instructions::HeaderSize() - kHeapObjectTag)); |
| 1952 __ jmp(RDI); |
| 1953 } |
| 1954 |
| 1955 |
1920 // On stack: user tag (+1), return-address (+0). | 1956 // On stack: user tag (+1), return-address (+0). |
1921 void Intrinsifier::UserTag_makeCurrent(Assembler* assembler) { | 1957 void Intrinsifier::UserTag_makeCurrent(Assembler* assembler) { |
1922 // RBX: Isolate. | 1958 // RBX: Isolate. |
1923 Isolate* isolate = Isolate::Current(); | 1959 Isolate* isolate = Isolate::Current(); |
1924 const Immediate& isolate_address = | 1960 const Immediate& isolate_address = |
1925 Immediate(reinterpret_cast<int64_t>(isolate)); | 1961 Immediate(reinterpret_cast<int64_t>(isolate)); |
1926 __ movq(RBX, isolate_address); | 1962 __ movq(RBX, isolate_address); |
1927 // RAX: Current user tag. | 1963 // RAX: Current user tag. |
1928 __ movq(RAX, Address(RBX, Isolate::current_tag_offset())); | 1964 __ movq(RAX, Address(RBX, Isolate::current_tag_offset())); |
1929 // R10: UserTag. | 1965 // R10: UserTag. |
(...skipping 30 matching lines...) Expand all Loading... |
1960 // Set return value to Isolate::current_tag_. | 1996 // Set return value to Isolate::current_tag_. |
1961 __ movq(RAX, Address(RBX, Isolate::current_tag_offset())); | 1997 __ movq(RAX, Address(RBX, Isolate::current_tag_offset())); |
1962 __ ret(); | 1998 __ ret(); |
1963 } | 1999 } |
1964 | 2000 |
1965 #undef __ | 2001 #undef __ |
1966 | 2002 |
1967 } // namespace dart | 2003 } // namespace dart |
1968 | 2004 |
1969 #endif // defined TARGET_ARCH_X64 | 2005 #endif // defined TARGET_ARCH_X64 |
OLD | NEW |