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 3335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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]. | 3355 // Clamp the value to [0..255]. |
3356 __ Usat(value, 8, Operand(value)); | 3356 __ Usat(value, 8, Operand(value)); |
Kevin Millikin (Chromium)
2011/05/16 07:06:35
Should this be removed?
danno
2011/05/16 14:13:43
Done.
| |
3357 // Fall through to the next case for the store instruction: | 3357 // Fall through to the next case for the store instruction: |
3358 case kExternalByteArray: | 3358 case kExternalByteArray: |
3359 case kExternalUnsignedByteArray: | 3359 case kExternalUnsignedByteArray: |
3360 __ strb(value, mem_operand); | 3360 __ strb(value, mem_operand); |
3361 break; | 3361 break; |
3362 case kExternalShortArray: | 3362 case kExternalShortArray: |
3363 case kExternalUnsignedShortArray: | 3363 case kExternalUnsignedShortArray: |
3364 __ strh(value, mem_operand); | 3364 __ strh(value, mem_operand); |
3365 break; | 3365 break; |
3366 case kExternalIntArray: | 3366 case kExternalIntArray: |
(...skipping 640 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4007 Register scratch = scratch0(); | 4007 Register scratch = scratch0(); |
4008 LOperand* input = instr->InputAt(0); | 4008 LOperand* input = instr->InputAt(0); |
4009 ASSERT(input->IsRegister()); | 4009 ASSERT(input->IsRegister()); |
4010 Register reg = ToRegister(input); | 4010 Register reg = ToRegister(input); |
4011 __ ldr(scratch, FieldMemOperand(reg, HeapObject::kMapOffset)); | 4011 __ ldr(scratch, FieldMemOperand(reg, HeapObject::kMapOffset)); |
4012 __ cmp(scratch, Operand(instr->hydrogen()->map())); | 4012 __ cmp(scratch, Operand(instr->hydrogen()->map())); |
4013 DeoptimizeIf(ne, instr->environment()); | 4013 DeoptimizeIf(ne, instr->environment()); |
4014 } | 4014 } |
4015 | 4015 |
4016 | 4016 |
4017 void LCodeGen::DoClampDoubleToUint8(LClampDoubleToUint8* instr) { | |
4018 DoubleRegister value_reg = ToDoubleRegister(instr->unclamped()); | |
4019 Register result_reg = ToRegister(instr->result()); | |
4020 DoubleRegister temp_reg = ToDoubleRegister(instr->TempAt(0)); | |
4021 __ ClampDoubleToUint8(result_reg, value_reg, temp_reg); | |
4022 } | |
4023 | |
4024 | |
4025 void LCodeGen::DoClampIToUint8(LClampIToUint8* instr) { | |
4026 Register unclamped_reg = ToRegister(instr->unclamped()); | |
4027 Register result_reg = ToRegister(instr->result()); | |
4028 __ ClampUint8(result_reg, unclamped_reg); | |
4029 } | |
4030 | |
4031 | |
4032 void LCodeGen::DoClampTaggedToUint8(LClampTaggedToUint8* instr) { | |
4033 Register scratch = scratch0(); | |
4034 Register input_reg = ToRegister(instr->unclamped()); | |
4035 Register result_reg = ToRegister(instr->result()); | |
4036 DoubleRegister temp_reg = ToDoubleRegister(instr->TempAt(0)); | |
4037 Label is_smi, done, heap_number; | |
4038 | |
4039 // Both smi and heap number cases are handled. | |
4040 __ JumpIfSmi(input_reg, &is_smi); | |
4041 | |
4042 // Check for heap number | |
4043 __ ldr(scratch, FieldMemOperand(input_reg, HeapObject::kMapOffset)); | |
4044 __ cmp(scratch, Operand(factory()->heap_number_map())); | |
4045 __ b(eq, &heap_number); | |
4046 | |
4047 // Check for undefined. Undefined is converted to zero for clamping | |
4048 // conversions. | |
4049 __ cmp(input_reg, Operand(factory()->undefined_value())); | |
4050 DeoptimizeIf(ne, instr->environment()); | |
4051 __ movt(input_reg, 0); | |
4052 __ b(al, &done); | |
Kevin Millikin (Chromium)
2011/05/16 07:06:35
There is __ jmp(&done) for ARM, which just emits _
danno
2011/05/16 14:13:43
Done.
| |
4053 | |
4054 // Heap number | |
4055 __ bind(&heap_number); | |
4056 __ sub(scratch0(), input_reg, Operand(kHeapObjectTag)); | |
4057 __ vldr(double_scratch0(), scratch0(), HeapNumber::kValueOffset); | |
Kevin Millikin (Chromium)
2011/05/16 07:06:35
Someone has kindly implemented vldr to take a MemO
danno
2011/05/16 14:13:43
Done.
| |
4058 __ ClampDoubleToUint8(result_reg, double_scratch0(), temp_reg); | |
4059 __ b(al, &done); | |
4060 | |
4061 // smi | |
4062 __ bind(&is_smi); | |
4063 __ SmiUntag(result_reg, input_reg); | |
4064 __ ClampUint8(result_reg, result_reg); | |
4065 | |
4066 __ bind(&done); | |
4067 } | |
4068 | |
4069 | |
4017 void LCodeGen::LoadHeapObject(Register result, | 4070 void LCodeGen::LoadHeapObject(Register result, |
4018 Handle<HeapObject> object) { | 4071 Handle<HeapObject> object) { |
4019 if (heap()->InNewSpace(*object)) { | 4072 if (heap()->InNewSpace(*object)) { |
4020 Handle<JSGlobalPropertyCell> cell = | 4073 Handle<JSGlobalPropertyCell> cell = |
4021 factory()->NewJSGlobalPropertyCell(object); | 4074 factory()->NewJSGlobalPropertyCell(object); |
4022 __ mov(result, Operand(cell)); | 4075 __ mov(result, Operand(cell)); |
4023 __ ldr(result, FieldMemOperand(result, JSGlobalPropertyCell::kValueOffset)); | 4076 __ ldr(result, FieldMemOperand(result, JSGlobalPropertyCell::kValueOffset)); |
4024 } else { | 4077 } else { |
4025 __ mov(result, Operand(object)); | 4078 __ mov(result, Operand(object)); |
4026 } | 4079 } |
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4416 ASSERT(osr_pc_offset_ == -1); | 4469 ASSERT(osr_pc_offset_ == -1); |
4417 osr_pc_offset_ = masm()->pc_offset(); | 4470 osr_pc_offset_ = masm()->pc_offset(); |
4418 } | 4471 } |
4419 | 4472 |
4420 | 4473 |
4421 | 4474 |
4422 | 4475 |
4423 #undef __ | 4476 #undef __ |
4424 | 4477 |
4425 } } // namespace v8::internal | 4478 } } // namespace v8::internal |
OLD | NEW |