| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 #ifndef V8_JSON_STRINGIFIER_H_ | 5 #ifndef V8_JSON_STRINGIFIER_H_ |
| 6 #define V8_JSON_STRINGIFIER_H_ | 6 #define V8_JSON_STRINGIFIER_H_ |
| 7 | 7 |
| 8 #include "src/conversions.h" | 8 #include "src/conversions.h" |
| 9 #include "src/lookup.h" | 9 #include "src/lookup.h" |
| 10 #include "src/messages.h" | 10 #include "src/messages.h" |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 238 } | 238 } |
| 239 } | 239 } |
| 240 | 240 |
| 241 | 241 |
| 242 MaybeHandle<Object> BasicJsonStringifier::ApplyToJsonFunction( | 242 MaybeHandle<Object> BasicJsonStringifier::ApplyToJsonFunction( |
| 243 Handle<Object> object, Handle<Object> key) { | 243 Handle<Object> object, Handle<Object> key) { |
| 244 LookupIterator it(object, tojson_string_, | 244 LookupIterator it(object, tojson_string_, |
| 245 LookupIterator::PROTOTYPE_CHAIN_SKIP_INTERCEPTOR); | 245 LookupIterator::PROTOTYPE_CHAIN_SKIP_INTERCEPTOR); |
| 246 Handle<Object> fun; | 246 Handle<Object> fun; |
| 247 ASSIGN_RETURN_ON_EXCEPTION(isolate_, fun, Object::GetProperty(&it), Object); | 247 ASSIGN_RETURN_ON_EXCEPTION(isolate_, fun, Object::GetProperty(&it), Object); |
| 248 if (!fun->IsJSFunction()) return object; | 248 if (!fun->IsCallable()) return object; |
| 249 | 249 |
| 250 // Call toJSON function. | 250 // Call toJSON function. |
| 251 if (key->IsSmi()) key = factory()->NumberToString(key); | 251 if (key->IsSmi()) key = factory()->NumberToString(key); |
| 252 Handle<Object> argv[] = { key }; | 252 Handle<Object> argv[] = { key }; |
| 253 HandleScope scope(isolate_); | 253 HandleScope scope(isolate_); |
| 254 ASSIGN_RETURN_ON_EXCEPTION( | 254 ASSIGN_RETURN_ON_EXCEPTION( |
| 255 isolate_, object, | 255 isolate_, object, |
| 256 Execution::Call(isolate_, fun, object, 1, argv), | 256 Execution::Call(isolate_, fun, object, 1, argv), |
| 257 Object); | 257 Object); |
| 258 return scope.CloseAndEscape(object); | 258 return scope.CloseAndEscape(object); |
| (...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 677 } else { | 677 } else { |
| 678 SerializeString_<uc16, uc16>(object); | 678 SerializeString_<uc16, uc16>(object); |
| 679 } | 679 } |
| 680 } | 680 } |
| 681 } | 681 } |
| 682 | 682 |
| 683 } // namespace internal | 683 } // namespace internal |
| 684 } // namespace v8 | 684 } // namespace v8 |
| 685 | 685 |
| 686 #endif // V8_JSON_STRINGIFIER_H_ | 686 #endif // V8_JSON_STRINGIFIER_H_ |
| OLD | NEW |