Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/v8.h" | 5 #include "src/v8.h" |
| 6 | 6 |
| 7 #include "src/base/atomicops.h" | 7 #include "src/base/atomicops.h" |
| 8 #include "src/base/bits.h" | 8 #include "src/base/bits.h" |
| 9 #include "src/code-stubs.h" | 9 #include "src/code-stubs.h" |
| 10 #include "src/compilation-cache.h" | 10 #include "src/compilation-cache.h" |
| (...skipping 1331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1342 // Make sure that the fixed array is in fact initialized on the RegExp. | 1342 // Make sure that the fixed array is in fact initialized on the RegExp. |
| 1343 // We could potentially trigger a GC when initializing the RegExp. | 1343 // We could potentially trigger a GC when initializing the RegExp. |
| 1344 if (HeapObject::cast(re->data())->map()->instance_type() != | 1344 if (HeapObject::cast(re->data())->map()->instance_type() != |
| 1345 FIXED_ARRAY_TYPE) | 1345 FIXED_ARRAY_TYPE) |
| 1346 return; | 1346 return; |
| 1347 | 1347 |
| 1348 // Make sure this is a RegExp that actually contains code. | 1348 // Make sure this is a RegExp that actually contains code. |
| 1349 if (re->TypeTag() != JSRegExp::IRREGEXP) return; | 1349 if (re->TypeTag() != JSRegExp::IRREGEXP) return; |
| 1350 | 1350 |
| 1351 Object* code = re->DataAt(JSRegExp::code_index(is_one_byte)); | 1351 Object* code = re->DataAt(JSRegExp::code_index(is_one_byte)); |
| 1352 if (!code->IsSmi() && | 1352 if (heap->flush_eagerly()) { |
| 1353 HeapObject::cast(code)->map()->instance_type() == CODE_TYPE) { | 1353 re->SetDataAt(JSRegExp::code_index(is_one_byte), |
| 1354 Smi::FromInt(JSRegExp::kUninitializedValue)); | |
| 1355 re->SetDataAt(JSRegExp::saved_code_index(is_one_byte), | |
| 1356 Smi::FromInt(JSRegExp::kUninitializedValue)); | |
|
rmcilroy
2014/10/24 11:46:07
Could you split this out so that it's shared with
| |
| 1357 } else if (!code->IsSmi() && | |
| 1358 HeapObject::cast(code)->map()->instance_type() == CODE_TYPE) { | |
| 1354 // Save a copy that can be reinstated if we need the code again. | 1359 // Save a copy that can be reinstated if we need the code again. |
| 1355 re->SetDataAt(JSRegExp::saved_code_index(is_one_byte), code); | 1360 re->SetDataAt(JSRegExp::saved_code_index(is_one_byte), code); |
| 1356 | 1361 |
| 1357 // Saving a copy might create a pointer into compaction candidate | 1362 // Saving a copy might create a pointer into compaction candidate |
| 1358 // that was not observed by marker. This might happen if JSRegExp data | 1363 // that was not observed by marker. This might happen if JSRegExp data |
| 1359 // was marked through the compilation cache before marker reached JSRegExp | 1364 // was marked through the compilation cache before marker reached JSRegExp |
| 1360 // object. | 1365 // object. |
| 1361 FixedArray* data = FixedArray::cast(re->data()); | 1366 FixedArray* data = FixedArray::cast(re->data()); |
| 1362 Object** slot = | 1367 Object** slot = |
| 1363 data->data_start() + JSRegExp::saved_code_index(is_one_byte); | 1368 data->data_start() + JSRegExp::saved_code_index(is_one_byte); |
| (...skipping 3088 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4452 SlotsBuffer* buffer = *buffer_address; | 4457 SlotsBuffer* buffer = *buffer_address; |
| 4453 while (buffer != NULL) { | 4458 while (buffer != NULL) { |
| 4454 SlotsBuffer* next_buffer = buffer->next(); | 4459 SlotsBuffer* next_buffer = buffer->next(); |
| 4455 DeallocateBuffer(buffer); | 4460 DeallocateBuffer(buffer); |
| 4456 buffer = next_buffer; | 4461 buffer = next_buffer; |
| 4457 } | 4462 } |
| 4458 *buffer_address = NULL; | 4463 *buffer_address = NULL; |
| 4459 } | 4464 } |
| 4460 } | 4465 } |
| 4461 } // namespace v8::internal | 4466 } // namespace v8::internal |
| OLD | NEW |