| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "platform/assert.h" | 5 #include "platform/assert.h" |
| 6 #include "vm/bootstrap_natives.h" | 6 #include "vm/bootstrap_natives.h" |
| 7 #include "vm/class_finalizer.h" | 7 #include "vm/class_finalizer.h" |
| 8 #include "vm/dart.h" | 8 #include "vm/dart.h" |
| 9 #include "vm/dart_api_impl.h" | 9 #include "vm/dart_api_impl.h" |
| 10 #include "vm/dart_entry.h" | 10 #include "vm/dart_entry.h" |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 int32_t hi = static_cast<int32_t>(id >> 32); | 49 int32_t hi = static_cast<int32_t>(id >> 32); |
| 50 int32_t lo = static_cast<int32_t>(id); | 50 int32_t lo = static_cast<int32_t>(id); |
| 51 int32_t hash = (hi ^ lo) & kSmiMax; | 51 int32_t hash = (hi ^ lo) & kSmiMax; |
| 52 return Smi::New(hash); | 52 return Smi::New(hash); |
| 53 } | 53 } |
| 54 | 54 |
| 55 | 55 |
| 56 DEFINE_NATIVE_ENTRY(RawReceivePortImpl_factory, 1) { | 56 DEFINE_NATIVE_ENTRY(RawReceivePortImpl_factory, 1) { |
| 57 ASSERT(TypeArguments::CheckedHandle(arguments->NativeArgAt(0)).IsNull()); | 57 ASSERT(TypeArguments::CheckedHandle(arguments->NativeArgAt(0)).IsNull()); |
| 58 Dart_Port port_id = | 58 Dart_Port port_id = |
| 59 PortMap::CreatePort(arguments->isolate()->message_handler()); | 59 PortMap::CreatePort(isolate->message_handler()); |
| 60 return ReceivePort::New(port_id, false /* not control port */); | 60 return ReceivePort::New(port_id, false /* not control port */); |
| 61 } | 61 } |
| 62 | 62 |
| 63 | 63 |
| 64 DEFINE_NATIVE_ENTRY(RawReceivePortImpl_get_id, 1) { | 64 DEFINE_NATIVE_ENTRY(RawReceivePortImpl_get_id, 1) { |
| 65 GET_NON_NULL_NATIVE_ARGUMENT(ReceivePort, port, arguments->NativeArgAt(0)); | 65 GET_NON_NULL_NATIVE_ARGUMENT(ReceivePort, port, arguments->NativeArgAt(0)); |
| 66 return Integer::NewFromUint64(port.Id()); | 66 return Integer::NewFromUint64(port.Id()); |
| 67 } | 67 } |
| 68 | 68 |
| 69 | 69 |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 248 GET_NON_NULL_NATIVE_ARGUMENT(String, uri, arguments->NativeArgAt(1)); | 248 GET_NON_NULL_NATIVE_ARGUMENT(String, uri, arguments->NativeArgAt(1)); |
| 249 GET_NON_NULL_NATIVE_ARGUMENT(Instance, args, arguments->NativeArgAt(2)); | 249 GET_NON_NULL_NATIVE_ARGUMENT(Instance, args, arguments->NativeArgAt(2)); |
| 250 GET_NON_NULL_NATIVE_ARGUMENT(Instance, message, arguments->NativeArgAt(3)); | 250 GET_NON_NULL_NATIVE_ARGUMENT(Instance, message, arguments->NativeArgAt(3)); |
| 251 GET_NON_NULL_NATIVE_ARGUMENT(Bool, paused, arguments->NativeArgAt(4)); | 251 GET_NON_NULL_NATIVE_ARGUMENT(Bool, paused, arguments->NativeArgAt(4)); |
| 252 GET_NATIVE_ARGUMENT(String, package_root, arguments->NativeArgAt(5)); | 252 GET_NATIVE_ARGUMENT(String, package_root, arguments->NativeArgAt(5)); |
| 253 | 253 |
| 254 // Canonicalize the uri with respect to the current isolate. | 254 // Canonicalize the uri with respect to the current isolate. |
| 255 char* error = NULL; | 255 char* error = NULL; |
| 256 char* canonical_uri = NULL; | 256 char* canonical_uri = NULL; |
| 257 const Library& root_lib = | 257 const Library& root_lib = |
| 258 Library::Handle(arguments->isolate()->object_store()->root_library()); | 258 Library::Handle(isolate->object_store()->root_library()); |
| 259 if (!CanonicalizeUri(arguments->isolate(), root_lib, uri, | 259 if (!CanonicalizeUri(isolate, root_lib, uri, |
| 260 &canonical_uri, &error)) { | 260 &canonical_uri, &error)) { |
| 261 const String& msg = String::Handle(String::New(error)); | 261 const String& msg = String::Handle(String::New(error)); |
| 262 ThrowIsolateSpawnException(msg); | 262 ThrowIsolateSpawnException(msg); |
| 263 } | 263 } |
| 264 | 264 |
| 265 char* utf8_package_root = NULL; | 265 char* utf8_package_root = NULL; |
| 266 if (!package_root.IsNull()) { | 266 if (!package_root.IsNull()) { |
| 267 const intptr_t len = Utf8::Length(package_root); | 267 const intptr_t len = Utf8::Length(package_root); |
| 268 utf8_package_root = zone->Alloc<char>(len + 1); | 268 utf8_package_root = zone->Alloc<char>(len + 1); |
| 269 package_root.ToUTF8(reinterpret_cast<uint8_t*>(utf8_package_root), len); | 269 package_root.ToUTF8(reinterpret_cast<uint8_t*>(utf8_package_root), len); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 302 MessageWriter writer(&data, &allocator, false); | 302 MessageWriter writer(&data, &allocator, false); |
| 303 writer.WriteMessage(msg); | 303 writer.WriteMessage(msg); |
| 304 | 304 |
| 305 PortMap::PostMessage(new Message(port.Id(), | 305 PortMap::PostMessage(new Message(port.Id(), |
| 306 data, writer.BytesWritten(), | 306 data, writer.BytesWritten(), |
| 307 Message::kOOBPriority)); | 307 Message::kOOBPriority)); |
| 308 return Object::null(); | 308 return Object::null(); |
| 309 } | 309 } |
| 310 | 310 |
| 311 } // namespace dart | 311 } // namespace dart |
| OLD | NEW |