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/heap/mark-compact.h" | 5 #include "src/heap/mark-compact.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 1319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1330 // that was not observed by marker. This might happen if JSRegExp data | 1330 // that was not observed by marker. This might happen if JSRegExp data |
1331 // was marked through the compilation cache before marker reached JSRegExp | 1331 // was marked through the compilation cache before marker reached JSRegExp |
1332 // object. | 1332 // object. |
1333 FixedArray* data = FixedArray::cast(re->data()); | 1333 FixedArray* data = FixedArray::cast(re->data()); |
1334 Object** slot = | 1334 Object** slot = |
1335 data->data_start() + JSRegExp::saved_code_index(is_one_byte); | 1335 data->data_start() + JSRegExp::saved_code_index(is_one_byte); |
1336 heap->mark_compact_collector()->RecordSlot(data, slot, code); | 1336 heap->mark_compact_collector()->RecordSlot(data, slot, code); |
1337 | 1337 |
1338 // Set a number in the 0-255 range to guarantee no smi overflow. | 1338 // Set a number in the 0-255 range to guarantee no smi overflow. |
1339 re->SetDataAt(JSRegExp::code_index(is_one_byte), | 1339 re->SetDataAt(JSRegExp::code_index(is_one_byte), |
1340 Smi::FromInt(heap->sweep_generation() & 0xff)); | 1340 Smi::FromInt(heap->ms_count() & 0xff)); |
1341 } else if (code->IsSmi()) { | 1341 } else if (code->IsSmi()) { |
1342 int value = Smi::cast(code)->value(); | 1342 int value = Smi::cast(code)->value(); |
1343 // The regexp has not been compiled yet or there was a compilation error. | 1343 // The regexp has not been compiled yet or there was a compilation error. |
1344 if (value == JSRegExp::kUninitializedValue || | 1344 if (value == JSRegExp::kUninitializedValue || |
1345 value == JSRegExp::kCompilationErrorValue) { | 1345 value == JSRegExp::kCompilationErrorValue) { |
1346 return; | 1346 return; |
1347 } | 1347 } |
1348 | 1348 |
1349 // Check if we should flush now. | 1349 // Check if we should flush now. |
1350 if (value == ((heap->sweep_generation() - kRegExpCodeThreshold) & 0xff)) { | 1350 if (value == ((heap->ms_count() - kRegExpCodeThreshold) & 0xff)) { |
1351 re->SetDataAt(JSRegExp::code_index(is_one_byte), | 1351 re->SetDataAt(JSRegExp::code_index(is_one_byte), |
1352 Smi::FromInt(JSRegExp::kUninitializedValue)); | 1352 Smi::FromInt(JSRegExp::kUninitializedValue)); |
1353 re->SetDataAt(JSRegExp::saved_code_index(is_one_byte), | 1353 re->SetDataAt(JSRegExp::saved_code_index(is_one_byte), |
1354 Smi::FromInt(JSRegExp::kUninitializedValue)); | 1354 Smi::FromInt(JSRegExp::kUninitializedValue)); |
1355 } | 1355 } |
1356 } | 1356 } |
1357 } | 1357 } |
1358 | 1358 |
1359 | 1359 |
1360 // Works by setting the current sweep_generation (as a smi) in the | 1360 // Works by setting the current sweep_generation (as a smi) in the |
(...skipping 3352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4713 SlotsBuffer* buffer = *buffer_address; | 4713 SlotsBuffer* buffer = *buffer_address; |
4714 while (buffer != NULL) { | 4714 while (buffer != NULL) { |
4715 SlotsBuffer* next_buffer = buffer->next(); | 4715 SlotsBuffer* next_buffer = buffer->next(); |
4716 DeallocateBuffer(buffer); | 4716 DeallocateBuffer(buffer); |
4717 buffer = next_buffer; | 4717 buffer = next_buffer; |
4718 } | 4718 } |
4719 *buffer_address = NULL; | 4719 *buffer_address = NULL; |
4720 } | 4720 } |
4721 } // namespace internal | 4721 } // namespace internal |
4722 } // namespace v8 | 4722 } // namespace v8 |
OLD | NEW |