| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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/messages.h" | 5 #include "src/messages.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "src/api.h" | 9 #include "src/api.h" |
| 10 #include "src/execution.h" | 10 #include "src/execution.h" |
| (...skipping 580 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 591 builder.AppendCString("new "); | 591 builder.AppendCString("new "); |
| 592 if (IsNonEmptyString(function_name)) { | 592 if (IsNonEmptyString(function_name)) { |
| 593 builder.AppendString(Handle<String>::cast(function_name)); | 593 builder.AppendString(Handle<String>::cast(function_name)); |
| 594 } else { | 594 } else { |
| 595 builder.AppendCString("<anonymous>"); | 595 builder.AppendCString("<anonymous>"); |
| 596 } | 596 } |
| 597 } else if (IsNonEmptyString(function_name)) { | 597 } else if (IsNonEmptyString(function_name)) { |
| 598 builder.AppendString(Handle<String>::cast(function_name)); | 598 builder.AppendString(Handle<String>::cast(function_name)); |
| 599 } else { | 599 } else { |
| 600 AppendFileLocation(isolate_, this, &builder); | 600 AppendFileLocation(isolate_, this, &builder); |
| 601 RETURN_RESULT(isolate_, builder.Finish(), String); | 601 return builder.Finish(); |
| 602 } | 602 } |
| 603 | 603 |
| 604 builder.AppendCString(" ("); | 604 builder.AppendCString(" ("); |
| 605 AppendFileLocation(isolate_, this, &builder); | 605 AppendFileLocation(isolate_, this, &builder); |
| 606 builder.AppendCString(")"); | 606 builder.AppendCString(")"); |
| 607 | 607 |
| 608 RETURN_RESULT(isolate_, builder.Finish(), String); | 608 return builder.Finish(); |
| 609 } | 609 } |
| 610 | 610 |
| 611 int JSStackFrame::GetPosition() const { return code_->SourcePosition(offset_); } | 611 int JSStackFrame::GetPosition() const { return code_->SourcePosition(offset_); } |
| 612 | 612 |
| 613 bool JSStackFrame::HasScript() const { | 613 bool JSStackFrame::HasScript() const { |
| 614 return function_->shared()->script()->IsScript(); | 614 return function_->shared()->script()->IsScript(); |
| 615 } | 615 } |
| 616 | 616 |
| 617 Handle<Script> JSStackFrame::GetScript() const { | 617 Handle<Script> JSStackFrame::GetScript() const { |
| 618 return handle(Script::cast(function_->shared()->script()), isolate_); | 618 return handle(Script::cast(function_->shared()->script()), isolate_); |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 727 | 727 |
| 728 if (IsNonEmptyString(function_name)) { | 728 if (IsNonEmptyString(function_name)) { |
| 729 builder.AppendString(Handle<String>::cast(function_name)); | 729 builder.AppendString(Handle<String>::cast(function_name)); |
| 730 builder.AppendCString(" ("); | 730 builder.AppendCString(" ("); |
| 731 } | 731 } |
| 732 | 732 |
| 733 AppendFileLocation(isolate_, this, &builder); | 733 AppendFileLocation(isolate_, this, &builder); |
| 734 | 734 |
| 735 if (IsNonEmptyString(function_name)) builder.AppendCString(")"); | 735 if (IsNonEmptyString(function_name)) builder.AppendCString(")"); |
| 736 | 736 |
| 737 RETURN_RESULT(isolate_, builder.Finish(), String); | 737 return builder.Finish(); |
| 738 } | 738 } |
| 739 | 739 |
| 740 FrameArrayIterator::FrameArrayIterator(Isolate* isolate, | 740 FrameArrayIterator::FrameArrayIterator(Isolate* isolate, |
| 741 Handle<FrameArray> array, int frame_ix) | 741 Handle<FrameArray> array, int frame_ix) |
| 742 : isolate_(isolate), array_(array), next_frame_ix_(frame_ix) {} | 742 : isolate_(isolate), array_(array), next_frame_ix_(frame_ix) {} |
| 743 | 743 |
| 744 bool FrameArrayIterator::HasNext() const { | 744 bool FrameArrayIterator::HasNext() const { |
| 745 return (next_frame_ix_ < array_->FrameCount()); | 745 return (next_frame_ix_ < array_->FrameCount()); |
| 746 } | 746 } |
| 747 | 747 |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 936 builder.AppendCString("<error: "); | 936 builder.AppendCString("<error: "); |
| 937 builder.AppendString(maybe_frame_string.ToHandleChecked()); | 937 builder.AppendString(maybe_frame_string.ToHandleChecked()); |
| 938 builder.AppendCString("<error>"); | 938 builder.AppendCString("<error>"); |
| 939 } | 939 } |
| 940 } else { | 940 } else { |
| 941 // CallSite.toString completed without throwing. | 941 // CallSite.toString completed without throwing. |
| 942 builder.AppendString(maybe_frame_string.ToHandleChecked()); | 942 builder.AppendString(maybe_frame_string.ToHandleChecked()); |
| 943 } | 943 } |
| 944 } | 944 } |
| 945 | 945 |
| 946 RETURN_RESULT(isolate, builder.Finish(), Object); | 946 return builder.Finish(); |
| 947 } | 947 } |
| 948 | 948 |
| 949 Handle<String> MessageTemplate::FormatMessage(Isolate* isolate, | 949 Handle<String> MessageTemplate::FormatMessage(Isolate* isolate, |
| 950 int template_index, | 950 int template_index, |
| 951 Handle<Object> arg) { | 951 Handle<Object> arg) { |
| 952 Factory* factory = isolate->factory(); | 952 Factory* factory = isolate->factory(); |
| 953 Handle<String> result_string = Object::NoSideEffectsToString(isolate, arg); | 953 Handle<String> result_string = Object::NoSideEffectsToString(isolate, arg); |
| 954 MaybeHandle<String> maybe_result_string = MessageTemplate::FormatMessage( | 954 MaybeHandle<String> maybe_result_string = MessageTemplate::FormatMessage( |
| 955 template_index, result_string, factory->empty_string(), | 955 template_index, result_string, factory->empty_string(), |
| 956 factory->empty_string()); | 956 factory->empty_string()); |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1178 DCHECK(mode != SKIP_UNTIL_SEEN); | 1178 DCHECK(mode != SKIP_UNTIL_SEEN); |
| 1179 | 1179 |
| 1180 Handle<Object> no_caller; | 1180 Handle<Object> no_caller; |
| 1181 Handle<String> msg = FormatMessage(isolate, template_index, arg0, arg1, arg2); | 1181 Handle<String> msg = FormatMessage(isolate, template_index, arg0, arg1, arg2); |
| 1182 return ErrorUtils::Construct(isolate, constructor, constructor, msg, mode, | 1182 return ErrorUtils::Construct(isolate, constructor, constructor, msg, mode, |
| 1183 no_caller, false); | 1183 no_caller, false); |
| 1184 } | 1184 } |
| 1185 | 1185 |
| 1186 } // namespace internal | 1186 } // namespace internal |
| 1187 } // namespace v8 | 1187 } // namespace v8 |
| OLD | NEW |