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

Side by Side Diff: vm/object.h

Issue 9701010: First step towards implementing stack map descriptions for the optimizing compiler. (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/bitmap_test.cc ('k') | 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) 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 #ifndef VM_OBJECT_H_ 5 #ifndef VM_OBJECT_H_
6 #define VM_OBJECT_H_ 6 #define VM_OBJECT_H_
7 7
8 #include "include/dart_api.h" 8 #include "include/dart_api.h"
9 #include "platform/assert.h" 9 #include "platform/assert.h"
10 #include "platform/utils.h" 10 #include "platform/utils.h"
11 #include "vm/bitmap.h"
11 #include "vm/dart.h" 12 #include "vm/dart.h"
12 #include "vm/globals.h" 13 #include "vm/globals.h"
13 #include "vm/handles.h" 14 #include "vm/handles.h"
14 #include "vm/heap.h" 15 #include "vm/heap.h"
15 #include "vm/isolate.h" 16 #include "vm/isolate.h"
16 #include "vm/os.h" 17 #include "vm/os.h"
17 #include "vm/raw_object.h" 18 #include "vm/raw_object.h"
18 #include "vm/scanner.h" 19 #include "vm/scanner.h"
19 20
20 namespace dart { 21 namespace dart {
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 kFunctionClass, 146 kFunctionClass,
146 kFieldClass, 147 kFieldClass,
147 kLiteralTokenClass, 148 kLiteralTokenClass,
148 kTokenStreamClass, 149 kTokenStreamClass,
149 kScriptClass, 150 kScriptClass,
150 kLibraryClass, 151 kLibraryClass,
151 kLibraryPrefixClass, 152 kLibraryPrefixClass,
152 kCodeClass, 153 kCodeClass,
153 kInstructionsClass, 154 kInstructionsClass,
154 kPcDescriptorsClass, 155 kPcDescriptorsClass,
156 kStackmapClass,
155 kLocalVarDescriptorsClass, 157 kLocalVarDescriptorsClass,
156 kExceptionHandlersClass, 158 kExceptionHandlersClass,
157 kContextClass, 159 kContextClass,
158 kContextScopeClass, 160 kContextScopeClass,
159 kICDataClass, 161 kICDataClass,
160 kApiErrorClass, 162 kApiErrorClass,
161 kLanguageErrorClass, 163 kLanguageErrorClass,
162 kUnhandledExceptionClass, 164 kUnhandledExceptionClass,
163 kUnwindErrorClass, 165 kUnwindErrorClass,
164 kMaxId, 166 kMaxId,
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 static RawClass* function_class() { return function_class_; } 283 static RawClass* function_class() { return function_class_; }
282 static RawClass* field_class() { return field_class_; } 284 static RawClass* field_class() { return field_class_; }
283 static RawClass* literal_token_class() { return literal_token_class_; } 285 static RawClass* literal_token_class() { return literal_token_class_; }
284 static RawClass* token_stream_class() { return token_stream_class_; } 286 static RawClass* token_stream_class() { return token_stream_class_; }
285 static RawClass* script_class() { return script_class_; } 287 static RawClass* script_class() { return script_class_; }
286 static RawClass* library_class() { return library_class_; } 288 static RawClass* library_class() { return library_class_; }
287 static RawClass* library_prefix_class() { return library_prefix_class_; } 289 static RawClass* library_prefix_class() { return library_prefix_class_; }
288 static RawClass* code_class() { return code_class_; } 290 static RawClass* code_class() { return code_class_; }
289 static RawClass* instructions_class() { return instructions_class_; } 291 static RawClass* instructions_class() { return instructions_class_; }
290 static RawClass* pc_descriptors_class() { return pc_descriptors_class_; } 292 static RawClass* pc_descriptors_class() { return pc_descriptors_class_; }
293 static RawClass* stackmap_class() { return stackmap_class_; }
291 static RawClass* var_descriptors_class() { return var_descriptors_class_; } 294 static RawClass* var_descriptors_class() { return var_descriptors_class_; }
292 static RawClass* exception_handlers_class() { 295 static RawClass* exception_handlers_class() {
293 return exception_handlers_class_; 296 return exception_handlers_class_;
294 } 297 }
295 static RawClass* context_class() { return context_class_; } 298 static RawClass* context_class() { return context_class_; }
296 static RawClass* context_scope_class() { return context_scope_class_; } 299 static RawClass* context_scope_class() { return context_scope_class_; }
297 static RawClass* api_error_class() { return api_error_class_; } 300 static RawClass* api_error_class() { return api_error_class_; }
298 static RawClass* language_error_class() { return language_error_class_; } 301 static RawClass* language_error_class() { return language_error_class_; }
299 static RawClass* unhandled_exception_class() { 302 static RawClass* unhandled_exception_class() {
300 return unhandled_exception_class_; 303 return unhandled_exception_class_;
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 static RawClass* function_class_; // Class of the Function vm object. 391 static RawClass* function_class_; // Class of the Function vm object.
389 static RawClass* field_class_; // Class of the Field vm object. 392 static RawClass* field_class_; // Class of the Field vm object.
390 static RawClass* literal_token_class_; // Class of LiteralToken vm object. 393 static RawClass* literal_token_class_; // Class of LiteralToken vm object.
391 static RawClass* token_stream_class_; // Class of the TokenStream vm object. 394 static RawClass* token_stream_class_; // Class of the TokenStream vm object.
392 static RawClass* script_class_; // Class of the Script vm object. 395 static RawClass* script_class_; // Class of the Script vm object.
393 static RawClass* library_class_; // Class of the Library vm object. 396 static RawClass* library_class_; // Class of the Library vm object.
394 static RawClass* library_prefix_class_; // Class of Library prefix vm object. 397 static RawClass* library_prefix_class_; // Class of Library prefix vm object.
395 static RawClass* code_class_; // Class of the Code vm object. 398 static RawClass* code_class_; // Class of the Code vm object.
396 static RawClass* instructions_class_; // Class of the Instructions vm object. 399 static RawClass* instructions_class_; // Class of the Instructions vm object.
397 static RawClass* pc_descriptors_class_; // Class of PcDescriptors vm object. 400 static RawClass* pc_descriptors_class_; // Class of PcDescriptors vm object.
401 static RawClass* stackmap_class_; // Class of Stackmap vm object.
398 static RawClass* var_descriptors_class_; // Class of LocalVarDescriptors. 402 static RawClass* var_descriptors_class_; // Class of LocalVarDescriptors.
399 static RawClass* exception_handlers_class_; // Class of ExceptionHandlers. 403 static RawClass* exception_handlers_class_; // Class of ExceptionHandlers.
400 static RawClass* context_class_; // Class of the Context vm object. 404 static RawClass* context_class_; // Class of the Context vm object.
401 static RawClass* context_scope_class_; // Class of ContextScope vm object. 405 static RawClass* context_scope_class_; // Class of ContextScope vm object.
402 static RawClass* icdata_class_; // Class of ICData. 406 static RawClass* icdata_class_; // Class of ICData.
403 static RawClass* api_error_class_; // Class of ApiError. 407 static RawClass* api_error_class_; // Class of ApiError.
404 static RawClass* language_error_class_; // Class of LanguageError. 408 static RawClass* language_error_class_; // Class of LanguageError.
405 static RawClass* unhandled_exception_class_; // Class of UnhandledException. 409 static RawClass* unhandled_exception_class_; // Class of UnhandledException.
406 static RawClass* unwind_error_class_; // Class of UnwindError. 410 static RawClass* unwind_error_class_; // Class of UnwindError.
407 411
(...skipping 1569 matching lines...) Expand 10 before | Expand all | Expand 10 after
1977 } 1981 }
1978 RawSmi** SmiAddr(intptr_t index, intptr_t entry_offset) const { 1982 RawSmi** SmiAddr(intptr_t index, intptr_t entry_offset) const {
1979 return reinterpret_cast<RawSmi**>(EntryAddr(index, entry_offset)); 1983 return reinterpret_cast<RawSmi**>(EntryAddr(index, entry_offset));
1980 } 1984 }
1981 1985
1982 HEAP_OBJECT_IMPLEMENTATION(PcDescriptors, Object); 1986 HEAP_OBJECT_IMPLEMENTATION(PcDescriptors, Object);
1983 friend class Class; 1987 friend class Class;
1984 }; 1988 };
1985 1989
1986 1990
1991 class Stackmap : public Object {
1992 public:
1993 static const intptr_t kNoMaximum = -1;
1994 static const intptr_t kNoMinimum = -1;
1995
1996 bool IsObject(intptr_t offset) const {
1997 return InRange(offset) && GetBit(offset);
1998 }
1999 uword pc() const { return raw_ptr()->pc_; }
2000
2001 static intptr_t InstanceSize() {
2002 ASSERT(sizeof(RawStackmap) == OFFSET_OF(RawStackmap, data_));
2003 return 0;
2004 }
2005 static intptr_t InstanceSize(intptr_t size) {
2006 return RoundedAllocationSize(sizeof(RawStackmap) + (size * kWordSize));
2007 }
2008 static RawStackmap* New(uword pc, const Code& code, BitmapBuilder* bmap);
2009
2010 private:
2011 inline intptr_t SizeInBits() const;
2012
2013 bool InRange(intptr_t offset) const { return offset < SizeInBits(); }
2014
2015 bool GetBit(intptr_t bit_offset) const;
2016 void SetBit(intptr_t bit_offset, bool value) const;
2017
2018 // Return the offset of the highest stack slot that has an object.
2019 intptr_t Maximum() const;
2020
2021 // Return the offset of the lowest stack slot that has an object.
2022 intptr_t Minimum() const;
2023
2024 void set_bitmap_size_in_bytes(intptr_t value) const;
2025 void set_pc(uword value) const;
2026 void set_code(const Code& code) const;
2027
2028 HEAP_OBJECT_IMPLEMENTATION(Stackmap, Object);
2029 friend class Class;
2030 friend class BitmapBuilder;
2031 };
2032
2033
1987 class ExceptionHandlers : public Object { 2034 class ExceptionHandlers : public Object {
1988 public: 2035 public:
1989 intptr_t Length() const; 2036 intptr_t Length() const;
1990 2037
1991 intptr_t TryIndex(intptr_t index) const; 2038 intptr_t TryIndex(intptr_t index) const;
1992 intptr_t HandlerPC(intptr_t index) const; 2039 intptr_t HandlerPC(intptr_t index) const;
1993 2040
1994 void SetHandlerEntry(intptr_t index, 2041 void SetHandlerEntry(intptr_t index,
1995 intptr_t try_index, 2042 intptr_t try_index,
1996 intptr_t handler_pc) const { 2043 intptr_t handler_pc) const {
(...skipping 1830 matching lines...) Expand 10 before | Expand all | Expand 10 after
3827 } 3874 }
3828 ASSERT(obj.IsString()); // Must be an identifier. 3875 ASSERT(obj.IsString()); // Must be an identifier.
3829 return Token::kIDENT; 3876 return Token::kIDENT;
3830 } 3877 }
3831 3878
3832 3879
3833 void Context::SetAt(intptr_t index, const Instance& value) const { 3880 void Context::SetAt(intptr_t index, const Instance& value) const {
3834 StorePointer(InstanceAddr(index), value.raw()); 3881 StorePointer(InstanceAddr(index), value.raw());
3835 } 3882 }
3836 3883
3884
3885 intptr_t Stackmap::SizeInBits() const {
3886 return (Smi::Value(raw_ptr()->bitmap_size_in_bytes_) * kBitsPerByte);
3887 }
3888
3837 } // namespace dart 3889 } // namespace dart
3838 3890
3839 #endif // VM_OBJECT_H_ 3891 #endif // VM_OBJECT_H_
OLDNEW
« no previous file with comments | « vm/bitmap_test.cc ('k') | vm/object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698