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

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

Issue 1897983002: VM: Avoid smi-check when loading class-ids from known non-smi values (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: addressed comments Created 4 years, 8 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/intermediate_language_mips.cc ('k') | no next file » | 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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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_X64. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_X64.
6 #if defined(TARGET_ARCH_X64) 6 #if defined(TARGET_ARCH_X64)
7 7
8 #include "vm/intermediate_language.h" 8 #include "vm/intermediate_language.h"
9 9
10 #include "vm/compiler.h" 10 #include "vm/compiler.h"
(...skipping 908 matching lines...) Expand 10 before | Expand all | Expand 10 after
919 return LocationSummary::Make(zone, 919 return LocationSummary::Make(zone,
920 kNumInputs, 920 kNumInputs,
921 Location::RequiresRegister(), 921 Location::RequiresRegister(),
922 LocationSummary::kNoCall); 922 LocationSummary::kNoCall);
923 } 923 }
924 924
925 925
926 void LoadClassIdInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 926 void LoadClassIdInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
927 const Register object = locs()->in(0).reg(); 927 const Register object = locs()->in(0).reg();
928 const Register result = locs()->out(0).reg(); 928 const Register result = locs()->out(0).reg();
929 Label load, done; 929 const AbstractType& value_type = *this->object()->Type()->ToAbstractType();
930 930 if (CompileType::Smi().IsAssignableTo(value_type) ||
931 // We don't use Assembler::LoadTaggedClassIdMayBeSmi() here---which uses 931 value_type.IsTypeParameter()) {
932 // a conditional move instead---because it is slower, probably due to 932 // We don't use Assembler::LoadTaggedClassIdMayBeSmi() here---which uses
933 // branch prediction usually working just fine in this case. 933 // a conditional move instead---because it is slower, probably due to
934 __ testq(object, Immediate(kSmiTagMask)); 934 // branch prediction usually working just fine in this case.
935 __ j(NOT_ZERO, &load, Assembler::kNearJump); 935 Label load, done;
936 __ LoadImmediate(result, Immediate(Smi::RawValue(kSmiCid))); 936 __ testq(object, Immediate(kSmiTagMask));
937 __ jmp(&done); 937 __ j(NOT_ZERO, &load, Assembler::kNearJump);
938 __ Bind(&load); 938 __ LoadImmediate(result, Immediate(Smi::RawValue(kSmiCid)));
939 __ LoadClassId(result, object); 939 __ jmp(&done);
940 __ SmiTag(result); 940 __ Bind(&load);
941 __ Bind(&done); 941 __ LoadClassId(result, object);
942 __ SmiTag(result);
943 __ Bind(&done);
944 } else {
945 __ LoadClassId(result, object);
946 __ SmiTag(result);
947 }
942 } 948 }
943 949
944 950
945 CompileType LoadIndexedInstr::ComputeType() const { 951 CompileType LoadIndexedInstr::ComputeType() const {
946 switch (class_id_) { 952 switch (class_id_) {
947 case kArrayCid: 953 case kArrayCid:
948 case kImmutableArrayCid: 954 case kImmutableArrayCid:
949 return CompileType::Dynamic(); 955 return CompileType::Dynamic();
950 956
951 case kTypedDataFloat32ArrayCid: 957 case kTypedDataFloat32ArrayCid:
(...skipping 5575 matching lines...) Expand 10 before | Expand all | Expand 10 after
6527 __ Drop(1); 6533 __ Drop(1);
6528 __ popq(result); 6534 __ popq(result);
6529 } 6535 }
6530 6536
6531 6537
6532 } // namespace dart 6538 } // namespace dart
6533 6539
6534 #undef __ 6540 #undef __
6535 6541
6536 #endif // defined TARGET_ARCH_X64 6542 #endif // defined TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « runtime/vm/intermediate_language_mips.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698