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

Side by Side Diff: vm/dart_api_impl.cc

Issue 9580036: - Always write a Null Object for Code objects (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 8 years, 9 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 | « vm/code_generator.cc ('k') | vm/object_store.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 "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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 55
56 // Return error if isolate is in an inconsistent state. 56 // Return error if isolate is in an inconsistent state.
57 // Return NULL when no error condition exists. 57 // Return NULL when no error condition exists.
58 const char* CheckIsolateState(Isolate* isolate, bool generating_snapshot) { 58 const char* CheckIsolateState(Isolate* isolate, bool generating_snapshot) {
59 bool success = true; 59 bool success = true;
60 if (!ClassFinalizer::AllClassesFinalized()) { 60 if (!ClassFinalizer::AllClassesFinalized()) {
61 success = (generating_snapshot) ? 61 success = (generating_snapshot) ?
62 ClassFinalizer::FinalizePendingClassesForSnapshotCreation() : 62 ClassFinalizer::FinalizePendingClassesForSnapshotCreation() :
63 ClassFinalizer::FinalizePendingClasses(); 63 ClassFinalizer::FinalizePendingClasses();
64 } 64 }
65 if (success && !generating_snapshot) { 65 if (success) {
66 success = isolate->object_store()->PreallocateObjects(); 66 success = isolate->object_store()->PreallocateObjects();
67 if (success) {
68 return NULL;
69 }
67 } 70 }
68 if (success) { 71 // Make a copy of the error message as the original message string
69 return NULL; 72 // may get deallocated when we return back from the Dart API call.
70 } else { 73 const Error& err = Error::Handle(isolate->object_store()->sticky_error());
71 // Make a copy of the error message as the original message string 74 const char* errmsg = err.ToErrorCString();
72 // may get deallocated when we return back from the Dart API call. 75 intptr_t errlen = strlen(errmsg) + 1;
73 const Error& err = 76 char* msg = reinterpret_cast<char*>(Api::Allocate(errlen));
74 Error::Handle(isolate->object_store()->sticky_error()); 77 OS::SNPrint(msg, errlen, "%s", errmsg);
75 const char* errmsg = err.ToErrorCString(); 78 return msg;
76 intptr_t errlen = strlen(errmsg) + 1;
77 char* msg = reinterpret_cast<char*>(Api::Allocate(errlen));
78 OS::SNPrint(msg, errlen, "%s", errmsg);
79 return msg;
80 }
81 } 79 }
82 80
83 81
84 void SetupErrorResult(Dart_Handle* handle) { 82 void SetupErrorResult(Dart_Handle* handle) {
85 const Error& error = Error::Handle( 83 const Error& error = Error::Handle(
86 Isolate::Current()->object_store()->sticky_error()); 84 Isolate::Current()->object_store()->sticky_error());
87 *handle = Api::NewLocalHandle(error); 85 *handle = Api::NewLocalHandle(error);
88 } 86 }
89 87
90 88
(...skipping 2621 matching lines...) Expand 10 before | Expand all | Expand 10 after
2712 *buffer = NULL; 2710 *buffer = NULL;
2713 } 2711 }
2714 delete debug_region; 2712 delete debug_region;
2715 } else { 2713 } else {
2716 *buffer = NULL; 2714 *buffer = NULL;
2717 *buffer_size = 0; 2715 *buffer_size = 0;
2718 } 2716 }
2719 } 2717 }
2720 2718
2721 } // namespace dart 2719 } // namespace dart
OLDNEW
« no previous file with comments | « vm/code_generator.cc ('k') | vm/object_store.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698