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

Side by Side Diff: runtime/vm/intermediate_language_ia32.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_arm64.cc ('k') | runtime/vm/intermediate_language_mips.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) 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_IA32. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_IA32.
6 #if defined(TARGET_ARCH_IA32) 6 #if defined(TARGET_ARCH_IA32)
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 935 matching lines...) Expand 10 before | Expand all | Expand 10 after
946 return LocationSummary::Make(zone, 946 return LocationSummary::Make(zone,
947 kNumInputs, 947 kNumInputs,
948 Location::RequiresRegister(), 948 Location::RequiresRegister(),
949 LocationSummary::kNoCall); 949 LocationSummary::kNoCall);
950 } 950 }
951 951
952 952
953 void LoadClassIdInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 953 void LoadClassIdInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
954 const Register object = locs()->in(0).reg(); 954 const Register object = locs()->in(0).reg();
955 const Register result = locs()->out(0).reg(); 955 const Register result = locs()->out(0).reg();
956 Label done; 956 const AbstractType& value_type = *this->object()->Type()->ToAbstractType();
957 957 if (CompileType::Smi().IsAssignableTo(value_type) ||
958 // We don't use Assembler::LoadTaggedClassIdMayBeSmi() here---which uses 958 value_type.IsTypeParameter()) {
959 // a conditional move instead, and requires an additional register---because 959 // We don't use Assembler::LoadTaggedClassIdMayBeSmi() here---which uses
960 // it is slower, probably due to branch prediction usually working just fine 960 // a conditional move instead, and requires an additional register---because
961 // in this case. 961 // it is slower, probably due to branch prediction usually working just fine
962 ASSERT(result != object); 962 // in this case.
963 __ movl(result, Immediate(kSmiCid << 1)); 963 ASSERT(result != object);
964 __ testl(object, Immediate(kSmiTagMask)); 964 Label done;
965 __ j(EQUAL, &done, Assembler::kNearJump); 965 __ movl(result, Immediate(kSmiCid << 1));
966 __ LoadClassId(result, object); 966 __ testl(object, Immediate(kSmiTagMask));
967 __ SmiTag(result); 967 __ j(EQUAL, &done, Assembler::kNearJump);
968 __ Bind(&done); 968 __ LoadClassId(result, object);
969 __ SmiTag(result);
970 __ Bind(&done);
971 } else {
972 __ LoadClassId(result, object);
973 __ SmiTag(result);
974 }
969 } 975 }
970 976
971 977
972 CompileType LoadIndexedInstr::ComputeType() const { 978 CompileType LoadIndexedInstr::ComputeType() const {
973 switch (class_id_) { 979 switch (class_id_) {
974 case kArrayCid: 980 case kArrayCid:
975 case kImmutableArrayCid: 981 case kImmutableArrayCid:
976 return CompileType::Dynamic(); 982 return CompileType::Dynamic();
977 983
978 case kTypedDataFloat32ArrayCid: 984 case kTypedDataFloat32ArrayCid:
(...skipping 5865 matching lines...) Expand 10 before | Expand all | Expand 10 after
6844 __ Drop(1); 6850 __ Drop(1);
6845 __ popl(result); 6851 __ popl(result);
6846 } 6852 }
6847 6853
6848 6854
6849 } // namespace dart 6855 } // namespace dart
6850 6856
6851 #undef __ 6857 #undef __
6852 6858
6853 #endif // defined TARGET_ARCH_IA32 6859 #endif // defined TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « runtime/vm/intermediate_language_arm64.cc ('k') | runtime/vm/intermediate_language_mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698