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

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

Issue 200363002: Handlify callers of Object::GetElement. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: addressed comments Created 6 years, 9 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.h ('k') | src/liveedit.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 637 matching lines...) Expand 10 before | Expand all | Expand 10 after
648 PropertyDetails details = map->instance_descriptors()->GetDetails(i); 648 PropertyDetails details = map->instance_descriptors()->GetDetails(i);
649 if (details.IsDontEnum()) continue; 649 if (details.IsDontEnum()) continue;
650 Handle<Object> property; 650 Handle<Object> property;
651 if (details.type() == FIELD && *map == object->map()) { 651 if (details.type() == FIELD && *map == object->map()) {
652 property = Handle<Object>( 652 property = Handle<Object>(
653 object->RawFastPropertyAt( 653 object->RawFastPropertyAt(
654 map->instance_descriptors()->GetFieldIndex(i)), 654 map->instance_descriptors()->GetFieldIndex(i)),
655 isolate_); 655 isolate_);
656 } else { 656 } else {
657 property = GetProperty(isolate_, object, key); 657 property = GetProperty(isolate_, object, key);
658 if (property.is_null()) return EXCEPTION; 658 RETURN_IF_EMPTY_HANDLE_VALUE(isolate_, property, EXCEPTION);
659 } 659 }
660 Result result = SerializeProperty(property, comma, key); 660 Result result = SerializeProperty(property, comma, key);
661 if (!comma && result == SUCCESS) comma = true; 661 if (!comma && result == SUCCESS) comma = true;
662 if (result >= EXCEPTION) return result; 662 if (result >= EXCEPTION) return result;
663 } 663 }
664 } else { 664 } else {
665 bool has_exception = false; 665 bool has_exception = false;
666 Handle<FixedArray> contents = 666 Handle<FixedArray> contents =
667 GetKeysInFixedArrayFor(object, LOCAL_ONLY, &has_exception); 667 GetKeysInFixedArrayFor(object, LOCAL_ONLY, &has_exception);
668 if (has_exception) return EXCEPTION; 668 if (has_exception) return EXCEPTION;
(...skipping 11 matching lines...) Expand all
680 uint32_t index; 680 uint32_t index;
681 if (key->IsSmi()) { 681 if (key->IsSmi()) {
682 property = Object::GetElement( 682 property = Object::GetElement(
683 isolate_, object, Smi::cast(key)->value()); 683 isolate_, object, Smi::cast(key)->value());
684 } else if (key_handle->AsArrayIndex(&index)) { 684 } else if (key_handle->AsArrayIndex(&index)) {
685 property = Object::GetElement(isolate_, object, index); 685 property = Object::GetElement(isolate_, object, index);
686 } else { 686 } else {
687 property = GetProperty(isolate_, object, key_handle); 687 property = GetProperty(isolate_, object, key_handle);
688 } 688 }
689 } 689 }
690 if (property.is_null()) return EXCEPTION; 690 RETURN_IF_EMPTY_HANDLE_VALUE(isolate_, property, EXCEPTION);
691 Result result = SerializeProperty(property, comma, key_handle); 691 Result result = SerializeProperty(property, comma, key_handle);
692 if (!comma && result == SUCCESS) comma = true; 692 if (!comma && result == SUCCESS) comma = true;
693 if (result >= EXCEPTION) return result; 693 if (result >= EXCEPTION) return result;
694 } 694 }
695 } 695 }
696 696
697 Append('}'); 697 Append('}');
698 StackPop(); 698 StackPop();
699 current_part_ = handle_scope.CloseAndEscape(current_part_); 699 current_part_ = handle_scope.CloseAndEscape(current_part_);
700 return SUCCESS; 700 return SUCCESS;
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
847 SerializeString_<false, uint8_t>(object); 847 SerializeString_<false, uint8_t>(object);
848 } else { 848 } else {
849 SerializeString_<false, uc16>(object); 849 SerializeString_<false, uc16>(object);
850 } 850 }
851 } 851 }
852 } 852 }
853 853
854 } } // namespace v8::internal 854 } } // namespace v8::internal
855 855
856 #endif // V8_JSON_STRINGIFIER_H_ 856 #endif // V8_JSON_STRINGIFIER_H_
OLDNEW
« no previous file with comments | « src/isolate.h ('k') | src/liveedit.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698