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

Side by Side Diff: src/frames.cc

Issue 62146: Add name inference for anonymous functions to facilitate debugging and profiling of JS code. (Closed)
Patch Set: updated v8_base_arm project Created 11 years, 8 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/frames.h ('k') | src/frames-arm.cc » ('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 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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 StackFrameIterator::StackFrameIterator(bool use_top, Address fp, Address sp) 79 StackFrameIterator::StackFrameIterator(bool use_top, Address fp, Address sp)
80 : STACK_FRAME_TYPE_LIST(INITIALIZE_SINGLETON) 80 : STACK_FRAME_TYPE_LIST(INITIALIZE_SINGLETON)
81 frame_(NULL), handler_(NULL), 81 frame_(NULL), handler_(NULL),
82 thread_(use_top ? Top::GetCurrentThread() : NULL), 82 thread_(use_top ? Top::GetCurrentThread() : NULL),
83 fp_(use_top ? NULL : fp), sp_(sp), 83 fp_(use_top ? NULL : fp), sp_(sp),
84 advance_(use_top ? &StackFrameIterator::AdvanceWithHandler : 84 advance_(use_top ? &StackFrameIterator::AdvanceWithHandler :
85 &StackFrameIterator::AdvanceWithoutHandler) { 85 &StackFrameIterator::AdvanceWithoutHandler) {
86 if (use_top || fp != NULL) { 86 if (use_top || fp != NULL) {
87 Reset(); 87 Reset();
88 } 88 }
89 JavaScriptFrame_.DisableHeapAccess();
90 } 89 }
91 90
92 #undef INITIALIZE_SINGLETON 91 #undef INITIALIZE_SINGLETON
93 92
94 93
95 void StackFrameIterator::AdvanceWithHandler() { 94 void StackFrameIterator::AdvanceWithHandler() {
96 ASSERT(!done()); 95 ASSERT(!done());
97 // Compute the state of the calling frame before restoring 96 // Compute the state of the calling frame before restoring
98 // callee-saved registers and unwinding handlers. This allows the 97 // callee-saved registers and unwinding handlers. This allows the
99 // frame code that computes the caller state to access the top 98 // frame code that computes the caller state to access the top
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 bool SafeStackFrameIterator::CanIterateHandles(StackFrame* frame, 224 bool SafeStackFrameIterator::CanIterateHandles(StackFrame* frame,
226 StackHandler* handler) { 225 StackHandler* handler) {
227 // If StackIterator iterates over StackHandles, verify that 226 // If StackIterator iterates over StackHandles, verify that
228 // StackHandlerIterator can be instantiated (see StackHandlerIterator 227 // StackHandlerIterator can be instantiated (see StackHandlerIterator
229 // constructor.) 228 // constructor.)
230 return !is_valid_top_ || (frame->sp() <= handler->address()); 229 return !is_valid_top_ || (frame->sp() <= handler->address());
231 } 230 }
232 231
233 232
234 bool SafeStackFrameIterator::IsValidFrame(StackFrame* frame) const { 233 bool SafeStackFrameIterator::IsValidFrame(StackFrame* frame) const {
235 return IsValidStackAddress(frame->sp()) && IsValidStackAddress(frame->fp()); 234 return IsValidStackAddress(frame->sp()) && IsValidStackAddress(frame->fp()) &&
235 // JavaScriptFrame uses function shared info to advance, hence it must
236 // point to a valid function object.
237 (!frame->is_java_script() ||
238 reinterpret_cast<JavaScriptFrame*>(frame)->is_at_function());
236 } 239 }
237 240
238 241
239 bool SafeStackFrameIterator::IsValidCaller(StackFrame* frame) { 242 bool SafeStackFrameIterator::IsValidCaller(StackFrame* frame) {
240 StackFrame::State state; 243 StackFrame::State state;
241 if (frame->is_entry() || frame->is_entry_construct()) { 244 if (frame->is_entry() || frame->is_entry_construct()) {
242 // See EntryFrame::GetCallerState. It computes the caller FP address 245 // See EntryFrame::GetCallerState. It computes the caller FP address
243 // and calls ExitFrame::GetStateForFramePointer on it. We need to be 246 // and calls ExitFrame::GetStateForFramePointer on it. We need to be
244 // sure that caller FP address is valid. 247 // sure that caller FP address is valid.
245 Address caller_fp = Memory::Address_at( 248 Address caller_fp = Memory::Address_at(
(...skipping 25 matching lines...) Expand all
271 } 274 }
272 275
273 276
274 // ------------------------------------------------------------------------- 277 // -------------------------------------------------------------------------
275 278
276 279
277 #ifdef ENABLE_LOGGING_AND_PROFILING 280 #ifdef ENABLE_LOGGING_AND_PROFILING
278 SafeStackTraceFrameIterator::SafeStackTraceFrameIterator( 281 SafeStackTraceFrameIterator::SafeStackTraceFrameIterator(
279 Address fp, Address sp, Address low_bound, Address high_bound) : 282 Address fp, Address sp, Address low_bound, Address high_bound) :
280 SafeJavaScriptFrameIterator(fp, sp, low_bound, high_bound) { 283 SafeJavaScriptFrameIterator(fp, sp, low_bound, high_bound) {
281 if (!done() && !frame()->is_java_script()) Advance(); 284 if (!done() && !frame()->is_at_function()) Advance();
282 } 285 }
283 286
284 287
285 void SafeStackTraceFrameIterator::Advance() { 288 void SafeStackTraceFrameIterator::Advance() {
286 while (true) { 289 while (true) {
287 SafeJavaScriptFrameIterator::Advance(); 290 SafeJavaScriptFrameIterator::Advance();
288 if (done()) return; 291 if (done()) return;
289 if (frame()->is_java_script()) return; 292 if (frame()->is_at_function()) return;
290 } 293 }
291 } 294 }
292 #endif 295 #endif
293 296
294 297
295 // ------------------------------------------------------------------------- 298 // -------------------------------------------------------------------------
296 299
297 300
298 void StackHandler::Cook(Code* code) { 301 void StackHandler::Cook(Code* code) {
299 ASSERT(MarkCompactCollector::IsCompacting()); 302 ASSERT(MarkCompactCollector::IsCompacting());
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after
731 reg_code[i++] = r; 734 reg_code[i++] = r;
732 735
733 ASSERT(i == kNumJSCallerSaved); 736 ASSERT(i == kNumJSCallerSaved);
734 } 737 }
735 ASSERT(0 <= n && n < kNumJSCallerSaved); 738 ASSERT(0 <= n && n < kNumJSCallerSaved);
736 return reg_code[n]; 739 return reg_code[n];
737 } 740 }
738 741
739 742
740 } } // namespace v8::internal 743 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/frames.h ('k') | src/frames-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698