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

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

Issue 11191078: Make hashCode a getter and not a method. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Update status file with co19 issue number. Created 8 years, 2 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 1491 matching lines...) Expand 10 before | Expand all | Expand 10 after
1502 __ LoadObject(RAX, bool_false); 1502 __ LoadObject(RAX, bool_false);
1503 __ ret(); 1503 __ ret();
1504 __ Bind(&is_true); 1504 __ Bind(&is_true);
1505 __ LoadObject(RAX, bool_true); 1505 __ LoadObject(RAX, bool_true);
1506 __ ret(); 1506 __ ret();
1507 __ Bind(&fall_through); 1507 __ Bind(&fall_through);
1508 return false; 1508 return false;
1509 } 1509 }
1510 1510
1511 1511
1512 bool Intrinsifier::String_getHashCode(Assembler* assembler) {
1513 Label fall_through;
1514 __ movq(RAX, Address(RSP, + 1 * kWordSize)); // String object.
1515 __ movq(RAX, FieldAddress(RAX, String::hash_offset()));
1516 __ cmpq(RAX, Immediate(0));
1517 __ j(EQUAL, &fall_through, Assembler::kNearJump);
1518 __ ret();
1519 __ Bind(&fall_through);
1520 // Hash not yet computed.
1521 return false;
1522 }
1523
1524
1512 bool Intrinsifier::String_getLength(Assembler* assembler) { 1525 bool Intrinsifier::String_getLength(Assembler* assembler) {
1513 __ movq(RAX, Address(RSP, + 1 * kWordSize)); // String object. 1526 __ movq(RAX, Address(RSP, + 1 * kWordSize)); // String object.
1514 __ movq(RAX, FieldAddress(RAX, String::length_offset())); 1527 __ movq(RAX, FieldAddress(RAX, String::length_offset()));
1515 __ ret(); 1528 __ ret();
1516 return true; 1529 return true;
1517 } 1530 }
1518 1531
1519 1532
1520 // TODO(srdjan): Implement for two and four byte strings as well. 1533 // TODO(srdjan): Implement for two and four byte strings as well.
1521 bool Intrinsifier::String_charCodeAt(Assembler* assembler) { 1534 bool Intrinsifier::String_charCodeAt(Assembler* assembler) {
(...skipping 10 matching lines...) Expand all
1532 __ j(NOT_EQUAL, &fall_through); 1545 __ j(NOT_EQUAL, &fall_through);
1533 __ SmiUntag(RCX); 1546 __ SmiUntag(RCX);
1534 __ movzxb(RAX, FieldAddress(RAX, RCX, TIMES_1, OneByteString::data_offset())); 1547 __ movzxb(RAX, FieldAddress(RAX, RCX, TIMES_1, OneByteString::data_offset()));
1535 __ SmiTag(RAX); 1548 __ SmiTag(RAX);
1536 __ ret(); 1549 __ ret();
1537 __ Bind(&fall_through); 1550 __ Bind(&fall_through);
1538 return false; 1551 return false;
1539 } 1552 }
1540 1553
1541 1554
1542 bool Intrinsifier::String_hashCode(Assembler* assembler) {
1543 Label fall_through;
1544 __ movq(RAX, Address(RSP, + 1 * kWordSize)); // String object.
1545 __ movq(RAX, FieldAddress(RAX, String::hash_offset()));
1546 __ cmpq(RAX, Immediate(0));
1547 __ j(EQUAL, &fall_through, Assembler::kNearJump);
1548 __ ret();
1549 __ Bind(&fall_through);
1550 // Hash not yet computed.
1551 return false;
1552 }
1553
1554
1555 bool Intrinsifier::String_isEmpty(Assembler* assembler) { 1555 bool Intrinsifier::String_isEmpty(Assembler* assembler) {
1556 Label is_true; 1556 Label is_true;
1557 const Bool& bool_true = Bool::ZoneHandle(Bool::True()); 1557 const Bool& bool_true = Bool::ZoneHandle(Bool::True());
1558 const Bool& bool_false = Bool::ZoneHandle(Bool::False()); 1558 const Bool& bool_false = Bool::ZoneHandle(Bool::False());
1559 // Get length. 1559 // Get length.
1560 __ movq(RAX, Address(RSP, + 1 * kWordSize)); // String object. 1560 __ movq(RAX, Address(RSP, + 1 * kWordSize)); // String object.
1561 __ movq(RAX, FieldAddress(RAX, String::length_offset())); 1561 __ movq(RAX, FieldAddress(RAX, String::length_offset()));
1562 __ cmpq(RAX, Immediate(Smi::RawValue(0))); 1562 __ cmpq(RAX, Immediate(Smi::RawValue(0)));
1563 __ j(EQUAL, &is_true, Assembler::kNearJump); 1563 __ j(EQUAL, &is_true, Assembler::kNearJump);
1564 __ LoadObject(RAX, bool_false); 1564 __ LoadObject(RAX, bool_false);
1565 __ ret(); 1565 __ ret();
1566 __ Bind(&is_true); 1566 __ Bind(&is_true);
1567 __ LoadObject(RAX, bool_true); 1567 __ LoadObject(RAX, bool_true);
1568 __ ret(); 1568 __ ret();
1569 return true; 1569 return true;
1570 } 1570 }
1571 1571
1572 #undef __ 1572 #undef __
1573 1573
1574 } // namespace dart 1574 } // namespace dart
1575 1575
1576 #endif // defined TARGET_ARCH_X64 1576 #endif // defined TARGET_ARCH_X64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698