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 1309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1320 return ReThrow(thrown); | 1320 return ReThrow(thrown); |
1321 } | 1321 } |
1322 | 1322 |
1323 | 1323 |
1324 void Isolate::PrintCurrentStackTrace(FILE* out) { | 1324 void Isolate::PrintCurrentStackTrace(FILE* out) { |
1325 StackTraceFrameIterator it(this); | 1325 StackTraceFrameIterator it(this); |
1326 while (!it.done()) { | 1326 while (!it.done()) { |
1327 HandleScope scope(this); | 1327 HandleScope scope(this); |
1328 // Find code position if recorded in relocation info. | 1328 // Find code position if recorded in relocation info. |
1329 StandardFrame* frame = it.frame(); | 1329 StandardFrame* frame = it.frame(); |
1330 Code* code = frame->LookupCode(); | 1330 int pos; |
1331 int offset = static_cast<int>(frame->pc() - code->instruction_start()); | 1331 if (frame->is_interpreted()) { |
1332 int pos = frame->LookupCode()->SourcePosition(offset); | 1332 InterpretedFrame* iframe = reinterpret_cast<InterpretedFrame*>(frame); |
| 1333 pos = iframe->GetBytecodeArray()->SourcePosition( |
| 1334 iframe->GetBytecodeOffset()); |
| 1335 } else { |
| 1336 Code* code = frame->LookupCode(); |
| 1337 int offset = static_cast<int>(frame->pc() - code->instruction_start()); |
| 1338 pos = frame->LookupCode()->SourcePosition(offset); |
| 1339 } |
1333 Handle<Object> pos_obj(Smi::FromInt(pos), this); | 1340 Handle<Object> pos_obj(Smi::FromInt(pos), this); |
1334 // Fetch function and receiver. | 1341 // Fetch function and receiver. |
1335 Handle<JSFunction> fun(frame->function()); | 1342 Handle<JSFunction> fun(frame->function()); |
1336 Handle<Object> recv(frame->receiver(), this); | 1343 Handle<Object> recv(frame->receiver(), this); |
1337 // Advance to the next JavaScript frame and determine if the | 1344 // Advance to the next JavaScript frame and determine if the |
1338 // current frame is the top-level frame. | 1345 // current frame is the top-level frame. |
1339 it.Advance(); | 1346 it.Advance(); |
1340 Handle<Object> is_top_level = factory()->ToBoolean(it.done()); | 1347 Handle<Object> is_top_level = factory()->ToBoolean(it.done()); |
1341 // Generate and print stack trace line. | 1348 // Generate and print stack trace line. |
1342 Handle<String> line = | 1349 Handle<String> line = |
(...skipping 1644 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2987 // Then check whether this scope intercepts. | 2994 // Then check whether this scope intercepts. |
2988 if ((flag & intercept_mask_)) { | 2995 if ((flag & intercept_mask_)) { |
2989 intercepted_flags_ |= flag; | 2996 intercepted_flags_ |= flag; |
2990 return true; | 2997 return true; |
2991 } | 2998 } |
2992 return false; | 2999 return false; |
2993 } | 3000 } |
2994 | 3001 |
2995 } // namespace internal | 3002 } // namespace internal |
2996 } // namespace v8 | 3003 } // namespace v8 |
OLD | NEW |