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 2074 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2085 times_pointer_size, | 2085 times_pointer_size, |
2086 FixedArray::kHeaderSize)); | 2086 FixedArray::kHeaderSize)); |
2087 | 2087 |
2088 // Check for the hole value. | 2088 // Check for the hole value. |
2089 __ cmp(result, Factory::the_hole_value()); | 2089 __ cmp(result, Factory::the_hole_value()); |
2090 DeoptimizeIf(equal, instr->environment()); | 2090 DeoptimizeIf(equal, instr->environment()); |
2091 } | 2091 } |
2092 | 2092 |
2093 | 2093 |
2094 void LCodeGen::DoLoadPixelArrayElement(LLoadPixelArrayElement* instr) { | 2094 void LCodeGen::DoLoadPixelArrayElement(LLoadPixelArrayElement* instr) { |
2095 Register external_elements = ToRegister(instr->external_pointer()); | 2095 Register external_pointer = ToRegister(instr->external_pointer()); |
2096 Register key = ToRegister(instr->key()); | 2096 Register key = ToRegister(instr->key()); |
2097 Register result = ToRegister(instr->result()); | 2097 Register result = ToRegister(instr->result()); |
2098 ASSERT(result.is(external_elements)); | 2098 ASSERT(result.is(external_pointer)); |
2099 | 2099 |
2100 // Load the result. | 2100 // Load the result. |
2101 __ movzx_b(result, Operand(external_elements, key, times_1, 0)); | 2101 __ movzx_b(result, Operand(external_pointer, key, times_1, 0)); |
2102 } | 2102 } |
2103 | 2103 |
2104 | 2104 |
2105 void LCodeGen::DoLoadKeyedGeneric(LLoadKeyedGeneric* instr) { | 2105 void LCodeGen::DoLoadKeyedGeneric(LLoadKeyedGeneric* instr) { |
2106 ASSERT(ToRegister(instr->context()).is(esi)); | 2106 ASSERT(ToRegister(instr->context()).is(esi)); |
2107 ASSERT(ToRegister(instr->object()).is(edx)); | 2107 ASSERT(ToRegister(instr->object()).is(edx)); |
2108 ASSERT(ToRegister(instr->key()).is(eax)); | 2108 ASSERT(ToRegister(instr->key()).is(eax)); |
2109 | 2109 |
2110 Handle<Code> ic(Builtins::builtin(Builtins::KeyedLoadIC_Initialize)); | 2110 Handle<Code> ic(Builtins::builtin(Builtins::KeyedLoadIC_Initialize)); |
2111 CallCode(ic, RelocInfo::CODE_TARGET, instr); | 2111 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
(...skipping 599 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2711 CallCode(ic, RelocInfo::CODE_TARGET, instr); | 2711 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
2712 } | 2712 } |
2713 | 2713 |
2714 | 2714 |
2715 void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) { | 2715 void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) { |
2716 __ cmp(ToRegister(instr->index()), ToOperand(instr->length())); | 2716 __ cmp(ToRegister(instr->index()), ToOperand(instr->length())); |
2717 DeoptimizeIf(above_equal, instr->environment()); | 2717 DeoptimizeIf(above_equal, instr->environment()); |
2718 } | 2718 } |
2719 | 2719 |
2720 | 2720 |
| 2721 void LCodeGen::DoStorePixelArrayElement(LStorePixelArrayElement* instr) { |
| 2722 Register external_pointer = ToRegister(instr->external_pointer()); |
| 2723 Register key = ToRegister(instr->key()); |
| 2724 Register value = ToRegister(instr->value()); |
| 2725 ASSERT(ToRegister(instr->TempAt(0)).is(eax)); |
| 2726 |
| 2727 __ mov(eax, value); |
| 2728 { // Clamp the value to [0..255]. |
| 2729 NearLabel done; |
| 2730 __ test(eax, Immediate(0xFFFFFF00)); |
| 2731 __ j(zero, &done); |
| 2732 __ setcc(negative, eax); // 1 if negative, 0 if positive. |
| 2733 __ dec_b(eax); // 0 if negative, 255 if positive. |
| 2734 __ bind(&done); |
| 2735 } |
| 2736 __ mov_b(Operand(external_pointer, key, times_1, 0), eax); |
| 2737 } |
| 2738 |
| 2739 |
2721 void LCodeGen::DoStoreKeyedFastElement(LStoreKeyedFastElement* instr) { | 2740 void LCodeGen::DoStoreKeyedFastElement(LStoreKeyedFastElement* instr) { |
2722 Register value = ToRegister(instr->value()); | 2741 Register value = ToRegister(instr->value()); |
2723 Register elements = ToRegister(instr->object()); | 2742 Register elements = ToRegister(instr->object()); |
2724 Register key = instr->key()->IsRegister() ? ToRegister(instr->key()) : no_reg; | 2743 Register key = instr->key()->IsRegister() ? ToRegister(instr->key()) : no_reg; |
2725 | 2744 |
2726 // Do the store. | 2745 // Do the store. |
2727 if (instr->key()->IsConstantOperand()) { | 2746 if (instr->key()->IsConstantOperand()) { |
2728 ASSERT(!instr->hydrogen()->NeedsWriteBarrier()); | 2747 ASSERT(!instr->hydrogen()->NeedsWriteBarrier()); |
2729 LConstantOperand* const_operand = LConstantOperand::cast(instr->key()); | 2748 LConstantOperand* const_operand = LConstantOperand::cast(instr->key()); |
2730 int offset = | 2749 int offset = |
(...skipping 1037 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3768 ASSERT(osr_pc_offset_ == -1); | 3787 ASSERT(osr_pc_offset_ == -1); |
3769 osr_pc_offset_ = masm()->pc_offset(); | 3788 osr_pc_offset_ = masm()->pc_offset(); |
3770 } | 3789 } |
3771 | 3790 |
3772 | 3791 |
3773 #undef __ | 3792 #undef __ |
3774 | 3793 |
3775 } } // namespace v8::internal | 3794 } } // namespace v8::internal |
3776 | 3795 |
3777 #endif // V8_TARGET_ARCH_IA32 | 3796 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |