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

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

Issue 2658603002: Revert "Optimizations to IC stub for unoptimized code performance on x64." (Closed)
Patch Set: Created 3 years, 11 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 | « no previous file | runtime/vm/assembler_x64.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" // NOLINT 5 #include "vm/globals.h" // NOLINT
6 #if defined(TARGET_ARCH_IA32) 6 #if defined(TARGET_ARCH_IA32)
7 7
8 #include "vm/assembler.h" 8 #include "vm/assembler.h"
9 #include "vm/code_generator.h" 9 #include "vm/code_generator.h"
10 #include "vm/cpu.h" 10 #include "vm/cpu.h"
(...skipping 2885 matching lines...) Expand 10 before | Expand all | Expand 10 after
2896 SmiUntag(object); 2896 SmiUntag(object);
2897 j(NOT_CARRY, is_smi, kNearJump); 2897 j(NOT_CARRY, is_smi, kNearJump);
2898 // Load cid: can't use LoadClassId, object is untagged. Use TIMES_2 scale 2898 // Load cid: can't use LoadClassId, object is untagged. Use TIMES_2 scale
2899 // factor in the addressing mode to compensate for this. 2899 // factor in the addressing mode to compensate for this.
2900 movzxw(scratch, Address(object, TIMES_2, class_id_offset)); 2900 movzxw(scratch, Address(object, TIMES_2, class_id_offset));
2901 cmpl(scratch, Immediate(class_id)); 2901 cmpl(scratch, Immediate(class_id));
2902 } 2902 }
2903 2903
2904 2904
2905 void Assembler::LoadClassIdMayBeSmi(Register result, Register object) { 2905 void Assembler::LoadClassIdMayBeSmi(Register result, Register object) {
2906 if (result == object) { 2906 ASSERT(result != object);
2907 Label smi, join; 2907 static const intptr_t kSmiCidSource = kSmiCid << RawObject::kClassIdTagPos;
2908 2908
2909 testl(object, Immediate(kSmiTagMask)); 2909 // Make a dummy "Object" whose cid is kSmiCid.
2910 j(EQUAL, &smi, Assembler::kNearJump); 2910 movl(result, Immediate(reinterpret_cast<int32_t>(&kSmiCidSource) + 1));
2911 LoadClassId(result, object);
2912 jmp(&join, Assembler::kNearJump);
2913 2911
2914 Bind(&smi); 2912 // Check if object (in tmp) is a Smi.
2915 movl(result, Immediate(kSmiCid)); 2913 testl(object, Immediate(kSmiTagMask));
2916 2914
2917 Bind(&join); 2915 // If the object is not a Smi, use the original object to load the cid.
2918 } else { 2916 // Otherwise, the dummy object is used, and the result is kSmiCid.
2919 ASSERT(result != object); 2917 cmovne(result, object);
2920 static const intptr_t kSmiCidSource = kSmiCid << RawObject::kClassIdTagPos; 2918 LoadClassId(result, result);
2921
2922 // Make a dummy "Object" whose cid is kSmiCid.
2923 movl(result, Immediate(reinterpret_cast<int32_t>(&kSmiCidSource) + 1));
2924
2925 // Check if object (in tmp) is a Smi.
2926 testl(object, Immediate(kSmiTagMask));
2927
2928 // If the object is not a Smi, use the original object to load the cid.
2929 // Otherwise, the dummy object is used, and the result is kSmiCid.
2930 cmovne(result, object);
2931 LoadClassId(result, result);
2932 }
2933 } 2919 }
2934 2920
2935 2921
2936 void Assembler::LoadTaggedClassIdMayBeSmi(Register result, Register object) { 2922 void Assembler::LoadTaggedClassIdMayBeSmi(Register result, Register object) {
2937 if (result == object) { 2923 LoadClassIdMayBeSmi(result, object);
2938 Label smi, join; 2924 // Tag the result.
2939 2925 SmiTag(result);
2940 testl(object, Immediate(kSmiTagMask));
2941 j(EQUAL, &smi, Assembler::kNearJump);
2942 LoadClassId(result, object);
2943 SmiTag(result);
2944 jmp(&join, Assembler::kNearJump);
2945
2946 Bind(&smi);
2947 movl(result, Immediate(Smi::RawValue(kSmiCid)));
2948
2949 Bind(&join);
2950 } else {
2951 LoadClassIdMayBeSmi(result, object);
2952 SmiTag(result);
2953 }
2954 } 2926 }
2955 2927
2956 2928
2957 Address Assembler::ElementAddressForIntIndex(bool is_external, 2929 Address Assembler::ElementAddressForIntIndex(bool is_external,
2958 intptr_t cid, 2930 intptr_t cid,
2959 intptr_t index_scale, 2931 intptr_t index_scale,
2960 Register array, 2932 Register array,
2961 intptr_t index) { 2933 intptr_t index) {
2962 if (is_external) { 2934 if (is_external) {
2963 return Address(array, index * index_scale); 2935 return Address(array, index * index_scale);
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
3023 2995
3024 const char* Assembler::FpuRegisterName(FpuRegister reg) { 2996 const char* Assembler::FpuRegisterName(FpuRegister reg) {
3025 ASSERT((0 <= reg) && (reg < kNumberOfXmmRegisters)); 2997 ASSERT((0 <= reg) && (reg < kNumberOfXmmRegisters));
3026 return xmm_reg_names[reg]; 2998 return xmm_reg_names[reg];
3027 } 2999 }
3028 3000
3029 3001
3030 } // namespace dart 3002 } // namespace dart
3031 3003
3032 #endif // defined TARGET_ARCH_IA32 3004 #endif // defined TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/assembler_x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698