| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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/v8.h" | 5 #include "src/v8.h" |
| 6 | 6 |
| 7 #include "src/api.h" | 7 #include "src/api.h" |
| 8 #include "src/execution.h" | 8 #include "src/execution.h" |
| 9 #include "src/messages.h" | 9 #include "src/messages.h" |
| 10 #include "src/string-builder.h" | 10 #include "src/string-builder.h" |
| (...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 297 if (arg->IsString()) { | 297 if (arg->IsString()) { |
| 298 result_string = Handle<String>::cast(arg); | 298 result_string = Handle<String>::cast(arg); |
| 299 } else { | 299 } else { |
| 300 Handle<String> fmt_str = factory->InternalizeOneByteString( | 300 Handle<String> fmt_str = factory->InternalizeOneByteString( |
| 301 STATIC_CHAR_VECTOR("$noSideEffectToString")); | 301 STATIC_CHAR_VECTOR("$noSideEffectToString")); |
| 302 Handle<JSFunction> fun = Handle<JSFunction>::cast( | 302 Handle<JSFunction> fun = Handle<JSFunction>::cast( |
| 303 Object::GetProperty(isolate->js_builtins_object(), fmt_str) | 303 Object::GetProperty(isolate->js_builtins_object(), fmt_str) |
| 304 .ToHandleChecked()); | 304 .ToHandleChecked()); |
| 305 | 305 |
| 306 MaybeHandle<Object> maybe_result = | 306 MaybeHandle<Object> maybe_result = |
| 307 Execution::TryCall(fun, isolate->js_builtins_object(), 1, &arg); | 307 Execution::TryCall(fun, factory->undefined_value(), 1, &arg); |
| 308 Handle<Object> result; | 308 Handle<Object> result; |
| 309 if (!maybe_result.ToHandle(&result) || !result->IsString()) { | 309 if (!maybe_result.ToHandle(&result) || !result->IsString()) { |
| 310 return factory->InternalizeOneByteString(STATIC_CHAR_VECTOR("<error>")); | 310 return factory->InternalizeOneByteString(STATIC_CHAR_VECTOR("<error>")); |
| 311 } | 311 } |
| 312 result_string = Handle<String>::cast(result); | 312 result_string = Handle<String>::cast(result); |
| 313 } | 313 } |
| 314 MaybeHandle<String> maybe_result_string = MessageTemplate::FormatMessage( | 314 MaybeHandle<String> maybe_result_string = MessageTemplate::FormatMessage( |
| 315 template_index, result_string, factory->empty_string(), | 315 template_index, result_string, factory->empty_string(), |
| 316 factory->empty_string()); | 316 factory->empty_string()); |
| 317 if (!maybe_result_string.ToHandle(&result_string)) { | 317 if (!maybe_result_string.ToHandle(&result_string)) { |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 454 if (obj->IsUndefined()) return default_value; | 454 if (obj->IsUndefined()) return default_value; |
| 455 if (!obj->IsString()) { | 455 if (!obj->IsString()) { |
| 456 ASSIGN_RETURN_ON_EXCEPTION(isolate, obj, Execution::ToString(isolate, obj), | 456 ASSIGN_RETURN_ON_EXCEPTION(isolate, obj, Execution::ToString(isolate, obj), |
| 457 String); | 457 String); |
| 458 } | 458 } |
| 459 return Handle<String>::cast(obj); | 459 return Handle<String>::cast(obj); |
| 460 } | 460 } |
| 461 | 461 |
| 462 } // namespace internal | 462 } // namespace internal |
| 463 } // namespace v8 | 463 } // namespace v8 |
| OLD | NEW |