Changeset 94477 in webkit for trunk/Source/JavaScriptCore/bytecode/CodeBlock.cpp
- Timestamp:
- Sep 2, 2011, 10:14:04 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/bytecode/CodeBlock.cpp
r93466 r94477 1434 1434 { 1435 1435 #if ENABLE(VERBOSE_VALUE_PROFILE) 1436 printf("ValueProfile for %p:\n", this);1436 fprintf(stderr, "ValueProfile for %p:\n", this); 1437 1437 for (unsigned i = 0; i < numberOfValueProfiles(); ++i) { 1438 1438 ValueProfile* profile = valueProfile(i); 1439 1439 if (profile->bytecodeOffset < 0) { 1440 1440 ASSERT(profile->bytecodeOffset == -1); 1441 printf(" arg = %u: ", i + 1);1441 fprintf(stderr, " arg = %u: ", i + 1); 1442 1442 } else 1443 printf(" bc = %d: ", profile->bytecodeOffset); 1444 printf("samples = %u, int32 = %u, double = %u, cell = %u\n", 1445 profile->numberOfSamples(), 1446 profile->probabilityOfInt32(), 1447 profile->probabilityOfDouble(), 1448 profile->probabilityOfCell()); 1443 fprintf(stderr, " bc = %d: ", profile->bytecodeOffset); 1444 fprintf(stderr, 1445 "samples = %u, int32 = %u, double = %u, cell = %u, array = %u\n", 1446 profile->numberOfSamples(), 1447 profile->probabilityOfInt32(), 1448 profile->probabilityOfDouble(), 1449 profile->probabilityOfCell(), 1450 profile->probabilityOfArray()); 1449 1451 } 1450 1452 #endif … … 1516 1518 void CodeBlock::visitAggregate(SlotVisitor& visitor) 1517 1519 { 1520 bool handleWeakReferences = false; 1521 1518 1522 visitor.append(&m_globalObject); 1519 1523 visitor.append(&m_ownerExecutable); … … 1563 1567 } 1564 1568 #endif 1569 1570 #if ENABLE(VALUE_PROFILER) 1571 for (unsigned profileIndex = 0; profileIndex < numberOfValueProfiles(); ++profileIndex) { 1572 ValueProfile* profile = valueProfile(profileIndex); 1573 1574 for (unsigned index = 0; index < ValueProfile::numberOfBuckets; ++index) { 1575 if (!profile->buckets[index]) { 1576 if (!!profile->weakBuckets[index]) 1577 handleWeakReferences = true; 1578 continue; 1579 } 1580 1581 if (!JSValue::decode(profile->buckets[index]).isCell()) { 1582 profile->weakBuckets[index] = ValueProfile::WeakBucket(); 1583 continue; 1584 } 1585 1586 handleWeakReferences = true; 1587 } 1588 } 1589 #endif 1590 1591 if (handleWeakReferences) 1592 visitor.addWeakReferenceHarvester(this); 1593 } 1594 1595 void CodeBlock::visitWeakReferences(SlotVisitor&) 1596 { 1597 #if ENABLE(VALUE_PROFILER) 1598 for (unsigned profileIndex = 0; profileIndex < numberOfValueProfiles(); ++profileIndex) { 1599 ValueProfile* profile = valueProfile(profileIndex); 1600 1601 for (unsigned index = 0; index < ValueProfile::numberOfBuckets; ++index) { 1602 if (!!profile->buckets[index]) { 1603 JSValue value = JSValue::decode(profile->buckets[index]); 1604 if (!value.isCell()) 1605 continue; 1606 1607 JSCell* cell = value.asCell(); 1608 if (Heap::isMarked(cell)) 1609 continue; 1610 1611 profile->buckets[index] = JSValue::encode(JSValue()); 1612 profile->weakBuckets[index] = cell->structure(); 1613 } 1614 1615 ValueProfile::WeakBucket weak = profile->weakBuckets[index]; 1616 if (!weak || weak.isClassInfo()) 1617 continue; 1618 1619 ASSERT(weak.isStructure()); 1620 if (Heap::isMarked(weak.asStructure())) 1621 continue; 1622 1623 profile->weakBuckets[index] = weak.asStructure()->classInfo(); 1624 } 1625 } 1626 #endif 1565 1627 } 1566 1628
Note:
See TracChangeset
for help on using the changeset viewer.