OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 1510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1521 static void InitializeScavengingVisitorsTables() { | 1521 static void InitializeScavengingVisitorsTables() { |
1522 ScavengingVisitor<LOGGING_AND_PROFILING_DISABLED>::Initialize(); | 1522 ScavengingVisitor<LOGGING_AND_PROFILING_DISABLED>::Initialize(); |
1523 ScavengingVisitor<LOGGING_AND_PROFILING_ENABLED>::Initialize(); | 1523 ScavengingVisitor<LOGGING_AND_PROFILING_ENABLED>::Initialize(); |
1524 scavenging_visitors_table_.CopyFrom( | 1524 scavenging_visitors_table_.CopyFrom( |
1525 ScavengingVisitor<LOGGING_AND_PROFILING_DISABLED>::GetTable()); | 1525 ScavengingVisitor<LOGGING_AND_PROFILING_DISABLED>::GetTable()); |
1526 scavenging_visitors_table_mode_ = LOGGING_AND_PROFILING_DISABLED; | 1526 scavenging_visitors_table_mode_ = LOGGING_AND_PROFILING_DISABLED; |
1527 } | 1527 } |
1528 | 1528 |
1529 | 1529 |
1530 void Heap::SwitchScavengingVisitorsTableIfProfilingWasEnabled() { | 1530 void Heap::SwitchScavengingVisitorsTableIfProfilingWasEnabled() { |
| 1531 #ifdef ENABLE_LOGGING_AND_PROFILING |
1531 if (scavenging_visitors_table_mode_ == LOGGING_AND_PROFILING_ENABLED) { | 1532 if (scavenging_visitors_table_mode_ == LOGGING_AND_PROFILING_ENABLED) { |
1532 // Table was already updated by some isolate. | 1533 // Table was already updated by some isolate. |
1533 return; | 1534 return; |
1534 } | 1535 } |
1535 | 1536 |
1536 if (isolate()->logger()->is_logging() | | 1537 if (isolate()->logger()->is_logging() | |
1537 CpuProfiler::is_profiling(isolate()) || | 1538 CpuProfiler::is_profiling(isolate()) || |
1538 (isolate()->heap_profiler() != NULL && | 1539 (isolate()->heap_profiler() != NULL && |
1539 isolate()->heap_profiler()->is_profiling())) { | 1540 isolate()->heap_profiler()->is_profiling())) { |
1540 // If one of the isolates is doing scavenge at this moment of time | 1541 // If one of the isolates is doing scavenge at this moment of time |
1541 // it might see this table in an inconsitent state when | 1542 // it might see this table in an inconsitent state when |
1542 // some of the callbacks point to | 1543 // some of the callbacks point to |
1543 // ScavengingVisitor<LOGGING_AND_PROFILING_ENABLED> and others | 1544 // ScavengingVisitor<LOGGING_AND_PROFILING_ENABLED> and others |
1544 // to ScavengingVisitor<LOGGING_AND_PROFILING_DISABLED>. | 1545 // to ScavengingVisitor<LOGGING_AND_PROFILING_DISABLED>. |
1545 // However this does not lead to any bugs as such isolate does not have | 1546 // However this does not lead to any bugs as such isolate does not have |
1546 // profiling enabled and any isolate with enabled profiling is guaranteed | 1547 // profiling enabled and any isolate with enabled profiling is guaranteed |
1547 // to see the table in the consistent state. | 1548 // to see the table in the consistent state. |
1548 scavenging_visitors_table_.CopyFrom( | 1549 scavenging_visitors_table_.CopyFrom( |
1549 ScavengingVisitor<LOGGING_AND_PROFILING_ENABLED>::GetTable()); | 1550 ScavengingVisitor<LOGGING_AND_PROFILING_ENABLED>::GetTable()); |
1550 | 1551 |
1551 // We use Release_Store to prevent reordering of this write before writes | 1552 // We use Release_Store to prevent reordering of this write before writes |
1552 // to the table. | 1553 // to the table. |
1553 Release_Store(&scavenging_visitors_table_mode_, | 1554 Release_Store(&scavenging_visitors_table_mode_, |
1554 LOGGING_AND_PROFILING_ENABLED); | 1555 LOGGING_AND_PROFILING_ENABLED); |
1555 } | 1556 } |
| 1557 #endif |
1556 } | 1558 } |
1557 | 1559 |
1558 | 1560 |
1559 void Heap::ScavengeObjectSlow(HeapObject** p, HeapObject* object) { | 1561 void Heap::ScavengeObjectSlow(HeapObject** p, HeapObject* object) { |
1560 ASSERT(HEAP->InFromSpace(object)); | 1562 ASSERT(HEAP->InFromSpace(object)); |
1561 MapWord first_word = object->map_word(); | 1563 MapWord first_word = object->map_word(); |
1562 ASSERT(!first_word.IsForwardingAddress()); | 1564 ASSERT(!first_word.IsForwardingAddress()); |
1563 Map* map = first_word.ToMap(); | 1565 Map* map = first_word.ToMap(); |
1564 DoScavengeObject(map, p, object); | 1566 DoScavengeObject(map, p, object); |
1565 } | 1567 } |
(...skipping 4355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5921 } | 5923 } |
5922 | 5924 |
5923 | 5925 |
5924 void ExternalStringTable::TearDown() { | 5926 void ExternalStringTable::TearDown() { |
5925 new_space_strings_.Free(); | 5927 new_space_strings_.Free(); |
5926 old_space_strings_.Free(); | 5928 old_space_strings_.Free(); |
5927 } | 5929 } |
5928 | 5930 |
5929 | 5931 |
5930 } } // namespace v8::internal | 5932 } } // namespace v8::internal |
OLD | NEW |