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

Side by Side Diff: src/x64/stub-cache-x64.cc

Issue 6879009: Support Float64Arrays (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: address comments Created 9 years, 8 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-x64.cc ('k') | test/cctest/test-api.cc » ('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 3196 matching lines...) Expand 10 before | Expand all | Expand 10 after
3207 break; 3207 break;
3208 case kExternalIntArray: 3208 case kExternalIntArray:
3209 __ movsxlq(rcx, Operand(rbx, rcx, times_4, 0)); 3209 __ movsxlq(rcx, Operand(rbx, rcx, times_4, 0));
3210 break; 3210 break;
3211 case kExternalUnsignedIntArray: 3211 case kExternalUnsignedIntArray:
3212 __ movl(rcx, Operand(rbx, rcx, times_4, 0)); 3212 __ movl(rcx, Operand(rbx, rcx, times_4, 0));
3213 break; 3213 break;
3214 case kExternalFloatArray: 3214 case kExternalFloatArray:
3215 __ cvtss2sd(xmm0, Operand(rbx, rcx, times_4, 0)); 3215 __ cvtss2sd(xmm0, Operand(rbx, rcx, times_4, 0));
3216 break; 3216 break;
3217 case kExternalDoubleArray:
3218 __ movsd(xmm0, Operand(rbx, rcx, times_8, 0));
3219 break;
3217 default: 3220 default:
3218 UNREACHABLE(); 3221 UNREACHABLE();
3219 break; 3222 break;
3220 } 3223 }
3221 3224
3222 // rax: index 3225 // rax: index
3223 // rdx: receiver 3226 // rdx: receiver
3224 // For integer array types: 3227 // For integer array types:
3225 // rcx: value 3228 // rcx: value
3226 // For floating-point array type: 3229 // For floating-point array type:
(...skipping 17 matching lines...) Expand all
3244 // conversion. 3247 // conversion.
3245 // The value is zero-extended since we loaded the value from memory 3248 // The value is zero-extended since we loaded the value from memory
3246 // with movl. 3249 // with movl.
3247 __ cvtqsi2sd(xmm0, rcx); 3250 __ cvtqsi2sd(xmm0, rcx);
3248 3251
3249 __ AllocateHeapNumber(rcx, rbx, &slow); 3252 __ AllocateHeapNumber(rcx, rbx, &slow);
3250 // Set the value. 3253 // Set the value.
3251 __ movsd(FieldOperand(rcx, HeapNumber::kValueOffset), xmm0); 3254 __ movsd(FieldOperand(rcx, HeapNumber::kValueOffset), xmm0);
3252 __ movq(rax, rcx); 3255 __ movq(rax, rcx);
3253 __ ret(0); 3256 __ ret(0);
3254 } else if (array_type == kExternalFloatArray) { 3257 } else if (array_type == kExternalFloatArray ||
3258 array_type == kExternalDoubleArray) {
3255 // For the floating-point array type, we need to always allocate a 3259 // For the floating-point array type, we need to always allocate a
3256 // HeapNumber. 3260 // HeapNumber.
3257 __ AllocateHeapNumber(rcx, rbx, &slow); 3261 __ AllocateHeapNumber(rcx, rbx, &slow);
3258 // Set the value. 3262 // Set the value.
3259 __ movsd(FieldOperand(rcx, HeapNumber::kValueOffset), xmm0); 3263 __ movsd(FieldOperand(rcx, HeapNumber::kValueOffset), xmm0);
3260 __ movq(rax, rcx); 3264 __ movq(rax, rcx);
3261 __ ret(0); 3265 __ ret(0);
3262 } else { 3266 } else {
3263 __ Integer32ToSmi(rax, rcx); 3267 __ Integer32ToSmi(rax, rcx);
3264 __ ret(0); 3268 __ ret(0);
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
3354 break; 3358 break;
3355 case kExternalIntArray: 3359 case kExternalIntArray:
3356 case kExternalUnsignedIntArray: 3360 case kExternalUnsignedIntArray:
3357 __ movl(Operand(rbx, rdi, times_4, 0), rdx); 3361 __ movl(Operand(rbx, rdi, times_4, 0), rdx);
3358 break; 3362 break;
3359 case kExternalFloatArray: 3363 case kExternalFloatArray:
3360 // Need to perform int-to-float conversion. 3364 // Need to perform int-to-float conversion.
3361 __ cvtlsi2ss(xmm0, rdx); 3365 __ cvtlsi2ss(xmm0, rdx);
3362 __ movss(Operand(rbx, rdi, times_4, 0), xmm0); 3366 __ movss(Operand(rbx, rdi, times_4, 0), xmm0);
3363 break; 3367 break;
3368 case kExternalDoubleArray:
3369 // Need to perform int-to-float conversion.
3370 __ cvtlsi2sd(xmm0, rdx);
3371 __ movsd(Operand(rbx, rdi, times_8, 0), xmm0);
3372 break;
3364 default: 3373 default:
3365 UNREACHABLE(); 3374 UNREACHABLE();
3366 break; 3375 break;
3367 } 3376 }
3368 __ ret(0); 3377 __ ret(0);
3369 3378
3370 // TODO(danno): handle heap number -> pixel array conversion 3379 // TODO(danno): handle heap number -> pixel array conversion
3371 if (array_type != kExternalPixelArray) { 3380 if (array_type != kExternalPixelArray) {
3372 __ bind(&check_heap_number); 3381 __ bind(&check_heap_number);
3373 // rax: value 3382 // rax: value
(...skipping 10 matching lines...) Expand all
3384 // reproducible behavior, convert these to zero. 3393 // reproducible behavior, convert these to zero.
3385 __ movsd(xmm0, FieldOperand(rax, HeapNumber::kValueOffset)); 3394 __ movsd(xmm0, FieldOperand(rax, HeapNumber::kValueOffset));
3386 __ movq(rbx, FieldOperand(rbx, ExternalArray::kExternalPointerOffset)); 3395 __ movq(rbx, FieldOperand(rbx, ExternalArray::kExternalPointerOffset));
3387 // rdi: untagged index 3396 // rdi: untagged index
3388 // rbx: base pointer of external storage 3397 // rbx: base pointer of external storage
3389 // top of FPU stack: value 3398 // top of FPU stack: value
3390 if (array_type == kExternalFloatArray) { 3399 if (array_type == kExternalFloatArray) {
3391 __ cvtsd2ss(xmm0, xmm0); 3400 __ cvtsd2ss(xmm0, xmm0);
3392 __ movss(Operand(rbx, rdi, times_4, 0), xmm0); 3401 __ movss(Operand(rbx, rdi, times_4, 0), xmm0);
3393 __ ret(0); 3402 __ ret(0);
3403 } else if (array_type == kExternalDoubleArray) {
3404 __ movsd(Operand(rbx, rdi, times_8, 0), xmm0);
3405 __ ret(0);
3394 } else { 3406 } else {
3395 // Perform float-to-int conversion with truncation (round-to-zero) 3407 // Perform float-to-int conversion with truncation (round-to-zero)
3396 // behavior. 3408 // behavior.
3397 3409
3398 // Convert to int32 and store the low byte/word. 3410 // Convert to int32 and store the low byte/word.
3399 // If the value is NaN or +/-infinity, the result is 0x80000000, 3411 // If the value is NaN or +/-infinity, the result is 0x80000000,
3400 // which is automatically zero when taken mod 2^n, n < 32. 3412 // which is automatically zero when taken mod 2^n, n < 32.
3401 // rdx: value (converted to an untagged integer) 3413 // rdx: value (converted to an untagged integer)
3402 // rdi: untagged index 3414 // rdi: untagged index
3403 // rbx: base pointer of external storage 3415 // rbx: base pointer of external storage
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
3451 __ TailCallRuntime(Runtime::kSetProperty, 5, 1); 3463 __ TailCallRuntime(Runtime::kSetProperty, 5, 1);
3452 3464
3453 return GetCode(flags); 3465 return GetCode(flags);
3454 } 3466 }
3455 3467
3456 #undef __ 3468 #undef __
3457 3469
3458 } } // namespace v8::internal 3470 } } // namespace v8::internal
3459 3471
3460 #endif // V8_TARGET_ARCH_X64 3472 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/x64/lithium-x64.cc ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698