OLD | NEW |
1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 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 #include "src/value-serializer.h" | 5 #include "src/value-serializer.h" |
6 | 6 |
7 #include <type_traits> | 7 #include <type_traits> |
8 | 8 |
9 #include "src/base/logging.h" | 9 #include "src/base/logging.h" |
10 #include "src/conversions.h" | 10 #include "src/conversions.h" |
(...skipping 1779 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1790 } | 1790 } |
1791 | 1791 |
1792 size_t begin_properties = | 1792 size_t begin_properties = |
1793 stack.size() - 2 * static_cast<size_t>(num_properties); | 1793 stack.size() - 2 * static_cast<size_t>(num_properties); |
1794 Handle<JSObject> js_object = isolate_->factory()->NewJSObject( | 1794 Handle<JSObject> js_object = isolate_->factory()->NewJSObject( |
1795 isolate_->object_function(), pretenure_); | 1795 isolate_->object_function(), pretenure_); |
1796 if (num_properties && | 1796 if (num_properties && |
1797 !SetPropertiesFromKeyValuePairs( | 1797 !SetPropertiesFromKeyValuePairs( |
1798 isolate_, js_object, &stack[begin_properties], num_properties) | 1798 isolate_, js_object, &stack[begin_properties], num_properties) |
1799 .FromMaybe(false)) { | 1799 .FromMaybe(false)) { |
1800 isolate_->Throw(*isolate_->factory()->NewError( | 1800 DCHECK(isolate_->has_pending_exception()); |
1801 MessageTemplate::kDataCloneDeserializationError)); | |
1802 return MaybeHandle<Object>(); | 1801 return MaybeHandle<Object>(); |
1803 } | 1802 } |
1804 | 1803 |
1805 stack.resize(begin_properties); | 1804 stack.resize(begin_properties); |
1806 new_object = js_object; | 1805 new_object = js_object; |
1807 break; | 1806 break; |
1808 } | 1807 } |
1809 case SerializationTag::kEndSparseJSArray: { | 1808 case SerializationTag::kEndSparseJSArray: { |
1810 ConsumeTag(SerializationTag::kEndSparseJSArray); | 1809 ConsumeTag(SerializationTag::kEndSparseJSArray); |
1811 | 1810 |
(...skipping 10 matching lines...) Expand all Loading... |
1822 | 1821 |
1823 Handle<JSArray> js_array = isolate_->factory()->NewJSArray( | 1822 Handle<JSArray> js_array = isolate_->factory()->NewJSArray( |
1824 0, TERMINAL_FAST_ELEMENTS_KIND, pretenure_); | 1823 0, TERMINAL_FAST_ELEMENTS_KIND, pretenure_); |
1825 JSArray::SetLength(js_array, length); | 1824 JSArray::SetLength(js_array, length); |
1826 size_t begin_properties = | 1825 size_t begin_properties = |
1827 stack.size() - 2 * static_cast<size_t>(num_properties); | 1826 stack.size() - 2 * static_cast<size_t>(num_properties); |
1828 if (num_properties && | 1827 if (num_properties && |
1829 !SetPropertiesFromKeyValuePairs( | 1828 !SetPropertiesFromKeyValuePairs( |
1830 isolate_, js_array, &stack[begin_properties], num_properties) | 1829 isolate_, js_array, &stack[begin_properties], num_properties) |
1831 .FromMaybe(false)) { | 1830 .FromMaybe(false)) { |
1832 isolate_->Throw(*isolate_->factory()->NewError( | 1831 DCHECK(isolate_->has_pending_exception()); |
1833 MessageTemplate::kDataCloneDeserializationError)); | |
1834 return MaybeHandle<Object>(); | 1832 return MaybeHandle<Object>(); |
1835 } | 1833 } |
1836 | 1834 |
1837 stack.resize(begin_properties); | 1835 stack.resize(begin_properties); |
1838 new_object = js_array; | 1836 new_object = js_array; |
1839 break; | 1837 break; |
1840 } | 1838 } |
1841 case SerializationTag::kEndDenseJSArray: { | 1839 case SerializationTag::kEndDenseJSArray: { |
1842 // This was already broken in Chromium, and apparently wasn't missed. | 1840 // This was already broken in Chromium, and apparently wasn't missed. |
1843 isolate_->Throw(*isolate_->factory()->NewError( | 1841 isolate_->Throw(*isolate_->factory()->NewError( |
(...skipping 18 matching lines...) Expand all Loading... |
1862 if (stack.size() != 1) { | 1860 if (stack.size() != 1) { |
1863 isolate_->Throw(*isolate_->factory()->NewError( | 1861 isolate_->Throw(*isolate_->factory()->NewError( |
1864 MessageTemplate::kDataCloneDeserializationError)); | 1862 MessageTemplate::kDataCloneDeserializationError)); |
1865 return MaybeHandle<Object>(); | 1863 return MaybeHandle<Object>(); |
1866 } | 1864 } |
1867 return scope.CloseAndEscape(stack[0]); | 1865 return scope.CloseAndEscape(stack[0]); |
1868 } | 1866 } |
1869 | 1867 |
1870 } // namespace internal | 1868 } // namespace internal |
1871 } // namespace v8 | 1869 } // namespace v8 |
OLD | NEW |