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

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: fix ia32 build 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
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 Operand hole_check_operand(BuildFastArrayOperand(
2255 instr->elements(), instr->key(), JSObject::FAST_DOUBLE_ELEMENTS,
2256 FixedDoubleArray::kHeaderSize - kSmiTagMask + sizeof(kHoleNanLower32)));
2257 __ cmpl(hole_check_operand, Immediate(kHoleNanUpper32));
2258 DeoptimizeIf(equal, instr->environment());
2259 }
2260
2261 Operand double_load_operand(BuildFastArrayOperand(
2262 instr->elements(), instr->key(), JSObject::FAST_DOUBLE_ELEMENTS,
2263 FixedDoubleArray::kHeaderSize - kSmiTagMask));
2264 __ movsd(result, double_load_operand);
2265 }
2266
2267
2268 Operand LCodeGen::BuildFastArrayOperand(
2249 LOperand* external_pointer, 2269 LOperand* external_pointer,
2250 LOperand* key, 2270 LOperand* key,
2251 JSObject::ElementsKind elements_kind) { 2271 JSObject::ElementsKind elements_kind,
2272 uint32_t offset) {
2252 Register external_pointer_reg = ToRegister(external_pointer); 2273 Register external_pointer_reg = ToRegister(external_pointer);
2253 int shift_size = ElementsKindToShiftSize(elements_kind); 2274 int shift_size = ElementsKindToShiftSize(elements_kind);
2254 if (key->IsConstantOperand()) { 2275 if (key->IsConstantOperand()) {
2255 int constant_value = ToInteger32(LConstantOperand::cast(key)); 2276 int constant_value = ToInteger32(LConstantOperand::cast(key));
2256 if (constant_value & 0xF0000000) { 2277 if (constant_value & 0xF0000000) {
2257 Abort("array index constant value too big"); 2278 Abort("array index constant value too big");
2258 } 2279 }
2259 return Operand(external_pointer_reg, constant_value * (1 << shift_size)); 2280 return Operand(external_pointer_reg,
2281 constant_value * (1 << shift_size) + offset);
2260 } else { 2282 } else {
2261 ScaleFactor scale_factor = static_cast<ScaleFactor>(shift_size); 2283 ScaleFactor scale_factor = static_cast<ScaleFactor>(shift_size);
2262 return Operand(external_pointer_reg, ToRegister(key), scale_factor, 0); 2284 return Operand(external_pointer_reg, ToRegister(key),
2285 scale_factor, offset);
2263 } 2286 }
2264 } 2287 }
2265 2288
2266 2289
2267 void LCodeGen::DoLoadKeyedSpecializedArrayElement( 2290 void LCodeGen::DoLoadKeyedSpecializedArrayElement(
2268 LLoadKeyedSpecializedArrayElement* instr) { 2291 LLoadKeyedSpecializedArrayElement* instr) {
2269 JSObject::ElementsKind elements_kind = instr->elements_kind(); 2292 JSObject::ElementsKind elements_kind = instr->elements_kind();
2270 Operand operand(BuildExternalArrayOperand(instr->external_pointer(), 2293 Operand operand(BuildFastArrayOperand(instr->external_pointer(),
2271 instr->key(), elements_kind)); 2294 instr->key(), elements_kind, 0));
2272 if (elements_kind == JSObject::EXTERNAL_FLOAT_ELEMENTS) { 2295 if (elements_kind == JSObject::EXTERNAL_FLOAT_ELEMENTS) {
2273 XMMRegister result(ToDoubleRegister(instr->result())); 2296 XMMRegister result(ToDoubleRegister(instr->result()));
2274 __ movss(result, operand); 2297 __ movss(result, operand);
2275 __ cvtss2sd(result, result); 2298 __ cvtss2sd(result, result);
2276 } else if (elements_kind == JSObject::EXTERNAL_DOUBLE_ELEMENTS) { 2299 } else if (elements_kind == JSObject::EXTERNAL_DOUBLE_ELEMENTS) {
2277 __ movsd(ToDoubleRegister(instr->result()), operand); 2300 __ movsd(ToDoubleRegister(instr->result()), operand);
2278 } else { 2301 } else {
2279 Register result(ToRegister(instr->result())); 2302 Register result(ToRegister(instr->result()));
2280 switch (elements_kind) { 2303 switch (elements_kind) {
2281 case JSObject::EXTERNAL_BYTE_ELEMENTS: 2304 case JSObject::EXTERNAL_BYTE_ELEMENTS:
(...skipping 705 matching lines...) Expand 10 before | Expand all | Expand 10 after
2987 Handle<Code> ic = instr->strict_mode() 3010 Handle<Code> ic = instr->strict_mode()
2988 ? isolate()->builtins()->StoreIC_Initialize_Strict() 3011 ? isolate()->builtins()->StoreIC_Initialize_Strict()
2989 : isolate()->builtins()->StoreIC_Initialize(); 3012 : isolate()->builtins()->StoreIC_Initialize();
2990 CallCode(ic, RelocInfo::CODE_TARGET, instr); 3013 CallCode(ic, RelocInfo::CODE_TARGET, instr);
2991 } 3014 }
2992 3015
2993 3016
2994 void LCodeGen::DoStoreKeyedSpecializedArrayElement( 3017 void LCodeGen::DoStoreKeyedSpecializedArrayElement(
2995 LStoreKeyedSpecializedArrayElement* instr) { 3018 LStoreKeyedSpecializedArrayElement* instr) {
2996 JSObject::ElementsKind elements_kind = instr->elements_kind(); 3019 JSObject::ElementsKind elements_kind = instr->elements_kind();
2997 Operand operand(BuildExternalArrayOperand(instr->external_pointer(), 3020 Operand operand(BuildFastArrayOperand(instr->external_pointer(),
2998 instr->key(), elements_kind)); 3021 instr->key(), elements_kind, 0));
2999 if (elements_kind == JSObject::EXTERNAL_FLOAT_ELEMENTS) { 3022 if (elements_kind == JSObject::EXTERNAL_FLOAT_ELEMENTS) {
3000 XMMRegister value(ToDoubleRegister(instr->value())); 3023 XMMRegister value(ToDoubleRegister(instr->value()));
3001 __ cvtsd2ss(value, value); 3024 __ cvtsd2ss(value, value);
3002 __ movss(operand, value); 3025 __ movss(operand, value);
3003 } else if (elements_kind == JSObject::EXTERNAL_DOUBLE_ELEMENTS) { 3026 } else if (elements_kind == JSObject::EXTERNAL_DOUBLE_ELEMENTS) {
3004 __ movsd(operand, ToDoubleRegister(instr->value())); 3027 __ movsd(operand, ToDoubleRegister(instr->value()));
3005 } else { 3028 } else {
3006 Register value(ToRegister(instr->value())); 3029 Register value(ToRegister(instr->value()));
3007 switch (elements_kind) { 3030 switch (elements_kind) {
3008 case JSObject::EXTERNAL_PIXEL_ELEMENTS: 3031 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. 3088 // Compute address of modified element and store it into key register.
3066 __ lea(key, FieldOperand(elements, 3089 __ lea(key, FieldOperand(elements,
3067 key, 3090 key,
3068 times_pointer_size, 3091 times_pointer_size,
3069 FixedArray::kHeaderSize)); 3092 FixedArray::kHeaderSize));
3070 __ RecordWrite(elements, key, value); 3093 __ RecordWrite(elements, key, value);
3071 } 3094 }
3072 } 3095 }
3073 3096
3074 3097
3098 void LCodeGen::DoStoreKeyedFastDoubleElement(
3099 LStoreKeyedFastDoubleElement* instr) {
3100 XMMRegister value(ToDoubleRegister(instr->value()));
3101 Register elements = ToRegister(instr->elements());
3102 Register key = instr->key()->IsRegister() ? ToRegister(instr->key()) : no_reg;
Mads Ager (chromium) 2011/07/19 08:03:51 I don't think you ever use this one?
danno 2011/07/19 12:50:17 Done.
3103 Label have_value;
3104
3105 __ ucomisd(value, value);
3106 __ j(parity_odd, &have_value); // NaN.
3107
3108 ExternalReference canonical_nan_reference =
3109 ExternalReference::address_of_canonical_non_hole_nan();
3110 __ Set(kScratchRegister, BitCast<uint64_t>(
3111 FixedDoubleArray::canonical_not_the_hole_nan_as_double()));
3112 __ movq(value, kScratchRegister);
3113
3114 __ bind(&have_value);
3115 Operand double_store_operand(BuildFastArrayOperand(
3116 instr->elements(), instr->key(), JSObject::FAST_DOUBLE_ELEMENTS,
3117 FixedDoubleArray::kHeaderSize - kSmiTagMask));
3118 __ movsd(double_store_operand, value);
3119 }
3120
3075 void LCodeGen::DoStoreKeyedGeneric(LStoreKeyedGeneric* instr) { 3121 void LCodeGen::DoStoreKeyedGeneric(LStoreKeyedGeneric* instr) {
3076 ASSERT(ToRegister(instr->object()).is(rdx)); 3122 ASSERT(ToRegister(instr->object()).is(rdx));
3077 ASSERT(ToRegister(instr->key()).is(rcx)); 3123 ASSERT(ToRegister(instr->key()).is(rcx));
3078 ASSERT(ToRegister(instr->value()).is(rax)); 3124 ASSERT(ToRegister(instr->value()).is(rax));
3079 3125
3080 Handle<Code> ic = instr->strict_mode() 3126 Handle<Code> ic = instr->strict_mode()
3081 ? isolate()->builtins()->KeyedStoreIC_Initialize_Strict() 3127 ? isolate()->builtins()->KeyedStoreIC_Initialize_Strict()
3082 : isolate()->builtins()->KeyedStoreIC_Initialize(); 3128 : isolate()->builtins()->KeyedStoreIC_Initialize();
3083 CallCode(ic, RelocInfo::CODE_TARGET, instr); 3129 CallCode(ic, RelocInfo::CODE_TARGET, instr);
3084 } 3130 }
(...skipping 975 matching lines...) Expand 10 before | Expand all | Expand 10 after
4060 RegisterEnvironmentForDeoptimization(environment); 4106 RegisterEnvironmentForDeoptimization(environment);
4061 ASSERT(osr_pc_offset_ == -1); 4107 ASSERT(osr_pc_offset_ == -1);
4062 osr_pc_offset_ = masm()->pc_offset(); 4108 osr_pc_offset_ = masm()->pc_offset();
4063 } 4109 }
4064 4110
4065 #undef __ 4111 #undef __
4066 4112
4067 } } // namespace v8::internal 4113 } } // namespace v8::internal
4068 4114
4069 #endif // V8_TARGET_ARCH_X64 4115 #endif // V8_TARGET_ARCH_X64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698