Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Side by Side Diff: src/messages.cc

Issue 8050: Changed the message reporting for try { ... } finally { ... } statements to... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 12 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | src/top.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 ? Factory::undefined_value() 89 ? Factory::undefined_value()
90 : Handle<Object>::cast(stack_trace); 90 : Handle<Object>::cast(stack_trace);
91 const int argc = 6; 91 const int argc = 6;
92 Object** argv[argc] = { type_str.location(), 92 Object** argv[argc] = { type_str.location(),
93 array.location(), 93 array.location(),
94 start_handle.location(), 94 start_handle.location(),
95 end_handle.location(), 95 end_handle.location(),
96 script.location(), 96 script.location(),
97 stack_trace_val.location() }; 97 stack_trace_val.location() };
98 98
99 // Setup a catch handler to catch exceptions in creating the message. This
100 // handler is non-verbose to avoid calling MakeMessage recursively in case of
101 // an exception.
102 v8::TryCatch catcher;
103 catcher.SetVerbose(false);
104 catcher.SetCaptureMessage(false);
105
106 // Format the message.
99 bool caught_exception = false; 107 bool caught_exception = false;
100 Handle<Object> message = 108 Handle<Object> message =
101 Execution::TryCall(fun, Factory::undefined_value(), argc, argv, 109 Execution::Call(fun, Factory::undefined_value(), argc, argv,
102 &caught_exception); 110 &caught_exception);
103 // If creating the message (in JS code) resulted in an exception, we 111 if (caught_exception) {
104 // skip doing the callback. This usually only happens in case of 112 // If creating the message (in JS code) resulted in an exception, we
105 // stack overflow exceptions being thrown by the parser when the 113 // skip doing the callback. This usually only happens in case of
106 // stack is almost full. 114 // stack overflow exceptions being thrown by the parser when the
107 if (caught_exception) return Handle<Object>(); 115 // stack is almost full.
116 if (caught_exception) return Handle<Object>();
117 }
118
108 return message.EscapeFrom(&scope); 119 return message.EscapeFrom(&scope);
109 } 120 }
110 121
111 122
112 void MessageHandler::ReportMessage(MessageLocation* loc, 123 void MessageHandler::ReportMessage(MessageLocation* loc,
113 Handle<Object> message) { 124 Handle<Object> message) {
114 v8::Local<v8::Message> api_message_obj = v8::Utils::MessageToLocal(message); 125 v8::Local<v8::Message> api_message_obj = v8::Utils::MessageToLocal(message);
115 126
116 v8::NeanderArray global_listeners(Factory::message_listeners()); 127 v8::NeanderArray global_listeners(Factory::message_listeners());
117 int global_length = global_listeners.length(); 128 int global_length = global_listeners.length();
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 } 170 }
160 171
161 172
162 SmartPointer<char> MessageHandler::GetLocalizedMessage(Handle<Object> data) { 173 SmartPointer<char> MessageHandler::GetLocalizedMessage(Handle<Object> data) {
163 HandleScope scope; 174 HandleScope scope;
164 return GetMessage(data)->ToCString(DISALLOW_NULLS); 175 return GetMessage(data)->ToCString(DISALLOW_NULLS);
165 } 176 }
166 177
167 178
168 } } // namespace v8::internal 179 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/top.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698