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 "platform/utils.h" |
6 #include "vm/bootstrap_natives.h" | 7 #include "vm/bootstrap_natives.h" |
7 #include "vm/class_finalizer.h" | 8 #include "vm/class_finalizer.h" |
8 #include "vm/dart.h" | 9 #include "vm/dart.h" |
9 #include "vm/dart_api_impl.h" | 10 #include "vm/dart_api_impl.h" |
10 #include "vm/dart_entry.h" | 11 #include "vm/dart_entry.h" |
11 #include "vm/exceptions.h" | 12 #include "vm/exceptions.h" |
12 #include "vm/longjump.h" | 13 #include "vm/longjump.h" |
13 #include "vm/message_handler.h" | 14 #include "vm/message_handler.h" |
14 #include "vm/object.h" | 15 #include "vm/object.h" |
15 #include "vm/object_store.h" | 16 #include "vm/object_store.h" |
(...skipping 14 matching lines...) Expand all Loading... |
30 class_name_(class_name), | 31 class_name_(class_name), |
31 port_id_(port_id) {} | 32 port_id_(port_id) {} |
32 | 33 |
33 char* library_url_; | 34 char* library_url_; |
34 char* class_name_; | 35 char* class_name_; |
35 intptr_t port_id_; | 36 intptr_t port_id_; |
36 }; | 37 }; |
37 | 38 |
38 | 39 |
39 static uint8_t* allocator(uint8_t* ptr, intptr_t old_size, intptr_t new_size) { | 40 static uint8_t* allocator(uint8_t* ptr, intptr_t old_size, intptr_t new_size) { |
40 void* new_ptr = realloc(reinterpret_cast<void*>(ptr), new_size); | 41 return Utils::Realloc(ptr, old_size, new_size); |
41 return reinterpret_cast<uint8_t*>(new_ptr); | |
42 } | 42 } |
43 | 43 |
44 | 44 |
45 // TODO(turnidge): Move to DartLibraryCalls. | 45 // TODO(turnidge): Move to DartLibraryCalls. |
46 static RawObject* ReceivePortCreate(intptr_t port_id) { | 46 static RawObject* ReceivePortCreate(intptr_t port_id) { |
47 Isolate* isolate = Isolate::Current(); | 47 Isolate* isolate = Isolate::Current(); |
48 Function& func = | 48 Function& func = |
49 Function::Handle(isolate, | 49 Function::Handle(isolate, |
50 isolate->object_store()->receive_port_create_function()); | 50 isolate->object_store()->receive_port_create_function()); |
51 const int kNumArguments = 1; | 51 const int kNumArguments = 1; |
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
295 | 295 |
296 DEFINE_NATIVE_ENTRY(isolate_getPortInternal, 0) { | 296 DEFINE_NATIVE_ENTRY(isolate_getPortInternal, 0) { |
297 const Object& port = Object::Handle(ReceivePortCreate(isolate->main_port())); | 297 const Object& port = Object::Handle(ReceivePortCreate(isolate->main_port())); |
298 if (port.IsError()) { | 298 if (port.IsError()) { |
299 Exceptions::PropagateError(Error::Cast(port)); | 299 Exceptions::PropagateError(Error::Cast(port)); |
300 } | 300 } |
301 return port.raw(); | 301 return port.raw(); |
302 } | 302 } |
303 | 303 |
304 } // namespace dart | 304 } // namespace dart |
OLD | NEW |