| 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 "src/isolate.h" | 5 #include "src/isolate.h" |
| 6 | 6 |
| 7 #include <stdlib.h> | 7 #include <stdlib.h> |
| 8 | 8 |
| 9 #include <fstream> // NOLINT(readability/streams) | 9 #include <fstream> // NOLINT(readability/streams) |
| 10 #include <sstream> | 10 #include <sstream> |
| (...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 494 } | 494 } |
| 495 | 495 |
| 496 Handle<JSObject> NewStackFrameObject(Handle<JSFunction> fun, int position, | 496 Handle<JSObject> NewStackFrameObject(Handle<JSFunction> fun, int position, |
| 497 bool is_constructor) { | 497 bool is_constructor) { |
| 498 Handle<JSObject> stack_frame = | 498 Handle<JSObject> stack_frame = |
| 499 factory()->NewJSObject(isolate_->object_function()); | 499 factory()->NewJSObject(isolate_->object_function()); |
| 500 | 500 |
| 501 Handle<Script> script(Script::cast(fun->shared()->script())); | 501 Handle<Script> script(Script::cast(fun->shared()->script())); |
| 502 | 502 |
| 503 if (!line_key_.is_null()) { | 503 if (!line_key_.is_null()) { |
| 504 int script_line_offset = script->line_offset()->value(); | 504 int script_line_offset = script->line_offset(); |
| 505 int line_number = Script::GetLineNumber(script, position); | 505 int line_number = Script::GetLineNumber(script, position); |
| 506 // line_number is already shifted by the script_line_offset. | 506 // line_number is already shifted by the script_line_offset. |
| 507 int relative_line_number = line_number - script_line_offset; | 507 int relative_line_number = line_number - script_line_offset; |
| 508 if (!column_key_.is_null() && relative_line_number >= 0) { | 508 if (!column_key_.is_null() && relative_line_number >= 0) { |
| 509 Handle<FixedArray> line_ends(FixedArray::cast(script->line_ends())); | 509 Handle<FixedArray> line_ends(FixedArray::cast(script->line_ends())); |
| 510 int start = (relative_line_number == 0) ? 0 : | 510 int start = (relative_line_number == 0) ? 0 : |
| 511 Smi::cast(line_ends->get(relative_line_number - 1))->value() + 1; | 511 Smi::cast(line_ends->get(relative_line_number - 1))->value() + 1; |
| 512 int column_offset = position - start; | 512 int column_offset = position - start; |
| 513 if (relative_line_number == 0) { | 513 if (relative_line_number == 0) { |
| 514 // For the case where the code is on the same line as the script | 514 // For the case where the code is on the same line as the script |
| 515 // tag. | 515 // tag. |
| 516 column_offset += script->column_offset()->value(); | 516 column_offset += script->column_offset(); |
| 517 } | 517 } |
| 518 JSObject::AddProperty(stack_frame, column_key_, | 518 JSObject::AddProperty(stack_frame, column_key_, |
| 519 handle(Smi::FromInt(column_offset + 1), isolate_), | 519 handle(Smi::FromInt(column_offset + 1), isolate_), |
| 520 NONE); | 520 NONE); |
| 521 } | 521 } |
| 522 JSObject::AddProperty(stack_frame, line_key_, | 522 JSObject::AddProperty(stack_frame, line_key_, |
| 523 handle(Smi::FromInt(line_number + 1), isolate_), | 523 handle(Smi::FromInt(line_number + 1), isolate_), |
| 524 NONE); | 524 NONE); |
| 525 } | 525 } |
| 526 | 526 |
| 527 if (!script_id_key_.is_null()) { | 527 if (!script_id_key_.is_null()) { |
| 528 JSObject::AddProperty(stack_frame, script_id_key_, | 528 JSObject::AddProperty(stack_frame, script_id_key_, |
| 529 handle(script->id(), isolate_), NONE); | 529 handle(Smi::FromInt(script->id()), isolate_), NONE); |
| 530 } | 530 } |
| 531 | 531 |
| 532 if (!script_name_key_.is_null()) { | 532 if (!script_name_key_.is_null()) { |
| 533 JSObject::AddProperty(stack_frame, script_name_key_, | 533 JSObject::AddProperty(stack_frame, script_name_key_, |
| 534 handle(script->name(), isolate_), NONE); | 534 handle(script->name(), isolate_), NONE); |
| 535 } | 535 } |
| 536 | 536 |
| 537 if (!script_name_or_source_url_key_.is_null()) { | 537 if (!script_name_or_source_url_key_.is_null()) { |
| 538 Handle<Object> result = Script::GetNameOrSourceURL(script); | 538 Handle<Object> result = Script::GetNameOrSourceURL(script); |
| 539 JSObject::AddProperty(stack_frame, script_name_or_source_url_key_, result, | 539 JSObject::AddProperty(stack_frame, script_name_or_source_url_key_, result, |
| (...skipping 2283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2823 // Then check whether this scope intercepts. | 2823 // Then check whether this scope intercepts. |
| 2824 if ((flag & intercept_mask_)) { | 2824 if ((flag & intercept_mask_)) { |
| 2825 intercepted_flags_ |= flag; | 2825 intercepted_flags_ |= flag; |
| 2826 return true; | 2826 return true; |
| 2827 } | 2827 } |
| 2828 return false; | 2828 return false; |
| 2829 } | 2829 } |
| 2830 | 2830 |
| 2831 } // namespace internal | 2831 } // namespace internal |
| 2832 } // namespace v8 | 2832 } // namespace v8 |
| OLD | NEW |