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 1485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1496 StackTraceFrameIterator it(this); | 1496 StackTraceFrameIterator it(this); |
1497 if (it.done()) return false; | 1497 if (it.done()) return false; |
1498 StandardFrame* frame = it.frame(); | 1498 StandardFrame* frame = it.frame(); |
1499 // Compute the location from the function and the relocation info of the | 1499 // Compute the location from the function and the relocation info of the |
1500 // baseline code. For optimized code this will use the deoptimization | 1500 // baseline code. For optimized code this will use the deoptimization |
1501 // information to get canonical location information. | 1501 // information to get canonical location information. |
1502 List<FrameSummary> frames(FLAG_max_inlining_levels + 1); | 1502 List<FrameSummary> frames(FLAG_max_inlining_levels + 1); |
1503 frame->Summarize(&frames); | 1503 frame->Summarize(&frames); |
1504 FrameSummary& summary = frames.last(); | 1504 FrameSummary& summary = frames.last(); |
1505 int pos = summary.SourcePosition(); | 1505 int pos = summary.SourcePosition(); |
1506 Handle<JSFunction> fun; | 1506 Handle<SharedFunctionInfo> shared; |
1507 Handle<Object> script = summary.script(); | 1507 Handle<Object> script = summary.script(); |
1508 if (!script->IsScript() || | 1508 if (!script->IsScript() || |
1509 (Script::cast(*script)->source()->IsUndefined(this))) { | 1509 (Script::cast(*script)->source()->IsUndefined(this))) { |
1510 return false; | 1510 return false; |
1511 } | 1511 } |
1512 | 1512 |
1513 // TODO(wasm): Remove this once trap-if is always on. | 1513 // TODO(wasm): Remove this once trap-if is always on. |
1514 // Background: Without trap-if, the information on the stack trace is | 1514 // Background: Without trap-if, the information on the stack trace is |
1515 // incomplete (see bug v8:5007). | 1515 // incomplete (see bug v8:5007). |
1516 if (summary.IsWasmCompiled() && !FLAG_wasm_trap_if) return false; | 1516 if (summary.IsWasmCompiled() && !FLAG_wasm_trap_if) return false; |
1517 | 1517 |
1518 if (summary.IsJavaScript()) fun = summary.AsJavaScript().function(); | 1518 if (summary.IsJavaScript()) { |
1519 *target = MessageLocation(Handle<Script>::cast(script), pos, pos + 1, fun); | 1519 shared = handle(summary.AsJavaScript().function()->shared()); |
| 1520 } |
| 1521 *target = MessageLocation(Handle<Script>::cast(script), pos, pos + 1, shared); |
1520 return true; | 1522 return true; |
1521 } | 1523 } |
1522 | 1524 |
1523 bool Isolate::ComputeLocationFromException(MessageLocation* target, | 1525 bool Isolate::ComputeLocationFromException(MessageLocation* target, |
1524 Handle<Object> exception) { | 1526 Handle<Object> exception) { |
1525 if (!exception->IsJSObject()) return false; | 1527 if (!exception->IsJSObject()) return false; |
1526 | 1528 |
1527 Handle<Name> start_pos_symbol = factory()->error_start_pos_symbol(); | 1529 Handle<Name> start_pos_symbol = factory()->error_start_pos_symbol(); |
1528 Handle<Object> start_pos = JSReceiver::GetDataProperty( | 1530 Handle<Object> start_pos = JSReceiver::GetDataProperty( |
1529 Handle<JSObject>::cast(exception), start_pos_symbol); | 1531 Handle<JSObject>::cast(exception), start_pos_symbol); |
(...skipping 2124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3654 // Then check whether this scope intercepts. | 3656 // Then check whether this scope intercepts. |
3655 if ((flag & intercept_mask_)) { | 3657 if ((flag & intercept_mask_)) { |
3656 intercepted_flags_ |= flag; | 3658 intercepted_flags_ |= flag; |
3657 return true; | 3659 return true; |
3658 } | 3660 } |
3659 return false; | 3661 return false; |
3660 } | 3662 } |
3661 | 3663 |
3662 } // namespace internal | 3664 } // namespace internal |
3663 } // namespace v8 | 3665 } // namespace v8 |
OLD | NEW |