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

Side by Side Diff: src/ia32/lithium-codegen-ia32.cc

Issue 1262583002: Reland of "Remove ExternalArray, derived types, and element kinds" (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: updates Created 5 years, 4 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 | « src/hydrogen-uint32-analysis.cc ('k') | src/ia32/lithium-ia32.h » ('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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #if V8_TARGET_ARCH_IA32 7 #if V8_TARGET_ARCH_IA32
8 8
9 #include "src/base/bits.h" 9 #include "src/base/bits.h"
10 #include "src/code-factory.h" 10 #include "src/code-factory.h"
(...skipping 3050 matching lines...) Expand 10 before | Expand all | Expand 10 after
3061 ExternalArrayOpRequiresTemp(instr->hydrogen()->key()->representation(), 3061 ExternalArrayOpRequiresTemp(instr->hydrogen()->key()->representation(),
3062 elements_kind)) { 3062 elements_kind)) {
3063 __ SmiUntag(ToRegister(key)); 3063 __ SmiUntag(ToRegister(key));
3064 } 3064 }
3065 Operand operand(BuildFastArrayOperand( 3065 Operand operand(BuildFastArrayOperand(
3066 instr->elements(), 3066 instr->elements(),
3067 key, 3067 key,
3068 instr->hydrogen()->key()->representation(), 3068 instr->hydrogen()->key()->representation(),
3069 elements_kind, 3069 elements_kind,
3070 instr->base_offset())); 3070 instr->base_offset()));
3071 if (elements_kind == EXTERNAL_FLOAT32_ELEMENTS || 3071 if (elements_kind == FLOAT32_ELEMENTS) {
3072 elements_kind == FLOAT32_ELEMENTS) {
3073 XMMRegister result(ToDoubleRegister(instr->result())); 3072 XMMRegister result(ToDoubleRegister(instr->result()));
3074 __ movss(result, operand); 3073 __ movss(result, operand);
3075 __ cvtss2sd(result, result); 3074 __ cvtss2sd(result, result);
3076 } else if (elements_kind == EXTERNAL_FLOAT64_ELEMENTS || 3075 } else if (elements_kind == FLOAT64_ELEMENTS) {
3077 elements_kind == FLOAT64_ELEMENTS) {
3078 __ movsd(ToDoubleRegister(instr->result()), operand); 3076 __ movsd(ToDoubleRegister(instr->result()), operand);
3079 } else { 3077 } else {
3080 Register result(ToRegister(instr->result())); 3078 Register result(ToRegister(instr->result()));
3081 switch (elements_kind) { 3079 switch (elements_kind) {
3082 case EXTERNAL_INT8_ELEMENTS:
3083 case INT8_ELEMENTS: 3080 case INT8_ELEMENTS:
3084 __ movsx_b(result, operand); 3081 __ movsx_b(result, operand);
3085 break; 3082 break;
3086 case EXTERNAL_UINT8_CLAMPED_ELEMENTS:
3087 case EXTERNAL_UINT8_ELEMENTS:
3088 case UINT8_ELEMENTS: 3083 case UINT8_ELEMENTS:
3089 case UINT8_CLAMPED_ELEMENTS: 3084 case UINT8_CLAMPED_ELEMENTS:
3090 __ movzx_b(result, operand); 3085 __ movzx_b(result, operand);
3091 break; 3086 break;
3092 case EXTERNAL_INT16_ELEMENTS:
3093 case INT16_ELEMENTS: 3087 case INT16_ELEMENTS:
3094 __ movsx_w(result, operand); 3088 __ movsx_w(result, operand);
3095 break; 3089 break;
3096 case EXTERNAL_UINT16_ELEMENTS:
3097 case UINT16_ELEMENTS: 3090 case UINT16_ELEMENTS:
3098 __ movzx_w(result, operand); 3091 __ movzx_w(result, operand);
3099 break; 3092 break;
3100 case EXTERNAL_INT32_ELEMENTS:
3101 case INT32_ELEMENTS: 3093 case INT32_ELEMENTS:
3102 __ mov(result, operand); 3094 __ mov(result, operand);
3103 break; 3095 break;
3104 case EXTERNAL_UINT32_ELEMENTS:
3105 case UINT32_ELEMENTS: 3096 case UINT32_ELEMENTS:
3106 __ mov(result, operand); 3097 __ mov(result, operand);
3107 if (!instr->hydrogen()->CheckFlag(HInstruction::kUint32)) { 3098 if (!instr->hydrogen()->CheckFlag(HInstruction::kUint32)) {
3108 __ test(result, Operand(result)); 3099 __ test(result, Operand(result));
3109 DeoptimizeIf(negative, instr, Deoptimizer::kNegativeValue); 3100 DeoptimizeIf(negative, instr, Deoptimizer::kNegativeValue);
3110 } 3101 }
3111 break; 3102 break;
3112 case EXTERNAL_FLOAT32_ELEMENTS:
3113 case EXTERNAL_FLOAT64_ELEMENTS:
3114 case FLOAT32_ELEMENTS: 3103 case FLOAT32_ELEMENTS:
3115 case FLOAT64_ELEMENTS: 3104 case FLOAT64_ELEMENTS:
3116 case FAST_SMI_ELEMENTS: 3105 case FAST_SMI_ELEMENTS:
3117 case FAST_ELEMENTS: 3106 case FAST_ELEMENTS:
3118 case FAST_DOUBLE_ELEMENTS: 3107 case FAST_DOUBLE_ELEMENTS:
3119 case FAST_HOLEY_SMI_ELEMENTS: 3108 case FAST_HOLEY_SMI_ELEMENTS:
3120 case FAST_HOLEY_ELEMENTS: 3109 case FAST_HOLEY_ELEMENTS:
3121 case FAST_HOLEY_DOUBLE_ELEMENTS: 3110 case FAST_HOLEY_DOUBLE_ELEMENTS:
3122 case DICTIONARY_ELEMENTS: 3111 case DICTIONARY_ELEMENTS:
3123 case FAST_SLOPPY_ARGUMENTS_ELEMENTS: 3112 case FAST_SLOPPY_ARGUMENTS_ELEMENTS:
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
3183 Immediate(Smi::FromInt(Isolate::kArrayProtectorValid))); 3172 Immediate(Smi::FromInt(Isolate::kArrayProtectorValid)));
3184 DeoptimizeIf(not_equal, instr, Deoptimizer::kHole); 3173 DeoptimizeIf(not_equal, instr, Deoptimizer::kHole);
3185 } 3174 }
3186 __ mov(result, isolate()->factory()->undefined_value()); 3175 __ mov(result, isolate()->factory()->undefined_value());
3187 __ bind(&done); 3176 __ bind(&done);
3188 } 3177 }
3189 } 3178 }
3190 3179
3191 3180
3192 void LCodeGen::DoLoadKeyed(LLoadKeyed* instr) { 3181 void LCodeGen::DoLoadKeyed(LLoadKeyed* instr) {
3193 if (instr->is_typed_elements()) { 3182 if (instr->is_fixed_typed_array()) {
3194 DoLoadKeyedExternalArray(instr); 3183 DoLoadKeyedExternalArray(instr);
3195 } else if (instr->hydrogen()->representation().IsDouble()) { 3184 } else if (instr->hydrogen()->representation().IsDouble()) {
3196 DoLoadKeyedFixedDoubleArray(instr); 3185 DoLoadKeyedFixedDoubleArray(instr);
3197 } else { 3186 } else {
3198 DoLoadKeyedFixedArray(instr); 3187 DoLoadKeyedFixedArray(instr);
3199 } 3188 }
3200 } 3189 }
3201 3190
3202 3191
3203 Operand LCodeGen::BuildFastArrayOperand( 3192 Operand LCodeGen::BuildFastArrayOperand(
(...skipping 992 matching lines...) Expand 10 before | Expand all | Expand 10 after
4196 ExternalArrayOpRequiresTemp(instr->hydrogen()->key()->representation(), 4185 ExternalArrayOpRequiresTemp(instr->hydrogen()->key()->representation(),
4197 elements_kind)) { 4186 elements_kind)) {
4198 __ SmiUntag(ToRegister(key)); 4187 __ SmiUntag(ToRegister(key));
4199 } 4188 }
4200 Operand operand(BuildFastArrayOperand( 4189 Operand operand(BuildFastArrayOperand(
4201 instr->elements(), 4190 instr->elements(),
4202 key, 4191 key,
4203 instr->hydrogen()->key()->representation(), 4192 instr->hydrogen()->key()->representation(),
4204 elements_kind, 4193 elements_kind,
4205 instr->base_offset())); 4194 instr->base_offset()));
4206 if (elements_kind == EXTERNAL_FLOAT32_ELEMENTS || 4195 if (elements_kind == FLOAT32_ELEMENTS) {
4207 elements_kind == FLOAT32_ELEMENTS) {
4208 XMMRegister xmm_scratch = double_scratch0(); 4196 XMMRegister xmm_scratch = double_scratch0();
4209 __ cvtsd2ss(xmm_scratch, ToDoubleRegister(instr->value())); 4197 __ cvtsd2ss(xmm_scratch, ToDoubleRegister(instr->value()));
4210 __ movss(operand, xmm_scratch); 4198 __ movss(operand, xmm_scratch);
4211 } else if (elements_kind == EXTERNAL_FLOAT64_ELEMENTS || 4199 } else if (elements_kind == FLOAT64_ELEMENTS) {
4212 elements_kind == FLOAT64_ELEMENTS) {
4213 __ movsd(operand, ToDoubleRegister(instr->value())); 4200 __ movsd(operand, ToDoubleRegister(instr->value()));
4214 } else { 4201 } else {
4215 Register value = ToRegister(instr->value()); 4202 Register value = ToRegister(instr->value());
4216 switch (elements_kind) { 4203 switch (elements_kind) {
4217 case EXTERNAL_UINT8_CLAMPED_ELEMENTS:
4218 case EXTERNAL_UINT8_ELEMENTS:
4219 case EXTERNAL_INT8_ELEMENTS:
4220 case UINT8_ELEMENTS: 4204 case UINT8_ELEMENTS:
4221 case INT8_ELEMENTS: 4205 case INT8_ELEMENTS:
4222 case UINT8_CLAMPED_ELEMENTS: 4206 case UINT8_CLAMPED_ELEMENTS:
4223 __ mov_b(operand, value); 4207 __ mov_b(operand, value);
4224 break; 4208 break;
4225 case EXTERNAL_INT16_ELEMENTS:
4226 case EXTERNAL_UINT16_ELEMENTS:
4227 case UINT16_ELEMENTS: 4209 case UINT16_ELEMENTS:
4228 case INT16_ELEMENTS: 4210 case INT16_ELEMENTS:
4229 __ mov_w(operand, value); 4211 __ mov_w(operand, value);
4230 break; 4212 break;
4231 case EXTERNAL_INT32_ELEMENTS:
4232 case EXTERNAL_UINT32_ELEMENTS:
4233 case UINT32_ELEMENTS: 4213 case UINT32_ELEMENTS:
4234 case INT32_ELEMENTS: 4214 case INT32_ELEMENTS:
4235 __ mov(operand, value); 4215 __ mov(operand, value);
4236 break; 4216 break;
4237 case EXTERNAL_FLOAT32_ELEMENTS:
4238 case EXTERNAL_FLOAT64_ELEMENTS:
4239 case FLOAT32_ELEMENTS: 4217 case FLOAT32_ELEMENTS:
4240 case FLOAT64_ELEMENTS: 4218 case FLOAT64_ELEMENTS:
4241 case FAST_SMI_ELEMENTS: 4219 case FAST_SMI_ELEMENTS:
4242 case FAST_ELEMENTS: 4220 case FAST_ELEMENTS:
4243 case FAST_DOUBLE_ELEMENTS: 4221 case FAST_DOUBLE_ELEMENTS:
4244 case FAST_HOLEY_SMI_ELEMENTS: 4222 case FAST_HOLEY_SMI_ELEMENTS:
4245 case FAST_HOLEY_ELEMENTS: 4223 case FAST_HOLEY_ELEMENTS:
4246 case FAST_HOLEY_DOUBLE_ELEMENTS: 4224 case FAST_HOLEY_DOUBLE_ELEMENTS:
4247 case DICTIONARY_ELEMENTS: 4225 case DICTIONARY_ELEMENTS:
4248 case FAST_SLOPPY_ARGUMENTS_ELEMENTS: 4226 case FAST_SLOPPY_ARGUMENTS_ELEMENTS:
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
4314 kSaveFPRegs, 4292 kSaveFPRegs,
4315 EMIT_REMEMBERED_SET, 4293 EMIT_REMEMBERED_SET,
4316 check_needed, 4294 check_needed,
4317 instr->hydrogen()->PointersToHereCheckForValue()); 4295 instr->hydrogen()->PointersToHereCheckForValue());
4318 } 4296 }
4319 } 4297 }
4320 4298
4321 4299
4322 void LCodeGen::DoStoreKeyed(LStoreKeyed* instr) { 4300 void LCodeGen::DoStoreKeyed(LStoreKeyed* instr) {
4323 // By cases...external, fast-double, fast 4301 // By cases...external, fast-double, fast
4324 if (instr->is_typed_elements()) { 4302 if (instr->is_fixed_typed_array()) {
4325 DoStoreKeyedExternalArray(instr); 4303 DoStoreKeyedExternalArray(instr);
4326 } else if (instr->hydrogen()->value()->representation().IsDouble()) { 4304 } else if (instr->hydrogen()->value()->representation().IsDouble()) {
4327 DoStoreKeyedFixedDoubleArray(instr); 4305 DoStoreKeyedFixedDoubleArray(instr);
4328 } else { 4306 } else {
4329 DoStoreKeyedFixedArray(instr); 4307 DoStoreKeyedFixedArray(instr);
4330 } 4308 }
4331 } 4309 }
4332 4310
4333 4311
4334 void LCodeGen::DoStoreKeyedGeneric(LStoreKeyedGeneric* instr) { 4312 void LCodeGen::DoStoreKeyedGeneric(LStoreKeyedGeneric* instr) {
(...skipping 1530 matching lines...) Expand 10 before | Expand all | Expand 10 after
5865 RecordSafepoint(Safepoint::kNoLazyDeopt); 5843 RecordSafepoint(Safepoint::kNoLazyDeopt);
5866 } 5844 }
5867 5845
5868 5846
5869 #undef __ 5847 #undef __
5870 5848
5871 } // namespace internal 5849 } // namespace internal
5872 } // namespace v8 5850 } // namespace v8
5873 5851
5874 #endif // V8_TARGET_ARCH_IA32 5852 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/hydrogen-uint32-analysis.cc ('k') | src/ia32/lithium-ia32.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698