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

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

Issue 6992072: Implement set trap for proxies, and revamp class hierarchy in preparation (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Address review. Created 9 years, 6 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 | « src/ic.cc ('k') | src/objects.h » ('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 1045 matching lines...) Expand 10 before | Expand all | Expand 10 after
1056 ASSERT(HEAP->Contains(object)); 1056 ASSERT(HEAP->Contains(object));
1057 if (object->IsMap()) { 1057 if (object->IsMap()) {
1058 Map* map = Map::cast(object); 1058 Map* map = Map::cast(object);
1059 if (FLAG_cleanup_code_caches_at_gc) { 1059 if (FLAG_cleanup_code_caches_at_gc) {
1060 map->ClearCodeCache(heap()); 1060 map->ClearCodeCache(heap());
1061 } 1061 }
1062 SetMark(map); 1062 SetMark(map);
1063 1063
1064 // When map collection is enabled we have to mark through map's transitions 1064 // When map collection is enabled we have to mark through map's transitions
1065 // in a special way to make transition links weak. 1065 // in a special way to make transition links weak.
1066 // Only maps with instance types between FIRST_JS_OBJECT_TYPE and 1066 // Only maps for subclasses of JSReceiver can have transitions.
1067 // JS_FUNCTION_TYPE can have transitions. 1067 STATIC_ASSERT(LAST_TYPE == LAST_JS_RECEIVER_TYPE);
1068 if (FLAG_collect_maps && 1068 if (FLAG_collect_maps && map->instance_type() >= FIRST_JS_RECEIVER_TYPE) {
1069 map->instance_type() >= FIRST_JS_OBJECT_TYPE &&
1070 map->instance_type() <= JS_FUNCTION_TYPE) {
1071 MarkMapContents(map); 1069 MarkMapContents(map);
1072 } else { 1070 } else {
1073 marking_stack_.Push(map); 1071 marking_stack_.Push(map);
1074 } 1072 }
1075 } else { 1073 } else {
1076 SetMark(object); 1074 SetMark(object);
1077 marking_stack_.Push(object); 1075 marking_stack_.Push(object);
1078 } 1076 }
1079 } 1077 }
1080 1078
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
1142 marking_stack_.Push(descriptors); 1140 marking_stack_.Push(descriptors);
1143 } 1141 }
1144 1142
1145 1143
1146 void MarkCompactCollector::CreateBackPointers() { 1144 void MarkCompactCollector::CreateBackPointers() {
1147 HeapObjectIterator iterator(heap()->map_space()); 1145 HeapObjectIterator iterator(heap()->map_space());
1148 for (HeapObject* next_object = iterator.next(); 1146 for (HeapObject* next_object = iterator.next();
1149 next_object != NULL; next_object = iterator.next()) { 1147 next_object != NULL; next_object = iterator.next()) {
1150 if (next_object->IsMap()) { // Could also be ByteArray on free list. 1148 if (next_object->IsMap()) { // Could also be ByteArray on free list.
1151 Map* map = Map::cast(next_object); 1149 Map* map = Map::cast(next_object);
1152 if (map->instance_type() >= FIRST_JS_OBJECT_TYPE && 1150 STATIC_ASSERT(LAST_TYPE == LAST_CALLABLE_SPEC_OBJECT_TYPE);
1153 map->instance_type() <= JS_FUNCTION_TYPE) { 1151 if (map->instance_type() >= FIRST_JS_RECEIVER_TYPE) {
1154 map->CreateBackPointers(); 1152 map->CreateBackPointers();
1155 } else { 1153 } else {
1156 ASSERT(map->instance_descriptors() == heap()->empty_descriptor_array()); 1154 ASSERT(map->instance_descriptors() == heap()->empty_descriptor_array());
1157 } 1155 }
1158 } 1156 }
1159 } 1157 }
1160 } 1158 }
1161 1159
1162 1160
1163 static int OverflowObjectSize(HeapObject* obj) { 1161 static int OverflowObjectSize(HeapObject* obj) {
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after
1519 // scan the descriptor arrays of those maps, not all maps. 1517 // scan the descriptor arrays of those maps, not all maps.
1520 // All of these actions are carried out only on maps of JSObjects 1518 // All of these actions are carried out only on maps of JSObjects
1521 // and related subtypes. 1519 // and related subtypes.
1522 for (HeapObject* obj = map_iterator.next(); 1520 for (HeapObject* obj = map_iterator.next();
1523 obj != NULL; obj = map_iterator.next()) { 1521 obj != NULL; obj = map_iterator.next()) {
1524 Map* map = reinterpret_cast<Map*>(obj); 1522 Map* map = reinterpret_cast<Map*>(obj);
1525 if (!map->IsMarked() && map->IsByteArray()) continue; 1523 if (!map->IsMarked() && map->IsByteArray()) continue;
1526 1524
1527 ASSERT(SafeIsMap(map)); 1525 ASSERT(SafeIsMap(map));
1528 // Only JSObject and subtypes have map transitions and back pointers. 1526 // Only JSObject and subtypes have map transitions and back pointers.
1529 if (map->instance_type() < FIRST_JS_OBJECT_TYPE) continue; 1527 STATIC_ASSERT(LAST_TYPE == LAST_CALLABLE_SPEC_OBJECT_TYPE);
1530 if (map->instance_type() > JS_FUNCTION_TYPE) continue; 1528 if (map->instance_type() < FIRST_JS_RECEIVER_TYPE) continue;
1531 1529
1532 if (map->IsMarked() && map->attached_to_shared_function_info()) { 1530 if (map->IsMarked() && map->attached_to_shared_function_info()) {
1533 // This map is used for inobject slack tracking and has been detached 1531 // This map is used for inobject slack tracking and has been detached
1534 // from SharedFunctionInfo during the mark phase. 1532 // from SharedFunctionInfo during the mark phase.
1535 // Since it survived the GC, reattach it now. 1533 // Since it survived the GC, reattach it now.
1536 map->unchecked_constructor()->unchecked_shared()->AttachInitialMap(map); 1534 map->unchecked_constructor()->unchecked_shared()->AttachInitialMap(map);
1537 } 1535 }
1538 1536
1539 // Clear dead prototype transitions. 1537 // Clear dead prototype transitions.
1540 FixedArray* prototype_transitions = map->unchecked_prototype_transitions(); 1538 FixedArray* prototype_transitions = map->unchecked_prototype_transitions();
(...skipping 1598 matching lines...) Expand 10 before | Expand all | Expand 10 after
3139 } 3137 }
3140 3138
3141 3139
3142 void MarkCompactCollector::Initialize() { 3140 void MarkCompactCollector::Initialize() {
3143 StaticPointersToNewGenUpdatingVisitor::Initialize(); 3141 StaticPointersToNewGenUpdatingVisitor::Initialize();
3144 StaticMarkingVisitor::Initialize(); 3142 StaticMarkingVisitor::Initialize();
3145 } 3143 }
3146 3144
3147 3145
3148 } } // namespace v8::internal 3146 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/ic.cc ('k') | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698