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 "v8.h" | 7 #include "v8.h" |
8 | 8 |
9 #include "ast.h" | 9 #include "ast.h" |
10 #include "bootstrapper.h" | 10 #include "bootstrapper.h" |
(...skipping 1115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1126 String::cast(location->script()->name())->ToCString().get(), | 1126 String::cast(location->script()->name())->ToCString().get(), |
1127 line_number); | 1127 line_number); |
1128 } else if (location->script()->name()->IsString()) { | 1128 } else if (location->script()->name()->IsString()) { |
1129 OS::PrintError( | 1129 OS::PrintError( |
1130 "Extension or internal compilation error in %s at line %d.\n", | 1130 "Extension or internal compilation error in %s at line %d.\n", |
1131 String::cast(location->script()->name())->ToCString().get(), | 1131 String::cast(location->script()->name())->ToCString().get(), |
1132 line_number); | 1132 line_number); |
1133 } else { | 1133 } else { |
1134 OS::PrintError("Extension or internal compilation error.\n"); | 1134 OS::PrintError("Extension or internal compilation error.\n"); |
1135 } | 1135 } |
| 1136 #ifdef OBJECT_PRINT |
| 1137 // Since comments and empty lines have been stripped from the source of |
| 1138 // builtins, print the actual source here so that line numbers match. |
| 1139 if (location->script()->source()->IsString()) { |
| 1140 Handle<String> src(String::cast(location->script()->source())); |
| 1141 PrintF("Failing script:\n"); |
| 1142 int len = src->length(); |
| 1143 int line_number = 1; |
| 1144 PrintF("%5d: ", line_number); |
| 1145 for (int i = 0; i < len; i++) { |
| 1146 uint16_t character = src->Get(i); |
| 1147 PrintF("%c", character); |
| 1148 if (character == '\n' && i < len - 2) { |
| 1149 PrintF("%5d: ", ++line_number); |
| 1150 } |
| 1151 } |
| 1152 } |
| 1153 #endif |
1136 } | 1154 } |
1137 } | 1155 } |
1138 | 1156 |
1139 // Save the message for reporting if the the exception remains uncaught. | 1157 // Save the message for reporting if the the exception remains uncaught. |
1140 thread_local_top()->has_pending_message_ = report_exception; | 1158 thread_local_top()->has_pending_message_ = report_exception; |
1141 | 1159 |
1142 // Do not forget to clean catcher_ if currently thrown exception cannot | 1160 // Do not forget to clean catcher_ if currently thrown exception cannot |
1143 // be caught. If necessary, ReThrow will update the catcher. | 1161 // be caught. If necessary, ReThrow will update the catcher. |
1144 thread_local_top()->catcher_ = can_be_caught_externally ? | 1162 thread_local_top()->catcher_ = can_be_caught_externally ? |
1145 try_catch_handler() : NULL; | 1163 try_catch_handler() : NULL; |
(...skipping 1142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2288 Execution::Call(this, microtask, factory()->undefined_value(), | 2306 Execution::Call(this, microtask, factory()->undefined_value(), |
2289 0, NULL).Check(); | 2307 0, NULL).Check(); |
2290 } | 2308 } |
2291 } | 2309 } |
2292 | 2310 |
2293 handle_scope_implementer()->DecrementCallDepth(); | 2311 handle_scope_implementer()->DecrementCallDepth(); |
2294 } | 2312 } |
2295 | 2313 |
2296 | 2314 |
2297 } } // namespace v8::internal | 2315 } } // namespace v8::internal |
OLD | NEW |