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 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 } | 147 } |
148 } | 148 } |
149 } | 149 } |
150 | 150 |
151 | 151 |
152 Handle<String> MessageHandler::GetMessage(Isolate* isolate, | 152 Handle<String> MessageHandler::GetMessage(Isolate* isolate, |
153 Handle<Object> data) { | 153 Handle<Object> data) { |
154 Factory* factory = isolate->factory(); | 154 Factory* factory = isolate->factory(); |
155 Handle<String> fmt_str = | 155 Handle<String> fmt_str = |
156 factory->InternalizeOneByteString(STATIC_ASCII_VECTOR("FormatMessage")); | 156 factory->InternalizeOneByteString(STATIC_ASCII_VECTOR("FormatMessage")); |
157 Handle<JSFunction> fun = Handle<JSFunction>::cast(Object::GetProperty( | 157 Handle<JSFunction> fun = Handle<JSFunction>::cast( |
158 isolate->js_builtins_object(), fmt_str).ToHandleChecked()); | 158 GlobalObject::GetPropertyNoExceptionThrown( |
| 159 isolate->js_builtins_object(), fmt_str)); |
159 Handle<JSMessageObject> message = Handle<JSMessageObject>::cast(data); | 160 Handle<JSMessageObject> message = Handle<JSMessageObject>::cast(data); |
160 Handle<Object> argv[] = { Handle<Object>(message->type(), isolate), | 161 Handle<Object> argv[] = { Handle<Object>(message->type(), isolate), |
161 Handle<Object>(message->arguments(), isolate) }; | 162 Handle<Object>(message->arguments(), isolate) }; |
162 | 163 |
163 MaybeHandle<Object> maybe_result = Execution::TryCall( | 164 MaybeHandle<Object> maybe_result = Execution::TryCall( |
164 fun, isolate->js_builtins_object(), ARRAY_SIZE(argv), argv); | 165 fun, isolate->js_builtins_object(), ARRAY_SIZE(argv), argv); |
165 Handle<Object> result; | 166 Handle<Object> result; |
166 if (!maybe_result.ToHandle(&result) || !result->IsString()) { | 167 if (!maybe_result.ToHandle(&result) || !result->IsString()) { |
167 return factory->InternalizeOneByteString(STATIC_ASCII_VECTOR("<error>")); | 168 return factory->InternalizeOneByteString(STATIC_ASCII_VECTOR("<error>")); |
168 } | 169 } |
(...skipping 10 matching lines...) Expand all Loading... |
179 | 180 |
180 SmartArrayPointer<char> MessageHandler::GetLocalizedMessage( | 181 SmartArrayPointer<char> MessageHandler::GetLocalizedMessage( |
181 Isolate* isolate, | 182 Isolate* isolate, |
182 Handle<Object> data) { | 183 Handle<Object> data) { |
183 HandleScope scope(isolate); | 184 HandleScope scope(isolate); |
184 return GetMessage(isolate, data)->ToCString(DISALLOW_NULLS); | 185 return GetMessage(isolate, data)->ToCString(DISALLOW_NULLS); |
185 } | 186 } |
186 | 187 |
187 | 188 |
188 } } // namespace v8::internal | 189 } } // namespace v8::internal |
OLD | NEW |