| OLD | NEW |
| 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 "lib/invocation_mirror.h" | 5 #include "lib/invocation_mirror.h" |
| 6 #include "vm/bootstrap_natives.h" | 6 #include "vm/bootstrap_natives.h" |
| 7 #include "vm/class_finalizer.h" | 7 #include "vm/class_finalizer.h" |
| 8 #include "vm/compiler.h" | 8 #include "vm/compiler.h" |
| 9 #include "vm/dart_entry.h" | 9 #include "vm/dart_entry.h" |
| 10 #include "vm/exceptions.h" | 10 #include "vm/exceptions.h" |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 array.SetAt(i, param_name); | 90 array.SetAt(i, param_name); |
| 91 } | 91 } |
| 92 args.SetAt(5, array); | 92 args.SetAt(5, array); |
| 93 } | 93 } |
| 94 | 94 |
| 95 Exceptions::ThrowByType(Exceptions::kNoSuchMethod, args); | 95 Exceptions::ThrowByType(Exceptions::kNoSuchMethod, args); |
| 96 UNREACHABLE(); | 96 UNREACHABLE(); |
| 97 } | 97 } |
| 98 | 98 |
| 99 | 99 |
| 100 DEFINE_NATIVE_ENTRY(Mirrors_isLocalPort, 1) { | |
| 101 GET_NON_NULL_NATIVE_ARGUMENT(Instance, port, arguments->NativeArgAt(0)); | |
| 102 | |
| 103 // Get the port id from the SendPort instance. | |
| 104 const Object& id_obj = Object::Handle(DartLibraryCalls::PortGetId(port)); | |
| 105 if (id_obj.IsError()) { | |
| 106 Exceptions::PropagateError(Error::Cast(id_obj)); | |
| 107 UNREACHABLE(); | |
| 108 } | |
| 109 ASSERT(id_obj.IsSmi() || id_obj.IsMint()); | |
| 110 Integer& id = Integer::Handle(); | |
| 111 id ^= id_obj.raw(); | |
| 112 Dart_Port port_id = static_cast<Dart_Port>(id.AsInt64Value()); | |
| 113 return Bool::Get(PortMap::IsLocalPort(port_id)).raw(); | |
| 114 } | |
| 115 | |
| 116 static void EnsureConstructorsAreCompiled(const Function& func) { | 100 static void EnsureConstructorsAreCompiled(const Function& func) { |
| 117 // Only generative constructors can have initializing formals. | 101 // Only generative constructors can have initializing formals. |
| 118 if (!func.IsConstructor()) return; | 102 if (!func.IsConstructor()) return; |
| 119 | 103 |
| 120 const Class& cls = Class::Handle(func.Owner()); | 104 const Class& cls = Class::Handle(func.Owner()); |
| 121 const Error& error = Error::Handle(cls.EnsureIsFinalized(Isolate::Current())); | 105 const Error& error = Error::Handle(cls.EnsureIsFinalized(Isolate::Current())); |
| 122 if (!error.IsNull()) { | 106 if (!error.IsNull()) { |
| 123 ThrowInvokeError(error); | 107 ThrowInvokeError(error); |
| 124 UNREACHABLE(); | 108 UNREACHABLE(); |
| 125 } | 109 } |
| (...skipping 1936 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2062 | 2046 |
| 2063 DEFINE_NATIVE_ENTRY(VariableMirror_type, 2) { | 2047 DEFINE_NATIVE_ENTRY(VariableMirror_type, 2) { |
| 2064 GET_NON_NULL_NATIVE_ARGUMENT(MirrorReference, ref, arguments->NativeArgAt(0)); | 2048 GET_NON_NULL_NATIVE_ARGUMENT(MirrorReference, ref, arguments->NativeArgAt(0)); |
| 2065 const Field& field = Field::Handle(ref.GetFieldReferent()); | 2049 const Field& field = Field::Handle(ref.GetFieldReferent()); |
| 2066 GET_NATIVE_ARGUMENT(AbstractType, instantiator, arguments->NativeArgAt(1)); | 2050 GET_NATIVE_ARGUMENT(AbstractType, instantiator, arguments->NativeArgAt(1)); |
| 2067 const AbstractType& type = AbstractType::Handle(field.type()); | 2051 const AbstractType& type = AbstractType::Handle(field.type()); |
| 2068 return InstantiateType(type, instantiator); | 2052 return InstantiateType(type, instantiator); |
| 2069 } | 2053 } |
| 2070 | 2054 |
| 2071 } // namespace dart | 2055 } // namespace dart |
| OLD | NEW |