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 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
309 if ((fun == caller) && !(*seen_caller)) { | 309 if ((fun == caller) && !(*seen_caller)) { |
310 *seen_caller = true; | 310 *seen_caller = true; |
311 return false; | 311 return false; |
312 } | 312 } |
313 // Skip all frames until we've seen the caller. | 313 // Skip all frames until we've seen the caller. |
314 if (!(*seen_caller)) return false; | 314 if (!(*seen_caller)) return false; |
315 // Functions defined in native scripts are not visible unless directly | 315 // Functions defined in native scripts are not visible unless directly |
316 // exposed, in which case the native flag is set. | 316 // exposed, in which case the native flag is set. |
317 // The --builtins-in-stack-traces command line flag allows including | 317 // The --builtins-in-stack-traces command line flag allows including |
318 // internal call sites in the stack trace for debugging purposes. | 318 // internal call sites in the stack trace for debugging purposes. |
319 if (!FLAG_builtins_in_stack_traces && fun->IsBuiltin()) { | 319 if (!FLAG_builtins_in_stack_traces && fun->shared()->IsBuiltin()) { |
320 return fun->shared()->native(); | 320 return fun->shared()->native(); |
321 } | 321 } |
322 return true; | 322 return true; |
323 } | 323 } |
324 | 324 |
325 | 325 |
326 Handle<Object> Isolate::CaptureSimpleStackTrace(Handle<JSObject> error_object, | 326 Handle<Object> Isolate::CaptureSimpleStackTrace(Handle<JSObject> error_object, |
327 Handle<Object> caller) { | 327 Handle<Object> caller) { |
328 // Get stack trace limit. | 328 // Get stack trace limit. |
329 Handle<JSObject> error = error_function(); | 329 Handle<JSObject> error = error_function(); |
(...skipping 1004 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1334 JSReceiver::GetDataProperty(Handle<JSObject>::cast(exception), key); | 1334 JSReceiver::GetDataProperty(Handle<JSObject>::cast(exception), key); |
1335 if (!property->IsJSArray()) return false; | 1335 if (!property->IsJSArray()) return false; |
1336 Handle<JSArray> simple_stack_trace = Handle<JSArray>::cast(property); | 1336 Handle<JSArray> simple_stack_trace = Handle<JSArray>::cast(property); |
1337 | 1337 |
1338 Handle<FixedArray> elements(FixedArray::cast(simple_stack_trace->elements())); | 1338 Handle<FixedArray> elements(FixedArray::cast(simple_stack_trace->elements())); |
1339 int elements_limit = Smi::cast(simple_stack_trace->length())->value(); | 1339 int elements_limit = Smi::cast(simple_stack_trace->length())->value(); |
1340 | 1340 |
1341 for (int i = 1; i < elements_limit; i += 4) { | 1341 for (int i = 1; i < elements_limit; i += 4) { |
1342 Handle<JSFunction> fun = | 1342 Handle<JSFunction> fun = |
1343 handle(JSFunction::cast(elements->get(i + 1)), this); | 1343 handle(JSFunction::cast(elements->get(i + 1)), this); |
1344 if (!fun->IsSubjectToDebugging()) continue; | 1344 if (!fun->shared()->IsSubjectToDebugging()) continue; |
1345 | 1345 |
1346 Object* script = fun->shared()->script(); | 1346 Object* script = fun->shared()->script(); |
1347 if (script->IsScript() && | 1347 if (script->IsScript() && |
1348 !(Script::cast(script)->source()->IsUndefined())) { | 1348 !(Script::cast(script)->source()->IsUndefined())) { |
1349 int pos = PositionFromStackTrace(elements, i); | 1349 int pos = PositionFromStackTrace(elements, i); |
1350 Handle<Script> casted_script(Script::cast(script)); | 1350 Handle<Script> casted_script(Script::cast(script)); |
1351 *target = MessageLocation(casted_script, pos, pos + 1); | 1351 *target = MessageLocation(casted_script, pos, pos + 1); |
1352 return true; | 1352 return true; |
1353 } | 1353 } |
1354 } | 1354 } |
(...skipping 1496 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2851 // Then check whether this scope intercepts. | 2851 // Then check whether this scope intercepts. |
2852 if ((flag & intercept_mask_)) { | 2852 if ((flag & intercept_mask_)) { |
2853 intercepted_flags_ |= flag; | 2853 intercepted_flags_ |= flag; |
2854 return true; | 2854 return true; |
2855 } | 2855 } |
2856 return false; | 2856 return false; |
2857 } | 2857 } |
2858 | 2858 |
2859 } // namespace internal | 2859 } // namespace internal |
2860 } // namespace v8 | 2860 } // namespace v8 |
OLD | NEW |