Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: src/mark-compact.cc

Issue 7342045: Merge changes 8634 and 8636 to trunk. (Closed) Base URL: http://v8.googlecode.com/svn/trunk/
Patch Set: '' Created 9 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | src/version.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1643 matching lines...) Expand 10 before | Expand all | Expand 10 after
1654 1654
1655 if (map->IsMarked() && map->attached_to_shared_function_info()) { 1655 if (map->IsMarked() && map->attached_to_shared_function_info()) {
1656 // This map is used for inobject slack tracking and has been detached 1656 // This map is used for inobject slack tracking and has been detached
1657 // from SharedFunctionInfo during the mark phase. 1657 // from SharedFunctionInfo during the mark phase.
1658 // Since it survived the GC, reattach it now. 1658 // Since it survived the GC, reattach it now.
1659 map->unchecked_constructor()->unchecked_shared()->AttachInitialMap(map); 1659 map->unchecked_constructor()->unchecked_shared()->AttachInitialMap(map);
1660 } 1660 }
1661 1661
1662 // Clear dead prototype transitions. 1662 // Clear dead prototype transitions.
1663 int number_of_transitions = map->NumberOfProtoTransitions(); 1663 int number_of_transitions = map->NumberOfProtoTransitions();
1664 FixedArray* prototype_transitions = map->unchecked_prototype_transitions(); 1664 if (number_of_transitions > 0) {
1665 int new_number_of_transitions = 0; 1665 FixedArray* prototype_transitions =
1666 const int header = Map::kProtoTransitionHeaderSize; 1666 map->unchecked_prototype_transitions();
1667 const int proto_offset = 1667 int new_number_of_transitions = 0;
1668 header + Map::kProtoTransitionPrototypeOffset; 1668 const int header = Map::kProtoTransitionHeaderSize;
1669 const int map_offset = header + Map::kProtoTransitionMapOffset; 1669 const int proto_offset =
1670 const int step = Map::kProtoTransitionElementsPerEntry; 1670 header + Map::kProtoTransitionPrototypeOffset;
1671 for (int i = 0; i < number_of_transitions; i++) { 1671 const int map_offset = header + Map::kProtoTransitionMapOffset;
1672 Object* prototype = prototype_transitions->get(proto_offset + i * step); 1672 const int step = Map::kProtoTransitionElementsPerEntry;
1673 Object* cached_map = prototype_transitions->get(map_offset + i * step); 1673 for (int i = 0; i < number_of_transitions; i++) {
1674 if (HeapObject::cast(prototype)->IsMarked() && 1674 Object* prototype = prototype_transitions->get(proto_offset + i * step);
1675 HeapObject::cast(cached_map)->IsMarked()) { 1675 Object* cached_map = prototype_transitions->get(map_offset + i * step);
1676 if (new_number_of_transitions != i) { 1676 if (HeapObject::cast(prototype)->IsMarked() &&
1677 prototype_transitions->set_unchecked( 1677 HeapObject::cast(cached_map)->IsMarked()) {
1678 heap_, 1678 if (new_number_of_transitions != i) {
1679 proto_offset + new_number_of_transitions * step, 1679 prototype_transitions->set_unchecked(
1680 prototype, 1680 heap_,
1681 UPDATE_WRITE_BARRIER); 1681 proto_offset + new_number_of_transitions * step,
1682 prototype_transitions->set_unchecked( 1682 prototype,
1683 heap_, 1683 UPDATE_WRITE_BARRIER);
1684 map_offset + new_number_of_transitions * step, 1684 prototype_transitions->set_unchecked(
1685 cached_map, 1685 heap_,
1686 SKIP_WRITE_BARRIER); 1686 map_offset + new_number_of_transitions * step,
1687 cached_map,
1688 SKIP_WRITE_BARRIER);
1689 }
1690 new_number_of_transitions++;
1687 } 1691 }
1688 new_number_of_transitions++;
1689 } 1692 }
1690 1693
1691 // Fill slots that became free with undefined value. 1694 // Fill slots that became free with undefined value.
1692 Object* undefined = heap()->raw_unchecked_undefined_value(); 1695 Object* undefined = heap()->raw_unchecked_undefined_value();
1693 for (int i = new_number_of_transitions * step; 1696 for (int i = new_number_of_transitions * step;
1694 i < number_of_transitions * step; 1697 i < number_of_transitions * step;
1695 i++) { 1698 i++) {
1696 prototype_transitions->set_unchecked(heap_, 1699 prototype_transitions->set_unchecked(heap_,
1697 header + i, 1700 header + i,
1698 undefined, 1701 undefined,
(...skipping 1569 matching lines...) Expand 10 before | Expand all | Expand 10 after
3268 } 3271 }
3269 3272
3270 3273
3271 void MarkCompactCollector::Initialize() { 3274 void MarkCompactCollector::Initialize() {
3272 StaticPointersToNewGenUpdatingVisitor::Initialize(); 3275 StaticPointersToNewGenUpdatingVisitor::Initialize();
3273 StaticMarkingVisitor::Initialize(); 3276 StaticMarkingVisitor::Initialize();
3274 } 3277 }
3275 3278
3276 3279
3277 } } // namespace v8::internal 3280 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/version.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698