| 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/v8.h" | 8 #include "src/v8.h" |
| 9 | 9 |
| 10 #include "src/conversions.h" | 10 #include "src/conversions.h" |
| (...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 265 return EXCEPTION; | 265 return EXCEPTION; |
| 266 } | 266 } |
| 267 | 267 |
| 268 int length = Smi::cast(stack_->length())->value(); | 268 int length = Smi::cast(stack_->length())->value(); |
| 269 { | 269 { |
| 270 DisallowHeapAllocation no_allocation; | 270 DisallowHeapAllocation no_allocation; |
| 271 FixedArray* elements = FixedArray::cast(stack_->elements()); | 271 FixedArray* elements = FixedArray::cast(stack_->elements()); |
| 272 for (int i = 0; i < length; i++) { | 272 for (int i = 0; i < length; i++) { |
| 273 if (elements->get(i) == *object) { | 273 if (elements->get(i) == *object) { |
| 274 AllowHeapAllocation allow_to_return_error; | 274 AllowHeapAllocation allow_to_return_error; |
| 275 Handle<Object> error; | 275 Handle<Object> error = factory()->NewTypeError( |
| 276 MaybeHandle<Object> maybe_error = factory()->NewTypeError( | |
| 277 "circular_structure", HandleVector<Object>(NULL, 0)); | 276 "circular_structure", HandleVector<Object>(NULL, 0)); |
| 278 if (maybe_error.ToHandle(&error)) isolate_->Throw(*error); | 277 isolate_->Throw(*error); |
| 279 return EXCEPTION; | 278 return EXCEPTION; |
| 280 } | 279 } |
| 281 } | 280 } |
| 282 } | 281 } |
| 283 JSArray::EnsureSize(stack_, length + 1); | 282 JSArray::EnsureSize(stack_, length + 1); |
| 284 FixedArray::cast(stack_->elements())->set(length, *object); | 283 FixedArray::cast(stack_->elements())->set(length, *object); |
| 285 stack_->set_length(Smi::FromInt(length + 1)); | 284 stack_->set_length(Smi::FromInt(length + 1)); |
| 286 return SUCCESS; | 285 return SUCCESS; |
| 287 } | 286 } |
| 288 | 287 |
| (...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 677 SerializeString_<uint8_t, uc16>(object); | 676 SerializeString_<uint8_t, uc16>(object); |
| 678 } else { | 677 } else { |
| 679 SerializeString_<uc16, uc16>(object); | 678 SerializeString_<uc16, uc16>(object); |
| 680 } | 679 } |
| 681 } | 680 } |
| 682 } | 681 } |
| 683 | 682 |
| 684 } } // namespace v8::internal | 683 } } // namespace v8::internal |
| 685 | 684 |
| 686 #endif // V8_JSON_STRINGIFIER_H_ | 685 #endif // V8_JSON_STRINGIFIER_H_ |
| OLD | NEW |