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

Side by Side Diff: runtime/vm/object.h

Issue 8501034: Deal with unhandled exceptions the same way in all Dart api functions. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: '' Created 9 years, 1 month 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/isolate_test.cc ('k') | runtime/vm/object.cc » ('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 #ifndef VM_OBJECT_H_ 5 #ifndef VM_OBJECT_H_
6 #define VM_OBJECT_H_ 6 #define VM_OBJECT_H_
7 7
8 #include "vm/assert.h" 8 #include "vm/assert.h"
9 #include "vm/dart.h" 9 #include "vm/dart.h"
10 #include "vm/globals.h" 10 #include "vm/globals.h"
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 kTokenStreamClass, 132 kTokenStreamClass,
133 kScriptClass, 133 kScriptClass,
134 kLibraryClass, 134 kLibraryClass,
135 kLibraryPrefixClass, 135 kLibraryPrefixClass,
136 kCodeClass, 136 kCodeClass,
137 kInstructionsClass, 137 kInstructionsClass,
138 kPcDescriptorsClass, 138 kPcDescriptorsClass,
139 kExceptionHandlersClass, 139 kExceptionHandlersClass,
140 kContextClass, 140 kContextClass,
141 kContextScopeClass, 141 kContextScopeClass,
142 kApiFailureClass, 142 kApiErrorClass,
143 kMaxId, 143 kMaxId,
144 kInvalidIndex = -1, 144 kInvalidIndex = -1,
145 }; 145 };
146 146
147 virtual ~Object() { } 147 virtual ~Object() { }
148 148
149 RawObject* raw() const { return raw_; } 149 RawObject* raw() const { return raw_; }
150 void operator=(RawObject* value) { SetRaw(value); } 150 void operator=(RawObject* value) { SetRaw(value); }
151 151
152 inline RawClass* clazz() const; 152 inline RawClass* clazz() const;
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 static RawClass* library_class() { return library_class_; } 232 static RawClass* library_class() { return library_class_; }
233 static RawClass* library_prefix_class() { return library_prefix_class_; } 233 static RawClass* library_prefix_class() { return library_prefix_class_; }
234 static RawClass* code_class() { return code_class_; } 234 static RawClass* code_class() { return code_class_; }
235 static RawClass* instructions_class() { return instructions_class_; } 235 static RawClass* instructions_class() { return instructions_class_; }
236 static RawClass* pc_descriptors_class() { return pc_descriptors_class_; } 236 static RawClass* pc_descriptors_class() { return pc_descriptors_class_; }
237 static RawClass* exception_handlers_class() { 237 static RawClass* exception_handlers_class() {
238 return exception_handlers_class_; 238 return exception_handlers_class_;
239 } 239 }
240 static RawClass* context_class() { return context_class_; } 240 static RawClass* context_class() { return context_class_; }
241 static RawClass* context_scope_class() { return context_scope_class_; } 241 static RawClass* context_scope_class() { return context_scope_class_; }
242 static RawClass* api_failure_class() { return api_failure_class_; } 242 static RawClass* api_error_class() { return api_error_class_; }
243 243
244 static int GetSingletonClassIndex(const RawClass* raw_class); 244 static int GetSingletonClassIndex(const RawClass* raw_class);
245 static RawClass* GetSingletonClass(int index); 245 static RawClass* GetSingletonClass(int index);
246 static const char* GetSingletonClassName(int index); 246 static const char* GetSingletonClassName(int index);
247 247
248 static void Init(Isolate* isolate); 248 static void Init(Isolate* isolate);
249 static void InitFromSnapshot(Isolate* isolate); 249 static void InitFromSnapshot(Isolate* isolate);
250 static void InitOnce(); 250 static void InitOnce();
251 251
252 static intptr_t InstanceSize() { 252 static intptr_t InstanceSize() {
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 static RawClass* token_stream_class_; // Class of the TokenStream vm object. 325 static RawClass* token_stream_class_; // Class of the TokenStream vm object.
326 static RawClass* script_class_; // Class of the Script vm object. 326 static RawClass* script_class_; // Class of the Script vm object.
327 static RawClass* library_class_; // Class of the Library vm object. 327 static RawClass* library_class_; // Class of the Library vm object.
328 static RawClass* library_prefix_class_; // Class of Library prefix vm object. 328 static RawClass* library_prefix_class_; // Class of Library prefix vm object.
329 static RawClass* code_class_; // Class of the Code vm object. 329 static RawClass* code_class_; // Class of the Code vm object.
330 static RawClass* instructions_class_; // Class of the Instructions vm object. 330 static RawClass* instructions_class_; // Class of the Instructions vm object.
331 static RawClass* pc_descriptors_class_; // Class of PcDescriptors vm object. 331 static RawClass* pc_descriptors_class_; // Class of PcDescriptors vm object.
332 static RawClass* exception_handlers_class_; // Class of ExceptionHandlers. 332 static RawClass* exception_handlers_class_; // Class of ExceptionHandlers.
333 static RawClass* context_class_; // Class of the Context vm object. 333 static RawClass* context_class_; // Class of the Context vm object.
334 static RawClass* context_scope_class_; // Class of ContextScope vm object. 334 static RawClass* context_scope_class_; // Class of ContextScope vm object.
335 static RawClass* api_failure_class_; // Class of ApiFailure. 335 static RawClass* api_error_class_; // Class of ApiError.
336 336
337 friend class Class; 337 friend class Class;
338 friend class SnapshotReader; 338 friend class SnapshotReader;
339 339
340 // Disallow allocation. 340 // Disallow allocation.
341 void* operator new(size_t size); 341 void* operator new(size_t size);
342 // Disallow copy constructor. 342 // Disallow copy constructor.
343 DISALLOW_COPY_AND_ASSIGN(Object); 343 DISALLOW_COPY_AND_ASSIGN(Object);
344 }; 344 };
345 345
(...skipping 1709 matching lines...) Expand 10 before | Expand all | Expand 10 after
2055 2055
2056 private: 2056 private:
2057 void set_exception(const Instance& exception) const; 2057 void set_exception(const Instance& exception) const;
2058 void set_stacktrace(const Instance& stacktrace) const; 2058 void set_stacktrace(const Instance& stacktrace) const;
2059 2059
2060 HEAP_OBJECT_IMPLEMENTATION(UnhandledException, Object); 2060 HEAP_OBJECT_IMPLEMENTATION(UnhandledException, Object);
2061 friend class Class; 2061 friend class Class;
2062 }; 2062 };
2063 2063
2064 2064
2065 class ApiFailure : public Object { 2065 class ApiError : public Object {
2066 public: 2066 public:
2067 RawString* message() const { return raw_ptr()->message_; } 2067 RawObject* data() const { return raw_ptr()->data_; }
2068 static intptr_t message_offset() { 2068 static intptr_t data_offset() {
2069 return OFFSET_OF(RawApiFailure, message_); 2069 return OFFSET_OF(RawApiError, data_);
2070 } 2070 }
2071 2071
2072 static intptr_t InstanceSize() { 2072 static intptr_t InstanceSize() {
2073 return RoundedAllocationSize(sizeof(RawApiFailure)); 2073 return RoundedAllocationSize(sizeof(RawApiError));
2074 } 2074 }
2075 2075
2076 static RawApiFailure* New(const String& message, 2076 static RawApiError* New(const String& message,
2077 Heap::Space space = Heap::kNew); 2077 Heap::Space space = Heap::kNew);
2078
2079 static RawApiError* New(const UnhandledException& exception,
2080 Heap::Space space = Heap::kNew);
2078 2081
2079 private: 2082 private:
2080 void set_message(const String& message) const; 2083 void set_data(const Object& data) const;
2081 2084
2082 HEAP_OBJECT_IMPLEMENTATION(ApiFailure, Object); 2085 HEAP_OBJECT_IMPLEMENTATION(ApiError, Object);
2083 friend class Class; 2086 friend class Class;
2084 }; 2087 };
2085 2088
2086 2089
2087 // Instance is the base class for all instance objects (aka the Object class 2090 // Instance is the base class for all instance objects (aka the Object class
2088 // in Dart source code. 2091 // in Dart source code.
2089 class Instance : public Object { 2092 class Instance : public Object {
2090 public: 2093 public:
2091 virtual bool Equals(const Instance& other) const; 2094 virtual bool Equals(const Instance& other) const;
2092 virtual RawInstance* Canonicalize() const; 2095 virtual RawInstance* Canonicalize() const;
(...skipping 907 matching lines...) Expand 10 before | Expand all | Expand 10 after
3000 } 3003 }
3001 3004
3002 3005
3003 void Context::SetAt(intptr_t index, const Instance& value) const { 3006 void Context::SetAt(intptr_t index, const Instance& value) const {
3004 StorePointer(InstanceAddr(index), value.raw()); 3007 StorePointer(InstanceAddr(index), value.raw());
3005 } 3008 }
3006 3009
3007 } // namespace dart 3010 } // namespace dart
3008 3011
3009 #endif // VM_OBJECT_H_ 3012 #endif // VM_OBJECT_H_
OLDNEW
« no previous file with comments | « runtime/vm/isolate_test.cc ('k') | runtime/vm/object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698