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

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

Issue 11190049: Improve ClampDoubleToUint8 on ia32/x64 (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 8 years, 2 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 4472 matching lines...) Expand 10 before | Expand all | Expand 10 after
4483 } 4483 }
4484 Handle<Map> map = map_set->last(); 4484 Handle<Map> map = map_set->last();
4485 DoCheckMapCommon(reg, map, REQUIRE_EXACT_MAP, instr->environment()); 4485 DoCheckMapCommon(reg, map, REQUIRE_EXACT_MAP, instr->environment());
4486 __ bind(&success); 4486 __ bind(&success);
4487 } 4487 }
4488 4488
4489 4489
4490 void LCodeGen::DoClampDToUint8(LClampDToUint8* instr) { 4490 void LCodeGen::DoClampDToUint8(LClampDToUint8* instr) {
4491 XMMRegister value_reg = ToDoubleRegister(instr->unclamped()); 4491 XMMRegister value_reg = ToDoubleRegister(instr->unclamped());
4492 Register result_reg = ToRegister(instr->result()); 4492 Register result_reg = ToRegister(instr->result());
4493 Register temp_reg = ToRegister(instr->temp()); 4493 __ ClampDoubleToUint8(value_reg, xmm0, result_reg);
4494 __ ClampDoubleToUint8(value_reg, xmm0, result_reg, temp_reg);
4495 } 4494 }
4496 4495
4497 4496
4498 void LCodeGen::DoClampIToUint8(LClampIToUint8* instr) { 4497 void LCodeGen::DoClampIToUint8(LClampIToUint8* instr) {
4499 ASSERT(instr->unclamped()->Equals(instr->result())); 4498 ASSERT(instr->unclamped()->Equals(instr->result()));
4500 Register value_reg = ToRegister(instr->result()); 4499 Register value_reg = ToRegister(instr->result());
4501 __ ClampUint8(value_reg); 4500 __ ClampUint8(value_reg);
4502 } 4501 }
4503 4502
4504 4503
4505 void LCodeGen::DoClampTToUint8(LClampTToUint8* instr) { 4504 void LCodeGen::DoClampTToUint8(LClampTToUint8* instr) {
4506 ASSERT(instr->unclamped()->Equals(instr->result())); 4505 ASSERT(instr->unclamped()->Equals(instr->result()));
4507 Register input_reg = ToRegister(instr->unclamped()); 4506 Register input_reg = ToRegister(instr->unclamped());
4508 Register temp_reg = ToRegister(instr->temp()); 4507 XMMRegister temp_xmm_reg = ToDoubleRegister(instr->temp_xmm());
4509 XMMRegister temp_xmm_reg = ToDoubleRegister(instr->temp2());
4510 Label is_smi, done, heap_number; 4508 Label is_smi, done, heap_number;
4511 4509
4512 __ JumpIfSmi(input_reg, &is_smi); 4510 __ JumpIfSmi(input_reg, &is_smi);
4513 4511
4514 // Check for heap number 4512 // Check for heap number
4515 __ Cmp(FieldOperand(input_reg, HeapObject::kMapOffset), 4513 __ Cmp(FieldOperand(input_reg, HeapObject::kMapOffset),
4516 factory()->heap_number_map()); 4514 factory()->heap_number_map());
4517 __ j(equal, &heap_number, Label::kNear); 4515 __ j(equal, &heap_number, Label::kNear);
4518 4516
4519 // Check for undefined. Undefined is converted to zero for clamping 4517 // Check for undefined. Undefined is converted to zero for clamping
4520 // conversions. 4518 // conversions.
4521 __ Cmp(input_reg, factory()->undefined_value()); 4519 __ Cmp(input_reg, factory()->undefined_value());
4522 DeoptimizeIf(not_equal, instr->environment()); 4520 DeoptimizeIf(not_equal, instr->environment());
4523 __ movq(input_reg, Immediate(0)); 4521 __ movq(input_reg, Immediate(0));
4524 __ jmp(&done, Label::kNear); 4522 __ jmp(&done, Label::kNear);
4525 4523
4526 // Heap number 4524 // Heap number
4527 __ bind(&heap_number); 4525 __ bind(&heap_number);
4528 __ movsd(xmm0, FieldOperand(input_reg, HeapNumber::kValueOffset)); 4526 __ movsd(xmm0, FieldOperand(input_reg, HeapNumber::kValueOffset));
4529 __ ClampDoubleToUint8(xmm0, temp_xmm_reg, input_reg, temp_reg); 4527 __ ClampDoubleToUint8(xmm0, temp_xmm_reg, input_reg);
4530 __ jmp(&done, Label::kNear); 4528 __ jmp(&done, Label::kNear);
4531 4529
4532 // smi 4530 // smi
4533 __ bind(&is_smi); 4531 __ bind(&is_smi);
4534 __ SmiToInteger32(input_reg, input_reg); 4532 __ SmiToInteger32(input_reg, input_reg);
4535 __ ClampUint8(input_reg); 4533 __ ClampUint8(input_reg);
4536 4534
4537 __ bind(&done); 4535 __ bind(&done);
4538 } 4536 }
4539 4537
(...skipping 773 matching lines...) Expand 10 before | Expand all | Expand 10 after
5313 FixedArray::kHeaderSize - kPointerSize)); 5311 FixedArray::kHeaderSize - kPointerSize));
5314 __ bind(&done); 5312 __ bind(&done);
5315 } 5313 }
5316 5314
5317 5315
5318 #undef __ 5316 #undef __
5319 5317
5320 } } // namespace v8::internal 5318 } } // namespace v8::internal
5321 5319
5322 #endif // V8_TARGET_ARCH_X64 5320 #endif // V8_TARGET_ARCH_X64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698