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

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: Address comments. 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 2351 matching lines...) Expand 10 before | Expand all | Expand 10 after
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::ClearAndDeoptimizeDependentCodes(Map* map) {
2370 AssertNoAllocation no_allocation_scope; 2370 AssertNoAllocation no_allocation_scope;
2371 DependentCodes* codes = map->dependent_codes(); 2371 DependentCodes* codes = map->dependent_codes();
2372 DependentCodes::GroupStartIndexes starts; 2372 DependentCodes::GroupStartIndexes starts(codes);
2373 codes->ComputeGroupStartIndexes(starts); 2373 int number_of_codes = starts.at(DependentCodes::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_codes(DependentCodes::cast(heap()->empty_fixed_array()));
2384 } 2383 }
2385 2384
2386 2385
2387 void MarkCompactCollector::ClearNonLiveDependentCodes(Map* map) { 2386 void MarkCompactCollector::ClearNonLiveDependentCodes(Map* map) {
2388 AssertNoAllocation no_allocation_scope; 2387 AssertNoAllocation no_allocation_scope;
2389 DependentCodes* codes = map->dependent_codes(); 2388 DependentCodes* codes = map->dependent_codes();
2390 DependentCodes::GroupStartIndexes starts; 2389 DependentCodes::GroupStartIndexes starts(codes);
2391 codes->ComputeGroupStartIndexes(starts); 2390 int number_of_codes = starts.at(DependentCodes::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 < DependentCodes::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 }
(...skipping 1674 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