| 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 1359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1370 if (!ComputeLocationFromException(&potential_computed_location, | 1370 if (!ComputeLocationFromException(&potential_computed_location, |
| 1371 exception)) { | 1371 exception)) { |
| 1372 if (!ComputeLocationFromStackTrace(&potential_computed_location, | 1372 if (!ComputeLocationFromStackTrace(&potential_computed_location, |
| 1373 exception)) { | 1373 exception)) { |
| 1374 ComputeLocation(&potential_computed_location); | 1374 ComputeLocation(&potential_computed_location); |
| 1375 } | 1375 } |
| 1376 } | 1376 } |
| 1377 location = &potential_computed_location; | 1377 location = &potential_computed_location; |
| 1378 } | 1378 } |
| 1379 | 1379 |
| 1380 // If the exception argument is a custom object, turn it into a string | |
| 1381 // before throwing as uncaught exception. Note that the pending | |
| 1382 // exception object to be set later must not be turned into a string. | |
| 1383 if (exception->IsJSObject() && !IsErrorObject(exception)) { | |
| 1384 MaybeHandle<Object> maybe_exception = | |
| 1385 Execution::ToDetailString(this, exception); | |
| 1386 if (!maybe_exception.ToHandle(&exception)) { | |
| 1387 exception = | |
| 1388 factory()->InternalizeOneByteString(STATIC_CHAR_VECTOR("exception")); | |
| 1389 } | |
| 1390 } | |
| 1391 return MessageHandler::MakeMessageObject( | 1380 return MessageHandler::MakeMessageObject( |
| 1392 this, MessageTemplate::kUncaughtException, location, exception, | 1381 this, MessageTemplate::kUncaughtException, location, exception, |
| 1393 stack_trace_object); | 1382 stack_trace_object); |
| 1394 } | 1383 } |
| 1395 | 1384 |
| 1396 | 1385 |
| 1397 bool Isolate::IsJavaScriptHandlerOnTop(Object* exception) { | 1386 bool Isolate::IsJavaScriptHandlerOnTop(Object* exception) { |
| 1398 DCHECK_NE(heap()->the_hole_value(), exception); | 1387 DCHECK_NE(heap()->the_hole_value(), exception); |
| 1399 | 1388 |
| 1400 // For uncatchable exceptions, the JavaScript handler cannot be on top. | 1389 // For uncatchable exceptions, the JavaScript handler cannot be on top. |
| (...skipping 1384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2785 if (prev_ && prev_->Intercept(flag)) return true; | 2774 if (prev_ && prev_->Intercept(flag)) return true; |
| 2786 // Then check whether this scope intercepts. | 2775 // Then check whether this scope intercepts. |
| 2787 if ((flag & intercept_mask_)) { | 2776 if ((flag & intercept_mask_)) { |
| 2788 intercepted_flags_ |= flag; | 2777 intercepted_flags_ |= flag; |
| 2789 return true; | 2778 return true; |
| 2790 } | 2779 } |
| 2791 return false; | 2780 return false; |
| 2792 } | 2781 } |
| 2793 | 2782 |
| 2794 } } // namespace v8::internal | 2783 } } // namespace v8::internal |
| OLD | NEW |