OLD | NEW |
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 // This file encapsulates all the interaction with the | 4 // This file encapsulates all the interaction with the |
5 // JSC regular expression library also referred to as pcre | 5 // JSC regular expression library also referred to as pcre |
6 | 6 |
7 #include "lib/regexp_jsc.h" | 7 #include "lib/regexp_jsc.h" |
8 | 8 |
| 9 #include "platform/assert.h" |
9 #include "vm/allocation.h" | 10 #include "vm/allocation.h" |
10 #include "vm/assert.h" | |
11 #include "vm/exceptions.h" | 11 #include "vm/exceptions.h" |
12 #include "vm/globals.h" | 12 #include "vm/globals.h" |
13 #include "vm/isolate.h" | 13 #include "vm/isolate.h" |
14 | |
15 #include "third_party/jscre/pcre.h" | 14 #include "third_party/jscre/pcre.h" |
16 | 15 |
17 namespace dart { | 16 namespace dart { |
18 | 17 |
19 static uint16_t* GetTwoByteData(const String& str) { | 18 static uint16_t* GetTwoByteData(const String& str) { |
20 intptr_t size = str.Length() * sizeof(uint16_t); | 19 intptr_t size = str.Length() * sizeof(uint16_t); |
21 Zone* zone = Isolate::Current()->current_zone(); | 20 Zone* zone = Isolate::Current()->current_zone(); |
22 uint16_t* two_byte_str = reinterpret_cast<uint16_t*>(zone->Allocate(size)); | 21 uint16_t* two_byte_str = reinterpret_cast<uint16_t*>(zone->Allocate(size)); |
23 for (intptr_t i = 0; i < str.Length(); i++) { | 22 for (intptr_t i = 0; i < str.Length(); i++) { |
24 two_byte_str[i] = str.CharAt(i); | 23 two_byte_str[i] = str.CharAt(i); |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 i += kMatchPair) { | 165 i += kMatchPair) { |
167 start = Smi::New(offsets[i]); | 166 start = Smi::New(offsets[i]); |
168 end = Smi::New(offsets[i + 1]); | 167 end = Smi::New(offsets[i + 1]); |
169 array.SetAt(i, start); | 168 array.SetAt(i, start); |
170 array.SetAt(i+1, end); | 169 array.SetAt(i+1, end); |
171 } | 170 } |
172 return array.raw(); | 171 return array.raw(); |
173 } | 172 } |
174 | 173 |
175 } // namespace dart | 174 } // namespace dart |
OLD | NEW |