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

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

Issue 385563004: Uses a conditional move for usage counter increment instead of a branch (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 5 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 | Annotate | Revision Log
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/dart_entry.h" 10 #include "vm/dart_entry.h"
(...skipping 917 matching lines...) Expand 10 before | Expand all | Expand 10 after
928 void LoadUntaggedInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 928 void LoadUntaggedInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
929 Register object = locs()->in(0).reg(); 929 Register object = locs()->in(0).reg();
930 Register result = locs()->out(0).reg(); 930 Register result = locs()->out(0).reg();
931 __ movl(result, FieldAddress(object, offset())); 931 __ movl(result, FieldAddress(object, offset()));
932 } 932 }
933 933
934 934
935 LocationSummary* LoadClassIdInstr::MakeLocationSummary(Isolate* isolate, 935 LocationSummary* LoadClassIdInstr::MakeLocationSummary(Isolate* isolate,
936 bool opt) const { 936 bool opt) const {
937 const intptr_t kNumInputs = 1; 937 const intptr_t kNumInputs = 1;
938 const intptr_t kNumTemps = 1; 938 return LocationSummary::Make(isolate,
939 LocationSummary* summary = new(isolate) LocationSummary( 939 kNumInputs,
940 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 940 Location::RequiresRegister(),
941 summary->set_in(0, Location::RequiresRegister()); 941 LocationSummary::kNoCall);
942 summary->set_out(0, Location::RequiresRegister());
943 summary->set_temp(0, Location::RequiresRegister());
944 return summary;
945 } 942 }
946 943
947 944
948 void LoadClassIdInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 945 void LoadClassIdInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
949 Register object = locs()->in(0).reg(); 946 const Register object = locs()->in(0).reg();
950 Register result = locs()->out(0).reg(); 947 const Register result = locs()->out(0).reg();
951 Register tmp = locs()->temp(0).reg(); 948 Label not_smi, done;
952 __ LoadTaggedClassIdMayBeSmi(result, object, tmp); 949
950 // We don't use Assembler::LoadTaggedClassIdMayBeSmi() here---which uses
951 // a conditional move instead, and requires an additional register---because
952 // it is slower, probably due to branch prediction usually working just fine
953 // in this case.
Ivan Posva 2014/07/15 08:47:09 Do we know through type feedback whether a LoadCla
954 __ testl(object, Immediate(kSmiTagMask));
955 __ j(NOT_ZERO, &not_smi, Assembler::kNearJump);
956 __ movl(result, Immediate(Smi::RawValue(kSmiCid)));
957 __ jmp(&done, Assembler::kNearJump);
958 __ Bind(&not_smi);
959 __ LoadClassId(result, object);
960 __ SmiTag(result);
961 __ Bind(&done);
953 } 962 }
954 963
955 964
956 CompileType LoadIndexedInstr::ComputeType() const { 965 CompileType LoadIndexedInstr::ComputeType() const {
957 switch (class_id_) { 966 switch (class_id_) {
958 case kArrayCid: 967 case kArrayCid:
959 case kImmutableArrayCid: 968 case kImmutableArrayCid:
960 return CompileType::Dynamic(); 969 return CompileType::Dynamic();
961 970
962 case kTypedDataFloat32ArrayCid: 971 case kTypedDataFloat32ArrayCid:
(...skipping 5400 matching lines...) Expand 10 before | Expand all | Expand 10 after
6363 __ movl(EDX, Immediate(kInvalidObjectPointer)); 6372 __ movl(EDX, Immediate(kInvalidObjectPointer));
6364 __ movl(EDX, Immediate(kInvalidObjectPointer)); 6373 __ movl(EDX, Immediate(kInvalidObjectPointer));
6365 #endif 6374 #endif
6366 } 6375 }
6367 6376
6368 } // namespace dart 6377 } // namespace dart
6369 6378
6370 #undef __ 6379 #undef __
6371 6380
6372 #endif // defined TARGET_ARCH_IA32 6381 #endif // defined TARGET_ARCH_IA32
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698