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

Side by Side Diff: runtime/vm/dart_api_impl.cc

Issue 8823001: Use preallocated StackOverflowException (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: '' Created 9 years 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 | « runtime/vm/code_generator.cc ('k') | runtime/vm/isolate.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) 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 CURRENT_FUNC, #dart_handle, #Type); \ 49 CURRENT_FUNC, #dart_handle, #Type); \
50 } \ 50 } \
51 } while (0) 51 } while (0)
52 52
53 53
54 // Return error if isolate is in an inconsistent state. 54 // Return error if isolate is in an inconsistent state.
55 // Return NULL when no error condition exists. 55 // Return NULL when no error condition exists.
56 static const char* CheckIsolateState( 56 static const char* CheckIsolateState(
57 Isolate* isolate, 57 Isolate* isolate,
58 bool generating_snapshot = ClassFinalizer::kNotGeneratingSnapshot) { 58 bool generating_snapshot = ClassFinalizer::kNotGeneratingSnapshot) {
59 bool result = (generating_snapshot) ? 59 bool success = (generating_snapshot) ?
60 ClassFinalizer::FinalizePendingClassesForSnapshotCreation() : 60 ClassFinalizer::FinalizePendingClassesForSnapshotCreation() :
61 ClassFinalizer::FinalizePendingClasses(); 61 ClassFinalizer::FinalizePendingClasses();
62 if (!result) { 62 if (success && !generating_snapshot) {
63 success = isolate->object_store()->PreallocateObjects();
64 }
65 if (success) {
66 return NULL;
67 } else {
63 // Make a copy of the error message as the original message string 68 // 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. 69 // may get deallocated when we return back from the Dart API call.
65 const String& err = 70 const String& err =
66 String::Handle(isolate->object_store()->sticky_error()); 71 String::Handle(isolate->object_store()->sticky_error());
67 const char* errmsg = err.ToCString(); 72 const char* errmsg = err.ToCString();
68 intptr_t errlen = strlen(errmsg) + 1; 73 intptr_t errlen = strlen(errmsg) + 1;
69 char* msg = reinterpret_cast<char*>(Api::Allocate(errlen)); 74 char* msg = reinterpret_cast<char*>(Api::Allocate(errlen));
70 OS::SNPrint(msg, errlen, "%s", errmsg); 75 OS::SNPrint(msg, errlen, "%s", errmsg);
71 return msg; 76 return msg;
72 } 77 }
73 return NULL;
74 } 78 }
75 79
76 80
77 static void SetupErrorResult(Dart_Handle* handle) { 81 static void SetupErrorResult(Dart_Handle* handle) {
78 // Make a copy of the error message as the original message string 82 // 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. 83 // may get deallocated when we return back from the Dart API call.
80 const String& error = String::Handle( 84 const String& error = String::Handle(
81 Isolate::Current()->object_store()->sticky_error()); 85 Isolate::Current()->object_store()->sticky_error());
82 const Object& obj = Object::Handle(ApiError::New(error)); 86 const Object& obj = Object::Handle(ApiError::New(error));
83 *handle = Api::NewLocalHandle(obj); 87 *handle = Api::NewLocalHandle(obj);
(...skipping 2323 matching lines...) Expand 10 before | Expand all | Expand 10 after
2407 } 2411 }
2408 delete debug_region; 2412 delete debug_region;
2409 } else { 2413 } else {
2410 *buffer = NULL; 2414 *buffer = NULL;
2411 *buffer_size = 0; 2415 *buffer_size = 0;
2412 } 2416 }
2413 } 2417 }
2414 2418
2415 2419
2416 } // namespace dart 2420 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/code_generator.cc ('k') | runtime/vm/isolate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698