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

Side by Side Diff: runtime/vm/intrinsifier_ia32.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: Missed a TODO. 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 // The intrinsic code below is executed before a method has built its frame. 5 // The intrinsic code below is executed before a method has built its frame.
6 // The return address is on the stack and the arguments below it. 6 // The return address is on the stack and the arguments below it.
7 // Registers EDX (arguments descriptor) and ECX (function) must be preserved. 7 // Registers EDX (arguments descriptor) and ECX (function) must be preserved.
8 // Each intrinsification method returns true if the corresponding 8 // Each intrinsification method returns true if the corresponding
9 // Dart method was intrinsified. 9 // Dart method was intrinsified.
10 10
11 #include "vm/globals.h" // Needed here to get TARGET_ARCH_IA32. 11 #include "vm/globals.h" // Needed here to get TARGET_ARCH_IA32.
12 #if defined(TARGET_ARCH_IA32) 12 #if defined(TARGET_ARCH_IA32)
13 13
14 #include "vm/intrinsifier.h" 14 #include "vm/intrinsifier.h"
15 15
16 #include "vm/assembler.h" 16 #include "vm/assembler.h"
17 #include "vm/dart_entry.h"
17 #include "vm/flow_graph_compiler.h" 18 #include "vm/flow_graph_compiler.h"
18 #include "vm/object.h" 19 #include "vm/object.h"
19 #include "vm/object_store.h" 20 #include "vm/object_store.h"
20 #include "vm/os.h" 21 #include "vm/os.h"
21 #include "vm/stub_code.h" 22 #include "vm/regexp_assembler.h"
22 #include "vm/symbols.h" 23 #include "vm/symbols.h"
23 24
24 namespace dart { 25 namespace dart {
25 26
26 DECLARE_FLAG(bool, enable_type_checks); 27 DECLARE_FLAG(bool, enable_type_checks);
27 28
28 29
29 #define __ assembler-> 30 #define __ assembler->
30 31
31 32
(...skipping 2024 matching lines...) Expand 10 before | Expand all | Expand 10 after
2056 void Intrinsifier::OneByteString_equality(Assembler* assembler) { 2057 void Intrinsifier::OneByteString_equality(Assembler* assembler) {
2057 StringEquality(assembler, kOneByteStringCid); 2058 StringEquality(assembler, kOneByteStringCid);
2058 } 2059 }
2059 2060
2060 2061
2061 void Intrinsifier::TwoByteString_equality(Assembler* assembler) { 2062 void Intrinsifier::TwoByteString_equality(Assembler* assembler) {
2062 StringEquality(assembler, kTwoByteStringCid); 2063 StringEquality(assembler, kTwoByteStringCid);
2063 } 2064 }
2064 2065
2065 2066
2067 #ifndef USE_JSCRE
2068 void Intrinsifier::JSRegExp_ExecuteMatch(Assembler* assembler) {
2069 static const intptr_t kRegExpParamOffset = + 3 * kWordSize;
2070 static const intptr_t kStringParamOffset = + 2 * kWordSize;
2071 // const Smi& start_index is located at (+ 1 * kWordSize).
2072
2073 // Register assignments are as follows:
2074 // EAX: The appropriate specialized matcher function.
2075 // EBX: The regexp object.
2076 // EDI: Temp, Pointer to the function's code which we then tail-call.
2077
2078 __ movl(EBX, Address(ESP, kRegExpParamOffset));
2079 __ movl(EDI, Address(ESP, kStringParamOffset));
2080
2081
2082 // Load the specialized function pointer into EAX. Leverage the fact the
2083 // string CIDs as well as stored function pointers are in sequence.
2084
2085 __ LoadClassId(EDI, EDI);
2086 __ SubImmediate(EDI, Immediate(kOneByteStringCid));
2087 __ movl(EAX, FieldAddress(EBX, EDI, TIMES_4,
2088 JSRegExp::function_offset(kOneByteStringCid)));
2089
2090 // Registers have been set up for the lazy compile stub at this point.
2091 // It expects the function in EAX, the argument descriptor in EDX, and
2092 // IC-Data in ECX. Explicitly null out IC-Data to ensure its validity.
2093
2094 static const intptr_t arg_count = RegExpMacroAssembler::kParamCount;
2095 __ LoadObject(EDX, Array::Handle(ArgumentsDescriptor::New(arg_count)));
2096 __ xorl(ECX, ECX);
2097
2098 // Tail-call the function.
2099 __ movl(EDI, FieldAddress(EAX, Function::instructions_offset()));
2100 __ addl(EDI, Immediate(Instructions::HeaderSize() - kHeapObjectTag));
2101 __ jmp(EDI);
2102 }
2103 #endif
2104
2105
2066 // On stack: user tag (+1), return-address (+0). 2106 // On stack: user tag (+1), return-address (+0).
2067 void Intrinsifier::UserTag_makeCurrent(Assembler* assembler) { 2107 void Intrinsifier::UserTag_makeCurrent(Assembler* assembler) {
2068 Isolate* isolate = Isolate::Current(); 2108 Isolate* isolate = Isolate::Current();
2069 const Address current_tag_addr = 2109 const Address current_tag_addr =
2070 Address::Absolute(reinterpret_cast<uword>(isolate) + 2110 Address::Absolute(reinterpret_cast<uword>(isolate) +
2071 Isolate::current_tag_offset()); 2111 Isolate::current_tag_offset());
2072 const Address user_tag_addr = 2112 const Address user_tag_addr =
2073 Address::Absolute(reinterpret_cast<uword>(isolate) + 2113 Address::Absolute(reinterpret_cast<uword>(isolate) +
2074 Isolate::user_tag_offset()); 2114 Isolate::user_tag_offset());
2075 // EAX: Current user tag. 2115 // EAX: Current user tag.
(...skipping 28 matching lines...) Expand all
2104 Isolate::current_tag_offset()); 2144 Isolate::current_tag_offset());
2105 // Set return value to Isolate::current_tag_. 2145 // Set return value to Isolate::current_tag_.
2106 __ movl(EAX, current_tag_addr); 2146 __ movl(EAX, current_tag_addr);
2107 __ ret(); 2147 __ ret();
2108 } 2148 }
2109 2149
2110 #undef __ 2150 #undef __
2111 } // namespace dart 2151 } // namespace dart
2112 2152
2113 #endif // defined TARGET_ARCH_IA32 2153 #endif // defined TARGET_ARCH_IA32
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698