| 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 "lib/stacktrace.h" |     9 #include "lib/stacktrace.h" | 
|    10 #include "platform/assert.h" |    10 #include "platform/assert.h" | 
| (...skipping 1078 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  1089   } |  1089   } | 
|  1090   const char* last_backslash = strrchr(script_uri, '\\'); |  1090   const char* last_backslash = strrchr(script_uri, '\\'); | 
|  1091   if (last_backslash != NULL) { |  1091   if (last_backslash != NULL) { | 
|  1092     script_uri = last_backslash + 1; |  1092     script_uri = last_backslash + 1; | 
|  1093   } |  1093   } | 
|  1094   if (main == NULL) { |  1094   if (main == NULL) { | 
|  1095     main = "main"; |  1095     main = "main"; | 
|  1096   } |  1096   } | 
|  1097  |  1097  | 
|  1098   char* chars = NULL; |  1098   char* chars = NULL; | 
|  1099   intptr_t len = OS::SNPrint(NULL, 0, "%s$%s", script_uri, main) + 1; |  1099   intptr_t len = OS::SNPrint(NULL, 0, "%s:%s()", script_uri, main) + 1; | 
|  1100   chars = reinterpret_cast<char*>(malloc(len)); |  1100   chars = reinterpret_cast<char*>(malloc(len)); | 
|  1101   OS::SNPrint(chars, len, "%s$%s", script_uri, main); |  1101   OS::SNPrint(chars, len, "%s:%s()", script_uri, main); | 
|  1102   return chars; |  1102   return chars; | 
|  1103 } |  1103 } | 
|  1104  |  1104  | 
|  1105 static Dart_Isolate CreateIsolate(const char* script_uri, |  1105 static Dart_Isolate CreateIsolate(const char* script_uri, | 
|  1106                                   const char* main, |  1106                                   const char* main, | 
|  1107                                   const uint8_t* snapshot_data, |  1107                                   const uint8_t* snapshot_data, | 
|  1108                                   const uint8_t* snapshot_instructions, |  1108                                   const uint8_t* snapshot_instructions, | 
|  1109                                   intptr_t snapshot_length, |  1109                                   intptr_t snapshot_length, | 
|  1110                                   kernel::Program* kernel_program, |  1110                                   kernel::Program* kernel_program, | 
|  1111                                   Dart_IsolateFlags* flags, |  1111                                   Dart_IsolateFlags* flags, | 
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  1228     FATAL1("%s expects argument 'isolate' to be non-null.", CURRENT_FUNC); |  1228     FATAL1("%s expects argument 'isolate' to be non-null.", CURRENT_FUNC); | 
|  1229   } |  1229   } | 
|  1230   // TODO(16615): Validate isolate parameter. |  1230   // TODO(16615): Validate isolate parameter. | 
|  1231   Isolate* iso = reinterpret_cast<Isolate*>(isolate); |  1231   Isolate* iso = reinterpret_cast<Isolate*>(isolate); | 
|  1232   return iso->init_callback_data(); |  1232   return iso->init_callback_data(); | 
|  1233 } |  1233 } | 
|  1234  |  1234  | 
|  1235 DART_EXPORT Dart_Handle Dart_DebugName() { |  1235 DART_EXPORT Dart_Handle Dart_DebugName() { | 
|  1236   DARTSCOPE(Thread::Current()); |  1236   DARTSCOPE(Thread::Current()); | 
|  1237   Isolate* I = T->isolate(); |  1237   Isolate* I = T->isolate(); | 
|  1238   return Api::NewHandle(T, String::New(I->name())); |  1238   return Api::NewHandle( | 
 |  1239       T, String::NewFormatted("(%" Pd64 ") '%s'", | 
 |  1240                               static_cast<int64_t>(I->main_port()), I->name())); | 
|  1239 } |  1241 } | 
|  1240  |  1242  | 
|  1241 DART_EXPORT void Dart_EnterIsolate(Dart_Isolate isolate) { |  1243 DART_EXPORT void Dart_EnterIsolate(Dart_Isolate isolate) { | 
|  1242   CHECK_NO_ISOLATE(Isolate::Current()); |  1244   CHECK_NO_ISOLATE(Isolate::Current()); | 
|  1243   // TODO(16615): Validate isolate parameter. |  1245   // TODO(16615): Validate isolate parameter. | 
|  1244   Isolate* iso = reinterpret_cast<Isolate*>(isolate); |  1246   Isolate* iso = reinterpret_cast<Isolate*>(isolate); | 
|  1245   if (!Thread::EnterIsolate(iso)) { |  1247   if (!Thread::EnterIsolate(iso)) { | 
|  1246     FATAL( |  1248     FATAL( | 
|  1247         "Unable to Enter Isolate : " |  1249         "Unable to Enter Isolate : " | 
|  1248         "Multiple mutators entering an isolate / " |  1250         "Multiple mutators entering an isolate / " | 
| (...skipping 5452 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  6701 #endif |  6703 #endif | 
|  6702 } |  6704 } | 
|  6703  |  6705  | 
|  6704 DART_EXPORT void Dart_DumpNativeStackTrace(void* context) { |  6706 DART_EXPORT void Dart_DumpNativeStackTrace(void* context) { | 
|  6705 #ifndef PRODUCT |  6707 #ifndef PRODUCT | 
|  6706   Profiler::DumpStackTrace(context); |  6708   Profiler::DumpStackTrace(context); | 
|  6707 #endif |  6709 #endif | 
|  6708 } |  6710 } | 
|  6709  |  6711  | 
|  6710 }  // namespace dart |  6712 }  // namespace dart | 
| OLD | NEW |