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

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

Issue 7350021: Crankshaft support for FixedDoubleArrays (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: review feedback Created 9 years, 5 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/x64/lithium-codegen-x64.h ('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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 2227 matching lines...) Expand 10 before | Expand all | Expand 10 after
2238 FixedArray::kHeaderSize)); 2238 FixedArray::kHeaderSize));
2239 2239
2240 // Check for the hole value. 2240 // Check for the hole value.
2241 if (instr->hydrogen()->RequiresHoleCheck()) { 2241 if (instr->hydrogen()->RequiresHoleCheck()) {
2242 __ CompareRoot(result, Heap::kTheHoleValueRootIndex); 2242 __ CompareRoot(result, Heap::kTheHoleValueRootIndex);
2243 DeoptimizeIf(equal, instr->environment()); 2243 DeoptimizeIf(equal, instr->environment());
2244 } 2244 }
2245 } 2245 }
2246 2246
2247 2247
2248 Operand LCodeGen::BuildExternalArrayOperand( 2248 void LCodeGen::DoLoadKeyedFastDoubleElement(
2249 LLoadKeyedFastDoubleElement* instr) {
2250 Register elements = ToRegister(instr->elements());
2251 XMMRegister result(ToDoubleRegister(instr->result()));
2252
2253 if (instr->hydrogen()->RequiresHoleCheck()) {
2254 int offset = FixedDoubleArray::kHeaderSize - kHeapObjectTag +
2255 sizeof(kHoleNanLower32);
2256 Operand hole_check_operand = BuildFastArrayOperand(
2257 instr->elements(),
2258 instr->key(),
2259 JSObject::FAST_DOUBLE_ELEMENTS,
2260 offset);
2261 __ cmpl(hole_check_operand, Immediate(kHoleNanUpper32));
2262 DeoptimizeIf(equal, instr->environment());
2263 }
2264
2265 Operand double_load_operand = BuildFastArrayOperand(
2266 instr->elements(), instr->key(), JSObject::FAST_DOUBLE_ELEMENTS,
2267 FixedDoubleArray::kHeaderSize - kHeapObjectTag);
2268 __ movsd(result, double_load_operand);
2269 }
2270
2271
2272 Operand LCodeGen::BuildFastArrayOperand(
2249 LOperand* external_pointer, 2273 LOperand* external_pointer,
2250 LOperand* key, 2274 LOperand* key,
2251 JSObject::ElementsKind elements_kind) { 2275 JSObject::ElementsKind elements_kind,
2276 uint32_t offset) {
2252 Register external_pointer_reg = ToRegister(external_pointer); 2277 Register external_pointer_reg = ToRegister(external_pointer);
2253 int shift_size = ElementsKindToShiftSize(elements_kind); 2278 int shift_size = ElementsKindToShiftSize(elements_kind);
2254 if (key->IsConstantOperand()) { 2279 if (key->IsConstantOperand()) {
2255 int constant_value = ToInteger32(LConstantOperand::cast(key)); 2280 int constant_value = ToInteger32(LConstantOperand::cast(key));
2256 if (constant_value & 0xF0000000) { 2281 if (constant_value & 0xF0000000) {
2257 Abort("array index constant value too big"); 2282 Abort("array index constant value too big");
2258 } 2283 }
2259 return Operand(external_pointer_reg, constant_value * (1 << shift_size)); 2284 return Operand(external_pointer_reg,
2285 constant_value * (1 << shift_size) + offset);
2260 } else { 2286 } else {
2261 ScaleFactor scale_factor = static_cast<ScaleFactor>(shift_size); 2287 ScaleFactor scale_factor = static_cast<ScaleFactor>(shift_size);
2262 return Operand(external_pointer_reg, ToRegister(key), scale_factor, 0); 2288 return Operand(external_pointer_reg, ToRegister(key),
2289 scale_factor, offset);
2263 } 2290 }
2264 } 2291 }
2265 2292
2266 2293
2267 void LCodeGen::DoLoadKeyedSpecializedArrayElement( 2294 void LCodeGen::DoLoadKeyedSpecializedArrayElement(
2268 LLoadKeyedSpecializedArrayElement* instr) { 2295 LLoadKeyedSpecializedArrayElement* instr) {
2269 JSObject::ElementsKind elements_kind = instr->elements_kind(); 2296 JSObject::ElementsKind elements_kind = instr->elements_kind();
2270 Operand operand(BuildExternalArrayOperand(instr->external_pointer(), 2297 Operand operand(BuildFastArrayOperand(instr->external_pointer(),
2271 instr->key(), elements_kind)); 2298 instr->key(), elements_kind, 0));
2272 if (elements_kind == JSObject::EXTERNAL_FLOAT_ELEMENTS) { 2299 if (elements_kind == JSObject::EXTERNAL_FLOAT_ELEMENTS) {
2273 XMMRegister result(ToDoubleRegister(instr->result())); 2300 XMMRegister result(ToDoubleRegister(instr->result()));
2274 __ movss(result, operand); 2301 __ movss(result, operand);
2275 __ cvtss2sd(result, result); 2302 __ cvtss2sd(result, result);
2276 } else if (elements_kind == JSObject::EXTERNAL_DOUBLE_ELEMENTS) { 2303 } else if (elements_kind == JSObject::EXTERNAL_DOUBLE_ELEMENTS) {
2277 __ movsd(ToDoubleRegister(instr->result()), operand); 2304 __ movsd(ToDoubleRegister(instr->result()), operand);
2278 } else { 2305 } else {
2279 Register result(ToRegister(instr->result())); 2306 Register result(ToRegister(instr->result()));
2280 switch (elements_kind) { 2307 switch (elements_kind) {
2281 case JSObject::EXTERNAL_BYTE_ELEMENTS: 2308 case JSObject::EXTERNAL_BYTE_ELEMENTS:
(...skipping 705 matching lines...) Expand 10 before | Expand all | Expand 10 after
2987 Handle<Code> ic = instr->strict_mode() 3014 Handle<Code> ic = instr->strict_mode()
2988 ? isolate()->builtins()->StoreIC_Initialize_Strict() 3015 ? isolate()->builtins()->StoreIC_Initialize_Strict()
2989 : isolate()->builtins()->StoreIC_Initialize(); 3016 : isolate()->builtins()->StoreIC_Initialize();
2990 CallCode(ic, RelocInfo::CODE_TARGET, instr); 3017 CallCode(ic, RelocInfo::CODE_TARGET, instr);
2991 } 3018 }
2992 3019
2993 3020
2994 void LCodeGen::DoStoreKeyedSpecializedArrayElement( 3021 void LCodeGen::DoStoreKeyedSpecializedArrayElement(
2995 LStoreKeyedSpecializedArrayElement* instr) { 3022 LStoreKeyedSpecializedArrayElement* instr) {
2996 JSObject::ElementsKind elements_kind = instr->elements_kind(); 3023 JSObject::ElementsKind elements_kind = instr->elements_kind();
2997 Operand operand(BuildExternalArrayOperand(instr->external_pointer(), 3024 Operand operand(BuildFastArrayOperand(instr->external_pointer(),
2998 instr->key(), elements_kind)); 3025 instr->key(), elements_kind, 0));
2999 if (elements_kind == JSObject::EXTERNAL_FLOAT_ELEMENTS) { 3026 if (elements_kind == JSObject::EXTERNAL_FLOAT_ELEMENTS) {
3000 XMMRegister value(ToDoubleRegister(instr->value())); 3027 XMMRegister value(ToDoubleRegister(instr->value()));
3001 __ cvtsd2ss(value, value); 3028 __ cvtsd2ss(value, value);
3002 __ movss(operand, value); 3029 __ movss(operand, value);
3003 } else if (elements_kind == JSObject::EXTERNAL_DOUBLE_ELEMENTS) { 3030 } else if (elements_kind == JSObject::EXTERNAL_DOUBLE_ELEMENTS) {
3004 __ movsd(operand, ToDoubleRegister(instr->value())); 3031 __ movsd(operand, ToDoubleRegister(instr->value()));
3005 } else { 3032 } else {
3006 Register value(ToRegister(instr->value())); 3033 Register value(ToRegister(instr->value()));
3007 switch (elements_kind) { 3034 switch (elements_kind) {
3008 case JSObject::EXTERNAL_PIXEL_ELEMENTS: 3035 case JSObject::EXTERNAL_PIXEL_ELEMENTS:
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
3065 // Compute address of modified element and store it into key register. 3092 // Compute address of modified element and store it into key register.
3066 __ lea(key, FieldOperand(elements, 3093 __ lea(key, FieldOperand(elements,
3067 key, 3094 key,
3068 times_pointer_size, 3095 times_pointer_size,
3069 FixedArray::kHeaderSize)); 3096 FixedArray::kHeaderSize));
3070 __ RecordWrite(elements, key, value); 3097 __ RecordWrite(elements, key, value);
3071 } 3098 }
3072 } 3099 }
3073 3100
3074 3101
3102 void LCodeGen::DoStoreKeyedFastDoubleElement(
3103 LStoreKeyedFastDoubleElement* instr) {
3104 XMMRegister value = ToDoubleRegister(instr->value());
3105 Register elements = ToRegister(instr->elements());
3106 Label have_value;
3107
3108 __ ucomisd(value, value);
3109 __ j(parity_odd, &have_value); // NaN.
3110
3111 ExternalReference canonical_nan_reference =
3112 ExternalReference::address_of_canonical_non_hole_nan();
3113 __ Set(kScratchRegister, BitCast<uint64_t>(
3114 FixedDoubleArray::canonical_not_the_hole_nan_as_double()));
3115 __ movq(value, kScratchRegister);
3116
3117 __ bind(&have_value);
3118 Operand double_store_operand = BuildFastArrayOperand(
3119 instr->elements(), instr->key(), JSObject::FAST_DOUBLE_ELEMENTS,
3120 FixedDoubleArray::kHeaderSize - kHeapObjectTag);
3121 __ movsd(double_store_operand, value);
3122 }
3123
3075 void LCodeGen::DoStoreKeyedGeneric(LStoreKeyedGeneric* instr) { 3124 void LCodeGen::DoStoreKeyedGeneric(LStoreKeyedGeneric* instr) {
3076 ASSERT(ToRegister(instr->object()).is(rdx)); 3125 ASSERT(ToRegister(instr->object()).is(rdx));
3077 ASSERT(ToRegister(instr->key()).is(rcx)); 3126 ASSERT(ToRegister(instr->key()).is(rcx));
3078 ASSERT(ToRegister(instr->value()).is(rax)); 3127 ASSERT(ToRegister(instr->value()).is(rax));
3079 3128
3080 Handle<Code> ic = instr->strict_mode() 3129 Handle<Code> ic = instr->strict_mode()
3081 ? isolate()->builtins()->KeyedStoreIC_Initialize_Strict() 3130 ? isolate()->builtins()->KeyedStoreIC_Initialize_Strict()
3082 : isolate()->builtins()->KeyedStoreIC_Initialize(); 3131 : isolate()->builtins()->KeyedStoreIC_Initialize();
3083 CallCode(ic, RelocInfo::CODE_TARGET, instr); 3132 CallCode(ic, RelocInfo::CODE_TARGET, instr);
3084 } 3133 }
(...skipping 975 matching lines...) Expand 10 before | Expand all | Expand 10 after
4060 RegisterEnvironmentForDeoptimization(environment); 4109 RegisterEnvironmentForDeoptimization(environment);
4061 ASSERT(osr_pc_offset_ == -1); 4110 ASSERT(osr_pc_offset_ == -1);
4062 osr_pc_offset_ = masm()->pc_offset(); 4111 osr_pc_offset_ = masm()->pc_offset();
4063 } 4112 }
4064 4113
4065 #undef __ 4114 #undef __
4066 4115
4067 } } // namespace v8::internal 4116 } } // namespace v8::internal
4068 4117
4069 #endif // V8_TARGET_ARCH_X64 4118 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/x64/lithium-codegen-x64.h ('k') | src/x64/lithium-x64.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698