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 927 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
938 String::cast(location->script()->name())->ToCString().get(), | 938 String::cast(location->script()->name())->ToCString().get(), |
939 line_number); | 939 line_number); |
940 } else { | 940 } else { |
941 base::OS::PrintError("Extension or internal compilation error.\n"); | 941 base::OS::PrintError("Extension or internal compilation error.\n"); |
942 } | 942 } |
943 #ifdef OBJECT_PRINT | 943 #ifdef OBJECT_PRINT |
944 // Since comments and empty lines have been stripped from the source of | 944 // Since comments and empty lines have been stripped from the source of |
945 // builtins, print the actual source here so that line numbers match. | 945 // builtins, print the actual source here so that line numbers match. |
946 if (location->script()->source()->IsString()) { | 946 if (location->script()->source()->IsString()) { |
947 Handle<String> src(String::cast(location->script()->source())); | 947 Handle<String> src(String::cast(location->script()->source())); |
948 PrintF("Failing script:\n"); | 948 PrintF("Failing script:"); |
949 int len = src->length(); | 949 int len = src->length(); |
950 int line_number = 1; | 950 if (len == 0) { |
951 PrintF("%5d: ", line_number); | 951 PrintF(" <not available>\n"); |
952 for (int i = 0; i < len; i++) { | 952 } else { |
953 uint16_t character = src->Get(i); | 953 PrintF("\n"); |
954 PrintF("%c", character); | 954 int line_number = 1; |
955 if (character == '\n' && i < len - 2) { | 955 PrintF("%5d: ", line_number); |
956 PrintF("%5d: ", ++line_number); | 956 for (int i = 0; i < len; i++) { |
| 957 uint16_t character = src->Get(i); |
| 958 PrintF("%c", character); |
| 959 if (character == '\n' && i < len - 2) { |
| 960 PrintF("%5d: ", ++line_number); |
| 961 } |
957 } | 962 } |
| 963 PrintF("\n"); |
958 } | 964 } |
959 } | 965 } |
960 #endif | 966 #endif |
961 } | 967 } |
962 | 968 |
963 | 969 |
964 Object* Isolate::Throw(Object* exception, MessageLocation* location) { | 970 Object* Isolate::Throw(Object* exception, MessageLocation* location) { |
965 DCHECK(!has_pending_exception()); | 971 DCHECK(!has_pending_exception()); |
966 | 972 |
967 HandleScope scope(this); | 973 HandleScope scope(this); |
(...skipping 1825 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2793 // Then check whether this scope intercepts. | 2799 // Then check whether this scope intercepts. |
2794 if ((flag & intercept_mask_)) { | 2800 if ((flag & intercept_mask_)) { |
2795 intercepted_flags_ |= flag; | 2801 intercepted_flags_ |= flag; |
2796 return true; | 2802 return true; |
2797 } | 2803 } |
2798 return false; | 2804 return false; |
2799 } | 2805 } |
2800 | 2806 |
2801 } // namespace internal | 2807 } // namespace internal |
2802 } // namespace v8 | 2808 } // namespace v8 |
OLD | NEW |