| Index: runtime/vm/dart_api_impl.cc
|
| diff --git a/runtime/vm/dart_api_impl.cc b/runtime/vm/dart_api_impl.cc
|
| index f607b189a0cd005500ddd7ce5959c4976a70e346..d4eb65e98e5398b2b6ef563100409a33fe20cc0c 100644
|
| --- a/runtime/vm/dart_api_impl.cc
|
| +++ b/runtime/vm/dart_api_impl.cc
|
| @@ -1584,10 +1584,19 @@ static uint8_t* allocator(uint8_t* ptr, intptr_t old_size, intptr_t new_size) {
|
|
|
| DART_EXPORT bool Dart_Post(Dart_Port port_id, Dart_Handle handle) {
|
| DARTSCOPE(Thread::Current());
|
| + NoSafepointScope no_safepoint_scope;
|
| if (port_id == ILLEGAL_PORT) {
|
| return false;
|
| }
|
| - const Object& object = Object::Handle(Z, Api::UnwrapHandle(handle));
|
| +
|
| + // Smis and null can be sent without serialization.
|
| + RawObject* raw_obj = Api::UnwrapHandle(handle);
|
| + if (ApiObjectConverter::CanConvert(raw_obj)) {
|
| + return PortMap::PostMessage(new Message(
|
| + port_id, raw_obj, Message::kNormalPriority));
|
| + }
|
| +
|
| + const Object& object = Object::Handle(Z, raw_obj);
|
| uint8_t* data = NULL;
|
| MessageWriter writer(&data, &allocator, false);
|
| writer.WriteMessage(object);
|
|
|