Index: src/isolate.cc |
diff --git a/src/isolate.cc b/src/isolate.cc |
index 9d3511327e63dd8592c2a33f296e6cc0308d748b..066261b52b21447a1967d30197939cf8732d04ae 100644 |
--- a/src/isolate.cc |
+++ b/src/isolate.cc |
@@ -551,28 +551,16 @@ class CaptureStackTraceHelper { |
Handle<Script> script(Script::cast(fun->shared()->script())); |
if (!line_key_.is_null()) { |
- int script_line_offset = script->line_offset(); |
- int line_number = Script::GetLineNumber(script, position); |
- // line_number is already shifted by the script_line_offset. |
- int relative_line_number = line_number - script_line_offset; |
- if (!column_key_.is_null() && relative_line_number >= 0) { |
- Handle<FixedArray> line_ends(FixedArray::cast(script->line_ends())); |
- int start = |
- (relative_line_number == 0) |
- ? 0 |
- : Smi::cast(line_ends->get(relative_line_number - 1))->value() + |
- 1; |
- int column_offset = position - start; |
- if (relative_line_number == 0) { |
- // For the case where the code is on the same line as the script tag. |
- column_offset += script->column_offset(); |
- } |
+ Script::PositionInfo info; |
+ bool valid_pos = Script::GetPositionInfo(script, position, &info, true); |
Yang
2016/05/18 13:23:08
Can we pass an enum value instead of true/false? T
jgruber1
2016/05/19 08:05:24
Good point. Is there an easy way to define an enum
jgruber1
2016/05/19 08:56:01
And done, using the enum on C++ side only.
|
+ |
+ if (!column_key_.is_null() && valid_pos) { |
JSObject::AddProperty(stack_frame, column_key_, |
- handle(Smi::FromInt(column_offset + 1), isolate_), |
+ handle(Smi::FromInt(info.column + 1), isolate_), |
NONE); |
} |
JSObject::AddProperty(stack_frame, line_key_, |
- handle(Smi::FromInt(line_number + 1), isolate_), |
+ handle(Smi::FromInt(info.line + 1), isolate_), |
NONE); |
} |