| 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" | |
| 12 #include "vm/flow_graph_compiler.h" | 11 #include "vm/flow_graph_compiler.h" |
| 13 #include "vm/instructions.h" | 12 #include "vm/instructions.h" |
| 14 #include "vm/object_store.h" | 13 #include "vm/object_store.h" |
| 15 #include "vm/regexp_assembler.h" | |
| 16 #include "vm/symbols.h" | 14 #include "vm/symbols.h" |
| 17 | 15 |
| 18 namespace dart { | 16 namespace dart { |
| 19 | 17 |
| 20 DECLARE_FLAG(bool, enable_type_checks); | 18 DECLARE_FLAG(bool, enable_type_checks); |
| 21 | 19 |
| 22 // When entering intrinsics code: | 20 // When entering intrinsics code: |
| 23 // RBX: IC Data | 21 // RBX: IC Data |
| 24 // R10: Arguments descriptor | 22 // R10: Arguments descriptor |
| 25 // TOS: Return address | 23 // TOS: Return address |
| (...skipping 1886 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1912 void Intrinsifier::OneByteString_equality(Assembler* assembler) { | 1910 void Intrinsifier::OneByteString_equality(Assembler* assembler) { |
| 1913 StringEquality(assembler, kOneByteStringCid); | 1911 StringEquality(assembler, kOneByteStringCid); |
| 1914 } | 1912 } |
| 1915 | 1913 |
| 1916 | 1914 |
| 1917 void Intrinsifier::TwoByteString_equality(Assembler* assembler) { | 1915 void Intrinsifier::TwoByteString_equality(Assembler* assembler) { |
| 1918 StringEquality(assembler, kTwoByteStringCid); | 1916 StringEquality(assembler, kTwoByteStringCid); |
| 1919 } | 1917 } |
| 1920 | 1918 |
| 1921 | 1919 |
| 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 | |
| 1956 // On stack: user tag (+1), return-address (+0). | 1920 // On stack: user tag (+1), return-address (+0). |
| 1957 void Intrinsifier::UserTag_makeCurrent(Assembler* assembler) { | 1921 void Intrinsifier::UserTag_makeCurrent(Assembler* assembler) { |
| 1958 // RBX: Isolate. | 1922 // RBX: Isolate. |
| 1959 Isolate* isolate = Isolate::Current(); | 1923 Isolate* isolate = Isolate::Current(); |
| 1960 const Immediate& isolate_address = | 1924 const Immediate& isolate_address = |
| 1961 Immediate(reinterpret_cast<int64_t>(isolate)); | 1925 Immediate(reinterpret_cast<int64_t>(isolate)); |
| 1962 __ movq(RBX, isolate_address); | 1926 __ movq(RBX, isolate_address); |
| 1963 // RAX: Current user tag. | 1927 // RAX: Current user tag. |
| 1964 __ movq(RAX, Address(RBX, Isolate::current_tag_offset())); | 1928 __ movq(RAX, Address(RBX, Isolate::current_tag_offset())); |
| 1965 // R10: UserTag. | 1929 // R10: UserTag. |
| (...skipping 30 matching lines...) Expand all Loading... |
| 1996 // Set return value to Isolate::current_tag_. | 1960 // Set return value to Isolate::current_tag_. |
| 1997 __ movq(RAX, Address(RBX, Isolate::current_tag_offset())); | 1961 __ movq(RAX, Address(RBX, Isolate::current_tag_offset())); |
| 1998 __ ret(); | 1962 __ ret(); |
| 1999 } | 1963 } |
| 2000 | 1964 |
| 2001 #undef __ | 1965 #undef __ |
| 2002 | 1966 |
| 2003 } // namespace dart | 1967 } // namespace dart |
| 2004 | 1968 |
| 2005 #endif // defined TARGET_ARCH_X64 | 1969 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |