| OLD | NEW | 
|     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 329 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   340   if (function.IsNull()) { |   340   if (function.IsNull()) { | 
|   341     return ApiError::New(String::Handle(String::New(""))); |   341     return ApiError::New(String::Handle(String::New(""))); | 
|   342   } |   342   } | 
|   343   const Array& args = Array::Handle(Array::New(kNumArgs)); |   343   const Array& args = Array::Handle(Array::New(kNumArgs)); | 
|   344   args.SetAt(0, receiver); |   344   args.SetAt(0, receiver); | 
|   345   args.SetAt(1, argument); |   345   args.SetAt(1, argument); | 
|   346   return DartEntry::InvokeFunction(function, args); |   346   return DartEntry::InvokeFunction(function, args); | 
|   347 } |   347 } | 
|   348  |   348  | 
|   349  |   349  | 
|   350 WeakReferenceSetBuilder* ApiState::NewWeakReferenceSetBuilder() { |  | 
|   351   return new WeakReferenceSetBuilder(this); |  | 
|   352 } |  | 
|   353  |  | 
|   354  |  | 
|   355 void ApiState::DelayWeakReferenceSet(WeakReferenceSet* reference_set) { |  | 
|   356   WeakReferenceSet::Push(reference_set, &delayed_weak_reference_sets_); |  | 
|   357 } |  | 
|   358  |  | 
|   359  |  | 
|   360 Dart_Handle Api::InitNewHandle(Isolate* isolate, RawObject* raw) { |   350 Dart_Handle Api::InitNewHandle(Isolate* isolate, RawObject* raw) { | 
|   361   LocalHandles* local_handles = Api::TopScope(isolate)->local_handles(); |   351   LocalHandles* local_handles = Api::TopScope(isolate)->local_handles(); | 
|   362   ASSERT(local_handles != NULL); |   352   ASSERT(local_handles != NULL); | 
|   363   LocalHandle* ref = local_handles->AllocateHandle(); |   353   LocalHandle* ref = local_handles->AllocateHandle(); | 
|   364   ref->set_raw(raw); |   354   ref->set_raw(raw); | 
|   365   return ref->apiHandle(); |   355   return ref->apiHandle(); | 
|   366 } |   356 } | 
|   367  |   357  | 
|   368  |   358  | 
|   369 Dart_Handle Api::NewHandle(Isolate* isolate, RawObject* raw) { |   359 Dart_Handle Api::NewHandle(Isolate* isolate, RawObject* raw) { | 
| (...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   684 PersistentHandle* PersistentHandle::Cast(Dart_PersistentHandle handle) { |   674 PersistentHandle* PersistentHandle::Cast(Dart_PersistentHandle handle) { | 
|   685   ASSERT(Isolate::Current()->api_state()->IsValidPersistentHandle(handle)); |   675   ASSERT(Isolate::Current()->api_state()->IsValidPersistentHandle(handle)); | 
|   686   return reinterpret_cast<PersistentHandle*>(handle); |   676   return reinterpret_cast<PersistentHandle*>(handle); | 
|   687 } |   677 } | 
|   688  |   678  | 
|   689  |   679  | 
|   690 FinalizablePersistentHandle* FinalizablePersistentHandle::Cast( |   680 FinalizablePersistentHandle* FinalizablePersistentHandle::Cast( | 
|   691     Dart_WeakPersistentHandle handle) { |   681     Dart_WeakPersistentHandle handle) { | 
|   692 #if defined(DEBUG) |   682 #if defined(DEBUG) | 
|   693   ApiState* state = Isolate::Current()->api_state(); |   683   ApiState* state = Isolate::Current()->api_state(); | 
|   694   ASSERT(state->IsValidWeakPersistentHandle(handle) || |   684   ASSERT(state->IsValidWeakPersistentHandle(handle)); | 
|   695          state->IsValidPrologueWeakPersistentHandle(handle)); |  | 
|   696 #endif |   685 #endif | 
|   697   return reinterpret_cast<FinalizablePersistentHandle*>(handle); |   686   return reinterpret_cast<FinalizablePersistentHandle*>(handle); | 
|   698 } |   687 } | 
|   699  |   688  | 
|   700  |   689  | 
|   701 void FinalizablePersistentHandle::Finalize( |   690 void FinalizablePersistentHandle::Finalize( | 
|   702     Isolate* isolate, FinalizablePersistentHandle* handle) { |   691     Isolate* isolate, FinalizablePersistentHandle* handle) { | 
|   703   if (!handle->raw()->IsHeapObject()) { |   692   if (!handle->raw()->IsHeapObject()) { | 
|   704     return; |   693     return; | 
|   705   } |   694   } | 
|   706   Dart_WeakPersistentHandleFinalizer callback = handle->callback(); |   695   Dart_WeakPersistentHandleFinalizer callback = handle->callback(); | 
|   707   ASSERT(callback != NULL); |   696   ASSERT(callback != NULL); | 
|   708   void* peer = handle->peer(); |   697   void* peer = handle->peer(); | 
|   709   Dart_WeakPersistentHandle object = handle->apiHandle(); |   698   Dart_WeakPersistentHandle object = handle->apiHandle(); | 
|   710   (*callback)(isolate->init_callback_data(), object, peer); |   699   (*callback)(isolate->init_callback_data(), object, peer); | 
|   711   ApiState* state = isolate->api_state(); |   700   ApiState* state = isolate->api_state(); | 
|   712   ASSERT(state != NULL); |   701   ASSERT(state != NULL); | 
|   713   if (handle->IsPrologueWeakPersistent()) { |   702   state->weak_persistent_handles().FreeHandle(handle); | 
|   714     state->prologue_weak_persistent_handles().FreeHandle(handle); |  | 
|   715   } else { |  | 
|   716     state->weak_persistent_handles().FreeHandle(handle); |  | 
|   717   } |  | 
|   718 } |   703 } | 
|   719  |   704  | 
|   720  |   705  | 
|   721 // --- Handles --- |   706 // --- Handles --- | 
|   722  |   707  | 
|   723 DART_EXPORT bool Dart_IsError(Dart_Handle handle) { |   708 DART_EXPORT bool Dart_IsError(Dart_Handle handle) { | 
|   724   TRACE_API_CALL(CURRENT_FUNC); |   709   TRACE_API_CALL(CURRENT_FUNC); | 
|   725   return RawObject::IsErrorClassId(Api::ClassId(handle)); |   710   return RawObject::IsErrorClassId(Api::ClassId(handle)); | 
|   726 } |   711 } | 
|   727  |   712  | 
| (...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  1011   ASSERT(state->IsValidPersistentHandle(obj1)); |   996   ASSERT(state->IsValidPersistentHandle(obj1)); | 
|  1012   const Object& obj2_ref = Object::Handle(Z, Api::UnwrapHandle(obj2)); |   997   const Object& obj2_ref = Object::Handle(Z, Api::UnwrapHandle(obj2)); | 
|  1013   PersistentHandle* obj1_ref = PersistentHandle::Cast(obj1); |   998   PersistentHandle* obj1_ref = PersistentHandle::Cast(obj1); | 
|  1014   obj1_ref->set_raw(obj2_ref); |   999   obj1_ref->set_raw(obj2_ref); | 
|  1015 } |  1000 } | 
|  1016  |  1001  | 
|  1017  |  1002  | 
|  1018 static Dart_WeakPersistentHandle AllocateFinalizableHandle( |  1003 static Dart_WeakPersistentHandle AllocateFinalizableHandle( | 
|  1019     Thread* thread, |  1004     Thread* thread, | 
|  1020     Dart_Handle object, |  1005     Dart_Handle object, | 
|  1021     bool is_prologue, |  | 
|  1022     void* peer, |  1006     void* peer, | 
|  1023     intptr_t external_allocation_size, |  1007     intptr_t external_allocation_size, | 
|  1024     Dart_WeakPersistentHandleFinalizer callback) { |  1008     Dart_WeakPersistentHandleFinalizer callback) { | 
|  1025   REUSABLE_OBJECT_HANDLESCOPE(thread); |  1009   REUSABLE_OBJECT_HANDLESCOPE(thread); | 
|  1026   Object& ref = thread->ObjectHandle(); |  1010   Object& ref = thread->ObjectHandle(); | 
|  1027   ref = Api::UnwrapHandle(object); |  1011   ref = Api::UnwrapHandle(object); | 
|  1028   FinalizablePersistentHandle* finalizable_ref = |  1012   FinalizablePersistentHandle* finalizable_ref = | 
|  1029       FinalizablePersistentHandle::New(thread->isolate(), |  1013       FinalizablePersistentHandle::New(thread->isolate(), | 
|  1030                                        is_prologue, |  | 
|  1031                                        ref, |  1014                                        ref, | 
|  1032                                        peer, |  1015                                        peer, | 
|  1033                                        callback, |  1016                                        callback, | 
|  1034                                        external_allocation_size); |  1017                                        external_allocation_size); | 
|  1035   return finalizable_ref->apiHandle(); |  1018   return finalizable_ref->apiHandle(); | 
|  1036 } |  1019 } | 
|  1037  |  1020  | 
|  1038  |  1021  | 
|  1039 DART_EXPORT Dart_WeakPersistentHandle Dart_NewWeakPersistentHandle( |  1022 DART_EXPORT Dart_WeakPersistentHandle Dart_NewWeakPersistentHandle( | 
|  1040     Dart_Handle object, |  1023     Dart_Handle object, | 
|  1041     void* peer, |  1024     void* peer, | 
|  1042     intptr_t external_allocation_size, |  1025     intptr_t external_allocation_size, | 
|  1043     Dart_WeakPersistentHandleFinalizer callback) { |  1026     Dart_WeakPersistentHandleFinalizer callback) { | 
|  1044   Thread* thread = Thread::Current(); |  1027   Thread* thread = Thread::Current(); | 
|  1045   CHECK_ISOLATE(thread->isolate()); |  1028   CHECK_ISOLATE(thread->isolate()); | 
|  1046   if (callback == NULL) { |  1029   if (callback == NULL) { | 
|  1047     return NULL; |  1030     return NULL; | 
|  1048   } |  1031   } | 
|  1049   return AllocateFinalizableHandle(thread, |  1032   return AllocateFinalizableHandle(thread, | 
|  1050                                    object, |  1033                                    object, | 
|  1051                                    false, |  | 
|  1052                                    peer, |  1034                                    peer, | 
|  1053                                    external_allocation_size, |  1035                                    external_allocation_size, | 
|  1054                                    callback); |  1036                                    callback); | 
|  1055 } |  | 
|  1056  |  | 
|  1057  |  | 
|  1058 DART_EXPORT Dart_WeakPersistentHandle Dart_NewPrologueWeakPersistentHandle( |  | 
|  1059     Dart_Handle object, |  | 
|  1060     void* peer, |  | 
|  1061     intptr_t external_allocation_size, |  | 
|  1062     Dart_WeakPersistentHandleFinalizer callback) { |  | 
|  1063   Thread* thread = Thread::Current(); |  | 
|  1064   CHECK_ISOLATE(thread->isolate()); |  | 
|  1065   if (callback == NULL) { |  | 
|  1066     return NULL; |  | 
|  1067   } |  | 
|  1068   return AllocateFinalizableHandle(thread, |  | 
|  1069                                    object, |  | 
|  1070                                    true, |  | 
|  1071                                    peer, |  | 
|  1072                                    external_allocation_size, |  | 
|  1073                                    callback); |  | 
|  1074 } |  1037 } | 
|  1075  |  1038  | 
|  1076  |  1039  | 
|  1077 DART_EXPORT void Dart_DeletePersistentHandle(Dart_PersistentHandle object) { |  1040 DART_EXPORT void Dart_DeletePersistentHandle(Dart_PersistentHandle object) { | 
|  1078   Isolate* isolate = Isolate::Current(); |  1041   Isolate* isolate = Isolate::Current(); | 
|  1079   CHECK_ISOLATE(isolate); |  1042   CHECK_ISOLATE(isolate); | 
|  1080   ApiState* state = isolate->api_state(); |  1043   ApiState* state = isolate->api_state(); | 
|  1081   ASSERT(state != NULL); |  1044   ASSERT(state != NULL); | 
|  1082   PersistentHandle* ref = PersistentHandle::Cast(object); |  1045   PersistentHandle* ref = PersistentHandle::Cast(object); | 
|  1083   ASSERT(!state->IsProtectedHandle(ref)); |  1046   ASSERT(!state->IsProtectedHandle(ref)); | 
|  1084   if (!state->IsProtectedHandle(ref)) { |  1047   if (!state->IsProtectedHandle(ref)) { | 
|  1085     state->persistent_handles().FreeHandle(ref); |  1048     state->persistent_handles().FreeHandle(ref); | 
|  1086   } |  1049   } | 
|  1087 } |  1050 } | 
|  1088  |  1051  | 
|  1089  |  1052  | 
|  1090 DART_EXPORT void Dart_DeleteWeakPersistentHandle( |  1053 DART_EXPORT void Dart_DeleteWeakPersistentHandle( | 
|  1091     Dart_Isolate current_isolate, |  1054     Dart_Isolate current_isolate, | 
|  1092     Dart_WeakPersistentHandle object) { |  1055     Dart_WeakPersistentHandle object) { | 
|  1093   Isolate* isolate = reinterpret_cast<Isolate*>(current_isolate); |  1056   Isolate* isolate = reinterpret_cast<Isolate*>(current_isolate); | 
|  1094   CHECK_ISOLATE(isolate); |  1057   CHECK_ISOLATE(isolate); | 
|  1095   ASSERT(isolate == Isolate::Current()); |  1058   ASSERT(isolate == Isolate::Current()); | 
|  1096   ApiState* state = isolate->api_state(); |  1059   ApiState* state = isolate->api_state(); | 
|  1097   ASSERT(state != NULL); |  1060   ASSERT(state != NULL); | 
|  1098   FinalizablePersistentHandle* weak_ref = |  1061   FinalizablePersistentHandle* weak_ref = | 
|  1099       FinalizablePersistentHandle::Cast(object); |  1062       FinalizablePersistentHandle::Cast(object); | 
|  1100   weak_ref->EnsureFreeExternal(isolate); |  1063   weak_ref->EnsureFreeExternal(isolate); | 
|  1101   if (weak_ref->IsPrologueWeakPersistent()) { |  1064   state->weak_persistent_handles().FreeHandle(weak_ref); | 
|  1102     ASSERT(state->IsValidPrologueWeakPersistentHandle(object)); |  | 
|  1103     state->prologue_weak_persistent_handles().FreeHandle(weak_ref); |  | 
|  1104   } else { |  | 
|  1105     ASSERT(!state->IsValidPrologueWeakPersistentHandle(object)); |  | 
|  1106     state->weak_persistent_handles().FreeHandle(weak_ref); |  | 
|  1107   } |  | 
|  1108 } |  1065 } | 
|  1109  |  1066  | 
|  1110  |  1067  | 
|  1111 DART_EXPORT bool Dart_IsPrologueWeakPersistentHandle( |  | 
|  1112     Dart_WeakPersistentHandle object) { |  | 
|  1113   FinalizablePersistentHandle* weak_ref = |  | 
|  1114       FinalizablePersistentHandle::Cast(object); |  | 
|  1115   return weak_ref->IsPrologueWeakPersistent(); |  | 
|  1116 } |  | 
|  1117  |  | 
|  1118  |  | 
|  1119 DART_EXPORT Dart_WeakReferenceSetBuilder Dart_NewWeakReferenceSetBuilder() { |  | 
|  1120   Isolate* isolate = Isolate::Current(); |  | 
|  1121   CHECK_ISOLATE(isolate); |  | 
|  1122   ApiState* state = isolate->api_state(); |  | 
|  1123   ASSERT(state != NULL); |  | 
|  1124   return reinterpret_cast<Dart_WeakReferenceSetBuilder>( |  | 
|  1125       state->NewWeakReferenceSetBuilder()); |  | 
|  1126 } |  | 
|  1127  |  | 
|  1128  |  | 
|  1129 DART_EXPORT Dart_WeakReferenceSet Dart_NewWeakReferenceSet( |  | 
|  1130     Dart_WeakReferenceSetBuilder set_builder, |  | 
|  1131     Dart_WeakPersistentHandle key, |  | 
|  1132     Dart_WeakPersistentHandle value) { |  | 
|  1133   ASSERT(set_builder != NULL && key != NULL); |  | 
|  1134   WeakReferenceSetBuilder* builder = |  | 
|  1135       reinterpret_cast<WeakReferenceSetBuilder*>(set_builder); |  | 
|  1136   ApiState* state = builder->api_state(); |  | 
|  1137   ASSERT(state == Isolate::Current()->api_state()); |  | 
|  1138   WeakReferenceSet* reference_set = builder->NewWeakReferenceSet(); |  | 
|  1139   reference_set->AppendKey(key); |  | 
|  1140   if (value != NULL) { |  | 
|  1141     reference_set->AppendValue(value); |  | 
|  1142   } |  | 
|  1143   state->DelayWeakReferenceSet(reference_set); |  | 
|  1144   return reinterpret_cast<Dart_WeakReferenceSet>(reference_set); |  | 
|  1145 } |  | 
|  1146  |  | 
|  1147  |  | 
|  1148 DART_EXPORT Dart_Handle Dart_AppendToWeakReferenceSet( |  | 
|  1149     Dart_WeakReferenceSet reference_set, |  | 
|  1150     Dart_WeakPersistentHandle key, |  | 
|  1151     Dart_WeakPersistentHandle value) { |  | 
|  1152   ASSERT(reference_set != NULL); |  | 
|  1153   WeakReferenceSet* set = reinterpret_cast<WeakReferenceSet*>(reference_set); |  | 
|  1154   set->Append(key, value); |  | 
|  1155   return Api::Success(); |  | 
|  1156 } |  | 
|  1157  |  | 
|  1158  |  | 
|  1159 DART_EXPORT Dart_Handle Dart_AppendKeyToWeakReferenceSet( |  | 
|  1160     Dart_WeakReferenceSet reference_set, |  | 
|  1161     Dart_WeakPersistentHandle key) { |  | 
|  1162   ASSERT(reference_set != NULL); |  | 
|  1163   WeakReferenceSet* set = reinterpret_cast<WeakReferenceSet*>(reference_set); |  | 
|  1164   set->AppendKey(key); |  | 
|  1165   return Api::Success(); |  | 
|  1166 } |  | 
|  1167  |  | 
|  1168  |  | 
|  1169 DART_EXPORT Dart_Handle Dart_AppendValueToWeakReferenceSet( |  | 
|  1170     Dart_WeakReferenceSet reference_set, |  | 
|  1171     Dart_WeakPersistentHandle value) { |  | 
|  1172   ASSERT(reference_set != NULL); |  | 
|  1173   WeakReferenceSet* set = reinterpret_cast<WeakReferenceSet*>(reference_set); |  | 
|  1174   set->AppendValue(value); |  | 
|  1175   return Api::Success(); |  | 
|  1176 } |  | 
|  1177  |  | 
|  1178  |  | 
|  1179 // --- Garbage Collection Callbacks -- |  1068 // --- Garbage Collection Callbacks -- | 
|  1180  |  1069  | 
|  1181 DART_EXPORT Dart_Handle Dart_SetGcCallbacks( |  1070 DART_EXPORT Dart_Handle Dart_SetGcCallbacks( | 
|  1182     Dart_GcPrologueCallback prologue_callback, |  1071     Dart_GcPrologueCallback prologue_callback, | 
|  1183     Dart_GcEpilogueCallback epilogue_callback) { |  1072     Dart_GcEpilogueCallback epilogue_callback) { | 
|  1184   Isolate* isolate = Isolate::Current(); |  1073   Isolate* isolate = Isolate::Current(); | 
|  1185   CHECK_ISOLATE(isolate); |  1074   CHECK_ISOLATE(isolate); | 
|  1186   if (prologue_callback != NULL) { |  1075   if (prologue_callback != NULL) { | 
|  1187     if (isolate->gc_prologue_callback() != NULL) { |  1076     if (isolate->gc_prologue_callback() != NULL) { | 
|  1188       return Api::NewError( |  1077       return Api::NewError( | 
| (...skipping 21 matching lines...) Expand all  Loading... | 
|  1210           "%s expects 'epilogue_callback' to be present in the callback set.", |  1099           "%s expects 'epilogue_callback' to be present in the callback set.", | 
|  1211           CURRENT_FUNC); |  1100           CURRENT_FUNC); | 
|  1212     } |  1101     } | 
|  1213   } |  1102   } | 
|  1214   isolate->set_gc_prologue_callback(prologue_callback); |  1103   isolate->set_gc_prologue_callback(prologue_callback); | 
|  1215   isolate->set_gc_epilogue_callback(epilogue_callback); |  1104   isolate->set_gc_epilogue_callback(epilogue_callback); | 
|  1216   return Api::Success(); |  1105   return Api::Success(); | 
|  1217 } |  1106 } | 
|  1218  |  1107  | 
|  1219  |  1108  | 
|  1220 class PrologueWeakVisitor : public HandleVisitor { |  | 
|  1221  public: |  | 
|  1222   PrologueWeakVisitor(Thread* thread, |  | 
|  1223                       Dart_GcPrologueWeakHandleCallback callback) |  | 
|  1224       :  HandleVisitor(thread), |  | 
|  1225          callback_(callback) { |  | 
|  1226   } |  | 
|  1227  |  | 
|  1228  |  | 
|  1229   void VisitHandle(uword addr) { |  | 
|  1230     NoSafepointScope no_safepoint; |  | 
|  1231     FinalizablePersistentHandle* handle = |  | 
|  1232         reinterpret_cast<FinalizablePersistentHandle*>(addr); |  | 
|  1233     RawObject* raw_obj = handle->raw(); |  | 
|  1234     if (raw_obj->IsHeapObject()) { |  | 
|  1235       ASSERT(handle->IsPrologueWeakPersistent()); |  | 
|  1236       ReusableInstanceHandleScope reused_instance_handle(thread()); |  | 
|  1237       Instance& instance = reused_instance_handle.Handle(); |  | 
|  1238       instance ^= reinterpret_cast<RawInstance*>(handle->raw()); |  | 
|  1239       intptr_t num_native_fields = instance.NumNativeFields(); |  | 
|  1240       intptr_t* native_fields = instance.NativeFieldsDataAddr(); |  | 
|  1241       if (native_fields != NULL) { |  | 
|  1242         callback_(thread()->isolate()->init_callback_data(), |  | 
|  1243                   reinterpret_cast<Dart_WeakPersistentHandle>(addr), |  | 
|  1244                   num_native_fields, |  | 
|  1245                   native_fields); |  | 
|  1246       } |  | 
|  1247     } |  | 
|  1248   } |  | 
|  1249  |  | 
|  1250  private: |  | 
|  1251   Dart_GcPrologueWeakHandleCallback callback_; |  | 
|  1252  |  | 
|  1253   DISALLOW_COPY_AND_ASSIGN(PrologueWeakVisitor); |  | 
|  1254 }; |  | 
|  1255  |  | 
|  1256  |  | 
|  1257 DART_EXPORT Dart_Handle Dart_VisitPrologueWeakHandles( |  | 
|  1258     Dart_GcPrologueWeakHandleCallback callback) { |  | 
|  1259   Thread* thread = Thread::Current(); |  | 
|  1260   CHECK_ISOLATE(thread->isolate()); |  | 
|  1261   PrologueWeakVisitor visitor(thread, callback); |  | 
|  1262   thread->isolate()->VisitPrologueWeakPersistentHandles(&visitor); |  | 
|  1263   return Api::Success(); |  | 
|  1264 } |  | 
|  1265  |  | 
|  1266  |  | 
|  1267 // --- Initialization and Globals --- |  1109 // --- Initialization and Globals --- | 
|  1268  |  1110  | 
|  1269 DART_EXPORT const char* Dart_VersionString() { |  1111 DART_EXPORT const char* Dart_VersionString() { | 
|  1270   return Version::String(); |  1112   return Version::String(); | 
|  1271 } |  1113 } | 
|  1272  |  1114  | 
|  1273 DART_EXPORT char* Dart_Initialize( |  1115 DART_EXPORT char* Dart_Initialize( | 
|  1274     const uint8_t* vm_isolate_snapshot, |  1116     const uint8_t* vm_isolate_snapshot, | 
|  1275     const uint8_t* instructions_snapshot, |  1117     const uint8_t* instructions_snapshot, | 
|  1276     Dart_IsolateCreateCallback create, |  1118     Dart_IsolateCreateCallback create, | 
| (...skipping 3692 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  4969 } |  4811 } | 
|  4970  |  4812  | 
|  4971  |  4813  | 
|  4972 DART_EXPORT void Dart_SetWeakHandleReturnValue(Dart_NativeArguments args, |  4814 DART_EXPORT void Dart_SetWeakHandleReturnValue(Dart_NativeArguments args, | 
|  4973                                                Dart_WeakPersistentHandle rval) { |  4815                                                Dart_WeakPersistentHandle rval) { | 
|  4974   NativeArguments* arguments = reinterpret_cast<NativeArguments*>(args); |  4816   NativeArguments* arguments = reinterpret_cast<NativeArguments*>(args); | 
|  4975 #if defined(DEBUG) |  4817 #if defined(DEBUG) | 
|  4976   Isolate* isolate = arguments->thread()->isolate(); |  4818   Isolate* isolate = arguments->thread()->isolate(); | 
|  4977   ASSERT(isolate == Isolate::Current()); |  4819   ASSERT(isolate == Isolate::Current()); | 
|  4978   ASSERT(isolate->api_state() != NULL && |  4820   ASSERT(isolate->api_state() != NULL && | 
|  4979          (isolate->api_state()->IsValidWeakPersistentHandle(rval) || |  4821          (isolate->api_state()->IsValidWeakPersistentHandle(rval))); | 
|  4980           isolate->api_state()->IsValidPrologueWeakPersistentHandle(rval))); |  | 
|  4981 #endif |  4822 #endif | 
|  4982   Api::SetWeakHandleReturnValue(arguments, rval); |  4823   Api::SetWeakHandleReturnValue(arguments, rval); | 
|  4983 } |  4824 } | 
|  4984  |  4825  | 
|  4985  |  4826  | 
|  4986 // --- Environment --- |  4827 // --- Environment --- | 
|  4987 RawString* Api::CallEnvironmentCallback(Thread* thread, const String& name) { |  4828 RawString* Api::CallEnvironmentCallback(Thread* thread, const String& name) { | 
|  4988   Isolate* isolate = thread->isolate(); |  4829   Isolate* isolate = thread->isolate(); | 
|  4989   Scope api_scope(thread); |  4830   Scope api_scope(thread); | 
|  4990   Dart_EnvironmentCallback callback = isolate->environment_callback(); |  4831   Dart_EnvironmentCallback callback = isolate->environment_callback(); | 
| (...skipping 1095 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  6086                                    ApiReallocate); |  5927                                    ApiReallocate); | 
|  6087   writer.WriteFullSnapshot(); |  5928   writer.WriteFullSnapshot(); | 
|  6088   *vm_isolate_snapshot_size = writer.VmIsolateSnapshotSize(); |  5929   *vm_isolate_snapshot_size = writer.VmIsolateSnapshotSize(); | 
|  6089   *isolate_snapshot_size = writer.IsolateSnapshotSize(); |  5930   *isolate_snapshot_size = writer.IsolateSnapshotSize(); | 
|  6090   *instructions_snapshot_size = writer.InstructionsSnapshotSize(); |  5931   *instructions_snapshot_size = writer.InstructionsSnapshotSize(); | 
|  6091  |  5932  | 
|  6092   return Api::Success(); |  5933   return Api::Success(); | 
|  6093 } |  5934 } | 
|  6094  |  5935  | 
|  6095 }  // namespace dart |  5936 }  // namespace dart | 
| OLD | NEW |