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

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

Issue 300283002: Introduce FieldIndex to unify and abstract property/field offset (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fix mutable boxed double runtime function Created 6 years, 6 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/ic.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 396 matching lines...) Expand 10 before | Expand all | Expand 10 after
407 } else { 407 } else {
408 transitioning = false; 408 transitioning = false;
409 } 409 }
410 } 410 }
411 411
412 // Commit the intermediate state to the object and stop transitioning. 412 // Commit the intermediate state to the object and stop transitioning.
413 JSObject::AllocateStorageForMap(json_object, map); 413 JSObject::AllocateStorageForMap(json_object, map);
414 int length = properties.length(); 414 int length = properties.length();
415 for (int i = 0; i < length; i++) { 415 for (int i = 0; i < length; i++) {
416 Handle<Object> value = properties[i]; 416 Handle<Object> value = properties[i];
417 json_object->FastPropertyAtPut(i, *value); 417 FieldIndex index = FieldIndex::ForPropertyIndex(*map, i);
418 json_object->FastPropertyAtPut(index, *value);
418 } 419 }
419 } else { 420 } else {
420 key = ParseJsonInternalizedString(); 421 key = ParseJsonInternalizedString();
421 if (key.is_null() || c0_ != ':') return ReportUnexpectedCharacter(); 422 if (key.is_null() || c0_ != ':') return ReportUnexpectedCharacter();
422 423
423 AdvanceSkipWhitespace(); 424 AdvanceSkipWhitespace();
424 value = ParseJsonValue(); 425 value = ParseJsonValue();
425 if (value.is_null()) return ReportUnexpectedCharacter(); 426 if (value.is_null()) return ReportUnexpectedCharacter();
426 } 427 }
427 428
428 JSObject::SetOwnPropertyIgnoreAttributes( 429 JSObject::SetOwnPropertyIgnoreAttributes(
429 json_object, key, value, NONE).Assert(); 430 json_object, key, value, NONE).Assert();
430 } while (MatchSkipWhiteSpace(',')); 431 } while (MatchSkipWhiteSpace(','));
431 if (c0_ != '}') { 432 if (c0_ != '}') {
432 return ReportUnexpectedCharacter(); 433 return ReportUnexpectedCharacter();
433 } 434 }
434 435
435 // If we transitioned until the very end, transition the map now. 436 // If we transitioned until the very end, transition the map now.
436 if (transitioning) { 437 if (transitioning) {
437 JSObject::AllocateStorageForMap(json_object, map); 438 JSObject::AllocateStorageForMap(json_object, map);
438 int length = properties.length(); 439 int length = properties.length();
439 for (int i = 0; i < length; i++) { 440 for (int i = 0; i < length; i++) {
440 Handle<Object> value = properties[i]; 441 Handle<Object> value = properties[i];
441 json_object->FastPropertyAtPut(i, *value); 442 FieldIndex index = FieldIndex::ForPropertyIndex(*map, i);
443 json_object->FastPropertyAtPut(index, *value);
442 } 444 }
443 } 445 }
444 } 446 }
445 AdvanceSkipWhitespace(); 447 AdvanceSkipWhitespace();
446 return scope.CloseAndEscape(json_object); 448 return scope.CloseAndEscape(json_object);
447 } 449 }
448 450
449 // Parse a JSON array. Position must be right at '['. 451 // Parse a JSON array. Position must be right at '['.
450 template <bool seq_ascii> 452 template <bool seq_ascii>
451 Handle<Object> JsonParser<seq_ascii>::ParseJsonArray() { 453 Handle<Object> JsonParser<seq_ascii>::ParseJsonArray() {
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after
781 783
782 ASSERT_EQ('"', c0_); 784 ASSERT_EQ('"', c0_);
783 // Advance past the last '"'. 785 // Advance past the last '"'.
784 AdvanceSkipWhitespace(); 786 AdvanceSkipWhitespace();
785 return result; 787 return result;
786 } 788 }
787 789
788 } } // namespace v8::internal 790 } } // namespace v8::internal
789 791
790 #endif // V8_JSON_PARSER_H_ 792 #endif // V8_JSON_PARSER_H_
OLDNEW
« no previous file with comments | « src/ic.cc ('k') | src/json-stringifier.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698