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

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

Issue 539153002: Port and integrate the irregexp engine from V8 (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Squashed all irregexp CLs, addressed comments. Created 6 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) 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_MIPS. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_MIPS.
6 #if defined(TARGET_ARCH_MIPS) 6 #if defined(TARGET_ARCH_MIPS)
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 #define __ assembler-> 22 #define __ assembler->
21 23
22 24
23 intptr_t Intrinsifier::ParameterSlotFromSp() { return -1; } 25 intptr_t Intrinsifier::ParameterSlotFromSp() { return -1; }
(...skipping 1634 matching lines...) Expand 10 before | Expand all | Expand 10 after
1658 1660
1659 void Intrinsifier::OneByteString_equality(Assembler* assembler) { 1661 void Intrinsifier::OneByteString_equality(Assembler* assembler) {
1660 StringEquality(assembler, kOneByteStringCid); 1662 StringEquality(assembler, kOneByteStringCid);
1661 } 1663 }
1662 1664
1663 1665
1664 void Intrinsifier::TwoByteString_equality(Assembler* assembler) { 1666 void Intrinsifier::TwoByteString_equality(Assembler* assembler) {
1665 StringEquality(assembler, kTwoByteStringCid); 1667 StringEquality(assembler, kTwoByteStringCid);
1666 } 1668 }
1667 1669
1670
1671 void Intrinsifier::JSRegExp_ExecuteMatch(Assembler* assembler) {
1672 static const intptr_t kRegExpParamOffset = + 2 * kWordSize;
1673 static const intptr_t kStringParamOffset = + 1 * kWordSize;
1674 // const Smi& start_index is located at (+ 0 * kWordSize).
1675
1676 // Register assignments are as follows:
1677 // T0: The appropriate specialized matcher function.
1678 // T1: The regexp object.
1679 // T2: Temp.
1680 // T3: Temp, Pointer to the function's code which we then tail-call.
1681
1682 __ lw(T1, Address(SP, kRegExpParamOffset));
1683 __ lw(T3, Address(SP, kStringParamOffset));
1684
1685 // Load the specialized function pointer into T0. Leverage the fact the
1686 // string CIDs as well as stored function pointers are in sequence.
1687
1688 __ LoadClassId(T2, T3);
1689 __ AddImmediate(T2, -kOneByteStringCid);
1690 __ sll(T2, T2, kWordSizeLog2);
1691 __ addu(T2, T2, T1);
1692 __ lw(T0, FieldAddress(T2, JSRegExp::function_offset(kOneByteStringCid)));
1693
1694 // Registers have been set up for the lazy compile stub at this point.
1695 // It expects the function in T0, the argument descriptor in S4, and
1696 // IC-Data in S5.
1697
1698 static const intptr_t arg_count = RegExpMacroAssembler::kParamCount;
1699 __ LoadObject(S4, Array::Handle(ArgumentsDescriptor::New(arg_count)));
1700
1701 // Tail-call the function.
1702 __ lw(T3, FieldAddress(T0, Function::instructions_offset()));
1703 __ AddImmediate(T3, Instructions::HeaderSize() - kHeapObjectTag);
1704 __ jr(T3);
1705 }
1706
1668 // On stack: user tag (+0). 1707 // On stack: user tag (+0).
1669 void Intrinsifier::UserTag_makeCurrent(Assembler* assembler) { 1708 void Intrinsifier::UserTag_makeCurrent(Assembler* assembler) {
1670 // T1: Isolate. 1709 // T1: Isolate.
1671 Isolate* isolate = Isolate::Current(); 1710 Isolate* isolate = Isolate::Current();
1672 __ LoadImmediate(T1, reinterpret_cast<uword>(isolate)); 1711 __ LoadImmediate(T1, reinterpret_cast<uword>(isolate));
1673 // V0: Current user tag. 1712 // V0: Current user tag.
1674 __ lw(V0, Address(T1, Isolate::current_tag_offset())); 1713 __ lw(V0, Address(T1, Isolate::current_tag_offset()));
1675 // T2: UserTag. 1714 // T2: UserTag.
1676 __ lw(T2, Address(SP, + 0 * kWordSize)); 1715 __ lw(T2, Address(SP, + 0 * kWordSize));
1677 // Set Isolate::current_tag_. 1716 // Set Isolate::current_tag_.
(...skipping 22 matching lines...) Expand all
1700 Isolate* isolate = Isolate::Current(); 1739 Isolate* isolate = Isolate::Current();
1701 __ LoadImmediate(V0, reinterpret_cast<uword>(isolate)); 1740 __ LoadImmediate(V0, reinterpret_cast<uword>(isolate));
1702 // Set return value. 1741 // Set return value.
1703 __ Ret(); 1742 __ Ret();
1704 __ delay_slot()->lw(V0, Address(V0, Isolate::current_tag_offset())); 1743 __ delay_slot()->lw(V0, Address(V0, Isolate::current_tag_offset()));
1705 } 1744 }
1706 1745
1707 } // namespace dart 1746 } // namespace dart
1708 1747
1709 #endif // defined TARGET_ARCH_MIPS 1748 #endif // defined TARGET_ARCH_MIPS
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698