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

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

Issue 2335363002: DBC: Another allocation fast path (Closed)
Patch Set: Remove extra whitespace Created 4 years, 3 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
« no previous file with comments | « runtime/vm/constants_dbc.h ('k') | runtime/vm/simulator_dbc.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) 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 898 matching lines...) Expand 10 before | Expand all | Expand 10 after
909 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.
910 __ StringToCharCode(result, str); 910 __ StringToCharCode(result, str);
911 } 911 }
912 912
913 913
914 EMIT_NATIVE_CODE(AllocateObject, 914 EMIT_NATIVE_CODE(AllocateObject,
915 0, Location::RequiresRegister(), 915 0, Location::RequiresRegister(),
916 LocationSummary::kCall) { 916 LocationSummary::kCall) {
917 if (ArgumentCount() == 1) { 917 if (ArgumentCount() == 1) {
918 // Allocate with type arguments. 918 // Allocate with type arguments.
919 __ PushConstant(cls());
920 __ AllocateT();
921 compiler->AddCurrentDescriptor(RawPcDescriptors::kOther,
922 Thread::kNoDeoptId,
923 token_pos());
924 compiler->RecordSafepoint(locs());
925 if (compiler->is_optimizing()) { 919 if (compiler->is_optimizing()) {
920 // If we're optimizing, try a streamlined fastpath.
921 const intptr_t instance_size = cls().instance_size();
922 Isolate* isolate = Isolate::Current();
923 if (Heap::IsAllocatableInNewSpace(instance_size) &&
924 !cls().TraceAllocation(isolate)) {
925 uword tags = 0;
926 tags = RawObject::SizeTag::update(instance_size, tags);
927 ASSERT(cls().id() != kIllegalCid);
928 tags = RawObject::ClassIdTag::update(cls().id(), tags);
929 if (Smi::IsValid(tags)) {
930 const intptr_t tags_kidx = __ AddConstant(
931 Smi::Handle(Smi::New(tags)));
932 __ AllocateTOpt(locs()->out(0).reg(), tags_kidx);
933 __ Nop(cls().type_arguments_field_offset());
934 }
935 }
936 __ PushConstant(cls());
937 __ AllocateT();
938 compiler->AddCurrentDescriptor(RawPcDescriptors::kOther,
939 Thread::kNoDeoptId,
940 token_pos());
941 compiler->RecordSafepoint(locs());
926 __ PopLocal(locs()->out(0).reg()); 942 __ PopLocal(locs()->out(0).reg());
943 } else {
944 __ PushConstant(cls());
945 __ AllocateT();
946 compiler->AddCurrentDescriptor(RawPcDescriptors::kOther,
947 Thread::kNoDeoptId,
948 token_pos());
949 compiler->RecordSafepoint(locs());
927 } 950 }
928 } else if (compiler->is_optimizing()) { 951 } else if (compiler->is_optimizing()) {
929 // If we're optimizing, try a streamlined fastpath. 952 // If we're optimizing, try a streamlined fastpath.
930 const intptr_t instance_size = cls().instance_size(); 953 const intptr_t instance_size = cls().instance_size();
931 Isolate* isolate = Isolate::Current(); 954 Isolate* isolate = Isolate::Current();
932 if (Heap::IsAllocatableInNewSpace(instance_size) && 955 if (Heap::IsAllocatableInNewSpace(instance_size) &&
933 !cls().TraceAllocation(isolate)) { 956 !cls().TraceAllocation(isolate)) {
934 uword tags = 0; 957 uword tags = 0;
935 tags = RawObject::SizeTag::update(instance_size, tags); 958 tags = RawObject::SizeTag::update(instance_size, tags);
936 ASSERT(cls().id() != kIllegalCid); 959 ASSERT(cls().id() != kIllegalCid);
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
1013 compiler->AddCurrentDescriptor(RawPcDescriptors::kOther, 1036 compiler->AddCurrentDescriptor(RawPcDescriptors::kOther,
1014 Thread::kNoDeoptId, 1037 Thread::kNoDeoptId,
1015 token_pos()); 1038 token_pos());
1016 } 1039 }
1017 1040
1018 1041
1019 EMIT_NATIVE_CODE(AllocateUninitializedContext, 1042 EMIT_NATIVE_CODE(AllocateUninitializedContext,
1020 0, Location::RequiresRegister(), 1043 0, Location::RequiresRegister(),
1021 LocationSummary::kCall) { 1044 LocationSummary::kCall) {
1022 ASSERT(compiler->is_optimizing()); 1045 ASSERT(compiler->is_optimizing());
1046 __ AllocateUninitializedContext(locs()->out(0).reg(),
1047 num_context_variables());
1023 __ AllocateContext(num_context_variables()); 1048 __ AllocateContext(num_context_variables());
1024 compiler->RecordSafepoint(locs()); 1049 compiler->RecordSafepoint(locs());
1025 compiler->AddCurrentDescriptor(RawPcDescriptors::kOther, 1050 compiler->AddCurrentDescriptor(RawPcDescriptors::kOther,
1026 Thread::kNoDeoptId, 1051 Thread::kNoDeoptId,
1027 token_pos()); 1052 token_pos());
1028 __ PopLocal(locs()->out(0).reg()); 1053 __ PopLocal(locs()->out(0).reg());
1029 } 1054 }
1030 1055
1031 1056
1032 EMIT_NATIVE_CODE(CloneContext, 1057 EMIT_NATIVE_CODE(CloneContext,
(...skipping 751 matching lines...) Expand 10 before | Expand all | Expand 10 after
1784 __ IfULe(length, index); 1809 __ IfULe(length, index);
1785 compiler->EmitDeopt(deopt_id(), 1810 compiler->EmitDeopt(deopt_id(),
1786 ICData::kDeoptCheckArrayBound, 1811 ICData::kDeoptCheckArrayBound,
1787 (generalized_ ? ICData::kGeneralized : 0) | 1812 (generalized_ ? ICData::kGeneralized : 0) |
1788 (licm_hoisted_ ? ICData::kHoisted : 0)); 1813 (licm_hoisted_ ? ICData::kHoisted : 0));
1789 } 1814 }
1790 1815
1791 } // namespace dart 1816 } // namespace dart
1792 1817
1793 #endif // defined TARGET_ARCH_DBC 1818 #endif // defined TARGET_ARCH_DBC
OLDNEW
« no previous file with comments | « runtime/vm/constants_dbc.h ('k') | runtime/vm/simulator_dbc.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698