| 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 12707 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12718 SMI_VALUE(ends->get(info->line - 1)) < position); | 12718 SMI_VALUE(ends->get(info->line - 1)) < position); |
| 12719 info->line_start = SMI_VALUE(ends->get(info->line - 1)) + 1; | 12719 info->line_start = SMI_VALUE(ends->get(info->line - 1)) + 1; |
| 12720 info->column = position - info->line_start; | 12720 info->column = position - info->line_start; |
| 12721 } | 12721 } |
| 12722 | 12722 |
| 12723 // Line end is position of the linebreak character. | 12723 // Line end is position of the linebreak character. |
| 12724 info->line_end = SMI_VALUE(ends->get(info->line)); | 12724 info->line_end = SMI_VALUE(ends->get(info->line)); |
| 12725 if (info->line_end > 0) { | 12725 if (info->line_end > 0) { |
| 12726 DCHECK(script->source()->IsString()); | 12726 DCHECK(script->source()->IsString()); |
| 12727 Handle<String> src(String::cast(script->source())); | 12727 Handle<String> src(String::cast(script->source())); |
| 12728 if (src->Get(info->line_end - 1) == '\r') { | 12728 if (src->length() >= info->line_end && |
| 12729 src->Get(info->line_end - 1) == '\r') { |
| 12729 info->line_end--; | 12730 info->line_end--; |
| 12730 } | 12731 } |
| 12731 } | 12732 } |
| 12732 | 12733 |
| 12733 // Add offsets if requested. | 12734 // Add offsets if requested. |
| 12734 if (offset_flag == WITH_OFFSET) { | 12735 if (offset_flag == WITH_OFFSET) { |
| 12735 if (info->line == 0) { | 12736 if (info->line == 0) { |
| 12736 info->column += script->column_offset(); | 12737 info->column += script->column_offset(); |
| 12737 } | 12738 } |
| 12738 info->line += script->line_offset(); | 12739 info->line += script->line_offset(); |
| (...skipping 6113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 18852 } else { | 18853 } else { |
| 18853 // Old-style generators. | 18854 // Old-style generators. |
| 18854 int offset = continuation(); | 18855 int offset = continuation(); |
| 18855 CHECK(0 <= offset && offset < function()->code()->instruction_size()); | 18856 CHECK(0 <= offset && offset < function()->code()->instruction_size()); |
| 18856 return function()->code()->SourcePosition(offset); | 18857 return function()->code()->SourcePosition(offset); |
| 18857 } | 18858 } |
| 18858 } | 18859 } |
| 18859 | 18860 |
| 18860 } // namespace internal | 18861 } // namespace internal |
| 18861 } // namespace v8 | 18862 } // namespace v8 |
| OLD | NEW |