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

Side by Side Diff: runtime/vm/intrinsifier_x64.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: Explicitly null IC-Data, whitespace fixes in tests. 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_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
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 void Intrinsifier::JSRegExp_ExecuteMatch(Assembler* assembler) {
1541 static const intptr_t kRegExpParamOffset = + 3 * kWordSize;
1542 static const intptr_t kStringParamOffset = + 2 * kWordSize;
1543 // const Smi& start_index is located at (+ 1 * kWordSize).
1544
1545 // Register assignments are as follows:
1546 // RAX: The appropriate specialized matcher function.
1547 // RBX: The regexp object.
1548 // RDI: Temp, Pointer to the function's code which we then tail-call.
1549
1550 __ movq(RBX, Address(RSP, kRegExpParamOffset));
1551 __ movq(RDI, Address(RSP, kStringParamOffset));
1552
1553 // Load the specialized function pointer into RAX. Leverage the fact the
1554 // string CIDs as well as stored function pointers are in sequence.
1555
1556 __ LoadClassId(RDI, RDI);
1557 __ SubImmediate(RDI, Immediate(kOneByteStringCid), PP);
1558 __ movq(RAX, FieldAddress(RBX, RDI, TIMES_8,
1559 JSRegExp::function_offset(kOneByteStringCid)));
1560
1561 // Registers have been set up for the lazy compile stub at this point.
1562 // It expects the function in RAX, the argument descriptor in R10, and
1563 // IC-Data in RCX. Explicitly null out IC-Data to ensure its validity.
1564
1565 static const intptr_t arg_count = RegExpMacroAssembler::kParamCount;
1566 __ LoadObject(R10, Array::Handle(ArgumentsDescriptor::New(arg_count)), PP);
1567 __ movq(RCX, Immediate(reinterpret_cast<intptr_t>(Object::null())));
1568
1569 // Tail-call the function.
1570 __ movq(RDI, FieldAddress(RAX, Function::instructions_offset()));
1571 __ addq(RDI, Immediate(Instructions::HeaderSize() - kHeapObjectTag));
1572 __ jmp(RDI);
1573 }
1574
1575
1538 // On stack: user tag (+1), return-address (+0). 1576 // On stack: user tag (+1), return-address (+0).
1539 void Intrinsifier::UserTag_makeCurrent(Assembler* assembler) { 1577 void Intrinsifier::UserTag_makeCurrent(Assembler* assembler) {
1540 // RBX: Isolate. 1578 // RBX: Isolate.
1541 Isolate* isolate = Isolate::Current(); 1579 Isolate* isolate = Isolate::Current();
1542 const Immediate& isolate_address = 1580 const Immediate& isolate_address =
1543 Immediate(reinterpret_cast<int64_t>(isolate)); 1581 Immediate(reinterpret_cast<int64_t>(isolate));
1544 __ movq(RBX, isolate_address); 1582 __ movq(RBX, isolate_address);
1545 // RAX: Current user tag. 1583 // RAX: Current user tag.
1546 __ movq(RAX, Address(RBX, Isolate::current_tag_offset())); 1584 __ movq(RAX, Address(RBX, Isolate::current_tag_offset()));
1547 // R10: UserTag. 1585 // R10: UserTag.
(...skipping 30 matching lines...) Expand all
1578 // Set return value to Isolate::current_tag_. 1616 // Set return value to Isolate::current_tag_.
1579 __ movq(RAX, Address(RBX, Isolate::current_tag_offset())); 1617 __ movq(RAX, Address(RBX, Isolate::current_tag_offset()));
1580 __ ret(); 1618 __ ret();
1581 } 1619 }
1582 1620
1583 #undef __ 1621 #undef __
1584 1622
1585 } // namespace dart 1623 } // namespace dart
1586 1624
1587 #endif // defined TARGET_ARCH_X64 1625 #endif // defined TARGET_ARCH_X64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698