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

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

Issue 145133013: External Array renaming and boilerplate scrapping (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 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 | Annotate | Revision Log
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 3057 matching lines...) Expand 10 before | Expand all | Expand 10 after
3068 } else { 3068 } else {
3069 key = ToRegister(instr->key()); 3069 key = ToRegister(instr->key());
3070 } 3070 }
3071 int element_size_shift = ElementsKindToShiftSize(elements_kind); 3071 int element_size_shift = ElementsKindToShiftSize(elements_kind);
3072 int shift_size = (instr->hydrogen()->key()->representation().IsSmi()) 3072 int shift_size = (instr->hydrogen()->key()->representation().IsSmi())
3073 ? (element_size_shift - kSmiTagSize) : element_size_shift; 3073 ? (element_size_shift - kSmiTagSize) : element_size_shift;
3074 int additional_offset = IsFixedTypedArrayElementsKind(elements_kind) 3074 int additional_offset = IsFixedTypedArrayElementsKind(elements_kind)
3075 ? FixedTypedArrayBase::kDataOffset - kHeapObjectTag 3075 ? FixedTypedArrayBase::kDataOffset - kHeapObjectTag
3076 : 0; 3076 : 0;
3077 3077
3078 if (elements_kind == EXTERNAL_FLOAT_ELEMENTS || 3078 if (elements_kind == EXTERNAL_FLOAT32_ELEMENTS ||
3079 elements_kind == FLOAT32_ELEMENTS || 3079 elements_kind == FLOAT32_ELEMENTS ||
3080 elements_kind == EXTERNAL_DOUBLE_ELEMENTS || 3080 elements_kind == EXTERNAL_FLOAT64_ELEMENTS ||
3081 elements_kind == FLOAT64_ELEMENTS) { 3081 elements_kind == FLOAT64_ELEMENTS) {
3082 int base_offset = 3082 int base_offset =
3083 (instr->additional_index() << element_size_shift) + additional_offset; 3083 (instr->additional_index() << element_size_shift) + additional_offset;
3084 FPURegister result = ToDoubleRegister(instr->result()); 3084 FPURegister result = ToDoubleRegister(instr->result());
3085 if (key_is_constant) { 3085 if (key_is_constant) {
3086 __ Addu(scratch0(), external_pointer, constant_key << element_size_shift); 3086 __ Addu(scratch0(), external_pointer, constant_key << element_size_shift);
3087 } else { 3087 } else {
3088 __ sll(scratch0(), key, shift_size); 3088 __ sll(scratch0(), key, shift_size);
3089 __ Addu(scratch0(), scratch0(), external_pointer); 3089 __ Addu(scratch0(), scratch0(), external_pointer);
3090 } 3090 }
3091 if (elements_kind == EXTERNAL_FLOAT_ELEMENTS || 3091 if (elements_kind == EXTERNAL_FLOAT32_ELEMENTS ||
3092 elements_kind == FLOAT32_ELEMENTS) { 3092 elements_kind == FLOAT32_ELEMENTS) {
3093 __ lwc1(result, MemOperand(scratch0(), base_offset)); 3093 __ lwc1(result, MemOperand(scratch0(), base_offset));
3094 __ cvt_d_s(result, result); 3094 __ cvt_d_s(result, result);
3095 } else { // loading doubles, not floats. 3095 } else { // loading doubles, not floats.
3096 __ ldc1(result, MemOperand(scratch0(), base_offset)); 3096 __ ldc1(result, MemOperand(scratch0(), base_offset));
3097 } 3097 }
3098 } else { 3098 } else {
3099 Register result = ToRegister(instr->result()); 3099 Register result = ToRegister(instr->result());
3100 MemOperand mem_operand = PrepareKeyedOperand( 3100 MemOperand mem_operand = PrepareKeyedOperand(
3101 key, external_pointer, key_is_constant, constant_key, 3101 key, external_pointer, key_is_constant, constant_key,
3102 element_size_shift, shift_size, 3102 element_size_shift, shift_size,
3103 instr->additional_index(), additional_offset); 3103 instr->additional_index(), additional_offset);
3104 switch (elements_kind) { 3104 switch (elements_kind) {
3105 case EXTERNAL_BYTE_ELEMENTS: 3105 case EXTERNAL_INT8_ELEMENTS:
3106 case INT8_ELEMENTS: 3106 case INT8_ELEMENTS:
3107 __ lb(result, mem_operand); 3107 __ lb(result, mem_operand);
3108 break; 3108 break;
3109 case EXTERNAL_PIXEL_ELEMENTS: 3109 case EXTERNAL_UINT8_CLAMPED_ELEMENTS:
3110 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: 3110 case EXTERNAL_UINT8_ELEMENTS:
3111 case UINT8_ELEMENTS: 3111 case UINT8_ELEMENTS:
3112 case UINT8_CLAMPED_ELEMENTS: 3112 case UINT8_CLAMPED_ELEMENTS:
3113 __ lbu(result, mem_operand); 3113 __ lbu(result, mem_operand);
3114 break; 3114 break;
3115 case EXTERNAL_SHORT_ELEMENTS: 3115 case EXTERNAL_INT16_ELEMENTS:
3116 case INT16_ELEMENTS: 3116 case INT16_ELEMENTS:
3117 __ lh(result, mem_operand); 3117 __ lh(result, mem_operand);
3118 break; 3118 break;
3119 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS: 3119 case EXTERNAL_UINT16_ELEMENTS:
3120 case UINT16_ELEMENTS: 3120 case UINT16_ELEMENTS:
3121 __ lhu(result, mem_operand); 3121 __ lhu(result, mem_operand);
3122 break; 3122 break;
3123 case EXTERNAL_INT_ELEMENTS: 3123 case EXTERNAL_INT32_ELEMENTS:
3124 case INT32_ELEMENTS: 3124 case INT32_ELEMENTS:
3125 __ lw(result, mem_operand); 3125 __ lw(result, mem_operand);
3126 break; 3126 break;
3127 case EXTERNAL_UNSIGNED_INT_ELEMENTS: 3127 case EXTERNAL_UINT32_ELEMENTS:
3128 case UINT32_ELEMENTS: 3128 case UINT32_ELEMENTS:
3129 __ lw(result, mem_operand); 3129 __ lw(result, mem_operand);
3130 if (!instr->hydrogen()->CheckFlag(HInstruction::kUint32)) { 3130 if (!instr->hydrogen()->CheckFlag(HInstruction::kUint32)) {
3131 DeoptimizeIf(Ugreater_equal, instr->environment(), 3131 DeoptimizeIf(Ugreater_equal, instr->environment(),
3132 result, Operand(0x80000000)); 3132 result, Operand(0x80000000));
3133 } 3133 }
3134 break; 3134 break;
3135 case FLOAT32_ELEMENTS: 3135 case FLOAT32_ELEMENTS:
3136 case FLOAT64_ELEMENTS: 3136 case FLOAT64_ELEMENTS:
3137 case EXTERNAL_FLOAT_ELEMENTS: 3137 case EXTERNAL_FLOAT32_ELEMENTS:
3138 case EXTERNAL_DOUBLE_ELEMENTS: 3138 case EXTERNAL_FLOAT64_ELEMENTS:
3139 case FAST_DOUBLE_ELEMENTS: 3139 case FAST_DOUBLE_ELEMENTS:
3140 case FAST_ELEMENTS: 3140 case FAST_ELEMENTS:
3141 case FAST_SMI_ELEMENTS: 3141 case FAST_SMI_ELEMENTS:
3142 case FAST_HOLEY_DOUBLE_ELEMENTS: 3142 case FAST_HOLEY_DOUBLE_ELEMENTS:
3143 case FAST_HOLEY_ELEMENTS: 3143 case FAST_HOLEY_ELEMENTS:
3144 case FAST_HOLEY_SMI_ELEMENTS: 3144 case FAST_HOLEY_SMI_ELEMENTS:
3145 case DICTIONARY_ELEMENTS: 3145 case DICTIONARY_ELEMENTS:
3146 case NON_STRICT_ARGUMENTS_ELEMENTS: 3146 case NON_STRICT_ARGUMENTS_ELEMENTS:
3147 UNREACHABLE(); 3147 UNREACHABLE();
3148 break; 3148 break;
(...skipping 1044 matching lines...) Expand 10 before | Expand all | Expand 10 after
4193 } else { 4193 } else {
4194 key = ToRegister(instr->key()); 4194 key = ToRegister(instr->key());
4195 } 4195 }
4196 int element_size_shift = ElementsKindToShiftSize(elements_kind); 4196 int element_size_shift = ElementsKindToShiftSize(elements_kind);
4197 int shift_size = (instr->hydrogen()->key()->representation().IsSmi()) 4197 int shift_size = (instr->hydrogen()->key()->representation().IsSmi())
4198 ? (element_size_shift - kSmiTagSize) : element_size_shift; 4198 ? (element_size_shift - kSmiTagSize) : element_size_shift;
4199 int additional_offset = IsFixedTypedArrayElementsKind(elements_kind) 4199 int additional_offset = IsFixedTypedArrayElementsKind(elements_kind)
4200 ? FixedTypedArrayBase::kDataOffset - kHeapObjectTag 4200 ? FixedTypedArrayBase::kDataOffset - kHeapObjectTag
4201 : 0; 4201 : 0;
4202 4202
4203 if (elements_kind == EXTERNAL_FLOAT_ELEMENTS || 4203 if (elements_kind == EXTERNAL_FLOAT32_ELEMENTS ||
4204 elements_kind == FLOAT32_ELEMENTS || 4204 elements_kind == FLOAT32_ELEMENTS ||
4205 elements_kind == EXTERNAL_DOUBLE_ELEMENTS || 4205 elements_kind == EXTERNAL_FLOAT64_ELEMENTS ||
4206 elements_kind == FLOAT64_ELEMENTS) { 4206 elements_kind == FLOAT64_ELEMENTS) {
4207 int base_offset = 4207 int base_offset =
4208 (instr->additional_index() << element_size_shift) + additional_offset; 4208 (instr->additional_index() << element_size_shift) + additional_offset;
4209 Register address = scratch0(); 4209 Register address = scratch0();
4210 FPURegister value(ToDoubleRegister(instr->value())); 4210 FPURegister value(ToDoubleRegister(instr->value()));
4211 if (key_is_constant) { 4211 if (key_is_constant) {
4212 if (constant_key != 0) { 4212 if (constant_key != 0) {
4213 __ Addu(address, external_pointer, 4213 __ Addu(address, external_pointer,
4214 Operand(constant_key << element_size_shift)); 4214 Operand(constant_key << element_size_shift));
4215 } else { 4215 } else {
4216 address = external_pointer; 4216 address = external_pointer;
4217 } 4217 }
4218 } else { 4218 } else {
4219 __ sll(address, key, shift_size); 4219 __ sll(address, key, shift_size);
4220 __ Addu(address, external_pointer, address); 4220 __ Addu(address, external_pointer, address);
4221 } 4221 }
4222 4222
4223 if (elements_kind == EXTERNAL_FLOAT_ELEMENTS || 4223 if (elements_kind == EXTERNAL_FLOAT32_ELEMENTS ||
4224 elements_kind == FLOAT32_ELEMENTS) { 4224 elements_kind == FLOAT32_ELEMENTS) {
4225 __ cvt_s_d(double_scratch0(), value); 4225 __ cvt_s_d(double_scratch0(), value);
4226 __ swc1(double_scratch0(), MemOperand(address, base_offset)); 4226 __ swc1(double_scratch0(), MemOperand(address, base_offset));
4227 } else { // Storing doubles, not floats. 4227 } else { // Storing doubles, not floats.
4228 __ sdc1(value, MemOperand(address, base_offset)); 4228 __ sdc1(value, MemOperand(address, base_offset));
4229 } 4229 }
4230 } else { 4230 } else {
4231 Register value(ToRegister(instr->value())); 4231 Register value(ToRegister(instr->value()));
4232 MemOperand mem_operand = PrepareKeyedOperand( 4232 MemOperand mem_operand = PrepareKeyedOperand(
4233 key, external_pointer, key_is_constant, constant_key, 4233 key, external_pointer, key_is_constant, constant_key,
4234 element_size_shift, shift_size, 4234 element_size_shift, shift_size,
4235 instr->additional_index(), additional_offset); 4235 instr->additional_index(), additional_offset);
4236 switch (elements_kind) { 4236 switch (elements_kind) {
4237 case EXTERNAL_PIXEL_ELEMENTS: 4237 case EXTERNAL_UINT8_CLAMPED_ELEMENTS:
4238 case EXTERNAL_BYTE_ELEMENTS: 4238 case EXTERNAL_INT8_ELEMENTS:
4239 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: 4239 case EXTERNAL_UINT8_ELEMENTS:
4240 case UINT8_ELEMENTS: 4240 case UINT8_ELEMENTS:
4241 case UINT8_CLAMPED_ELEMENTS: 4241 case UINT8_CLAMPED_ELEMENTS:
4242 case INT8_ELEMENTS: 4242 case INT8_ELEMENTS:
4243 __ sb(value, mem_operand); 4243 __ sb(value, mem_operand);
4244 break; 4244 break;
4245 case EXTERNAL_SHORT_ELEMENTS: 4245 case EXTERNAL_INT16_ELEMENTS:
4246 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS: 4246 case EXTERNAL_UINT16_ELEMENTS:
4247 case INT16_ELEMENTS: 4247 case INT16_ELEMENTS:
4248 case UINT16_ELEMENTS: 4248 case UINT16_ELEMENTS:
4249 __ sh(value, mem_operand); 4249 __ sh(value, mem_operand);
4250 break; 4250 break;
4251 case EXTERNAL_INT_ELEMENTS: 4251 case EXTERNAL_INT32_ELEMENTS:
4252 case EXTERNAL_UNSIGNED_INT_ELEMENTS: 4252 case EXTERNAL_UINT32_ELEMENTS:
4253 case INT32_ELEMENTS: 4253 case INT32_ELEMENTS:
4254 case UINT32_ELEMENTS: 4254 case UINT32_ELEMENTS:
4255 __ sw(value, mem_operand); 4255 __ sw(value, mem_operand);
4256 break; 4256 break;
4257 case FLOAT32_ELEMENTS: 4257 case FLOAT32_ELEMENTS:
4258 case FLOAT64_ELEMENTS: 4258 case FLOAT64_ELEMENTS:
4259 case EXTERNAL_FLOAT_ELEMENTS: 4259 case EXTERNAL_FLOAT32_ELEMENTS:
4260 case EXTERNAL_DOUBLE_ELEMENTS: 4260 case EXTERNAL_FLOAT64_ELEMENTS:
4261 case FAST_DOUBLE_ELEMENTS: 4261 case FAST_DOUBLE_ELEMENTS:
4262 case FAST_ELEMENTS: 4262 case FAST_ELEMENTS:
4263 case FAST_SMI_ELEMENTS: 4263 case FAST_SMI_ELEMENTS:
4264 case FAST_HOLEY_DOUBLE_ELEMENTS: 4264 case FAST_HOLEY_DOUBLE_ELEMENTS:
4265 case FAST_HOLEY_ELEMENTS: 4265 case FAST_HOLEY_ELEMENTS:
4266 case FAST_HOLEY_SMI_ELEMENTS: 4266 case FAST_HOLEY_SMI_ELEMENTS:
4267 case DICTIONARY_ELEMENTS: 4267 case DICTIONARY_ELEMENTS:
4268 case NON_STRICT_ARGUMENTS_ELEMENTS: 4268 case NON_STRICT_ARGUMENTS_ELEMENTS:
4269 UNREACHABLE(); 4269 UNREACHABLE();
4270 break; 4270 break;
(...skipping 1545 matching lines...) Expand 10 before | Expand all | Expand 10 after
5816 __ Subu(scratch, result, scratch); 5816 __ Subu(scratch, result, scratch);
5817 __ lw(result, FieldMemOperand(scratch, 5817 __ lw(result, FieldMemOperand(scratch,
5818 FixedArray::kHeaderSize - kPointerSize)); 5818 FixedArray::kHeaderSize - kPointerSize));
5819 __ bind(&done); 5819 __ bind(&done);
5820 } 5820 }
5821 5821
5822 5822
5823 #undef __ 5823 #undef __
5824 5824
5825 } } // namespace v8::internal 5825 } } // namespace v8::internal
OLDNEW
« src/api.cc ('K') | « src/ia32/lithium-ia32.cc ('k') | src/mips/lithium-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698