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

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

Issue 12225099: Remove prototype checks for leaf maps in optimized code. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rename "dependent codes" and add comment. Created 7 years, 10 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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 2276 matching lines...) Expand 10 before | Expand all | Expand 10 after
2287 // This map is used for inobject slack tracking and has been detached 2287 // This map is used for inobject slack tracking and has been detached
2288 // from SharedFunctionInfo during the mark phase. 2288 // from SharedFunctionInfo during the mark phase.
2289 // Since it survived the GC, reattach it now. 2289 // Since it survived the GC, reattach it now.
2290 map->unchecked_constructor()->unchecked_shared()->AttachInitialMap(map); 2290 map->unchecked_constructor()->unchecked_shared()->AttachInitialMap(map);
2291 } 2291 }
2292 2292
2293 ClearNonLivePrototypeTransitions(map); 2293 ClearNonLivePrototypeTransitions(map);
2294 ClearNonLiveMapTransitions(map, map_mark); 2294 ClearNonLiveMapTransitions(map, map_mark);
2295 2295
2296 if (map_mark.Get()) { 2296 if (map_mark.Get()) {
2297 ClearNonLiveDependentCodes(map); 2297 ClearNonLiveDependentCode(map);
2298 } else { 2298 } else {
2299 ClearAndDeoptimizeDependentCodes(map); 2299 ClearAndDeoptimizeDependentCode(map);
2300 } 2300 }
2301 } 2301 }
2302 } 2302 }
2303 2303
2304 2304
2305 void MarkCompactCollector::ClearNonLivePrototypeTransitions(Map* map) { 2305 void MarkCompactCollector::ClearNonLivePrototypeTransitions(Map* map) {
2306 int number_of_transitions = map->NumberOfProtoTransitions(); 2306 int number_of_transitions = map->NumberOfProtoTransitions();
2307 FixedArray* prototype_transitions = map->GetPrototypeTransitions(); 2307 FixedArray* prototype_transitions = map->GetPrototypeTransitions();
2308 2308
2309 int new_number_of_transitions = 0; 2309 int new_number_of_transitions = 0;
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
2359 // Follow back pointer, check whether we are dealing with a map transition 2359 // Follow back pointer, check whether we are dealing with a map transition
2360 // from a live map to a dead path and in case clear transitions of parent. 2360 // from a live map to a dead path and in case clear transitions of parent.
2361 bool current_is_alive = map_mark.Get(); 2361 bool current_is_alive = map_mark.Get();
2362 bool parent_is_alive = Marking::MarkBitFrom(parent).Get(); 2362 bool parent_is_alive = Marking::MarkBitFrom(parent).Get();
2363 if (!current_is_alive && parent_is_alive) { 2363 if (!current_is_alive && parent_is_alive) {
2364 parent->ClearNonLiveTransitions(heap()); 2364 parent->ClearNonLiveTransitions(heap());
2365 } 2365 }
2366 } 2366 }
2367 2367
2368 2368
2369 void MarkCompactCollector::ClearAndDeoptimizeDependentCodes(Map* map) { 2369 void MarkCompactCollector::ClearAndDeoptimizeDependentCode(Map* map) {
2370 AssertNoAllocation no_allocation_scope; 2370 AssertNoAllocation no_allocation_scope;
2371 DependentCodes* codes = map->dependent_codes(); 2371 DependentCode* codes = map->dependent_code();
2372 DependentCodes::GroupStartIndexes starts; 2372 DependentCode::GroupStartIndexes starts(codes);
2373 codes->ComputeGroupStartIndexes(starts); 2373 int number_of_codes = starts.at(DependentCode::kGroupCount);
2374 int number_of_codes = starts[DependentCodes::kGroupCount];
2375 if (number_of_codes == 0) return; 2374 if (number_of_codes == 0) return;
2376 for (int i = 0; i < number_of_codes; i++) { 2375 for (int i = 0; i < number_of_codes; i++) {
2377 Code* code = codes->code_at(i); 2376 Code* code = codes->code_at(i);
2378 if (IsMarked(code) && !code->marked_for_deoptimization()) { 2377 if (IsMarked(code) && !code->marked_for_deoptimization()) {
2379 code->set_marked_for_deoptimization(true); 2378 code->set_marked_for_deoptimization(true);
2380 } 2379 }
2381 codes->clear_code_at(i); 2380 codes->clear_code_at(i);
2382 } 2381 }
2383 map->set_dependent_codes(DependentCodes::cast(heap()->empty_fixed_array())); 2382 map->set_dependent_code(DependentCode::cast(heap()->empty_fixed_array()));
2384 } 2383 }
2385 2384
2386 2385
2387 void MarkCompactCollector::ClearNonLiveDependentCodes(Map* map) { 2386 void MarkCompactCollector::ClearNonLiveDependentCode(Map* map) {
2388 AssertNoAllocation no_allocation_scope; 2387 AssertNoAllocation no_allocation_scope;
2389 DependentCodes* codes = map->dependent_codes(); 2388 DependentCode* codes = map->dependent_code();
2390 DependentCodes::GroupStartIndexes starts; 2389 DependentCode::GroupStartIndexes starts(codes);
2391 codes->ComputeGroupStartIndexes(starts); 2390 int number_of_codes = starts.at(DependentCode::kGroupCount);
2392 int number_of_codes = starts[DependentCodes::kGroupCount];
2393 if (number_of_codes == 0) return; 2391 if (number_of_codes == 0) return;
2394 int new_number_of_codes = 0; 2392 int new_number_of_codes = 0;
2395 // Go through all groups, remove dead codes and compact. 2393 // Go through all groups, remove dead codes and compact.
2396 for (int g = 0; g < DependentCodes::kGroupCount; g++) { 2394 for (int g = 0; g < DependentCode::kGroupCount; g++) {
2397 int group_number_of_codes = 0; 2395 int group_number_of_codes = 0;
2398 for (int i = starts[g]; i < starts[g + 1]; i++) { 2396 for (int i = starts.at(g); i < starts.at(g + 1); i++) {
2399 Code* code = codes->code_at(i); 2397 Code* code = codes->code_at(i);
2400 if (IsMarked(code) && !code->marked_for_deoptimization()) { 2398 if (IsMarked(code) && !code->marked_for_deoptimization()) {
2401 if (new_number_of_codes + group_number_of_codes != i) { 2399 if (new_number_of_codes + group_number_of_codes != i) {
2402 codes->set_code_at(new_number_of_codes + group_number_of_codes, code); 2400 codes->set_code_at(new_number_of_codes + group_number_of_codes, code);
2403 } 2401 }
2404 Object** slot = codes->code_slot_at(new_number_of_codes + 2402 Object** slot = codes->code_slot_at(new_number_of_codes +
2405 group_number_of_codes); 2403 group_number_of_codes);
2406 RecordSlot(slot, slot, code); 2404 RecordSlot(slot, slot, code);
2407 group_number_of_codes++; 2405 group_number_of_codes++;
2408 } 2406 }
2409 } 2407 }
2410 codes->set_number_of_codes(static_cast<DependentCodes::DependencyGroup>(g), 2408 codes->set_number_of_codes(static_cast<DependentCode::DependencyGroup>(g),
2411 group_number_of_codes); 2409 group_number_of_codes);
2412 new_number_of_codes += group_number_of_codes; 2410 new_number_of_codes += group_number_of_codes;
2413 } 2411 }
2414 for (int i = new_number_of_codes; i < number_of_codes; i++) { 2412 for (int i = new_number_of_codes; i < number_of_codes; i++) {
2415 codes->clear_code_at(i); 2413 codes->clear_code_at(i);
2416 } 2414 }
2417 } 2415 }
2418 2416
2419 2417
2420 void MarkCompactCollector::ProcessWeakMaps() { 2418 void MarkCompactCollector::ProcessWeakMaps() {
(...skipping 1662 matching lines...) Expand 10 before | Expand all | Expand 10 after
4083 while (buffer != NULL) { 4081 while (buffer != NULL) {
4084 SlotsBuffer* next_buffer = buffer->next(); 4082 SlotsBuffer* next_buffer = buffer->next();
4085 DeallocateBuffer(buffer); 4083 DeallocateBuffer(buffer);
4086 buffer = next_buffer; 4084 buffer = next_buffer;
4087 } 4085 }
4088 *buffer_address = NULL; 4086 *buffer_address = NULL;
4089 } 4087 }
4090 4088
4091 4089
4092 } } // namespace v8::internal 4090 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698