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

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

Issue 16212013: Fix clearing of dependent codes. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 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 | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 2463 matching lines...) Expand 10 before | Expand all | Expand 10 after
2474 } 2474 }
2475 2475
2476 2476
2477 void MarkCompactCollector::ClearAndDeoptimizeDependentCode(Map* map) { 2477 void MarkCompactCollector::ClearAndDeoptimizeDependentCode(Map* map) {
2478 DisallowHeapAllocation no_allocation; 2478 DisallowHeapAllocation no_allocation;
2479 DependentCode* entries = map->dependent_code(); 2479 DependentCode* entries = map->dependent_code();
2480 DependentCode::GroupStartIndexes starts(entries); 2480 DependentCode::GroupStartIndexes starts(entries);
2481 int number_of_entries = starts.number_of_entries(); 2481 int number_of_entries = starts.number_of_entries();
2482 if (number_of_entries == 0) return; 2482 if (number_of_entries == 0) return;
2483 for (int i = 0; i < number_of_entries; i++) { 2483 for (int i = 0; i < number_of_entries; i++) {
2484 if (!entries->is_code_at(i)) continue; 2484 // If the entry is compilation info then the map must be alive,
2485 // and ClearAndDeoptimizeDependentCode shouldn't be called.
2486 ASSERT(entries->is_code_at(i));
2485 Code* code = entries->code_at(i); 2487 Code* code = entries->code_at(i);
2486 if (IsMarked(code) && !code->marked_for_deoptimization()) { 2488 if (IsMarked(code) && !code->marked_for_deoptimization()) {
2487 code->set_marked_for_deoptimization(true); 2489 code->set_marked_for_deoptimization(true);
2488 } 2490 }
2489 entries->clear_at(i); 2491 entries->clear_at(i);
2490 } 2492 }
2491 map->set_dependent_code(DependentCode::cast(heap()->empty_fixed_array())); 2493 map->set_dependent_code(DependentCode::cast(heap()->empty_fixed_array()));
2492 } 2494 }
2493 2495
2494 2496
2495 void MarkCompactCollector::ClearNonLiveDependentCode(Map* map) { 2497 void MarkCompactCollector::ClearNonLiveDependentCode(Map* map) {
2496 DisallowHeapAllocation no_allocation; 2498 DisallowHeapAllocation no_allocation;
2497 DependentCode* entries = map->dependent_code(); 2499 DependentCode* entries = map->dependent_code();
2498 DependentCode::GroupStartIndexes starts(entries); 2500 DependentCode::GroupStartIndexes starts(entries);
2499 int number_of_entries = starts.number_of_entries(); 2501 int number_of_entries = starts.number_of_entries();
2500 if (number_of_entries == 0) return; 2502 if (number_of_entries == 0) return;
2501 int new_number_of_entries = 0; 2503 int new_number_of_entries = 0;
2502 // Go through all groups, remove dead codes and compact. 2504 // Go through all groups, remove dead codes and compact.
2503 for (int g = 0; g < DependentCode::kGroupCount; g++) { 2505 for (int g = 0; g < DependentCode::kGroupCount; g++) {
2504 int group_number_of_entries = 0; 2506 int group_number_of_entries = 0;
2505 for (int i = starts.at(g); i < starts.at(g + 1); i++) { 2507 for (int i = starts.at(g); i < starts.at(g + 1); i++) {
2506 if (!entries->is_code_at(i)) continue; 2508 Object* obj = entries->object_at(i);
2507 Code* code = entries->code_at(i); 2509 ASSERT(obj->IsCode() || IsMarked(obj));
2508 if (IsMarked(code) && !code->marked_for_deoptimization()) { 2510 if (IsMarked(obj) &&
2511 (!obj->IsCode() || !Code::cast(obj)->marked_for_deoptimization())) {
2509 if (new_number_of_entries + group_number_of_entries != i) { 2512 if (new_number_of_entries + group_number_of_entries != i) {
2510 entries->set_object_at( 2513 entries->set_object_at(
2511 new_number_of_entries + group_number_of_entries, code); 2514 new_number_of_entries + group_number_of_entries, obj);
2512 } 2515 }
2513 Object** slot = entries->slot_at(new_number_of_entries + 2516 Object** slot = entries->slot_at(new_number_of_entries +
2514 group_number_of_entries); 2517 group_number_of_entries);
2515 RecordSlot(slot, slot, code); 2518 RecordSlot(slot, slot, obj);
2516 group_number_of_entries++; 2519 group_number_of_entries++;
2517 } 2520 }
2518 } 2521 }
2519 entries->set_number_of_entries( 2522 entries->set_number_of_entries(
2520 static_cast<DependentCode::DependencyGroup>(g), 2523 static_cast<DependentCode::DependencyGroup>(g),
2521 group_number_of_entries); 2524 group_number_of_entries);
2522 new_number_of_entries += group_number_of_entries; 2525 new_number_of_entries += group_number_of_entries;
2523 } 2526 }
2524 for (int i = new_number_of_entries; i < number_of_entries; i++) { 2527 for (int i = new_number_of_entries; i < number_of_entries; i++) {
2525 entries->clear_at(i); 2528 entries->clear_at(i);
(...skipping 1718 matching lines...) Expand 10 before | Expand all | Expand 10 after
4244 while (buffer != NULL) { 4247 while (buffer != NULL) {
4245 SlotsBuffer* next_buffer = buffer->next(); 4248 SlotsBuffer* next_buffer = buffer->next();
4246 DeallocateBuffer(buffer); 4249 DeallocateBuffer(buffer);
4247 buffer = next_buffer; 4250 buffer = next_buffer;
4248 } 4251 }
4249 *buffer_address = NULL; 4252 *buffer_address = NULL;
4250 } 4253 }
4251 4254
4252 4255
4253 } } // namespace v8::internal 4256 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698