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

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

Issue 3329019: Dynamically determine optimal instance size.... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 10 years, 3 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
OLDNEW
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 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 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 &FixedBodyVisitor<StaticMarkingVisitor, 275 &FixedBodyVisitor<StaticMarkingVisitor,
276 ConsString::BodyDescriptor, 276 ConsString::BodyDescriptor,
277 void>::Visit); 277 void>::Visit);
278 278
279 279
280 table_.Register(kVisitFixedArray, 280 table_.Register(kVisitFixedArray,
281 &FlexibleBodyVisitor<StaticMarkingVisitor, 281 &FlexibleBodyVisitor<StaticMarkingVisitor,
282 FixedArray::BodyDescriptor, 282 FixedArray::BodyDescriptor,
283 void>::Visit); 283 void>::Visit);
284 284
285 table_.Register(kVisitSharedFunctionInfo, 285 table_.Register(kVisitSharedFunctionInfo, &VisitSharedFunctionInfo);
286 &FixedBodyVisitor<StaticMarkingVisitor,
287 SharedFunctionInfo::BodyDescriptor,
288 void>::Visit);
289 286
290 table_.Register(kVisitByteArray, &DataObjectVisitor::Visit); 287 table_.Register(kVisitByteArray, &DataObjectVisitor::Visit);
291 table_.Register(kVisitSeqAsciiString, &DataObjectVisitor::Visit); 288 table_.Register(kVisitSeqAsciiString, &DataObjectVisitor::Visit);
292 table_.Register(kVisitSeqTwoByteString, &DataObjectVisitor::Visit); 289 table_.Register(kVisitSeqTwoByteString, &DataObjectVisitor::Visit);
293 290
294 table_.Register(kVisitOddball, 291 table_.Register(kVisitOddball,
295 &FixedBodyVisitor<StaticMarkingVisitor, 292 &FixedBodyVisitor<StaticMarkingVisitor,
296 Oddball::BodyDescriptor, 293 Oddball::BodyDescriptor,
297 void>::Visit); 294 void>::Visit);
298 table_.Register(kVisitMap, 295 table_.Register(kVisitMap,
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
530 Context* context = reinterpret_cast<Context*>(ctx); 527 Context* context = reinterpret_cast<Context*>(ctx);
531 528
532 if (IsJSBuiltinsObject(context->global())) { 529 if (IsJSBuiltinsObject(context->global())) {
533 return false; 530 return false;
534 } 531 }
535 532
536 return true; 533 return true;
537 } 534 }
538 535
539 536
537 static void VisitSharedFunctionInfo(Map* map, HeapObject* object) {
538 SharedFunctionInfo* shared = reinterpret_cast<SharedFunctionInfo*>(object);
539 if (shared->IsInobjectSlackTrackingInProgress()) {
540 shared->DetachInitialMap();
541 }
542 FixedBodyVisitor<StaticMarkingVisitor,
543 SharedFunctionInfo::BodyDescriptor,
544 void>::Visit(map, object);
545 }
546
547
540 static void VisitCodeEntry(Address entry_address) { 548 static void VisitCodeEntry(Address entry_address) {
541 Object* code = Code::GetObjectFromEntryAddress(entry_address); 549 Object* code = Code::GetObjectFromEntryAddress(entry_address);
542 Object* old_code = code; 550 Object* old_code = code;
543 VisitPointer(&code); 551 VisitPointer(&code);
544 if (code != old_code) { 552 if (code != old_code) {
545 Memory::Address_at(entry_address) = 553 Memory::Address_at(entry_address) =
546 reinterpret_cast<Code*>(code)->entry(); 554 reinterpret_cast<Code*>(code)->entry();
547 } 555 }
548 } 556 }
549 557
(...skipping 582 matching lines...) Expand 10 before | Expand all | Expand 10 after
1132 // and related subtypes. 1140 // and related subtypes.
1133 for (HeapObject* obj = map_iterator.next(); 1141 for (HeapObject* obj = map_iterator.next();
1134 obj != NULL; obj = map_iterator.next()) { 1142 obj != NULL; obj = map_iterator.next()) {
1135 Map* map = reinterpret_cast<Map*>(obj); 1143 Map* map = reinterpret_cast<Map*>(obj);
1136 if (!map->IsMarked() && map->IsByteArray()) continue; 1144 if (!map->IsMarked() && map->IsByteArray()) continue;
1137 1145
1138 ASSERT(SafeIsMap(map)); 1146 ASSERT(SafeIsMap(map));
1139 // Only JSObject and subtypes have map transitions and back pointers. 1147 // Only JSObject and subtypes have map transitions and back pointers.
1140 if (map->instance_type() < FIRST_JS_OBJECT_TYPE) continue; 1148 if (map->instance_type() < FIRST_JS_OBJECT_TYPE) continue;
1141 if (map->instance_type() > JS_FUNCTION_TYPE) continue; 1149 if (map->instance_type() > JS_FUNCTION_TYPE) continue;
1150
1151 if (map->IsMarked() && map->attached_to_shared_function_info()) {
Vitaly Repeshko 2010/09/22 14:40:25 This needs a short comment.
Vladislav Kaznacheev 2010/09/23 08:38:16 Done.
1152 map->unchecked_constructor()->unchecked_shared()->
1153 AttachInitialMap(map);
1154 }
1155
1142 // Follow the chain of back pointers to find the prototype. 1156 // Follow the chain of back pointers to find the prototype.
1143 Map* current = map; 1157 Map* current = map;
1144 while (SafeIsMap(current)) { 1158 while (SafeIsMap(current)) {
1145 current = reinterpret_cast<Map*>(current->prototype()); 1159 current = reinterpret_cast<Map*>(current->prototype());
1146 ASSERT(current->IsHeapObject()); 1160 ASSERT(current->IsHeapObject());
1147 } 1161 }
1148 Object* real_prototype = current; 1162 Object* real_prototype = current;
1149 1163
1150 // Follow back pointers, setting them to prototype, 1164 // Follow back pointers, setting them to prototype,
1151 // clearing map transitions when necessary. 1165 // clearing map transitions when necessary.
(...skipping 1462 matching lines...) Expand 10 before | Expand all | Expand 10 after
2614 } 2628 }
2615 2629
2616 2630
2617 void MarkCompactCollector::Initialize() { 2631 void MarkCompactCollector::Initialize() {
2618 StaticPointersToNewGenUpdatingVisitor::Initialize(); 2632 StaticPointersToNewGenUpdatingVisitor::Initialize();
2619 StaticMarkingVisitor::Initialize(); 2633 StaticMarkingVisitor::Initialize();
2620 } 2634 }
2621 2635
2622 2636
2623 } } // namespace v8::internal 2637 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698