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

Side by Side Diff: lib/mirrors.cc

Issue 10874072: Use the return value of vm native methods to set the return value, (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 8 years, 3 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
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 "vm/bootstrap_natives.h"
6
7 #include "platform/json.h"
8 #include "include/dart_api.h" 5 #include "include/dart_api.h"
9 #include "include/dart_debugger_api.h" 6 #include "include/dart_debugger_api.h"
7 #include "platform/json.h"
8 #include "vm/bootstrap_natives.h"
10 #include "vm/dart_entry.h" 9 #include "vm/dart_entry.h"
11 #include "vm/exceptions.h" 10 #include "vm/exceptions.h"
12 #include "vm/message.h" 11 #include "vm/message.h"
13 #include "vm/port.h" 12 #include "vm/port.h"
14 #include "vm/resolver.h" 13 #include "vm/resolver.h"
15 14
16 namespace dart { 15 namespace dart {
17 16
18 DEFINE_NATIVE_ENTRY(Mirrors_isLocalPort, 1) { 17 DEFINE_NATIVE_ENTRY(Mirrors_isLocalPort, 1) {
19 GET_NATIVE_ARGUMENT(Instance, port, arguments->At(0)); 18 GET_NATIVE_ARGUMENT(Instance, port, arguments->At(0));
20 19
21 // Get the port id from the SendPort instance. 20 // Get the port id from the SendPort instance.
22 const Object& id_obj = Object::Handle(DartLibraryCalls::PortGetId(port)); 21 const Object& id_obj = Object::Handle(DartLibraryCalls::PortGetId(port));
23 if (id_obj.IsError()) { 22 if (id_obj.IsError()) {
24 Exceptions::PropagateError(Error::Cast(id_obj)); 23 Exceptions::PropagateError(Error::Cast(id_obj));
25 UNREACHABLE(); 24 UNREACHABLE();
26 } 25 }
27 ASSERT(id_obj.IsSmi() || id_obj.IsMint()); 26 ASSERT(id_obj.IsSmi() || id_obj.IsMint());
28 Integer& id = Integer::Handle(); 27 Integer& id = Integer::Handle();
29 id ^= id_obj.raw(); 28 id ^= id_obj.raw();
30 Dart_Port port_id = static_cast<Dart_Port>(id.AsInt64Value()); 29 Dart_Port port_id = static_cast<Dart_Port>(id.AsInt64Value());
31 const Bool& is_local = Bool::Handle(Bool::Get(PortMap::IsLocalPort(port_id))); 30 return Bool::Get(PortMap::IsLocalPort(port_id));
32 arguments->SetReturn(is_local);
33 } 31 }
34 32
35 33
36 // TODO(turnidge): Add Map support to the dart embedding api instead 34 // TODO(turnidge): Add Map support to the dart embedding api instead
37 // of implementing it here. 35 // of implementing it here.
38 static Dart_Handle CoreLib() { 36 static Dart_Handle CoreLib() {
39 Dart_Handle core_lib_name = Dart_NewString("dart:core"); 37 Dart_Handle core_lib_name = Dart_NewString("dart:core");
40 return Dart_LookupLibrary(core_lib_name); 38 return Dart_LookupLibrary(core_lib_name);
41 } 39 }
42 40
(...skipping 882 matching lines...) Expand 10 before | Expand all | Expand 10 after
925 } 923 }
926 924
927 925
928 void HandleMirrorsMessage(Isolate* isolate, 926 void HandleMirrorsMessage(Isolate* isolate,
929 Dart_Port reply_port, 927 Dart_Port reply_port,
930 const Instance& message) { 928 const Instance& message) {
931 UNIMPLEMENTED(); 929 UNIMPLEMENTED();
932 } 930 }
933 931
934 } // namespace dart 932 } // namespace dart
OLDNEW
« no previous file with comments | « lib/math.cc ('k') | lib/object.cc » ('j') | vm/bootstrap_natives.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698