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

Side by Side Diff: src/ia32/macro-assembler-ia32.cc

Issue 7014033: Support conversion of clamped double values for pixel arrays in Crankshaft. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: tweaks 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
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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 // Compute number of region covering addr. See Page::GetRegionNumberForAddress 70 // Compute number of region covering addr. See Page::GetRegionNumberForAddress
71 // method for more details. 71 // method for more details.
72 and_(addr, Page::kPageAlignmentMask); 72 and_(addr, Page::kPageAlignmentMask);
73 shr(addr, Page::kRegionSizeLog2); 73 shr(addr, Page::kRegionSizeLog2);
74 74
75 // Set dirty mark for region. 75 // Set dirty mark for region.
76 bts(Operand(object, Page::kDirtyFlagOffset), addr); 76 bts(Operand(object, Page::kDirtyFlagOffset), addr);
77 } 77 }
78 78
79 79
80 void MacroAssembler::ClampDoubleToUint8(XMMRegister input_reg,
81 XMMRegister scratch_reg,
82 Register result_reg) {
83 Label above_zero;
84 Label done;
85 Label in_bounds;
86 ExternalReference zero = ExternalReference::address_of_zero();
87 movdbl(scratch_reg, Operand::StaticVariable(zero));
88 ucomisd(input_reg, scratch_reg);
89 j(above, &above_zero, Label::kNear);
90 Set(result_reg, Immediate(0));
91 jmp(&done, Label::kNear);
92 bind(&above_zero);
93 ExternalReference uint8_max_value =
94 ExternalReference::address_of_uint8_max_value();
95 movdbl(scratch_reg, Operand::StaticVariable(uint8_max_value));
96 ucomisd(input_reg, scratch_reg);
97 j(below_equal, &in_bounds, Label::kNear);
98 Set(result_reg, Immediate(255));
99 jmp(&done, Label::kNear);
100 bind(&in_bounds);
101 ExternalReference one_half =
102 ExternalReference::address_of_one_half();
103 movdbl(scratch_reg, Operand::StaticVariable(one_half));
104 addsd(scratch_reg, input_reg);
105 cvttsd2si(result_reg, Operand(scratch_reg));
106 bind(&done);
107 }
108
109
110 void MacroAssembler::ClampUint8(Register reg) {
111 Label done;
112 test(reg, Immediate(0xFFFFFF00));
113 j(zero, &done, Label::kNear);
114 setcc(negative, reg); // 1 if negative, 0 if positive.
115 dec_b(reg); // 0 if negative, 255 if positive.
116 bind(&done);
117 }
118
119
80 void MacroAssembler::InNewSpace(Register object, 120 void MacroAssembler::InNewSpace(Register object,
81 Register scratch, 121 Register scratch,
82 Condition cc, 122 Condition cc,
83 Label* branch, 123 Label* branch,
84 Label::Distance branch_near) { 124 Label::Distance branch_near) {
85 ASSERT(cc == equal || cc == not_equal); 125 ASSERT(cc == equal || cc == not_equal);
86 if (Serializer::enabled()) { 126 if (Serializer::enabled()) {
87 // Can't do arithmetic on external references if it might get serialized. 127 // Can't do arithmetic on external references if it might get serialized.
88 mov(scratch, Operand(object)); 128 mov(scratch, Operand(object));
89 // The mask isn't really an address. We load it as an external reference in 129 // The mask isn't really an address. We load it as an external reference in
(...skipping 1949 matching lines...) Expand 10 before | Expand all | Expand 10 after
2039 2079
2040 // Check that the code was patched as expected. 2080 // Check that the code was patched as expected.
2041 ASSERT(masm_.pc_ == address_ + size_); 2081 ASSERT(masm_.pc_ == address_ + size_);
2042 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); 2082 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap);
2043 } 2083 }
2044 2084
2045 2085
2046 } } // namespace v8::internal 2086 } } // namespace v8::internal
2047 2087
2048 #endif // V8_TARGET_ARCH_IA32 2088 #endif // V8_TARGET_ARCH_IA32
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698