| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 353 | 353 |
| 354 | 354 |
| 355 Handle<Object> BasicJsonStringifier::ApplyToJsonFunction( | 355 Handle<Object> BasicJsonStringifier::ApplyToJsonFunction( |
| 356 Handle<Object> object, Handle<Object> key) { | 356 Handle<Object> object, Handle<Object> key) { |
| 357 LookupResult lookup(isolate_); | 357 LookupResult lookup(isolate_); |
| 358 JSObject::cast(*object)->LookupRealNamedProperty(*tojson_string_, &lookup); | 358 JSObject::cast(*object)->LookupRealNamedProperty(*tojson_string_, &lookup); |
| 359 if (!lookup.IsProperty()) return object; | 359 if (!lookup.IsProperty()) return object; |
| 360 PropertyAttributes attr; | 360 PropertyAttributes attr; |
| 361 Handle<Object> fun = | 361 Handle<Object> fun = |
| 362 Object::GetProperty(object, object, &lookup, tojson_string_, &attr); | 362 Object::GetProperty(object, object, &lookup, tojson_string_, &attr); |
| 363 if (fun.is_null()) return Handle<Object>::null(); |
| 363 if (!fun->IsJSFunction()) return object; | 364 if (!fun->IsJSFunction()) return object; |
| 364 | 365 |
| 365 // Call toJSON function. | 366 // Call toJSON function. |
| 366 if (key->IsSmi()) key = factory_->NumberToString(key); | 367 if (key->IsSmi()) key = factory_->NumberToString(key); |
| 367 Handle<Object> argv[] = { key }; | 368 Handle<Object> argv[] = { key }; |
| 368 bool has_exception = false; | 369 bool has_exception = false; |
| 369 HandleScope scope(isolate_); | 370 HandleScope scope(isolate_); |
| 370 object = Execution::Call(isolate_, fun, object, 1, argv, &has_exception); | 371 object = Execution::Call(isolate_, fun, object, 1, argv, &has_exception); |
| 371 // Return empty handle to signal an exception. | 372 // Return empty handle to signal an exception. |
| 372 if (has_exception) return Handle<Object>::null(); | 373 if (has_exception) return Handle<Object>::null(); |
| (...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 846 SerializeString_<false, uint8_t>(object); | 847 SerializeString_<false, uint8_t>(object); |
| 847 } else { | 848 } else { |
| 848 SerializeString_<false, uc16>(object); | 849 SerializeString_<false, uc16>(object); |
| 849 } | 850 } |
| 850 } | 851 } |
| 851 } | 852 } |
| 852 | 853 |
| 853 } } // namespace v8::internal | 854 } } // namespace v8::internal |
| 854 | 855 |
| 855 #endif // V8_JSON_STRINGIFIER_H_ | 856 #endif // V8_JSON_STRINGIFIER_H_ |
| OLD | NEW |