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

Side by Side Diff: src/x64/lithium-codegen-x64.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/x64/code-stubs-x64.cc ('k') | src/x64/lithium-x64.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 3167 matching lines...) Expand 10 before | Expand all | Expand 10 after
3178 if (array_type == kExternalFloatArray) { 3178 if (array_type == kExternalFloatArray) {
3179 XMMRegister value(ToDoubleRegister(instr->value())); 3179 XMMRegister value(ToDoubleRegister(instr->value()));
3180 __ cvtsd2ss(value, value); 3180 __ cvtsd2ss(value, value);
3181 __ movss(operand, value); 3181 __ movss(operand, value);
3182 } else if (array_type == kExternalDoubleArray) { 3182 } else if (array_type == kExternalDoubleArray) {
3183 __ movsd(operand, ToDoubleRegister(instr->value())); 3183 __ movsd(operand, ToDoubleRegister(instr->value()));
3184 } else { 3184 } else {
3185 Register value(ToRegister(instr->value())); 3185 Register value(ToRegister(instr->value()));
3186 switch (array_type) { 3186 switch (array_type) {
3187 case kExternalPixelArray: 3187 case kExternalPixelArray:
3188 { // Clamp the value to [0..255].
3189 Label done;
3190 __ testl(value, Immediate(0xFFFFFF00));
3191 __ j(zero, &done, Label::kNear);
3192 __ setcc(negative, value); // 1 if negative, 0 if positive.
3193 __ decb(value); // 0 if negative, 255 if positive.
3194 __ bind(&done);
3195 __ movb(operand, value);
3196 }
3197 break;
3198 case kExternalByteArray: 3188 case kExternalByteArray:
3199 case kExternalUnsignedByteArray: 3189 case kExternalUnsignedByteArray:
3200 __ movb(operand, value); 3190 __ movb(operand, value);
3201 break; 3191 break;
3202 case kExternalShortArray: 3192 case kExternalShortArray:
3203 case kExternalUnsignedShortArray: 3193 case kExternalUnsignedShortArray:
3204 __ movw(operand, value); 3194 __ movw(operand, value);
3205 break; 3195 break;
3206 case kExternalIntArray: 3196 case kExternalIntArray:
3207 case kExternalUnsignedIntArray: 3197 case kExternalUnsignedIntArray:
(...skipping 570 matching lines...) Expand 10 before | Expand all | Expand 10 after
3778 void LCodeGen::DoCheckMap(LCheckMap* instr) { 3768 void LCodeGen::DoCheckMap(LCheckMap* instr) {
3779 LOperand* input = instr->InputAt(0); 3769 LOperand* input = instr->InputAt(0);
3780 ASSERT(input->IsRegister()); 3770 ASSERT(input->IsRegister());
3781 Register reg = ToRegister(input); 3771 Register reg = ToRegister(input);
3782 __ Cmp(FieldOperand(reg, HeapObject::kMapOffset), 3772 __ Cmp(FieldOperand(reg, HeapObject::kMapOffset),
3783 instr->hydrogen()->map()); 3773 instr->hydrogen()->map());
3784 DeoptimizeIf(not_equal, instr->environment()); 3774 DeoptimizeIf(not_equal, instr->environment());
3785 } 3775 }
3786 3776
3787 3777
3778 void LCodeGen::DoClampDToUint8(LClampDToUint8* instr) {
3779 XMMRegister value_reg = ToDoubleRegister(instr->unclamped());
3780 Register result_reg = ToRegister(instr->result());
3781 Register temp_reg = ToRegister(instr->TempAt(0));
3782 __ ClampDoubleToUint8(value_reg, xmm0, result_reg, temp_reg);
3783 }
3784
3785
3786 void LCodeGen::DoClampIToUint8(LClampIToUint8* instr) {
3787 ASSERT(instr->unclamped()->Equals(instr->result()));
3788 Register value_reg = ToRegister(instr->result());
3789 __ ClampUint8(value_reg);
3790 }
3791
3792
3793 void LCodeGen::DoClampTToUint8(LClampTToUint8* instr) {
3794 ASSERT(instr->unclamped()->Equals(instr->result()));
3795 Register input_reg = ToRegister(instr->unclamped());
3796 Register temp_reg = ToRegister(instr->TempAt(0));
3797 XMMRegister temp_xmm_reg = ToDoubleRegister(instr->TempAt(1));
3798 Label is_smi, done, heap_number;
3799
3800 __ JumpIfSmi(input_reg, &is_smi);
3801
3802 // Check for heap number
3803 __ Cmp(FieldOperand(input_reg, HeapObject::kMapOffset),
3804 factory()->heap_number_map());
3805 __ j(equal, &heap_number, Label::kNear);
3806
3807 // Check for undefined. Undefined is converted to zero for clamping
3808 // conversions.
3809 __ Cmp(input_reg, factory()->undefined_value());
3810 DeoptimizeIf(not_equal, instr->environment());
3811 __ movq(input_reg, Immediate(0));
3812 __ jmp(&done, Label::kNear);
3813
3814 // Heap number
3815 __ bind(&heap_number);
3816 __ movsd(xmm0, FieldOperand(input_reg, HeapNumber::kValueOffset));
3817 __ ClampDoubleToUint8(xmm0, temp_xmm_reg, input_reg, temp_reg);
3818 __ jmp(&done, Label::kNear);
3819
3820 // smi
3821 __ bind(&is_smi);
3822 __ SmiToInteger32(input_reg, input_reg);
3823 __ ClampUint8(input_reg);
3824
3825 __ bind(&done);
3826 }
3827
3828
3788 void LCodeGen::LoadHeapObject(Register result, Handle<HeapObject> object) { 3829 void LCodeGen::LoadHeapObject(Register result, Handle<HeapObject> object) {
3789 if (heap()->InNewSpace(*object)) { 3830 if (heap()->InNewSpace(*object)) {
3790 Handle<JSGlobalPropertyCell> cell = 3831 Handle<JSGlobalPropertyCell> cell =
3791 factory()->NewJSGlobalPropertyCell(object); 3832 factory()->NewJSGlobalPropertyCell(object);
3792 __ movq(result, cell, RelocInfo::GLOBAL_PROPERTY_CELL); 3833 __ movq(result, cell, RelocInfo::GLOBAL_PROPERTY_CELL);
3793 __ movq(result, Operand(result, 0)); 3834 __ movq(result, Operand(result, 0));
3794 } else { 3835 } else {
3795 __ Move(result, object); 3836 __ Move(result, object);
3796 } 3837 }
3797 } 3838 }
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after
4195 RegisterEnvironmentForDeoptimization(environment); 4236 RegisterEnvironmentForDeoptimization(environment);
4196 ASSERT(osr_pc_offset_ == -1); 4237 ASSERT(osr_pc_offset_ == -1);
4197 osr_pc_offset_ = masm()->pc_offset(); 4238 osr_pc_offset_ = masm()->pc_offset();
4198 } 4239 }
4199 4240
4200 #undef __ 4241 #undef __
4201 4242
4202 } } // namespace v8::internal 4243 } } // namespace v8::internal
4203 4244
4204 #endif // V8_TARGET_ARCH_X64 4245 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/x64/code-stubs-x64.cc ('k') | src/x64/lithium-x64.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698