OLD | NEW |
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 1348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1359 // Register code that has used CHA for optimization. | 1359 // Register code that has used CHA for optimization. |
1360 // TODO(srdjan): Also register kind of CHA optimization (e.g.: leaf class, | 1360 // TODO(srdjan): Also register kind of CHA optimization (e.g.: leaf class, |
1361 // leaf method, ...). | 1361 // leaf method, ...). |
1362 void RegisterCHACode(const Code& code); | 1362 void RegisterCHACode(const Code& code); |
1363 | 1363 |
1364 void DisableCHAOptimizedCode(); | 1364 void DisableCHAOptimizedCode(); |
1365 | 1365 |
1366 RawArray* cha_codes() const { return raw_ptr()->cha_codes_; } | 1366 RawArray* cha_codes() const { return raw_ptr()->cha_codes_; } |
1367 void set_cha_codes(const Array& value) const; | 1367 void set_cha_codes(const Array& value) const; |
1368 | 1368 |
1369 bool trace_allocation() const { | 1369 bool TraceAllocation(Isolate* isolate) const; |
1370 return TraceAllocationBit::decode(raw_ptr()->state_bits_); | |
1371 } | |
1372 void SetTraceAllocation(bool trace_allocation) const; | 1370 void SetTraceAllocation(bool trace_allocation) const; |
1373 | 1371 |
1374 private: | 1372 private: |
1375 enum MemberKind { | 1373 enum MemberKind { |
1376 kAny = 0, | 1374 kAny = 0, |
1377 kStatic, | 1375 kStatic, |
1378 kInstance, | 1376 kInstance, |
1379 kConstructor, | 1377 kConstructor, |
1380 kFactory, | 1378 kFactory, |
1381 }; | 1379 }; |
1382 enum StateBits { | 1380 enum StateBits { |
1383 kConstBit = 0, | 1381 kConstBit = 0, |
1384 kImplementedBit = 1, | 1382 kImplementedBit = 1, |
1385 kTypeFinalizedBit = 2, | 1383 kTypeFinalizedBit = 2, |
1386 kClassFinalizedPos = 3, | 1384 kClassFinalizedPos = 3, |
1387 kClassFinalizedSize = 2, | 1385 kClassFinalizedSize = 2, |
1388 kAbstractBit = kClassFinalizedPos + kClassFinalizedSize, // = 5 | 1386 kAbstractBit = kClassFinalizedPos + kClassFinalizedSize, // = 5 |
1389 kPatchBit = 6, | 1387 kPatchBit = 6, |
1390 kSynthesizedClassBit = 7, | 1388 kSynthesizedClassBit = 7, |
1391 kMarkedForParsingBit = 8, | 1389 kMarkedForParsingBit = 8, |
1392 kMixinAppAliasBit = 9, | 1390 kMixinAppAliasBit = 9, |
1393 kMixinTypeAppliedBit = 10, | 1391 kMixinTypeAppliedBit = 10, |
1394 kFieldsMarkedNullableBit = 11, | 1392 kFieldsMarkedNullableBit = 11, |
1395 kCycleFreeBit = 12, | 1393 kCycleFreeBit = 12, |
1396 kEnumBit = 13, | 1394 kEnumBit = 13, |
1397 kTraceAllocationBit = 14, | |
1398 kIsAllocatedBit = 15, | 1395 kIsAllocatedBit = 15, |
1399 }; | 1396 }; |
1400 class ConstBit : public BitField<bool, kConstBit, 1> {}; | 1397 class ConstBit : public BitField<bool, kConstBit, 1> {}; |
1401 class ImplementedBit : public BitField<bool, kImplementedBit, 1> {}; | 1398 class ImplementedBit : public BitField<bool, kImplementedBit, 1> {}; |
1402 class TypeFinalizedBit : public BitField<bool, kTypeFinalizedBit, 1> {}; | 1399 class TypeFinalizedBit : public BitField<bool, kTypeFinalizedBit, 1> {}; |
1403 class ClassFinalizedBits : public BitField<RawClass::ClassFinalizedState, | 1400 class ClassFinalizedBits : public BitField<RawClass::ClassFinalizedState, |
1404 kClassFinalizedPos, kClassFinalizedSize> {}; // NOLINT | 1401 kClassFinalizedPos, kClassFinalizedSize> {}; // NOLINT |
1405 class AbstractBit : public BitField<bool, kAbstractBit, 1> {}; | 1402 class AbstractBit : public BitField<bool, kAbstractBit, 1> {}; |
1406 class PatchBit : public BitField<bool, kPatchBit, 1> {}; | 1403 class PatchBit : public BitField<bool, kPatchBit, 1> {}; |
1407 class SynthesizedClassBit : public BitField<bool, kSynthesizedClassBit, 1> {}; | 1404 class SynthesizedClassBit : public BitField<bool, kSynthesizedClassBit, 1> {}; |
1408 class MarkedForParsingBit : public BitField<bool, kMarkedForParsingBit, 1> {}; | 1405 class MarkedForParsingBit : public BitField<bool, kMarkedForParsingBit, 1> {}; |
1409 class MixinAppAliasBit : public BitField<bool, kMixinAppAliasBit, 1> {}; | 1406 class MixinAppAliasBit : public BitField<bool, kMixinAppAliasBit, 1> {}; |
1410 class MixinTypeAppliedBit : public BitField<bool, kMixinTypeAppliedBit, 1> {}; | 1407 class MixinTypeAppliedBit : public BitField<bool, kMixinTypeAppliedBit, 1> {}; |
1411 class FieldsMarkedNullableBit : public BitField<bool, | 1408 class FieldsMarkedNullableBit : public BitField<bool, |
1412 kFieldsMarkedNullableBit, 1> {}; // NOLINT | 1409 kFieldsMarkedNullableBit, 1> {}; // NOLINT |
1413 class CycleFreeBit : public BitField<bool, kCycleFreeBit, 1> {}; | 1410 class CycleFreeBit : public BitField<bool, kCycleFreeBit, 1> {}; |
1414 class EnumBit : public BitField<bool, kEnumBit, 1> {}; | 1411 class EnumBit : public BitField<bool, kEnumBit, 1> {}; |
1415 class TraceAllocationBit : public BitField<bool, kTraceAllocationBit, 1> {}; | |
1416 class IsAllocatedBit : public BitField<bool, kIsAllocatedBit, 1> {}; | 1412 class IsAllocatedBit : public BitField<bool, kIsAllocatedBit, 1> {}; |
1417 | 1413 |
1418 void set_name(const String& value) const; | 1414 void set_name(const String& value) const; |
1419 void set_pretty_name(const String& value) const; | 1415 void set_pretty_name(const String& value) const; |
1420 void set_user_name(const String& value) const; | 1416 void set_user_name(const String& value) const; |
1421 RawString* GeneratePrettyName() const; | 1417 RawString* GeneratePrettyName() const; |
1422 RawString* GenerateUserVisibleName() const; | 1418 RawString* GenerateUserVisibleName() const; |
1423 void set_signature_function(const Function& value) const; | 1419 void set_signature_function(const Function& value) const; |
1424 void set_signature_type(const AbstractType& value) const; | 1420 void set_signature_type(const AbstractType& value) const; |
1425 void set_state_bits(intptr_t bits) const; | 1421 void set_state_bits(intptr_t bits) const; |
(...skipping 6609 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8035 | 8031 |
8036 | 8032 |
8037 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, | 8033 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, |
8038 intptr_t index) { | 8034 intptr_t index) { |
8039 return array.At((index * kEntryLength) + kTargetFunctionIndex); | 8035 return array.At((index * kEntryLength) + kTargetFunctionIndex); |
8040 } | 8036 } |
8041 | 8037 |
8042 } // namespace dart | 8038 } // namespace dart |
8043 | 8039 |
8044 #endif // VM_OBJECT_H_ | 8040 #endif // VM_OBJECT_H_ |
OLD | NEW |