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 1054 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1065 | 1065 |
1066 Object* Isolate::Throw(Object* exception, MessageLocation* location) { | 1066 Object* Isolate::Throw(Object* exception, MessageLocation* location) { |
1067 DCHECK(!has_pending_exception()); | 1067 DCHECK(!has_pending_exception()); |
1068 | 1068 |
1069 HandleScope scope(this); | 1069 HandleScope scope(this); |
1070 Handle<Object> exception_handle(exception, this); | 1070 Handle<Object> exception_handle(exception, this); |
1071 | 1071 |
1072 if (FLAG_print_all_exceptions) { | 1072 if (FLAG_print_all_exceptions) { |
1073 printf("=========================================================\n"); | 1073 printf("=========================================================\n"); |
1074 printf("Exception thrown:\n"); | 1074 printf("Exception thrown:\n"); |
1075 if (location) { | |
1076 Handle<Script> script = location->script(); | |
1077 Handle<Object> name = Script::GetNameOrSourceURL(script); | |
1078 printf("at "); | |
1079 if (name->IsString() && String::cast(*name)->length() > 0) | |
1080 String::cast(*name)->PrintOn(stdout); | |
1081 else | |
1082 printf("<anonymous>"); | |
1083 #ifdef DEBUG | |
1084 if (AllowHeapAllocation::IsAllowed()) { | |
titzer
2016/10/26 15:52:47
Maybe add a comment that GetColumnNumber() allocat
Clemens Hammacher
2016/10/26 16:15:41
Done.
| |
1085 #else | |
1086 if (false) { | |
1087 #endif | |
1088 printf("%d:%d - %d:%d\n", | |
1089 Script::GetLineNumber(script, location->start_pos()) + 1, | |
1090 Script::GetColumnNumber(script, location->start_pos()), | |
1091 Script::GetLineNumber(script, location->end_pos()) + 1, | |
1092 Script::GetColumnNumber(script, location->end_pos())); | |
1093 } else { | |
1094 printf("line %d\n", script->GetLineNumber(location->start_pos()) + 1); | |
1095 } | |
1096 } | |
1075 exception->Print(); | 1097 exception->Print(); |
1076 printf("Stack Trace:\n"); | 1098 printf("Stack Trace:\n"); |
1077 PrintStack(stdout); | 1099 PrintStack(stdout); |
1078 printf("=========================================================\n"); | 1100 printf("=========================================================\n"); |
1079 } | 1101 } |
1080 | 1102 |
1081 // Determine whether a message needs to be created for the given exception | 1103 // Determine whether a message needs to be created for the given exception |
1082 // depending on the following criteria: | 1104 // depending on the following criteria: |
1083 // 1) External v8::TryCatch missing: Always create a message because any | 1105 // 1) External v8::TryCatch missing: Always create a message because any |
1084 // JavaScript handler for a finally-block might re-throw to top-level. | 1106 // JavaScript handler for a finally-block might re-throw to top-level. |
(...skipping 2379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3464 // Then check whether this scope intercepts. | 3486 // Then check whether this scope intercepts. |
3465 if ((flag & intercept_mask_)) { | 3487 if ((flag & intercept_mask_)) { |
3466 intercepted_flags_ |= flag; | 3488 intercepted_flags_ |= flag; |
3467 return true; | 3489 return true; |
3468 } | 3490 } |
3469 return false; | 3491 return false; |
3470 } | 3492 } |
3471 | 3493 |
3472 } // namespace internal | 3494 } // namespace internal |
3473 } // namespace v8 | 3495 } // namespace v8 |
OLD | NEW |