OLD | NEW |
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 892 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
903 // Allocate space for stack frames + pc + function + vm-state. | 903 // Allocate space for stack frames + pc + function + vm-state. |
904 ScopedVector<CodeEntry*> entries(sample.frames_count + 3); | 904 ScopedVector<CodeEntry*> entries(sample.frames_count + 3); |
905 // As actual number of decoded code entries may vary, initialize | 905 // As actual number of decoded code entries may vary, initialize |
906 // entries vector with NULL values. | 906 // entries vector with NULL values. |
907 CodeEntry** entry = entries.start(); | 907 CodeEntry** entry = entries.start(); |
908 memset(entry, 0, entries.length() * sizeof(*entry)); | 908 memset(entry, 0, entries.length() * sizeof(*entry)); |
909 if (sample.pc != NULL) { | 909 if (sample.pc != NULL) { |
910 Address start; | 910 Address start; |
911 CodeEntry* pc_entry = code_map_.FindEntry(sample.pc, &start); | 911 CodeEntry* pc_entry = code_map_.FindEntry(sample.pc, &start); |
912 // If pc is in the function code before it set up stack frame or after the | 912 // If pc is in the function code before it set up stack frame or after the |
913 // frame was destroyed SafeStackTraceFrameIterator incorrectly thinks that | 913 // frame was destroyed SafeStackFrameIterator incorrectly thinks that |
914 // ebp contains return address of the current function and skips caller's | 914 // ebp contains return address of the current function and skips caller's |
915 // frame. Check for this case and just skip such samples. | 915 // frame. Check for this case and just skip such samples. |
916 if (pc_entry) { | 916 if (pc_entry) { |
917 List<OffsetRange>* ranges = pc_entry->no_frame_ranges(); | 917 List<OffsetRange>* ranges = pc_entry->no_frame_ranges(); |
918 if (ranges) { | 918 if (ranges) { |
919 Code* code = Code::cast(HeapObject::FromAddress(start)); | 919 Code* code = Code::cast(HeapObject::FromAddress(start)); |
920 int pc_offset = static_cast<int>(sample.pc - code->instruction_start()); | 920 int pc_offset = static_cast<int>(sample.pc - code->instruction_start()); |
921 for (int i = 0; i < ranges->length(); i++) { | 921 for (int i = 0; i < ranges->length(); i++) { |
922 OffsetRange& range = ranges->at(i); | 922 OffsetRange& range = ranges->at(i); |
923 if (range.from <= pc_offset && pc_offset < range.to) { | 923 if (range.from <= pc_offset && pc_offset < range.to) { |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
956 if (no_symbolized_entries) { | 956 if (no_symbolized_entries) { |
957 *entry++ = EntryForVMState(sample.state); | 957 *entry++ = EntryForVMState(sample.state); |
958 } | 958 } |
959 } | 959 } |
960 | 960 |
961 profiles_->AddPathToCurrentProfiles(entries); | 961 profiles_->AddPathToCurrentProfiles(entries); |
962 } | 962 } |
963 | 963 |
964 | 964 |
965 } } // namespace v8::internal | 965 } } // namespace v8::internal |
OLD | NEW |