OLD | NEW |
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/native_entry.h" | 5 #include "vm/native_entry.h" |
6 #include "vm/object.h" | 6 #include "vm/object.h" |
7 #include "vm/object_store.h" | 7 #include "vm/object_store.h" |
8 #include "vm/snapshot.h" | 8 #include "vm/snapshot.h" |
9 #include "vm/stub_code.h" | 9 #include "vm/stub_code.h" |
10 #include "vm/symbols.h" | 10 #include "vm/symbols.h" |
(...skipping 1522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1533 reader->ReadObjectImpl(kAsReference); | 1533 reader->ReadObjectImpl(kAsReference); |
1534 result->SetObjectAt(i, *(reader->PassiveObjectHandle())); | 1534 result->SetObjectAt(i, *(reader->PassiveObjectHandle())); |
1535 break; | 1535 break; |
1536 } | 1536 } |
1537 case ObjectPool::kImmediate: { | 1537 case ObjectPool::kImmediate: { |
1538 intptr_t raw_value = reader->Read<intptr_t>(); | 1538 intptr_t raw_value = reader->Read<intptr_t>(); |
1539 result->SetRawValueAt(i, raw_value); | 1539 result->SetRawValueAt(i, raw_value); |
1540 break; | 1540 break; |
1541 } | 1541 } |
1542 case ObjectPool::kNativeEntry: { | 1542 case ObjectPool::kNativeEntry: { |
| 1543 #if !defined(TARGET_ARCH_DBC) |
1543 // Read nothing. Initialize with the lazy link entry. | 1544 // Read nothing. Initialize with the lazy link entry. |
1544 uword new_entry = NativeEntry::LinkNativeCallEntry(); | 1545 uword new_entry = NativeEntry::LinkNativeCallEntry(); |
1545 result->SetRawValueAt(i, static_cast<intptr_t>(new_entry)); | 1546 result->SetRawValueAt(i, static_cast<intptr_t>(new_entry)); |
| 1547 #else |
| 1548 UNREACHABLE(); // DBC does not support lazy native call linking. |
| 1549 #endif |
1546 break; | 1550 break; |
1547 } | 1551 } |
1548 default: | 1552 default: |
1549 UNREACHABLE(); | 1553 UNREACHABLE(); |
1550 } | 1554 } |
1551 } | 1555 } |
1552 } | 1556 } |
1553 return result->raw(); | 1557 return result->raw(); |
1554 } | 1558 } |
1555 | 1559 |
(...skipping 29 matching lines...) Expand all Loading... |
1585 ASSERT(info_array != TypedData::null()); | 1589 ASSERT(info_array != TypedData::null()); |
1586 | 1590 |
1587 writer->Write<intptr_t>(length); | 1591 writer->Write<intptr_t>(length); |
1588 for (intptr_t i = 0; i < length; i++) { | 1592 for (intptr_t i = 0; i < length; i++) { |
1589 ObjectPool::EntryType entry_type = | 1593 ObjectPool::EntryType entry_type = |
1590 static_cast<ObjectPool::EntryType>(info_array->data()[i]); | 1594 static_cast<ObjectPool::EntryType>(info_array->data()[i]); |
1591 writer->Write<int8_t>(entry_type); | 1595 writer->Write<int8_t>(entry_type); |
1592 Entry& entry = ptr()->data()[i]; | 1596 Entry& entry = ptr()->data()[i]; |
1593 switch (entry_type) { | 1597 switch (entry_type) { |
1594 case ObjectPool::kTaggedObject: { | 1598 case ObjectPool::kTaggedObject: { |
| 1599 #if !defined(TARGET_ARCH_DBC) |
1595 if (entry.raw_obj_ == StubCode::CallNativeCFunction_entry()->code()) { | 1600 if (entry.raw_obj_ == StubCode::CallNativeCFunction_entry()->code()) { |
1596 // Natives can run while precompiling, becoming linked and switching | 1601 // Natives can run while precompiling, becoming linked and switching |
1597 // their stub. Reset to the initial stub used for lazy-linking. | 1602 // their stub. Reset to the initial stub used for lazy-linking. |
1598 writer->WriteObjectImpl( | 1603 writer->WriteObjectImpl( |
1599 StubCode::CallBootstrapCFunction_entry()->code(), kAsReference); | 1604 StubCode::CallBootstrapCFunction_entry()->code(), kAsReference); |
1600 } else { | 1605 break; |
1601 writer->WriteObjectImpl(entry.raw_obj_, kAsReference); | |
1602 } | 1606 } |
| 1607 #endif |
| 1608 writer->WriteObjectImpl(entry.raw_obj_, kAsReference); |
1603 break; | 1609 break; |
1604 } | 1610 } |
1605 case ObjectPool::kImmediate: { | 1611 case ObjectPool::kImmediate: { |
1606 writer->Write<intptr_t>(entry.raw_value_); | 1612 writer->Write<intptr_t>(entry.raw_value_); |
1607 break; | 1613 break; |
1608 } | 1614 } |
1609 case ObjectPool::kNativeEntry: { | 1615 case ObjectPool::kNativeEntry: { |
1610 // Write nothing. Will initialize with the lazy link entry. | 1616 // Write nothing. Will initialize with the lazy link entry. |
| 1617 #if defined(TARGET_ARCH_DBC) |
| 1618 UNREACHABLE(); // DBC does not support lazy native call linking. |
| 1619 #endif |
1611 break; | 1620 break; |
1612 } | 1621 } |
1613 default: | 1622 default: |
1614 UNREACHABLE(); | 1623 UNREACHABLE(); |
1615 } | 1624 } |
1616 } | 1625 } |
1617 } | 1626 } |
1618 } | 1627 } |
1619 | 1628 |
1620 | 1629 |
(...skipping 2079 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3700 // We do not allow objects with native fields in an isolate message. | 3709 // We do not allow objects with native fields in an isolate message. |
3701 writer->SetWriteException(Exceptions::kArgument, | 3710 writer->SetWriteException(Exceptions::kArgument, |
3702 "Illegal argument in isolate message" | 3711 "Illegal argument in isolate message" |
3703 " : (object is a UserTag)"); | 3712 " : (object is a UserTag)"); |
3704 } else { | 3713 } else { |
3705 UNREACHABLE(); | 3714 UNREACHABLE(); |
3706 } | 3715 } |
3707 } | 3716 } |
3708 | 3717 |
3709 } // namespace dart | 3718 } // namespace dart |
OLD | NEW |