| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 "|\0 }\0 ~\0 \177\0 "; | 209 "|\0 }\0 ~\0 \177\0 "; |
| 210 | 210 |
| 211 | 211 |
| 212 BasicJsonStringifier::BasicJsonStringifier(Isolate* isolate) | 212 BasicJsonStringifier::BasicJsonStringifier(Isolate* isolate) |
| 213 : isolate_(isolate), current_index_(0), is_ascii_(true) { | 213 : isolate_(isolate), current_index_(0), is_ascii_(true) { |
| 214 factory_ = isolate_->factory(); | 214 factory_ = isolate_->factory(); |
| 215 accumulator_store_ = Handle<JSValue>::cast( | 215 accumulator_store_ = Handle<JSValue>::cast( |
| 216 factory_->ToObject(factory_->empty_string())); | 216 factory_->ToObject(factory_->empty_string())); |
| 217 part_length_ = kInitialPartLength; | 217 part_length_ = kInitialPartLength; |
| 218 current_part_ = factory_->NewRawOneByteString(kInitialPartLength); | 218 current_part_ = factory_->NewRawOneByteString(kInitialPartLength); |
| 219 tojson_symbol_ = factory_->LookupAsciiSymbol("toJSON"); | 219 tojson_symbol_ = |
| 220 factory_->LookupOneByteSymbol(STATIC_ASCII_VECTOR("toJSON")); |
| 220 stack_ = factory_->NewJSArray(8); | 221 stack_ = factory_->NewJSArray(8); |
| 221 } | 222 } |
| 222 | 223 |
| 223 | 224 |
| 224 MaybeObject* BasicJsonStringifier::Stringify(Handle<Object> object) { | 225 MaybeObject* BasicJsonStringifier::Stringify(Handle<Object> object) { |
| 225 switch (SerializeObject(object)) { | 226 switch (SerializeObject(object)) { |
| 226 case UNCHANGED: | 227 case UNCHANGED: |
| 227 return isolate_->heap()->undefined_value(); | 228 return isolate_->heap()->undefined_value(); |
| 228 case SUCCESS: | 229 case SUCCESS: |
| 229 ShrinkCurrentPart(); | 230 ShrinkCurrentPart(); |
| (...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 739 SerializeString_<false, char>(object); | 740 SerializeString_<false, char>(object); |
| 740 } else { | 741 } else { |
| 741 SerializeString_<false, uc16>(object); | 742 SerializeString_<false, uc16>(object); |
| 742 } | 743 } |
| 743 } | 744 } |
| 744 } | 745 } |
| 745 | 746 |
| 746 } } // namespace v8::internal | 747 } } // namespace v8::internal |
| 747 | 748 |
| 748 #endif // V8_JSON_STRINGIFIER_H_ | 749 #endif // V8_JSON_STRINGIFIER_H_ |
| OLD | NEW |