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

Side by Side Diff: src/json-parser.cc

Issue 2651653002: Use proper descriptors array when committing state to JSON object. (Closed)
Patch Set: Created 3 years, 11 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 the V8 project authors. All rights reserved. 1 // Copyright 2016 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/json-parser.h" 5 #include "src/json-parser.h"
6 6
7 #include "src/char-predicates-inl.h" 7 #include "src/char-predicates-inl.h"
8 #include "src/conversions.h" 8 #include "src/conversions.h"
9 #include "src/debug/debug.h" 9 #include "src/debug/debug.h"
10 #include "src/factory.h" 10 #include "src/factory.h"
(...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after
471 } 471 }
472 472
473 template <bool seq_one_byte> 473 template <bool seq_one_byte>
474 void JsonParser<seq_one_byte>::CommitStateToJsonObject( 474 void JsonParser<seq_one_byte>::CommitStateToJsonObject(
475 Handle<JSObject> json_object, Handle<Map> map, 475 Handle<JSObject> json_object, Handle<Map> map,
476 ZoneList<Handle<Object> >* properties) { 476 ZoneList<Handle<Object> >* properties) {
477 JSObject::AllocateStorageForMap(json_object, map); 477 JSObject::AllocateStorageForMap(json_object, map);
478 DCHECK(!json_object->map()->is_dictionary_map()); 478 DCHECK(!json_object->map()->is_dictionary_map());
479 479
480 DisallowHeapAllocation no_gc; 480 DisallowHeapAllocation no_gc;
481 DescriptorArray* descriptors = map->instance_descriptors(); 481 DescriptorArray* descriptors = json_object->map()->instance_descriptors();
482 int length = properties->length(); 482 int length = properties->length();
483 for (int i = 0; i < length; i++) { 483 for (int i = 0; i < length; i++) {
484 Handle<Object> value = (*properties)[i]; 484 Handle<Object> value = (*properties)[i];
485 // Initializing store. 485 // Initializing store.
486 json_object->WriteToField(i, descriptors->GetDetails(i), *value); 486 json_object->WriteToField(i, descriptors->GetDetails(i), *value);
487 } 487 }
488 } 488 }
489 489
490 // Parse a JSON array. Position must be right at '['. 490 // Parse a JSON array. Position must be right at '['.
491 template <bool seq_one_byte> 491 template <bool seq_one_byte>
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after
804 AdvanceSkipWhitespace(); 804 AdvanceSkipWhitespace();
805 return result; 805 return result;
806 } 806 }
807 807
808 // Explicit instantiation. 808 // Explicit instantiation.
809 template class JsonParser<true>; 809 template class JsonParser<true>;
810 template class JsonParser<false>; 810 template class JsonParser<false>;
811 811
812 } // namespace internal 812 } // namespace internal
813 } // namespace v8 813 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698