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

Side by Side Diff: src/arm/macro-assembler-arm.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: review feedback 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/arm/macro-assembler-arm.h ('k') | src/assembler.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 3010 matching lines...) Expand 10 before | Expand all | Expand 10 after
3021 // Result was clobbered. Restore it. 3021 // Result was clobbered. Restore it.
3022 ldr(result, MemOperand(ldr_location)); 3022 ldr(result, MemOperand(ldr_location));
3023 } 3023 }
3024 // Get the address of the constant. 3024 // Get the address of the constant.
3025 and_(result, result, Operand(kLdrOffsetMask)); 3025 and_(result, result, Operand(kLdrOffsetMask));
3026 add(result, ldr_location, Operand(result)); 3026 add(result, ldr_location, Operand(result));
3027 add(result, result, Operand(kPCRegOffset)); 3027 add(result, result, Operand(kPCRegOffset));
3028 } 3028 }
3029 3029
3030 3030
3031 void MacroAssembler::ClampUint8(Register output_reg, Register input_reg) {
3032 Usat(output_reg, 8, Operand(input_reg));
3033 }
3034
3035
3036 void MacroAssembler::ClampDoubleToUint8(Register result_reg,
3037 DoubleRegister input_reg,
3038 DoubleRegister temp_double_reg) {
3039 Label above_zero;
3040 Label done;
3041 Label in_bounds;
3042
3043 vmov(temp_double_reg, 0.0);
3044 VFPCompareAndSetFlags(input_reg, temp_double_reg);
3045 b(gt, &above_zero);
3046
3047 // Double value is less than zero, NaN or Inf, return 0.
3048 mov(result_reg, Operand(0));
3049 b(al, &done);
3050
3051 // Double value is >= 255, return 255.
3052 bind(&above_zero);
3053 vmov(temp_double_reg, 255.0);
3054 VFPCompareAndSetFlags(input_reg, temp_double_reg);
3055 b(le, &in_bounds);
3056 mov(result_reg, Operand(255));
3057 b(al, &done);
3058
3059 // In 0-255 range, round and truncate.
3060 bind(&in_bounds);
3061 vmov(temp_double_reg, 0.5);
3062 vadd(temp_double_reg, input_reg, temp_double_reg);
3063 vcvt_u32_f64(s0, temp_double_reg);
3064 vmov(result_reg, s0);
3065 bind(&done);
3066 }
3067
3068
3031 CodePatcher::CodePatcher(byte* address, int instructions) 3069 CodePatcher::CodePatcher(byte* address, int instructions)
3032 : address_(address), 3070 : address_(address),
3033 instructions_(instructions), 3071 instructions_(instructions),
3034 size_(instructions * Assembler::kInstrSize), 3072 size_(instructions * Assembler::kInstrSize),
3035 masm_(Isolate::Current(), address, size_ + Assembler::kGap) { 3073 masm_(Isolate::Current(), address, size_ + Assembler::kGap) {
3036 // Create a new macro assembler pointing to the address of the code to patch. 3074 // Create a new macro assembler pointing to the address of the code to patch.
3037 // The size is adjusted with kGap on order for the assembler to generate size 3075 // The size is adjusted with kGap on order for the assembler to generate size
3038 // bytes of instructions without failing with buffer size constraints. 3076 // bytes of instructions without failing with buffer size constraints.
3039 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); 3077 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap);
3040 } 3078 }
(...skipping 22 matching lines...) Expand all
3063 void CodePatcher::EmitCondition(Condition cond) { 3101 void CodePatcher::EmitCondition(Condition cond) {
3064 Instr instr = Assembler::instr_at(masm_.pc_); 3102 Instr instr = Assembler::instr_at(masm_.pc_);
3065 instr = (instr & ~kCondMask) | cond; 3103 instr = (instr & ~kCondMask) | cond;
3066 masm_.emit(instr); 3104 masm_.emit(instr);
3067 } 3105 }
3068 3106
3069 3107
3070 } } // namespace v8::internal 3108 } } // namespace v8::internal
3071 3109
3072 #endif // V8_TARGET_ARCH_ARM 3110 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « src/arm/macro-assembler-arm.h ('k') | src/assembler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698