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

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: Fixed nits 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
« no previous file with comments | « src/ia32/macro-assembler-ia32.cc ('k') | src/isolate.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 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 2029 matching lines...) Expand 10 before | Expand all | Expand 10 after
2040 // -- esp[0] : return address 2040 // -- esp[0] : return address
2041 // -- esp[(argc - n) * 4] : arg[n] (zero-based) 2041 // -- esp[(argc - n) * 4] : arg[n] (zero-based)
2042 // -- ... 2042 // -- ...
2043 // -- esp[(argc + 1) * 4] : receiver 2043 // -- esp[(argc + 1) * 4] : receiver
2044 // ----------------------------------- 2044 // -----------------------------------
2045 2045
2046 if (!CpuFeatures::IsSupported(SSE2)) { 2046 if (!CpuFeatures::IsSupported(SSE2)) {
2047 return Handle<Code>::null(); 2047 return Handle<Code>::null();
2048 } 2048 }
2049 2049
2050 CpuFeatures::Scope use_sse2(SSE2); 2050 CpuFeatureScope use_sse2(masm(), SSE2);
2051 2051
2052 const int argc = arguments().immediate(); 2052 const int argc = arguments().immediate();
2053 2053
2054 // If the object is not a JSObject or we got an unexpected number of 2054 // If the object is not a JSObject or we got an unexpected number of
2055 // arguments, bail out to the regular call. 2055 // arguments, bail out to the regular call.
2056 if (!object->IsJSObject() || argc != 1) { 2056 if (!object->IsJSObject() || argc != 1) {
2057 return Handle<Code>::null(); 2057 return Handle<Code>::null();
2058 } 2058 }
2059 2059
2060 Label miss; 2060 Label miss;
(...skipping 1130 matching lines...) Expand 10 before | Expand all | Expand 10 after
3191 Handle<SharedFunctionInfo> shared(function->shared()); 3191 Handle<SharedFunctionInfo> shared(function->shared());
3192 for (int i = 0; i < shared->this_property_assignments_count(); i++) { 3192 for (int i = 0; i < shared->this_property_assignments_count(); i++) {
3193 if (shared->IsThisPropertyAssignmentArgument(i)) { 3193 if (shared->IsThisPropertyAssignmentArgument(i)) {
3194 // Check if the argument assigned to the property is actually passed. 3194 // Check if the argument assigned to the property is actually passed.
3195 // If argument is not passed the property is set to undefined, 3195 // If argument is not passed the property is set to undefined,
3196 // otherwise find it on the stack. 3196 // otherwise find it on the stack.
3197 int arg_number = shared->GetThisPropertyAssignmentArgument(i); 3197 int arg_number = shared->GetThisPropertyAssignmentArgument(i);
3198 __ mov(ebx, edi); 3198 __ mov(ebx, edi);
3199 __ cmp(eax, arg_number); 3199 __ cmp(eax, arg_number);
3200 if (CpuFeatures::IsSupported(CMOV)) { 3200 if (CpuFeatures::IsSupported(CMOV)) {
3201 CpuFeatures::Scope use_cmov(CMOV); 3201 CpuFeatureScope use_cmov(masm(), CMOV);
3202 __ cmov(above, ebx, Operand(ecx, arg_number * -kPointerSize)); 3202 __ cmov(above, ebx, Operand(ecx, arg_number * -kPointerSize));
3203 } else { 3203 } else {
3204 Label not_passed; 3204 Label not_passed;
3205 __ j(below_equal, &not_passed); 3205 __ j(below_equal, &not_passed);
3206 __ mov(ebx, Operand(ecx, arg_number * -kPointerSize)); 3206 __ mov(ebx, Operand(ecx, arg_number * -kPointerSize));
3207 __ bind(&not_passed); 3207 __ bind(&not_passed);
3208 } 3208 }
3209 // Store value in the property. 3209 // Store value in the property.
3210 __ mov(Operand(edx, i * kPointerSize), ebx); 3210 __ mov(Operand(edx, i * kPointerSize), ebx);
3211 } else { 3211 } else {
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
3304 3304
3305 static void GenerateSmiKeyCheck(MacroAssembler* masm, 3305 static void GenerateSmiKeyCheck(MacroAssembler* masm,
3306 Register key, 3306 Register key,
3307 Register scratch, 3307 Register scratch,
3308 XMMRegister xmm_scratch0, 3308 XMMRegister xmm_scratch0,
3309 XMMRegister xmm_scratch1, 3309 XMMRegister xmm_scratch1,
3310 Label* fail) { 3310 Label* fail) {
3311 // Check that key is a smi and if SSE2 is available a heap number 3311 // Check that key is a smi and if SSE2 is available a heap number
3312 // containing a smi and branch if the check fails. 3312 // containing a smi and branch if the check fails.
3313 if (CpuFeatures::IsSupported(SSE2)) { 3313 if (CpuFeatures::IsSupported(SSE2)) {
3314 CpuFeatures::Scope use_sse2(SSE2); 3314 CpuFeatureScope use_sse2(masm, SSE2);
3315 Label key_ok; 3315 Label key_ok;
3316 __ JumpIfSmi(key, &key_ok); 3316 __ JumpIfSmi(key, &key_ok);
3317 __ cmp(FieldOperand(key, HeapObject::kMapOffset), 3317 __ cmp(FieldOperand(key, HeapObject::kMapOffset),
3318 Immediate(Handle<Map>(masm->isolate()->heap()->heap_number_map()))); 3318 Immediate(Handle<Map>(masm->isolate()->heap()->heap_number_map())));
3319 __ j(not_equal, fail); 3319 __ j(not_equal, fail);
3320 __ movdbl(xmm_scratch0, FieldOperand(key, HeapNumber::kValueOffset)); 3320 __ movdbl(xmm_scratch0, FieldOperand(key, HeapNumber::kValueOffset));
3321 __ cvttsd2si(scratch, Operand(xmm_scratch0)); 3321 __ cvttsd2si(scratch, Operand(xmm_scratch0));
3322 __ cvtsi2sd(xmm_scratch1, scratch); 3322 __ cvtsi2sd(xmm_scratch1, scratch);
3323 __ ucomisd(xmm_scratch1, xmm_scratch0); 3323 __ ucomisd(xmm_scratch1, xmm_scratch0);
3324 __ j(not_equal, fail); 3324 __ j(not_equal, fail);
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
3441 // behavior. 3441 // behavior.
3442 3442
3443 // For the moment we make the slow call to the runtime on 3443 // For the moment we make the slow call to the runtime on
3444 // processors that don't support SSE2. The code in IntegerConvert 3444 // processors that don't support SSE2. The code in IntegerConvert
3445 // (code-stubs-ia32.cc) is roughly what is needed here though the 3445 // (code-stubs-ia32.cc) is roughly what is needed here though the
3446 // conversion failure case does not need to be handled. 3446 // conversion failure case does not need to be handled.
3447 if (CpuFeatures::IsSupported(SSE2)) { 3447 if (CpuFeatures::IsSupported(SSE2)) {
3448 if ((elements_kind == EXTERNAL_INT_ELEMENTS || 3448 if ((elements_kind == EXTERNAL_INT_ELEMENTS ||
3449 elements_kind == EXTERNAL_UNSIGNED_INT_ELEMENTS) && 3449 elements_kind == EXTERNAL_UNSIGNED_INT_ELEMENTS) &&
3450 CpuFeatures::IsSupported(SSE3)) { 3450 CpuFeatures::IsSupported(SSE3)) {
3451 CpuFeatures::Scope scope(SSE3); 3451 CpuFeatureScope scope(masm, SSE3);
3452 // fisttp stores values as signed integers. To represent the 3452 // fisttp stores values as signed integers. To represent the
3453 // entire range of int and unsigned int arrays, store as a 3453 // entire range of int and unsigned int arrays, store as a
3454 // 64-bit int and discard the high 32 bits. 3454 // 64-bit int and discard the high 32 bits.
3455 __ fld_d(FieldOperand(eax, HeapNumber::kValueOffset)); 3455 __ fld_d(FieldOperand(eax, HeapNumber::kValueOffset));
3456 __ sub(esp, Immediate(2 * kPointerSize)); 3456 __ sub(esp, Immediate(2 * kPointerSize));
3457 __ fisttp_d(Operand(esp, 0)); 3457 __ fisttp_d(Operand(esp, 0));
3458 3458
3459 // If conversion failed (NaN, infinity, or a number outside 3459 // If conversion failed (NaN, infinity, or a number outside
3460 // signed int64 range), the result is 0x8000000000000000, and 3460 // signed int64 range), the result is 0x8000000000000000, and
3461 // we must handle this case in the runtime. 3461 // we must handle this case in the runtime.
3462 Label ok; 3462 Label ok;
3463 __ cmp(Operand(esp, kPointerSize), Immediate(0x80000000u)); 3463 __ cmp(Operand(esp, kPointerSize), Immediate(0x80000000u));
3464 __ j(not_equal, &ok); 3464 __ j(not_equal, &ok);
3465 __ cmp(Operand(esp, 0), Immediate(0)); 3465 __ cmp(Operand(esp, 0), Immediate(0));
3466 __ j(not_equal, &ok); 3466 __ j(not_equal, &ok);
3467 __ add(esp, Immediate(2 * kPointerSize)); // Restore the stack. 3467 __ add(esp, Immediate(2 * kPointerSize)); // Restore the stack.
3468 __ jmp(&slow); 3468 __ jmp(&slow);
3469 3469
3470 __ bind(&ok); 3470 __ bind(&ok);
3471 __ pop(ebx); 3471 __ pop(ebx);
3472 __ add(esp, Immediate(kPointerSize)); 3472 __ add(esp, Immediate(kPointerSize));
3473 __ mov(Operand(edi, ecx, times_2, 0), ebx); 3473 __ mov(Operand(edi, ecx, times_2, 0), ebx);
3474 } else { 3474 } else {
3475 ASSERT(CpuFeatures::IsSupported(SSE2)); 3475 ASSERT(CpuFeatures::IsSupported(SSE2));
3476 CpuFeatures::Scope scope(SSE2); 3476 CpuFeatureScope scope(masm, SSE2);
3477 __ cvttsd2si(ebx, FieldOperand(eax, HeapNumber::kValueOffset)); 3477 __ cvttsd2si(ebx, FieldOperand(eax, HeapNumber::kValueOffset));
3478 __ cmp(ebx, 0x80000000u); 3478 __ cmp(ebx, 0x80000000u);
3479 __ j(equal, &slow); 3479 __ j(equal, &slow);
3480 // ebx: untagged integer value 3480 // ebx: untagged integer value
3481 switch (elements_kind) { 3481 switch (elements_kind) {
3482 case EXTERNAL_PIXEL_ELEMENTS: 3482 case EXTERNAL_PIXEL_ELEMENTS:
3483 __ ClampUint8(ebx); 3483 __ ClampUint8(ebx);
3484 // Fall through. 3484 // Fall through.
3485 case EXTERNAL_BYTE_ELEMENTS: 3485 case EXTERNAL_BYTE_ELEMENTS:
3486 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: 3486 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS:
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after
3826 __ jmp(ic_slow, RelocInfo::CODE_TARGET); 3826 __ jmp(ic_slow, RelocInfo::CODE_TARGET);
3827 } 3827 }
3828 } 3828 }
3829 3829
3830 3830
3831 #undef __ 3831 #undef __
3832 3832
3833 } } // namespace v8::internal 3833 } } // namespace v8::internal
3834 3834
3835 #endif // V8_TARGET_ARCH_IA32 3835 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/ia32/macro-assembler-ia32.cc ('k') | src/isolate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698