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

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

Issue 1644223006: Fix some more shorten-64-to-32 warnings: (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Address review comments. Created 4 years, 10 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 | « runtime/vm/native_arguments.h ('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 1344 matching lines...) Expand 10 before | Expand all | Expand 10 after
1355 kPatchBit = 6, 1355 kPatchBit = 6,
1356 kSynthesizedClassBit = 7, 1356 kSynthesizedClassBit = 7,
1357 kMarkedForParsingBit = 8, 1357 kMarkedForParsingBit = 8,
1358 kMixinAppAliasBit = 9, 1358 kMixinAppAliasBit = 9,
1359 kMixinTypeAppliedBit = 10, 1359 kMixinTypeAppliedBit = 10,
1360 kFieldsMarkedNullableBit = 11, 1360 kFieldsMarkedNullableBit = 11,
1361 kCycleFreeBit = 12, 1361 kCycleFreeBit = 12,
1362 kEnumBit = 13, 1362 kEnumBit = 13,
1363 kIsAllocatedBit = 15, 1363 kIsAllocatedBit = 15,
1364 }; 1364 };
1365 class ConstBit : public BitField<bool, kConstBit, 1> {}; 1365 class ConstBit : public BitField<uint16_t, bool, kConstBit, 1> {};
1366 class ImplementedBit : public BitField<bool, kImplementedBit, 1> {}; 1366 class ImplementedBit : public BitField<uint16_t, bool, kImplementedBit, 1> {};
1367 class TypeFinalizedBit : public BitField<bool, kTypeFinalizedBit, 1> {}; 1367 class TypeFinalizedBit :
1368 class ClassFinalizedBits : public BitField<RawClass::ClassFinalizedState, 1368 public BitField<uint16_t, bool, kTypeFinalizedBit, 1> {};
1369 kClassFinalizedPos, kClassFinalizedSize> {}; // NOLINT 1369 class ClassFinalizedBits : public BitField<uint16_t,
1370 class AbstractBit : public BitField<bool, kAbstractBit, 1> {}; 1370 RawClass::ClassFinalizedState,
1371 class PatchBit : public BitField<bool, kPatchBit, 1> {}; 1371 kClassFinalizedPos,
1372 class SynthesizedClassBit : public BitField<bool, kSynthesizedClassBit, 1> {}; 1372 kClassFinalizedSize> {};
1373 class MarkedForParsingBit : public BitField<bool, kMarkedForParsingBit, 1> {}; 1373 class AbstractBit : public BitField<uint16_t, bool, kAbstractBit, 1> {};
1374 class MixinAppAliasBit : public BitField<bool, kMixinAppAliasBit, 1> {}; 1374 class PatchBit : public BitField<uint16_t, bool, kPatchBit, 1> {};
1375 class MixinTypeAppliedBit : public BitField<bool, kMixinTypeAppliedBit, 1> {}; 1375 class SynthesizedClassBit :
1376 class FieldsMarkedNullableBit : public BitField<bool, 1376 public BitField<uint16_t, bool, kSynthesizedClassBit, 1> {};
1377 kFieldsMarkedNullableBit, 1> {}; // NOLINT 1377 class MarkedForParsingBit :
1378 class CycleFreeBit : public BitField<bool, kCycleFreeBit, 1> {}; 1378 public BitField<uint16_t, bool, kMarkedForParsingBit, 1> {};
1379 class EnumBit : public BitField<bool, kEnumBit, 1> {}; 1379 class MixinAppAliasBit :
1380 class IsAllocatedBit : public BitField<bool, kIsAllocatedBit, 1> {}; 1380 public BitField<uint16_t, bool, kMixinAppAliasBit, 1> {};
1381 class MixinTypeAppliedBit :
1382 public BitField<uint16_t, bool, kMixinTypeAppliedBit, 1> {};
1383 class FieldsMarkedNullableBit :
1384 public BitField<uint16_t, bool, kFieldsMarkedNullableBit, 1> {};
1385 class CycleFreeBit : public BitField<uint16_t, bool, kCycleFreeBit, 1> {};
1386 class EnumBit : public BitField<uint16_t, bool, kEnumBit, 1> {};
1387 class IsAllocatedBit : public BitField<uint16_t, bool, kIsAllocatedBit, 1> {};
1381 1388
1382 void set_name(const String& value) const; 1389 void set_name(const String& value) const;
1383 void set_pretty_name(const String& value) const; 1390 void set_pretty_name(const String& value) const;
1384 void set_user_name(const String& value) const; 1391 void set_user_name(const String& value) const;
1385 RawString* GeneratePrettyName() const; 1392 RawString* GeneratePrettyName() const;
1386 RawString* GenerateUserVisibleName() const; 1393 RawString* GenerateUserVisibleName() const;
1387 void set_state_bits(intptr_t bits) const; 1394 void set_state_bits(intptr_t bits) const;
1388 1395
1389 void set_constants(const Array& value) const; 1396 void set_constants(const Array& value) const;
1390 1397
(...skipping 639 matching lines...) Expand 10 before | Expand all | Expand 10 after
2030 kNumArgsTestedPos = 0, 2037 kNumArgsTestedPos = 0,
2031 kNumArgsTestedSize = 2, 2038 kNumArgsTestedSize = 2,
2032 kDeoptReasonPos = kNumArgsTestedPos + kNumArgsTestedSize, 2039 kDeoptReasonPos = kNumArgsTestedPos + kNumArgsTestedSize,
2033 kDeoptReasonSize = kLastRecordedDeoptReason + 1, 2040 kDeoptReasonSize = kLastRecordedDeoptReason + 1,
2034 kIssuedJSWarningBit = kDeoptReasonPos + kDeoptReasonSize, 2041 kIssuedJSWarningBit = kDeoptReasonPos + kDeoptReasonSize,
2035 kRangeFeedbackPos = kIssuedJSWarningBit + 1, 2042 kRangeFeedbackPos = kIssuedJSWarningBit + 1,
2036 kRangeFeedbackSize = kBitsPerRangeFeedback * kRangeFeedbackSlots 2043 kRangeFeedbackSize = kBitsPerRangeFeedback * kRangeFeedbackSlots
2037 }; 2044 };
2038 2045
2039 class NumArgsTestedBits : public BitField<uint32_t, 2046 class NumArgsTestedBits : public BitField<uint32_t,
2040 kNumArgsTestedPos, kNumArgsTestedSize> {}; // NOLINT 2047 uint32_t,
2048 kNumArgsTestedPos,
2049 kNumArgsTestedSize> {};
2041 class DeoptReasonBits : public BitField<uint32_t, 2050 class DeoptReasonBits : public BitField<uint32_t,
2042 ICData::kDeoptReasonPos, ICData::kDeoptReasonSize> {}; // NOLINT 2051 uint32_t,
2043 class IssuedJSWarningBit : public BitField<bool, kIssuedJSWarningBit, 1> {}; 2052 ICData::kDeoptReasonPos,
2053 ICData::kDeoptReasonSize> {};
2054 class IssuedJSWarningBit :
2055 public BitField<uint32_t, bool, kIssuedJSWarningBit, 1> {};
2044 class RangeFeedbackBits : public BitField<uint32_t, 2056 class RangeFeedbackBits : public BitField<uint32_t,
2045 ICData::kRangeFeedbackPos, ICData::kRangeFeedbackSize> {}; // NOLINT 2057 uint32_t,
2058 ICData::kRangeFeedbackPos,
2059 ICData::kRangeFeedbackSize> {};
2046 2060
2047 #if defined(DEBUG) 2061 #if defined(DEBUG)
2048 // Used in asserts to verify that a check is not added twice. 2062 // Used in asserts to verify that a check is not added twice.
2049 bool HasCheck(const GrowableArray<intptr_t>& cids) const; 2063 bool HasCheck(const GrowableArray<intptr_t>& cids) const;
2050 #endif // DEBUG 2064 #endif // DEBUG
2051 2065
2052 intptr_t TestEntryLength() const; 2066 intptr_t TestEntryLength() const;
2053 static RawArray* NewNonCachedEmptyICDataArray(intptr_t num_args_tested); 2067 static RawArray* NewNonCachedEmptyICDataArray(intptr_t num_args_tested);
2054 static RawArray* NewEmptyICDataArray(intptr_t num_args_tested); 2068 static RawArray* NewEmptyICDataArray(intptr_t num_args_tested);
2055 static RawICData* NewDescriptor(Zone* zone, 2069 static RawICData* NewDescriptor(Zone* zone,
(...skipping 669 matching lines...) Expand 10 before | Expand all | Expand 10 after
2725 kNumTagBits 2739 kNumTagBits
2726 }; 2740 };
2727 2741
2728 COMPILE_ASSERT( 2742 COMPILE_ASSERT(
2729 MethodRecognizer::kNumRecognizedMethods < (1 << kRecognizedTagSize)); 2743 MethodRecognizer::kNumRecognizedMethods < (1 << kRecognizedTagSize));
2730 COMPILE_ASSERT( 2744 COMPILE_ASSERT(
2731 kNumTagBits <= 2745 kNumTagBits <=
2732 (kBitsPerByte * sizeof(static_cast<RawFunction*>(0)->kind_tag_))); 2746 (kBitsPerByte * sizeof(static_cast<RawFunction*>(0)->kind_tag_)));
2733 2747
2734 class KindBits : 2748 class KindBits :
2735 public BitField<RawFunction::Kind, kKindTagPos, kKindTagSize> {}; // NOLINT 2749 public BitField<uint32_t, RawFunction::Kind, kKindTagPos, kKindTagSize> {};
2736 2750
2737 class RecognizedBits : public BitField<MethodRecognizer::Kind, 2751 class RecognizedBits : public BitField<uint32_t,
2752 MethodRecognizer::Kind,
2738 kRecognizedTagPos, 2753 kRecognizedTagPos,
2739 kRecognizedTagSize> {}; 2754 kRecognizedTagSize> {};
2740 class ModifierBits : 2755 class ModifierBits : public BitField<uint32_t,
2741 public BitField<RawFunction::AsyncModifier, 2756 RawFunction::AsyncModifier,
2742 kModifierPos, 2757 kModifierPos,
2743 kModifierSize> {}; // NOLINT 2758 kModifierSize> {};
2744 2759
2745 #define DEFINE_BIT(name, _) \ 2760 #define DEFINE_BIT(name, _) \
2746 class name##Bit : public BitField<bool, k##name##Bit, 1> {}; 2761 class name##Bit : public BitField<uint32_t, bool, k##name##Bit, 1> {};
2747 FOR_EACH_FUNCTION_KIND_BIT(DEFINE_BIT) 2762 FOR_EACH_FUNCTION_KIND_BIT(DEFINE_BIT)
2748 #undef DEFINE_BIT 2763 #undef DEFINE_BIT
2749 2764
2750 void set_name(const String& value) const; 2765 void set_name(const String& value) const;
2751 void set_kind(RawFunction::Kind value) const; 2766 void set_kind(RawFunction::Kind value) const;
2752 void set_parent_function(const Function& value) const; 2767 void set_parent_function(const Function& value) const;
2753 void set_owner(const Object& value) const; 2768 void set_owner(const Object& value) const;
2754 RawFunction* implicit_closure_function() const; 2769 RawFunction* implicit_closure_function() const;
2755 void set_implicit_closure_function(const Function& value) const; 2770 void set_implicit_closure_function(const Function& value) const;
2756 RawInstance* implicit_static_closure() const; 2771 RawInstance* implicit_static_closure() const;
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after
3073 3088
3074 enum { 3089 enum {
3075 kConstBit = 0, 3090 kConstBit = 0,
3076 kStaticBit, 3091 kStaticBit,
3077 kFinalBit, 3092 kFinalBit,
3078 kHasInitializerBit, 3093 kHasInitializerBit,
3079 kUnboxingCandidateBit, 3094 kUnboxingCandidateBit,
3080 kReflectableBit, 3095 kReflectableBit,
3081 kDoubleInitializedBit, 3096 kDoubleInitializedBit,
3082 }; 3097 };
3083 class ConstBit : public BitField<bool, kConstBit, 1> {}; 3098 class ConstBit : public BitField<uint8_t, bool, kConstBit, 1> {};
3084 class StaticBit : public BitField<bool, kStaticBit, 1> {}; 3099 class StaticBit : public BitField<uint8_t, bool, kStaticBit, 1> {};
3085 class FinalBit : public BitField<bool, kFinalBit, 1> {}; 3100 class FinalBit : public BitField<uint8_t, bool, kFinalBit, 1> {};
3086 class HasInitializerBit : public BitField<bool, kHasInitializerBit, 1> {}; 3101 class HasInitializerBit :
3087 class UnboxingCandidateBit : public BitField<bool, 3102 public BitField<uint8_t, bool, kHasInitializerBit, 1> {};
3088 kUnboxingCandidateBit, 1> {}; 3103 class UnboxingCandidateBit :
3089 class ReflectableBit : public BitField<bool, kReflectableBit, 1> {}; 3104 public BitField<uint8_t, bool, kUnboxingCandidateBit, 1> {};
3090 class DoubleInitializedBit : public BitField<bool, 3105 class ReflectableBit : public BitField<uint8_t, bool, kReflectableBit, 1> {};
3091 kDoubleInitializedBit, 1> {}; 3106 class DoubleInitializedBit :
3107 public BitField<uint8_t, bool, kDoubleInitializedBit, 1> {};
3092 3108
3093 // Update guarded cid and guarded length for this field. Returns true, if 3109 // Update guarded cid and guarded length for this field. Returns true, if
3094 // deoptimization of dependent code is required. 3110 // deoptimization of dependent code is required.
3095 bool UpdateGuardedCidAndLength(const Object& value) const; 3111 bool UpdateGuardedCidAndLength(const Object& value) const;
3096 3112
3097 void set_name(const String& value) const; 3113 void set_name(const String& value) const;
3098 void set_is_static(bool is_static) const { 3114 void set_is_static(bool is_static) const {
3099 set_kind_bits(StaticBit::update(is_static, raw_ptr()->kind_bits_)); 3115 set_kind_bits(StaticBit::update(is_static, raw_ptr()->kind_bits_));
3100 } 3116 }
3101 void set_is_final(bool is_final) const { 3117 void set_is_final(bool is_final) const {
3102 set_kind_bits(FinalBit::update(is_final, raw_ptr()->kind_bits_)); 3118 set_kind_bits(FinalBit::update(is_final, raw_ptr()->kind_bits_));
3103 } 3119 }
3104 void set_is_const(bool value) const { 3120 void set_is_const(bool value) const {
3105 set_kind_bits(ConstBit::update(value, raw_ptr()->kind_bits_)); 3121 set_kind_bits(ConstBit::update(value, raw_ptr()->kind_bits_));
3106 } 3122 }
3107 void set_owner(const Object& value) const { 3123 void set_owner(const Object& value) const {
3108 StorePointer(&raw_ptr()->owner_, value.raw()); 3124 StorePointer(&raw_ptr()->owner_, value.raw());
3109 } 3125 }
3110 void set_token_pos(TokenPosition token_pos) const { 3126 void set_token_pos(TokenPosition token_pos) const {
3111 StoreNonPointer(&raw_ptr()->token_pos_, token_pos); 3127 StoreNonPointer(&raw_ptr()->token_pos_, token_pos);
3112 } 3128 }
3113 void set_kind_bits(intptr_t value) const { 3129 void set_kind_bits(uint8_t value) const {
3114 StoreNonPointer(&raw_ptr()->kind_bits_, static_cast<uint8_t>(value)); 3130 StoreNonPointer(&raw_ptr()->kind_bits_, value);
3115 } 3131 }
3116 3132
3117 static RawField* New(); 3133 static RawField* New();
3118 3134
3119 FINAL_HEAP_OBJECT_IMPLEMENTATION(Field, Object); 3135 FINAL_HEAP_OBJECT_IMPLEMENTATION(Field, Object);
3120 friend class Class; 3136 friend class Class;
3121 friend class HeapProfiler; 3137 friend class HeapProfiler;
3122 friend class RawField; 3138 friend class RawField;
3123 }; 3139 };
3124 3140
(...skipping 1388 matching lines...) Expand 10 before | Expand all | Expand 10 after
4513 4529
4514 friend class RawObject; // For RawObject::SizeFromClass(). 4530 friend class RawObject; // For RawObject::SizeFromClass().
4515 friend class RawCode; 4531 friend class RawCode;
4516 enum { 4532 enum {
4517 kOptimizedBit = 0, 4533 kOptimizedBit = 0,
4518 kAliveBit = 1, 4534 kAliveBit = 1,
4519 kPtrOffBit = 2, 4535 kPtrOffBit = 2,
4520 kPtrOffSize = 30, 4536 kPtrOffSize = 30,
4521 }; 4537 };
4522 4538
4523 class OptimizedBit : public BitField<bool, kOptimizedBit, 1> {}; 4539 class OptimizedBit : public BitField<int32_t, bool, kOptimizedBit, 1> {};
4524 class AliveBit : public BitField<bool, kAliveBit, 1> {}; 4540 class AliveBit : public BitField<int32_t, bool, kAliveBit, 1> {};
4525 class PtrOffBits : public BitField<intptr_t, kPtrOffBit, kPtrOffSize> {}; 4541 class PtrOffBits :
4542 public BitField<int32_t, intptr_t, kPtrOffBit, kPtrOffSize> {};
4526 4543
4527 class SlowFindRawCodeVisitor : public FindObjectVisitor { 4544 class SlowFindRawCodeVisitor : public FindObjectVisitor {
4528 public: 4545 public:
4529 explicit SlowFindRawCodeVisitor(uword pc) 4546 explicit SlowFindRawCodeVisitor(uword pc)
4530 : FindObjectVisitor(Isolate::Current()), pc_(pc) { } 4547 : FindObjectVisitor(Isolate::Current()), pc_(pc) { }
4531 virtual ~SlowFindRawCodeVisitor() { } 4548 virtual ~SlowFindRawCodeVisitor() { }
4532 4549
4533 // Check if object matches find condition. 4550 // Check if object matches find condition.
4534 virtual bool FindObject(RawObject* obj) const; 4551 virtual bool FindObject(RawObject* obj) const;
4535 4552
(...skipping 3473 matching lines...) Expand 10 before | Expand all | Expand 10 after
8009 kMultiLine = 4, 8026 kMultiLine = 4,
8010 }; 8027 };
8011 8028
8012 enum { 8029 enum {
8013 kTypePos = 0, 8030 kTypePos = 0,
8014 kTypeSize = 2, 8031 kTypeSize = 2,
8015 kFlagsPos = 2, 8032 kFlagsPos = 2,
8016 kFlagsSize = 4, 8033 kFlagsSize = 4,
8017 }; 8034 };
8018 8035
8019 class TypeBits : public BitField<RegExType, kTypePos, kTypeSize> {}; 8036 class TypeBits : public BitField<int8_t, RegExType, kTypePos, kTypeSize> {};
8020 class FlagsBits : public BitField<intptr_t, kFlagsPos, kFlagsSize> {}; 8037 class FlagsBits : public BitField<int8_t, intptr_t, kFlagsPos, kFlagsSize> {};
8021 8038
8022 bool is_initialized() const { return (type() != kUnitialized); } 8039 bool is_initialized() const { return (type() != kUnitialized); }
8023 bool is_simple() const { return (type() == kSimple); } 8040 bool is_simple() const { return (type() == kSimple); }
8024 bool is_complex() const { return (type() == kComplex); } 8041 bool is_complex() const { return (type() == kComplex); }
8025 8042
8026 bool is_global() const { return (flags() & kGlobal); } 8043 bool is_global() const { return (flags() & kGlobal); }
8027 bool is_ignore_case() const { return (flags() & kIgnoreCase); } 8044 bool is_ignore_case() const { return (flags() & kIgnoreCase); }
8028 bool is_multi_line() const { return (flags() & kMultiLine); } 8045 bool is_multi_line() const { return (flags() & kMultiLine); }
8029 8046
8030 intptr_t num_registers() const { return raw_ptr()->num_registers_; } 8047 intptr_t num_registers() const { return raw_ptr()->num_registers_; }
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after
8381 8398
8382 8399
8383 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, 8400 RawObject* MegamorphicCache::GetTargetFunction(const Array& array,
8384 intptr_t index) { 8401 intptr_t index) {
8385 return array.At((index * kEntryLength) + kTargetFunctionIndex); 8402 return array.At((index * kEntryLength) + kTargetFunctionIndex);
8386 } 8403 }
8387 8404
8388 } // namespace dart 8405 } // namespace dart
8389 8406
8390 #endif // VM_OBJECT_H_ 8407 #endif // VM_OBJECT_H_
OLDNEW
« no previous file with comments | « runtime/vm/native_arguments.h ('k') | runtime/vm/object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698