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 1385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1396 reinterpret_cast<HeapObject*>(new_array_alloc)->set_map(regexp_result_map); | 1396 reinterpret_cast<HeapObject*>(new_array_alloc)->set_map(regexp_result_map); |
1397 | 1397 |
1398 JSArray* new_array = JSArray::cast(new_array_alloc); | 1398 JSArray* new_array = JSArray::cast(new_array_alloc); |
1399 | 1399 |
1400 // Copy JSObject properties. | 1400 // Copy JSObject properties. |
1401 new_array->set_properties(result->properties()); // Empty FixedArray. | 1401 new_array->set_properties(result->properties()); // Empty FixedArray. |
1402 | 1402 |
1403 // Copy JSObject elements as copy-on-write. | 1403 // Copy JSObject elements as copy-on-write. |
1404 FixedArray* elements = FixedArray::cast(result->elements()); | 1404 FixedArray* elements = FixedArray::cast(result->elements()); |
1405 if (elements != Heap::empty_fixed_array()) { | 1405 if (elements != Heap::empty_fixed_array()) { |
1406 ASSERT(!Heap::InNewSpace(Heap::fixed_cow_array_map())); | |
1407 // No write barrier is necessary when writing old-space pointer. | |
1408 elements->set_map(Heap::fixed_cow_array_map()); | 1406 elements->set_map(Heap::fixed_cow_array_map()); |
1409 } | 1407 } |
1410 new_array->set_elements(elements); | 1408 new_array->set_elements(elements); |
1411 | 1409 |
1412 // Copy JSArray length. | 1410 // Copy JSArray length. |
1413 new_array->set_length(result->length()); | 1411 new_array->set_length(result->length()); |
1414 | 1412 |
1415 // Copy JSRegExpResult in-object property fields input and index. | 1413 // Copy JSRegExpResult in-object property fields input and index. |
1416 new_array->FastPropertyAtPut(JSRegExpResult::kIndexIndex, | 1414 new_array->FastPropertyAtPut(JSRegExpResult::kIndexIndex, |
1417 result->FastPropertyAt( | 1415 result->FastPropertyAt( |
(...skipping 9291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10709 } else { | 10707 } else { |
10710 // Handle last resort GC and make sure to allow future allocations | 10708 // Handle last resort GC and make sure to allow future allocations |
10711 // to grow the heap without causing GCs (if possible). | 10709 // to grow the heap without causing GCs (if possible). |
10712 Counters::gc_last_resort_from_js.Increment(); | 10710 Counters::gc_last_resort_from_js.Increment(); |
10713 Heap::CollectAllGarbage(false); | 10711 Heap::CollectAllGarbage(false); |
10714 } | 10712 } |
10715 } | 10713 } |
10716 | 10714 |
10717 | 10715 |
10718 } } // namespace v8::internal | 10716 } } // namespace v8::internal |
OLD | NEW |