Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 148 } | 148 } |
| 149 | 149 |
| 150 | 150 |
| 151 Handle<String> MessageHandler::GetMessage(Handle<Object> data) { | 151 Handle<String> MessageHandler::GetMessage(Handle<Object> data) { |
| 152 Handle<String> fmt_str = FACTORY->LookupAsciiSymbol("FormatMessage"); | 152 Handle<String> fmt_str = FACTORY->LookupAsciiSymbol("FormatMessage"); |
| 153 Handle<JSFunction> fun = | 153 Handle<JSFunction> fun = |
| 154 Handle<JSFunction>( | 154 Handle<JSFunction>( |
| 155 JSFunction::cast( | 155 JSFunction::cast( |
| 156 Isolate::Current()->js_builtins_object()-> | 156 Isolate::Current()->js_builtins_object()-> |
| 157 GetPropertyNoExceptionThrown(*fmt_str))); | 157 GetPropertyNoExceptionThrown(*fmt_str))); |
| 158 Handle<Object> argv[] = { data }; | 158 ASSERT(data->IsJSMessageObject()); |
|
Sven Panne
2012/11/09 07:55:07
No need for this ASSERT, all cast methods do this
| |
| 159 Handle<JSMessageObject> message = Handle<JSMessageObject>::cast(data); | |
| 160 Handle<Object> argv[] = { Handle<Object>(message->type()), | |
| 161 Handle<Object>(message->arguments()) }; | |
| 159 | 162 |
| 160 bool caught_exception; | 163 bool caught_exception; |
| 161 Handle<Object> result = | 164 Handle<Object> result = |
| 162 Execution::TryCall(fun, | 165 Execution::TryCall(fun, |
| 163 Isolate::Current()->js_builtins_object(), | 166 Isolate::Current()->js_builtins_object(), |
| 164 ARRAY_SIZE(argv), | 167 ARRAY_SIZE(argv), |
| 165 argv, | 168 argv, |
| 166 &caught_exception); | 169 &caught_exception); |
| 167 | 170 |
| 168 if (caught_exception || !result->IsString()) { | 171 if (caught_exception || !result->IsString()) { |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 180 | 183 |
| 181 | 184 |
| 182 SmartArrayPointer<char> MessageHandler::GetLocalizedMessage( | 185 SmartArrayPointer<char> MessageHandler::GetLocalizedMessage( |
| 183 Handle<Object> data) { | 186 Handle<Object> data) { |
| 184 HandleScope scope; | 187 HandleScope scope; |
| 185 return GetMessage(data)->ToCString(DISALLOW_NULLS); | 188 return GetMessage(data)->ToCString(DISALLOW_NULLS); |
| 186 } | 189 } |
| 187 | 190 |
| 188 | 191 |
| 189 } } // namespace v8::internal | 192 } } // namespace v8::internal |
| OLD | NEW |