| 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 1959 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1970 // Tail-call the function. | 1970 // Tail-call the function. |
| 1971 __ movq(RDI, FieldAddress(RAX, Function::instructions_offset())); | 1971 __ movq(RDI, FieldAddress(RAX, Function::instructions_offset())); |
| 1972 __ addq(RDI, Immediate(Instructions::HeaderSize() - kHeapObjectTag)); | 1972 __ addq(RDI, Immediate(Instructions::HeaderSize() - kHeapObjectTag)); |
| 1973 __ jmp(RDI); | 1973 __ jmp(RDI); |
| 1974 } | 1974 } |
| 1975 | 1975 |
| 1976 | 1976 |
| 1977 // On stack: user tag (+1), return-address (+0). | 1977 // On stack: user tag (+1), return-address (+0). |
| 1978 void Intrinsifier::UserTag_makeCurrent(Assembler* assembler) { | 1978 void Intrinsifier::UserTag_makeCurrent(Assembler* assembler) { |
| 1979 // RBX: Isolate. | 1979 // RBX: Isolate. |
| 1980 Isolate* isolate = Isolate::Current(); | 1980 __ LoadIsolate(RBX); |
| 1981 const Immediate& isolate_address = | |
| 1982 Immediate(reinterpret_cast<int64_t>(isolate)); | |
| 1983 __ movq(RBX, isolate_address); | |
| 1984 // RAX: Current user tag. | 1981 // RAX: Current user tag. |
| 1985 __ movq(RAX, Address(RBX, Isolate::current_tag_offset())); | 1982 __ movq(RAX, Address(RBX, Isolate::current_tag_offset())); |
| 1986 // R10: UserTag. | 1983 // R10: UserTag. |
| 1987 __ movq(R10, Address(RSP, + 1 * kWordSize)); | 1984 __ movq(R10, Address(RSP, + 1 * kWordSize)); |
| 1988 // Set Isolate::current_tag_. | 1985 // Set Isolate::current_tag_. |
| 1989 __ movq(Address(RBX, Isolate::current_tag_offset()), R10); | 1986 __ movq(Address(RBX, Isolate::current_tag_offset()), R10); |
| 1990 // R10: UserTag's tag. | 1987 // R10: UserTag's tag. |
| 1991 __ movq(R10, FieldAddress(R10, UserTag::tag_offset())); | 1988 __ movq(R10, FieldAddress(R10, UserTag::tag_offset())); |
| 1992 // Set Isolate::user_tag_. | 1989 // Set Isolate::user_tag_. |
| 1993 __ movq(Address(RBX, Isolate::user_tag_offset()), R10); | 1990 __ movq(Address(RBX, Isolate::user_tag_offset()), R10); |
| 1994 __ ret(); | 1991 __ ret(); |
| 1995 } | 1992 } |
| 1996 | 1993 |
| 1997 | 1994 |
| 1998 void Intrinsifier::UserTag_defaultTag(Assembler* assembler) { | 1995 void Intrinsifier::UserTag_defaultTag(Assembler* assembler) { |
| 1999 // RBX: Address of default tag. | 1996 __ LoadIsolate(RAX); |
| 2000 Isolate* isolate = Isolate::Current(); | 1997 __ movq(RAX, Address(RAX, Isolate::default_tag_offset())); |
| 2001 const Immediate& default_tag_addr = | |
| 2002 Immediate(reinterpret_cast<int64_t>(isolate) + | |
| 2003 Isolate::default_tag_offset()); | |
| 2004 __ movq(RBX, default_tag_addr); | |
| 2005 // Set return value. | |
| 2006 __ movq(RAX, Address(RBX, 0)); | |
| 2007 __ ret(); | 1998 __ ret(); |
| 2008 } | 1999 } |
| 2009 | 2000 |
| 2010 | 2001 |
| 2011 void Intrinsifier::Profiler_getCurrentTag(Assembler* assembler) { | 2002 void Intrinsifier::Profiler_getCurrentTag(Assembler* assembler) { |
| 2012 // RBX: Isolate. | 2003 __ LoadIsolate(RAX); |
| 2013 Isolate* isolate = Isolate::Current(); | 2004 __ movq(RAX, Address(RAX, Isolate::current_tag_offset())); |
| 2014 const Immediate& isolate_address = | |
| 2015 Immediate(reinterpret_cast<int64_t>(isolate)); | |
| 2016 __ movq(RBX, isolate_address); | |
| 2017 // Set return value to Isolate::current_tag_. | |
| 2018 __ movq(RAX, Address(RBX, Isolate::current_tag_offset())); | |
| 2019 __ ret(); | 2005 __ ret(); |
| 2020 } | 2006 } |
| 2021 | 2007 |
| 2022 #undef __ | 2008 #undef __ |
| 2023 | 2009 |
| 2024 } // namespace dart | 2010 } // namespace dart |
| 2025 | 2011 |
| 2026 #endif // defined TARGET_ARCH_X64 | 2012 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |