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 // 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 30 matching lines...) Expand all Loading... | |
| 41 #include "conversions-inl.h" | 41 #include "conversions-inl.h" |
| 42 #include "heap.h" | 42 #include "heap.h" |
| 43 #include "isolate.h" | 43 #include "isolate.h" |
| 44 #include "property.h" | 44 #include "property.h" |
| 45 #include "spaces.h" | 45 #include "spaces.h" |
| 46 #include "store-buffer.h" | 46 #include "store-buffer.h" |
| 47 #include "v8memory.h" | 47 #include "v8memory.h" |
| 48 #include "factory.h" | 48 #include "factory.h" |
| 49 #include "incremental-marking.h" | 49 #include "incremental-marking.h" |
| 50 #include "transitions-inl.h" | 50 #include "transitions-inl.h" |
| 51 #include "objects-visiting.h" | |
|
Hannes Payer (out of office)
2014/01/10 11:17:29
alphabetic order
| |
| 51 | 52 |
| 52 namespace v8 { | 53 namespace v8 { |
| 53 namespace internal { | 54 namespace internal { |
| 54 | 55 |
| 55 PropertyDetails::PropertyDetails(Smi* smi) { | 56 PropertyDetails::PropertyDetails(Smi* smi) { |
| 56 value_ = smi->value(); | 57 value_ = smi->value(); |
| 57 } | 58 } |
| 58 | 59 |
| 59 | 60 |
| 60 Smi* PropertyDetails::AsSmi() { | 61 Smi* PropertyDetails::AsSmi() { |
| (...skipping 1236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1297 accessor->Validate(this); | 1298 accessor->Validate(this); |
| 1298 } | 1299 } |
| 1299 #endif | 1300 #endif |
| 1300 } | 1301 } |
| 1301 | 1302 |
| 1302 | 1303 |
| 1303 void AllocationSite::Initialize() { | 1304 void AllocationSite::Initialize() { |
| 1304 set_transition_info(Smi::FromInt(0)); | 1305 set_transition_info(Smi::FromInt(0)); |
| 1305 SetElementsKind(GetInitialFastElementsKind()); | 1306 SetElementsKind(GetInitialFastElementsKind()); |
| 1306 set_nested_site(Smi::FromInt(0)); | 1307 set_nested_site(Smi::FromInt(0)); |
| 1307 set_memento_create_count(Smi::FromInt(0)); | 1308 set_pretenure_data(Smi::FromInt(0)); |
| 1308 set_memento_found_count(Smi::FromInt(0)); | 1309 set_pretenure_create_count(Smi::FromInt(0)); |
| 1309 set_pretenure_decision(Smi::FromInt(0)); | |
| 1310 set_dependent_code(DependentCode::cast(GetHeap()->empty_fixed_array()), | 1310 set_dependent_code(DependentCode::cast(GetHeap()->empty_fixed_array()), |
| 1311 SKIP_WRITE_BARRIER); | 1311 SKIP_WRITE_BARRIER); |
| 1312 } | 1312 } |
| 1313 | 1313 |
| 1314 | 1314 |
| 1315 void AllocationSite::MarkZombie() { | 1315 void AllocationSite::MarkZombie() { |
| 1316 ASSERT(!IsZombie()); | 1316 ASSERT(!IsZombie()); |
| 1317 Initialize(); | 1317 Initialize(); |
| 1318 set_pretenure_decision(Smi::FromInt(kZombie)); | 1318 set_pretenure_decision(kZombie); |
| 1319 } | 1319 } |
| 1320 | 1320 |
| 1321 | 1321 |
| 1322 // Heuristic: We only need to create allocation site info if the boilerplate | 1322 // Heuristic: We only need to create allocation site info if the boilerplate |
| 1323 // elements kind is the initial elements kind. | 1323 // elements kind is the initial elements kind. |
| 1324 AllocationSiteMode AllocationSite::GetMode( | 1324 AllocationSiteMode AllocationSite::GetMode( |
| 1325 ElementsKind boilerplate_elements_kind) { | 1325 ElementsKind boilerplate_elements_kind) { |
| 1326 if (IsFastSmiElementsKind(boilerplate_elements_kind)) { | 1326 if (IsFastSmiElementsKind(boilerplate_elements_kind)) { |
| 1327 return TRACK_ALLOCATION_SITE; | 1327 return TRACK_ALLOCATION_SITE; |
| 1328 } | 1328 } |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1360 break; | 1360 break; |
| 1361 case TRANSITIONS: | 1361 case TRANSITIONS: |
| 1362 return DependentCode::kAllocationSiteTransitionChangedGroup; | 1362 return DependentCode::kAllocationSiteTransitionChangedGroup; |
| 1363 break; | 1363 break; |
| 1364 } | 1364 } |
| 1365 UNREACHABLE(); | 1365 UNREACHABLE(); |
| 1366 return DependentCode::kAllocationSiteTransitionChangedGroup; | 1366 return DependentCode::kAllocationSiteTransitionChangedGroup; |
| 1367 } | 1367 } |
| 1368 | 1368 |
| 1369 | 1369 |
| 1370 inline void AllocationSite::set_memento_found_count(int count) { | |
| 1371 int value = pretenure_data()->value(); | |
| 1372 // Verify that we can count more mementos than we can possibly find in one | |
| 1373 // new space collection. | |
| 1374 ASSERT((GetHeap()->MaxSemiSpaceSize() / | |
| 1375 (StaticVisitorBase::kMinObjectSizeInWords * kPointerSize + | |
| 1376 AllocationMemento::kSize)) < MementoFoundCountBits::kMax); | |
| 1377 ASSERT(count < MementoFoundCountBits::kMax); | |
| 1378 set_pretenure_data( | |
| 1379 Smi::FromInt(MementoFoundCountBits::update(value, count)), | |
| 1380 SKIP_WRITE_BARRIER); | |
| 1381 } | |
| 1382 | |
| 1370 inline bool AllocationSite::IncrementMementoFoundCount() { | 1383 inline bool AllocationSite::IncrementMementoFoundCount() { |
| 1371 if (IsZombie()) return false; | 1384 if (IsZombie()) return false; |
| 1372 | 1385 |
| 1373 int value = memento_found_count()->value(); | 1386 int value = memento_found_count(); |
| 1374 set_memento_found_count(Smi::FromInt(value + 1)); | 1387 set_memento_found_count(value + 1); |
| 1375 return value == 0; | 1388 return value == 0; |
| 1376 } | 1389 } |
| 1377 | 1390 |
| 1378 | 1391 |
| 1379 inline void AllocationSite::IncrementMementoCreateCount() { | 1392 inline void AllocationSite::IncrementMementoCreateCount() { |
| 1380 ASSERT(FLAG_allocation_site_pretenuring); | 1393 ASSERT(FLAG_allocation_site_pretenuring); |
| 1381 int value = memento_create_count()->value(); | 1394 int value = memento_create_count(); |
| 1382 set_memento_create_count(Smi::FromInt(value + 1)); | 1395 set_memento_create_count(value + 1); |
| 1383 } | 1396 } |
| 1384 | 1397 |
| 1385 | 1398 |
| 1386 inline bool AllocationSite::DigestPretenuringFeedback() { | 1399 inline bool AllocationSite::DigestPretenuringFeedback() { |
| 1387 bool decision_made = false; | 1400 bool decision_made = false; |
| 1388 if (!PretenuringDecisionMade()) { | 1401 if (!PretenuringDecisionMade()) { |
| 1389 int create_count = memento_create_count()->value(); | 1402 int create_count = memento_create_count(); |
| 1390 if (create_count >= kPretenureMinimumCreated) { | 1403 if (create_count >= kPretenureMinimumCreated) { |
| 1391 int found_count = memento_found_count()->value(); | 1404 int found_count = memento_found_count(); |
| 1392 double ratio = static_cast<double>(found_count) / create_count; | 1405 double ratio = static_cast<double>(found_count) / create_count; |
| 1393 if (FLAG_trace_track_allocation_sites) { | 1406 if (FLAG_trace_track_allocation_sites) { |
| 1394 PrintF("AllocationSite: %p (created, found, ratio) (%d, %d, %f)\n", | 1407 PrintF("AllocationSite: %p (created, found, ratio) (%d, %d, %f)\n", |
| 1395 static_cast<void*>(this), create_count, found_count, ratio); | 1408 static_cast<void*>(this), create_count, found_count, ratio); |
| 1396 } | 1409 } |
| 1397 int result = ratio >= kPretenureRatio ? kTenure : kDontTenure; | 1410 PretenureDecision result = ratio >= kPretenureRatio |
| 1398 set_pretenure_decision(Smi::FromInt(result)); | 1411 ? kTenure |
| 1412 : kDontTenure; | |
| 1413 set_pretenure_decision(result); | |
| 1399 decision_made = true; | 1414 decision_made = true; |
| 1400 // TODO(mvstanton): if the decision represents a change, any dependent | 1415 // TODO(mvstanton): if the decision represents a change, any dependent |
| 1401 // code registered for pretenuring changes should be deopted. | 1416 // code registered for pretenuring changes should be deopted. |
| 1402 } | 1417 } |
| 1403 } | 1418 } |
| 1404 | 1419 |
| 1405 // Clear feedback calculation fields until the next gc. | 1420 // Clear feedback calculation fields until the next gc. |
| 1406 set_memento_found_count(Smi::FromInt(0)); | 1421 set_memento_found_count(0); |
| 1407 set_memento_create_count(Smi::FromInt(0)); | 1422 set_memento_create_count(0); |
| 1408 return decision_made; | 1423 return decision_made; |
| 1409 } | 1424 } |
| 1410 | 1425 |
| 1411 | 1426 |
| 1412 void JSObject::EnsureCanContainHeapObjectElements(Handle<JSObject> object) { | 1427 void JSObject::EnsureCanContainHeapObjectElements(Handle<JSObject> object) { |
| 1413 object->ValidateElements(); | 1428 object->ValidateElements(); |
| 1414 ElementsKind elements_kind = object->map()->elements_kind(); | 1429 ElementsKind elements_kind = object->map()->elements_kind(); |
| 1415 if (!IsFastObjectElementsKind(elements_kind)) { | 1430 if (!IsFastObjectElementsKind(elements_kind)) { |
| 1416 if (IsFastHoleyElementsKind(elements_kind)) { | 1431 if (IsFastHoleyElementsKind(elements_kind)) { |
| 1417 TransitionElementsKind(object, FAST_HOLEY_ELEMENTS); | 1432 TransitionElementsKind(object, FAST_HOLEY_ELEMENTS); |
| (...skipping 3173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4591 ACCESSORS(ObjectTemplateInfo, internal_field_count, Object, | 4606 ACCESSORS(ObjectTemplateInfo, internal_field_count, Object, |
| 4592 kInternalFieldCountOffset) | 4607 kInternalFieldCountOffset) |
| 4593 | 4608 |
| 4594 ACCESSORS(SignatureInfo, receiver, Object, kReceiverOffset) | 4609 ACCESSORS(SignatureInfo, receiver, Object, kReceiverOffset) |
| 4595 ACCESSORS(SignatureInfo, args, Object, kArgsOffset) | 4610 ACCESSORS(SignatureInfo, args, Object, kArgsOffset) |
| 4596 | 4611 |
| 4597 ACCESSORS(TypeSwitchInfo, types, Object, kTypesOffset) | 4612 ACCESSORS(TypeSwitchInfo, types, Object, kTypesOffset) |
| 4598 | 4613 |
| 4599 ACCESSORS(AllocationSite, transition_info, Object, kTransitionInfoOffset) | 4614 ACCESSORS(AllocationSite, transition_info, Object, kTransitionInfoOffset) |
| 4600 ACCESSORS(AllocationSite, nested_site, Object, kNestedSiteOffset) | 4615 ACCESSORS(AllocationSite, nested_site, Object, kNestedSiteOffset) |
| 4601 ACCESSORS_TO_SMI(AllocationSite, memento_found_count, kMementoFoundCountOffset) | 4616 ACCESSORS_TO_SMI(AllocationSite, pretenure_data, kPretenureDataOffset) |
| 4602 ACCESSORS_TO_SMI(AllocationSite, memento_create_count, | 4617 ACCESSORS_TO_SMI(AllocationSite, pretenure_create_count, |
| 4603 kMementoCreateCountOffset) | 4618 kPretenureCreateCountOffset) |
| 4604 ACCESSORS_TO_SMI(AllocationSite, pretenure_decision, kPretenureDecisionOffset) | |
| 4605 ACCESSORS(AllocationSite, dependent_code, DependentCode, | 4619 ACCESSORS(AllocationSite, dependent_code, DependentCode, |
| 4606 kDependentCodeOffset) | 4620 kDependentCodeOffset) |
| 4607 ACCESSORS(AllocationSite, weak_next, Object, kWeakNextOffset) | 4621 ACCESSORS(AllocationSite, weak_next, Object, kWeakNextOffset) |
| 4608 ACCESSORS(AllocationMemento, allocation_site, Object, kAllocationSiteOffset) | 4622 ACCESSORS(AllocationMemento, allocation_site, Object, kAllocationSiteOffset) |
| 4609 | 4623 |
| 4610 ACCESSORS(Script, source, Object, kSourceOffset) | 4624 ACCESSORS(Script, source, Object, kSourceOffset) |
| 4611 ACCESSORS(Script, name, Object, kNameOffset) | 4625 ACCESSORS(Script, name, Object, kNameOffset) |
| 4612 ACCESSORS(Script, id, Smi, kIdOffset) | 4626 ACCESSORS(Script, id, Smi, kIdOffset) |
| 4613 ACCESSORS_TO_SMI(Script, line_offset, kLineOffsetOffset) | 4627 ACCESSORS_TO_SMI(Script, line_offset, kLineOffsetOffset) |
| 4614 ACCESSORS_TO_SMI(Script, column_offset, kColumnOffsetOffset) | 4628 ACCESSORS_TO_SMI(Script, column_offset, kColumnOffsetOffset) |
| (...skipping 1860 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6475 #undef WRITE_UINT32_FIELD | 6489 #undef WRITE_UINT32_FIELD |
| 6476 #undef READ_SHORT_FIELD | 6490 #undef READ_SHORT_FIELD |
| 6477 #undef WRITE_SHORT_FIELD | 6491 #undef WRITE_SHORT_FIELD |
| 6478 #undef READ_BYTE_FIELD | 6492 #undef READ_BYTE_FIELD |
| 6479 #undef WRITE_BYTE_FIELD | 6493 #undef WRITE_BYTE_FIELD |
| 6480 | 6494 |
| 6481 | 6495 |
| 6482 } } // namespace v8::internal | 6496 } } // namespace v8::internal |
| 6483 | 6497 |
| 6484 #endif // V8_OBJECTS_INL_H_ | 6498 #endif // V8_OBJECTS_INL_H_ |
| OLD | NEW |