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

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

Issue 1159433003: Use GetProperty for getting elements. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Addressed comments Created 5 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
« no previous file with comments | « src/json-parser.h ('k') | src/lookup.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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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_STRINGIFIER_H_ 5 #ifndef V8_JSON_STRINGIFIER_H_
6 #define V8_JSON_STRINGIFIER_H_ 6 #define V8_JSON_STRINGIFIER_H_
7 7
8 #include "src/v8.h" 8 #include "src/v8.h"
9 9
10 #include "src/conversions.h" 10 #include "src/conversions.h"
(...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after
432 return SUCCESS; 432 return SUCCESS;
433 } 433 }
434 434
435 435
436 BasicJsonStringifier::Result BasicJsonStringifier::SerializeJSArray( 436 BasicJsonStringifier::Result BasicJsonStringifier::SerializeJSArray(
437 Handle<JSArray> object) { 437 Handle<JSArray> object) {
438 HandleScope handle_scope(isolate_); 438 HandleScope handle_scope(isolate_);
439 Result stack_push = StackPush(object); 439 Result stack_push = StackPush(object);
440 if (stack_push != SUCCESS) return stack_push; 440 if (stack_push != SUCCESS) return stack_push;
441 uint32_t length = 0; 441 uint32_t length = 0;
442 CHECK(object->length()->ToArrayIndex(&length)); 442 CHECK(object->length()->ToArrayLength(&length));
443 builder_.AppendCharacter('['); 443 builder_.AppendCharacter('[');
444 switch (object->GetElementsKind()) { 444 switch (object->GetElementsKind()) {
445 case FAST_SMI_ELEMENTS: { 445 case FAST_SMI_ELEMENTS: {
446 Handle<FixedArray> elements( 446 Handle<FixedArray> elements(
447 FixedArray::cast(object->elements()), isolate_); 447 FixedArray::cast(object->elements()), isolate_);
448 for (uint32_t i = 0; i < length; i++) { 448 for (uint32_t i = 0; i < length; i++) {
449 if (i > 0) builder_.AppendCharacter(','); 449 if (i > 0) builder_.AppendCharacter(',');
450 SerializeSmi(Smi::cast(elements->get(i))); 450 SerializeSmi(Smi::cast(elements->get(i)));
451 } 451 }
452 break; 452 break;
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
681 SerializeString_<uint8_t, uc16>(object); 681 SerializeString_<uint8_t, uc16>(object);
682 } else { 682 } else {
683 SerializeString_<uc16, uc16>(object); 683 SerializeString_<uc16, uc16>(object);
684 } 684 }
685 } 685 }
686 } 686 }
687 687
688 } } // namespace v8::internal 688 } } // namespace v8::internal
689 689
690 #endif // V8_JSON_STRINGIFIER_H_ 690 #endif // V8_JSON_STRINGIFIER_H_
OLDNEW
« no previous file with comments | « src/json-parser.h ('k') | src/lookup.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698