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

Side by Side Diff: runtime/vm/intermediate_language_x64.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_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/dart_entry.h" 10 #include "vm/dart_entry.h"
(...skipping 854 matching lines...) Expand 10 before | Expand all | Expand 10 after
865 bool opt) const { 865 bool opt) const {
866 const intptr_t kNumInputs = 1; 866 const intptr_t kNumInputs = 1;
867 return LocationSummary::Make(isolate, 867 return LocationSummary::Make(isolate,
868 kNumInputs, 868 kNumInputs,
869 Location::RequiresRegister(), 869 Location::RequiresRegister(),
870 LocationSummary::kNoCall); 870 LocationSummary::kNoCall);
871 } 871 }
872 872
873 873
874 void LoadClassIdInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 874 void LoadClassIdInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
875 Register object = locs()->in(0).reg(); 875 const Register object = locs()->in(0).reg();
876 Register result = locs()->out(0).reg(); 876 const Register result = locs()->out(0).reg();
877 __ LoadTaggedClassIdMayBeSmi(result, object); 877 Label load, done;
878
879 // We don't use Assembler::LoadTaggedClassIdMayBeSmi() here---which uses
880 // a conditional move instead---because it is slower, probably due to
881 // branch prediction usually working just fine in this case.
882 __ testq(object, Immediate(kSmiTagMask));
883 __ j(NOT_ZERO, &load, Assembler::kNearJump);
884 __ LoadImmediate(result, Immediate(Smi::RawValue(kSmiCid)), PP);
885 __ jmp(&done);
886 __ Bind(&load);
887 __ LoadClassId(result, object);
888 __ SmiTag(result);
889 __ Bind(&done);
878 } 890 }
879 891
880 892
881 CompileType LoadIndexedInstr::ComputeType() const { 893 CompileType LoadIndexedInstr::ComputeType() const {
882 switch (class_id_) { 894 switch (class_id_) {
883 case kArrayCid: 895 case kArrayCid:
884 case kImmutableArrayCid: 896 case kImmutableArrayCid:
885 return CompileType::Dynamic(); 897 return CompileType::Dynamic();
886 898
887 case kTypedDataFloat32ArrayCid: 899 case kTypedDataFloat32ArrayCid:
(...skipping 4974 matching lines...) Expand 10 before | Expand all | Expand 10 after
5862 __ movq(R10, Immediate(kInvalidObjectPointer)); 5874 __ movq(R10, Immediate(kInvalidObjectPointer));
5863 __ movq(RBX, Immediate(kInvalidObjectPointer)); 5875 __ movq(RBX, Immediate(kInvalidObjectPointer));
5864 #endif 5876 #endif
5865 } 5877 }
5866 5878
5867 } // namespace dart 5879 } // namespace dart
5868 5880
5869 #undef __ 5881 #undef __
5870 5882
5871 #endif // defined TARGET_ARCH_X64 5883 #endif // defined TARGET_ARCH_X64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698