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

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

Issue 10352012: Using SubtypeTestCache object instead of an array, that way we do not need to patch and can communi… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 7 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 | « runtime/vm/flow_graph_compiler_x64.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) 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"
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 kLibraryPrefixClass, 160 kLibraryPrefixClass,
161 kCodeClass, 161 kCodeClass,
162 kInstructionsClass, 162 kInstructionsClass,
163 kPcDescriptorsClass, 163 kPcDescriptorsClass,
164 kStackmapClass, 164 kStackmapClass,
165 kLocalVarDescriptorsClass, 165 kLocalVarDescriptorsClass,
166 kExceptionHandlersClass, 166 kExceptionHandlersClass,
167 kContextClass, 167 kContextClass,
168 kContextScopeClass, 168 kContextScopeClass,
169 kICDataClass, 169 kICDataClass,
170 kSubtypeTestCacheClass,
170 kApiErrorClass, 171 kApiErrorClass,
171 kLanguageErrorClass, 172 kLanguageErrorClass,
172 kUnhandledExceptionClass, 173 kUnhandledExceptionClass,
173 kUnwindErrorClass, 174 kUnwindErrorClass,
174 kMaxId, 175 kMaxId,
175 kInvalidIndex = -1, 176 kInvalidIndex = -1,
176 }; 177 };
177 178
178 virtual ~Object() { } 179 virtual ~Object() { }
179 180
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 } 310 }
310 static RawClass* context_class() { return context_class_; } 311 static RawClass* context_class() { return context_class_; }
311 static RawClass* context_scope_class() { return context_scope_class_; } 312 static RawClass* context_scope_class() { return context_scope_class_; }
312 static RawClass* api_error_class() { return api_error_class_; } 313 static RawClass* api_error_class() { return api_error_class_; }
313 static RawClass* language_error_class() { return language_error_class_; } 314 static RawClass* language_error_class() { return language_error_class_; }
314 static RawClass* unhandled_exception_class() { 315 static RawClass* unhandled_exception_class() {
315 return unhandled_exception_class_; 316 return unhandled_exception_class_;
316 } 317 }
317 static RawClass* unwind_error_class() { return unwind_error_class_; } 318 static RawClass* unwind_error_class() { return unwind_error_class_; }
318 static RawClass* icdata_class() { return icdata_class_; } 319 static RawClass* icdata_class() { return icdata_class_; }
320 static RawClass* subtypetestcache_class() { return subtypetestcache_class_; }
319 321
320 static int GetSingletonClassIndex(const RawClass* raw_class); 322 static int GetSingletonClassIndex(const RawClass* raw_class);
321 static RawClass* GetSingletonClass(int index); 323 static RawClass* GetSingletonClass(int index);
322 static const char* GetSingletonClassName(int index); 324 static const char* GetSingletonClassName(int index);
323 325
324 static RawClass* CreateAndRegisterInterface(const char* cname, 326 static RawClass* CreateAndRegisterInterface(const char* cname,
325 const Script& script, 327 const Script& script,
326 const Library& lib); 328 const Library& lib);
327 static void RegisterClass(const Class& cls, 329 static void RegisterClass(const Class& cls,
328 const char* cname, 330 const char* cname,
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
410 static RawClass* library_prefix_class_; // Class of Library prefix vm object. 412 static RawClass* library_prefix_class_; // Class of Library prefix vm object.
411 static RawClass* code_class_; // Class of the Code vm object. 413 static RawClass* code_class_; // Class of the Code vm object.
412 static RawClass* instructions_class_; // Class of the Instructions vm object. 414 static RawClass* instructions_class_; // Class of the Instructions vm object.
413 static RawClass* pc_descriptors_class_; // Class of PcDescriptors vm object. 415 static RawClass* pc_descriptors_class_; // Class of PcDescriptors vm object.
414 static RawClass* stackmap_class_; // Class of Stackmap vm object. 416 static RawClass* stackmap_class_; // Class of Stackmap vm object.
415 static RawClass* var_descriptors_class_; // Class of LocalVarDescriptors. 417 static RawClass* var_descriptors_class_; // Class of LocalVarDescriptors.
416 static RawClass* exception_handlers_class_; // Class of ExceptionHandlers. 418 static RawClass* exception_handlers_class_; // Class of ExceptionHandlers.
417 static RawClass* context_class_; // Class of the Context vm object. 419 static RawClass* context_class_; // Class of the Context vm object.
418 static RawClass* context_scope_class_; // Class of ContextScope vm object. 420 static RawClass* context_scope_class_; // Class of ContextScope vm object.
419 static RawClass* icdata_class_; // Class of ICData. 421 static RawClass* icdata_class_; // Class of ICData.
422 static RawClass* subtypetestcache_class_; // Class of SubtypeTestCache.
420 static RawClass* api_error_class_; // Class of ApiError. 423 static RawClass* api_error_class_; // Class of ApiError.
421 static RawClass* language_error_class_; // Class of LanguageError. 424 static RawClass* language_error_class_; // Class of LanguageError.
422 static RawClass* unhandled_exception_class_; // Class of UnhandledException. 425 static RawClass* unhandled_exception_class_; // Class of UnhandledException.
423 static RawClass* unwind_error_class_; // Class of UnwindError. 426 static RawClass* unwind_error_class_; // Class of UnwindError.
424 427
425 friend void RawObject::Validate(Isolate* isolate) const; 428 friend void RawObject::Validate(Isolate* isolate) const;
426 friend class SnapshotReader; 429 friend class SnapshotReader;
427 430
428 // Disallow allocation. 431 // Disallow allocation.
429 void* operator new(size_t size); 432 void* operator new(size_t size);
(...skipping 1567 matching lines...) Expand 10 before | Expand all | Expand 10 after
1997 2000
1998 2001
1999 class PcDescriptors : public Object { 2002 class PcDescriptors : public Object {
2000 public: 2003 public:
2001 enum Kind { 2004 enum Kind {
2002 kDeopt = 0, // Deoptimization cotinuation point. 2005 kDeopt = 0, // Deoptimization cotinuation point.
2003 kPatchCode, // Buffer for patching code entry. 2006 kPatchCode, // Buffer for patching code entry.
2004 kIcCall, // IC call. 2007 kIcCall, // IC call.
2005 kFuncCall, // Call to known target, e.g. static call, closure call. 2008 kFuncCall, // Call to known target, e.g. static call, closure call.
2006 kReturn, // Return from function. 2009 kReturn, // Return from function.
2007 kTypeTest, // Array caching previous type tests.
2008 kOther 2010 kOther
2009 }; 2011 };
2010 2012
2011 intptr_t Length() const; 2013 intptr_t Length() const;
2012 2014
2013 uword PC(intptr_t index) const; 2015 uword PC(intptr_t index) const;
2014 PcDescriptors::Kind DescriptorKind(intptr_t index) const; 2016 PcDescriptors::Kind DescriptorKind(intptr_t index) const;
2015 const char* KindAsStr(intptr_t index) const; 2017 const char* KindAsStr(intptr_t index) const;
2016 intptr_t NodeId(intptr_t index) const; 2018 intptr_t NodeId(intptr_t index) const;
2017 intptr_t TokenIndex(intptr_t index) const; 2019 intptr_t TokenIndex(intptr_t index) const;
(...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after
2498 void set_num_args_tested(intptr_t value) const; 2500 void set_num_args_tested(intptr_t value) const;
2499 void set_ic_data(const Array& value) const; 2501 void set_ic_data(const Array& value) const;
2500 2502
2501 intptr_t TestEntryLength() const; 2503 intptr_t TestEntryLength() const;
2502 2504
2503 HEAP_OBJECT_IMPLEMENTATION(ICData, Object); 2505 HEAP_OBJECT_IMPLEMENTATION(ICData, Object);
2504 friend class Class; 2506 friend class Class;
2505 }; 2507 };
2506 2508
2507 2509
2510 class SubtypeTestCache : public Object {
2511 public:
2512 enum Entries {
2513 kInstanceClass = 0,
2514 kInstanceTypeArguments = 1,
2515 kInstantiatorTypeArguments = 2,
2516 kTestResult = 3,
2517 kTestEntryLength = 4,
2518 };
2519
2520 intptr_t NumberOfChecks() const;
2521 void AddCheck(const Class& instance_class,
2522 const AbstractTypeArguments& instance_type_arguments,
2523 const AbstractTypeArguments& instantiator_type_arguments,
2524 const Bool& test_result) const;
2525 void GetCheck(intptr_t ix,
2526 Class* instance_class,
2527 AbstractTypeArguments* instance_type_arguments,
2528 AbstractTypeArguments* instantiator_type_arguments,
2529 Bool* test_result) const;
2530
2531 static RawSubtypeTestCache* New();
2532
2533 static intptr_t InstanceSize() {
2534 return RoundedAllocationSize(sizeof(RawSubtypeTestCache));
2535 }
2536
2537 static intptr_t cache_offset() {
2538 return OFFSET_OF(RawSubtypeTestCache, cache_);
2539 }
2540
2541 private:
2542 RawArray* cache() const {
2543 return raw_ptr()->cache_;
2544 }
2545
2546 void set_cache(const Array& value) const;
2547
2548 intptr_t TestEntryLength() const;
2549
2550 HEAP_OBJECT_IMPLEMENTATION(SubtypeTestCache, Object);
2551 friend class Class;
2552 };
2553
2554
2508 class Error : public Object { 2555 class Error : public Object {
2509 public: 2556 public:
2510 virtual const char* ToErrorCString() const; 2557 virtual const char* ToErrorCString() const;
2511 2558
2512 private: 2559 private:
2513 HEAP_OBJECT_IMPLEMENTATION(Error, Object); 2560 HEAP_OBJECT_IMPLEMENTATION(Error, Object);
2514 }; 2561 };
2515 2562
2516 2563
2517 class ApiError : public Error { 2564 class ApiError : public Error {
(...skipping 1503 matching lines...) Expand 10 before | Expand all | Expand 10 after
4021 } 4068 }
4022 4069
4023 4070
4024 intptr_t Stackmap::SizeInBits() const { 4071 intptr_t Stackmap::SizeInBits() const {
4025 return (Smi::Value(raw_ptr()->bitmap_size_in_bytes_) * kBitsPerByte); 4072 return (Smi::Value(raw_ptr()->bitmap_size_in_bytes_) * kBitsPerByte);
4026 } 4073 }
4027 4074
4028 } // namespace dart 4075 } // namespace dart
4029 4076
4030 #endif // VM_OBJECT_H_ 4077 #endif // VM_OBJECT_H_
OLDNEW
« no previous file with comments | « runtime/vm/flow_graph_compiler_x64.cc ('k') | runtime/vm/object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698