| OLD | NEW |
| 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 447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 458 | 458 |
| 459 | 459 |
| 460 void CpuProfile::Print() { | 460 void CpuProfile::Print() { |
| 461 OS::Print("[Top down]:\n"); | 461 OS::Print("[Top down]:\n"); |
| 462 top_down_.Print(); | 462 top_down_.Print(); |
| 463 OS::Print("[Bottom up]:\n"); | 463 OS::Print("[Bottom up]:\n"); |
| 464 bottom_up_.Print(); | 464 bottom_up_.Print(); |
| 465 } | 465 } |
| 466 | 466 |
| 467 | 467 |
| 468 CodeEntry* const CodeMap::kSfiCodeEntry = NULL; | 468 CodeEntry* const CodeMap::kSharedFunctionCodeEntry = NULL; |
| 469 const CodeMap::CodeTreeConfig::Key CodeMap::CodeTreeConfig::kNoKey = NULL; | 469 const CodeMap::CodeTreeConfig::Key CodeMap::CodeTreeConfig::kNoKey = NULL; |
| 470 const CodeMap::CodeTreeConfig::Value CodeMap::CodeTreeConfig::kNoValue = | 470 const CodeMap::CodeTreeConfig::Value CodeMap::CodeTreeConfig::kNoValue = |
| 471 CodeMap::CodeEntryInfo(NULL, 0); | 471 CodeMap::CodeEntryInfo(NULL, 0); |
| 472 | 472 |
| 473 | 473 |
| 474 CodeEntry* CodeMap::FindEntry(Address addr) { | 474 CodeEntry* CodeMap::FindEntry(Address addr) { |
| 475 CodeTree::Locator locator; | 475 CodeTree::Locator locator; |
| 476 if (tree_.FindGreatestLessThan(addr, &locator)) { | 476 if (tree_.FindGreatestLessThan(addr, &locator)) { |
| 477 // locator.key() <= addr. Need to check that addr is within entry. | 477 // locator.key() <= addr. Need to check that addr is within entry. |
| 478 const CodeEntryInfo& entry = locator.value(); | 478 const CodeEntryInfo& entry = locator.value(); |
| 479 if (addr < (locator.key() + entry.size)) | 479 if (addr < (locator.key() + entry.size)) |
| 480 return entry.entry; | 480 return entry.entry; |
| 481 } | 481 } |
| 482 return NULL; | 482 return NULL; |
| 483 } | 483 } |
| 484 | 484 |
| 485 | 485 |
| 486 int CodeMap::GetSFITag(Address addr) { | 486 int CodeMap::GetSharedId(Address addr) { |
| 487 CodeTree::Locator locator; | 487 CodeTree::Locator locator; |
| 488 // For SFI entries, 'size' field is used to store their IDs. | 488 // For shared function entries, 'size' field is used to store their IDs. |
| 489 if (tree_.Find(addr, &locator)) { | 489 if (tree_.Find(addr, &locator)) { |
| 490 const CodeEntryInfo& entry = locator.value(); | 490 const CodeEntryInfo& entry = locator.value(); |
| 491 ASSERT(entry.entry == kSfiCodeEntry); | 491 ASSERT(entry.entry == kSharedFunctionCodeEntry); |
| 492 return entry.size; | 492 return entry.size; |
| 493 } else { | 493 } else { |
| 494 tree_.Insert(addr, &locator); | 494 tree_.Insert(addr, &locator); |
| 495 int tag = next_sfi_tag_++; | 495 int id = next_shared_id_++; |
| 496 locator.set_value(CodeEntryInfo(kSfiCodeEntry, tag)); | 496 locator.set_value(CodeEntryInfo(kSharedFunctionCodeEntry, id)); |
| 497 return tag; | 497 return id; |
| 498 } | 498 } |
| 499 } | 499 } |
| 500 | 500 |
| 501 | 501 |
| 502 void CodeMap::CodeTreePrinter::Call( | 502 void CodeMap::CodeTreePrinter::Call( |
| 503 const Address& key, const CodeMap::CodeEntryInfo& value) { | 503 const Address& key, const CodeMap::CodeEntryInfo& value) { |
| 504 OS::Print("%p %5d %s\n", key, value.size, value.entry->name()); | 504 OS::Print("%p %5d %s\n", key, value.size, value.entry->name()); |
| 505 } | 505 } |
| 506 | 506 |
| 507 | 507 |
| (...skipping 2382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2890 | 2890 |
| 2891 | 2891 |
| 2892 String* GetConstructorNameForHeapProfile(JSObject* object) { | 2892 String* GetConstructorNameForHeapProfile(JSObject* object) { |
| 2893 if (object->IsJSFunction()) return Heap::closure_symbol(); | 2893 if (object->IsJSFunction()) return Heap::closure_symbol(); |
| 2894 return object->constructor_name(); | 2894 return object->constructor_name(); |
| 2895 } | 2895 } |
| 2896 | 2896 |
| 2897 } } // namespace v8::internal | 2897 } } // namespace v8::internal |
| 2898 | 2898 |
| 2899 #endif // ENABLE_LOGGING_AND_PROFILING | 2899 #endif // ENABLE_LOGGING_AND_PROFILING |
| OLD | NEW |