OLD | NEW |
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 "vm/dart_entry.h" | 5 #include "vm/dart_entry.h" |
6 | 6 |
7 #include "vm/code_generator.h" | 7 #include "vm/code_generator.h" |
8 #include "vm/compiler.h" | 8 #include "vm/compiler.h" |
9 #include "vm/longjump.h" | 9 #include "vm/longjump.h" |
10 #include "vm/object_store.h" | 10 #include "vm/object_store.h" |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 kNumArguments, | 179 kNumArguments, |
180 kNumNamedArguments)); | 180 kNumNamedArguments)); |
181 ASSERT(!function.IsNull()); | 181 ASSERT(!function.IsNull()); |
182 const Instance& result = Instance::Handle( | 182 const Instance& result = Instance::Handle( |
183 DartEntry::InvokeDynamic(left, function, arguments, kNoArgumentNames)); | 183 DartEntry::InvokeDynamic(left, function, arguments, kNoArgumentNames)); |
184 // Object's '==' threw an exception, let the caller handle it. | 184 // Object's '==' threw an exception, let the caller handle it. |
185 ASSERT(result.IsBool() || result.IsUnhandledException()); | 185 ASSERT(result.IsBool() || result.IsUnhandledException()); |
186 return result.raw(); | 186 return result.raw(); |
187 } | 187 } |
188 | 188 |
| 189 |
| 190 RawObject* DartLibraryCalls::HandleMessage(Dart_Port dest_port_id, |
| 191 Dart_Port reply_port_id, |
| 192 const Instance& message) { |
| 193 const String& class_name = |
| 194 String::Handle(String::NewSymbol("ReceivePortImpl")); |
| 195 const String& function_name = |
| 196 String::Handle(String::NewSymbol("_handleMessage")); |
| 197 const int kNumArguments = 3; |
| 198 const Array& kNoArgumentNames = Array::Handle(); |
| 199 const Function& function = Function::Handle( |
| 200 Resolver::ResolveStatic(Library::Handle(Library::CoreLibrary()), |
| 201 class_name, |
| 202 function_name, |
| 203 kNumArguments, |
| 204 kNoArgumentNames, |
| 205 Resolver::kIsQualified)); |
| 206 GrowableArray<const Object*> arguments(kNumArguments); |
| 207 arguments.Add(&Integer::Handle(Integer::New(dest_port_id))); |
| 208 arguments.Add(&Integer::Handle(Integer::New(reply_port_id))); |
| 209 arguments.Add(&message); |
| 210 const Object& result = Object::Handle( |
| 211 DartEntry::InvokeStatic(function, arguments, kNoArgumentNames)); |
| 212 ASSERT(result.IsNull() || result.IsUnhandledException()); |
| 213 return result.raw(); |
| 214 } |
| 215 |
189 } // namespace dart | 216 } // namespace dart |
OLD | NEW |