| OLD | NEW |
| 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 2332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2343 | 2343 |
| 2344 void LCodeGen::DoLoadKeyedSpecializedArrayElement( | 2344 void LCodeGen::DoLoadKeyedSpecializedArrayElement( |
| 2345 LLoadKeyedSpecializedArrayElement* instr) { | 2345 LLoadKeyedSpecializedArrayElement* instr) { |
| 2346 Register external_pointer = ToRegister(instr->external_pointer()); | 2346 Register external_pointer = ToRegister(instr->external_pointer()); |
| 2347 Register key = ToRegister(instr->key()); | 2347 Register key = ToRegister(instr->key()); |
| 2348 ExternalArrayType array_type = instr->array_type(); | 2348 ExternalArrayType array_type = instr->array_type(); |
| 2349 if (array_type == kExternalFloatArray) { | 2349 if (array_type == kExternalFloatArray) { |
| 2350 XMMRegister result(ToDoubleRegister(instr->result())); | 2350 XMMRegister result(ToDoubleRegister(instr->result())); |
| 2351 __ movss(result, Operand(external_pointer, key, times_4, 0)); | 2351 __ movss(result, Operand(external_pointer, key, times_4, 0)); |
| 2352 __ cvtss2sd(result, result); | 2352 __ cvtss2sd(result, result); |
| 2353 } else if (array_type == kExternalDoubleArray) { |
| 2354 __ movsd(ToDoubleRegister(instr->result()), |
| 2355 Operand(external_pointer, key, times_8, 0)); |
| 2353 } else { | 2356 } else { |
| 2354 Register result(ToRegister(instr->result())); | 2357 Register result(ToRegister(instr->result())); |
| 2355 switch (array_type) { | 2358 switch (array_type) { |
| 2356 case kExternalByteArray: | 2359 case kExternalByteArray: |
| 2357 __ movsxbq(result, Operand(external_pointer, key, times_1, 0)); | 2360 __ movsxbq(result, Operand(external_pointer, key, times_1, 0)); |
| 2358 break; | 2361 break; |
| 2359 case kExternalUnsignedByteArray: | 2362 case kExternalUnsignedByteArray: |
| 2360 case kExternalPixelArray: | 2363 case kExternalPixelArray: |
| 2361 __ movzxbq(result, Operand(external_pointer, key, times_1, 0)); | 2364 __ movzxbq(result, Operand(external_pointer, key, times_1, 0)); |
| 2362 break; | 2365 break; |
| 2363 case kExternalShortArray: | 2366 case kExternalShortArray: |
| 2364 __ movsxwq(result, Operand(external_pointer, key, times_2, 0)); | 2367 __ movsxwq(result, Operand(external_pointer, key, times_2, 0)); |
| 2365 break; | 2368 break; |
| 2366 case kExternalUnsignedShortArray: | 2369 case kExternalUnsignedShortArray: |
| 2367 __ movzxwq(result, Operand(external_pointer, key, times_2, 0)); | 2370 __ movzxwq(result, Operand(external_pointer, key, times_2, 0)); |
| 2368 break; | 2371 break; |
| 2369 case kExternalIntArray: | 2372 case kExternalIntArray: |
| 2370 __ movsxlq(result, Operand(external_pointer, key, times_4, 0)); | 2373 __ movsxlq(result, Operand(external_pointer, key, times_4, 0)); |
| 2371 break; | 2374 break; |
| 2372 case kExternalUnsignedIntArray: | 2375 case kExternalUnsignedIntArray: |
| 2373 __ movl(result, Operand(external_pointer, key, times_4, 0)); | 2376 __ movl(result, Operand(external_pointer, key, times_4, 0)); |
| 2374 __ testl(result, result); | 2377 __ testl(result, result); |
| 2375 // TODO(danno): we could be more clever here, perhaps having a special | 2378 // TODO(danno): we could be more clever here, perhaps having a special |
| 2376 // version of the stub that detects if the overflow case actually | 2379 // version of the stub that detects if the overflow case actually |
| 2377 // happens, and generate code that returns a double rather than int. | 2380 // happens, and generate code that returns a double rather than int. |
| 2378 DeoptimizeIf(negative, instr->environment()); | 2381 DeoptimizeIf(negative, instr->environment()); |
| 2379 break; | 2382 break; |
| 2380 case kExternalFloatArray: | 2383 case kExternalFloatArray: |
| 2384 case kExternalDoubleArray: |
| 2381 UNREACHABLE(); | 2385 UNREACHABLE(); |
| 2382 break; | 2386 break; |
| 2383 } | 2387 } |
| 2384 } | 2388 } |
| 2385 } | 2389 } |
| 2386 | 2390 |
| 2387 | 2391 |
| 2388 void LCodeGen::DoLoadKeyedGeneric(LLoadKeyedGeneric* instr) { | 2392 void LCodeGen::DoLoadKeyedGeneric(LLoadKeyedGeneric* instr) { |
| 2389 ASSERT(ToRegister(instr->object()).is(rdx)); | 2393 ASSERT(ToRegister(instr->object()).is(rdx)); |
| 2390 ASSERT(ToRegister(instr->key()).is(rax)); | 2394 ASSERT(ToRegister(instr->key()).is(rax)); |
| (...skipping 639 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3030 | 3034 |
| 3031 void LCodeGen::DoStoreKeyedSpecializedArrayElement( | 3035 void LCodeGen::DoStoreKeyedSpecializedArrayElement( |
| 3032 LStoreKeyedSpecializedArrayElement* instr) { | 3036 LStoreKeyedSpecializedArrayElement* instr) { |
| 3033 Register external_pointer = ToRegister(instr->external_pointer()); | 3037 Register external_pointer = ToRegister(instr->external_pointer()); |
| 3034 Register key = ToRegister(instr->key()); | 3038 Register key = ToRegister(instr->key()); |
| 3035 ExternalArrayType array_type = instr->array_type(); | 3039 ExternalArrayType array_type = instr->array_type(); |
| 3036 if (array_type == kExternalFloatArray) { | 3040 if (array_type == kExternalFloatArray) { |
| 3037 XMMRegister value(ToDoubleRegister(instr->value())); | 3041 XMMRegister value(ToDoubleRegister(instr->value())); |
| 3038 __ cvtsd2ss(value, value); | 3042 __ cvtsd2ss(value, value); |
| 3039 __ movss(Operand(external_pointer, key, times_4, 0), value); | 3043 __ movss(Operand(external_pointer, key, times_4, 0), value); |
| 3044 } else if (array_type == kExternalDoubleArray) { |
| 3045 __ movsd(Operand(external_pointer, key, times_8, 0), |
| 3046 ToDoubleRegister(instr->value())); |
| 3040 } else { | 3047 } else { |
| 3041 Register value(ToRegister(instr->value())); | 3048 Register value(ToRegister(instr->value())); |
| 3042 switch (array_type) { | 3049 switch (array_type) { |
| 3043 case kExternalPixelArray: | 3050 case kExternalPixelArray: |
| 3044 { // Clamp the value to [0..255]. | 3051 { // Clamp the value to [0..255]. |
| 3045 NearLabel done; | 3052 NearLabel done; |
| 3046 __ testl(value, Immediate(0xFFFFFF00)); | 3053 __ testl(value, Immediate(0xFFFFFF00)); |
| 3047 __ j(zero, &done); | 3054 __ j(zero, &done); |
| 3048 __ setcc(negative, value); // 1 if negative, 0 if positive. | 3055 __ setcc(negative, value); // 1 if negative, 0 if positive. |
| 3049 __ decb(value); // 0 if negative, 255 if positive. | 3056 __ decb(value); // 0 if negative, 255 if positive. |
| 3050 __ bind(&done); | 3057 __ bind(&done); |
| 3051 __ movb(Operand(external_pointer, key, times_1, 0), value); | 3058 __ movb(Operand(external_pointer, key, times_1, 0), value); |
| 3052 } | 3059 } |
| 3053 break; | 3060 break; |
| 3054 case kExternalByteArray: | 3061 case kExternalByteArray: |
| 3055 case kExternalUnsignedByteArray: | 3062 case kExternalUnsignedByteArray: |
| 3056 __ movb(Operand(external_pointer, key, times_1, 0), value); | 3063 __ movb(Operand(external_pointer, key, times_1, 0), value); |
| 3057 break; | 3064 break; |
| 3058 case kExternalShortArray: | 3065 case kExternalShortArray: |
| 3059 case kExternalUnsignedShortArray: | 3066 case kExternalUnsignedShortArray: |
| 3060 __ movw(Operand(external_pointer, key, times_2, 0), value); | 3067 __ movw(Operand(external_pointer, key, times_2, 0), value); |
| 3061 break; | 3068 break; |
| 3062 case kExternalIntArray: | 3069 case kExternalIntArray: |
| 3063 case kExternalUnsignedIntArray: | 3070 case kExternalUnsignedIntArray: |
| 3064 __ movl(Operand(external_pointer, key, times_4, 0), value); | 3071 __ movl(Operand(external_pointer, key, times_4, 0), value); |
| 3065 break; | 3072 break; |
| 3066 case kExternalFloatArray: | 3073 case kExternalFloatArray: |
| 3074 case kExternalDoubleArray: |
| 3067 UNREACHABLE(); | 3075 UNREACHABLE(); |
| 3068 break; | 3076 break; |
| 3069 } | 3077 } |
| 3070 } | 3078 } |
| 3071 } | 3079 } |
| 3072 | 3080 |
| 3073 | 3081 |
| 3074 void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) { | 3082 void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) { |
| 3075 if (instr->length()->IsRegister()) { | 3083 if (instr->length()->IsRegister()) { |
| 3076 __ cmpq(ToRegister(instr->index()), ToRegister(instr->length())); | 3084 __ cmpq(ToRegister(instr->index()), ToRegister(instr->length())); |
| (...skipping 939 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4016 RegisterEnvironmentForDeoptimization(environment); | 4024 RegisterEnvironmentForDeoptimization(environment); |
| 4017 ASSERT(osr_pc_offset_ == -1); | 4025 ASSERT(osr_pc_offset_ == -1); |
| 4018 osr_pc_offset_ = masm()->pc_offset(); | 4026 osr_pc_offset_ = masm()->pc_offset(); |
| 4019 } | 4027 } |
| 4020 | 4028 |
| 4021 #undef __ | 4029 #undef __ |
| 4022 | 4030 |
| 4023 } } // namespace v8::internal | 4031 } } // namespace v8::internal |
| 4024 | 4032 |
| 4025 #endif // V8_TARGET_ARCH_X64 | 4033 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |