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

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

Issue 334323003: Reland r22082 "Replace HeapNumber as doublebox with an explicit MutableHeapNumber." (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Migrations test fixed Created 6 years, 5 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/ia32/stub-cache-ia32.cc ('k') | src/json-stringifier.h » ('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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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_PARSER_H_ 5 #ifndef V8_JSON_PARSER_H_
6 #define V8_JSON_PARSER_H_ 6 #define V8_JSON_PARSER_H_
7 7
8 #include "src/v8.h" 8 #include "src/v8.h"
9 9
10 #include "src/char-predicates-inl.h" 10 #include "src/char-predicates-inl.h"
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after
380 value = ParseJsonValue(); 380 value = ParseJsonValue();
381 if (value.is_null()) return ReportUnexpectedCharacter(); 381 if (value.is_null()) return ReportUnexpectedCharacter();
382 382
383 if (transitioning) { 383 if (transitioning) {
384 int descriptor = map->NumberOfOwnDescriptors(); 384 int descriptor = map->NumberOfOwnDescriptors();
385 PropertyDetails details = 385 PropertyDetails details =
386 target->instance_descriptors()->GetDetails(descriptor); 386 target->instance_descriptors()->GetDetails(descriptor);
387 Representation expected_representation = details.representation(); 387 Representation expected_representation = details.representation();
388 388
389 if (value->FitsRepresentation(expected_representation)) { 389 if (value->FitsRepresentation(expected_representation)) {
390 // If the target representation is double and the value is already 390 if (expected_representation.IsDouble()) {
391 // double, use the existing box. 391 value = Object::NewStorageFor(isolate(), value,
392 if (value->IsSmi() && expected_representation.IsDouble()) { 392 expected_representation);
393 value = factory()->NewHeapNumber(
394 Handle<Smi>::cast(value)->value());
395 } else if (expected_representation.IsHeapObject() && 393 } else if (expected_representation.IsHeapObject() &&
396 !target->instance_descriptors()->GetFieldType( 394 !target->instance_descriptors()->GetFieldType(
397 descriptor)->NowContains(value)) { 395 descriptor)->NowContains(value)) {
398 Handle<HeapType> value_type(value->OptimalType( 396 Handle<HeapType> value_type(value->OptimalType(
399 isolate(), expected_representation)); 397 isolate(), expected_representation));
400 Map::GeneralizeFieldType(target, descriptor, value_type); 398 Map::GeneralizeFieldType(target, descriptor, value_type);
401 } 399 }
402 ASSERT(target->instance_descriptors()->GetFieldType( 400 ASSERT(target->instance_descriptors()->GetFieldType(
403 descriptor)->NowContains(value)); 401 descriptor)->NowContains(value));
404 properties.Add(value, zone()); 402 properties.Add(value, zone());
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after
783 781
784 ASSERT_EQ('"', c0_); 782 ASSERT_EQ('"', c0_);
785 // Advance past the last '"'. 783 // Advance past the last '"'.
786 AdvanceSkipWhitespace(); 784 AdvanceSkipWhitespace();
787 return result; 785 return result;
788 } 786 }
789 787
790 } } // namespace v8::internal 788 } } // namespace v8::internal
791 789
792 #endif // V8_JSON_PARSER_H_ 790 #endif // V8_JSON_PARSER_H_
OLDNEW
« no previous file with comments | « src/ia32/stub-cache-ia32.cc ('k') | src/json-stringifier.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698