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

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

Issue 683433003: Integrate the Irregexp Regular Expression Engine. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: rebase, enable tests, remove *CodeUnitsAt Created 6 years, 1 month 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 2013 matching lines...) Expand 10 before | Expand all | Expand 10 after
2045 void Intrinsifier::OneByteString_equality(Assembler* assembler) { 2046 void Intrinsifier::OneByteString_equality(Assembler* assembler) {
2046 StringEquality(assembler, kOneByteStringCid); 2047 StringEquality(assembler, kOneByteStringCid);
2047 } 2048 }
2048 2049
2049 2050
2050 void Intrinsifier::TwoByteString_equality(Assembler* assembler) { 2051 void Intrinsifier::TwoByteString_equality(Assembler* assembler) {
2051 StringEquality(assembler, kTwoByteStringCid); 2052 StringEquality(assembler, kTwoByteStringCid);
2052 } 2053 }
2053 2054
2054 2055
2056 #ifndef USE_JSCRE
2057 void Intrinsifier::JSRegExp_ExecuteMatch(Assembler* assembler) {
2058 static const intptr_t kRegExpParamOffset = + 3 * kWordSize;
2059 static const intptr_t kStringParamOffset = + 2 * kWordSize;
2060 // const Smi& start_index is located at (+ 1 * kWordSize).
2061
2062 // Register assignments are as follows:
2063 // EAX: The appropriate specialized matcher function.
2064 // EBX: The regexp object.
2065 // EDI: Temp, Pointer to the function's code which we then tail-call.
2066
2067 __ movl(EBX, Address(ESP, kRegExpParamOffset));
2068 __ movl(EDI, Address(ESP, kStringParamOffset));
2069
2070
2071 // Load the specialized function pointer into EAX. Leverage the fact the
2072 // string CIDs as well as stored function pointers are in sequence.
2073
2074 __ LoadClassId(EDI, EDI);
2075 __ SubImmediate(EDI, Immediate(kOneByteStringCid));
2076 __ movl(EAX, FieldAddress(EBX, EDI, TIMES_4,
2077 JSRegExp::function_offset(kOneByteStringCid)));
2078
2079 // Registers have been set up for the lazy compile stub at this point.
2080 // It expects the function in EAX, the argument descriptor in EDX, and
2081 // IC-Data in ECX. Explicitly null out IC-Data to ensure its validity.
2082
2083 static const intptr_t arg_count = RegExpMacroAssembler::kParamCount;
2084 __ LoadObject(EDX, Array::Handle(ArgumentsDescriptor::New(arg_count)));
2085 __ xorl(ECX, ECX);
2086
2087 // Tail-call the function.
2088 __ movl(EDI, FieldAddress(EAX, Function::instructions_offset()));
2089 __ addl(EDI, Immediate(Instructions::HeaderSize() - kHeapObjectTag));
2090 __ jmp(EDI);
2091 }
2092 #endif
2093
2094
2055 // On stack: user tag (+1), return-address (+0). 2095 // On stack: user tag (+1), return-address (+0).
2056 void Intrinsifier::UserTag_makeCurrent(Assembler* assembler) { 2096 void Intrinsifier::UserTag_makeCurrent(Assembler* assembler) {
2057 Isolate* isolate = Isolate::Current(); 2097 Isolate* isolate = Isolate::Current();
2058 const Address current_tag_addr = 2098 const Address current_tag_addr =
2059 Address::Absolute(reinterpret_cast<uword>(isolate) + 2099 Address::Absolute(reinterpret_cast<uword>(isolate) +
2060 Isolate::current_tag_offset()); 2100 Isolate::current_tag_offset());
2061 const Address user_tag_addr = 2101 const Address user_tag_addr =
2062 Address::Absolute(reinterpret_cast<uword>(isolate) + 2102 Address::Absolute(reinterpret_cast<uword>(isolate) +
2063 Isolate::user_tag_offset()); 2103 Isolate::user_tag_offset());
2064 // EAX: Current user tag. 2104 // EAX: Current user tag.
(...skipping 28 matching lines...) Expand all
2093 Isolate::current_tag_offset()); 2133 Isolate::current_tag_offset());
2094 // Set return value to Isolate::current_tag_. 2134 // Set return value to Isolate::current_tag_.
2095 __ movl(EAX, current_tag_addr); 2135 __ movl(EAX, current_tag_addr);
2096 __ ret(); 2136 __ ret();
2097 } 2137 }
2098 2138
2099 #undef __ 2139 #undef __
2100 } // namespace dart 2140 } // namespace dart
2101 2141
2102 #endif // defined TARGET_ARCH_IA32 2142 #endif // defined TARGET_ARCH_IA32
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698