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" |
11 #include "vm/flow_graph_compiler.h" | 12 #include "vm/flow_graph_compiler.h" |
12 #include "vm/instructions.h" | 13 #include "vm/instructions.h" |
13 #include "vm/object_store.h" | 14 #include "vm/object_store.h" |
| 15 #include "vm/regexp_assembler.h" |
14 #include "vm/symbols.h" | 16 #include "vm/symbols.h" |
15 | 17 |
16 namespace dart { | 18 namespace dart { |
17 | 19 |
18 DECLARE_FLAG(bool, enable_type_checks); | 20 DECLARE_FLAG(bool, enable_type_checks); |
19 | 21 |
20 // When entering intrinsics code: | 22 // When entering intrinsics code: |
21 // RBX: IC Data | 23 // RBX: IC Data |
22 // R10: Arguments descriptor | 24 // R10: Arguments descriptor |
23 // TOS: Return address | 25 // TOS: Return address |
(...skipping 1504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1528 void Intrinsifier::OneByteString_equality(Assembler* assembler) { | 1530 void Intrinsifier::OneByteString_equality(Assembler* assembler) { |
1529 StringEquality(assembler, kOneByteStringCid); | 1531 StringEquality(assembler, kOneByteStringCid); |
1530 } | 1532 } |
1531 | 1533 |
1532 | 1534 |
1533 void Intrinsifier::TwoByteString_equality(Assembler* assembler) { | 1535 void Intrinsifier::TwoByteString_equality(Assembler* assembler) { |
1534 StringEquality(assembler, kTwoByteStringCid); | 1536 StringEquality(assembler, kTwoByteStringCid); |
1535 } | 1537 } |
1536 | 1538 |
1537 | 1539 |
| 1540 #ifndef USE_JSCRE |
| 1541 void Intrinsifier::JSRegExp_ExecuteMatch(Assembler* assembler) { |
| 1542 static const intptr_t kRegExpParamOffset = + 3 * kWordSize; |
| 1543 static const intptr_t kStringParamOffset = + 2 * kWordSize; |
| 1544 // const Smi& start_index is located at (+ 1 * kWordSize). |
| 1545 |
| 1546 // Register assignments are as follows: |
| 1547 // RAX: The appropriate specialized matcher function. |
| 1548 // RBX: The regexp object. |
| 1549 // RDI: Temp, Pointer to the function's code which we then tail-call. |
| 1550 |
| 1551 __ movq(RBX, Address(RSP, kRegExpParamOffset)); |
| 1552 __ movq(RDI, Address(RSP, kStringParamOffset)); |
| 1553 |
| 1554 // Load the specialized function pointer into RAX. Leverage the fact the |
| 1555 // string CIDs as well as stored function pointers are in sequence. |
| 1556 |
| 1557 __ LoadClassId(RDI, RDI); |
| 1558 __ SubImmediate(RDI, Immediate(kOneByteStringCid), PP); |
| 1559 __ movq(RAX, FieldAddress(RBX, RDI, TIMES_8, |
| 1560 JSRegExp::function_offset(kOneByteStringCid))); |
| 1561 |
| 1562 // Registers have been set up for the lazy compile stub at this point. |
| 1563 // It expects the function in RAX, the argument descriptor in R10, and |
| 1564 // IC-Data in RCX. Explicitly null out IC-Data to ensure its validity. |
| 1565 |
| 1566 static const intptr_t arg_count = RegExpMacroAssembler::kParamCount; |
| 1567 __ LoadObject(R10, Array::Handle(ArgumentsDescriptor::New(arg_count)), PP); |
| 1568 __ xorq(RCX, RCX); |
| 1569 |
| 1570 // Tail-call the function. |
| 1571 __ movq(RDI, FieldAddress(RAX, Function::instructions_offset())); |
| 1572 __ addq(RDI, Immediate(Instructions::HeaderSize() - kHeapObjectTag)); |
| 1573 __ jmp(RDI); |
| 1574 } |
| 1575 #endif |
| 1576 |
| 1577 |
1538 // On stack: user tag (+1), return-address (+0). | 1578 // On stack: user tag (+1), return-address (+0). |
1539 void Intrinsifier::UserTag_makeCurrent(Assembler* assembler) { | 1579 void Intrinsifier::UserTag_makeCurrent(Assembler* assembler) { |
1540 // RBX: Isolate. | 1580 // RBX: Isolate. |
1541 Isolate* isolate = Isolate::Current(); | 1581 Isolate* isolate = Isolate::Current(); |
1542 const Immediate& isolate_address = | 1582 const Immediate& isolate_address = |
1543 Immediate(reinterpret_cast<int64_t>(isolate)); | 1583 Immediate(reinterpret_cast<int64_t>(isolate)); |
1544 __ movq(RBX, isolate_address); | 1584 __ movq(RBX, isolate_address); |
1545 // RAX: Current user tag. | 1585 // RAX: Current user tag. |
1546 __ movq(RAX, Address(RBX, Isolate::current_tag_offset())); | 1586 __ movq(RAX, Address(RBX, Isolate::current_tag_offset())); |
1547 // R10: UserTag. | 1587 // R10: UserTag. |
(...skipping 30 matching lines...) Expand all Loading... |
1578 // Set return value to Isolate::current_tag_. | 1618 // Set return value to Isolate::current_tag_. |
1579 __ movq(RAX, Address(RBX, Isolate::current_tag_offset())); | 1619 __ movq(RAX, Address(RBX, Isolate::current_tag_offset())); |
1580 __ ret(); | 1620 __ ret(); |
1581 } | 1621 } |
1582 | 1622 |
1583 #undef __ | 1623 #undef __ |
1584 | 1624 |
1585 } // namespace dart | 1625 } // namespace dart |
1586 | 1626 |
1587 #endif // defined TARGET_ARCH_X64 | 1627 #endif // defined TARGET_ARCH_X64 |
OLD | NEW |