| OLD | NEW |
| 1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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/objects.h" | 5 #include "src/objects.h" |
| 6 | 6 |
| 7 #include <cmath> | 7 #include <cmath> |
| 8 #include <iomanip> | 8 #include <iomanip> |
| 9 #include <sstream> | 9 #include <sstream> |
| 10 | 10 |
| (...skipping 12729 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12740 SMI_VALUE(ends->get(info->line - 1)) < position); | 12740 SMI_VALUE(ends->get(info->line - 1)) < position); |
| 12741 info->line_start = SMI_VALUE(ends->get(info->line - 1)) + 1; | 12741 info->line_start = SMI_VALUE(ends->get(info->line - 1)) + 1; |
| 12742 info->column = position - info->line_start; | 12742 info->column = position - info->line_start; |
| 12743 } | 12743 } |
| 12744 | 12744 |
| 12745 // Line end is position of the linebreak character. | 12745 // Line end is position of the linebreak character. |
| 12746 info->line_end = SMI_VALUE(ends->get(info->line)); | 12746 info->line_end = SMI_VALUE(ends->get(info->line)); |
| 12747 if (info->line_end > 0) { | 12747 if (info->line_end > 0) { |
| 12748 DCHECK(script->source()->IsString()); | 12748 DCHECK(script->source()->IsString()); |
| 12749 Handle<String> src(String::cast(script->source())); | 12749 Handle<String> src(String::cast(script->source())); |
| 12750 if (src->Get(info->line_end - 1) == '\r') { | 12750 if (src->length() >= info->line_end && |
| 12751 src->Get(info->line_end - 1) == '\r') { |
| 12751 info->line_end--; | 12752 info->line_end--; |
| 12752 } | 12753 } |
| 12753 } | 12754 } |
| 12754 | 12755 |
| 12755 // Add offsets if requested. | 12756 // Add offsets if requested. |
| 12756 if (offset_flag == WITH_OFFSET) { | 12757 if (offset_flag == WITH_OFFSET) { |
| 12757 if (info->line == 0) { | 12758 if (info->line == 0) { |
| 12758 info->column += script->column_offset(); | 12759 info->column += script->column_offset(); |
| 12759 } | 12760 } |
| 12760 info->line += script->line_offset(); | 12761 info->line += script->line_offset(); |
| (...skipping 6073 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 18834 } else { | 18835 } else { |
| 18835 // Old-style generators. | 18836 // Old-style generators. |
| 18836 int offset = continuation(); | 18837 int offset = continuation(); |
| 18837 CHECK(0 <= offset && offset < function()->code()->instruction_size()); | 18838 CHECK(0 <= offset && offset < function()->code()->instruction_size()); |
| 18838 return function()->code()->SourcePosition(offset); | 18839 return function()->code()->SourcePosition(offset); |
| 18839 } | 18840 } |
| 18840 } | 18841 } |
| 18841 | 18842 |
| 18842 } // namespace internal | 18843 } // namespace internal |
| 18843 } // namespace v8 | 18844 } // namespace v8 |
| OLD | NEW |