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 984 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
995 } | 995 } |
996 | 996 |
997 | 997 |
998 void LCodeGen::DoFixedArrayLength(LFixedArrayLength* instr) { | 998 void LCodeGen::DoFixedArrayLength(LFixedArrayLength* instr) { |
999 Register result = ToRegister(instr->result()); | 999 Register result = ToRegister(instr->result()); |
1000 Register array = ToRegister(instr->InputAt(0)); | 1000 Register array = ToRegister(instr->InputAt(0)); |
1001 __ mov(result, FieldOperand(array, FixedArray::kLengthOffset)); | 1001 __ mov(result, FieldOperand(array, FixedArray::kLengthOffset)); |
1002 } | 1002 } |
1003 | 1003 |
1004 | 1004 |
| 1005 void LCodeGen::DoPixelArrayLength(LPixelArrayLength* instr) { |
| 1006 Register result = ToRegister(instr->result()); |
| 1007 Register array = ToRegister(instr->InputAt(0)); |
| 1008 __ mov(result, FieldOperand(array, PixelArray::kLengthOffset)); |
| 1009 } |
| 1010 |
| 1011 |
1005 void LCodeGen::DoValueOf(LValueOf* instr) { | 1012 void LCodeGen::DoValueOf(LValueOf* instr) { |
1006 Register input = ToRegister(instr->InputAt(0)); | 1013 Register input = ToRegister(instr->InputAt(0)); |
1007 Register result = ToRegister(instr->result()); | 1014 Register result = ToRegister(instr->result()); |
1008 Register map = ToRegister(instr->TempAt(0)); | 1015 Register map = ToRegister(instr->TempAt(0)); |
1009 ASSERT(input.is(result)); | 1016 ASSERT(input.is(result)); |
1010 NearLabel done; | 1017 NearLabel done; |
1011 // If the object is a smi return the object. | 1018 // If the object is a smi return the object. |
1012 __ test(input, Immediate(kSmiTagMask)); | 1019 __ test(input, Immediate(kSmiTagMask)); |
1013 __ j(zero, &done); | 1020 __ j(zero, &done); |
1014 | 1021 |
(...skipping 1002 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2017 // in the function's map. | 2024 // in the function's map. |
2018 __ bind(&non_instance); | 2025 __ bind(&non_instance); |
2019 __ mov(result, FieldOperand(result, Map::kConstructorOffset)); | 2026 __ mov(result, FieldOperand(result, Map::kConstructorOffset)); |
2020 | 2027 |
2021 // All done. | 2028 // All done. |
2022 __ bind(&done); | 2029 __ bind(&done); |
2023 } | 2030 } |
2024 | 2031 |
2025 | 2032 |
2026 void LCodeGen::DoLoadElements(LLoadElements* instr) { | 2033 void LCodeGen::DoLoadElements(LLoadElements* instr) { |
2027 ASSERT(instr->result()->Equals(instr->InputAt(0))); | 2034 Register result = ToRegister(instr->result()); |
2028 Register reg = ToRegister(instr->InputAt(0)); | 2035 Register input = ToRegister(instr->InputAt(0)); |
2029 __ mov(reg, FieldOperand(reg, JSObject::kElementsOffset)); | 2036 __ mov(result, FieldOperand(input, JSObject::kElementsOffset)); |
2030 if (FLAG_debug_code) { | 2037 if (FLAG_debug_code) { |
2031 NearLabel done; | 2038 NearLabel done; |
2032 __ cmp(FieldOperand(reg, HeapObject::kMapOffset), | 2039 __ cmp(FieldOperand(result, HeapObject::kMapOffset), |
2033 Immediate(Factory::fixed_array_map())); | 2040 Immediate(Factory::fixed_array_map())); |
2034 __ j(equal, &done); | 2041 __ j(equal, &done); |
2035 __ cmp(FieldOperand(reg, HeapObject::kMapOffset), | 2042 __ cmp(FieldOperand(result, HeapObject::kMapOffset), |
| 2043 Immediate(Factory::pixel_array_map())); |
| 2044 __ j(equal, &done); |
| 2045 __ cmp(FieldOperand(result, HeapObject::kMapOffset), |
2036 Immediate(Factory::fixed_cow_array_map())); | 2046 Immediate(Factory::fixed_cow_array_map())); |
2037 __ Check(equal, "Check for fast elements failed."); | 2047 __ Check(equal, "Check for fast elements or pixel array failed."); |
2038 __ bind(&done); | 2048 __ bind(&done); |
2039 } | 2049 } |
2040 } | 2050 } |
2041 | 2051 |
2042 | 2052 |
| 2053 void LCodeGen::DoLoadPixelArrayExternalPointer( |
| 2054 LLoadPixelArrayExternalPointer* instr) { |
| 2055 Register result = ToRegister(instr->result()); |
| 2056 Register input = ToRegister(instr->InputAt(0)); |
| 2057 __ mov(result, FieldOperand(input, PixelArray::kExternalPointerOffset)); |
| 2058 } |
| 2059 |
| 2060 |
2043 void LCodeGen::DoAccessArgumentsAt(LAccessArgumentsAt* instr) { | 2061 void LCodeGen::DoAccessArgumentsAt(LAccessArgumentsAt* instr) { |
2044 Register arguments = ToRegister(instr->arguments()); | 2062 Register arguments = ToRegister(instr->arguments()); |
2045 Register length = ToRegister(instr->length()); | 2063 Register length = ToRegister(instr->length()); |
2046 Operand index = ToOperand(instr->index()); | 2064 Operand index = ToOperand(instr->index()); |
2047 Register result = ToRegister(instr->result()); | 2065 Register result = ToRegister(instr->result()); |
2048 | 2066 |
2049 __ sub(length, index); | 2067 __ sub(length, index); |
2050 DeoptimizeIf(below_equal, instr->environment()); | 2068 DeoptimizeIf(below_equal, instr->environment()); |
2051 | 2069 |
2052 // There are two words between the frame pointer and the last argument. | 2070 // There are two words between the frame pointer and the last argument. |
(...skipping 13 matching lines...) Expand all Loading... |
2066 key, | 2084 key, |
2067 times_pointer_size, | 2085 times_pointer_size, |
2068 FixedArray::kHeaderSize)); | 2086 FixedArray::kHeaderSize)); |
2069 | 2087 |
2070 // Check for the hole value. | 2088 // Check for the hole value. |
2071 __ cmp(result, Factory::the_hole_value()); | 2089 __ cmp(result, Factory::the_hole_value()); |
2072 DeoptimizeIf(equal, instr->environment()); | 2090 DeoptimizeIf(equal, instr->environment()); |
2073 } | 2091 } |
2074 | 2092 |
2075 | 2093 |
| 2094 void LCodeGen::DoLoadPixelArrayElement(LLoadPixelArrayElement* instr) { |
| 2095 Register external_elements = ToRegister(instr->external_pointer()); |
| 2096 Register key = ToRegister(instr->key()); |
| 2097 Register result = ToRegister(instr->result()); |
| 2098 ASSERT(result.is(external_elements)); |
| 2099 |
| 2100 // Load the result. |
| 2101 __ movzx_b(result, Operand(external_elements, key, times_1, 0)); |
| 2102 } |
| 2103 |
| 2104 |
2076 void LCodeGen::DoLoadKeyedGeneric(LLoadKeyedGeneric* instr) { | 2105 void LCodeGen::DoLoadKeyedGeneric(LLoadKeyedGeneric* instr) { |
2077 ASSERT(ToRegister(instr->context()).is(esi)); | 2106 ASSERT(ToRegister(instr->context()).is(esi)); |
2078 ASSERT(ToRegister(instr->object()).is(edx)); | 2107 ASSERT(ToRegister(instr->object()).is(edx)); |
2079 ASSERT(ToRegister(instr->key()).is(eax)); | 2108 ASSERT(ToRegister(instr->key()).is(eax)); |
2080 | 2109 |
2081 Handle<Code> ic(Builtins::builtin(Builtins::KeyedLoadIC_Initialize)); | 2110 Handle<Code> ic(Builtins::builtin(Builtins::KeyedLoadIC_Initialize)); |
2082 CallCode(ic, RelocInfo::CODE_TARGET, instr); | 2111 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
2083 } | 2112 } |
2084 | 2113 |
2085 | 2114 |
(...skipping 1653 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3739 ASSERT(osr_pc_offset_ == -1); | 3768 ASSERT(osr_pc_offset_ == -1); |
3740 osr_pc_offset_ = masm()->pc_offset(); | 3769 osr_pc_offset_ = masm()->pc_offset(); |
3741 } | 3770 } |
3742 | 3771 |
3743 | 3772 |
3744 #undef __ | 3773 #undef __ |
3745 | 3774 |
3746 } } // namespace v8::internal | 3775 } } // namespace v8::internal |
3747 | 3776 |
3748 #endif // V8_TARGET_ARCH_IA32 | 3777 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |