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_java_script() && |
Michael Starzinger
2016/04/21 17:05:18
nit: Just "frame->is_interpreted()" is sufficient.
Yang
2016/04/22 05:03:39
Done.
| |
1332 int pos = frame->LookupCode()->SourcePosition(offset); | 1332 JavaScriptFrame::cast(frame)->is_interpreted()) { |
1333 InterpretedFrame* iframe = reinterpret_cast<InterpretedFrame*>(frame); | |
1334 pos = iframe->GetBytecodeArray()->SourcePosition( | |
1335 iframe->GetBytecodeOffset()); | |
1336 } else { | |
1337 Code* code = frame->LookupCode(); | |
1338 int offset = static_cast<int>(frame->pc() - code->instruction_start()); | |
1339 pos = frame->LookupCode()->SourcePosition(offset); | |
1340 } | |
1333 Handle<Object> pos_obj(Smi::FromInt(pos), this); | 1341 Handle<Object> pos_obj(Smi::FromInt(pos), this); |
1334 // Fetch function and receiver. | 1342 // Fetch function and receiver. |
1335 Handle<JSFunction> fun(frame->function()); | 1343 Handle<JSFunction> fun(frame->function()); |
1336 Handle<Object> recv(frame->receiver(), this); | 1344 Handle<Object> recv(frame->receiver(), this); |
1337 // Advance to the next JavaScript frame and determine if the | 1345 // Advance to the next JavaScript frame and determine if the |
1338 // current frame is the top-level frame. | 1346 // current frame is the top-level frame. |
1339 it.Advance(); | 1347 it.Advance(); |
1340 Handle<Object> is_top_level = factory()->ToBoolean(it.done()); | 1348 Handle<Object> is_top_level = factory()->ToBoolean(it.done()); |
1341 // Generate and print stack trace line. | 1349 // Generate and print stack trace line. |
1342 Handle<String> line = | 1350 Handle<String> line = |
(...skipping 1644 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2987 // Then check whether this scope intercepts. | 2995 // Then check whether this scope intercepts. |
2988 if ((flag & intercept_mask_)) { | 2996 if ((flag & intercept_mask_)) { |
2989 intercepted_flags_ |= flag; | 2997 intercepted_flags_ |= flag; |
2990 return true; | 2998 return true; |
2991 } | 2999 } |
2992 return false; | 3000 return false; |
2993 } | 3001 } |
2994 | 3002 |
2995 } // namespace internal | 3003 } // namespace internal |
2996 } // namespace v8 | 3004 } // namespace v8 |
OLD | NEW |