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

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

Issue 2571563005: Turn the VM's dart:typed_data into a patch (Closed)
Patch Set: Fix interface/implementation type mismatch Created 4 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
« no previous file with comments | « runtime/vm/method_recognizer.h ('k') | runtime/vm/precompiler.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 #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/become.h" 10 #include "vm/become.h"
(...skipping 1492 matching lines...) Expand 10 before | Expand all | Expand 10 after
1503 if (lib.IsNull()) { 1503 if (lib.IsNull()) {
1504 lib = Library::NewLibraryHelper(Symbols::DartTypedData(), true); 1504 lib = Library::NewLibraryHelper(Symbols::DartTypedData(), true);
1505 lib.SetLoadRequested(); 1505 lib.SetLoadRequested();
1506 lib.Register(thread); 1506 lib.Register(thread);
1507 } 1507 }
1508 object_store->set_bootstrap_library(ObjectStore::kTypedData, lib); 1508 object_store->set_bootstrap_library(ObjectStore::kTypedData, lib);
1509 ASSERT(!lib.IsNull()); 1509 ASSERT(!lib.IsNull());
1510 ASSERT(lib.raw() == Library::TypedDataLibrary()); 1510 ASSERT(lib.raw() == Library::TypedDataLibrary());
1511 #define REGISTER_TYPED_DATA_CLASS(clazz) \ 1511 #define REGISTER_TYPED_DATA_CLASS(clazz) \
1512 cls = Class::NewTypedDataClass(kTypedData##clazz##ArrayCid); \ 1512 cls = Class::NewTypedDataClass(kTypedData##clazz##ArrayCid); \
1513 RegisterClass(cls, Symbols::clazz##List(), lib); 1513 RegisterPrivateClass(cls, Symbols::clazz##List(), lib);
1514 1514
1515 DART_CLASS_LIST_TYPED_DATA(REGISTER_TYPED_DATA_CLASS); 1515 DART_CLASS_LIST_TYPED_DATA(REGISTER_TYPED_DATA_CLASS);
1516 #undef REGISTER_TYPED_DATA_CLASS 1516 #undef REGISTER_TYPED_DATA_CLASS
1517 #define REGISTER_TYPED_DATA_VIEW_CLASS(clazz) \ 1517 #define REGISTER_TYPED_DATA_VIEW_CLASS(clazz) \
1518 cls = Class::NewTypedDataViewClass(kTypedData##clazz##ViewCid); \ 1518 cls = Class::NewTypedDataViewClass(kTypedData##clazz##ViewCid); \
1519 RegisterPrivateClass(cls, Symbols::_##clazz##View(), lib); \ 1519 RegisterPrivateClass(cls, Symbols::_##clazz##View(), lib); \
1520 pending_classes.Add(cls); 1520 pending_classes.Add(cls);
1521 1521
1522 CLASS_LIST_TYPED_DATA(REGISTER_TYPED_DATA_VIEW_CLASS); 1522 CLASS_LIST_TYPED_DATA(REGISTER_TYPED_DATA_VIEW_CLASS);
1523 cls = Class::NewTypedDataViewClass(kByteDataViewCid); 1523 cls = Class::NewTypedDataViewClass(kByteDataViewCid);
1524 RegisterPrivateClass(cls, Symbols::_ByteDataView(), lib); 1524 RegisterPrivateClass(cls, Symbols::_ByteDataView(), lib);
1525 pending_classes.Add(cls); 1525 pending_classes.Add(cls);
1526 #undef REGISTER_TYPED_DATA_VIEW_CLASS 1526 #undef REGISTER_TYPED_DATA_VIEW_CLASS
1527 #define REGISTER_EXT_TYPED_DATA_CLASS(clazz) \ 1527 #define REGISTER_EXT_TYPED_DATA_CLASS(clazz) \
1528 cls = Class::NewExternalTypedDataClass(kExternalTypedData##clazz##Cid); \ 1528 cls = Class::NewExternalTypedDataClass(kExternalTypedData##clazz##Cid); \
1529 RegisterPrivateClass(cls, Symbols::_External##clazz(), lib); 1529 RegisterPrivateClass(cls, Symbols::_External##clazz(), lib);
1530 1530
1531 cls = Class::New<Instance>(kByteBufferCid); 1531 cls = Class::New<Instance>(kByteBufferCid);
1532 cls.set_instance_size(0); 1532 cls.set_instance_size(0);
1533 cls.set_next_field_offset(-kWordSize); 1533 cls.set_next_field_offset(-kWordSize);
1534 RegisterClass(cls, Symbols::ByteBuffer(), lib); 1534 RegisterPrivateClass(cls, Symbols::_ByteBuffer(), lib);
1535 pending_classes.Add(cls); 1535 pending_classes.Add(cls);
1536 1536
1537 CLASS_LIST_TYPED_DATA(REGISTER_EXT_TYPED_DATA_CLASS); 1537 CLASS_LIST_TYPED_DATA(REGISTER_EXT_TYPED_DATA_CLASS);
1538 #undef REGISTER_EXT_TYPED_DATA_CLASS 1538 #undef REGISTER_EXT_TYPED_DATA_CLASS
1539 // Register Float32x4 and Int32x4 in the object store. 1539 // Register Float32x4, Int32x4, and Float64x2 in the object store.
1540 cls = Class::New<Float32x4>(); 1540 cls = Class::New<Float32x4>();
1541 RegisterPrivateClass(cls, Symbols::_Float32x4(), lib);
1542 pending_classes.Add(cls);
1543 object_store->set_float32x4_class(cls);
1544
1545 cls = Class::New<Instance>(kIllegalCid);
1541 RegisterClass(cls, Symbols::Float32x4(), lib); 1546 RegisterClass(cls, Symbols::Float32x4(), lib);
1542 cls.set_num_type_arguments(0); 1547 cls.set_num_type_arguments(0);
1543 cls.set_num_own_type_arguments(0); 1548 cls.set_num_own_type_arguments(0);
1544 cls.set_is_prefinalized(); 1549 cls.set_is_prefinalized();
1545 pending_classes.Add(cls);
1546 object_store->set_float32x4_class(cls);
1547 type = Type::NewNonParameterizedType(cls); 1550 type = Type::NewNonParameterizedType(cls);
1548 object_store->set_float32x4_type(type); 1551 object_store->set_float32x4_type(type);
1549 1552
1550 cls = Class::New<Int32x4>(); 1553 cls = Class::New<Int32x4>();
1554 RegisterPrivateClass(cls, Symbols::_Int32x4(), lib);
1555 pending_classes.Add(cls);
1556 object_store->set_int32x4_class(cls);
1557
1558 cls = Class::New<Instance>(kIllegalCid);
1551 RegisterClass(cls, Symbols::Int32x4(), lib); 1559 RegisterClass(cls, Symbols::Int32x4(), lib);
1552 cls.set_num_type_arguments(0); 1560 cls.set_num_type_arguments(0);
1553 cls.set_num_own_type_arguments(0); 1561 cls.set_num_own_type_arguments(0);
1554 cls.set_is_prefinalized(); 1562 cls.set_is_prefinalized();
1555 pending_classes.Add(cls);
1556 object_store->set_int32x4_class(cls);
1557 type = Type::NewNonParameterizedType(cls); 1563 type = Type::NewNonParameterizedType(cls);
1558 object_store->set_int32x4_type(type); 1564 object_store->set_int32x4_type(type);
1559 1565
1560 cls = Class::New<Float64x2>(); 1566 cls = Class::New<Float64x2>();
1567 RegisterPrivateClass(cls, Symbols::_Float64x2(), lib);
1568 pending_classes.Add(cls);
1569 object_store->set_float64x2_class(cls);
1570
1571 cls = Class::New<Instance>(kIllegalCid);
1561 RegisterClass(cls, Symbols::Float64x2(), lib); 1572 RegisterClass(cls, Symbols::Float64x2(), lib);
1562 cls.set_num_type_arguments(0); 1573 cls.set_num_type_arguments(0);
1563 cls.set_num_own_type_arguments(0); 1574 cls.set_num_own_type_arguments(0);
1564 cls.set_is_prefinalized(); 1575 cls.set_is_prefinalized();
1565 pending_classes.Add(cls);
1566 object_store->set_float64x2_class(cls);
1567 type = Type::NewNonParameterizedType(cls); 1576 type = Type::NewNonParameterizedType(cls);
1568 object_store->set_float64x2_type(type); 1577 object_store->set_float64x2_type(type);
1569 1578
1570 // Set the super type of class StackTrace to Object type so that the 1579 // Set the super type of class StackTrace to Object type so that the
1571 // 'toString' method is implemented. 1580 // 'toString' method is implemented.
1572 type = object_store->object_type(); 1581 type = object_store->object_type();
1573 stacktrace_cls.set_super_type(type); 1582 stacktrace_cls.set_super_type(type);
1574 1583
1575 // Abstract class that represents the Dart class Function. 1584 // Abstract class that represents the Dart class Function.
1576 cls = Class::New<Instance>(kIllegalCid); 1585 cls = Class::New<Instance>(kIllegalCid);
(...skipping 9991 matching lines...) Expand 10 before | Expand all | Expand 10 after
11568 MATH_LIB_INTRINSIC_LIST(CHECK_FINGERPRINTS2); 11577 MATH_LIB_INTRINSIC_LIST(CHECK_FINGERPRINTS2);
11569 11578
11570 all_libs.Clear(); 11579 all_libs.Clear();
11571 all_libs.Add(&Library::ZoneHandle(Library::TypedDataLibrary())); 11580 all_libs.Add(&Library::ZoneHandle(Library::TypedDataLibrary()));
11572 TYPED_DATA_LIB_INTRINSIC_LIST(CHECK_FINGERPRINTS2); 11581 TYPED_DATA_LIB_INTRINSIC_LIST(CHECK_FINGERPRINTS2);
11573 11582
11574 #undef CHECK_FINGERPRINTS 11583 #undef CHECK_FINGERPRINTS
11575 #undef CHECK_FINGERPRINTS2 11584 #undef CHECK_FINGERPRINTS2
11576 11585
11577 11586
11578 Class& cls = Class::Handle(); 11587 #define CHECK_FACTORY_FINGERPRINTS(symbol, class_name, factory_name, cid, fp) \
11579 11588 func = GetFunction(all_libs, #class_name, #factory_name); \
11580 #define CHECK_FACTORY_FINGERPRINTS(factory_symbol, cid, fp) \
11581 cls = Isolate::Current()->class_table()->At(cid); \
11582 func = cls.LookupFunctionAllowPrivate(Symbols::factory_symbol()); \
11583 if (func.IsNull()) { \ 11589 if (func.IsNull()) { \
11584 has_errors = true; \ 11590 has_errors = true; \
11585 OS::Print("Function not found %s.%s\n", cls.ToCString(), \ 11591 OS::Print("Function not found %s.%s\n", #class_name, #factory_name); \
11586 Symbols::factory_symbol().ToCString()); \
11587 } else { \ 11592 } else { \
11588 CHECK_FINGERPRINT2(func, factory_symbol, cid, fp); \ 11593 CHECK_FINGERPRINT2(func, symbol, cid, fp); \
11589 } 11594 }
11590 11595
11596 all_libs.Add(&Library::ZoneHandle(Library::CoreLibrary()));
11591 RECOGNIZED_LIST_FACTORY_LIST(CHECK_FACTORY_FINGERPRINTS); 11597 RECOGNIZED_LIST_FACTORY_LIST(CHECK_FACTORY_FINGERPRINTS);
11592 11598
11593 #undef CHECK_FACTORY_FINGERPRINTS 11599 #undef CHECK_FACTORY_FINGERPRINTS
11594 11600
11595 if (has_errors) { 11601 if (has_errors) {
11596 FATAL("Fingerprint mismatch."); 11602 FATAL("Fingerprint mismatch.");
11597 } 11603 }
11598 } 11604 }
11599 #endif // defined(DART_NO_SNAPSHOT) && !defined(PRODUCT). 11605 #endif // defined(DART_NO_SNAPSHOT) && !defined(PRODUCT).
11600 11606
(...skipping 11271 matching lines...) Expand 10 before | Expand all | Expand 10 after
22872 return UserTag::null(); 22878 return UserTag::null();
22873 } 22879 }
22874 22880
22875 22881
22876 const char* UserTag::ToCString() const { 22882 const char* UserTag::ToCString() const {
22877 const String& tag_label = String::Handle(label()); 22883 const String& tag_label = String::Handle(label());
22878 return tag_label.ToCString(); 22884 return tag_label.ToCString();
22879 } 22885 }
22880 22886
22881 } // namespace dart 22887 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/method_recognizer.h ('k') | runtime/vm/precompiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698