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 2076 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2087 Register result = ToRegister(instr->result()); | 2087 Register result = ToRegister(instr->result()); |
2088 if (instr->hydrogen()->is_in_object()) { | 2088 if (instr->hydrogen()->is_in_object()) { |
2089 __ movq(result, FieldOperand(object, instr->hydrogen()->offset())); | 2089 __ movq(result, FieldOperand(object, instr->hydrogen()->offset())); |
2090 } else { | 2090 } else { |
2091 __ movq(result, FieldOperand(object, JSObject::kPropertiesOffset)); | 2091 __ movq(result, FieldOperand(object, JSObject::kPropertiesOffset)); |
2092 __ movq(result, FieldOperand(result, instr->hydrogen()->offset())); | 2092 __ movq(result, FieldOperand(result, instr->hydrogen()->offset())); |
2093 } | 2093 } |
2094 } | 2094 } |
2095 | 2095 |
2096 | 2096 |
| 2097 void LCodeGen::EmitLoadField(Register result, |
| 2098 Register object, |
| 2099 Handle<Map> type, |
| 2100 LookupResult* lookup) { |
| 2101 ASSERT(lookup->IsProperty() && lookup->type() == FIELD); |
| 2102 int index = lookup->GetLocalFieldIndexFromMap(*type); |
| 2103 int offset = index * kPointerSize; |
| 2104 if (index < 0) { |
| 2105 // Negative property indices are in-object properties, indexed |
| 2106 // from the end of the fixed part of the object. |
| 2107 __ movq(result, FieldOperand(object, offset + type->instance_size())); |
| 2108 } else { |
| 2109 // Non-negative property indices are in the properties array. |
| 2110 __ movq(result, FieldOperand(object, JSObject::kPropertiesOffset)); |
| 2111 __ movq(result, FieldOperand(result, offset + FixedArray::kHeaderSize)); |
| 2112 } |
| 2113 } |
| 2114 |
| 2115 |
| 2116 void LCodeGen::DoLoadNamedFieldPolymorphic(LLoadNamedFieldPolymorphic* instr) { |
| 2117 Register object = ToRegister(instr->object()); |
| 2118 Register result = ToRegister(instr->result()); |
| 2119 NearLabel done; |
| 2120 int map_count = instr->hydrogen()->types()->length(); |
| 2121 for (int i = 0; i < map_count - 1; ++i) { |
| 2122 Handle<Map> map = instr->hydrogen()->types()->at(i); |
| 2123 LookupResult lookup; |
| 2124 map->LookupInDescriptors(NULL, *instr->hydrogen()->name(), &lookup); |
| 2125 NearLabel next; |
| 2126 __ Cmp(FieldOperand(object, HeapObject::kMapOffset), map); |
| 2127 __ j(not_equal, &next); |
| 2128 EmitLoadField(result, object, map, &lookup); |
| 2129 __ jmp(&done); |
| 2130 __ bind(&next); |
| 2131 } |
| 2132 if (map_count > 0) { |
| 2133 Handle<Map> map = instr->hydrogen()->types()->at(map_count - 1); |
| 2134 LookupResult lookup; |
| 2135 map->LookupInDescriptors(NULL, *instr->hydrogen()->name(), &lookup); |
| 2136 __ Cmp(FieldOperand(object, HeapObject::kMapOffset), map); |
| 2137 if (instr->hydrogen()->need_generic()) { |
| 2138 NearLabel generic; |
| 2139 __ j(not_equal, &generic); |
| 2140 EmitLoadField(result, object, map, &lookup); |
| 2141 __ jmp(&done); |
| 2142 __ bind(&generic); |
| 2143 } else { |
| 2144 DeoptimizeIf(not_equal, instr->environment()); |
| 2145 EmitLoadField(result, object, map, &lookup); |
| 2146 } |
| 2147 } |
| 2148 if (instr->hydrogen()->need_generic()) { |
| 2149 __ Move(rcx, instr->hydrogen()->name()); |
| 2150 Handle<Code> ic( |
| 2151 isolate()->builtins()->builtin(Builtins::LoadIC_Initialize)); |
| 2152 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
| 2153 } |
| 2154 __ bind(&done); |
| 2155 } |
| 2156 |
| 2157 |
2097 void LCodeGen::DoLoadNamedGeneric(LLoadNamedGeneric* instr) { | 2158 void LCodeGen::DoLoadNamedGeneric(LLoadNamedGeneric* instr) { |
2098 ASSERT(ToRegister(instr->object()).is(rax)); | 2159 ASSERT(ToRegister(instr->object()).is(rax)); |
2099 ASSERT(ToRegister(instr->result()).is(rax)); | 2160 ASSERT(ToRegister(instr->result()).is(rax)); |
2100 | 2161 |
2101 __ Move(rcx, instr->name()); | 2162 __ Move(rcx, instr->name()); |
2102 Handle<Code> ic(isolate()->builtins()->builtin(Builtins::LoadIC_Initialize)); | 2163 Handle<Code> ic(isolate()->builtins()->builtin(Builtins::LoadIC_Initialize)); |
2103 CallCode(ic, RelocInfo::CODE_TARGET, instr); | 2164 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
2104 } | 2165 } |
2105 | 2166 |
2106 | 2167 |
(...skipping 1712 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3819 RegisterEnvironmentForDeoptimization(environment); | 3880 RegisterEnvironmentForDeoptimization(environment); |
3820 ASSERT(osr_pc_offset_ == -1); | 3881 ASSERT(osr_pc_offset_ == -1); |
3821 osr_pc_offset_ = masm()->pc_offset(); | 3882 osr_pc_offset_ = masm()->pc_offset(); |
3822 } | 3883 } |
3823 | 3884 |
3824 #undef __ | 3885 #undef __ |
3825 | 3886 |
3826 } } // namespace v8::internal | 3887 } } // namespace v8::internal |
3827 | 3888 |
3828 #endif // V8_TARGET_ARCH_X64 | 3889 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |