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 1506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1517 __ cmpq(RAX, Address(RSP, + kReceiverOffset * kWordSize)); | 1517 __ cmpq(RAX, Address(RSP, + kReceiverOffset * kWordSize)); |
1518 __ j(EQUAL, &is_true, Assembler::kNearJump); | 1518 __ j(EQUAL, &is_true, Assembler::kNearJump); |
1519 __ LoadObject(RAX, Bool::False(), PP); | 1519 __ LoadObject(RAX, Bool::False(), PP); |
1520 __ ret(); | 1520 __ ret(); |
1521 __ Bind(&is_true); | 1521 __ Bind(&is_true); |
1522 __ LoadObject(RAX, Bool::True(), PP); | 1522 __ LoadObject(RAX, Bool::True(), PP); |
1523 __ ret(); | 1523 __ ret(); |
1524 } | 1524 } |
1525 | 1525 |
1526 | 1526 |
| 1527 // Return type quickly for simple types (not parameterized and not signature). |
| 1528 void Intrinsifier::ObjectRuntimeType(Assembler* assembler) { |
| 1529 Label fall_through; |
| 1530 __ movq(RAX, Address(RSP, + 1 * kWordSize)); |
| 1531 __ LoadClassIdMayBeSmi(RCX, RAX); |
| 1532 |
| 1533 // RCX: untagged cid of instance (RAX). |
| 1534 __ LoadClassById(RDI, RCX, PP); |
| 1535 // RDI: class of instance (RAX). |
| 1536 __ movq(RCX, FieldAddress(RDI, Class::signature_function_offset())); |
| 1537 __ CompareObject(RCX, Object::null_object(), PP); |
| 1538 __ j(NOT_EQUAL, &fall_through, Assembler::kNearJump); |
| 1539 |
| 1540 __ movzxw(RCX, FieldAddress(RDI, Class::num_type_arguments_offset())); |
| 1541 __ cmpq(RCX, Immediate(0)); |
| 1542 __ j(NOT_EQUAL, &fall_through, Assembler::kNearJump); |
| 1543 __ movq(RAX, FieldAddress(RDI, Class::canonical_types_offset())); |
| 1544 __ CompareObject(RAX, Object::null_object(), PP); |
| 1545 __ j(EQUAL, &fall_through, Assembler::kNearJump); // Not yet set. |
| 1546 __ ret(); |
| 1547 |
| 1548 __ Bind(&fall_through); |
| 1549 } |
| 1550 |
| 1551 |
1527 void Intrinsifier::String_getHashCode(Assembler* assembler) { | 1552 void Intrinsifier::String_getHashCode(Assembler* assembler) { |
1528 Label fall_through; | 1553 Label fall_through; |
1529 __ movq(RAX, Address(RSP, + 1 * kWordSize)); // String object. | 1554 __ movq(RAX, Address(RSP, + 1 * kWordSize)); // String object. |
1530 __ movq(RAX, FieldAddress(RAX, String::hash_offset())); | 1555 __ movq(RAX, FieldAddress(RAX, String::hash_offset())); |
1531 __ cmpq(RAX, Immediate(0)); | 1556 __ cmpq(RAX, Immediate(0)); |
1532 __ j(EQUAL, &fall_through, Assembler::kNearJump); | 1557 __ j(EQUAL, &fall_through, Assembler::kNearJump); |
1533 __ ret(); | 1558 __ ret(); |
1534 __ Bind(&fall_through); | 1559 __ Bind(&fall_through); |
1535 // Hash not yet computed. | 1560 // Hash not yet computed. |
1536 } | 1561 } |
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1925 __ movq(RBX, Address(RSP, kRegExpParamOffset)); | 1950 __ movq(RBX, Address(RSP, kRegExpParamOffset)); |
1926 __ movq(RDI, Address(RSP, kStringParamOffset)); | 1951 __ movq(RDI, Address(RSP, kStringParamOffset)); |
1927 __ LoadClassId(RDI, RDI); | 1952 __ LoadClassId(RDI, RDI); |
1928 __ SubImmediate(RDI, Immediate(kOneByteStringCid), PP); | 1953 __ SubImmediate(RDI, Immediate(kOneByteStringCid), PP); |
1929 __ movq(RAX, FieldAddress(RBX, RDI, TIMES_8, | 1954 __ movq(RAX, FieldAddress(RBX, RDI, TIMES_8, |
1930 JSRegExp::function_offset(kOneByteStringCid))); | 1955 JSRegExp::function_offset(kOneByteStringCid))); |
1931 | 1956 |
1932 // Registers are now set up for the lazy compile stub. It expects the function | 1957 // Registers are now set up for the lazy compile stub. It expects the function |
1933 // in RAX, the argument descriptor in R10, and IC-Data in RCX. | 1958 // in RAX, the argument descriptor in R10, and IC-Data in RCX. |
1934 static const intptr_t arg_count = RegExpMacroAssembler::kParamCount; | 1959 static const intptr_t arg_count = RegExpMacroAssembler::kParamCount; |
1935 __ LoadObject(R10, Array::Handle(ArgumentsDescriptor::New(arg_count)), PP); | 1960 __ LoadObject(R10, |
| 1961 Array::ZoneHandle(ArgumentsDescriptor::New(arg_count)), PP); |
1936 __ xorq(RCX, RCX); | 1962 __ xorq(RCX, RCX); |
1937 | 1963 |
1938 // Tail-call the function. | 1964 // Tail-call the function. |
1939 __ movq(RDI, FieldAddress(RAX, Function::instructions_offset())); | 1965 __ movq(RDI, FieldAddress(RAX, Function::instructions_offset())); |
1940 __ addq(RDI, Immediate(Instructions::HeaderSize() - kHeapObjectTag)); | 1966 __ addq(RDI, Immediate(Instructions::HeaderSize() - kHeapObjectTag)); |
1941 __ jmp(RDI); | 1967 __ jmp(RDI); |
1942 } | 1968 } |
1943 | 1969 |
1944 | 1970 |
1945 // On stack: user tag (+1), return-address (+0). | 1971 // On stack: user tag (+1), return-address (+0). |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1985 // Set return value to Isolate::current_tag_. | 2011 // Set return value to Isolate::current_tag_. |
1986 __ movq(RAX, Address(RBX, Isolate::current_tag_offset())); | 2012 __ movq(RAX, Address(RBX, Isolate::current_tag_offset())); |
1987 __ ret(); | 2013 __ ret(); |
1988 } | 2014 } |
1989 | 2015 |
1990 #undef __ | 2016 #undef __ |
1991 | 2017 |
1992 } // namespace dart | 2018 } // namespace dart |
1993 | 2019 |
1994 #endif // defined TARGET_ARCH_X64 | 2020 #endif // defined TARGET_ARCH_X64 |
OLD | NEW |