Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1249)

Unified Diff: src/top.cc

Issue 2049004: Fixes bug with v8::StackTrace for non-zero script line offsets... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 10 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | test/cctest/test-api.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/top.cc
===================================================================
--- src/top.cc (revision 4622)
+++ src/top.cc (working copy)
@@ -394,21 +394,20 @@
int script_line_offset = script->line_offset()->value();
int position = frame->code()->SourcePosition(frame->pc());
int line_number = GetScriptLineNumber(Handle<Script>(script), position);
-
- if (options & StackTrace::kColumnOffset) {
+ // line_number is already shifted by the script_line_offset.
+ int relative_line_number = line_number - script_line_offset;
+ if (options & StackTrace::kColumnOffset && relative_line_number >= 0) {
Handle<FixedArray> line_ends(FixedArray::cast(script->line_ends()));
- int start = (line_number == 0) ?
- 0 : Smi::cast(line_ends->get(line_number - 1))->value() + 1;
+ int start = (relative_line_number == 0) ? 0 :
+ Smi::cast(line_ends->get(relative_line_number - 1))->value() + 1;
int column_offset = position - start;
- if (line_number == script_line_offset) {
+ if (relative_line_number == 0) {
// For the case where the code is on the same line as the script tag.
- column_offset += script_line_offset;
+ column_offset += script->column_offset()->value();
}
SetProperty(stackFrame, column_key,
Handle<Smi>(Smi::FromInt(column_offset + 1)), NONE);
}
- // Adjust the line_number by the offset in the parent resource.
- line_number += script_line_offset;
SetProperty(stackFrame, line_key,
Handle<Smi>(Smi::FromInt(line_number + 1)), NONE);
}
@@ -420,7 +419,7 @@
if (options & StackTrace::kFunctionName) {
Handle<Object> fun_name(fun->shared()->name());
- if (!fun_name->IsString()) {
+ if (fun_name->ToBoolean()->IsFalse()) {
fun_name = Handle<Object>(fun->shared()->inferred_name());
}
SetProperty(stackFrame, function_key, fun_name, NONE);
« no previous file with comments | « no previous file | test/cctest/test-api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698