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

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

Issue 1790593002: Move the VM's typed_data implementation to runtime/lib. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 9 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
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 1419 matching lines...) Expand 10 before | Expand all | Expand 10 after
1430 lib = Library::LookupLibrary(Symbols::DartTypedData()); 1430 lib = Library::LookupLibrary(Symbols::DartTypedData());
1431 if (lib.IsNull()) { 1431 if (lib.IsNull()) {
1432 lib = Library::NewLibraryHelper(Symbols::DartTypedData(), true); 1432 lib = Library::NewLibraryHelper(Symbols::DartTypedData(), true);
1433 lib.SetLoadRequested(); 1433 lib.SetLoadRequested();
1434 lib.Register(); 1434 lib.Register();
1435 object_store->set_bootstrap_library(ObjectStore::kTypedData, lib); 1435 object_store->set_bootstrap_library(ObjectStore::kTypedData, lib);
1436 } 1436 }
1437 ASSERT(!lib.IsNull()); 1437 ASSERT(!lib.IsNull());
1438 ASSERT(lib.raw() == Library::TypedDataLibrary()); 1438 ASSERT(lib.raw() == Library::TypedDataLibrary());
1439 #define REGISTER_TYPED_DATA_CLASS(clazz) \ 1439 #define REGISTER_TYPED_DATA_CLASS(clazz) \
1440 cls = Class::NewTypedDataClass(kTypedData##clazz##Cid); \ 1440 cls = Class::NewTypedDataClass(kTypedData##clazz##ArrayCid); \
1441 RegisterPrivateClass(cls, Symbols::_##clazz(), lib); \ 1441 RegisterClass(cls, Symbols::clazz##List(), lib); \
1442 1442
1443 CLASS_LIST_TYPED_DATA(REGISTER_TYPED_DATA_CLASS); 1443 DART_CLASS_LIST_TYPED_DATA(REGISTER_TYPED_DATA_CLASS);
1444 #undef REGISTER_TYPED_DATA_CLASS 1444 #undef REGISTER_TYPED_DATA_CLASS
1445 #define REGISTER_TYPED_DATA_VIEW_CLASS(clazz) \ 1445 #define REGISTER_TYPED_DATA_VIEW_CLASS(clazz) \
1446 cls = Class::NewTypedDataViewClass(kTypedData##clazz##ViewCid); \ 1446 cls = Class::NewTypedDataViewClass(kTypedData##clazz##ViewCid); \
1447 RegisterPrivateClass(cls, Symbols::_##clazz##View(), lib); \ 1447 RegisterPrivateClass(cls, Symbols::_##clazz##View(), lib); \
1448 pending_classes.Add(cls); \ 1448 pending_classes.Add(cls); \
1449 1449
1450 CLASS_LIST_TYPED_DATA(REGISTER_TYPED_DATA_VIEW_CLASS); 1450 CLASS_LIST_TYPED_DATA(REGISTER_TYPED_DATA_VIEW_CLASS);
1451 cls = Class::NewTypedDataViewClass(kByteDataViewCid); 1451 cls = Class::NewTypedDataViewClass(kByteDataViewCid);
1452 RegisterPrivateClass(cls, Symbols::_ByteDataView(), lib); 1452 RegisterPrivateClass(cls, Symbols::_ByteDataView(), lib);
1453 pending_classes.Add(cls); 1453 pending_classes.Add(cls);
1454 #undef REGISTER_TYPED_DATA_VIEW_CLASS 1454 #undef REGISTER_TYPED_DATA_VIEW_CLASS
1455 #define REGISTER_EXT_TYPED_DATA_CLASS(clazz) \ 1455 #define REGISTER_EXT_TYPED_DATA_CLASS(clazz) \
1456 cls = Class::NewExternalTypedDataClass(kExternalTypedData##clazz##Cid); \ 1456 cls = Class::NewExternalTypedDataClass(kExternalTypedData##clazz##Cid); \
1457 RegisterPrivateClass(cls, Symbols::_External##clazz(), lib); \ 1457 RegisterPrivateClass(cls, Symbols::_External##clazz(), lib); \
1458 1458
1459 cls = Class::New<Instance>(kByteBufferCid); 1459 cls = Class::New<Instance>(kByteBufferCid);
1460 cls.set_instance_size(0); 1460 cls.set_instance_size(0);
1461 cls.set_next_field_offset(-kWordSize); 1461 cls.set_next_field_offset(-kWordSize);
1462 RegisterPrivateClass(cls, Symbols::_ByteBuffer(), lib); 1462 RegisterClass(cls, Symbols::ByteBuffer(), lib);
1463 pending_classes.Add(cls); 1463 pending_classes.Add(cls);
1464 1464
1465 CLASS_LIST_TYPED_DATA(REGISTER_EXT_TYPED_DATA_CLASS); 1465 CLASS_LIST_TYPED_DATA(REGISTER_EXT_TYPED_DATA_CLASS);
1466 #undef REGISTER_EXT_TYPED_DATA_CLASS 1466 #undef REGISTER_EXT_TYPED_DATA_CLASS
1467 // Register Float32x4 and Int32x4 in the object store. 1467 // Register Float32x4 and Int32x4 in the object store.
1468 cls = Class::New<Float32x4>(); 1468 cls = Class::New<Float32x4>();
1469 object_store->set_float32x4_class(cls);
1470 RegisterPrivateClass(cls, Symbols::_Float32x4(), lib);
1471 cls = Class::New<Int32x4>();
1472 object_store->set_int32x4_class(cls);
1473 RegisterPrivateClass(cls, Symbols::_Int32x4(), lib);
1474 cls = Class::New<Float64x2>();
1475 object_store->set_float64x2_class(cls);
1476 RegisterPrivateClass(cls, Symbols::_Float64x2(), lib);
1477
1478 cls = Class::New<Instance>(kIllegalCid);
1479 RegisterClass(cls, Symbols::Float32x4(), lib); 1469 RegisterClass(cls, Symbols::Float32x4(), lib);
1480 cls.set_num_type_arguments(0); 1470 cls.set_num_type_arguments(0);
1481 cls.set_num_own_type_arguments(0); 1471 cls.set_num_own_type_arguments(0);
1482 cls.set_is_prefinalized(); 1472 cls.set_is_prefinalized();
1483 pending_classes.Add(cls); 1473 pending_classes.Add(cls);
1474 object_store->set_float32x4_class(cls);
1484 type = Type::NewNonParameterizedType(cls); 1475 type = Type::NewNonParameterizedType(cls);
1485 object_store->set_float32x4_type(type); 1476 object_store->set_float32x4_type(type);
1486 1477
1487 cls = Class::New<Instance>(kIllegalCid); 1478 cls = Class::New<Int32x4>();
1488 RegisterClass(cls, Symbols::Int32x4(), lib); 1479 RegisterClass(cls, Symbols::Int32x4(), lib);
1489 cls.set_num_type_arguments(0); 1480 cls.set_num_type_arguments(0);
1490 cls.set_num_own_type_arguments(0); 1481 cls.set_num_own_type_arguments(0);
1491 cls.set_is_prefinalized(); 1482 cls.set_is_prefinalized();
1492 pending_classes.Add(cls); 1483 pending_classes.Add(cls);
1484 object_store->set_int32x4_class(cls);
1493 type = Type::NewNonParameterizedType(cls); 1485 type = Type::NewNonParameterizedType(cls);
1494 object_store->set_int32x4_type(type); 1486 object_store->set_int32x4_type(type);
1495 1487
1496 cls = Class::New<Instance>(kIllegalCid); 1488 cls = Class::New<Float64x2>();
1497 RegisterClass(cls, Symbols::Float64x2(), lib); 1489 RegisterClass(cls, Symbols::Float64x2(), lib);
1498 cls.set_num_type_arguments(0); 1490 cls.set_num_type_arguments(0);
1499 cls.set_num_own_type_arguments(0); 1491 cls.set_num_own_type_arguments(0);
1500 cls.set_is_prefinalized(); 1492 cls.set_is_prefinalized();
1501 pending_classes.Add(cls); 1493 pending_classes.Add(cls);
1494 object_store->set_float64x2_class(cls);
1502 type = Type::NewNonParameterizedType(cls); 1495 type = Type::NewNonParameterizedType(cls);
1503 object_store->set_float64x2_type(type); 1496 object_store->set_float64x2_type(type);
1504 1497
1505 // Set the super type of class Stacktrace to Object type so that the 1498 // Set the super type of class Stacktrace to Object type so that the
1506 // 'toString' method is implemented. 1499 // 'toString' method is implemented.
1507 type = object_store->object_type(); 1500 type = object_store->object_type();
1508 stacktrace_cls.set_super_type(type); 1501 stacktrace_cls.set_super_type(type);
1509 1502
1510 // Abstract class that represents the Dart class Function. 1503 // Abstract class that represents the Dart class Function.
1511 cls = Class::New<Instance>(kIllegalCid); 1504 cls = Class::New<Instance>(kIllegalCid);
(...skipping 5532 matching lines...) Expand 10 before | Expand all | Expand 10 after
7044 } 7037 }
7045 7038
7046 7039
7047 bool Function::CheckSourceFingerprint(const char* prefix, int32_t fp) const { 7040 bool Function::CheckSourceFingerprint(const char* prefix, int32_t fp) const {
7048 if (SourceFingerprint() != fp) { 7041 if (SourceFingerprint() != fp) {
7049 const bool recalculatingFingerprints = false; 7042 const bool recalculatingFingerprints = false;
7050 if (recalculatingFingerprints) { 7043 if (recalculatingFingerprints) {
7051 // This output can be copied into a file, then used with sed 7044 // This output can be copied into a file, then used with sed
7052 // to replace the old values. 7045 // to replace the old values.
7053 // sed -i .bak -f /tmp/newkeys runtime/vm/method_recognizer.h 7046 // sed -i .bak -f /tmp/newkeys runtime/vm/method_recognizer.h
7054 // sed -i .bak -f /tmp/newkeys runtime/vm/flow_graph_builder.h
7055 THR_Print("s/V(%s, %d)/V(%s, %d)/\n", 7047 THR_Print("s/V(%s, %d)/V(%s, %d)/\n",
7056 prefix, fp, prefix, SourceFingerprint()); 7048 prefix, fp, prefix, SourceFingerprint());
7057 } else { 7049 } else {
7058 THR_Print("FP mismatch while recognizing method %s:" 7050 THR_Print("FP mismatch while recognizing method %s:"
7059 " expecting %d found %d\n", 7051 " expecting %d found %d\n",
7060 ToFullyQualifiedCString(), 7052 ToFullyQualifiedCString(),
7061 fp, 7053 fp,
7062 SourceFingerprint()); 7054 SourceFingerprint());
7063 return false; 7055 return false;
7064 } 7056 }
(...skipping 14852 matching lines...) Expand 10 before | Expand all | Expand 10 after
21917 return UserTag::null(); 21909 return UserTag::null();
21918 } 21910 }
21919 21911
21920 21912
21921 const char* UserTag::ToCString() const { 21913 const char* UserTag::ToCString() const {
21922 const String& tag_label = String::Handle(label()); 21914 const String& tag_label = String::Handle(label());
21923 return tag_label.ToCString(); 21915 return tag_label.ToCString();
21924 } 21916 }
21925 21917
21926 } // namespace dart 21918 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/method_recognizer.h ('k') | runtime/vm/precompiler.cc » ('j') | runtime/vm/vm.gypi » ('J')

Powered by Google App Engine
This is Rietveld 408576698