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

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

Issue 9169102: Add Dart_PropagateError. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: '' Created 8 years, 10 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
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 "vm/object_store.h" 5 #include "vm/object_store.h"
6 6
7 #include "vm/exceptions.h" 7 #include "vm/exceptions.h"
8 #include "vm/isolate.h" 8 #include "vm/isolate.h"
9 #include "vm/longjump.h"
10 #include "vm/object.h" 9 #include "vm/object.h"
11 #include "vm/raw_object.h" 10 #include "vm/raw_object.h"
12 #include "vm/visitor.h" 11 #include "vm/visitor.h"
13 12
14 namespace dart { 13 namespace dart {
15 14
16 ObjectStore::ObjectStore() 15 ObjectStore::ObjectStore()
17 : object_class_(Class::null()), 16 : object_class_(Class::null()),
18 function_interface_(Type::null()), 17 function_interface_(Type::null()),
19 number_interface_(Type::null()), 18 number_interface_(Type::null()),
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 ASSERT(isolate->object_store() == NULL); 70 ASSERT(isolate->object_store() == NULL);
72 ObjectStore* store = new ObjectStore(); 71 ObjectStore* store = new ObjectStore();
73 isolate->set_object_store(store); 72 isolate->set_object_store(store);
74 } 73 }
75 74
76 75
77 bool ObjectStore::PreallocateObjects() { 76 bool ObjectStore::PreallocateObjects() {
78 if (preallocate_objects_called_) { 77 if (preallocate_objects_called_) {
79 return true; 78 return true;
80 } 79 }
81
82 Isolate* isolate = Isolate::Current(); 80 Isolate* isolate = Isolate::Current();
83 ASSERT(isolate != NULL && isolate->object_store() == this); 81 ASSERT(isolate != NULL && isolate->object_store() == this);
84 LongJump* base = isolate->long_jump_base(); 82 GrowableArray<const Object*> args;
85 LongJump jump; 83 Object& result = Object::Handle();
86 isolate->set_long_jump_base(&jump); 84 Instance& exception = Instance::Handle();
87 if (setjmp(*jump.Set()) == 0) { 85
88 GrowableArray<const Object*> args; 86 result = Exceptions::Create(Exceptions::kStackOverflow, args);
89 Instance& exception =Instance::Handle(); 87 if (result.IsError()) {
90 exception = Exceptions::Create(Exceptions::kStackOverflow, args);
91 set_stack_overflow(exception);
92 exception = Exceptions::Create(Exceptions::kOutOfMemory, args);
93 set_out_of_memory(exception);
94 } else {
95 return false; 88 return false;
96 } 89 }
97 isolate->set_long_jump_base(base); 90 exception ^= result.raw();
91 set_stack_overflow(exception);
92
93 result = Exceptions::Create(Exceptions::kOutOfMemory, args);
94 if (result.IsError()) {
95 return false;
96 }
97 exception ^= result.raw();
98 set_out_of_memory(exception);
99
98 preallocate_objects_called_ = true; 100 preallocate_objects_called_ = true;
99 return true; 101 return true;
100 } 102 }
101 103
102 104
103 RawClass* ObjectStore::GetClass(int index) { 105 RawClass* ObjectStore::GetClass(int index) {
104 switch (index) { 106 switch (index) {
105 case kObjectClass: return object_class_; 107 case kObjectClass: return object_class_;
106 case kSmiClass: return smi_class_; 108 case kSmiClass: return smi_class_;
107 case kMintClass: return mint_class_; 109 case kMintClass: return mint_class_;
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 return kBoolInterface; 211 return kBoolInterface;
210 } else if (raw_type == string_interface()) { 212 } else if (raw_type == string_interface()) {
211 return kStringInterface; 213 return kStringInterface;
212 } else if (raw_type == list_interface()) { 214 } else if (raw_type == list_interface()) {
213 return kListInterface; 215 return kListInterface;
214 } 216 }
215 return kInvalidIndex; 217 return kInvalidIndex;
216 } 218 }
217 219
218 } // namespace dart 220 } // namespace dart
OLDNEW
« runtime/vm/exceptions.cc ('K') | « runtime/vm/object_store.h ('k') | runtime/vm/parser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698