OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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_ARM64. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_ARM64. |
6 #if defined(TARGET_ARCH_ARM64) | 6 #if defined(TARGET_ARCH_ARM64) |
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/object.h" | 13 #include "vm/object.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 | 22 |
21 #define __ assembler-> | 23 #define __ assembler-> |
22 | 24 |
23 | 25 |
(...skipping 1486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1510 void Intrinsifier::OneByteString_equality(Assembler* assembler) { | 1512 void Intrinsifier::OneByteString_equality(Assembler* assembler) { |
1511 StringEquality(assembler, kOneByteStringCid); | 1513 StringEquality(assembler, kOneByteStringCid); |
1512 } | 1514 } |
1513 | 1515 |
1514 | 1516 |
1515 void Intrinsifier::TwoByteString_equality(Assembler* assembler) { | 1517 void Intrinsifier::TwoByteString_equality(Assembler* assembler) { |
1516 StringEquality(assembler, kTwoByteStringCid); | 1518 StringEquality(assembler, kTwoByteStringCid); |
1517 } | 1519 } |
1518 | 1520 |
1519 | 1521 |
| 1522 #ifndef USE_JSCRE |
| 1523 void Intrinsifier::JSRegExp_ExecuteMatch(Assembler* assembler) { |
| 1524 static const intptr_t kRegExpParamOffset = + 2 * kWordSize; |
| 1525 static const intptr_t kStringParamOffset = + 1 * kWordSize; |
| 1526 // const Smi& start_index is located at (+ 0 * kWordSize). |
| 1527 |
| 1528 // Register assignments are as follows: |
| 1529 // R0: The appropriate specialized matcher function. |
| 1530 // R2: The regexp object. |
| 1531 // R4: Temp. |
| 1532 // R5: Temp. |
| 1533 // R1: Temp, Pointer to the function's code which we then tail-call. |
| 1534 |
| 1535 __ ldr(R2, Address(SP, kRegExpParamOffset)); |
| 1536 __ ldr(R1, Address(SP, kStringParamOffset)); |
| 1537 |
| 1538 // Load the specialized function pointer into R0. Leverage the fact the |
| 1539 // string CIDs as well as stored function pointers are in sequence. |
| 1540 |
| 1541 __ LoadClassId(R1, R1, kNoPP); |
| 1542 __ AddImmediate(R1, R1, -kOneByteStringCid, kNoPP); |
| 1543 __ add(R1, R2, Operand(R1, LSL, kWordSizeLog2)); |
| 1544 __ ldr(R0, FieldAddress(R1, JSRegExp::function_offset(kOneByteStringCid))); |
| 1545 |
| 1546 // Registers have been set up for the lazy compile stub at this point. |
| 1547 // It expects the function in R0, the argument descriptor in R4, and |
| 1548 // IC-Data in R5. Explicitly null out IC-Data to ensure its validity. |
| 1549 |
| 1550 static const intptr_t arg_count = RegExpMacroAssembler::kParamCount; |
| 1551 __ LoadObject(R4, Array::Handle(ArgumentsDescriptor::New(arg_count)), kNoPP); |
| 1552 __ eor(R5, R5, Operand(R5)); |
| 1553 |
| 1554 // Tail-call the function. |
| 1555 __ ldr(R1, FieldAddress(R0, Function::instructions_offset())); |
| 1556 __ AddImmediate(R1, R1, Instructions::HeaderSize() - kHeapObjectTag, kNoPP); |
| 1557 __ br(R1); |
| 1558 } |
| 1559 #endif |
| 1560 |
| 1561 |
1520 // On stack: user tag (+0). | 1562 // On stack: user tag (+0). |
1521 void Intrinsifier::UserTag_makeCurrent(Assembler* assembler) { | 1563 void Intrinsifier::UserTag_makeCurrent(Assembler* assembler) { |
1522 // R1: Isolate. | 1564 // R1: Isolate. |
1523 Isolate* isolate = Isolate::Current(); | 1565 Isolate* isolate = Isolate::Current(); |
1524 __ LoadImmediate(R1, reinterpret_cast<uword>(isolate), kNoPP); | 1566 __ LoadImmediate(R1, reinterpret_cast<uword>(isolate), kNoPP); |
1525 // R0: Current user tag. | 1567 // R0: Current user tag. |
1526 __ ldr(R0, Address(R1, Isolate::current_tag_offset())); | 1568 __ ldr(R0, Address(R1, Isolate::current_tag_offset())); |
1527 // R2: UserTag. | 1569 // R2: UserTag. |
1528 __ ldr(R2, Address(SP, + 0 * kWordSize)); | 1570 __ ldr(R2, Address(SP, + 0 * kWordSize)); |
1529 // Set Isolate::current_tag_. | 1571 // Set Isolate::current_tag_. |
(...skipping 22 matching lines...) Expand all Loading... |
1552 Isolate* isolate = Isolate::Current(); | 1594 Isolate* isolate = Isolate::Current(); |
1553 __ LoadImmediate(R1, reinterpret_cast<uword>(isolate), kNoPP); | 1595 __ LoadImmediate(R1, reinterpret_cast<uword>(isolate), kNoPP); |
1554 // Set return value to Isolate::current_tag_. | 1596 // Set return value to Isolate::current_tag_. |
1555 __ ldr(R0, Address(R1, Isolate::current_tag_offset())); | 1597 __ ldr(R0, Address(R1, Isolate::current_tag_offset())); |
1556 __ ret(); | 1598 __ ret(); |
1557 } | 1599 } |
1558 | 1600 |
1559 } // namespace dart | 1601 } // namespace dart |
1560 | 1602 |
1561 #endif // defined TARGET_ARCH_ARM64 | 1603 #endif // defined TARGET_ARCH_ARM64 |
OLD | NEW |