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

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

Issue 6670119: VM initialization refactoring. (Closed)
Patch Set: 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
OLDNEW
1 // Copyright 2006-2009 the V8 project authors. All rights reserved. 1 // Copyright 2006-2009 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 1903 matching lines...) Expand 10 before | Expand all | Expand 10 after
1914 JSFunction* function, 1914 JSFunction* function,
1915 String* name) { 1915 String* name) {
1916 // ----------- S t a t e ------------- 1916 // ----------- S t a t e -------------
1917 // -- ecx : name 1917 // -- ecx : name
1918 // -- esp[0] : return address 1918 // -- esp[0] : return address
1919 // -- esp[(argc - n) * 4] : arg[n] (zero-based) 1919 // -- esp[(argc - n) * 4] : arg[n] (zero-based)
1920 // -- ... 1920 // -- ...
1921 // -- esp[(argc + 1) * 4] : receiver 1921 // -- esp[(argc + 1) * 4] : receiver
1922 // ----------------------------------- 1922 // -----------------------------------
1923 1923
1924 if (!isolate()->cpu_features()->IsSupported(SSE2)) { 1924 if (!CpuFeatures::IsSupported(SSE2)) {
1925 return isolate()->heap()->undefined_value(); 1925 return isolate()->heap()->undefined_value();
1926 } 1926 }
1927 1927
1928 CpuFeatures::Scope use_sse2(SSE2); 1928 CpuFeatures::Scope use_sse2(SSE2);
1929 1929
1930 const int argc = arguments().immediate(); 1930 const int argc = arguments().immediate();
1931 1931
1932 // If the object is not a JSObject or we got an unexpected number of 1932 // If the object is not a JSObject or we got an unexpected number of
1933 // arguments, bail out to the regular call. 1933 // arguments, bail out to the regular call.
1934 if (!object->IsJSObject() || argc != 1) { 1934 if (!object->IsJSObject() || argc != 1) {
(...skipping 1350 matching lines...) Expand 10 before | Expand all | Expand 10 after
3285 // depending on the this.x = ...; assignment in the function. 3285 // depending on the this.x = ...; assignment in the function.
3286 SharedFunctionInfo* shared = function->shared(); 3286 SharedFunctionInfo* shared = function->shared();
3287 for (int i = 0; i < shared->this_property_assignments_count(); i++) { 3287 for (int i = 0; i < shared->this_property_assignments_count(); i++) {
3288 if (shared->IsThisPropertyAssignmentArgument(i)) { 3288 if (shared->IsThisPropertyAssignmentArgument(i)) {
3289 // Check if the argument assigned to the property is actually passed. 3289 // Check if the argument assigned to the property is actually passed.
3290 // If argument is not passed the property is set to undefined, 3290 // If argument is not passed the property is set to undefined,
3291 // otherwise find it on the stack. 3291 // otherwise find it on the stack.
3292 int arg_number = shared->GetThisPropertyAssignmentArgument(i); 3292 int arg_number = shared->GetThisPropertyAssignmentArgument(i);
3293 __ mov(ebx, edi); 3293 __ mov(ebx, edi);
3294 __ cmp(eax, arg_number); 3294 __ cmp(eax, arg_number);
3295 if (isolate()->cpu_features()->IsSupported(CMOV)) { 3295 if (CpuFeatures::IsSupported(CMOV)) {
3296 CpuFeatures::Scope use_cmov(CMOV); 3296 CpuFeatures::Scope use_cmov(CMOV);
3297 __ cmov(above, ebx, Operand(ecx, arg_number * -kPointerSize)); 3297 __ cmov(above, ebx, Operand(ecx, arg_number * -kPointerSize));
3298 } else { 3298 } else {
3299 Label not_passed; 3299 Label not_passed;
3300 __ j(below_equal, &not_passed); 3300 __ j(below_equal, &not_passed);
3301 __ mov(ebx, Operand(ecx, arg_number * -kPointerSize)); 3301 __ mov(ebx, Operand(ecx, arg_number * -kPointerSize));
3302 __ bind(&not_passed); 3302 __ bind(&not_passed);
3303 } 3303 }
3304 // Store value in the property. 3304 // Store value in the property.
3305 __ mov(Operand(edx, i * kPointerSize), ebx); 3305 __ mov(Operand(edx, i * kPointerSize), ebx);
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after
3604 __ fstp_s(Operand(edi, ebx, times_4, 0)); 3604 __ fstp_s(Operand(edi, ebx, times_4, 0));
3605 __ ret(0); 3605 __ ret(0);
3606 } else { 3606 } else {
3607 // Perform float-to-int conversion with truncation (round-to-zero) 3607 // Perform float-to-int conversion with truncation (round-to-zero)
3608 // behavior. 3608 // behavior.
3609 3609
3610 // For the moment we make the slow call to the runtime on 3610 // For the moment we make the slow call to the runtime on
3611 // processors that don't support SSE2. The code in IntegerConvert 3611 // processors that don't support SSE2. The code in IntegerConvert
3612 // (code-stubs-ia32.cc) is roughly what is needed here though the 3612 // (code-stubs-ia32.cc) is roughly what is needed here though the
3613 // conversion failure case does not need to be handled. 3613 // conversion failure case does not need to be handled.
3614 if (isolate()->cpu_features()->IsSupported(SSE2)) { 3614 if (CpuFeatures::IsSupported(SSE2)) {
3615 if (array_type != kExternalIntArray && 3615 if (array_type != kExternalIntArray &&
3616 array_type != kExternalUnsignedIntArray) { 3616 array_type != kExternalUnsignedIntArray) {
3617 ASSERT(isolate()->cpu_features()->IsSupported(SSE2)); 3617 ASSERT(CpuFeatures::IsSupported(SSE2));
3618 CpuFeatures::Scope scope(SSE2); 3618 CpuFeatures::Scope scope(SSE2);
3619 __ cvttsd2si(ecx, FieldOperand(eax, HeapNumber::kValueOffset)); 3619 __ cvttsd2si(ecx, FieldOperand(eax, HeapNumber::kValueOffset));
3620 // ecx: untagged integer value 3620 // ecx: untagged integer value
3621 switch (array_type) { 3621 switch (array_type) {
3622 case kExternalPixelArray: 3622 case kExternalPixelArray:
3623 { // Clamp the value to [0..255]. 3623 { // Clamp the value to [0..255].
3624 NearLabel done; 3624 NearLabel done;
3625 __ test(ecx, Immediate(0xFFFFFF00)); 3625 __ test(ecx, Immediate(0xFFFFFF00));
3626 __ j(zero, &done); 3626 __ j(zero, &done);
3627 __ setcc(negative, ecx); // 1 if negative, 0 if positive. 3627 __ setcc(negative, ecx); // 1 if negative, 0 if positive.
3628 __ dec_b(ecx); // 0 if negative, 255 if positive. 3628 __ dec_b(ecx); // 0 if negative, 255 if positive.
3629 __ bind(&done); 3629 __ bind(&done);
3630 } 3630 }
3631 __ mov_b(Operand(edi, ebx, times_1, 0), ecx); 3631 __ mov_b(Operand(edi, ebx, times_1, 0), ecx);
3632 case kExternalByteArray: 3632 case kExternalByteArray:
3633 case kExternalUnsignedByteArray: 3633 case kExternalUnsignedByteArray:
3634 __ mov_b(Operand(edi, ebx, times_1, 0), ecx); 3634 __ mov_b(Operand(edi, ebx, times_1, 0), ecx);
3635 break; 3635 break;
3636 case kExternalShortArray: 3636 case kExternalShortArray:
3637 case kExternalUnsignedShortArray: 3637 case kExternalUnsignedShortArray:
3638 __ mov_w(Operand(edi, ebx, times_2, 0), ecx); 3638 __ mov_w(Operand(edi, ebx, times_2, 0), ecx);
3639 break; 3639 break;
3640 default: 3640 default:
3641 UNREACHABLE(); 3641 UNREACHABLE();
3642 break; 3642 break;
3643 } 3643 }
3644 } else { 3644 } else {
3645 if (isolate()->cpu_features()->IsSupported(SSE3)) { 3645 if (CpuFeatures::IsSupported(SSE3)) {
3646 CpuFeatures::Scope scope(SSE3); 3646 CpuFeatures::Scope scope(SSE3);
3647 // fisttp stores values as signed integers. To represent the 3647 // fisttp stores values as signed integers. To represent the
3648 // entire range of int and unsigned int arrays, store as a 3648 // entire range of int and unsigned int arrays, store as a
3649 // 64-bit int and discard the high 32 bits. 3649 // 64-bit int and discard the high 32 bits.
3650 // If the value is NaN or +/-infinity, the result is 0x80000000, 3650 // If the value is NaN or +/-infinity, the result is 0x80000000,
3651 // which is automatically zero when taken mod 2^n, n < 32. 3651 // which is automatically zero when taken mod 2^n, n < 32.
3652 __ fld_d(FieldOperand(eax, HeapNumber::kValueOffset)); 3652 __ fld_d(FieldOperand(eax, HeapNumber::kValueOffset));
3653 __ sub(Operand(esp), Immediate(2 * kPointerSize)); 3653 __ sub(Operand(esp), Immediate(2 * kPointerSize));
3654 __ fisttp_d(Operand(esp, 0)); 3654 __ fisttp_d(Operand(esp, 0));
3655 __ pop(ecx); 3655 __ pop(ecx);
3656 __ add(Operand(esp), Immediate(kPointerSize)); 3656 __ add(Operand(esp), Immediate(kPointerSize));
3657 } else { 3657 } else {
3658 ASSERT(isolate()->cpu_features()->IsSupported(SSE2)); 3658 ASSERT(CpuFeatures::IsSupported(SSE2));
3659 CpuFeatures::Scope scope(SSE2); 3659 CpuFeatures::Scope scope(SSE2);
3660 // We can easily implement the correct rounding behavior for the 3660 // We can easily implement the correct rounding behavior for the
3661 // range [0, 2^31-1]. For the time being, to keep this code simple, 3661 // range [0, 2^31-1]. For the time being, to keep this code simple,
3662 // make the slow runtime call for values outside this range. 3662 // make the slow runtime call for values outside this range.
3663 // Note: we could do better for signed int arrays. 3663 // Note: we could do better for signed int arrays.
3664 __ movd(xmm0, FieldOperand(eax, HeapNumber::kValueOffset)); 3664 __ movd(xmm0, FieldOperand(eax, HeapNumber::kValueOffset));
3665 // We will need the key if we have to make the slow runtime call. 3665 // We will need the key if we have to make the slow runtime call.
3666 __ push(ecx); 3666 __ push(ecx);
3667 __ LoadPowerOf2(xmm1, ecx, 31); 3667 __ LoadPowerOf2(xmm1, ecx, 31);
3668 __ pop(ecx); 3668 __ pop(ecx);
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
3701 3701
3702 return GetCode(flags); 3702 return GetCode(flags);
3703 } 3703 }
3704 3704
3705 3705
3706 #undef __ 3706 #undef __
3707 3707
3708 } } // namespace v8::internal 3708 } } // namespace v8::internal
3709 3709
3710 #endif // V8_TARGET_ARCH_IA32 3710 #endif // V8_TARGET_ARCH_IA32
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698