Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(884)

Side by Side Diff: runtime/vm/intrinsifier_x64.cc

Issue 1192103004: VM: New calling convention for generated code. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: fixed comments Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « runtime/vm/intrinsifier_mips.cc ('k') | runtime/vm/native_entry.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1581 matching lines...) Expand 10 before | Expand all | Expand 10 after
1592 1592
1593 __ Bind(&fall_through); 1593 __ Bind(&fall_through);
1594 } 1594 }
1595 1595
1596 1596
1597 void Intrinsifier::StringBaseCharAt(Assembler* assembler) { 1597 void Intrinsifier::StringBaseCharAt(Assembler* assembler) {
1598 Label fall_through, try_two_byte_string; 1598 Label fall_through, try_two_byte_string;
1599 __ movq(RCX, Address(RSP, + 1 * kWordSize)); // Index. 1599 __ movq(RCX, Address(RSP, + 1 * kWordSize)); // Index.
1600 __ movq(RAX, Address(RSP, + 2 * kWordSize)); // String. 1600 __ movq(RAX, Address(RSP, + 2 * kWordSize)); // String.
1601 __ testq(RCX, Immediate(kSmiTagMask)); 1601 __ testq(RCX, Immediate(kSmiTagMask));
1602 __ j(NOT_ZERO, &fall_through, Assembler::kNearJump); // Non-smi index. 1602 __ j(NOT_ZERO, &fall_through); // Non-smi index.
1603 // Range check. 1603 // Range check.
1604 __ cmpq(RCX, FieldAddress(RAX, String::length_offset())); 1604 __ cmpq(RCX, FieldAddress(RAX, String::length_offset()));
1605 // Runtime throws exception. 1605 // Runtime throws exception.
1606 __ j(ABOVE_EQUAL, &fall_through, Assembler::kNearJump); 1606 __ j(ABOVE_EQUAL, &fall_through);
1607 __ CompareClassId(RAX, kOneByteStringCid); 1607 __ CompareClassId(RAX, kOneByteStringCid);
1608 __ j(NOT_EQUAL, &try_two_byte_string, Assembler::kNearJump); 1608 __ j(NOT_EQUAL, &try_two_byte_string, Assembler::kNearJump);
1609 __ SmiUntag(RCX); 1609 __ SmiUntag(RCX);
1610 __ movzxb(RCX, FieldAddress(RAX, RCX, TIMES_1, OneByteString::data_offset())); 1610 __ movzxb(RCX, FieldAddress(RAX, RCX, TIMES_1, OneByteString::data_offset()));
1611 __ cmpq(RCX, Immediate(Symbols::kNumberOfOneCharCodeSymbols)); 1611 __ cmpq(RCX, Immediate(Symbols::kNumberOfOneCharCodeSymbols));
1612 __ j(GREATER_EQUAL, &fall_through); 1612 __ j(GREATER_EQUAL, &fall_through);
1613 __ movq(RAX, Address(THR, Thread::predefined_symbols_address_offset())); 1613 __ movq(RAX, Address(THR, Thread::predefined_symbols_address_offset()));
1614 __ movq(RAX, Address(RAX, 1614 __ movq(RAX, Address(RAX,
1615 RCX, 1615 RCX,
1616 TIMES_8, 1616 TIMES_8,
1617 Symbols::kNullCharCodeSymbolOffset * kWordSize)); 1617 Symbols::kNullCharCodeSymbolOffset * kWordSize));
1618 __ ret(); 1618 __ ret();
1619 1619
1620 __ Bind(&try_two_byte_string); 1620 __ Bind(&try_two_byte_string);
1621 __ CompareClassId(RAX, kTwoByteStringCid); 1621 __ CompareClassId(RAX, kTwoByteStringCid);
1622 __ j(NOT_EQUAL, &fall_through, Assembler::kNearJump); 1622 __ j(NOT_EQUAL, &fall_through);
1623 ASSERT(kSmiTagShift == 1); 1623 ASSERT(kSmiTagShift == 1);
1624 __ movzxw(RCX, FieldAddress(RAX, RCX, TIMES_1, OneByteString::data_offset())); 1624 __ movzxw(RCX, FieldAddress(RAX, RCX, TIMES_1, OneByteString::data_offset()));
1625 __ cmpq(RCX, Immediate(Symbols::kNumberOfOneCharCodeSymbols)); 1625 __ cmpq(RCX, Immediate(Symbols::kNumberOfOneCharCodeSymbols));
1626 __ j(GREATER_EQUAL, &fall_through); 1626 __ j(GREATER_EQUAL, &fall_through);
1627 __ movq(RAX, Address(THR, Thread::predefined_symbols_address_offset())); 1627 __ movq(RAX, Address(THR, Thread::predefined_symbols_address_offset()));
1628 __ movq(RAX, Address(RAX, 1628 __ movq(RAX, Address(RAX,
1629 RCX, 1629 RCX,
1630 TIMES_8, 1630 TIMES_8,
1631 Symbols::kNullCharCodeSymbolOffset * kWordSize)); 1631 Symbols::kNullCharCodeSymbolOffset * kWordSize));
1632 __ ret(); 1632 __ ret();
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after
1956 __ LoadClassId(RDI, RDI); 1956 __ LoadClassId(RDI, RDI);
1957 __ SubImmediate(RDI, Immediate(kOneByteStringCid)); 1957 __ SubImmediate(RDI, Immediate(kOneByteStringCid));
1958 __ movq(RAX, FieldAddress(RBX, RDI, TIMES_8, 1958 __ movq(RAX, FieldAddress(RBX, RDI, TIMES_8,
1959 JSRegExp::function_offset(kOneByteStringCid))); 1959 JSRegExp::function_offset(kOneByteStringCid)));
1960 1960
1961 // Registers are now set up for the lazy compile stub. It expects the function 1961 // Registers are now set up for the lazy compile stub. It expects the function
1962 // in RAX, the argument descriptor in R10, and IC-Data in RCX. 1962 // in RAX, the argument descriptor in R10, and IC-Data in RCX.
1963 __ xorq(RCX, RCX); 1963 __ xorq(RCX, RCX);
1964 1964
1965 // Tail-call the function. 1965 // Tail-call the function.
1966 __ movq(CODE_REG, FieldAddress(RAX, Function::code_offset()));
1966 __ movq(RDI, FieldAddress(RAX, Function::entry_point_offset())); 1967 __ movq(RDI, FieldAddress(RAX, Function::entry_point_offset()));
1967 __ jmp(RDI); 1968 __ jmp(RDI);
1968 } 1969 }
1969 1970
1970 1971
1971 // On stack: user tag (+1), return-address (+0). 1972 // On stack: user tag (+1), return-address (+0).
1972 void Intrinsifier::UserTag_makeCurrent(Assembler* assembler) { 1973 void Intrinsifier::UserTag_makeCurrent(Assembler* assembler) {
1973 // RBX: Isolate. 1974 // RBX: Isolate.
1974 __ LoadIsolate(RBX); 1975 __ LoadIsolate(RBX);
1975 // RAX: Current user tag. 1976 // RAX: Current user tag.
(...skipping 21 matching lines...) Expand all
1997 __ LoadIsolate(RAX); 1998 __ LoadIsolate(RAX);
1998 __ movq(RAX, Address(RAX, Isolate::current_tag_offset())); 1999 __ movq(RAX, Address(RAX, Isolate::current_tag_offset()));
1999 __ ret(); 2000 __ ret();
2000 } 2001 }
2001 2002
2002 #undef __ 2003 #undef __
2003 2004
2004 } // namespace dart 2005 } // namespace dart
2005 2006
2006 #endif // defined TARGET_ARCH_X64 2007 #endif // defined TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « runtime/vm/intrinsifier_mips.cc ('k') | runtime/vm/native_entry.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698