OLD | NEW |
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 3334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3345 } else { // i.e. array_type == kExternalDoubleArray | 3345 } else { // i.e. array_type == kExternalDoubleArray |
3346 __ vstr(value, scratch0(), 0); | 3346 __ vstr(value, scratch0(), 0); |
3347 } | 3347 } |
3348 } else { | 3348 } else { |
3349 Register value(ToRegister(instr->value())); | 3349 Register value(ToRegister(instr->value())); |
3350 MemOperand mem_operand(key_is_constant | 3350 MemOperand mem_operand(key_is_constant |
3351 ? MemOperand(external_pointer, constant_key * (1 << shift_size)) | 3351 ? MemOperand(external_pointer, constant_key * (1 << shift_size)) |
3352 : MemOperand(external_pointer, key, LSL, shift_size)); | 3352 : MemOperand(external_pointer, key, LSL, shift_size)); |
3353 switch (array_type) { | 3353 switch (array_type) { |
3354 case kExternalPixelArray: | 3354 case kExternalPixelArray: |
3355 // Clamp the value to [0..255]. | |
3356 __ Usat(value, 8, Operand(value)); | |
3357 // Fall through to the next case for the store instruction: | |
3358 case kExternalByteArray: | 3355 case kExternalByteArray: |
3359 case kExternalUnsignedByteArray: | 3356 case kExternalUnsignedByteArray: |
3360 __ strb(value, mem_operand); | 3357 __ strb(value, mem_operand); |
3361 break; | 3358 break; |
3362 case kExternalShortArray: | 3359 case kExternalShortArray: |
3363 case kExternalUnsignedShortArray: | 3360 case kExternalUnsignedShortArray: |
3364 __ strh(value, mem_operand); | 3361 __ strh(value, mem_operand); |
3365 break; | 3362 break; |
3366 case kExternalIntArray: | 3363 case kExternalIntArray: |
3367 case kExternalUnsignedIntArray: | 3364 case kExternalUnsignedIntArray: |
(...skipping 639 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4007 Register scratch = scratch0(); | 4004 Register scratch = scratch0(); |
4008 LOperand* input = instr->InputAt(0); | 4005 LOperand* input = instr->InputAt(0); |
4009 ASSERT(input->IsRegister()); | 4006 ASSERT(input->IsRegister()); |
4010 Register reg = ToRegister(input); | 4007 Register reg = ToRegister(input); |
4011 __ ldr(scratch, FieldMemOperand(reg, HeapObject::kMapOffset)); | 4008 __ ldr(scratch, FieldMemOperand(reg, HeapObject::kMapOffset)); |
4012 __ cmp(scratch, Operand(instr->hydrogen()->map())); | 4009 __ cmp(scratch, Operand(instr->hydrogen()->map())); |
4013 DeoptimizeIf(ne, instr->environment()); | 4010 DeoptimizeIf(ne, instr->environment()); |
4014 } | 4011 } |
4015 | 4012 |
4016 | 4013 |
| 4014 void LCodeGen::DoClampDToUint8(LClampDToUint8* instr) { |
| 4015 DoubleRegister value_reg = ToDoubleRegister(instr->unclamped()); |
| 4016 Register result_reg = ToRegister(instr->result()); |
| 4017 DoubleRegister temp_reg = ToDoubleRegister(instr->TempAt(0)); |
| 4018 __ ClampDoubleToUint8(result_reg, value_reg, temp_reg); |
| 4019 } |
| 4020 |
| 4021 |
| 4022 void LCodeGen::DoClampIToUint8(LClampIToUint8* instr) { |
| 4023 Register unclamped_reg = ToRegister(instr->unclamped()); |
| 4024 Register result_reg = ToRegister(instr->result()); |
| 4025 __ ClampUint8(result_reg, unclamped_reg); |
| 4026 } |
| 4027 |
| 4028 |
| 4029 void LCodeGen::DoClampTToUint8(LClampTToUint8* instr) { |
| 4030 Register scratch = scratch0(); |
| 4031 Register input_reg = ToRegister(instr->unclamped()); |
| 4032 Register result_reg = ToRegister(instr->result()); |
| 4033 DoubleRegister temp_reg = ToDoubleRegister(instr->TempAt(0)); |
| 4034 Label is_smi, done, heap_number; |
| 4035 |
| 4036 // Both smi and heap number cases are handled. |
| 4037 __ JumpIfSmi(input_reg, &is_smi); |
| 4038 |
| 4039 // Check for heap number |
| 4040 __ ldr(scratch, FieldMemOperand(input_reg, HeapObject::kMapOffset)); |
| 4041 __ cmp(scratch, Operand(factory()->heap_number_map())); |
| 4042 __ b(eq, &heap_number); |
| 4043 |
| 4044 // Check for undefined. Undefined is converted to zero for clamping |
| 4045 // conversions. |
| 4046 __ cmp(input_reg, Operand(factory()->undefined_value())); |
| 4047 DeoptimizeIf(ne, instr->environment()); |
| 4048 __ movt(input_reg, 0); |
| 4049 __ jmp(&done); |
| 4050 |
| 4051 // Heap number |
| 4052 __ bind(&heap_number); |
| 4053 __ vldr(double_scratch0(), FieldMemOperand(input_reg, |
| 4054 HeapNumber::kValueOffset)); |
| 4055 __ ClampDoubleToUint8(result_reg, double_scratch0(), temp_reg); |
| 4056 __ jmp(&done); |
| 4057 |
| 4058 // smi |
| 4059 __ bind(&is_smi); |
| 4060 __ SmiUntag(result_reg, input_reg); |
| 4061 __ ClampUint8(result_reg, result_reg); |
| 4062 |
| 4063 __ bind(&done); |
| 4064 } |
| 4065 |
| 4066 |
4017 void LCodeGen::LoadHeapObject(Register result, | 4067 void LCodeGen::LoadHeapObject(Register result, |
4018 Handle<HeapObject> object) { | 4068 Handle<HeapObject> object) { |
4019 if (heap()->InNewSpace(*object)) { | 4069 if (heap()->InNewSpace(*object)) { |
4020 Handle<JSGlobalPropertyCell> cell = | 4070 Handle<JSGlobalPropertyCell> cell = |
4021 factory()->NewJSGlobalPropertyCell(object); | 4071 factory()->NewJSGlobalPropertyCell(object); |
4022 __ mov(result, Operand(cell)); | 4072 __ mov(result, Operand(cell)); |
4023 __ ldr(result, FieldMemOperand(result, JSGlobalPropertyCell::kValueOffset)); | 4073 __ ldr(result, FieldMemOperand(result, JSGlobalPropertyCell::kValueOffset)); |
4024 } else { | 4074 } else { |
4025 __ mov(result, Operand(object)); | 4075 __ mov(result, Operand(object)); |
4026 } | 4076 } |
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4416 ASSERT(osr_pc_offset_ == -1); | 4466 ASSERT(osr_pc_offset_ == -1); |
4417 osr_pc_offset_ = masm()->pc_offset(); | 4467 osr_pc_offset_ = masm()->pc_offset(); |
4418 } | 4468 } |
4419 | 4469 |
4420 | 4470 |
4421 | 4471 |
4422 | 4472 |
4423 #undef __ | 4473 #undef __ |
4424 | 4474 |
4425 } } // namespace v8::internal | 4475 } } // namespace v8::internal |
OLD | NEW |