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

Side by Side Diff: src/ia32/lithium-codegen-ia32.cc

Issue 7043003: Version 3.3.8 (Closed) Base URL: https://v8.googlecode.com/svn/trunk
Patch Set: Created 9 years, 7 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/ic-ia32.cc ('k') | src/ia32/lithium-ia32.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 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 3181 matching lines...) Expand 10 before | Expand all | Expand 10 after
3192 Operand operand(BuildExternalArrayOperand(instr->external_pointer(), 3192 Operand operand(BuildExternalArrayOperand(instr->external_pointer(),
3193 instr->key(), array_type)); 3193 instr->key(), array_type));
3194 if (array_type == kExternalFloatArray) { 3194 if (array_type == kExternalFloatArray) {
3195 __ cvtsd2ss(xmm0, ToDoubleRegister(instr->value())); 3195 __ cvtsd2ss(xmm0, ToDoubleRegister(instr->value()));
3196 __ movss(operand, xmm0); 3196 __ movss(operand, xmm0);
3197 } else if (array_type == kExternalDoubleArray) { 3197 } else if (array_type == kExternalDoubleArray) {
3198 __ movdbl(operand, ToDoubleRegister(instr->value())); 3198 __ movdbl(operand, ToDoubleRegister(instr->value()));
3199 } else { 3199 } else {
3200 Register value = ToRegister(instr->value()); 3200 Register value = ToRegister(instr->value());
3201 switch (array_type) { 3201 switch (array_type) {
3202 case kExternalPixelArray: { 3202 case kExternalPixelArray:
3203 // Clamp the value to [0..255].
3204 Register temp = ToRegister(instr->TempAt(0));
3205 // The dec_b below requires that the clamped value is in a byte
3206 // register. eax is an arbitrary choice to satisfy this requirement, we
3207 // hinted the register allocator to give us eax when building the
3208 // instruction.
3209 ASSERT(temp.is(eax));
3210 __ mov(temp, ToRegister(instr->value()));
3211 Label done;
3212 __ test(temp, Immediate(0xFFFFFF00));
3213 __ j(zero, &done, Label::kNear);
3214 __ setcc(negative, temp); // 1 if negative, 0 if positive.
3215 __ dec_b(temp); // 0 if negative, 255 if positive.
3216 __ bind(&done);
3217 __ mov_b(operand, temp);
3218 break;
3219 }
3220 case kExternalByteArray: 3203 case kExternalByteArray:
3221 case kExternalUnsignedByteArray: 3204 case kExternalUnsignedByteArray:
3222 __ mov_b(operand, value); 3205 __ mov_b(operand, value);
3223 break; 3206 break;
3224 case kExternalShortArray: 3207 case kExternalShortArray:
3225 case kExternalUnsignedShortArray: 3208 case kExternalUnsignedShortArray:
3226 __ mov_w(operand, value); 3209 __ mov_w(operand, value);
3227 break; 3210 break;
3228 case kExternalIntArray: 3211 case kExternalIntArray:
3229 case kExternalUnsignedIntArray: 3212 case kExternalUnsignedIntArray:
(...skipping 731 matching lines...) Expand 10 before | Expand all | Expand 10 after
3961 void LCodeGen::DoCheckMap(LCheckMap* instr) { 3944 void LCodeGen::DoCheckMap(LCheckMap* instr) {
3962 LOperand* input = instr->InputAt(0); 3945 LOperand* input = instr->InputAt(0);
3963 ASSERT(input->IsRegister()); 3946 ASSERT(input->IsRegister());
3964 Register reg = ToRegister(input); 3947 Register reg = ToRegister(input);
3965 __ cmp(FieldOperand(reg, HeapObject::kMapOffset), 3948 __ cmp(FieldOperand(reg, HeapObject::kMapOffset),
3966 instr->hydrogen()->map()); 3949 instr->hydrogen()->map());
3967 DeoptimizeIf(not_equal, instr->environment()); 3950 DeoptimizeIf(not_equal, instr->environment());
3968 } 3951 }
3969 3952
3970 3953
3954 void LCodeGen::DoClampDToUint8(LClampDToUint8* instr) {
3955 XMMRegister value_reg = ToDoubleRegister(instr->unclamped());
3956 Register result_reg = ToRegister(instr->result());
3957 __ ClampDoubleToUint8(value_reg, xmm0, result_reg);
3958 }
3959
3960
3961 void LCodeGen::DoClampIToUint8(LClampIToUint8* instr) {
3962 ASSERT(instr->unclamped()->Equals(instr->result()));
3963 Register value_reg = ToRegister(instr->result());
3964 __ ClampUint8(value_reg);
3965 }
3966
3967
3968 void LCodeGen::DoClampTToUint8(LClampTToUint8* instr) {
3969 ASSERT(instr->unclamped()->Equals(instr->result()));
3970 Register input_reg = ToRegister(instr->unclamped());
3971 Label is_smi, done, heap_number;
3972
3973 __ JumpIfSmi(input_reg, &is_smi);
3974
3975 // Check for heap number
3976 __ cmp(FieldOperand(input_reg, HeapObject::kMapOffset),
3977 factory()->heap_number_map());
3978 __ j(equal, &heap_number, Label::kNear);
3979
3980 // Check for undefined. Undefined is converted to zero for clamping
3981 // conversions.
3982 __ cmp(input_reg, factory()->undefined_value());
3983 DeoptimizeIf(not_equal, instr->environment());
3984 __ mov(input_reg, 0);
3985 __ jmp(&done, Label::kNear);
3986
3987 // Heap number
3988 __ bind(&heap_number);
3989 __ movdbl(xmm0, FieldOperand(input_reg, HeapNumber::kValueOffset));
3990 __ ClampDoubleToUint8(xmm0, xmm1, input_reg);
3991 __ jmp(&done, Label::kNear);
3992
3993 // smi
3994 __ bind(&is_smi);
3995 __ SmiUntag(input_reg);
3996 __ ClampUint8(input_reg);
3997
3998 __ bind(&done);
3999 }
4000
4001
3971 void LCodeGen::LoadHeapObject(Register result, Handle<HeapObject> object) { 4002 void LCodeGen::LoadHeapObject(Register result, Handle<HeapObject> object) {
3972 if (isolate()->heap()->InNewSpace(*object)) { 4003 if (isolate()->heap()->InNewSpace(*object)) {
3973 Handle<JSGlobalPropertyCell> cell = 4004 Handle<JSGlobalPropertyCell> cell =
3974 isolate()->factory()->NewJSGlobalPropertyCell(object); 4005 isolate()->factory()->NewJSGlobalPropertyCell(object);
3975 __ mov(result, Operand::Cell(cell)); 4006 __ mov(result, Operand::Cell(cell));
3976 } else { 4007 } else {
3977 __ mov(result, object); 4008 __ mov(result, object);
3978 } 4009 }
3979 } 4010 }
3980 4011
(...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after
4399 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); 4430 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset));
4400 __ InvokeBuiltin(Builtins::IN, CALL_FUNCTION, safepoint_generator); 4431 __ InvokeBuiltin(Builtins::IN, CALL_FUNCTION, safepoint_generator);
4401 } 4432 }
4402 4433
4403 4434
4404 #undef __ 4435 #undef __
4405 4436
4406 } } // namespace v8::internal 4437 } } // namespace v8::internal
4407 4438
4408 #endif // V8_TARGET_ARCH_IA32 4439 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/ia32/ic-ia32.cc ('k') | src/ia32/lithium-ia32.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698