| 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 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 394 WriteVarint(id - 1); | 394 WriteVarint(id - 1); |
| 395 return Just(true); | 395 return Just(true); |
| 396 } | 396 } |
| 397 | 397 |
| 398 // Otherwise, allocate an ID for it. | 398 // Otherwise, allocate an ID for it. |
| 399 uint32_t id = next_id_++; | 399 uint32_t id = next_id_++; |
| 400 *id_map_entry = id + 1; | 400 *id_map_entry = id + 1; |
| 401 | 401 |
| 402 // Eliminate callable and exotic objects, which should not be serialized. | 402 // Eliminate callable and exotic objects, which should not be serialized. |
| 403 InstanceType instance_type = receiver->map()->instance_type(); | 403 InstanceType instance_type = receiver->map()->instance_type(); |
| 404 if (receiver->IsCallable() || (instance_type <= LAST_SPECIAL_RECEIVER_TYPE && | 404 if (receiver->IsCallable() || (IsSpecialReceiverInstanceType(instance_type) && |
| 405 instance_type != JS_SPECIAL_API_OBJECT_TYPE)) { | 405 instance_type != JS_SPECIAL_API_OBJECT_TYPE)) { |
| 406 ThrowDataCloneError(MessageTemplate::kDataCloneError, receiver); | 406 ThrowDataCloneError(MessageTemplate::kDataCloneError, receiver); |
| 407 return Nothing<bool>(); | 407 return Nothing<bool>(); |
| 408 } | 408 } |
| 409 | 409 |
| 410 // If we are at the end of the stack, abort. This function may recurse. | 410 // If we are at the end of the stack, abort. This function may recurse. |
| 411 STACK_CHECK(isolate_, Nothing<bool>()); | 411 STACK_CHECK(isolate_, Nothing<bool>()); |
| 412 | 412 |
| 413 HandleScope scope(isolate_); | 413 HandleScope scope(isolate_); |
| 414 switch (instance_type) { | 414 switch (instance_type) { |
| (...skipping 1456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1871 if (stack.size() != 1) { | 1871 if (stack.size() != 1) { |
| 1872 isolate_->Throw(*isolate_->factory()->NewError( | 1872 isolate_->Throw(*isolate_->factory()->NewError( |
| 1873 MessageTemplate::kDataCloneDeserializationError)); | 1873 MessageTemplate::kDataCloneDeserializationError)); |
| 1874 return MaybeHandle<Object>(); | 1874 return MaybeHandle<Object>(); |
| 1875 } | 1875 } |
| 1876 return scope.CloseAndEscape(stack[0]); | 1876 return scope.CloseAndEscape(stack[0]); |
| 1877 } | 1877 } |
| 1878 | 1878 |
| 1879 } // namespace internal | 1879 } // namespace internal |
| 1880 } // namespace v8 | 1880 } // namespace v8 |
| OLD | NEW |