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 1379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1390 | 1390 |
1391 | 1391 |
1392 inline void AllocationSite::IncrementMementoCreateCount() { | 1392 inline void AllocationSite::IncrementMementoCreateCount() { |
1393 ASSERT(FLAG_allocation_site_pretenuring); | 1393 ASSERT(FLAG_allocation_site_pretenuring); |
1394 int value = memento_create_count(); | 1394 int value = memento_create_count(); |
1395 set_memento_create_count(value + 1); | 1395 set_memento_create_count(value + 1); |
1396 } | 1396 } |
1397 | 1397 |
1398 | 1398 |
1399 inline bool AllocationSite::DigestPretenuringFeedback() { | 1399 inline bool AllocationSite::DigestPretenuringFeedback() { |
1400 bool decision_made = false; | 1400 bool decision_changed = false; |
1401 int create_count = memento_create_count(); | 1401 int create_count = memento_create_count(); |
1402 if (create_count >= kPretenureMinimumCreated) { | 1402 if (create_count >= kPretenureMinimumCreated) { |
1403 int found_count = memento_found_count(); | 1403 int found_count = memento_found_count(); |
1404 double ratio = static_cast<double>(found_count) / create_count; | 1404 double ratio = static_cast<double>(found_count) / create_count; |
1405 if (FLAG_trace_track_allocation_sites) { | 1405 if (FLAG_trace_track_allocation_sites) { |
1406 PrintF("AllocationSite: %p (created, found, ratio) (%d, %d, %f)\n", | 1406 PrintF("AllocationSite: %p (created, found, ratio) (%d, %d, %f)\n", |
1407 static_cast<void*>(this), create_count, found_count, ratio); | 1407 static_cast<void*>(this), create_count, found_count, ratio); |
1408 } | 1408 } |
1409 int current_mode = GetPretenureMode(); | 1409 int current_mode = GetPretenureMode(); |
1410 PretenureDecision result = ratio >= kPretenureRatio | 1410 PretenureDecision result = ratio >= kPretenureRatio |
1411 ? kTenure | 1411 ? kTenure |
1412 : kDontTenure; | 1412 : kDontTenure; |
1413 set_pretenure_decision(result); | 1413 set_pretenure_decision(result); |
1414 decision_made = true; | |
1415 if (current_mode != GetPretenureMode()) { | 1414 if (current_mode != GetPretenureMode()) { |
1416 dependent_code()->DeoptimizeDependentCodeGroup( | 1415 decision_changed = true; |
| 1416 dependent_code()->MarkCodeForDeoptimization( |
1417 GetIsolate(), | 1417 GetIsolate(), |
1418 DependentCode::kAllocationSiteTenuringChangedGroup); | 1418 DependentCode::kAllocationSiteTenuringChangedGroup); |
1419 } | 1419 } |
1420 } | 1420 } |
1421 | 1421 |
1422 // Clear feedback calculation fields until the next gc. | 1422 // Clear feedback calculation fields until the next gc. |
1423 set_memento_found_count(0); | 1423 set_memento_found_count(0); |
1424 set_memento_create_count(0); | 1424 set_memento_create_count(0); |
1425 return decision_made; | 1425 return decision_changed; |
1426 } | 1426 } |
1427 | 1427 |
1428 | 1428 |
1429 void JSObject::EnsureCanContainHeapObjectElements(Handle<JSObject> object) { | 1429 void JSObject::EnsureCanContainHeapObjectElements(Handle<JSObject> object) { |
1430 object->ValidateElements(); | 1430 object->ValidateElements(); |
1431 ElementsKind elements_kind = object->map()->elements_kind(); | 1431 ElementsKind elements_kind = object->map()->elements_kind(); |
1432 if (!IsFastObjectElementsKind(elements_kind)) { | 1432 if (!IsFastObjectElementsKind(elements_kind)) { |
1433 if (IsFastHoleyElementsKind(elements_kind)) { | 1433 if (IsFastHoleyElementsKind(elements_kind)) { |
1434 TransitionElementsKind(object, FAST_HOLEY_ELEMENTS); | 1434 TransitionElementsKind(object, FAST_HOLEY_ELEMENTS); |
1435 } else { | 1435 } else { |
(...skipping 5055 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6491 #undef WRITE_UINT32_FIELD | 6491 #undef WRITE_UINT32_FIELD |
6492 #undef READ_SHORT_FIELD | 6492 #undef READ_SHORT_FIELD |
6493 #undef WRITE_SHORT_FIELD | 6493 #undef WRITE_SHORT_FIELD |
6494 #undef READ_BYTE_FIELD | 6494 #undef READ_BYTE_FIELD |
6495 #undef WRITE_BYTE_FIELD | 6495 #undef WRITE_BYTE_FIELD |
6496 | 6496 |
6497 | 6497 |
6498 } } // namespace v8::internal | 6498 } } // namespace v8::internal |
6499 | 6499 |
6500 #endif // V8_OBJECTS_INL_H_ | 6500 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |