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

Side by Side Diff: src/runtime.cc

Issue 3167021: Use consistent types when calling RegExpImpl::IrregexpExecOnce (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 10 years, 4 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
« no previous file with comments | « src/jsregexp.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2006-2009 the V8 project authors. All rights reserved. 1 // Copyright 2006-2009 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 3506 matching lines...) Expand 10 before | Expand all | Expand 10 after
3517 Handle<JSArray> last_match_array, 3517 Handle<JSArray> last_match_array,
3518 FixedArrayBuilder* builder) { 3518 FixedArrayBuilder* builder) {
3519 ASSERT(subject->IsFlat()); 3519 ASSERT(subject->IsFlat());
3520 int match_start = -1; 3520 int match_start = -1;
3521 int match_end = 0; 3521 int match_end = 0;
3522 int pos = 0; 3522 int pos = 0;
3523 int required_registers = RegExpImpl::IrregexpPrepare(regexp, subject); 3523 int required_registers = RegExpImpl::IrregexpPrepare(regexp, subject);
3524 if (required_registers < 0) return RegExpImpl::RE_EXCEPTION; 3524 if (required_registers < 0) return RegExpImpl::RE_EXCEPTION;
3525 3525
3526 OffsetsVector registers(required_registers); 3526 OffsetsVector registers(required_registers);
3527 Vector<int> register_vector(registers.vector(), registers.length()); 3527 Vector<int32_t> register_vector(registers.vector(), registers.length());
3528 int subject_length = subject->length(); 3528 int subject_length = subject->length();
3529 3529
3530 for (;;) { // Break on failure, return on exception. 3530 for (;;) { // Break on failure, return on exception.
3531 RegExpImpl::IrregexpResult result = 3531 RegExpImpl::IrregexpResult result =
3532 RegExpImpl::IrregexpExecOnce(regexp, 3532 RegExpImpl::IrregexpExecOnce(regexp,
3533 subject, 3533 subject,
3534 pos, 3534 pos,
3535 register_vector); 3535 register_vector);
3536 if (result == RegExpImpl::RE_SUCCESS) { 3536 if (result == RegExpImpl::RE_SUCCESS) {
3537 match_start = register_vector[0]; 3537 match_start = register_vector[0];
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
3579 Handle<String> subject, 3579 Handle<String> subject,
3580 Handle<JSRegExp> regexp, 3580 Handle<JSRegExp> regexp,
3581 Handle<JSArray> last_match_array, 3581 Handle<JSArray> last_match_array,
3582 FixedArrayBuilder* builder) { 3582 FixedArrayBuilder* builder) {
3583 3583
3584 ASSERT(subject->IsFlat()); 3584 ASSERT(subject->IsFlat());
3585 int required_registers = RegExpImpl::IrregexpPrepare(regexp, subject); 3585 int required_registers = RegExpImpl::IrregexpPrepare(regexp, subject);
3586 if (required_registers < 0) return RegExpImpl::RE_EXCEPTION; 3586 if (required_registers < 0) return RegExpImpl::RE_EXCEPTION;
3587 3587
3588 OffsetsVector registers(required_registers); 3588 OffsetsVector registers(required_registers);
3589 Vector<int> register_vector(registers.vector(), registers.length()); 3589 Vector<int32_t> register_vector(registers.vector(), registers.length());
3590 3590
3591 RegExpImpl::IrregexpResult result = 3591 RegExpImpl::IrregexpResult result =
3592 RegExpImpl::IrregexpExecOnce(regexp, 3592 RegExpImpl::IrregexpExecOnce(regexp,
3593 subject, 3593 subject,
3594 0, 3594 0,
3595 register_vector); 3595 register_vector);
3596 3596
3597 int capture_count = regexp->CaptureCount(); 3597 int capture_count = regexp->CaptureCount();
3598 int subject_length = subject->length(); 3598 int subject_length = subject->length();
3599 3599
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
3639 ASSERT(register_vector[i * 2 + 1] < 0); 3639 ASSERT(register_vector[i * 2 + 1] < 0);
3640 elements->set(i, Heap::undefined_value()); 3640 elements->set(i, Heap::undefined_value());
3641 } 3641 }
3642 } 3642 }
3643 elements->set(capture_count + 1, Smi::FromInt(match_start)); 3643 elements->set(capture_count + 1, Smi::FromInt(match_start));
3644 elements->set(capture_count + 2, *subject); 3644 elements->set(capture_count + 2, *subject);
3645 builder->Add(*Factory::NewJSArrayWithElements(elements)); 3645 builder->Add(*Factory::NewJSArrayWithElements(elements));
3646 } 3646 }
3647 // Swap register vectors, so the last successful match is in 3647 // Swap register vectors, so the last successful match is in
3648 // prev_register_vector. 3648 // prev_register_vector.
3649 Vector<int> tmp = prev_register_vector; 3649 Vector<int32_t> tmp = prev_register_vector;
3650 prev_register_vector = register_vector; 3650 prev_register_vector = register_vector;
3651 register_vector = tmp; 3651 register_vector = tmp;
3652 3652
3653 if (match_end > match_start) { 3653 if (match_end > match_start) {
3654 pos = match_end; 3654 pos = match_end;
3655 } else { 3655 } else {
3656 pos = match_end + 1; 3656 pos = match_end + 1;
3657 if (pos > subject_length) { 3657 if (pos > subject_length) {
3658 break; 3658 break;
3659 } 3659 }
(...skipping 6990 matching lines...) Expand 10 before | Expand all | Expand 10 after
10650 } else { 10650 } else {
10651 // Handle last resort GC and make sure to allow future allocations 10651 // Handle last resort GC and make sure to allow future allocations
10652 // to grow the heap without causing GCs (if possible). 10652 // to grow the heap without causing GCs (if possible).
10653 Counters::gc_last_resort_from_js.Increment(); 10653 Counters::gc_last_resort_from_js.Increment();
10654 Heap::CollectAllGarbage(false); 10654 Heap::CollectAllGarbage(false);
10655 } 10655 }
10656 } 10656 }
10657 10657
10658 10658
10659 } } // namespace v8::internal 10659 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/jsregexp.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698