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 540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
551 // at the first location the user is interested in. | 551 // at the first location the user is interested in. |
552 isolate->debugger()->SetSingleStep(); | 552 isolate->debugger()->SetSingleStep(); |
553 } | 553 } |
554 const Object& result = Object::Handle(isolate, | 554 const Object& result = Object::Handle(isolate, |
555 DartEntry::InvokeFunction(function, args)); | 555 DartEntry::InvokeFunction(function, args)); |
556 ASSERT(result.IsNull() || result.IsError()); | 556 ASSERT(result.IsNull() || result.IsError()); |
557 return result.raw(); | 557 return result.raw(); |
558 } | 558 } |
559 | 559 |
560 | 560 |
| 561 RawObject* DartLibraryCalls::DrainMicrotaskQueue() { |
| 562 Isolate* isolate = Isolate::Current(); |
| 563 Library& isolate_lib = Library::Handle(isolate, Library::IsolateLibrary()); |
| 564 ASSERT(!isolate_lib.IsNull()); |
| 565 Function& function = Function::Handle(isolate, |
| 566 isolate_lib.LookupFunctionAllowPrivate( |
| 567 Symbols::_runPendingImmediateCallback())); |
| 568 const Object& result = Object::Handle(isolate, |
| 569 DartEntry::InvokeFunction(function, Object::empty_array())); |
| 570 ASSERT(result.IsNull() || result.IsError()); |
| 571 return result.raw(); |
| 572 } |
| 573 |
| 574 |
561 RawObject* DartLibraryCalls::MapSetAt(const Instance& map, | 575 RawObject* DartLibraryCalls::MapSetAt(const Instance& map, |
562 const Instance& key, | 576 const Instance& key, |
563 const Instance& value) { | 577 const Instance& value) { |
564 const int kNumArguments = 3; | 578 const int kNumArguments = 3; |
565 ArgumentsDescriptor args_desc( | 579 ArgumentsDescriptor args_desc( |
566 Array::Handle(ArgumentsDescriptor::New(kNumArguments))); | 580 Array::Handle(ArgumentsDescriptor::New(kNumArguments))); |
567 const Function& function = Function::Handle( | 581 const Function& function = Function::Handle( |
568 Resolver::ResolveDynamic(map, | 582 Resolver::ResolveDynamic(map, |
569 Symbols::AssignIndexToken(), | 583 Symbols::AssignIndexToken(), |
570 args_desc)); | 584 args_desc)); |
571 ASSERT(!function.IsNull()); | 585 ASSERT(!function.IsNull()); |
572 const Array& args = Array::Handle(Array::New(kNumArguments)); | 586 const Array& args = Array::Handle(Array::New(kNumArguments)); |
573 args.SetAt(0, map); | 587 args.SetAt(0, map); |
574 args.SetAt(1, key); | 588 args.SetAt(1, key); |
575 args.SetAt(2, value); | 589 args.SetAt(2, value); |
576 const Object& result = Object::Handle(DartEntry::InvokeFunction(function, | 590 const Object& result = Object::Handle(DartEntry::InvokeFunction(function, |
577 args)); | 591 args)); |
578 return result.raw(); | 592 return result.raw(); |
579 } | 593 } |
580 | 594 |
581 } // namespace dart | 595 } // namespace dart |
OLD | NEW |