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 Handle<FixedArray> line_ends(FixedArray::cast(script->line_ends())); | 514 int column = Script::GetColumnNumber(script, position); |
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 } | |
523 JSObject::AddProperty(stack_frame, column_key_, | 515 JSObject::AddProperty(stack_frame, column_key_, |
524 handle(Smi::FromInt(column_offset + 1), isolate_), | 516 handle(Smi::FromInt(column + 1), isolate_), NONE); |
525 NONE); | |
526 } | 517 } |
527 JSObject::AddProperty(stack_frame, line_key_, | 518 JSObject::AddProperty(stack_frame, line_key_, |
528 handle(Smi::FromInt(line_number + 1), isolate_), | 519 handle(Smi::FromInt(line_number + 1), isolate_), |
529 NONE); | 520 NONE); |
530 } | 521 } |
531 | 522 |
532 if (!script_id_key_.is_null()) { | 523 if (!script_id_key_.is_null()) { |
533 JSObject::AddProperty(stack_frame, script_id_key_, | 524 JSObject::AddProperty(stack_frame, script_id_key_, |
534 handle(script->id(), isolate_), NONE); | 525 handle(script->id(), isolate_), NONE); |
535 } | 526 } |
(...skipping 2263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2799 // Then check whether this scope intercepts. | 2790 // Then check whether this scope intercepts. |
2800 if ((flag & intercept_mask_)) { | 2791 if ((flag & intercept_mask_)) { |
2801 intercepted_flags_ |= flag; | 2792 intercepted_flags_ |= flag; |
2802 return true; | 2793 return true; |
2803 } | 2794 } |
2804 return false; | 2795 return false; |
2805 } | 2796 } |
2806 | 2797 |
2807 } // namespace internal | 2798 } // namespace internal |
2808 } // namespace v8 | 2799 } // namespace v8 |
OLD | NEW |