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

Side by Side Diff: src/ia32/lithium-codegen-ia32.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/ia32/lithium-codegen-ia32.h ('k') | src/ia32/lithium-ia32.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 2212 matching lines...) Expand 10 before | Expand all | Expand 10 after
2223 FixedArray::kHeaderSize)); 2223 FixedArray::kHeaderSize));
2224 2224
2225 // Check for the hole value. 2225 // Check for the hole value.
2226 if (instr->hydrogen()->RequiresHoleCheck()) { 2226 if (instr->hydrogen()->RequiresHoleCheck()) {
2227 __ cmp(result, factory()->the_hole_value()); 2227 __ cmp(result, factory()->the_hole_value());
2228 DeoptimizeIf(equal, instr->environment()); 2228 DeoptimizeIf(equal, instr->environment());
2229 } 2229 }
2230 } 2230 }
2231 2231
2232 2232
2233 Operand LCodeGen::BuildExternalArrayOperand( 2233 void LCodeGen::DoLoadKeyedFastDoubleElement(
2234 LLoadKeyedFastDoubleElement* instr) {
2235 Register elements = ToRegister(instr->elements());
2236 XMMRegister result = ToDoubleRegister(instr->result());
2237
2238 if (instr->hydrogen()->RequiresHoleCheck()) {
2239 int offset = FixedDoubleArray::kHeaderSize - kHeapObjectTag +
2240 sizeof(kHoleNanLower32);
2241 Operand hole_check_operand = BuildFastArrayOperand(
2242 instr->elements(), instr->key(),
2243 JSObject::FAST_DOUBLE_ELEMENTS,
2244 offset);
2245 __ cmp(hole_check_operand, Immediate(kHoleNanUpper32));
2246 DeoptimizeIf(equal, instr->environment());
2247 }
2248
2249 Operand double_load_operand = BuildFastArrayOperand(
2250 instr->elements(), instr->key(), JSObject::FAST_DOUBLE_ELEMENTS,
2251 FixedDoubleArray::kHeaderSize - kHeapObjectTag);
2252 __ movdbl(result, double_load_operand);
2253 }
2254
2255
2256 Operand LCodeGen::BuildFastArrayOperand(
2234 LOperand* external_pointer, 2257 LOperand* external_pointer,
2235 LOperand* key, 2258 LOperand* key,
2236 JSObject::ElementsKind elements_kind) { 2259 JSObject::ElementsKind elements_kind,
2260 uint32_t offset) {
2237 Register external_pointer_reg = ToRegister(external_pointer); 2261 Register external_pointer_reg = ToRegister(external_pointer);
2238 int shift_size = ElementsKindToShiftSize(elements_kind); 2262 int shift_size = ElementsKindToShiftSize(elements_kind);
2239 if (key->IsConstantOperand()) { 2263 if (key->IsConstantOperand()) {
2240 int constant_value = ToInteger32(LConstantOperand::cast(key)); 2264 int constant_value = ToInteger32(LConstantOperand::cast(key));
2241 if (constant_value & 0xF0000000) { 2265 if (constant_value & 0xF0000000) {
2242 Abort("array index constant value too big"); 2266 Abort("array index constant value too big");
2243 } 2267 }
2244 return Operand(external_pointer_reg, constant_value * (1 << shift_size)); 2268 return Operand(external_pointer_reg,
2269 constant_value * (1 << shift_size) + offset);
2245 } else { 2270 } else {
2246 ScaleFactor scale_factor = static_cast<ScaleFactor>(shift_size); 2271 ScaleFactor scale_factor = static_cast<ScaleFactor>(shift_size);
2247 return Operand(external_pointer_reg, ToRegister(key), scale_factor, 0); 2272 return Operand(external_pointer_reg, ToRegister(key), scale_factor, offset);
2248 } 2273 }
2249 } 2274 }
2250 2275
2251 2276
2252 void LCodeGen::DoLoadKeyedSpecializedArrayElement( 2277 void LCodeGen::DoLoadKeyedSpecializedArrayElement(
2253 LLoadKeyedSpecializedArrayElement* instr) { 2278 LLoadKeyedSpecializedArrayElement* instr) {
2254 JSObject::ElementsKind elements_kind = instr->elements_kind(); 2279 JSObject::ElementsKind elements_kind = instr->elements_kind();
2255 Operand operand(BuildExternalArrayOperand(instr->external_pointer(), 2280 Operand operand(BuildFastArrayOperand(instr->external_pointer(),
2256 instr->key(), elements_kind)); 2281 instr->key(), elements_kind, 0));
2257 if (elements_kind == JSObject::EXTERNAL_FLOAT_ELEMENTS) { 2282 if (elements_kind == JSObject::EXTERNAL_FLOAT_ELEMENTS) {
2258 XMMRegister result(ToDoubleRegister(instr->result())); 2283 XMMRegister result(ToDoubleRegister(instr->result()));
2259 __ movss(result, operand); 2284 __ movss(result, operand);
2260 __ cvtss2sd(result, result); 2285 __ cvtss2sd(result, result);
2261 } else if (elements_kind == JSObject::EXTERNAL_DOUBLE_ELEMENTS) { 2286 } else if (elements_kind == JSObject::EXTERNAL_DOUBLE_ELEMENTS) {
2262 __ movdbl(ToDoubleRegister(instr->result()), operand); 2287 __ movdbl(ToDoubleRegister(instr->result()), operand);
2263 } else { 2288 } else {
2264 Register result(ToRegister(instr->result())); 2289 Register result(ToRegister(instr->result()));
2265 switch (elements_kind) { 2290 switch (elements_kind) {
2266 case JSObject::EXTERNAL_BYTE_ELEMENTS: 2291 case JSObject::EXTERNAL_BYTE_ELEMENTS:
(...skipping 727 matching lines...) Expand 10 before | Expand all | Expand 10 after
2994 3019
2995 void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) { 3020 void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) {
2996 __ cmp(ToRegister(instr->index()), ToOperand(instr->length())); 3021 __ cmp(ToRegister(instr->index()), ToOperand(instr->length()));
2997 DeoptimizeIf(above_equal, instr->environment()); 3022 DeoptimizeIf(above_equal, instr->environment());
2998 } 3023 }
2999 3024
3000 3025
3001 void LCodeGen::DoStoreKeyedSpecializedArrayElement( 3026 void LCodeGen::DoStoreKeyedSpecializedArrayElement(
3002 LStoreKeyedSpecializedArrayElement* instr) { 3027 LStoreKeyedSpecializedArrayElement* instr) {
3003 JSObject::ElementsKind elements_kind = instr->elements_kind(); 3028 JSObject::ElementsKind elements_kind = instr->elements_kind();
3004 Operand operand(BuildExternalArrayOperand(instr->external_pointer(), 3029 Operand operand(BuildFastArrayOperand(instr->external_pointer(),
3005 instr->key(), elements_kind)); 3030 instr->key(), elements_kind, 0));
3006 if (elements_kind == JSObject::EXTERNAL_FLOAT_ELEMENTS) { 3031 if (elements_kind == JSObject::EXTERNAL_FLOAT_ELEMENTS) {
3007 __ cvtsd2ss(xmm0, ToDoubleRegister(instr->value())); 3032 __ cvtsd2ss(xmm0, ToDoubleRegister(instr->value()));
3008 __ movss(operand, xmm0); 3033 __ movss(operand, xmm0);
3009 } else if (elements_kind == JSObject::EXTERNAL_DOUBLE_ELEMENTS) { 3034 } else if (elements_kind == JSObject::EXTERNAL_DOUBLE_ELEMENTS) {
3010 __ movdbl(operand, ToDoubleRegister(instr->value())); 3035 __ movdbl(operand, ToDoubleRegister(instr->value()));
3011 } else { 3036 } else {
3012 Register value = ToRegister(instr->value()); 3037 Register value = ToRegister(instr->value());
3013 switch (elements_kind) { 3038 switch (elements_kind) {
3014 case JSObject::EXTERNAL_PIXEL_ELEMENTS: 3039 case JSObject::EXTERNAL_PIXEL_ELEMENTS:
3015 case JSObject::EXTERNAL_UNSIGNED_BYTE_ELEMENTS: 3040 case JSObject::EXTERNAL_UNSIGNED_BYTE_ELEMENTS:
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
3062 __ lea(key, 3087 __ lea(key,
3063 FieldOperand(elements, 3088 FieldOperand(elements,
3064 key, 3089 key,
3065 times_pointer_size, 3090 times_pointer_size,
3066 FixedArray::kHeaderSize)); 3091 FixedArray::kHeaderSize));
3067 __ RecordWrite(elements, key, value); 3092 __ RecordWrite(elements, key, value);
3068 } 3093 }
3069 } 3094 }
3070 3095
3071 3096
3097 void LCodeGen::DoStoreKeyedFastDoubleElement(
3098 LStoreKeyedFastDoubleElement* instr) {
3099 XMMRegister value = ToDoubleRegister(instr->value());
3100 Register elements = ToRegister(instr->elements());
3101 Register key = instr->key()->IsRegister() ? ToRegister(instr->key()) : no_reg;
3102 Label have_value;
3103
3104 __ ucomisd(value, value);
3105 __ j(parity_odd, &have_value); // NaN.
3106
3107 ExternalReference canonical_nan_reference =
3108 ExternalReference::address_of_canonical_non_hole_nan();
3109 __ movdbl(value, Operand::StaticVariable(canonical_nan_reference));
3110 __ bind(&have_value);
3111
3112 Operand double_store_operand = BuildFastArrayOperand(
3113 instr->elements(), instr->key(), JSObject::FAST_DOUBLE_ELEMENTS,
3114 FixedDoubleArray::kHeaderSize - kHeapObjectTag);
3115 __ movdbl(double_store_operand, value);
3116 }
3117
3118
3072 void LCodeGen::DoStoreKeyedGeneric(LStoreKeyedGeneric* instr) { 3119 void LCodeGen::DoStoreKeyedGeneric(LStoreKeyedGeneric* instr) {
3073 ASSERT(ToRegister(instr->context()).is(esi)); 3120 ASSERT(ToRegister(instr->context()).is(esi));
3074 ASSERT(ToRegister(instr->object()).is(edx)); 3121 ASSERT(ToRegister(instr->object()).is(edx));
3075 ASSERT(ToRegister(instr->key()).is(ecx)); 3122 ASSERT(ToRegister(instr->key()).is(ecx));
3076 ASSERT(ToRegister(instr->value()).is(eax)); 3123 ASSERT(ToRegister(instr->value()).is(eax));
3077 3124
3078 Handle<Code> ic = instr->strict_mode() 3125 Handle<Code> ic = instr->strict_mode()
3079 ? isolate()->builtins()->KeyedStoreIC_Initialize_Strict() 3126 ? isolate()->builtins()->KeyedStoreIC_Initialize_Strict()
3080 : isolate()->builtins()->KeyedStoreIC_Initialize(); 3127 : isolate()->builtins()->KeyedStoreIC_Initialize();
3081 CallCode(ic, RelocInfo::CODE_TARGET, instr); 3128 CallCode(ic, RelocInfo::CODE_TARGET, instr);
(...skipping 1181 matching lines...) Expand 10 before | Expand all | Expand 10 after
4263 env->deoptimization_index()); 4310 env->deoptimization_index());
4264 __ InvokeBuiltin(Builtins::IN, CALL_FUNCTION, safepoint_generator); 4311 __ InvokeBuiltin(Builtins::IN, CALL_FUNCTION, safepoint_generator);
4265 } 4312 }
4266 4313
4267 4314
4268 #undef __ 4315 #undef __
4269 4316
4270 } } // namespace v8::internal 4317 } } // namespace v8::internal
4271 4318
4272 #endif // V8_TARGET_ARCH_IA32 4319 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/ia32/lithium-codegen-ia32.h ('k') | src/ia32/lithium-ia32.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698