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

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

Issue 25813002: - Rename arrays to lists: (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 2 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
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 #include "vm/object.h" 5 #include "vm/object.h"
6 6
7 #include "include/dart_api.h" 7 #include "include/dart_api.h"
8 #include "platform/assert.h" 8 #include "platform/assert.h"
9 #include "vm/assembler.h" 9 #include "vm/assembler.h"
10 #include "vm/cpu.h" 10 #include "vm/cpu.h"
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 const double MegamorphicCache::kLoadFactor = 0.75; 147 const double MegamorphicCache::kLoadFactor = 0.75;
148 148
149 149
150 // The following functions are marked as invisible, meaning they will be hidden 150 // The following functions are marked as invisible, meaning they will be hidden
151 // in the stack trace and will be hidden from reflective access. 151 // in the stack trace and will be hidden from reflective access.
152 // (Library, class name, method name) 152 // (Library, class name, method name)
153 #define INVISIBLE_LIST(V) \ 153 #define INVISIBLE_LIST(V) \
154 V(CoreLibrary, Object, _noSuchMethod) \ 154 V(CoreLibrary, Object, _noSuchMethod) \
155 V(CoreLibrary, Object, _as) \ 155 V(CoreLibrary, Object, _as) \
156 V(CoreLibrary, Object, _instanceOf) \ 156 V(CoreLibrary, Object, _instanceOf) \
157 V(CoreLibrary, _ObjectArray, _ObjectArray.) \ 157 V(CoreLibrary, _List, _List.) \
srdjan 2013/10/03 00:13:31 Formatting
158 V(CoreLibrary, AssertionError, _throwNew) \ 158 V(CoreLibrary, AssertionError, _throwNew) \
159 V(CoreLibrary, TypeError, _throwNew) \ 159 V(CoreLibrary, TypeError, _throwNew) \
160 V(CoreLibrary, FallThroughError, _throwNew) \ 160 V(CoreLibrary, FallThroughError, _throwNew) \
161 V(CoreLibrary, AbstractClassInstantiationError, _throwNew) \ 161 V(CoreLibrary, AbstractClassInstantiationError, _throwNew) \
162 V(CoreLibrary, int, _throwFormatException) \ 162 V(CoreLibrary, int, _throwFormatException) \
163 V(CoreLibrary, int, _parse) \ 163 V(CoreLibrary, int, _parse) \
164 V(CoreLibrary, StackTrace, _setupFullStackTrace) \ 164 V(CoreLibrary, StackTrace, _setupFullStackTrace) \
165 V(CoreLibrary, _OneByteString, _setAt) \ 165 V(CoreLibrary, _OneByteString, _setAt) \
166 V(TypedDataLibrary, _TypedList, _getInt8) \ 166 V(TypedDataLibrary, _TypedList, _getInt8) \
167 V(TypedDataLibrary, _TypedList, _setInt8) \ 167 V(TypedDataLibrary, _TypedList, _setInt8) \
(...skipping 521 matching lines...) Expand 10 before | Expand all | Expand 10 after
689 SET_CLASS_NAME(megamorphic_cache, MegamorphicCache); 689 SET_CLASS_NAME(megamorphic_cache, MegamorphicCache);
690 SET_CLASS_NAME(subtypetestcache, SubtypeTestCache); 690 SET_CLASS_NAME(subtypetestcache, SubtypeTestCache);
691 SET_CLASS_NAME(api_error, ApiError); 691 SET_CLASS_NAME(api_error, ApiError);
692 SET_CLASS_NAME(language_error, LanguageError); 692 SET_CLASS_NAME(language_error, LanguageError);
693 SET_CLASS_NAME(unhandled_exception, UnhandledException); 693 SET_CLASS_NAME(unhandled_exception, UnhandledException);
694 SET_CLASS_NAME(unwind_error, UnwindError); 694 SET_CLASS_NAME(unwind_error, UnwindError);
695 695
696 // Set up names for object array and one byte string class which are 696 // Set up names for object array and one byte string class which are
697 // pre-allocated in the vm isolate also. 697 // pre-allocated in the vm isolate also.
698 cls = Dart::vm_isolate()->object_store()->array_class(); 698 cls = Dart::vm_isolate()->object_store()->array_class();
699 cls.set_name(Symbols::ObjectArray()); 699 cls.set_name(Symbols::_List());
700 cls = Dart::vm_isolate()->object_store()->one_byte_string_class(); 700 cls = Dart::vm_isolate()->object_store()->one_byte_string_class();
701 cls.set_name(Symbols::OneByteString()); 701 cls.set_name(Symbols::OneByteString());
702 } 702 }
703 703
704 704
705 void Object::CreateInternalMetaData() { 705 void Object::CreateInternalMetaData() {
706 // Initialize meta data for VM internal classes. 706 // Initialize meta data for VM internal classes.
707 Class& cls = Class::Handle(); 707 Class& cls = Class::Handle();
708 Array& fields = Array::Handle(); 708 Array& fields = Array::Handle();
709 Field& fld = Field::Handle(); 709 Field& fld = Field::Handle();
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
869 object_store->set_pending_classes(pending_classes); 869 object_store->set_pending_classes(pending_classes);
870 870
871 Context& context = Context::Handle(Context::New(0, Heap::kOld)); 871 Context& context = Context::Handle(Context::New(0, Heap::kOld));
872 object_store->set_empty_context(context); 872 object_store->set_empty_context(context);
873 873
874 // Now that the symbol table is initialized and that the core dictionary as 874 // Now that the symbol table is initialized and that the core dictionary as
875 // well as the core implementation dictionary have been setup, preallocate 875 // well as the core implementation dictionary have been setup, preallocate
876 // remaining classes and register them by name in the dictionaries. 876 // remaining classes and register them by name in the dictionaries.
877 String& name = String::Handle(); 877 String& name = String::Handle();
878 cls = object_store->array_class(); // Was allocated above. 878 cls = object_store->array_class(); // Was allocated above.
879 RegisterPrivateClass(cls, Symbols::ObjectArray(), core_lib); 879 RegisterPrivateClass(cls, Symbols::_List(), core_lib);
880 pending_classes.Add(cls); 880 pending_classes.Add(cls);
881 // We cannot use NewNonParameterizedType(cls), because Array is parameterized. 881 // We cannot use NewNonParameterizedType(cls), because Array is parameterized.
882 type ^= Type::New(Object::Handle(cls.raw()), 882 type ^= Type::New(Object::Handle(cls.raw()),
883 TypeArguments::Handle(), 883 TypeArguments::Handle(),
884 Scanner::kDummyTokenIndex); 884 Scanner::kDummyTokenIndex);
885 type.SetIsFinalized(); 885 type.SetIsFinalized();
886 type ^= type.Canonicalize(); 886 type ^= type.Canonicalize();
887 object_store->set_array_type(type); 887 object_store->set_array_type(type);
888 888
889 cls = object_store->growable_object_array_class(); // Was allocated above. 889 cls = object_store->growable_object_array_class(); // Was allocated above.
890 RegisterPrivateClass(cls, Symbols::GrowableObjectArray(), core_lib); 890 RegisterPrivateClass(cls, Symbols::_GrowableList(), core_lib);
891 pending_classes.Add(cls); 891 pending_classes.Add(cls);
892 892
893 cls = Class::New<Array>(kImmutableArrayCid); 893 cls = Class::New<Array>(kImmutableArrayCid);
894 object_store->set_immutable_array_class(cls); 894 object_store->set_immutable_array_class(cls);
895 cls.set_type_arguments_field_offset(Array::type_arguments_offset()); 895 cls.set_type_arguments_field_offset(Array::type_arguments_offset());
896 ASSERT(object_store->immutable_array_class() != object_store->array_class()); 896 ASSERT(object_store->immutable_array_class() != object_store->array_class());
897 cls.set_is_prefinalized(); 897 cls.set_is_prefinalized();
898 RegisterPrivateClass(cls, Symbols::ImmutableArray(), core_lib); 898 RegisterPrivateClass(cls, Symbols::_ImmutableList(), core_lib);
899 pending_classes.Add(cls); 899 pending_classes.Add(cls);
900 900
901 cls = object_store->one_byte_string_class(); // Was allocated above. 901 cls = object_store->one_byte_string_class(); // Was allocated above.
902 RegisterPrivateClass(cls, Symbols::OneByteString(), core_lib); 902 RegisterPrivateClass(cls, Symbols::OneByteString(), core_lib);
903 pending_classes.Add(cls); 903 pending_classes.Add(cls);
904 904
905 cls = object_store->two_byte_string_class(); // Was allocated above. 905 cls = object_store->two_byte_string_class(); // Was allocated above.
906 RegisterPrivateClass(cls, Symbols::TwoByteString(), core_lib); 906 RegisterPrivateClass(cls, Symbols::TwoByteString(), core_lib);
907 pending_classes.Add(cls); 907 pending_classes.Add(cls);
908 908
(...skipping 13404 matching lines...) Expand 10 before | Expand all | Expand 10 after
14313 void Array::MakeImmutable() const { 14313 void Array::MakeImmutable() const {
14314 NoGCScope no_gc; 14314 NoGCScope no_gc;
14315 uword tags = raw_ptr()->tags_; 14315 uword tags = raw_ptr()->tags_;
14316 tags = RawObject::ClassIdTag::update(kImmutableArrayCid, tags); 14316 tags = RawObject::ClassIdTag::update(kImmutableArrayCid, tags);
14317 raw_ptr()->tags_ = tags; 14317 raw_ptr()->tags_ = tags;
14318 } 14318 }
14319 14319
14320 14320
14321 const char* Array::ToCString() const { 14321 const char* Array::ToCString() const {
14322 if (IsNull()) { 14322 if (IsNull()) {
14323 return IsImmutable() ? "ImmutableArray NULL" : "Array NULL"; 14323 return IsImmutable() ? "_ImmutableList NULL" : "_List NULL";
14324 } 14324 }
14325 const char* format = !IsImmutable() ? "Array len:%" Pd "" : 14325 const char* format = IsImmutable() ?
14326 "Immutable Array len:%" Pd ""; 14326 "_ImmutableList len:%" Pd : "_List len:%" Pd;
14327 intptr_t len = OS::SNPrint(NULL, 0, format, Length()) + 1; 14327 intptr_t len = OS::SNPrint(NULL, 0, format, Length()) + 1;
14328 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); 14328 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len);
14329 OS::SNPrint(chars, len, format, Length()); 14329 OS::SNPrint(chars, len, format, Length());
14330 return chars; 14330 return chars;
14331 } 14331 }
14332 14332
14333 14333
14334 void Array::PrintToJSONStream(JSONStream* stream, bool ref) const { 14334 void Array::PrintToJSONStream(JSONStream* stream, bool ref) const {
14335 JSONObject jsobj(stream); 14335 JSONObject jsobj(stream);
14336 } 14336 }
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
14524 result ^= raw; 14524 result ^= raw;
14525 result.SetLength(0); 14525 result.SetLength(0);
14526 result.SetData(array); 14526 result.SetData(array);
14527 } 14527 }
14528 return result.raw(); 14528 return result.raw();
14529 } 14529 }
14530 14530
14531 14531
14532 const char* GrowableObjectArray::ToCString() const { 14532 const char* GrowableObjectArray::ToCString() const {
14533 if (IsNull()) { 14533 if (IsNull()) {
14534 return "GrowableObjectArray NULL"; 14534 return "_GrowableList NULL";
14535 } 14535 }
14536 const char* format = "GrowableObjectArray len:%" Pd ""; 14536 const char* format = "_GrowableList len:%" Pd "";
14537 intptr_t len = OS::SNPrint(NULL, 0, format, Length()) + 1; 14537 intptr_t len = OS::SNPrint(NULL, 0, format, Length()) + 1;
14538 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); 14538 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len);
14539 OS::SNPrint(chars, len, format, Length()); 14539 OS::SNPrint(chars, len, format, Length());
14540 return chars; 14540 return chars;
14541 } 14541 }
14542 14542
14543 14543
14544 void GrowableObjectArray::PrintToJSONStream(JSONStream* stream, 14544 void GrowableObjectArray::PrintToJSONStream(JSONStream* stream,
14545 bool ref) const { 14545 bool ref) const {
14546 JSONObject jsobj(stream); 14546 JSONObject jsobj(stream);
(...skipping 769 matching lines...) Expand 10 before | Expand all | Expand 10 after
15316 return "_MirrorReference"; 15316 return "_MirrorReference";
15317 } 15317 }
15318 15318
15319 15319
15320 void MirrorReference::PrintToJSONStream(JSONStream* stream, bool ref) const { 15320 void MirrorReference::PrintToJSONStream(JSONStream* stream, bool ref) const {
15321 JSONObject jsobj(stream); 15321 JSONObject jsobj(stream);
15322 } 15322 }
15323 15323
15324 15324
15325 } // namespace dart 15325 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/intrinsifier_x64.cc ('k') | runtime/vm/symbols.h » ('j') | runtime/vm/symbols.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698