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 void Intrinsifier::JSRegExp_ExecuteMatch(Assembler* assembler) { | |
Ivan Posva
2014/11/14 08:42:50
ditto
zerny-google
2014/11/14 12:18:57
Done.
| |
1523 static const intptr_t kRegExpParamOffset = + 2 * kWordSize; | |
1524 static const intptr_t kStringParamOffset = + 1 * kWordSize; | |
1525 // const Smi& start_index is located at (+ 0 * kWordSize). | |
1526 | |
1527 // Register assignments are as follows: | |
1528 // R0: The appropriate specialized matcher function. | |
1529 // R2: The regexp object. | |
1530 // R4: Temp. | |
1531 // R5: Temp. | |
1532 // R1: Temp, Pointer to the function's code which we then tail-call. | |
1533 | |
1534 __ ldr(R2, Address(SP, kRegExpParamOffset)); | |
1535 __ ldr(R1, Address(SP, kStringParamOffset)); | |
1536 | |
1537 // Load the specialized function pointer into R0. Leverage the fact the | |
1538 // string CIDs as well as stored function pointers are in sequence. | |
1539 | |
1540 __ LoadClassId(R1, R1, kNoPP); | |
1541 __ AddImmediate(R1, R1, -kOneByteStringCid, kNoPP); | |
1542 __ add(R1, R2, Operand(R1, LSL, kWordSizeLog2)); | |
1543 __ ldr(R0, FieldAddress(R1, JSRegExp::function_offset(kOneByteStringCid))); | |
1544 | |
1545 // Registers have been set up for the lazy compile stub at this point. | |
1546 // It expects the function in R0, the argument descriptor in R4, and | |
1547 // IC-Data in R5. Explicitly null out IC-Data to ensure its validity. | |
1548 | |
1549 static const intptr_t arg_count = RegExpMacroAssembler::kParamCount; | |
1550 __ LoadObject(R4, Array::Handle(ArgumentsDescriptor::New(arg_count)), kNoPP); | |
1551 __ eor(R5, R5, Operand(R5)); | |
1552 | |
1553 // Tail-call the function. | |
1554 __ ldr(R1, FieldAddress(R0, Function::instructions_offset())); | |
1555 __ AddImmediate(R1, R1, Instructions::HeaderSize() - kHeapObjectTag, kNoPP); | |
1556 __ br(R1); | |
1557 } | |
1558 | |
1559 | |
1520 // On stack: user tag (+0). | 1560 // On stack: user tag (+0). |
1521 void Intrinsifier::UserTag_makeCurrent(Assembler* assembler) { | 1561 void Intrinsifier::UserTag_makeCurrent(Assembler* assembler) { |
1522 // R1: Isolate. | 1562 // R1: Isolate. |
1523 Isolate* isolate = Isolate::Current(); | 1563 Isolate* isolate = Isolate::Current(); |
1524 __ LoadImmediate(R1, reinterpret_cast<uword>(isolate), kNoPP); | 1564 __ LoadImmediate(R1, reinterpret_cast<uword>(isolate), kNoPP); |
1525 // R0: Current user tag. | 1565 // R0: Current user tag. |
1526 __ ldr(R0, Address(R1, Isolate::current_tag_offset())); | 1566 __ ldr(R0, Address(R1, Isolate::current_tag_offset())); |
1527 // R2: UserTag. | 1567 // R2: UserTag. |
1528 __ ldr(R2, Address(SP, + 0 * kWordSize)); | 1568 __ ldr(R2, Address(SP, + 0 * kWordSize)); |
1529 // Set Isolate::current_tag_. | 1569 // Set Isolate::current_tag_. |
(...skipping 22 matching lines...) Expand all Loading... | |
1552 Isolate* isolate = Isolate::Current(); | 1592 Isolate* isolate = Isolate::Current(); |
1553 __ LoadImmediate(R1, reinterpret_cast<uword>(isolate), kNoPP); | 1593 __ LoadImmediate(R1, reinterpret_cast<uword>(isolate), kNoPP); |
1554 // Set return value to Isolate::current_tag_. | 1594 // Set return value to Isolate::current_tag_. |
1555 __ ldr(R0, Address(R1, Isolate::current_tag_offset())); | 1595 __ ldr(R0, Address(R1, Isolate::current_tag_offset())); |
1556 __ ret(); | 1596 __ ret(); |
1557 } | 1597 } |
1558 | 1598 |
1559 } // namespace dart | 1599 } // namespace dart |
1560 | 1600 |
1561 #endif // defined TARGET_ARCH_ARM64 | 1601 #endif // defined TARGET_ARCH_ARM64 |
OLD | NEW |