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

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

Issue 12391055: Cleaned up CpuFeature scope handling. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: ARM and MIPS support Created 7 years, 9 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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 2017 matching lines...) Expand 10 before | Expand all | Expand 10 after
2028 // -- esp[0] : return address 2028 // -- esp[0] : return address
2029 // -- esp[(argc - n) * 4] : arg[n] (zero-based) 2029 // -- esp[(argc - n) * 4] : arg[n] (zero-based)
2030 // -- ... 2030 // -- ...
2031 // -- esp[(argc + 1) * 4] : receiver 2031 // -- esp[(argc + 1) * 4] : receiver
2032 // ----------------------------------- 2032 // -----------------------------------
2033 2033
2034 if (!CpuFeatures::IsSupported(SSE2)) { 2034 if (!CpuFeatures::IsSupported(SSE2)) {
2035 return Handle<Code>::null(); 2035 return Handle<Code>::null();
2036 } 2036 }
2037 2037
2038 CpuFeatures::Scope use_sse2(SSE2); 2038 CpuFeatureScope use_sse2(masm(), SSE2);
2039 2039
2040 const int argc = arguments().immediate(); 2040 const int argc = arguments().immediate();
2041 2041
2042 // If the object is not a JSObject or we got an unexpected number of 2042 // If the object is not a JSObject or we got an unexpected number of
2043 // arguments, bail out to the regular call. 2043 // arguments, bail out to the regular call.
2044 if (!object->IsJSObject() || argc != 1) { 2044 if (!object->IsJSObject() || argc != 1) {
2045 return Handle<Code>::null(); 2045 return Handle<Code>::null();
2046 } 2046 }
2047 2047
2048 Label miss; 2048 Label miss;
(...skipping 1124 matching lines...) Expand 10 before | Expand all | Expand 10 after
3173 Handle<SharedFunctionInfo> shared(function->shared()); 3173 Handle<SharedFunctionInfo> shared(function->shared());
3174 for (int i = 0; i < shared->this_property_assignments_count(); i++) { 3174 for (int i = 0; i < shared->this_property_assignments_count(); i++) {
3175 if (shared->IsThisPropertyAssignmentArgument(i)) { 3175 if (shared->IsThisPropertyAssignmentArgument(i)) {
3176 // Check if the argument assigned to the property is actually passed. 3176 // Check if the argument assigned to the property is actually passed.
3177 // If argument is not passed the property is set to undefined, 3177 // If argument is not passed the property is set to undefined,
3178 // otherwise find it on the stack. 3178 // otherwise find it on the stack.
3179 int arg_number = shared->GetThisPropertyAssignmentArgument(i); 3179 int arg_number = shared->GetThisPropertyAssignmentArgument(i);
3180 __ mov(ebx, edi); 3180 __ mov(ebx, edi);
3181 __ cmp(eax, arg_number); 3181 __ cmp(eax, arg_number);
3182 if (CpuFeatures::IsSupported(CMOV)) { 3182 if (CpuFeatures::IsSupported(CMOV)) {
3183 CpuFeatures::Scope use_cmov(CMOV); 3183 CpuFeatureScope use_cmov(masm(), CMOV);
3184 __ cmov(above, ebx, Operand(ecx, arg_number * -kPointerSize)); 3184 __ cmov(above, ebx, Operand(ecx, arg_number * -kPointerSize));
3185 } else { 3185 } else {
3186 Label not_passed; 3186 Label not_passed;
3187 __ j(below_equal, &not_passed); 3187 __ j(below_equal, &not_passed);
3188 __ mov(ebx, Operand(ecx, arg_number * -kPointerSize)); 3188 __ mov(ebx, Operand(ecx, arg_number * -kPointerSize));
3189 __ bind(&not_passed); 3189 __ bind(&not_passed);
3190 } 3190 }
3191 // Store value in the property. 3191 // Store value in the property.
3192 __ mov(Operand(edx, i * kPointerSize), ebx); 3192 __ mov(Operand(edx, i * kPointerSize), ebx);
3193 } else { 3193 } else {
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
3286 3286
3287 static void GenerateSmiKeyCheck(MacroAssembler* masm, 3287 static void GenerateSmiKeyCheck(MacroAssembler* masm,
3288 Register key, 3288 Register key,
3289 Register scratch, 3289 Register scratch,
3290 XMMRegister xmm_scratch0, 3290 XMMRegister xmm_scratch0,
3291 XMMRegister xmm_scratch1, 3291 XMMRegister xmm_scratch1,
3292 Label* fail) { 3292 Label* fail) {
3293 // Check that key is a smi and if SSE2 is available a heap number 3293 // Check that key is a smi and if SSE2 is available a heap number
3294 // containing a smi and branch if the check fails. 3294 // containing a smi and branch if the check fails.
3295 if (CpuFeatures::IsSupported(SSE2)) { 3295 if (CpuFeatures::IsSupported(SSE2)) {
3296 CpuFeatures::Scope use_sse2(SSE2); 3296 CpuFeatureScope use_sse2(masm, SSE2);
3297 Label key_ok; 3297 Label key_ok;
3298 __ JumpIfSmi(key, &key_ok); 3298 __ JumpIfSmi(key, &key_ok);
3299 __ cmp(FieldOperand(key, HeapObject::kMapOffset), 3299 __ cmp(FieldOperand(key, HeapObject::kMapOffset),
3300 Immediate(Handle<Map>(masm->isolate()->heap()->heap_number_map()))); 3300 Immediate(Handle<Map>(masm->isolate()->heap()->heap_number_map())));
3301 __ j(not_equal, fail); 3301 __ j(not_equal, fail);
3302 __ movdbl(xmm_scratch0, FieldOperand(key, HeapNumber::kValueOffset)); 3302 __ movdbl(xmm_scratch0, FieldOperand(key, HeapNumber::kValueOffset));
3303 __ cvttsd2si(scratch, Operand(xmm_scratch0)); 3303 __ cvttsd2si(scratch, Operand(xmm_scratch0));
3304 __ cvtsi2sd(xmm_scratch1, scratch); 3304 __ cvtsi2sd(xmm_scratch1, scratch);
3305 __ ucomisd(xmm_scratch1, xmm_scratch0); 3305 __ ucomisd(xmm_scratch1, xmm_scratch0);
3306 __ j(not_equal, fail); 3306 __ j(not_equal, fail);
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
3423 // behavior. 3423 // behavior.
3424 3424
3425 // For the moment we make the slow call to the runtime on 3425 // For the moment we make the slow call to the runtime on
3426 // processors that don't support SSE2. The code in IntegerConvert 3426 // processors that don't support SSE2. The code in IntegerConvert
3427 // (code-stubs-ia32.cc) is roughly what is needed here though the 3427 // (code-stubs-ia32.cc) is roughly what is needed here though the
3428 // conversion failure case does not need to be handled. 3428 // conversion failure case does not need to be handled.
3429 if (CpuFeatures::IsSupported(SSE2)) { 3429 if (CpuFeatures::IsSupported(SSE2)) {
3430 if ((elements_kind == EXTERNAL_INT_ELEMENTS || 3430 if ((elements_kind == EXTERNAL_INT_ELEMENTS ||
3431 elements_kind == EXTERNAL_UNSIGNED_INT_ELEMENTS) && 3431 elements_kind == EXTERNAL_UNSIGNED_INT_ELEMENTS) &&
3432 CpuFeatures::IsSupported(SSE3)) { 3432 CpuFeatures::IsSupported(SSE3)) {
3433 CpuFeatures::Scope scope(SSE3); 3433 CpuFeatureScope scope(masm, SSE3);
3434 // fisttp stores values as signed integers. To represent the 3434 // fisttp stores values as signed integers. To represent the
3435 // entire range of int and unsigned int arrays, store as a 3435 // entire range of int and unsigned int arrays, store as a
3436 // 64-bit int and discard the high 32 bits. 3436 // 64-bit int and discard the high 32 bits.
3437 __ fld_d(FieldOperand(eax, HeapNumber::kValueOffset)); 3437 __ fld_d(FieldOperand(eax, HeapNumber::kValueOffset));
3438 __ sub(esp, Immediate(2 * kPointerSize)); 3438 __ sub(esp, Immediate(2 * kPointerSize));
3439 __ fisttp_d(Operand(esp, 0)); 3439 __ fisttp_d(Operand(esp, 0));
3440 3440
3441 // If conversion failed (NaN, infinity, or a number outside 3441 // If conversion failed (NaN, infinity, or a number outside
3442 // signed int64 range), the result is 0x8000000000000000, and 3442 // signed int64 range), the result is 0x8000000000000000, and
3443 // we must handle this case in the runtime. 3443 // we must handle this case in the runtime.
3444 Label ok; 3444 Label ok;
3445 __ cmp(Operand(esp, kPointerSize), Immediate(0x80000000u)); 3445 __ cmp(Operand(esp, kPointerSize), Immediate(0x80000000u));
3446 __ j(not_equal, &ok); 3446 __ j(not_equal, &ok);
3447 __ cmp(Operand(esp, 0), Immediate(0)); 3447 __ cmp(Operand(esp, 0), Immediate(0));
3448 __ j(not_equal, &ok); 3448 __ j(not_equal, &ok);
3449 __ add(esp, Immediate(2 * kPointerSize)); // Restore the stack. 3449 __ add(esp, Immediate(2 * kPointerSize)); // Restore the stack.
3450 __ jmp(&slow); 3450 __ jmp(&slow);
3451 3451
3452 __ bind(&ok); 3452 __ bind(&ok);
3453 __ pop(ebx); 3453 __ pop(ebx);
3454 __ add(esp, Immediate(kPointerSize)); 3454 __ add(esp, Immediate(kPointerSize));
3455 __ mov(Operand(edi, ecx, times_2, 0), ebx); 3455 __ mov(Operand(edi, ecx, times_2, 0), ebx);
3456 } else { 3456 } else {
3457 ASSERT(CpuFeatures::IsSupported(SSE2)); 3457 ASSERT(CpuFeatures::IsSupported(SSE2));
3458 CpuFeatures::Scope scope(SSE2); 3458 CpuFeatureScope scope(masm, SSE2);
3459 __ cvttsd2si(ebx, FieldOperand(eax, HeapNumber::kValueOffset)); 3459 __ cvttsd2si(ebx, FieldOperand(eax, HeapNumber::kValueOffset));
3460 __ cmp(ebx, 0x80000000u); 3460 __ cmp(ebx, 0x80000000u);
3461 __ j(equal, &slow); 3461 __ j(equal, &slow);
3462 // ebx: untagged integer value 3462 // ebx: untagged integer value
3463 switch (elements_kind) { 3463 switch (elements_kind) {
3464 case EXTERNAL_PIXEL_ELEMENTS: 3464 case EXTERNAL_PIXEL_ELEMENTS:
3465 __ ClampUint8(ebx); 3465 __ ClampUint8(ebx);
3466 // Fall through. 3466 // Fall through.
3467 case EXTERNAL_BYTE_ELEMENTS: 3467 case EXTERNAL_BYTE_ELEMENTS:
3468 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: 3468 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS:
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after
3808 __ jmp(ic_slow, RelocInfo::CODE_TARGET); 3808 __ jmp(ic_slow, RelocInfo::CODE_TARGET);
3809 } 3809 }
3810 } 3810 }
3811 3811
3812 3812
3813 #undef __ 3813 #undef __
3814 3814
3815 } } // namespace v8::internal 3815 } } // namespace v8::internal
3816 3816
3817 #endif // V8_TARGET_ARCH_IA32 3817 #endif // V8_TARGET_ARCH_IA32
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698