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 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
392 return EXCEPTION; | 392 return EXCEPTION; |
393 } | 393 } |
394 | 394 |
395 int length = Smi::cast(stack_->length())->value(); | 395 int length = Smi::cast(stack_->length())->value(); |
396 { | 396 { |
397 DisallowHeapAllocation no_allocation; | 397 DisallowHeapAllocation no_allocation; |
398 FixedArray* elements = FixedArray::cast(stack_->elements()); | 398 FixedArray* elements = FixedArray::cast(stack_->elements()); |
399 for (int i = 0; i < length; i++) { | 399 for (int i = 0; i < length; i++) { |
400 if (elements->get(i) == *object) { | 400 if (elements->get(i) == *object) { |
401 AllowHeapAllocation allow_to_return_error; | 401 AllowHeapAllocation allow_to_return_error; |
402 isolate_->Throw<Object>(factory_->NewTypeError( | 402 isolate_->Throw(*factory_->NewTypeError( |
403 "circular_structure", HandleVector<Object>(NULL, 0))); | 403 "circular_structure", HandleVector<Object>(NULL, 0))); |
404 return EXCEPTION; | 404 return EXCEPTION; |
405 } | 405 } |
406 } | 406 } |
407 } | 407 } |
408 JSArray::EnsureSize(stack_, length + 1); | 408 JSArray::EnsureSize(stack_, length + 1); |
409 FixedArray::cast(stack_->elements())->set(length, *object); | 409 FixedArray::cast(stack_->elements())->set(length, *object); |
410 stack_->set_length(Smi::FromInt(length + 1)); | 410 stack_->set_length(Smi::FromInt(length + 1)); |
411 return SUCCESS; | 411 return SUCCESS; |
412 } | 412 } |
(...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
897 SerializeString_<false, uint8_t>(object); | 897 SerializeString_<false, uint8_t>(object); |
898 } else { | 898 } else { |
899 SerializeString_<false, uc16>(object); | 899 SerializeString_<false, uc16>(object); |
900 } | 900 } |
901 } | 901 } |
902 } | 902 } |
903 | 903 |
904 } } // namespace v8::internal | 904 } } // namespace v8::internal |
905 | 905 |
906 #endif // V8_JSON_STRINGIFIER_H_ | 906 #endif // V8_JSON_STRINGIFIER_H_ |
OLD | NEW |