| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 1230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1241 if (!shared_info->allows_lazy_compilation()) { | 1241 if (!shared_info->allows_lazy_compilation()) { |
| 1242 return false; | 1242 return false; |
| 1243 } | 1243 } |
| 1244 | 1244 |
| 1245 // If this is a full script wrapped in a function we do no flush the code. | 1245 // If this is a full script wrapped in a function we do no flush the code. |
| 1246 if (shared_info->is_toplevel()) { | 1246 if (shared_info->is_toplevel()) { |
| 1247 return false; | 1247 return false; |
| 1248 } | 1248 } |
| 1249 | 1249 |
| 1250 // Age this shared function info. | 1250 // Age this shared function info. |
| 1251 if (shared_info->code_age() < kCodeAgeThreshold) { | 1251 if (!heap->flush_eagerly() && |
| 1252 shared_info->code_age() < kCodeAgeThreshold) { |
| 1252 shared_info->set_code_age(shared_info->code_age() + 1); | 1253 shared_info->set_code_age(shared_info->code_age() + 1); |
| 1253 return false; | 1254 return false; |
| 1254 } | 1255 } |
| 1255 | 1256 |
| 1256 return true; | 1257 return true; |
| 1257 } | 1258 } |
| 1258 | 1259 |
| 1259 | 1260 |
| 1260 static bool FlushCodeForFunction(Heap* heap, JSFunction* function) { | 1261 static bool FlushCodeForFunction(Heap* heap, JSFunction* function) { |
| 1261 if (!IsFlushable(heap, function)) return false; | 1262 if (!IsFlushable(heap, function)) return false; |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1318 heap); | 1319 heap); |
| 1319 } else if (code->IsSmi()) { | 1320 } else if (code->IsSmi()) { |
| 1320 int value = Smi::cast(code)->value(); | 1321 int value = Smi::cast(code)->value(); |
| 1321 // The regexp has not been compiled yet or there was a compilation error. | 1322 // The regexp has not been compiled yet or there was a compilation error. |
| 1322 if (value == JSRegExp::kUninitializedValue || | 1323 if (value == JSRegExp::kUninitializedValue || |
| 1323 value == JSRegExp::kCompilationErrorValue) { | 1324 value == JSRegExp::kCompilationErrorValue) { |
| 1324 return; | 1325 return; |
| 1325 } | 1326 } |
| 1326 | 1327 |
| 1327 // Check if we should flush now. | 1328 // Check if we should flush now. |
| 1328 if (value == ((heap->sweep_generation() - kRegExpCodeThreshold) & 0xff)) { | 1329 if (heap->flush_eagerly() || |
| 1330 value == ((heap->sweep_generation() - kRegExpCodeThreshold) & 0xff)) { |
| 1329 re->SetDataAtUnchecked(JSRegExp::code_index(is_ascii), | 1331 re->SetDataAtUnchecked(JSRegExp::code_index(is_ascii), |
| 1330 Smi::FromInt(JSRegExp::kUninitializedValue), | 1332 Smi::FromInt(JSRegExp::kUninitializedValue), |
| 1331 heap); | 1333 heap); |
| 1332 re->SetDataAtUnchecked(JSRegExp::saved_code_index(is_ascii), | 1334 re->SetDataAtUnchecked(JSRegExp::saved_code_index(is_ascii), |
| 1333 Smi::FromInt(JSRegExp::kUninitializedValue), | 1335 Smi::FromInt(JSRegExp::kUninitializedValue), |
| 1334 heap); | 1336 heap); |
| 1335 } | 1337 } |
| 1336 } | 1338 } |
| 1337 } | 1339 } |
| 1338 | 1340 |
| (...skipping 2806 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4145 while (buffer != NULL) { | 4147 while (buffer != NULL) { |
| 4146 SlotsBuffer* next_buffer = buffer->next(); | 4148 SlotsBuffer* next_buffer = buffer->next(); |
| 4147 DeallocateBuffer(buffer); | 4149 DeallocateBuffer(buffer); |
| 4148 buffer = next_buffer; | 4150 buffer = next_buffer; |
| 4149 } | 4151 } |
| 4150 *buffer_address = NULL; | 4152 *buffer_address = NULL; |
| 4151 } | 4153 } |
| 4152 | 4154 |
| 4153 | 4155 |
| 4154 } } // namespace v8::internal | 4156 } } // namespace v8::internal |
| OLD | NEW |