Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(299)

Side by Side Diff: src/json-stringifier.h

Issue 237673014: Move functions from handles.cc to where they belong. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: rebox Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/isolate.cc ('k') | src/lithium-codegen.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 466 matching lines...) Expand 10 before | Expand all | Expand 10 after
477 477
478 return SerializeGeneric(object, key, comma, deferred_string_key); 478 return SerializeGeneric(object, key, comma, deferred_string_key);
479 } 479 }
480 480
481 481
482 BasicJsonStringifier::Result BasicJsonStringifier::SerializeGeneric( 482 BasicJsonStringifier::Result BasicJsonStringifier::SerializeGeneric(
483 Handle<Object> object, 483 Handle<Object> object,
484 Handle<Object> key, 484 Handle<Object> key,
485 bool deferred_comma, 485 bool deferred_comma,
486 bool deferred_key) { 486 bool deferred_key) {
487 Handle<JSObject> builtins(isolate_->native_context()->builtins()); 487 Handle<JSObject> builtins(isolate_->native_context()->builtins(), isolate_);
488 Handle<JSFunction> builtin = Handle<JSFunction>::cast( 488 Handle<JSFunction> builtin = Handle<JSFunction>::cast(Object::GetProperty(
489 GetProperty(builtins, "JSONSerializeAdapter").ToHandleChecked()); 489 isolate_, builtins, "JSONSerializeAdapter").ToHandleChecked());
490 490
491 Handle<Object> argv[] = { key, object }; 491 Handle<Object> argv[] = { key, object };
492 Handle<Object> result; 492 Handle<Object> result;
493 ASSIGN_RETURN_ON_EXCEPTION_VALUE( 493 ASSIGN_RETURN_ON_EXCEPTION_VALUE(
494 isolate_, result, 494 isolate_, result,
495 Execution::Call(isolate_, builtin, object, 2, argv), 495 Execution::Call(isolate_, builtin, object, 2, argv),
496 EXCEPTION); 496 EXCEPTION);
497 if (result->IsUndefined()) return UNCHANGED; 497 if (result->IsUndefined()) return UNCHANGED;
498 if (deferred_key) { 498 if (deferred_key) {
499 if (key->IsSmi()) key = factory_->NumberToString(key); 499 if (key->IsSmi()) key = factory_->NumberToString(key);
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
688 EXCEPTION); 688 EXCEPTION);
689 } 689 }
690 Result result = SerializeProperty(property, comma, key); 690 Result result = SerializeProperty(property, comma, key);
691 if (!comma && result == SUCCESS) comma = true; 691 if (!comma && result == SUCCESS) comma = true;
692 if (result == EXCEPTION) return result; 692 if (result == EXCEPTION) return result;
693 } 693 }
694 } else { 694 } else {
695 Handle<FixedArray> contents; 695 Handle<FixedArray> contents;
696 ASSIGN_RETURN_ON_EXCEPTION_VALUE( 696 ASSIGN_RETURN_ON_EXCEPTION_VALUE(
697 isolate_, contents, 697 isolate_, contents,
698 GetKeysInFixedArrayFor(object, LOCAL_ONLY), 698 JSReceiver::GetKeys(object, JSReceiver::LOCAL_ONLY),
699 EXCEPTION); 699 EXCEPTION);
700 700
701 for (int i = 0; i < contents->length(); i++) { 701 for (int i = 0; i < contents->length(); i++) {
702 Object* key = contents->get(i); 702 Object* key = contents->get(i);
703 Handle<String> key_handle; 703 Handle<String> key_handle;
704 MaybeHandle<Object> maybe_property; 704 MaybeHandle<Object> maybe_property;
705 if (key->IsString()) { 705 if (key->IsString()) {
706 key_handle = Handle<String>(String::cast(key), isolate_); 706 key_handle = Handle<String>(String::cast(key), isolate_);
707 maybe_property = Object::GetPropertyOrElement(object, key_handle); 707 maybe_property = Object::GetPropertyOrElement(object, key_handle);
708 } else { 708 } else {
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
897 SerializeString_<false, uint8_t>(object); 897 SerializeString_<false, uint8_t>(object);
898 } else { 898 } else {
899 SerializeString_<false, uc16>(object); 899 SerializeString_<false, uc16>(object);
900 } 900 }
901 } 901 }
902 } 902 }
903 903
904 } } // namespace v8::internal 904 } } // namespace v8::internal
905 905
906 #endif // V8_JSON_STRINGIFIER_H_ 906 #endif // V8_JSON_STRINGIFIER_H_
OLDNEW
« no previous file with comments | « src/isolate.cc ('k') | src/lithium-codegen.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698