OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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/isolate.h" | 5 #include "src/isolate.h" |
6 | 6 |
7 #include <stdlib.h> | 7 #include <stdlib.h> |
8 | 8 |
9 #include <fstream> // NOLINT(readability/streams) | 9 #include <fstream> // NOLINT(readability/streams) |
10 #include <sstream> | 10 #include <sstream> |
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 static bool IsVisibleInStackTrace(JSFunction* fun, | 306 static bool IsVisibleInStackTrace(JSFunction* fun, |
307 Object* caller, | 307 Object* caller, |
308 Object* receiver, | 308 Object* receiver, |
309 bool* seen_caller) { | 309 bool* seen_caller) { |
310 if ((fun == caller) && !(*seen_caller)) { | 310 if ((fun == caller) && !(*seen_caller)) { |
311 *seen_caller = true; | 311 *seen_caller = true; |
312 return false; | 312 return false; |
313 } | 313 } |
314 // Skip all frames until we've seen the caller. | 314 // Skip all frames until we've seen the caller. |
315 if (!(*seen_caller)) return false; | 315 if (!(*seen_caller)) return false; |
316 // Also, skip non-visible built-in functions and any call with the builtins | 316 // Functions defined in native scripts are not visible unless directly |
317 // object as receiver, so as to not reveal either the builtins object or | 317 // exposed, in which case the native flag is set. |
318 // an internal function. | |
319 // The --builtins-in-stack-traces command line flag allows including | 318 // The --builtins-in-stack-traces command line flag allows including |
320 // internal call sites in the stack trace for debugging purposes. | 319 // internal call sites in the stack trace for debugging purposes. |
321 if (!FLAG_builtins_in_stack_traces) { | 320 if (!FLAG_builtins_in_stack_traces) { |
322 if (receiver->IsJSBuiltinsObject()) return false; | 321 if (receiver->IsJSBuiltinsObject()) return false; |
323 if (fun->IsBuiltin()) { | 322 if (fun->IsBuiltin()) return fun->shared()->native(); |
324 return fun->shared()->native(); | |
325 } else if (!fun->IsSubjectToDebugging()) { | |
326 return false; | |
327 } | |
328 } | 323 } |
329 return true; | 324 return true; |
330 } | 325 } |
331 | 326 |
332 | 327 |
333 Handle<Object> Isolate::CaptureSimpleStackTrace(Handle<JSObject> error_object, | 328 Handle<Object> Isolate::CaptureSimpleStackTrace(Handle<JSObject> error_object, |
334 Handle<Object> caller) { | 329 Handle<Object> caller) { |
335 // Get stack trace limit. | 330 // Get stack trace limit. |
336 Handle<JSObject> error = error_function(); | 331 Handle<JSObject> error = error_function(); |
337 Handle<String> stackTraceLimit = | 332 Handle<String> stackTraceLimit = |
(...skipping 2477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2815 // Then check whether this scope intercepts. | 2810 // Then check whether this scope intercepts. |
2816 if ((flag & intercept_mask_)) { | 2811 if ((flag & intercept_mask_)) { |
2817 intercepted_flags_ |= flag; | 2812 intercepted_flags_ |= flag; |
2818 return true; | 2813 return true; |
2819 } | 2814 } |
2820 return false; | 2815 return false; |
2821 } | 2816 } |
2822 | 2817 |
2823 } // namespace internal | 2818 } // namespace internal |
2824 } // namespace v8 | 2819 } // namespace v8 |
OLD | NEW |