| OLD | NEW |
| 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/conversions.h" | 8 #include "src/conversions.h" |
| 9 #include "src/lookup.h" | 9 #include "src/lookup.h" |
| 10 #include "src/messages.h" | 10 #include "src/messages.h" |
| (...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 512 } | 512 } |
| 513 return SUCCESS; | 513 return SUCCESS; |
| 514 } | 514 } |
| 515 | 515 |
| 516 | 516 |
| 517 BasicJsonStringifier::Result BasicJsonStringifier::SerializeJSObject( | 517 BasicJsonStringifier::Result BasicJsonStringifier::SerializeJSObject( |
| 518 Handle<JSObject> object) { | 518 Handle<JSObject> object) { |
| 519 HandleScope handle_scope(isolate_); | 519 HandleScope handle_scope(isolate_); |
| 520 Result stack_push = StackPush(object); | 520 Result stack_push = StackPush(object); |
| 521 if (stack_push != SUCCESS) return stack_push; | 521 if (stack_push != SUCCESS) return stack_push; |
| 522 DCHECK(!object->IsJSGlobalProxy() && !object->IsGlobalObject()); | 522 DCHECK(!object->IsJSGlobalProxy() && !object->IsJSGlobalObject()); |
| 523 | 523 |
| 524 builder_.AppendCharacter('{'); | 524 builder_.AppendCharacter('{'); |
| 525 bool comma = false; | 525 bool comma = false; |
| 526 | 526 |
| 527 if (object->HasFastProperties() && | 527 if (object->HasFastProperties() && |
| 528 !object->HasIndexedInterceptor() && | 528 !object->HasIndexedInterceptor() && |
| 529 !object->HasNamedInterceptor() && | 529 !object->HasNamedInterceptor() && |
| 530 object->elements()->length() == 0) { | 530 object->elements()->length() == 0) { |
| 531 Handle<Map> map(object->map()); | 531 Handle<Map> map(object->map()); |
| 532 for (int i = 0; i < map->NumberOfOwnDescriptors(); i++) { | 532 for (int i = 0; i < map->NumberOfOwnDescriptors(); i++) { |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 673 } else { | 673 } else { |
| 674 SerializeString_<uc16, uc16>(object); | 674 SerializeString_<uc16, uc16>(object); |
| 675 } | 675 } |
| 676 } | 676 } |
| 677 } | 677 } |
| 678 | 678 |
| 679 } // namespace internal | 679 } // namespace internal |
| 680 } // namespace v8 | 680 } // namespace v8 |
| 681 | 681 |
| 682 #endif // V8_JSON_STRINGIFIER_H_ | 682 #endif // V8_JSON_STRINGIFIER_H_ |
| OLD | NEW |