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 <stdlib.h> | 5 #include <stdlib.h> |
6 | 6 |
7 #include <fstream> // NOLINT(readability/streams) | 7 #include <fstream> // NOLINT(readability/streams) |
8 #include <sstream> | 8 #include <sstream> |
9 | 9 |
10 #include "src/v8.h" | 10 #include "src/v8.h" |
(...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
504 factory()->NewJSObject(isolate_->object_function()); | 504 factory()->NewJSObject(isolate_->object_function()); |
505 | 505 |
506 Handle<Script> script(Script::cast(fun->shared()->script())); | 506 Handle<Script> script(Script::cast(fun->shared()->script())); |
507 | 507 |
508 if (!line_key_.is_null()) { | 508 if (!line_key_.is_null()) { |
509 int script_line_offset = script->line_offset()->value(); | 509 int script_line_offset = script->line_offset()->value(); |
510 int line_number = Script::GetLineNumber(script, position); | 510 int line_number = Script::GetLineNumber(script, position); |
511 // line_number is already shifted by the script_line_offset. | 511 // line_number is already shifted by the script_line_offset. |
512 int relative_line_number = line_number - script_line_offset; | 512 int relative_line_number = line_number - script_line_offset; |
513 if (!column_key_.is_null() && relative_line_number >= 0) { | 513 if (!column_key_.is_null() && relative_line_number >= 0) { |
514 int column = Script::GetColumnNumber(script, position); | 514 Handle<FixedArray> line_ends(FixedArray::cast(script->line_ends())); |
| 515 int start = (relative_line_number == 0) ? 0 : |
| 516 Smi::cast(line_ends->get(relative_line_number - 1))->value() + 1; |
| 517 int column_offset = position - start; |
| 518 if (relative_line_number == 0) { |
| 519 // For the case where the code is on the same line as the script |
| 520 // tag. |
| 521 column_offset += script->column_offset()->value(); |
| 522 } |
515 JSObject::AddProperty(stack_frame, column_key_, | 523 JSObject::AddProperty(stack_frame, column_key_, |
516 handle(Smi::FromInt(column + 1), isolate_), NONE); | 524 handle(Smi::FromInt(column_offset + 1), isolate_), |
| 525 NONE); |
517 } | 526 } |
518 JSObject::AddProperty(stack_frame, line_key_, | 527 JSObject::AddProperty(stack_frame, line_key_, |
519 handle(Smi::FromInt(line_number + 1), isolate_), | 528 handle(Smi::FromInt(line_number + 1), isolate_), |
520 NONE); | 529 NONE); |
521 } | 530 } |
522 | 531 |
523 if (!script_id_key_.is_null()) { | 532 if (!script_id_key_.is_null()) { |
524 JSObject::AddProperty(stack_frame, script_id_key_, | 533 JSObject::AddProperty(stack_frame, script_id_key_, |
525 handle(script->id(), isolate_), NONE); | 534 handle(script->id(), isolate_), NONE); |
526 } | 535 } |
(...skipping 2263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2790 // Then check whether this scope intercepts. | 2799 // Then check whether this scope intercepts. |
2791 if ((flag & intercept_mask_)) { | 2800 if ((flag & intercept_mask_)) { |
2792 intercepted_flags_ |= flag; | 2801 intercepted_flags_ |= flag; |
2793 return true; | 2802 return true; |
2794 } | 2803 } |
2795 return false; | 2804 return false; |
2796 } | 2805 } |
2797 | 2806 |
2798 } // namespace internal | 2807 } // namespace internal |
2799 } // namespace v8 | 2808 } // namespace v8 |
OLD | NEW |