| OLD | NEW |
| 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 3343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3354 // subject, i.e., 3 + capture count in total. | 3354 // subject, i.e., 3 + capture count in total. |
| 3355 Handle<FixedArray> elements = Factory::NewFixedArray(3 + capture_count); | 3355 Handle<FixedArray> elements = Factory::NewFixedArray(3 + capture_count); |
| 3356 elements->set(0, *Factory::NewSubString(subject, | 3356 elements->set(0, *Factory::NewSubString(subject, |
| 3357 match_start, | 3357 match_start, |
| 3358 match_end)); | 3358 match_end)); |
| 3359 for (int i = 1; i <= capture_count; i++) { | 3359 for (int i = 1; i <= capture_count; i++) { |
| 3360 int start = register_vector[i * 2]; | 3360 int start = register_vector[i * 2]; |
| 3361 if (start >= 0) { | 3361 if (start >= 0) { |
| 3362 int end = register_vector[i * 2 + 1]; | 3362 int end = register_vector[i * 2 + 1]; |
| 3363 ASSERT(start <= end); | 3363 ASSERT(start <= end); |
| 3364 Handle<String> substring = Factory::NewSubString(subject, start, end
); | 3364 Handle<String> substring = Factory::NewSubString(subject, |
| 3365 start, |
| 3366 end); |
| 3365 elements->set(i, *substring); | 3367 elements->set(i, *substring); |
| 3366 } else { | 3368 } else { |
| 3367 ASSERT(register_vector[i * 2 + 1] < 0); | 3369 ASSERT(register_vector[i * 2 + 1] < 0); |
| 3368 elements->set(i, Heap::undefined_value()); | 3370 elements->set(i, Heap::undefined_value()); |
| 3369 } | 3371 } |
| 3370 } | 3372 } |
| 3371 elements->set(capture_count + 1, Smi::FromInt(match_start)); | 3373 elements->set(capture_count + 1, Smi::FromInt(match_start)); |
| 3372 elements->set(capture_count + 2, *subject); | 3374 elements->set(capture_count + 2, *subject); |
| 3373 builder->Add(*Factory::NewJSArrayWithElements(elements)); | 3375 builder->Add(*Factory::NewJSArrayWithElements(elements)); |
| 3374 } | 3376 } |
| (...skipping 6662 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10037 } else { | 10039 } else { |
| 10038 // Handle last resort GC and make sure to allow future allocations | 10040 // Handle last resort GC and make sure to allow future allocations |
| 10039 // to grow the heap without causing GCs (if possible). | 10041 // to grow the heap without causing GCs (if possible). |
| 10040 Counters::gc_last_resort_from_js.Increment(); | 10042 Counters::gc_last_resort_from_js.Increment(); |
| 10041 Heap::CollectAllGarbage(false); | 10043 Heap::CollectAllGarbage(false); |
| 10042 } | 10044 } |
| 10043 } | 10045 } |
| 10044 | 10046 |
| 10045 | 10047 |
| 10046 } } // namespace v8::internal | 10048 } } // namespace v8::internal |
| OLD | NEW |