OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 20 matching lines...) Expand all Loading... |
31 #include "api.h" | 31 #include "api.h" |
32 #include "execution.h" | 32 #include "execution.h" |
33 #include "global-handles.h" | 33 #include "global-handles.h" |
34 #include "ic-inl.h" | 34 #include "ic-inl.h" |
35 #include "natives.h" | 35 #include "natives.h" |
36 #include "platform.h" | 36 #include "platform.h" |
37 #include "runtime.h" | 37 #include "runtime.h" |
38 #include "serialize.h" | 38 #include "serialize.h" |
39 #include "stub-cache.h" | 39 #include "stub-cache.h" |
40 #include "v8threads.h" | 40 #include "v8threads.h" |
| 41 #include "top.h" |
41 | 42 |
42 namespace v8 { | 43 namespace v8 { |
43 namespace internal { | 44 namespace internal { |
44 | 45 |
45 // 32-bit encoding: a RelativeAddress must be able to fit in a | 46 // 32-bit encoding: a RelativeAddress must be able to fit in a |
46 // pointer: it is encoded as an Address with (from LS to MS bits): | 47 // pointer: it is encoded as an Address with (from LS to MS bits): |
47 // - 2 bits identifying this as a HeapObject. | 48 // - 2 bits identifying this as a HeapObject. |
48 // - 4 bits to encode the AllocationSpace (including special values for | 49 // - 4 bits to encode the AllocationSpace (including special values for |
49 // code and fixed arrays in LO space) | 50 // code and fixed arrays in LO space) |
50 // - 27 bits identifying a word in the space, in one of three formats: | 51 // - 27 bits identifying a word in the space, in one of three formats: |
(...skipping 554 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
605 | 606 |
606 for (size_t i = 0; i < ARRAY_SIZE(stats_ref_table); ++i) { | 607 for (size_t i = 0; i < ARRAY_SIZE(stats_ref_table); ++i) { |
607 Add(reinterpret_cast<Address>( | 608 Add(reinterpret_cast<Address>( |
608 GetInternalPointer(stats_ref_table[i].counter)), | 609 GetInternalPointer(stats_ref_table[i].counter)), |
609 STATS_COUNTER, | 610 STATS_COUNTER, |
610 stats_ref_table[i].id, | 611 stats_ref_table[i].id, |
611 stats_ref_table[i].name); | 612 stats_ref_table[i].name); |
612 } | 613 } |
613 | 614 |
614 // Top addresses | 615 // Top addresses |
615 const char* top_address_format = "Top::get_address_from_id(%i)"; | 616 const char* top_address_format = "Top::%s"; |
616 size_t top_format_length = strlen(top_address_format); | 617 |
| 618 const char* AddressNames[] = { |
| 619 #define C(name) #name, |
| 620 TOP_ADDRESS_LIST(C) |
| 621 TOP_ADDRESS_LIST_PROF(C) |
| 622 NULL |
| 623 #undef C |
| 624 }; |
| 625 |
| 626 size_t top_format_length = strlen(top_address_format) - 2; |
617 for (uint16_t i = 0; i < Top::k_top_address_count; ++i) { | 627 for (uint16_t i = 0; i < Top::k_top_address_count; ++i) { |
618 Vector<char> name = Vector<char>::New(top_format_length + 1); | 628 const char* address_name = AddressNames[i]; |
| 629 Vector<char> name = |
| 630 Vector<char>::New(top_format_length + strlen(address_name) + 1); |
619 const char* chars = name.start(); | 631 const char* chars = name.start(); |
620 OS::SNPrintF(name, top_address_format, i); | 632 OS::SNPrintF(name, top_address_format, address_name); |
621 Add(Top::get_address_from_id((Top::AddressId)i), TOP_ADDRESS, i, chars); | 633 Add(Top::get_address_from_id((Top::AddressId)i), TOP_ADDRESS, i, chars); |
622 } | 634 } |
623 | 635 |
624 // Extensions | 636 // Extensions |
625 Add(FUNCTION_ADDR(GCExtension::GC), EXTENSION, 1, | 637 Add(FUNCTION_ADDR(GCExtension::GC), EXTENSION, 1, |
626 "GCExtension::GC"); | 638 "GCExtension::GC"); |
627 | 639 |
628 // Accessors | 640 // Accessors |
629 #define ACCESSOR_DESCRIPTOR_DECLARATION(name) \ | 641 #define ACCESSOR_DESCRIPTOR_DECLARATION(name) \ |
630 Add((Address)&Accessors::name, \ | 642 Add((Address)&Accessors::name, \ |
(...skipping 1091 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1722 ASSERT(index < large_objects_.length()); | 1734 ASSERT(index < large_objects_.length()); |
1723 } | 1735 } |
1724 return large_objects_[index]; // s.page_offset() is ignored. | 1736 return large_objects_[index]; // s.page_offset() is ignored. |
1725 } | 1737 } |
1726 UNREACHABLE(); | 1738 UNREACHABLE(); |
1727 return NULL; | 1739 return NULL; |
1728 } | 1740 } |
1729 | 1741 |
1730 | 1742 |
1731 } } // namespace v8::internal | 1743 } } // namespace v8::internal |
OLD | NEW |