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