OLD | NEW |
---|---|
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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/globals.h" // Needed here to get TARGET_ARCH_DBC. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_DBC. |
6 #if defined(TARGET_ARCH_DBC) | 6 #if defined(TARGET_ARCH_DBC) |
7 | 7 |
8 #include "vm/intermediate_language.h" | 8 #include "vm/intermediate_language.h" |
9 | 9 |
10 #include "vm/cpu.h" | 10 #include "vm/cpu.h" |
(...skipping 665 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
676 __ Bind(&is_true); | 676 __ Bind(&is_true); |
677 __ LoadConstant(result_reg, Bool::True()); | 677 __ LoadConstant(result_reg, Bool::True()); |
678 __ Bind(&done); | 678 __ Bind(&done); |
679 } | 679 } |
680 | 680 |
681 | 681 |
682 EMIT_NATIVE_CODE(CreateArray, | 682 EMIT_NATIVE_CODE(CreateArray, |
683 2, Location::RequiresRegister(), | 683 2, Location::RequiresRegister(), |
684 LocationSummary::kCall) { | 684 LocationSummary::kCall) { |
685 if (compiler->is_optimizing()) { | 685 if (compiler->is_optimizing()) { |
686 __ Push(locs()->in(0).reg()); | 686 const Register length = locs()->in(kLengthPos).reg(); |
687 __ Push(locs()->in(1).reg()); | 687 const Register typ = locs()->in(kElementTypePos).reg(); |
Florian Schneider
2016/09/13 17:06:58
s/typ/type_argument/
zra
2016/09/13 17:21:18
Done.
| |
688 } | 688 const Register out = locs()->out(0).reg(); |
689 __ CreateArrayTOS(); | 689 __ CreateArrayOpt(out, length, typ); |
690 compiler->RecordSafepoint(locs()); | 690 __ Push(typ); |
691 if (compiler->is_optimizing()) { | 691 __ Push(length); |
692 __ PopLocal(locs()->out(0).reg()); | 692 __ CreateArrayTOS(); |
693 compiler->RecordSafepoint(locs()); | |
694 __ PopLocal(out); | |
695 } else { | |
696 __ CreateArrayTOS(); | |
697 compiler->RecordSafepoint(locs()); | |
693 } | 698 } |
694 } | 699 } |
695 | 700 |
696 | 701 |
697 EMIT_NATIVE_CODE(StoreIndexed, 3, Location::NoLocation(), | 702 EMIT_NATIVE_CODE(StoreIndexed, 3, Location::NoLocation(), |
698 LocationSummary::kNoCall, 1) { | 703 LocationSummary::kNoCall, 1) { |
699 if (!compiler->is_optimizing()) { | 704 if (!compiler->is_optimizing()) { |
700 ASSERT(class_id() == kArrayCid); | 705 ASSERT(class_id() == kArrayCid); |
701 __ StoreIndexedTOS(); | 706 __ StoreIndexedTOS(); |
702 return; | 707 return; |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
903 const Register str = locs()->in(0).reg(); | 908 const Register str = locs()->in(0).reg(); |
904 const Register result = locs()->out(0).reg(); // Result char code is a smi. | 909 const Register result = locs()->out(0).reg(); // Result char code is a smi. |
905 __ StringToCharCode(result, str); | 910 __ StringToCharCode(result, str); |
906 } | 911 } |
907 | 912 |
908 | 913 |
909 EMIT_NATIVE_CODE(AllocateObject, | 914 EMIT_NATIVE_CODE(AllocateObject, |
910 0, Location::RequiresRegister(), | 915 0, Location::RequiresRegister(), |
911 LocationSummary::kCall) { | 916 LocationSummary::kCall) { |
912 if (ArgumentCount() == 1) { | 917 if (ArgumentCount() == 1) { |
918 // Allocate with type arguments. | |
913 __ PushConstant(cls()); | 919 __ PushConstant(cls()); |
914 __ AllocateT(); | 920 __ AllocateT(); |
915 compiler->AddCurrentDescriptor(RawPcDescriptors::kOther, | 921 compiler->AddCurrentDescriptor(RawPcDescriptors::kOther, |
916 Thread::kNoDeoptId, | 922 Thread::kNoDeoptId, |
917 token_pos()); | 923 token_pos()); |
924 compiler->RecordSafepoint(locs()); | |
925 if (compiler->is_optimizing()) { | |
926 __ PopLocal(locs()->out(0).reg()); | |
927 } | |
928 } else if (compiler->is_optimizing()) { | |
929 // If we're optimizing, try a streamlined fastpath. | |
930 const intptr_t instance_size = cls().instance_size(); | |
931 Isolate* isolate = Isolate::Current(); | |
932 if (Heap::IsAllocatableInNewSpace(instance_size) && | |
933 !cls().TraceAllocation(isolate)) { | |
934 uword tags = 0; | |
935 tags = RawObject::SizeTag::update(instance_size, tags); | |
936 ASSERT(cls().id() != kIllegalCid); | |
937 tags = RawObject::ClassIdTag::update(cls().id(), tags); | |
938 if (Smi::IsValid(tags)) { | |
939 const intptr_t tags_kidx = __ AddConstant(Smi::Handle(Smi::New(tags))); | |
940 __ AllocateOpt(locs()->out(0).reg(), tags_kidx); | |
941 } | |
942 } | |
943 const intptr_t kidx = __ AddConstant(cls()); | |
944 __ Allocate(kidx); | |
945 compiler->AddCurrentDescriptor(RawPcDescriptors::kOther, | |
946 Thread::kNoDeoptId, | |
947 token_pos()); | |
948 compiler->RecordSafepoint(locs()); | |
949 __ PopLocal(locs()->out(0).reg()); | |
918 } else { | 950 } else { |
919 const intptr_t kidx = __ AddConstant(cls()); | 951 const intptr_t kidx = __ AddConstant(cls()); |
920 __ Allocate(kidx); | 952 __ Allocate(kidx); |
921 compiler->AddCurrentDescriptor(RawPcDescriptors::kOther, | 953 compiler->AddCurrentDescriptor(RawPcDescriptors::kOther, |
922 Thread::kNoDeoptId, | 954 Thread::kNoDeoptId, |
923 token_pos()); | 955 token_pos()); |
924 } | 956 compiler->RecordSafepoint(locs()); |
925 compiler->RecordSafepoint(locs()); | |
926 if (compiler->is_optimizing()) { | |
927 __ PopLocal(locs()->out(0).reg()); | |
928 } | 957 } |
929 } | 958 } |
930 | 959 |
931 | 960 |
932 EMIT_NATIVE_CODE(StoreInstanceField, 2) { | 961 EMIT_NATIVE_CODE(StoreInstanceField, 2) { |
933 ASSERT(!HasTemp()); | 962 ASSERT(!HasTemp()); |
934 ASSERT(offset_in_bytes() % kWordSize == 0); | 963 ASSERT(offset_in_bytes() % kWordSize == 0); |
935 if (compiler->is_optimizing()) { | 964 if (compiler->is_optimizing()) { |
936 const Register value = locs()->in(1).reg(); | 965 const Register value = locs()->in(1).reg(); |
937 const Register instance = locs()->in(0).reg(); | 966 const Register instance = locs()->in(0).reg(); |
(...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1406 UNREACHABLE(); | 1435 UNREACHABLE(); |
1407 break; | 1436 break; |
1408 } | 1437 } |
1409 } | 1438 } |
1410 | 1439 |
1411 | 1440 |
1412 EMIT_NATIVE_CODE(Box, 1, Location::RequiresRegister(), LocationSummary::kCall) { | 1441 EMIT_NATIVE_CODE(Box, 1, Location::RequiresRegister(), LocationSummary::kCall) { |
1413 ASSERT(from_representation() == kUnboxedDouble); | 1442 ASSERT(from_representation() == kUnboxedDouble); |
1414 const Register value = locs()->in(0).reg(); | 1443 const Register value = locs()->in(0).reg(); |
1415 const Register out = locs()->out(0).reg(); | 1444 const Register out = locs()->out(0).reg(); |
1445 const intptr_t instance_size = compiler->double_class().instance_size(); | |
1446 Isolate* isolate = Isolate::Current(); | |
1447 ASSERT(Heap::IsAllocatableInNewSpace(instance_size)); | |
1448 if (!compiler->double_class().TraceAllocation(isolate)) { | |
1449 uword tags = 0; | |
1450 tags = RawObject::SizeTag::update(instance_size, tags); | |
1451 tags = RawObject::ClassIdTag::update(compiler->double_class().id(), tags); | |
1452 const intptr_t tags_kidx = __ AddConstant(Smi::Handle(Smi::New(tags))); | |
Florian Schneider
2016/09/13 17:06:58
Check Smi::IsValid(tags)?
zra
2016/09/13 17:21:18
Done.
| |
1453 __ AllocateOpt(out, tags_kidx); | |
1454 } | |
1416 const intptr_t kidx = __ AddConstant(compiler->double_class()); | 1455 const intptr_t kidx = __ AddConstant(compiler->double_class()); |
1417 __ Allocate(kidx); | 1456 __ Allocate(kidx); |
1418 compiler->AddCurrentDescriptor(RawPcDescriptors::kOther, | 1457 compiler->AddCurrentDescriptor(RawPcDescriptors::kOther, |
1419 Thread::kNoDeoptId, | 1458 Thread::kNoDeoptId, |
1420 token_pos()); | 1459 token_pos()); |
1421 compiler->RecordSafepoint(locs()); | 1460 compiler->RecordSafepoint(locs()); |
1422 // __ Allocate puts the box at the top of the stack. | 1461 __ PopLocal(out); |
1423 __ WriteIntoDouble(out, value); | 1462 __ WriteIntoDouble(out, value); |
1424 } | 1463 } |
1425 | 1464 |
1426 | 1465 |
1427 EMIT_NATIVE_CODE(Unbox, 1, Location::RequiresRegister()) { | 1466 EMIT_NATIVE_CODE(Unbox, 1, Location::RequiresRegister()) { |
1428 ASSERT(representation() == kUnboxedDouble); | 1467 ASSERT(representation() == kUnboxedDouble); |
1429 const intptr_t value_cid = value()->Type()->ToCid(); | 1468 const intptr_t value_cid = value()->Type()->ToCid(); |
1430 const intptr_t box_cid = BoxCid(); | 1469 const intptr_t box_cid = BoxCid(); |
1431 const Register box = locs()->in(0).reg(); | 1470 const Register box = locs()->in(0).reg(); |
1432 const Register result = locs()->out(0).reg(); | 1471 const Register result = locs()->out(0).reg(); |
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1743 __ IfULe(length, index); | 1782 __ IfULe(length, index); |
1744 compiler->EmitDeopt(deopt_id(), | 1783 compiler->EmitDeopt(deopt_id(), |
1745 ICData::kDeoptCheckArrayBound, | 1784 ICData::kDeoptCheckArrayBound, |
1746 (generalized_ ? ICData::kGeneralized : 0) | | 1785 (generalized_ ? ICData::kGeneralized : 0) | |
1747 (licm_hoisted_ ? ICData::kHoisted : 0)); | 1786 (licm_hoisted_ ? ICData::kHoisted : 0)); |
1748 } | 1787 } |
1749 | 1788 |
1750 } // namespace dart | 1789 } // namespace dart |
1751 | 1790 |
1752 #endif // defined TARGET_ARCH_DBC | 1791 #endif // defined TARGET_ARCH_DBC |
OLD | NEW |