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

Side by Side Diff: runtime/lib/mirrors.cc

Issue 10693071: Use VM type cast and save handles. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 5 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
« no previous file with comments | « runtime/lib/isolate.cc ('k') | runtime/vm/ast.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) 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" 5 #include "vm/bootstrap_natives.h"
6 6
7 #include "platform/json.h" 7 #include "platform/json.h"
8 #include "include/dart_api.h" 8 #include "include/dart_api.h"
9 #include "include/dart_debugger_api.h" 9 #include "include/dart_debugger_api.h"
10 #include "vm/dart_entry.h" 10 #include "vm/dart_entry.h"
11 #include "vm/exceptions.h" 11 #include "vm/exceptions.h"
12 #include "vm/message.h" 12 #include "vm/message.h"
13 #include "vm/port.h" 13 #include "vm/port.h"
14 #include "vm/resolver.h" 14 #include "vm/resolver.h"
15 15
16 namespace dart { 16 namespace dart {
17 17
18 DEFINE_NATIVE_ENTRY(Mirrors_isLocalPort, 1) { 18 DEFINE_NATIVE_ENTRY(Mirrors_isLocalPort, 1) {
19 GET_NATIVE_ARGUMENT(Instance, port, arguments->At(0)); 19 GET_NATIVE_ARGUMENT(Instance, port, arguments->At(0));
20 20
21 // Get the port id from the SendPort instance. 21 // Get the port id from the SendPort instance.
22 const Object& id_obj = Object::Handle(DartLibraryCalls::PortGetId(port)); 22 const Object& id_obj = Object::Handle(DartLibraryCalls::PortGetId(port));
23 if (id_obj.IsError()) { 23 if (id_obj.IsError()) {
24 Exceptions::PropagateError(id_obj); 24 Exceptions::PropagateError(Error::Cast(id_obj));
25 UNREACHABLE(); 25 UNREACHABLE();
26 } 26 }
27 ASSERT(id_obj.IsSmi() || id_obj.IsMint()); 27 ASSERT(id_obj.IsSmi() || id_obj.IsMint());
28 Integer& id = Integer::Handle(); 28 Integer& id = Integer::Handle();
29 id ^= id_obj.raw(); 29 id ^= id_obj.raw();
30 Dart_Port port_id = static_cast<Dart_Port>(id.AsInt64Value()); 30 Dart_Port port_id = static_cast<Dart_Port>(id.AsInt64Value());
31 const Bool& is_local = Bool::Handle(Bool::Get(PortMap::IsLocalPort(port_id))); 31 const Bool& is_local = Bool::Handle(Bool::Get(PortMap::IsLocalPort(port_id)));
32 arguments->SetReturn(is_local); 32 arguments->SetReturn(is_local);
33 } 33 }
34 34
(...skipping 507 matching lines...) Expand 10 before | Expand all | Expand 10 after
542 Dart_SetReturnValue(args, wrapped_result); 542 Dart_SetReturnValue(args, wrapped_result);
543 } 543 }
544 544
545 void HandleMirrorsMessage(Isolate* isolate, 545 void HandleMirrorsMessage(Isolate* isolate,
546 Dart_Port reply_port, 546 Dart_Port reply_port,
547 const Instance& message) { 547 const Instance& message) {
548 UNIMPLEMENTED(); 548 UNIMPLEMENTED();
549 } 549 }
550 550
551 } // namespace dart 551 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/lib/isolate.cc ('k') | runtime/vm/ast.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698