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

Side by Side Diff: runtime/vm/dart_api_impl.cc

Issue 1344993002: Refactor isolate interrupts to use OOB messages instead of interrupt bits. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: code review 2 Created 5 years, 2 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
« no previous file with comments | « runtime/vm/code_generator.cc ('k') | runtime/vm/debugger.h » ('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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 "include/dart_api.h" 5 #include "include/dart_api.h"
6 #include "include/dart_mirrors_api.h" 6 #include "include/dart_mirrors_api.h"
7 #include "include/dart_native_api.h" 7 #include "include/dart_native_api.h"
8 8
9 #include "platform/assert.h" 9 #include "platform/assert.h"
10 #include "vm/class_finalizer.h" 10 #include "vm/class_finalizer.h"
(...skipping 1578 matching lines...) Expand 10 before | Expand all | Expand 10 after
1589 } 1589 }
1590 1590
1591 1591
1592 DART_EXPORT void Dart_InterruptIsolate(Dart_Isolate isolate) { 1592 DART_EXPORT void Dart_InterruptIsolate(Dart_Isolate isolate) {
1593 TRACE_API_CALL(CURRENT_FUNC); 1593 TRACE_API_CALL(CURRENT_FUNC);
1594 if (isolate == NULL) { 1594 if (isolate == NULL) {
1595 FATAL1("%s expects argument 'isolate' to be non-null.", CURRENT_FUNC); 1595 FATAL1("%s expects argument 'isolate' to be non-null.", CURRENT_FUNC);
1596 } 1596 }
1597 // TODO(16615): Validate isolate parameter. 1597 // TODO(16615): Validate isolate parameter.
1598 Isolate* iso = reinterpret_cast<Isolate*>(isolate); 1598 Isolate* iso = reinterpret_cast<Isolate*>(isolate);
1599 // Schedule the interrupt. The isolate will notice this bit being set if it 1599 iso->SendInternalLibMessage(Isolate::kInterruptMsg, iso->pause_capability());
1600 // is currently executing in Dart code.
1601 iso->ScheduleInterrupts(Isolate::kApiInterrupt);
1602 // If the isolate is blocked on the message queue, we post a dummy message
1603 // to the isolate's main port. The message will be ultimately ignored, but as
1604 // part of handling the message the interrupt bit which was set above will be
1605 // honored.
1606 // Can't use Dart_Post() since there isn't a current isolate.
1607 Dart_CObject api_null = { Dart_CObject_kNull , { 0 } };
1608 Dart_PostCObject(iso->main_port(), &api_null);
1609 } 1600 }
1610 1601
1611 1602
1612 DART_EXPORT bool Dart_IsolateMakeRunnable(Dart_Isolate isolate) { 1603 DART_EXPORT bool Dart_IsolateMakeRunnable(Dart_Isolate isolate) {
1613 CHECK_NO_ISOLATE(Isolate::Current()); 1604 CHECK_NO_ISOLATE(Isolate::Current());
1614 if (isolate == NULL) { 1605 if (isolate == NULL) {
1615 FATAL1("%s expects argument 'isolate' to be non-null.", CURRENT_FUNC); 1606 FATAL1("%s expects argument 'isolate' to be non-null.", CURRENT_FUNC);
1616 } 1607 }
1617 // TODO(16615): Validate isolate parameter. 1608 // TODO(16615): Validate isolate parameter.
1618 Isolate* iso = reinterpret_cast<Isolate*>(isolate); 1609 Isolate* iso = reinterpret_cast<Isolate*>(isolate);
(...skipping 4382 matching lines...) Expand 10 before | Expand all | Expand 10 after
6001 ApiReallocate); 5992 ApiReallocate);
6002 writer.WriteFullSnapshot(); 5993 writer.WriteFullSnapshot();
6003 *vm_isolate_snapshot_size = writer.VmIsolateSnapshotSize(); 5994 *vm_isolate_snapshot_size = writer.VmIsolateSnapshotSize();
6004 *isolate_snapshot_size = writer.IsolateSnapshotSize(); 5995 *isolate_snapshot_size = writer.IsolateSnapshotSize();
6005 *instructions_snapshot_size = writer.InstructionsSnapshotSize(); 5996 *instructions_snapshot_size = writer.InstructionsSnapshotSize();
6006 5997
6007 return Api::Success(); 5998 return Api::Success();
6008 } 5999 }
6009 6000
6010 } // namespace dart 6001 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/code_generator.cc ('k') | runtime/vm/debugger.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698