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

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

Issue 99573005: Add mutable double boxes for fields. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years 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/intermediate_language_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 2124 matching lines...) Expand 10 before | Expand all | Expand 10 after
2135 void set_guarded_list_length(intptr_t list_length) const; 2135 void set_guarded_list_length(intptr_t list_length) const;
2136 static intptr_t guarded_list_length_offset() { 2136 static intptr_t guarded_list_length_offset() {
2137 return OFFSET_OF(RawField, guarded_list_length_); 2137 return OFFSET_OF(RawField, guarded_list_length_);
2138 } 2138 }
2139 bool needs_length_check() const { 2139 bool needs_length_check() const {
2140 const bool r = guarded_list_length() >= Field::kUnknownFixedLength; 2140 const bool r = guarded_list_length() >= Field::kUnknownFixedLength;
2141 ASSERT(!r || is_final()); 2141 ASSERT(!r || is_final());
2142 return r; 2142 return r;
2143 } 2143 }
2144 2144
2145 bool IsUnboxedField() const {
2146 return is_unboxing_candidate()
2147 && !is_final()
2148 && (guarded_cid() == kDoubleCid && !is_nullable());
2149 }
2150
2151 bool IsPotentialUnboxedField() const {
2152 return is_unboxing_candidate()
2153 && (IsUnboxedField() ||
2154 (!is_final() && (guarded_cid() == kIllegalCid)));
2155 }
2156
2157 bool is_unboxing_candidate() const {
2158 return UnboxingCandidateBit::decode(raw_ptr()->kind_bits_);
2159 }
2160 void set_is_unboxing_candidate(bool b) const {
2161 set_kind_bits(UnboxingCandidateBit::update(b, raw_ptr()->kind_bits_));
2162 }
2163
2145 static bool IsExternalizableCid(intptr_t cid) { 2164 static bool IsExternalizableCid(intptr_t cid) {
2146 return (cid == kOneByteStringCid) || (cid == kTwoByteStringCid); 2165 return (cid == kOneByteStringCid) || (cid == kTwoByteStringCid);
2147 } 2166 }
2148 2167
2149 enum { 2168 enum {
2150 kUnknownFixedLength = -1, 2169 kUnknownFixedLength = -1,
2151 kNoFixedLength = -2, 2170 kNoFixedLength = -2,
2152 }; 2171 };
2153 // Returns false if any value read from this field is guaranteed to be 2172 // Returns false if any value read from this field is guaranteed to be
2154 // not null. 2173 // not null.
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
2199 // instance to be supplied here. 2218 // instance to be supplied here.
2200 virtual void PrintToJSONStreamWithInstance( 2219 virtual void PrintToJSONStreamWithInstance(
2201 JSONStream* stream, const Instance& instance, bool ref) const; 2220 JSONStream* stream, const Instance& instance, bool ref) const;
2202 2221
2203 private: 2222 private:
2204 enum { 2223 enum {
2205 kConstBit = 1, 2224 kConstBit = 1,
2206 kStaticBit, 2225 kStaticBit,
2207 kFinalBit, 2226 kFinalBit,
2208 kHasInitializerBit, 2227 kHasInitializerBit,
2228 kUnboxingCandidateBit
2209 }; 2229 };
2210 class ConstBit : public BitField<bool, kConstBit, 1> {}; 2230 class ConstBit : public BitField<bool, kConstBit, 1> {};
2211 class StaticBit : public BitField<bool, kStaticBit, 1> {}; 2231 class StaticBit : public BitField<bool, kStaticBit, 1> {};
2212 class FinalBit : public BitField<bool, kFinalBit, 1> {}; 2232 class FinalBit : public BitField<bool, kFinalBit, 1> {};
2213 class HasInitializerBit : public BitField<bool, kHasInitializerBit, 1> {}; 2233 class HasInitializerBit : public BitField<bool, kHasInitializerBit, 1> {};
2234 class UnboxingCandidateBit : public BitField<bool,
2235 kUnboxingCandidateBit, 1> {
2236 };
2214 2237
2215 // Update guarded class id and nullability of the field to reflect assignment 2238 // Update guarded class id and nullability of the field to reflect assignment
2216 // of the value with the given class id to this field. Returns true, if 2239 // of the value with the given class id to this field. Returns true, if
2217 // deoptimization of dependent code is required. 2240 // deoptimization of dependent code is required.
2218 bool UpdateCid(intptr_t cid) const; 2241 bool UpdateCid(intptr_t cid) const;
2219 2242
2220 // Update guarded class length of the field to reflect assignment of the 2243 // Update guarded class length of the field to reflect assignment of the
2221 // value with the given length. Returns true if deoptimization of dependent 2244 // value with the given length. Returns true if deoptimization of dependent
2222 // code is required. 2245 // code is required.
2223 bool UpdateLength(intptr_t length) const; 2246 bool UpdateLength(intptr_t length) const;
(...skipping 4299 matching lines...) Expand 10 before | Expand all | Expand 10 after
6523 6546
6524 6547
6525 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, 6548 RawObject* MegamorphicCache::GetTargetFunction(const Array& array,
6526 intptr_t index) { 6549 intptr_t index) {
6527 return array.At((index * kEntryLength) + kTargetFunctionIndex); 6550 return array.At((index * kEntryLength) + kTargetFunctionIndex);
6528 } 6551 }
6529 6552
6530 } // namespace dart 6553 } // namespace dart
6531 6554
6532 #endif // VM_OBJECT_H_ 6555 #endif // VM_OBJECT_H_
OLDNEW
« no previous file with comments | « runtime/vm/intermediate_language_x64.cc ('k') | runtime/vm/object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698