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

Side by Side Diff: src/mips/lithium-codegen-mips.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/lookup.cc ('k') | src/mips/lithium-mips.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.7 1 // Copyright 2012 the V8 project authors. All rights reserved.7
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 3093 matching lines...) Expand 10 before | Expand all | Expand 10 after
3104 Abort(kArrayIndexConstantValueTooBig); 3104 Abort(kArrayIndexConstantValueTooBig);
3105 } 3105 }
3106 } else { 3106 } else {
3107 key = ToRegister(instr->key()); 3107 key = ToRegister(instr->key());
3108 } 3108 }
3109 int element_size_shift = ElementsKindToShiftSize(elements_kind); 3109 int element_size_shift = ElementsKindToShiftSize(elements_kind);
3110 int shift_size = (instr->hydrogen()->key()->representation().IsSmi()) 3110 int shift_size = (instr->hydrogen()->key()->representation().IsSmi())
3111 ? (element_size_shift - kSmiTagSize) : element_size_shift; 3111 ? (element_size_shift - kSmiTagSize) : element_size_shift;
3112 int base_offset = instr->base_offset(); 3112 int base_offset = instr->base_offset();
3113 3113
3114 if (elements_kind == EXTERNAL_FLOAT32_ELEMENTS || 3114 if (elements_kind == FLOAT32_ELEMENTS || elements_kind == FLOAT64_ELEMENTS) {
3115 elements_kind == FLOAT32_ELEMENTS ||
3116 elements_kind == EXTERNAL_FLOAT64_ELEMENTS ||
3117 elements_kind == FLOAT64_ELEMENTS) {
3118 FPURegister result = ToDoubleRegister(instr->result()); 3115 FPURegister result = ToDoubleRegister(instr->result());
3119 if (key_is_constant) { 3116 if (key_is_constant) {
3120 __ Addu(scratch0(), external_pointer, constant_key << element_size_shift); 3117 __ Addu(scratch0(), external_pointer, constant_key << element_size_shift);
3121 } else { 3118 } else {
3122 __ sll(scratch0(), key, shift_size); 3119 __ sll(scratch0(), key, shift_size);
3123 __ Addu(scratch0(), scratch0(), external_pointer); 3120 __ Addu(scratch0(), scratch0(), external_pointer);
3124 } 3121 }
3125 if (elements_kind == EXTERNAL_FLOAT32_ELEMENTS || 3122 if (elements_kind == FLOAT32_ELEMENTS) {
3126 elements_kind == FLOAT32_ELEMENTS) {
3127 __ lwc1(result, MemOperand(scratch0(), base_offset)); 3123 __ lwc1(result, MemOperand(scratch0(), base_offset));
3128 __ cvt_d_s(result, result); 3124 __ cvt_d_s(result, result);
3129 } else { // i.e. elements_kind == EXTERNAL_DOUBLE_ELEMENTS 3125 } else { // i.e. elements_kind == EXTERNAL_DOUBLE_ELEMENTS
3130 __ ldc1(result, MemOperand(scratch0(), base_offset)); 3126 __ ldc1(result, MemOperand(scratch0(), base_offset));
3131 } 3127 }
3132 } else { 3128 } else {
3133 Register result = ToRegister(instr->result()); 3129 Register result = ToRegister(instr->result());
3134 MemOperand mem_operand = PrepareKeyedOperand( 3130 MemOperand mem_operand = PrepareKeyedOperand(
3135 key, external_pointer, key_is_constant, constant_key, 3131 key, external_pointer, key_is_constant, constant_key,
3136 element_size_shift, shift_size, base_offset); 3132 element_size_shift, shift_size, base_offset);
3137 switch (elements_kind) { 3133 switch (elements_kind) {
3138 case EXTERNAL_INT8_ELEMENTS:
3139 case INT8_ELEMENTS: 3134 case INT8_ELEMENTS:
3140 __ lb(result, mem_operand); 3135 __ lb(result, mem_operand);
3141 break; 3136 break;
3142 case EXTERNAL_UINT8_CLAMPED_ELEMENTS:
3143 case EXTERNAL_UINT8_ELEMENTS:
3144 case UINT8_ELEMENTS: 3137 case UINT8_ELEMENTS:
3145 case UINT8_CLAMPED_ELEMENTS: 3138 case UINT8_CLAMPED_ELEMENTS:
3146 __ lbu(result, mem_operand); 3139 __ lbu(result, mem_operand);
3147 break; 3140 break;
3148 case EXTERNAL_INT16_ELEMENTS:
3149 case INT16_ELEMENTS: 3141 case INT16_ELEMENTS:
3150 __ lh(result, mem_operand); 3142 __ lh(result, mem_operand);
3151 break; 3143 break;
3152 case EXTERNAL_UINT16_ELEMENTS:
3153 case UINT16_ELEMENTS: 3144 case UINT16_ELEMENTS:
3154 __ lhu(result, mem_operand); 3145 __ lhu(result, mem_operand);
3155 break; 3146 break;
3156 case EXTERNAL_INT32_ELEMENTS:
3157 case INT32_ELEMENTS: 3147 case INT32_ELEMENTS:
3158 __ lw(result, mem_operand); 3148 __ lw(result, mem_operand);
3159 break; 3149 break;
3160 case EXTERNAL_UINT32_ELEMENTS:
3161 case UINT32_ELEMENTS: 3150 case UINT32_ELEMENTS:
3162 __ lw(result, mem_operand); 3151 __ lw(result, mem_operand);
3163 if (!instr->hydrogen()->CheckFlag(HInstruction::kUint32)) { 3152 if (!instr->hydrogen()->CheckFlag(HInstruction::kUint32)) {
3164 DeoptimizeIf(Ugreater_equal, instr, Deoptimizer::kNegativeValue, 3153 DeoptimizeIf(Ugreater_equal, instr, Deoptimizer::kNegativeValue,
3165 result, Operand(0x80000000)); 3154 result, Operand(0x80000000));
3166 } 3155 }
3167 break; 3156 break;
3168 case FLOAT32_ELEMENTS: 3157 case FLOAT32_ELEMENTS:
3169 case FLOAT64_ELEMENTS: 3158 case FLOAT64_ELEMENTS:
3170 case EXTERNAL_FLOAT32_ELEMENTS:
3171 case EXTERNAL_FLOAT64_ELEMENTS:
3172 case FAST_DOUBLE_ELEMENTS: 3159 case FAST_DOUBLE_ELEMENTS:
3173 case FAST_ELEMENTS: 3160 case FAST_ELEMENTS:
3174 case FAST_SMI_ELEMENTS: 3161 case FAST_SMI_ELEMENTS:
3175 case FAST_HOLEY_DOUBLE_ELEMENTS: 3162 case FAST_HOLEY_DOUBLE_ELEMENTS:
3176 case FAST_HOLEY_ELEMENTS: 3163 case FAST_HOLEY_ELEMENTS:
3177 case FAST_HOLEY_SMI_ELEMENTS: 3164 case FAST_HOLEY_SMI_ELEMENTS:
3178 case DICTIONARY_ELEMENTS: 3165 case DICTIONARY_ELEMENTS:
3179 case FAST_SLOPPY_ARGUMENTS_ELEMENTS: 3166 case FAST_SLOPPY_ARGUMENTS_ELEMENTS:
3180 case SLOW_SLOPPY_ARGUMENTS_ELEMENTS: 3167 case SLOW_SLOPPY_ARGUMENTS_ELEMENTS:
3181 UNREACHABLE(); 3168 UNREACHABLE();
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
3273 DeoptimizeIf(ne, instr, Deoptimizer::kHole, result, 3260 DeoptimizeIf(ne, instr, Deoptimizer::kHole, result,
3274 Operand(Smi::FromInt(Isolate::kArrayProtectorValid))); 3261 Operand(Smi::FromInt(Isolate::kArrayProtectorValid)));
3275 } 3262 }
3276 __ LoadRoot(result, Heap::kUndefinedValueRootIndex); 3263 __ LoadRoot(result, Heap::kUndefinedValueRootIndex);
3277 __ bind(&done); 3264 __ bind(&done);
3278 } 3265 }
3279 } 3266 }
3280 3267
3281 3268
3282 void LCodeGen::DoLoadKeyed(LLoadKeyed* instr) { 3269 void LCodeGen::DoLoadKeyed(LLoadKeyed* instr) {
3283 if (instr->is_typed_elements()) { 3270 if (instr->is_fixed_typed_array()) {
3284 DoLoadKeyedExternalArray(instr); 3271 DoLoadKeyedExternalArray(instr);
3285 } else if (instr->hydrogen()->representation().IsDouble()) { 3272 } else if (instr->hydrogen()->representation().IsDouble()) {
3286 DoLoadKeyedFixedDoubleArray(instr); 3273 DoLoadKeyedFixedDoubleArray(instr);
3287 } else { 3274 } else {
3288 DoLoadKeyedFixedArray(instr); 3275 DoLoadKeyedFixedArray(instr);
3289 } 3276 }
3290 } 3277 }
3291 3278
3292 3279
3293 MemOperand LCodeGen::PrepareKeyedOperand(Register key, 3280 MemOperand LCodeGen::PrepareKeyedOperand(Register key,
(...skipping 971 matching lines...) Expand 10 before | Expand all | Expand 10 after
4265 Abort(kArrayIndexConstantValueTooBig); 4252 Abort(kArrayIndexConstantValueTooBig);
4266 } 4253 }
4267 } else { 4254 } else {
4268 key = ToRegister(instr->key()); 4255 key = ToRegister(instr->key());
4269 } 4256 }
4270 int element_size_shift = ElementsKindToShiftSize(elements_kind); 4257 int element_size_shift = ElementsKindToShiftSize(elements_kind);
4271 int shift_size = (instr->hydrogen()->key()->representation().IsSmi()) 4258 int shift_size = (instr->hydrogen()->key()->representation().IsSmi())
4272 ? (element_size_shift - kSmiTagSize) : element_size_shift; 4259 ? (element_size_shift - kSmiTagSize) : element_size_shift;
4273 int base_offset = instr->base_offset(); 4260 int base_offset = instr->base_offset();
4274 4261
4275 if (elements_kind == EXTERNAL_FLOAT32_ELEMENTS || 4262 if (elements_kind == FLOAT32_ELEMENTS || elements_kind == FLOAT64_ELEMENTS) {
4276 elements_kind == FLOAT32_ELEMENTS ||
4277 elements_kind == EXTERNAL_FLOAT64_ELEMENTS ||
4278 elements_kind == FLOAT64_ELEMENTS) {
4279 Register address = scratch0(); 4263 Register address = scratch0();
4280 FPURegister value(ToDoubleRegister(instr->value())); 4264 FPURegister value(ToDoubleRegister(instr->value()));
4281 if (key_is_constant) { 4265 if (key_is_constant) {
4282 if (constant_key != 0) { 4266 if (constant_key != 0) {
4283 __ Addu(address, external_pointer, 4267 __ Addu(address, external_pointer,
4284 Operand(constant_key << element_size_shift)); 4268 Operand(constant_key << element_size_shift));
4285 } else { 4269 } else {
4286 address = external_pointer; 4270 address = external_pointer;
4287 } 4271 }
4288 } else { 4272 } else {
4289 __ sll(address, key, shift_size); 4273 __ sll(address, key, shift_size);
4290 __ Addu(address, external_pointer, address); 4274 __ Addu(address, external_pointer, address);
4291 } 4275 }
4292 4276
4293 if (elements_kind == EXTERNAL_FLOAT32_ELEMENTS || 4277 if (elements_kind == FLOAT32_ELEMENTS) {
4294 elements_kind == FLOAT32_ELEMENTS) {
4295 __ cvt_s_d(double_scratch0(), value); 4278 __ cvt_s_d(double_scratch0(), value);
4296 __ swc1(double_scratch0(), MemOperand(address, base_offset)); 4279 __ swc1(double_scratch0(), MemOperand(address, base_offset));
4297 } else { // Storing doubles, not floats. 4280 } else { // Storing doubles, not floats.
4298 __ sdc1(value, MemOperand(address, base_offset)); 4281 __ sdc1(value, MemOperand(address, base_offset));
4299 } 4282 }
4300 } else { 4283 } else {
4301 Register value(ToRegister(instr->value())); 4284 Register value(ToRegister(instr->value()));
4302 MemOperand mem_operand = PrepareKeyedOperand( 4285 MemOperand mem_operand = PrepareKeyedOperand(
4303 key, external_pointer, key_is_constant, constant_key, 4286 key, external_pointer, key_is_constant, constant_key,
4304 element_size_shift, shift_size, 4287 element_size_shift, shift_size,
4305 base_offset); 4288 base_offset);
4306 switch (elements_kind) { 4289 switch (elements_kind) {
4307 case EXTERNAL_UINT8_CLAMPED_ELEMENTS:
4308 case EXTERNAL_INT8_ELEMENTS:
4309 case EXTERNAL_UINT8_ELEMENTS:
4310 case UINT8_ELEMENTS: 4290 case UINT8_ELEMENTS:
4311 case UINT8_CLAMPED_ELEMENTS: 4291 case UINT8_CLAMPED_ELEMENTS:
4312 case INT8_ELEMENTS: 4292 case INT8_ELEMENTS:
4313 __ sb(value, mem_operand); 4293 __ sb(value, mem_operand);
4314 break; 4294 break;
4315 case EXTERNAL_INT16_ELEMENTS:
4316 case EXTERNAL_UINT16_ELEMENTS:
4317 case INT16_ELEMENTS: 4295 case INT16_ELEMENTS:
4318 case UINT16_ELEMENTS: 4296 case UINT16_ELEMENTS:
4319 __ sh(value, mem_operand); 4297 __ sh(value, mem_operand);
4320 break; 4298 break;
4321 case EXTERNAL_INT32_ELEMENTS:
4322 case EXTERNAL_UINT32_ELEMENTS:
4323 case INT32_ELEMENTS: 4299 case INT32_ELEMENTS:
4324 case UINT32_ELEMENTS: 4300 case UINT32_ELEMENTS:
4325 __ sw(value, mem_operand); 4301 __ sw(value, mem_operand);
4326 break; 4302 break;
4327 case FLOAT32_ELEMENTS: 4303 case FLOAT32_ELEMENTS:
4328 case FLOAT64_ELEMENTS: 4304 case FLOAT64_ELEMENTS:
4329 case EXTERNAL_FLOAT32_ELEMENTS:
4330 case EXTERNAL_FLOAT64_ELEMENTS:
4331 case FAST_DOUBLE_ELEMENTS: 4305 case FAST_DOUBLE_ELEMENTS:
4332 case FAST_ELEMENTS: 4306 case FAST_ELEMENTS:
4333 case FAST_SMI_ELEMENTS: 4307 case FAST_SMI_ELEMENTS:
4334 case FAST_HOLEY_DOUBLE_ELEMENTS: 4308 case FAST_HOLEY_DOUBLE_ELEMENTS:
4335 case FAST_HOLEY_ELEMENTS: 4309 case FAST_HOLEY_ELEMENTS:
4336 case FAST_HOLEY_SMI_ELEMENTS: 4310 case FAST_HOLEY_SMI_ELEMENTS:
4337 case DICTIONARY_ELEMENTS: 4311 case DICTIONARY_ELEMENTS:
4338 case FAST_SLOPPY_ARGUMENTS_ELEMENTS: 4312 case FAST_SLOPPY_ARGUMENTS_ELEMENTS:
4339 case SLOW_SLOPPY_ARGUMENTS_ELEMENTS: 4313 case SLOW_SLOPPY_ARGUMENTS_ELEMENTS:
4340 UNREACHABLE(); 4314 UNREACHABLE();
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
4434 kSaveFPRegs, 4408 kSaveFPRegs,
4435 EMIT_REMEMBERED_SET, 4409 EMIT_REMEMBERED_SET,
4436 check_needed, 4410 check_needed,
4437 instr->hydrogen()->PointersToHereCheckForValue()); 4411 instr->hydrogen()->PointersToHereCheckForValue());
4438 } 4412 }
4439 } 4413 }
4440 4414
4441 4415
4442 void LCodeGen::DoStoreKeyed(LStoreKeyed* instr) { 4416 void LCodeGen::DoStoreKeyed(LStoreKeyed* instr) {
4443 // By cases: external, fast double 4417 // By cases: external, fast double
4444 if (instr->is_typed_elements()) { 4418 if (instr->is_fixed_typed_array()) {
4445 DoStoreKeyedExternalArray(instr); 4419 DoStoreKeyedExternalArray(instr);
4446 } else if (instr->hydrogen()->value()->representation().IsDouble()) { 4420 } else if (instr->hydrogen()->value()->representation().IsDouble()) {
4447 DoStoreKeyedFixedDoubleArray(instr); 4421 DoStoreKeyedFixedDoubleArray(instr);
4448 } else { 4422 } else {
4449 DoStoreKeyedFixedArray(instr); 4423 DoStoreKeyedFixedArray(instr);
4450 } 4424 }
4451 } 4425 }
4452 4426
4453 4427
4454 void LCodeGen::DoStoreKeyedGeneric(LStoreKeyedGeneric* instr) { 4428 void LCodeGen::DoStoreKeyedGeneric(LStoreKeyedGeneric* instr) {
(...skipping 1631 matching lines...) Expand 10 before | Expand all | Expand 10 after
6086 __ Push(at, ToRegister(instr->function())); 6060 __ Push(at, ToRegister(instr->function()));
6087 CallRuntime(Runtime::kPushBlockContext, 2, instr); 6061 CallRuntime(Runtime::kPushBlockContext, 2, instr);
6088 RecordSafepoint(Safepoint::kNoLazyDeopt); 6062 RecordSafepoint(Safepoint::kNoLazyDeopt);
6089 } 6063 }
6090 6064
6091 6065
6092 #undef __ 6066 #undef __
6093 6067
6094 } // namespace internal 6068 } // namespace internal
6095 } // namespace v8 6069 } // namespace v8
OLDNEW
« no previous file with comments | « src/lookup.cc ('k') | src/mips/lithium-mips.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698