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

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

Issue 11299020: Make creation of list literal more resilient to changes in the underlying (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 1 month 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
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 3204 matching lines...) Expand 10 before | Expand all | Expand 10 after
3215 3215
3216 // Check if this type represents the 'num' type. 3216 // Check if this type represents the 'num' type.
3217 bool IsNumberType() const; 3217 bool IsNumberType() const;
3218 3218
3219 // Check if this type represents the 'String' type. 3219 // Check if this type represents the 'String' type.
3220 bool IsStringType() const; 3220 bool IsStringType() const;
3221 3221
3222 // Check if this type represents the 'Function' type. 3222 // Check if this type represents the 'Function' type.
3223 bool IsFunctionType() const; 3223 bool IsFunctionType() const;
3224 3224
3225 // Check if this type represents the 'List' interface.
3226 bool IsListInterface() const;
3227
3228 // Check if this type is an interface type. 3225 // Check if this type is an interface type.
3229 bool IsInterfaceType() const { 3226 bool IsInterfaceType() const {
3230 if (!HasResolvedTypeClass()) { 3227 if (!HasResolvedTypeClass()) {
3231 return false; 3228 return false;
3232 } 3229 }
3233 const Class& cls = Class::Handle(type_class()); 3230 const Class& cls = Class::Handle(type_class());
3234 return !cls.IsNull() && cls.is_interface(); 3231 return !cls.IsNull() && cls.is_interface();
3235 } 3232 }
3236 3233
3237 // Check the subtype relationship. 3234 // Check the subtype relationship.
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
3336 3333
3337 // The 'double' type. 3334 // The 'double' type.
3338 static RawType* Double(); 3335 static RawType* Double();
3339 3336
3340 // The 'num' interface type. 3337 // The 'num' interface type.
3341 static RawType* Number(); 3338 static RawType* Number();
3342 3339
3343 // The 'String' type. 3340 // The 'String' type.
3344 static RawType* StringType(); 3341 static RawType* StringType();
3345 3342
3343 // The 'Array' type.
3344 static RawType* ArrayType();
3345
3346 // The 'Function' interface type. 3346 // The 'Function' interface type.
3347 static RawType* Function(); 3347 static RawType* Function();
3348 3348
3349 // The 'List' interface type.
3350 static RawType* ListInterface();
3351
3352 // The finalized type of the given non-parameterized class. 3349 // The finalized type of the given non-parameterized class.
3353 static RawType* NewNonParameterizedType(const Class& type_class); 3350 static RawType* NewNonParameterizedType(const Class& type_class);
3354 3351
3355 static RawType* New(const Object& clazz, 3352 static RawType* New(const Object& clazz,
3356 const AbstractTypeArguments& arguments, 3353 const AbstractTypeArguments& arguments,
3357 intptr_t token_pos, 3354 intptr_t token_pos,
3358 Heap::Space space = Heap::kOld); 3355 Heap::Space space = Heap::kOld);
3359 3356
3360 private: 3357 private:
3361 void set_token_pos(intptr_t token_pos) const; 3358 void set_token_pos(intptr_t token_pos) const;
(...skipping 888 matching lines...) Expand 10 before | Expand all | Expand 10 after
4250 } 4247 }
4251 void SetAt(intptr_t index, const Object& value) const { 4248 void SetAt(intptr_t index, const Object& value) const {
4252 // TODO(iposva): Add storing NoGCScope. 4249 // TODO(iposva): Add storing NoGCScope.
4253 StorePointer(ObjectAddr(index), value.raw()); 4250 StorePointer(ObjectAddr(index), value.raw());
4254 } 4251 }
4255 4252
4256 virtual RawAbstractTypeArguments* GetTypeArguments() const { 4253 virtual RawAbstractTypeArguments* GetTypeArguments() const {
4257 return raw_ptr()->type_arguments_; 4254 return raw_ptr()->type_arguments_;
4258 } 4255 }
4259 virtual void SetTypeArguments(const AbstractTypeArguments& value) const { 4256 virtual void SetTypeArguments(const AbstractTypeArguments& value) const {
4257 ASSERT(value.IsNull() || ((value.Length() == 1) && value.IsInstantiated()));
4260 StorePointer(&raw_ptr()->type_arguments_, value.raw()); 4258 StorePointer(&raw_ptr()->type_arguments_, value.raw());
4261 } 4259 }
4262 4260
4263 virtual bool Equals(const Instance& other) const; 4261 virtual bool Equals(const Instance& other) const;
4264 4262
4265 static const intptr_t kBytesPerElement = kWordSize; 4263 static const intptr_t kBytesPerElement = kWordSize;
4266 static const intptr_t kMaxElements = kSmiMax / kBytesPerElement; 4264 static const intptr_t kMaxElements = kSmiMax / kBytesPerElement;
4267 4265
4268 static intptr_t type_arguments_offset() { 4266 static intptr_t type_arguments_offset() {
4269 return OFFSET_OF(RawArray, type_arguments_); 4267 return OFFSET_OF(RawArray, type_arguments_);
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
4377 void Grow(intptr_t new_capacity, Heap::Space space = Heap::kNew) const; 4375 void Grow(intptr_t new_capacity, Heap::Space space = Heap::kNew) const;
4378 RawObject* RemoveLast() const; 4376 RawObject* RemoveLast() const;
4379 4377
4380 virtual RawAbstractTypeArguments* GetTypeArguments() const { 4378 virtual RawAbstractTypeArguments* GetTypeArguments() const {
4381 ASSERT(AbstractTypeArguments::AreEqual( 4379 ASSERT(AbstractTypeArguments::AreEqual(
4382 AbstractTypeArguments::Handle(Array::Handle(data()).GetTypeArguments()), 4380 AbstractTypeArguments::Handle(Array::Handle(data()).GetTypeArguments()),
4383 AbstractTypeArguments::Handle(raw_ptr()->type_arguments_))); 4381 AbstractTypeArguments::Handle(raw_ptr()->type_arguments_)));
4384 return raw_ptr()->type_arguments_; 4382 return raw_ptr()->type_arguments_;
4385 } 4383 }
4386 virtual void SetTypeArguments(const AbstractTypeArguments& value) const { 4384 virtual void SetTypeArguments(const AbstractTypeArguments& value) const {
4385 ASSERT(value.IsNull() || ((value.Length() == 1) && value.IsInstantiated()));
4387 const Array& contents = Array::Handle(data()); 4386 const Array& contents = Array::Handle(data());
4388 contents.SetTypeArguments(value); 4387 contents.SetTypeArguments(value);
4389 StorePointer(&raw_ptr()->type_arguments_, value.raw()); 4388 StorePointer(&raw_ptr()->type_arguments_, value.raw());
4390 } 4389 }
4391 4390
4392 virtual bool Equals(const Instance& other) const; 4391 virtual bool Equals(const Instance& other) const;
4393 4392
4394 static intptr_t type_arguments_offset() { 4393 static intptr_t type_arguments_offset() {
4395 return OFFSET_OF(RawGrowableObjectArray, type_arguments_); 4394 return OFFSET_OF(RawGrowableObjectArray, type_arguments_);
4396 } 4395 }
(...skipping 1525 matching lines...) Expand 10 before | Expand all | Expand 10 after
5922 if (this->CharAt(i) != str.CharAt(begin_index + i)) { 5921 if (this->CharAt(i) != str.CharAt(begin_index + i)) {
5923 return false; 5922 return false;
5924 } 5923 }
5925 } 5924 }
5926 return true; 5925 return true;
5927 } 5926 }
5928 5927
5929 } // namespace dart 5928 } // namespace dart
5930 5929
5931 #endif // VM_OBJECT_H_ 5930 #endif // VM_OBJECT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698