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

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

Issue 22314017: Do not use guarded cid on externalizable cid-s (one and two byte strings). (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 4 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
« no previous file with comments | « runtime/vm/dart_api_impl_test.cc ('k') | no next file » | 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 1943 matching lines...) Expand 10 before | Expand all | Expand 10 after
1954 return HasInitializerBit::decode(raw_ptr()->kind_bits_); 1954 return HasInitializerBit::decode(raw_ptr()->kind_bits_);
1955 } 1955 }
1956 void set_has_initializer(bool has_initializer) const { 1956 void set_has_initializer(bool has_initializer) const {
1957 set_kind_bits(HasInitializerBit::update(has_initializer, 1957 set_kind_bits(HasInitializerBit::update(has_initializer,
1958 raw_ptr()->kind_bits_)); 1958 raw_ptr()->kind_bits_));
1959 } 1959 }
1960 1960
1961 // Return class id that any non-null value read from this field is guaranteed 1961 // Return class id that any non-null value read from this field is guaranteed
1962 // to have or kDynamicCid if such class id is not known. 1962 // to have or kDynamicCid if such class id is not known.
1963 // Stores to this field must update this information hence the name. 1963 // Stores to this field must update this information hence the name.
1964 intptr_t guarded_cid() const { return raw_ptr()->guarded_cid_; } 1964 intptr_t guarded_cid() const {
Vyacheslav Egorov (Google) 2013/08/07 17:56:09 Please add assertion in the place where we infer C
srdjan 2013/08/07 18:27:48 Done.
1965 const intptr_t cid = raw_ptr()->guarded_cid_;
1966 if (IsExternalizableCid(cid)) {
1967 return kDynamicCid;
1968 } else {
1969 return cid;
1970 }
1971 }
1965 void set_guarded_cid(intptr_t cid) const { 1972 void set_guarded_cid(intptr_t cid) const {
1966 raw_ptr()->guarded_cid_ = cid; 1973 raw_ptr()->guarded_cid_ = cid;
1967 } 1974 }
1968 static intptr_t guarded_cid_offset() { 1975 static intptr_t guarded_cid_offset() {
1969 return OFFSET_OF(RawField, guarded_cid_); 1976 return OFFSET_OF(RawField, guarded_cid_);
1970 } 1977 }
1971 1978
1979 static bool IsExternalizableCid(intptr_t cid) {
1980 return (cid == kOneByteStringCid) || (cid == kTwoByteStringCid);
1981 }
1982
1972 // Returns false if any value read from this field is guaranteed to be 1983 // Returns false if any value read from this field is guaranteed to be
1973 // not null. 1984 // not null.
1974 // Internally we is_nullable_ field contains either kNullCid (nullable) or 1985 // Internally we is_nullable_ field contains either kNullCid (nullable) or
1975 // any other value (non-nullable) instead of boolean. This is done to simplify 1986 // any other value (non-nullable) instead of boolean. This is done to simplify
1976 // guarding sequence in the generated code. 1987 // guarding sequence in the generated code.
1977 bool is_nullable() const { 1988 bool is_nullable() const {
1978 return raw_ptr()->is_nullable_ == kNullCid; 1989 return raw_ptr()->is_nullable_ == kNullCid;
1979 } 1990 }
1980 void set_is_nullable(bool val) const { 1991 void set_is_nullable(bool val) const {
1981 raw_ptr()->is_nullable_ = val ? kNullCid : kIllegalCid; 1992 raw_ptr()->is_nullable_ = val ? kNullCid : kIllegalCid;
(...skipping 4057 matching lines...) Expand 10 before | Expand all | Expand 10 after
6039 6050
6040 6051
6041 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, 6052 RawObject* MegamorphicCache::GetTargetFunction(const Array& array,
6042 intptr_t index) { 6053 intptr_t index) {
6043 return array.At((index * kEntryLength) + kTargetFunctionIndex); 6054 return array.At((index * kEntryLength) + kTargetFunctionIndex);
6044 } 6055 }
6045 6056
6046 } // namespace dart 6057 } // namespace dart
6047 6058
6048 #endif // VM_OBJECT_H_ 6059 #endif // VM_OBJECT_H_
OLDNEW
« no previous file with comments | « runtime/vm/dart_api_impl_test.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698