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

Side by Side Diff: src/profiler/tick-sample.cc

Issue 2151103002: [cpu-profiler] Do not record empty stack trace. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 5 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 | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/profiler/tick-sample.h" 5 #include "src/profiler/tick-sample.h"
6 6
7 #include "include/v8-profiler.h" 7 #include "include/v8-profiler.h"
8 #include "src/frames-inl.h" 8 #include "src/frames-inl.h"
9 #include "src/msan.h" 9 #include "src/msan.h"
10 #include "src/simulator.h" 10 #include "src/simulator.h"
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 // we have already entrered JavaScript again and the external callback 138 // we have already entrered JavaScript again and the external callback
139 // is not the top function. 139 // is not the top function.
140 if (scope && scope->scope_address() < handler) { 140 if (scope && scope->scope_address() < handler) {
141 sample_info->external_callback_entry = 141 sample_info->external_callback_entry =
142 *scope->callback_entrypoint_address(); 142 *scope->callback_entrypoint_address();
143 } 143 }
144 144
145 i::SafeStackFrameIterator it(isolate, reinterpret_cast<i::Address>(regs.fp), 145 i::SafeStackFrameIterator it(isolate, reinterpret_cast<i::Address>(regs.fp),
146 reinterpret_cast<i::Address>(regs.sp), 146 reinterpret_cast<i::Address>(regs.sp),
147 js_entry_sp); 147 js_entry_sp);
148
149 // If at this point iterator does not see any frames,
150 // is usually means something is wrong with the FP,
151 // e.g. it is used as a general purpose register in the function.
152 // Bailout.
153 if (it.done()) return false;
154
148 size_t i = 0; 155 size_t i = 0;
149 if (record_c_entry_frame == kIncludeCEntryFrame && !it.done() && 156 if (record_c_entry_frame == kIncludeCEntryFrame &&
150 (it.top_frame_type() == internal::StackFrame::EXIT || 157 (it.top_frame_type() == internal::StackFrame::EXIT ||
151 it.top_frame_type() == internal::StackFrame::BUILTIN_EXIT)) { 158 it.top_frame_type() == internal::StackFrame::BUILTIN_EXIT)) {
152 frames[i++] = isolate->c_function(); 159 frames[i++] = isolate->c_function();
153 } 160 }
154 while (!it.done() && i < frames_limit) { 161 for (; !it.done() && i < frames_limit; it.Advance()) {
155 if (it.frame()->is_interpreted()) { 162 if (!it.frame()->is_interpreted()) {
156 // For interpreted frames use the bytecode array pointer as the pc.
157 i::InterpretedFrame* frame =
158 static_cast<i::InterpretedFrame*>(it.frame());
159 // Since the sampler can interrupt execution at any point the
160 // bytecode_array might be garbage, so don't dereference it.
161 i::Address bytecode_array =
162 reinterpret_cast<i::Address>(frame->GetBytecodeArray()) -
163 i::kHeapObjectTag;
164 frames[i++] = bytecode_array + i::BytecodeArray::kHeaderSize +
165 frame->GetBytecodeOffset();
166 } else {
167 frames[i++] = it.frame()->pc(); 163 frames[i++] = it.frame()->pc();
164 continue;
168 } 165 }
169 it.Advance(); 166 // For interpreted frames use the bytecode array pointer as the pc.
167 i::InterpretedFrame* frame = static_cast<i::InterpretedFrame*>(it.frame());
168 // Since the sampler can interrupt execution at any point the
169 // bytecode_array might be garbage, so don't dereference it.
170 i::Address bytecode_array =
171 reinterpret_cast<i::Address>(frame->GetBytecodeArray()) -
172 i::kHeapObjectTag;
173 frames[i++] = bytecode_array + i::BytecodeArray::kHeaderSize +
174 frame->GetBytecodeOffset();
170 } 175 }
171 sample_info->frames_count = i; 176 sample_info->frames_count = i;
172 return true; 177 return true;
173 } 178 }
174 179
175 namespace internal { 180 namespace internal {
176 181
177 void TickSample::Init(Isolate* isolate, const v8::RegisterState& state, 182 void TickSample::Init(Isolate* isolate, const v8::RegisterState& state,
178 RecordCEntryFrame record_c_entry_frame, 183 RecordCEntryFrame record_c_entry_frame,
179 bool update_stats) { 184 bool update_stats) {
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 // it is not guaranteed to be atomic even when both host and target 237 // it is not guaranteed to be atomic even when both host and target
233 // are of same bitness. 238 // are of same bitness.
234 return false; 239 return false;
235 } 240 }
236 return true; 241 return true;
237 } 242 }
238 #endif // USE_SIMULATOR 243 #endif // USE_SIMULATOR
239 244
240 } // namespace internal 245 } // namespace internal
241 } // namespace v8 246 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698