| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 | 6 |
| 7 #include "vm/bigint_operations.h" | 7 #include "vm/bigint_operations.h" |
| 8 #include "vm/class_finalizer.h" | 8 #include "vm/class_finalizer.h" |
| 9 #include "vm/compiler.h" | 9 #include "vm/compiler.h" |
| 10 #include "vm/dart.h" | 10 #include "vm/dart.h" |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 // Make a copy of the error message as the original message string | 63 // Make a copy of the error message as the original message string |
| 64 // may get deallocated when we return back from the Dart API call. | 64 // may get deallocated when we return back from the Dart API call. |
| 65 const String& err = | 65 const String& err = |
| 66 String::Handle(isolate->object_store()->sticky_error()); | 66 String::Handle(isolate->object_store()->sticky_error()); |
| 67 const char* errmsg = err.ToCString(); | 67 const char* errmsg = err.ToCString(); |
| 68 intptr_t errlen = strlen(errmsg) + 1; | 68 intptr_t errlen = strlen(errmsg) + 1; |
| 69 char* msg = reinterpret_cast<char*>(Api::Allocate(errlen)); | 69 char* msg = reinterpret_cast<char*>(Api::Allocate(errlen)); |
| 70 OS::SNPrint(msg, errlen, "%s", errmsg); | 70 OS::SNPrint(msg, errlen, "%s", errmsg); |
| 71 return msg; | 71 return msg; |
| 72 } | 72 } |
| 73 if (!generating_snapshot) { |
| 74 isolate->object_store()->PreallocateObjects(); |
| 75 } |
| 73 return NULL; | 76 return NULL; |
| 74 } | 77 } |
| 75 | 78 |
| 76 | 79 |
| 77 static void SetupErrorResult(Dart_Handle* handle) { | 80 static void SetupErrorResult(Dart_Handle* handle) { |
| 78 // Make a copy of the error message as the original message string | 81 // Make a copy of the error message as the original message string |
| 79 // may get deallocated when we return back from the Dart API call. | 82 // may get deallocated when we return back from the Dart API call. |
| 80 const String& error = String::Handle( | 83 const String& error = String::Handle( |
| 81 Isolate::Current()->object_store()->sticky_error()); | 84 Isolate::Current()->object_store()->sticky_error()); |
| 82 const Object& obj = Object::Handle(ApiError::New(error)); | 85 const Object& obj = Object::Handle(ApiError::New(error)); |
| (...skipping 2324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2407 } | 2410 } |
| 2408 delete debug_region; | 2411 delete debug_region; |
| 2409 } else { | 2412 } else { |
| 2410 *buffer = NULL; | 2413 *buffer = NULL; |
| 2411 *buffer_size = 0; | 2414 *buffer_size = 0; |
| 2412 } | 2415 } |
| 2413 } | 2416 } |
| 2414 | 2417 |
| 2415 | 2418 |
| 2416 } // namespace dart | 2419 } // namespace dart |
| OLD | NEW |