Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(991)

Side by Side Diff: runtime/lib/isolate.cc

Issue 867113003: Revert r43217, r43215, r43208, r43207, and r43202. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/include/dart_api.h ('k') | runtime/tools/gyp/runtime-configurations.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
11 #include "vm/exceptions.h" 11 #include "vm/exceptions.h"
12 #include "vm/lockers.h" 12 #include "vm/lockers.h"
13 #include "vm/longjump.h" 13 #include "vm/longjump.h"
14 #include "vm/message_handler.h" 14 #include "vm/message_handler.h"
15 #include "vm/object.h" 15 #include "vm/object.h"
16 #include "vm/object_store.h" 16 #include "vm/object_store.h"
17 #include "vm/port.h" 17 #include "vm/port.h"
18 #include "vm/resolver.h" 18 #include "vm/resolver.h"
19 #include "vm/service.h"
20 #include "vm/snapshot.h" 19 #include "vm/snapshot.h"
21 #include "vm/symbols.h" 20 #include "vm/symbols.h"
22 #include "vm/unicode.h" 21 #include "vm/unicode.h"
23 22
24 namespace dart { 23 namespace dart {
25 24
26 static uint8_t* allocator(uint8_t* ptr, intptr_t old_size, intptr_t new_size) { 25 static uint8_t* allocator(uint8_t* ptr, intptr_t old_size, intptr_t new_size) {
27 void* new_ptr = realloc(reinterpret_cast<void*>(ptr), new_size); 26 void* new_ptr = realloc(reinterpret_cast<void*>(ptr), new_size);
28 return reinterpret_cast<uint8_t*>(new_ptr); 27 return reinterpret_cast<uint8_t*>(new_ptr);
29 } 28 }
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 return Smi::New(hash); 95 return Smi::New(hash);
97 } 96 }
98 97
99 98
100 DEFINE_NATIVE_ENTRY(SendPortImpl_sendInternal_, 2) { 99 DEFINE_NATIVE_ENTRY(SendPortImpl_sendInternal_, 2) {
101 GET_NON_NULL_NATIVE_ARGUMENT(SendPort, port, arguments->NativeArgAt(0)); 100 GET_NON_NULL_NATIVE_ARGUMENT(SendPort, port, arguments->NativeArgAt(0));
102 // TODO(iposva): Allow for arbitrary messages to be sent. 101 // TODO(iposva): Allow for arbitrary messages to be sent.
103 GET_NON_NULL_NATIVE_ARGUMENT(Instance, obj, arguments->NativeArgAt(1)); 102 GET_NON_NULL_NATIVE_ARGUMENT(Instance, obj, arguments->NativeArgAt(1));
104 103
105 uint8_t* data = NULL; 104 uint8_t* data = NULL;
106 105 bool can_send_any_object = (isolate->origin_id() == port.origin_id());
107 const Dart_Port destination_port_id = port.Id();
108 const bool can_send_any_object = isolate->origin_id() == port.origin_id();
109
110 MessageWriter writer(&data, &allocator, can_send_any_object); 106 MessageWriter writer(&data, &allocator, can_send_any_object);
111 writer.WriteMessage(obj); 107 writer.WriteMessage(obj);
112 108
113 // TODO(turnidge): Throw an exception when the return value is false? 109 // TODO(turnidge): Throw an exception when the return value is false?
114 PortMap::PostMessage(new Message(destination_port_id, 110 PortMap::PostMessage(new Message(port.Id(),
115 data, writer.BytesWritten(), 111 data, writer.BytesWritten(),
116 Message::kNormalPriority)); 112 Message::kNormalPriority));
117 return Object::null(); 113 return Object::null();
118 } 114 }
119 115
120 116
121 static void ThrowIsolateSpawnException(const String& message) { 117 static void ThrowIsolateSpawnException(const String& message) {
122 const Array& args = Array::Handle(Array::New(1)); 118 const Array& args = Array::Handle(Array::New(1));
123 args.SetAt(0, message); 119 args.SetAt(0, message);
124 Exceptions::ThrowByType(Exceptions::kIsolateSpawn, args); 120 Exceptions::ThrowByType(Exceptions::kIsolateSpawn, args);
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 MessageWriter writer(&data, &allocator, false); 299 MessageWriter writer(&data, &allocator, false);
304 writer.WriteMessage(msg); 300 writer.WriteMessage(msg);
305 301
306 PortMap::PostMessage(new Message(port.Id(), 302 PortMap::PostMessage(new Message(port.Id(),
307 data, writer.BytesWritten(), 303 data, writer.BytesWritten(),
308 Message::kOOBPriority)); 304 Message::kOOBPriority));
309 return Object::null(); 305 return Object::null();
310 } 306 }
311 307
312 } // namespace dart 308 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/include/dart_api.h ('k') | runtime/tools/gyp/runtime-configurations.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698