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

Side by Side Diff: src/profile-generator.cc

Issue 6529055: [Isolates] Merge crankshaft (r5922 from bleeding_edge). (Closed)
Patch Set: Win32 port Created 9 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
« no previous file with comments | « src/prettyprinter.h ('k') | src/property.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 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 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 587 matching lines...) Expand 10 before | Expand all | Expand 10 after
598 } else { 598 } else {
599 return NULL; 599 return NULL;
600 } 600 }
601 List<CpuProfile*>* unabridged_list = 601 List<CpuProfile*>* unabridged_list =
602 profiles_by_token_[TokenToIndex(TokenEnumerator::kNoSecurityToken)]; 602 profiles_by_token_[TokenToIndex(TokenEnumerator::kNoSecurityToken)];
603 if (security_token_id == TokenEnumerator::kNoSecurityToken) { 603 if (security_token_id == TokenEnumerator::kNoSecurityToken) {
604 return unabridged_list->at(index); 604 return unabridged_list->at(index);
605 } 605 }
606 List<CpuProfile*>* list = GetProfilesList(security_token_id); 606 List<CpuProfile*>* list = GetProfilesList(security_token_id);
607 if (list->at(index) == NULL) { 607 if (list->at(index) == NULL) {
608 list->at(index) = 608 (*list)[index] =
609 unabridged_list->at(index)->FilteredClone(security_token_id); 609 unabridged_list->at(index)->FilteredClone(security_token_id);
610 } 610 }
611 return list->at(index); 611 return list->at(index);
612 } 612 }
613 613
614 614
615 bool CpuProfilesCollection::IsLastProfile(const char* title) { 615 bool CpuProfilesCollection::IsLastProfile(const char* title) {
616 // Called from VM thread, and only it can mutate the list, 616 // Called from VM thread, and only it can mutate the list,
617 // so no locking is needed here. 617 // so no locking is needed here.
618 if (current_profiles_.length() != 1) return false; 618 if (current_profiles_.length() != 1) return false;
619 return StrLength(title) == 0 619 return StrLength(title) == 0
(...skipping 28 matching lines...) Expand all
648 List<CpuProfile*>* CpuProfilesCollection::Profiles(int security_token_id) { 648 List<CpuProfile*>* CpuProfilesCollection::Profiles(int security_token_id) {
649 List<CpuProfile*>* unabridged_list = 649 List<CpuProfile*>* unabridged_list =
650 profiles_by_token_[TokenToIndex(TokenEnumerator::kNoSecurityToken)]; 650 profiles_by_token_[TokenToIndex(TokenEnumerator::kNoSecurityToken)];
651 if (security_token_id == TokenEnumerator::kNoSecurityToken) { 651 if (security_token_id == TokenEnumerator::kNoSecurityToken) {
652 return unabridged_list; 652 return unabridged_list;
653 } 653 }
654 List<CpuProfile*>* list = GetProfilesList(security_token_id); 654 List<CpuProfile*>* list = GetProfilesList(security_token_id);
655 const int current_count = unabridged_list->length(); 655 const int current_count = unabridged_list->length();
656 for (int i = 0; i < current_count; ++i) { 656 for (int i = 0; i < current_count; ++i) {
657 if (list->at(i) == NULL) { 657 if (list->at(i) == NULL) {
658 list->at(i) = unabridged_list->at(i)->FilteredClone(security_token_id); 658 (*list)[i] = unabridged_list->at(i)->FilteredClone(security_token_id);
659 } 659 }
660 } 660 }
661 return list; 661 return list;
662 } 662 }
663 663
664 664
665 CodeEntry* CpuProfilesCollection::NewCodeEntry(Logger::LogEventsAndTags tag, 665 CodeEntry* CpuProfilesCollection::NewCodeEntry(Logger::LogEventsAndTags tag,
666 String* name, 666 String* name,
667 String* resource_name, 667 String* resource_name,
668 int line_number) { 668 int line_number) {
(...skipping 731 matching lines...) Expand 10 before | Expand all | Expand 10 after
1400 if (children[i].type() == HeapGraphEdge::kShortcut) continue; 1400 if (children[i].type() == HeapGraphEdge::kShortcut) continue;
1401 HeapEntry* child = children[i].to(); 1401 HeapEntry* child = children[i].to();
1402 if (!child->painted_reachable()) { 1402 if (!child->painted_reachable()) {
1403 nodes_to_visit.Add(child); 1403 nodes_to_visit.Add(child);
1404 child->paint_reachable(); 1404 child->paint_reachable();
1405 has_new_edges = true; 1405 has_new_edges = true;
1406 } 1406 }
1407 } 1407 }
1408 if (!has_new_edges) { 1408 if (!has_new_edges) {
1409 entry->set_ordered_index(current_entry); 1409 entry->set_ordered_index(current_entry);
1410 entries->at(current_entry++) = entry; 1410 (*entries)[current_entry++] = entry;
1411 nodes_to_visit.RemoveLast(); 1411 nodes_to_visit.RemoveLast();
1412 } 1412 }
1413 } 1413 }
1414 entries->Truncate(current_entry); 1414 entries->Truncate(current_entry);
1415 } 1415 }
1416 1416
1417 1417
1418 static int Intersect(int i1, int i2, const Vector<HeapEntry*>& dominators) { 1418 static int Intersect(int i1, int i2, const Vector<HeapEntry*>& dominators) {
1419 int finger1 = i1, finger2 = i2; 1419 int finger1 = i1, finger2 = i2;
1420 while (finger1 != finger2) { 1420 while (finger1 != finger2) {
1421 while (finger1 < finger2) finger1 = dominators[finger1]->ordered_index(); 1421 while (finger1 < finger2) finger1 = dominators[finger1]->ordered_index();
1422 while (finger2 < finger1) finger2 = dominators[finger2]->ordered_index(); 1422 while (finger2 < finger1) finger2 = dominators[finger2]->ordered_index();
1423 } 1423 }
1424 return finger1; 1424 return finger1;
1425 } 1425 }
1426 1426
1427 // The algorithm is based on the article: 1427 // The algorithm is based on the article:
1428 // K. Cooper, T. Harvey and K. Kennedy "A Simple, Fast Dominance Algorithm" 1428 // K. Cooper, T. Harvey and K. Kennedy "A Simple, Fast Dominance Algorithm"
1429 // Softw. Pract. Exper. 4 (2001), pp. 1–10. 1429 // Softw. Pract. Exper. 4 (2001), pp. 1–10.
1430 void HeapSnapshot::BuildDominatorTree(const Vector<HeapEntry*>& entries, 1430 void HeapSnapshot::BuildDominatorTree(const Vector<HeapEntry*>& entries,
1431 Vector<HeapEntry*>* dominators) { 1431 Vector<HeapEntry*>* dominators) {
1432 if (entries.length() == 0) return; 1432 if (entries.length() == 0) return;
1433 const int root_index = entries.length() - 1; 1433 const int root_index = entries.length() - 1;
1434 for (int i = 0; i < root_index; ++i) dominators->at(i) = NULL; 1434 for (int i = 0; i < root_index; ++i) (*dominators)[i] = NULL;
1435 dominators->at(root_index) = entries[root_index]; 1435 (*dominators)[root_index] = entries[root_index];
1436 bool changed = true; 1436 bool changed = true;
1437 while (changed) { 1437 while (changed) {
1438 changed = false; 1438 changed = false;
1439 for (int i = root_index - 1; i >= 0; --i) { 1439 for (int i = root_index - 1; i >= 0; --i) {
1440 HeapEntry* new_idom = NULL; 1440 HeapEntry* new_idom = NULL;
1441 Vector<HeapGraphEdge*> rets = entries[i]->retainers(); 1441 Vector<HeapGraphEdge*> rets = entries[i]->retainers();
1442 int j = 0; 1442 int j = 0;
1443 for (; j < rets.length(); ++j) { 1443 for (; j < rets.length(); ++j) {
1444 if (rets[j]->type() == HeapGraphEdge::kShortcut) continue; 1444 if (rets[j]->type() == HeapGraphEdge::kShortcut) continue;
1445 HeapEntry* ret = rets[j]->From(); 1445 HeapEntry* ret = rets[j]->From();
1446 if (dominators->at(ret->ordered_index()) != NULL) { 1446 if (dominators->at(ret->ordered_index()) != NULL) {
1447 new_idom = ret; 1447 new_idom = ret;
1448 break; 1448 break;
1449 } 1449 }
1450 } 1450 }
1451 for (++j; j < rets.length(); ++j) { 1451 for (++j; j < rets.length(); ++j) {
1452 if (rets[j]->type() == HeapGraphEdge::kShortcut) continue; 1452 if (rets[j]->type() == HeapGraphEdge::kShortcut) continue;
1453 HeapEntry* ret = rets[j]->From(); 1453 HeapEntry* ret = rets[j]->From();
1454 if (dominators->at(ret->ordered_index()) != NULL) { 1454 if (dominators->at(ret->ordered_index()) != NULL) {
1455 new_idom = entries[Intersect(ret->ordered_index(), 1455 new_idom = entries[Intersect(ret->ordered_index(),
1456 new_idom->ordered_index(), 1456 new_idom->ordered_index(),
1457 *dominators)]; 1457 *dominators)];
1458 } 1458 }
1459 } 1459 }
1460 if (new_idom != NULL && dominators->at(i) != new_idom) { 1460 if (new_idom != NULL && dominators->at(i) != new_idom) {
1461 dominators->at(i) = new_idom; 1461 (*dominators)[i] = new_idom;
1462 changed = true; 1462 changed = true;
1463 } 1463 }
1464 } 1464 }
1465 } 1465 }
1466 } 1466 }
1467 1467
1468 1468
1469 void HeapSnapshot::SetDominatorsToSelf() { 1469 void HeapSnapshot::SetDominatorsToSelf() {
1470 for (int i = 0; i < entries_.length(); ++i) { 1470 for (int i = 0; i < entries_.length(); ++i) {
1471 HeapEntry* entry = entries_[i]; 1471 HeapEntry* entry = entries_[i];
(...skipping 1326 matching lines...) Expand 10 before | Expand all | Expand 10 after
2798 2798
2799 2799
2800 String* GetConstructorNameForHeapProfile(JSObject* object) { 2800 String* GetConstructorNameForHeapProfile(JSObject* object) {
2801 if (object->IsJSFunction()) return HEAP->closure_symbol(); 2801 if (object->IsJSFunction()) return HEAP->closure_symbol();
2802 return object->constructor_name(); 2802 return object->constructor_name();
2803 } 2803 }
2804 2804
2805 } } // namespace v8::internal 2805 } } // namespace v8::internal
2806 2806
2807 #endif // ENABLE_LOGGING_AND_PROFILING 2807 #endif // ENABLE_LOGGING_AND_PROFILING
OLDNEW
« no previous file with comments | « src/prettyprinter.h ('k') | src/property.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698