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