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