OLD | NEW |
1 | 1 |
2 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 2 // Copyright 2006-2008 the V8 project authors. All rights reserved. |
3 // Redistribution and use in source and binary forms, with or without | 3 // Redistribution and use in source and binary forms, with or without |
4 // modification, are permitted provided that the following conditions are | 4 // modification, are permitted provided that the following conditions are |
5 // met: | 5 // met: |
6 // | 6 // |
7 // * Redistributions of source code must retain the above copyright | 7 // * Redistributions of source code must retain the above copyright |
8 // notice, this list of conditions and the following disclaimer. | 8 // notice, this list of conditions and the following disclaimer. |
9 // * Redistributions in binary form must reproduce the above | 9 // * Redistributions in binary form must reproduce the above |
10 // copyright notice, this list of conditions and the following | 10 // copyright notice, this list of conditions and the following |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 Handle<Object> data(loc->script()->name()); | 49 Handle<Object> data(loc->script()->name()); |
50 SmartPointer<char> data_str; | 50 SmartPointer<char> data_str; |
51 if (data->IsString()) | 51 if (data->IsString()) |
52 data_str = Handle<String>::cast(data)->ToCString(DISALLOW_NULLS); | 52 data_str = Handle<String>::cast(data)->ToCString(DISALLOW_NULLS); |
53 PrintF("%s:%i: %s\n", *data_str ? *data_str : "<unknown>", | 53 PrintF("%s:%i: %s\n", *data_str ? *data_str : "<unknown>", |
54 loc->start_pos(), *str); | 54 loc->start_pos(), *str); |
55 } | 55 } |
56 } | 56 } |
57 | 57 |
58 | 58 |
59 void MessageHandler::ReportMessage(const char* msg) { | |
60 PrintF("%s\n", msg); | |
61 } | |
62 | |
63 | |
64 Handle<JSMessageObject> MessageHandler::MakeMessageObject( | 59 Handle<JSMessageObject> MessageHandler::MakeMessageObject( |
65 const char* type, | 60 const char* type, |
66 MessageLocation* loc, | 61 MessageLocation* loc, |
67 Vector< Handle<Object> > args, | 62 Vector< Handle<Object> > args, |
68 Handle<String> stack_trace, | 63 Handle<String> stack_trace, |
69 Handle<JSArray> stack_frames) { | 64 Handle<JSArray> stack_frames) { |
70 Handle<String> type_handle = FACTORY->LookupAsciiSymbol(type); | 65 Handle<String> type_handle = FACTORY->LookupAsciiSymbol(type); |
71 Handle<FixedArray> arguments_elements = | 66 Handle<FixedArray> arguments_elements = |
72 FACTORY->NewFixedArray(args.length()); | 67 FACTORY->NewFixedArray(args.length()); |
73 for (int i = 0; i < args.length(); i++) { | 68 for (int i = 0; i < args.length(); i++) { |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 } | 101 } |
107 | 102 |
108 | 103 |
109 void MessageHandler::ReportMessage(Isolate* isolate, | 104 void MessageHandler::ReportMessage(Isolate* isolate, |
110 MessageLocation* loc, | 105 MessageLocation* loc, |
111 Handle<Object> message) { | 106 Handle<Object> message) { |
112 // If we are in process of message reporting, just ignore all other requests | 107 // If we are in process of message reporting, just ignore all other requests |
113 // to report a message as they are due to unhandled exceptions thrown in | 108 // to report a message as they are due to unhandled exceptions thrown in |
114 // message callbacks. | 109 // message callbacks. |
115 if (isolate->in_exception_reporting()) { | 110 if (isolate->in_exception_reporting()) { |
116 ReportMessage("uncaught exception thrown while reporting"); | 111 PrintF("uncaught exception thrown while reporting\n"); |
117 return; | 112 return; |
118 } | 113 } |
119 isolate->set_in_exception_reporting(true); | 114 isolate->set_in_exception_reporting(true); |
120 | 115 |
121 // We are calling into embedder's code which can throw exceptions. | 116 // We are calling into embedder's code which can throw exceptions. |
122 // Thus we need to save current exception state, reset it to the clean one | 117 // Thus we need to save current exception state, reset it to the clean one |
123 // and ignore scheduled exceptions callbacks can throw. | 118 // and ignore scheduled exceptions callbacks can throw. |
124 Isolate::ExceptionScope exception_scope(isolate); | 119 Isolate::ExceptionScope exception_scope(isolate); |
125 isolate->clear_pending_exception(); | 120 isolate->clear_pending_exception(); |
126 isolate->set_external_caught_exception(false); | 121 isolate->set_external_caught_exception(false); |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 } | 177 } |
183 | 178 |
184 | 179 |
185 SmartPointer<char> MessageHandler::GetLocalizedMessage(Handle<Object> data) { | 180 SmartPointer<char> MessageHandler::GetLocalizedMessage(Handle<Object> data) { |
186 HandleScope scope; | 181 HandleScope scope; |
187 return GetMessage(data)->ToCString(DISALLOW_NULLS); | 182 return GetMessage(data)->ToCString(DISALLOW_NULLS); |
188 } | 183 } |
189 | 184 |
190 | 185 |
191 } } // namespace v8::internal | 186 } } // namespace v8::internal |
OLD | NEW |