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

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

Issue 1211633002: Introduce mechanism to record an allocation of a class (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 6 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
« no previous file with comments | « no previous file | 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 1345 matching lines...) Expand 10 before | Expand all | Expand 10 after
1356 // Register code that has used CHA for optimization. 1356 // Register code that has used CHA for optimization.
1357 // TODO(srdjan): Also register kind of CHA optimization (e.g.: leaf class, 1357 // TODO(srdjan): Also register kind of CHA optimization (e.g.: leaf class,
1358 // leaf method, ...). 1358 // leaf method, ...).
1359 void RegisterCHACode(const Code& code); 1359 void RegisterCHACode(const Code& code);
1360 1360
1361 void DisableCHAOptimizedCode(); 1361 void DisableCHAOptimizedCode();
1362 1362
1363 RawArray* cha_codes() const { return raw_ptr()->cha_codes_; } 1363 RawArray* cha_codes() const { return raw_ptr()->cha_codes_; }
1364 void set_cha_codes(const Array& value) const; 1364 void set_cha_codes(const Array& value) const;
1365 1365
1366 bool trace_allocation() const {
1367 return TraceAllocationBit::decode(raw_ptr()->state_bits_);
1368 }
1369 void SetTraceAllocation(bool trace_allocation) const;
1370
1366 private: 1371 private:
1367 enum MemberKind { 1372 enum MemberKind {
1368 kAny = 0, 1373 kAny = 0,
1369 kStatic, 1374 kStatic,
1370 kInstance, 1375 kInstance,
1371 kConstructor, 1376 kConstructor,
1372 kFactory, 1377 kFactory,
1373 }; 1378 };
1374 enum StateBits { 1379 enum StateBits {
1375 kConstBit = 0, 1380 kConstBit = 0,
1376 kImplementedBit = 1, 1381 kImplementedBit = 1,
1377 kTypeFinalizedBit = 2, 1382 kTypeFinalizedBit = 2,
1378 kClassFinalizedPos = 3, 1383 kClassFinalizedPos = 3,
1379 kClassFinalizedSize = 2, 1384 kClassFinalizedSize = 2,
1380 kAbstractBit = kClassFinalizedPos + kClassFinalizedSize, // = 5 1385 kAbstractBit = kClassFinalizedPos + kClassFinalizedSize, // = 5
1381 kPatchBit = 6, 1386 kPatchBit = 6,
1382 kSynthesizedClassBit = 7, 1387 kSynthesizedClassBit = 7,
1383 kMarkedForParsingBit = 8, 1388 kMarkedForParsingBit = 8,
1384 kMixinAppAliasBit = 9, 1389 kMixinAppAliasBit = 9,
1385 kMixinTypeAppliedBit = 10, 1390 kMixinTypeAppliedBit = 10,
1386 kFieldsMarkedNullableBit = 11, 1391 kFieldsMarkedNullableBit = 11,
1387 kCycleFreeBit = 12, 1392 kCycleFreeBit = 12,
1388 kEnumBit = 13, 1393 kEnumBit = 13,
1394 kTraceAllocationBit = 14,
1389 }; 1395 };
1390 class ConstBit : public BitField<bool, kConstBit, 1> {}; 1396 class ConstBit : public BitField<bool, kConstBit, 1> {};
1391 class ImplementedBit : public BitField<bool, kImplementedBit, 1> {}; 1397 class ImplementedBit : public BitField<bool, kImplementedBit, 1> {};
1392 class TypeFinalizedBit : public BitField<bool, kTypeFinalizedBit, 1> {}; 1398 class TypeFinalizedBit : public BitField<bool, kTypeFinalizedBit, 1> {};
1393 class ClassFinalizedBits : public BitField<RawClass::ClassFinalizedState, 1399 class ClassFinalizedBits : public BitField<RawClass::ClassFinalizedState,
1394 kClassFinalizedPos, kClassFinalizedSize> {}; // NOLINT 1400 kClassFinalizedPos, kClassFinalizedSize> {}; // NOLINT
1395 class AbstractBit : public BitField<bool, kAbstractBit, 1> {}; 1401 class AbstractBit : public BitField<bool, kAbstractBit, 1> {};
1396 class PatchBit : public BitField<bool, kPatchBit, 1> {}; 1402 class PatchBit : public BitField<bool, kPatchBit, 1> {};
1397 class SynthesizedClassBit : public BitField<bool, kSynthesizedClassBit, 1> {}; 1403 class SynthesizedClassBit : public BitField<bool, kSynthesizedClassBit, 1> {};
1398 class MarkedForParsingBit : public BitField<bool, kMarkedForParsingBit, 1> {}; 1404 class MarkedForParsingBit : public BitField<bool, kMarkedForParsingBit, 1> {};
1399 class MixinAppAliasBit : public BitField<bool, kMixinAppAliasBit, 1> {}; 1405 class MixinAppAliasBit : public BitField<bool, kMixinAppAliasBit, 1> {};
1400 class MixinTypeAppliedBit : public BitField<bool, kMixinTypeAppliedBit, 1> {}; 1406 class MixinTypeAppliedBit : public BitField<bool, kMixinTypeAppliedBit, 1> {};
1401 class FieldsMarkedNullableBit : public BitField<bool, 1407 class FieldsMarkedNullableBit : public BitField<bool,
1402 kFieldsMarkedNullableBit, 1> {}; // NOLINT 1408 kFieldsMarkedNullableBit, 1> {}; // NOLINT
1403 class CycleFreeBit : public BitField<bool, kCycleFreeBit, 1> {}; 1409 class CycleFreeBit : public BitField<bool, kCycleFreeBit, 1> {};
1404 class EnumBit : public BitField<bool, kEnumBit, 1> {}; 1410 class EnumBit : public BitField<bool, kEnumBit, 1> {};
1411 class TraceAllocationBit : public BitField<bool, kTraceAllocationBit, 1> {};
1405 1412
1406 void set_name(const String& value) const; 1413 void set_name(const String& value) const;
1407 void set_pretty_name(const String& value) const; 1414 void set_pretty_name(const String& value) const;
1408 void set_user_name(const String& value) const; 1415 void set_user_name(const String& value) const;
1409 RawString* GeneratePrettyName() const; 1416 RawString* GeneratePrettyName() const;
1410 RawString* GenerateUserVisibleName() const; 1417 RawString* GenerateUserVisibleName() const;
1411 void set_signature_function(const Function& value) const; 1418 void set_signature_function(const Function& value) const;
1412 void set_signature_type(const AbstractType& value) const; 1419 void set_signature_type(const AbstractType& value) const;
1413 void set_state_bits(intptr_t bits) const; 1420 void set_state_bits(intptr_t bits) const;
1414 1421
(...skipping 6561 matching lines...) Expand 10 before | Expand all | Expand 10 after
7976 7983
7977 7984
7978 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, 7985 RawObject* MegamorphicCache::GetTargetFunction(const Array& array,
7979 intptr_t index) { 7986 intptr_t index) {
7980 return array.At((index * kEntryLength) + kTargetFunctionIndex); 7987 return array.At((index * kEntryLength) + kTargetFunctionIndex);
7981 } 7988 }
7982 7989
7983 } // namespace dart 7990 } // namespace dart
7984 7991
7985 #endif // VM_OBJECT_H_ 7992 #endif // VM_OBJECT_H_
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698