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

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

Issue 26682003: Cache number of type arguments in class object instead of recalculating it. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 2 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) 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_RAW_OBJECT_H_ 5 #ifndef VM_RAW_OBJECT_H_
6 #define VM_RAW_OBJECT_H_ 6 #define VM_RAW_OBJECT_H_
7 7
8 #include "platform/assert.h" 8 #include "platform/assert.h"
9 #include "vm/globals.h" 9 #include "vm/globals.h"
10 #include "vm/token.h" 10 #include "vm/token.h"
(...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after
489 RawFunction* signature_function_; // Associated function for signature class. 489 RawFunction* signature_function_; // Associated function for signature class.
490 RawArray* constants_; // Canonicalized values of this class. 490 RawArray* constants_; // Canonicalized values of this class.
491 RawArray* canonical_types_; // Canonicalized types of this class. 491 RawArray* canonical_types_; // Canonicalized types of this class.
492 RawArray* invocation_dispatcher_cache_; // Cache for dispatcher functions. 492 RawArray* invocation_dispatcher_cache_; // Cache for dispatcher functions.
493 RawCode* allocation_stub_; // Stub code for allocation of instances. 493 RawCode* allocation_stub_; // Stub code for allocation of instances.
494 RawObject** to() { 494 RawObject** to() {
495 return reinterpret_cast<RawObject**>(&ptr()->allocation_stub_); 495 return reinterpret_cast<RawObject**>(&ptr()->allocation_stub_);
496 } 496 }
497 497
498 cpp_vtable handle_vtable_; 498 cpp_vtable handle_vtable_;
499 intptr_t id_; // Class Id, also index in the class table.
500 intptr_t token_pos_;
499 intptr_t instance_size_in_words_; // Size if fixed len or 0 if variable len. 501 intptr_t instance_size_in_words_; // Size if fixed len or 0 if variable len.
500 intptr_t id_; // Class Id, also index in the class table.
501 intptr_t type_arguments_field_offset_in_words_; // Offset of type args fld. 502 intptr_t type_arguments_field_offset_in_words_; // Offset of type args fld.
502 intptr_t next_field_offset_in_words_; // Offset of the next instance field. 503 intptr_t next_field_offset_in_words_; // Offset of the next instance field.
503 intptr_t num_native_fields_; // Number of native fields in class. 504 int16_t num_type_arguments_; // Number of type arguments in flatten vector.
504 intptr_t token_pos_; 505 int16_t num_own_type_arguments_; // Number of non-overlapping type arguments.
506 uint16_t num_native_fields_; // Number of native fields in class.
505 uint16_t state_bits_; 507 uint16_t state_bits_;
506 508
507 friend class Instance; 509 friend class Instance;
508 friend class Object; 510 friend class Object;
509 friend class RawInstance; 511 friend class RawInstance;
510 friend class RawInstructions; 512 friend class RawInstructions;
511 friend class RawType; // TODO(regis): To temporarily print unfinalized types. 513 friend class RawType; // TODO(regis): To temporarily print unfinalized types.
512 friend class RawTypeParameter; // To temporarily print unfinalized types. 514 friend class RawTypeParameter; // To temporarily print unfinalized types.
513 friend class SnapshotReader; 515 friend class SnapshotReader;
514 }; 516 };
(...skipping 1203 matching lines...) Expand 10 before | Expand all | Expand 10 after
1718 // Make sure this is updated when new TypedData types are added. 1720 // Make sure this is updated when new TypedData types are added.
1719 ASSERT(kTypedDataInt8ArrayViewCid == kTypedDataInt8ArrayCid + 12); 1721 ASSERT(kTypedDataInt8ArrayViewCid == kTypedDataInt8ArrayCid + 12);
1720 ASSERT(kExternalTypedDataInt8ArrayCid == kTypedDataInt8ArrayViewCid + 13); 1722 ASSERT(kExternalTypedDataInt8ArrayCid == kTypedDataInt8ArrayViewCid + 13);
1721 ASSERT(kNullCid == kExternalTypedDataInt8ArrayCid + 12); 1723 ASSERT(kNullCid == kExternalTypedDataInt8ArrayCid + 12);
1722 return (kNullCid - kTypedDataInt8ArrayCid); 1724 return (kNullCid - kTypedDataInt8ArrayCid);
1723 } 1725 }
1724 1726
1725 } // namespace dart 1727 } // namespace dart
1726 1728
1727 #endif // VM_RAW_OBJECT_H_ 1729 #endif // VM_RAW_OBJECT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698