OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
263 pattern, | 263 pattern, |
264 flags, | 264 flags, |
265 match_pattern); | 265 match_pattern); |
266 } | 266 } |
267 | 267 |
268 | 268 |
269 static void SetAtomLastCapture(FixedArray* array, | 269 static void SetAtomLastCapture(FixedArray* array, |
270 String* subject, | 270 String* subject, |
271 int from, | 271 int from, |
272 int to) { | 272 int to) { |
273 NoHandleAllocation no_handles; | 273 NoHandleAllocation no_handles(array->GetIsolate()); |
274 RegExpImpl::SetLastCaptureCount(array, 2); | 274 RegExpImpl::SetLastCaptureCount(array, 2); |
275 RegExpImpl::SetLastSubject(array, subject); | 275 RegExpImpl::SetLastSubject(array, subject); |
276 RegExpImpl::SetLastInput(array, subject); | 276 RegExpImpl::SetLastInput(array, subject); |
277 RegExpImpl::SetCapture(array, 0, from); | 277 RegExpImpl::SetCapture(array, 0, from); |
278 RegExpImpl::SetCapture(array, 1, to); | 278 RegExpImpl::SetCapture(array, 1, to); |
279 } | 279 } |
280 | 280 |
281 | 281 |
282 int RegExpImpl::AtomExecRaw(Handle<JSRegExp> regexp, | 282 int RegExpImpl::AtomExecRaw(Handle<JSRegExp> regexp, |
283 Handle<String> subject, | 283 Handle<String> subject, |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
346 | 346 |
347 static const int kNumRegisters = 2; | 347 static const int kNumRegisters = 2; |
348 STATIC_ASSERT(kNumRegisters <= Isolate::kJSRegexpStaticOffsetsVectorSize); | 348 STATIC_ASSERT(kNumRegisters <= Isolate::kJSRegexpStaticOffsetsVectorSize); |
349 int32_t* output_registers = isolate->jsregexp_static_offsets_vector(); | 349 int32_t* output_registers = isolate->jsregexp_static_offsets_vector(); |
350 | 350 |
351 int res = AtomExecRaw(re, subject, index, output_registers, kNumRegisters); | 351 int res = AtomExecRaw(re, subject, index, output_registers, kNumRegisters); |
352 | 352 |
353 if (res == RegExpImpl::RE_FAILURE) return isolate->factory()->null_value(); | 353 if (res == RegExpImpl::RE_FAILURE) return isolate->factory()->null_value(); |
354 | 354 |
355 ASSERT_EQ(res, RegExpImpl::RE_SUCCESS); | 355 ASSERT_EQ(res, RegExpImpl::RE_SUCCESS); |
356 NoHandleAllocation no_handles; | 356 NoHandleAllocation no_handles(isolate); |
357 FixedArray* array = FixedArray::cast(last_match_info->elements()); | 357 FixedArray* array = FixedArray::cast(last_match_info->elements()); |
358 SetAtomLastCapture(array, *subject, output_registers[0], output_registers[1]); | 358 SetAtomLastCapture(array, *subject, output_registers[0], output_registers[1]); |
359 return last_match_info; | 359 return last_match_info; |
360 } | 360 } |
361 | 361 |
362 | 362 |
363 // Irregexp implementation. | 363 // Irregexp implementation. |
364 | 364 |
365 // Ensures that the regexp object contains a compiled version of the | 365 // Ensures that the regexp object contains a compiled version of the |
366 // source for either ASCII or non-ASCII strings. | 366 // source for either ASCII or non-ASCII strings. |
(...skipping 5782 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6149 } | 6149 } |
6150 | 6150 |
6151 return compiler.Assemble(¯o_assembler, | 6151 return compiler.Assemble(¯o_assembler, |
6152 node, | 6152 node, |
6153 data->capture_count, | 6153 data->capture_count, |
6154 pattern); | 6154 pattern); |
6155 } | 6155 } |
6156 | 6156 |
6157 | 6157 |
6158 }} // namespace v8::internal | 6158 }} // namespace v8::internal |
OLD | NEW |