| 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/class_finalizer.h" | 7 #include "vm/class_finalizer.h" |
| 8 #include "vm/code_generator.h" | 8 #include "vm/code_generator.h" |
| 9 #include "vm/compiler.h" | 9 #include "vm/compiler.h" |
| 10 #include "vm/debugger.h" | 10 #include "vm/debugger.h" |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 // Allocate an Invocation object. | 116 // Allocate an Invocation object. |
| 117 const Library& core_lib = Library::Handle(Library::CoreLibrary()); | 117 const Library& core_lib = Library::Handle(Library::CoreLibrary()); |
| 118 | 118 |
| 119 Class& invocation_mirror_class = Class::Handle( | 119 Class& invocation_mirror_class = Class::Handle( |
| 120 core_lib.LookupClass( | 120 core_lib.LookupClass( |
| 121 String::Handle(core_lib.PrivateName(Symbols::InvocationMirror())))); | 121 String::Handle(core_lib.PrivateName(Symbols::InvocationMirror())))); |
| 122 ASSERT(!invocation_mirror_class.IsNull()); | 122 ASSERT(!invocation_mirror_class.IsNull()); |
| 123 const String& function_name = | 123 const String& function_name = |
| 124 String::Handle(core_lib.PrivateName(Symbols::AllocateInvocationMirror())); | 124 String::Handle(core_lib.PrivateName(Symbols::AllocateInvocationMirror())); |
| 125 const Function& allocation_function = Function::Handle( | 125 const Function& allocation_function = Function::Handle( |
| 126 Resolver::ResolveStaticByName(invocation_mirror_class, | 126 invocation_mirror_class.LookupStaticFunction(function_name)); |
| 127 function_name, | |
| 128 Resolver::kIsQualified)); | |
| 129 ASSERT(!allocation_function.IsNull()); | 127 ASSERT(!allocation_function.IsNull()); |
| 130 const int kNumAllocationArgs = 4; | 128 const int kNumAllocationArgs = 4; |
| 131 const Array& allocation_args = Array::Handle(Array::New(kNumAllocationArgs)); | 129 const Array& allocation_args = Array::Handle(Array::New(kNumAllocationArgs)); |
| 132 allocation_args.SetAt(0, target_name); | 130 allocation_args.SetAt(0, target_name); |
| 133 allocation_args.SetAt(1, arguments_descriptor); | 131 allocation_args.SetAt(1, arguments_descriptor); |
| 134 allocation_args.SetAt(2, arguments); | 132 allocation_args.SetAt(2, arguments); |
| 135 allocation_args.SetAt(3, Bool::False()); // Not a super invocation. | 133 allocation_args.SetAt(3, Bool::False()); // Not a super invocation. |
| 136 const Object& invocation_mirror = Object::Handle( | 134 const Object& invocation_mirror = Object::Handle( |
| 137 InvokeFunction(allocation_function, allocation_args)); | 135 InvokeFunction(allocation_function, allocation_args)); |
| 138 | 136 |
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 383 Library& isolate_lib = Library::Handle(Library::IsolateLibrary()); | 381 Library& isolate_lib = Library::Handle(Library::IsolateLibrary()); |
| 384 ASSERT(!isolate_lib.IsNull()); | 382 ASSERT(!isolate_lib.IsNull()); |
| 385 const String& class_name = | 383 const String& class_name = |
| 386 String::Handle(isolate_lib.PrivateName(Symbols::_RawReceivePortImpl())); | 384 String::Handle(isolate_lib.PrivateName(Symbols::_RawReceivePortImpl())); |
| 387 const String& function_name = | 385 const String& function_name = |
| 388 String::Handle(isolate_lib.PrivateName(Symbols::_lookupReceivePort())); | 386 String::Handle(isolate_lib.PrivateName(Symbols::_lookupReceivePort())); |
| 389 function = Resolver::ResolveStatic(isolate_lib, | 387 function = Resolver::ResolveStatic(isolate_lib, |
| 390 class_name, | 388 class_name, |
| 391 function_name, | 389 function_name, |
| 392 kNumArguments, | 390 kNumArguments, |
| 393 Object::empty_array(), | 391 Object::empty_array()); |
| 394 Resolver::kIsQualified); | |
| 395 ASSERT(!function.IsNull()); | 392 ASSERT(!function.IsNull()); |
| 396 isolate->object_store()->set_lookup_receive_port_function(function); | 393 isolate->object_store()->set_lookup_receive_port_function(function); |
| 397 } | 394 } |
| 398 const Array& args = Array::Handle(Array::New(kNumArguments)); | 395 const Array& args = Array::Handle(Array::New(kNumArguments)); |
| 399 args.SetAt(0, Integer::Handle(Integer::New(port_id))); | 396 args.SetAt(0, Integer::Handle(Integer::New(port_id))); |
| 400 const Object& result = | 397 const Object& result = |
| 401 Object::Handle(DartEntry::InvokeFunction(function, args)); | 398 Object::Handle(DartEntry::InvokeFunction(function, args)); |
| 402 return result.raw(); | 399 return result.raw(); |
| 403 } | 400 } |
| 404 | 401 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 415 Library& isolate_lib = Library::Handle(Library::IsolateLibrary()); | 412 Library& isolate_lib = Library::Handle(Library::IsolateLibrary()); |
| 416 ASSERT(!isolate_lib.IsNull()); | 413 ASSERT(!isolate_lib.IsNull()); |
| 417 const String& class_name = | 414 const String& class_name = |
| 418 String::Handle(isolate_lib.PrivateName(Symbols::_RawReceivePortImpl())); | 415 String::Handle(isolate_lib.PrivateName(Symbols::_RawReceivePortImpl())); |
| 419 const String& function_name = | 416 const String& function_name = |
| 420 String::Handle(isolate_lib.PrivateName(Symbols::_handleMessage())); | 417 String::Handle(isolate_lib.PrivateName(Symbols::_handleMessage())); |
| 421 function = Resolver::ResolveStatic(isolate_lib, | 418 function = Resolver::ResolveStatic(isolate_lib, |
| 422 class_name, | 419 class_name, |
| 423 function_name, | 420 function_name, |
| 424 kNumArguments, | 421 kNumArguments, |
| 425 Object::empty_array(), | 422 Object::empty_array()); |
| 426 Resolver::kIsQualified); | |
| 427 ASSERT(!function.IsNull()); | 423 ASSERT(!function.IsNull()); |
| 428 isolate->object_store()->set_handle_message_function(function); | 424 isolate->object_store()->set_handle_message_function(function); |
| 429 } | 425 } |
| 430 const Array& args = Array::Handle(isolate, Array::New(kNumArguments)); | 426 const Array& args = Array::Handle(isolate, Array::New(kNumArguments)); |
| 431 args.SetAt(0, receive_port); | 427 args.SetAt(0, receive_port); |
| 432 args.SetAt(1, Integer::Handle(isolate, Integer::New(reply_port_id))); | 428 args.SetAt(1, Integer::Handle(isolate, Integer::New(reply_port_id))); |
| 433 args.SetAt(2, message); | 429 args.SetAt(2, message); |
| 434 if (isolate->debugger()->IsStepping()) { | 430 if (isolate->debugger()->IsStepping()) { |
| 435 // If the isolate is being debugged and the debugger was stepping | 431 // If the isolate is being debugged and the debugger was stepping |
| 436 // through code, enable single stepping so debugger will stop | 432 // through code, enable single stepping so debugger will stop |
| (...skipping 13 matching lines...) Expand all Loading... |
| 450 const String& class_name = | 446 const String& class_name = |
| 451 String::Handle(isolate_lib.PrivateName(Symbols::_SendPortImpl())); | 447 String::Handle(isolate_lib.PrivateName(Symbols::_SendPortImpl())); |
| 452 const int kNumArguments = 1; | 448 const int kNumArguments = 1; |
| 453 const String& function_name = | 449 const String& function_name = |
| 454 String::Handle(isolate_lib.PrivateName(Symbols::_create())); | 450 String::Handle(isolate_lib.PrivateName(Symbols::_create())); |
| 455 const Function& function = Function::Handle( | 451 const Function& function = Function::Handle( |
| 456 Resolver::ResolveStatic(isolate_lib, | 452 Resolver::ResolveStatic(isolate_lib, |
| 457 class_name, | 453 class_name, |
| 458 function_name, | 454 function_name, |
| 459 kNumArguments, | 455 kNumArguments, |
| 460 Object::empty_array(), | 456 Object::empty_array())); |
| 461 Resolver::kIsQualified)); | |
| 462 ASSERT(!function.IsNull()); | 457 ASSERT(!function.IsNull()); |
| 463 const Array& args = Array::Handle(Array::New(kNumArguments)); | 458 const Array& args = Array::Handle(Array::New(kNumArguments)); |
| 464 args.SetAt(0, Integer::Handle(Integer::New(port_id))); | 459 args.SetAt(0, Integer::Handle(Integer::New(port_id))); |
| 465 return DartEntry::InvokeFunction(function, args); | 460 return DartEntry::InvokeFunction(function, args); |
| 466 } | 461 } |
| 467 | 462 |
| 468 | 463 |
| 469 RawObject* DartLibraryCalls::MapSetAt(const Instance& map, | 464 RawObject* DartLibraryCalls::MapSetAt(const Instance& map, |
| 470 const Instance& key, | 465 const Instance& key, |
| 471 const Instance& value) { | 466 const Instance& value) { |
| (...skipping 23 matching lines...) Expand all Loading... |
| 495 String::Handle(Field::GetterName(Symbols::_id())))); | 490 String::Handle(Field::GetterName(Symbols::_id())))); |
| 496 const Function& func = Function::Handle(cls.LookupDynamicFunction(func_name)); | 491 const Function& func = Function::Handle(cls.LookupDynamicFunction(func_name)); |
| 497 ASSERT(!func.IsNull()); | 492 ASSERT(!func.IsNull()); |
| 498 const Array& args = Array::Handle(Array::New(1)); | 493 const Array& args = Array::Handle(Array::New(1)); |
| 499 args.SetAt(0, port); | 494 args.SetAt(0, port); |
| 500 return DartEntry::InvokeFunction(func, args); | 495 return DartEntry::InvokeFunction(func, args); |
| 501 } | 496 } |
| 502 | 497 |
| 503 | 498 |
| 504 } // namespace dart | 499 } // namespace dart |
| OLD | NEW |