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

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

Issue 101413006: Implement in-heap backing store for typed arrays. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: GC fixes 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
« no previous file with comments | « src/third_party/vtune/vtune-jit.cc ('k') | src/x64/lithium-x64.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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 the V8 project authors. All rights reserved.
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 2945 matching lines...) Expand 10 before | Expand all | Expand 10 after
2956 // the input representation for the key to be an integer, the input 2956 // the input representation for the key to be an integer, the input
2957 // gets replaced during bound check elimination with the index argument 2957 // gets replaced during bound check elimination with the index argument
2958 // to the bounds check, which can be tagged, so that case must be 2958 // to the bounds check, which can be tagged, so that case must be
2959 // handled here, too. 2959 // handled here, too.
2960 if (instr->hydrogen()->IsDehoisted()) { 2960 if (instr->hydrogen()->IsDehoisted()) {
2961 // Sign extend key because it could be a 32 bit negative value 2961 // Sign extend key because it could be a 32 bit negative value
2962 // and the dehoisted address computation happens in 64 bits 2962 // and the dehoisted address computation happens in 64 bits
2963 __ movsxlq(key_reg, key_reg); 2963 __ movsxlq(key_reg, key_reg);
2964 } 2964 }
2965 } 2965 }
2966 int base_offset = instr->is_fixed_typed_array()
2967 ? FixedTypedArrayBase::kDataOffset - kHeapObjectTag
2968 : 0;
2966 Operand operand(BuildFastArrayOperand( 2969 Operand operand(BuildFastArrayOperand(
2967 instr->elements(), 2970 instr->elements(),
2968 key, 2971 key,
2969 elements_kind, 2972 elements_kind,
2970 0, 2973 base_offset,
2971 instr->additional_index())); 2974 instr->additional_index()));
2972 2975
2973 if (elements_kind == EXTERNAL_FLOAT_ELEMENTS) { 2976 if (elements_kind == EXTERNAL_FLOAT_ELEMENTS ||
2977 elements_kind == FLOAT32_ELEMENTS) {
2974 XMMRegister result(ToDoubleRegister(instr->result())); 2978 XMMRegister result(ToDoubleRegister(instr->result()));
2975 __ movss(result, operand); 2979 __ movss(result, operand);
2976 __ cvtss2sd(result, result); 2980 __ cvtss2sd(result, result);
2977 } else if (elements_kind == EXTERNAL_DOUBLE_ELEMENTS) { 2981 } else if (elements_kind == EXTERNAL_DOUBLE_ELEMENTS ||
2982 elements_kind == FLOAT64_ELEMENTS) {
2978 __ movsd(ToDoubleRegister(instr->result()), operand); 2983 __ movsd(ToDoubleRegister(instr->result()), operand);
2979 } else { 2984 } else {
2980 Register result(ToRegister(instr->result())); 2985 Register result(ToRegister(instr->result()));
2981 switch (elements_kind) { 2986 switch (elements_kind) {
2982 case EXTERNAL_BYTE_ELEMENTS: 2987 case EXTERNAL_BYTE_ELEMENTS:
2988 case INT8_ELEMENTS:
2983 __ movsxbq(result, operand); 2989 __ movsxbq(result, operand);
2984 break; 2990 break;
2985 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: 2991 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS:
2986 case EXTERNAL_PIXEL_ELEMENTS: 2992 case EXTERNAL_PIXEL_ELEMENTS:
2993 case UINT8_ELEMENTS:
2994 case UINT8_CLAMPED_ELEMENTS:
2987 __ movzxbq(result, operand); 2995 __ movzxbq(result, operand);
2988 break; 2996 break;
2989 case EXTERNAL_SHORT_ELEMENTS: 2997 case EXTERNAL_SHORT_ELEMENTS:
2998 case INT16_ELEMENTS:
2990 __ movsxwq(result, operand); 2999 __ movsxwq(result, operand);
2991 break; 3000 break;
2992 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS: 3001 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS:
3002 case UINT16_ELEMENTS:
2993 __ movzxwq(result, operand); 3003 __ movzxwq(result, operand);
2994 break; 3004 break;
2995 case EXTERNAL_INT_ELEMENTS: 3005 case EXTERNAL_INT_ELEMENTS:
3006 case INT32_ELEMENTS:
2996 __ movsxlq(result, operand); 3007 __ movsxlq(result, operand);
2997 break; 3008 break;
2998 case EXTERNAL_UNSIGNED_INT_ELEMENTS: 3009 case EXTERNAL_UNSIGNED_INT_ELEMENTS:
3010 case UINT32_ELEMENTS:
2999 __ movl(result, operand); 3011 __ movl(result, operand);
3000 if (!instr->hydrogen()->CheckFlag(HInstruction::kUint32)) { 3012 if (!instr->hydrogen()->CheckFlag(HInstruction::kUint32)) {
3001 __ testl(result, result); 3013 __ testl(result, result);
3002 DeoptimizeIf(negative, instr->environment()); 3014 DeoptimizeIf(negative, instr->environment());
3003 } 3015 }
3004 break; 3016 break;
3005 case EXTERNAL_FLOAT_ELEMENTS: 3017 case EXTERNAL_FLOAT_ELEMENTS:
3006 case EXTERNAL_DOUBLE_ELEMENTS: 3018 case EXTERNAL_DOUBLE_ELEMENTS:
3019 case FLOAT32_ELEMENTS:
3020 case FLOAT64_ELEMENTS:
3007 case FAST_ELEMENTS: 3021 case FAST_ELEMENTS:
3008 case FAST_SMI_ELEMENTS: 3022 case FAST_SMI_ELEMENTS:
3009 case FAST_DOUBLE_ELEMENTS: 3023 case FAST_DOUBLE_ELEMENTS:
3010 case FAST_HOLEY_ELEMENTS: 3024 case FAST_HOLEY_ELEMENTS:
3011 case FAST_HOLEY_SMI_ELEMENTS: 3025 case FAST_HOLEY_SMI_ELEMENTS:
3012 case FAST_HOLEY_DOUBLE_ELEMENTS: 3026 case FAST_HOLEY_DOUBLE_ELEMENTS:
3013 case DICTIONARY_ELEMENTS: 3027 case DICTIONARY_ELEMENTS:
3014 case NON_STRICT_ARGUMENTS_ELEMENTS: 3028 case NON_STRICT_ARGUMENTS_ELEMENTS:
3015 UNREACHABLE(); 3029 UNREACHABLE();
3016 break; 3030 break;
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
3104 DeoptimizeIf(NegateCondition(smi), instr->environment()); 3118 DeoptimizeIf(NegateCondition(smi), instr->environment());
3105 } else { 3119 } else {
3106 __ CompareRoot(result, Heap::kTheHoleValueRootIndex); 3120 __ CompareRoot(result, Heap::kTheHoleValueRootIndex);
3107 DeoptimizeIf(equal, instr->environment()); 3121 DeoptimizeIf(equal, instr->environment());
3108 } 3122 }
3109 } 3123 }
3110 } 3124 }
3111 3125
3112 3126
3113 void LCodeGen::DoLoadKeyed(LLoadKeyed* instr) { 3127 void LCodeGen::DoLoadKeyed(LLoadKeyed* instr) {
3114 if (instr->is_external()) { 3128 if (instr->is_typed_elements()) {
3115 DoLoadKeyedExternalArray(instr); 3129 DoLoadKeyedExternalArray(instr);
3116 } else if (instr->hydrogen()->representation().IsDouble()) { 3130 } else if (instr->hydrogen()->representation().IsDouble()) {
3117 DoLoadKeyedFixedDoubleArray(instr); 3131 DoLoadKeyedFixedDoubleArray(instr);
3118 } else { 3132 } else {
3119 DoLoadKeyedFixedArray(instr); 3133 DoLoadKeyedFixedArray(instr);
3120 } 3134 }
3121 } 3135 }
3122 3136
3123 3137
3124 Operand LCodeGen::BuildFastArrayOperand( 3138 Operand LCodeGen::BuildFastArrayOperand(
(...skipping 1010 matching lines...) Expand 10 before | Expand all | Expand 10 after
4135 // the input representation for the key to be an integer, the input 4149 // the input representation for the key to be an integer, the input
4136 // gets replaced during bound check elimination with the index 4150 // gets replaced during bound check elimination with the index
4137 // argument to the bounds check, which can be tagged, so that case 4151 // argument to the bounds check, which can be tagged, so that case
4138 // must be handled here, too. 4152 // must be handled here, too.
4139 if (instr->hydrogen()->IsDehoisted()) { 4153 if (instr->hydrogen()->IsDehoisted()) {
4140 // Sign extend key because it could be a 32 bit negative value 4154 // Sign extend key because it could be a 32 bit negative value
4141 // and the dehoisted address computation happens in 64 bits 4155 // and the dehoisted address computation happens in 64 bits
4142 __ movsxlq(key_reg, key_reg); 4156 __ movsxlq(key_reg, key_reg);
4143 } 4157 }
4144 } 4158 }
4159 int base_offset = instr->is_fixed_typed_array()
4160 ? FixedTypedArrayBase::kDataOffset - kHeapObjectTag
4161 : 0;
4145 Operand operand(BuildFastArrayOperand( 4162 Operand operand(BuildFastArrayOperand(
4146 instr->elements(), 4163 instr->elements(),
4147 key, 4164 key,
4148 elements_kind, 4165 elements_kind,
4149 0, 4166 base_offset,
4150 instr->additional_index())); 4167 instr->additional_index()));
4151 4168
4152 if (elements_kind == EXTERNAL_FLOAT_ELEMENTS) { 4169 if (elements_kind == EXTERNAL_FLOAT_ELEMENTS ||
4170 elements_kind == FLOAT32_ELEMENTS) {
4153 XMMRegister value(ToDoubleRegister(instr->value())); 4171 XMMRegister value(ToDoubleRegister(instr->value()));
4154 __ cvtsd2ss(value, value); 4172 __ cvtsd2ss(value, value);
4155 __ movss(operand, value); 4173 __ movss(operand, value);
4156 } else if (elements_kind == EXTERNAL_DOUBLE_ELEMENTS) { 4174 } else if (elements_kind == EXTERNAL_DOUBLE_ELEMENTS ||
4175 elements_kind == FLOAT64_ELEMENTS) {
4157 __ movsd(operand, ToDoubleRegister(instr->value())); 4176 __ movsd(operand, ToDoubleRegister(instr->value()));
4158 } else { 4177 } else {
4159 Register value(ToRegister(instr->value())); 4178 Register value(ToRegister(instr->value()));
4160 switch (elements_kind) { 4179 switch (elements_kind) {
4161 case EXTERNAL_PIXEL_ELEMENTS: 4180 case EXTERNAL_PIXEL_ELEMENTS:
4162 case EXTERNAL_BYTE_ELEMENTS: 4181 case EXTERNAL_BYTE_ELEMENTS:
4163 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: 4182 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS:
4183 case INT8_ELEMENTS:
4184 case UINT8_ELEMENTS:
4185 case UINT8_CLAMPED_ELEMENTS:
4164 __ movb(operand, value); 4186 __ movb(operand, value);
4165 break; 4187 break;
4166 case EXTERNAL_SHORT_ELEMENTS: 4188 case EXTERNAL_SHORT_ELEMENTS:
4167 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS: 4189 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS:
4190 case INT16_ELEMENTS:
4191 case UINT16_ELEMENTS:
4168 __ movw(operand, value); 4192 __ movw(operand, value);
4169 break; 4193 break;
4170 case EXTERNAL_INT_ELEMENTS: 4194 case EXTERNAL_INT_ELEMENTS:
4171 case EXTERNAL_UNSIGNED_INT_ELEMENTS: 4195 case EXTERNAL_UNSIGNED_INT_ELEMENTS:
4196 case INT32_ELEMENTS:
4197 case UINT32_ELEMENTS:
4172 __ movl(operand, value); 4198 __ movl(operand, value);
4173 break; 4199 break;
4174 case EXTERNAL_FLOAT_ELEMENTS: 4200 case EXTERNAL_FLOAT_ELEMENTS:
4175 case EXTERNAL_DOUBLE_ELEMENTS: 4201 case EXTERNAL_DOUBLE_ELEMENTS:
4202 case FLOAT32_ELEMENTS:
4203 case FLOAT64_ELEMENTS:
4176 case FAST_ELEMENTS: 4204 case FAST_ELEMENTS:
4177 case FAST_SMI_ELEMENTS: 4205 case FAST_SMI_ELEMENTS:
4178 case FAST_DOUBLE_ELEMENTS: 4206 case FAST_DOUBLE_ELEMENTS:
4179 case FAST_HOLEY_ELEMENTS: 4207 case FAST_HOLEY_ELEMENTS:
4180 case FAST_HOLEY_SMI_ELEMENTS: 4208 case FAST_HOLEY_SMI_ELEMENTS:
4181 case FAST_HOLEY_DOUBLE_ELEMENTS: 4209 case FAST_HOLEY_DOUBLE_ELEMENTS:
4182 case DICTIONARY_ELEMENTS: 4210 case DICTIONARY_ELEMENTS:
4183 case NON_STRICT_ARGUMENTS_ELEMENTS: 4211 case NON_STRICT_ARGUMENTS_ELEMENTS:
4184 UNREACHABLE(); 4212 UNREACHABLE();
4185 break; 4213 break;
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
4297 key_reg, 4325 key_reg,
4298 value, 4326 value,
4299 kSaveFPRegs, 4327 kSaveFPRegs,
4300 EMIT_REMEMBERED_SET, 4328 EMIT_REMEMBERED_SET,
4301 check_needed); 4329 check_needed);
4302 } 4330 }
4303 } 4331 }
4304 4332
4305 4333
4306 void LCodeGen::DoStoreKeyed(LStoreKeyed* instr) { 4334 void LCodeGen::DoStoreKeyed(LStoreKeyed* instr) {
4307 if (instr->is_external()) { 4335 if (instr->is_typed_elements()) {
4308 DoStoreKeyedExternalArray(instr); 4336 DoStoreKeyedExternalArray(instr);
4309 } else if (instr->hydrogen()->value()->representation().IsDouble()) { 4337 } else if (instr->hydrogen()->value()->representation().IsDouble()) {
4310 DoStoreKeyedFixedDoubleArray(instr); 4338 DoStoreKeyedFixedDoubleArray(instr);
4311 } else { 4339 } else {
4312 DoStoreKeyedFixedArray(instr); 4340 DoStoreKeyedFixedArray(instr);
4313 } 4341 }
4314 } 4342 }
4315 4343
4316 4344
4317 void LCodeGen::DoStoreKeyedGeneric(LStoreKeyedGeneric* instr) { 4345 void LCodeGen::DoStoreKeyedGeneric(LStoreKeyedGeneric* instr) {
(...skipping 1304 matching lines...) Expand 10 before | Expand all | Expand 10 after
5622 FixedArray::kHeaderSize - kPointerSize)); 5650 FixedArray::kHeaderSize - kPointerSize));
5623 __ bind(&done); 5651 __ bind(&done);
5624 } 5652 }
5625 5653
5626 5654
5627 #undef __ 5655 #undef __
5628 5656
5629 } } // namespace v8::internal 5657 } } // namespace v8::internal
5630 5658
5631 #endif // V8_TARGET_ARCH_X64 5659 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/third_party/vtune/vtune-jit.cc ('k') | src/x64/lithium-x64.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698