OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #if V8_TARGET_ARCH_ARM64 | 7 #if V8_TARGET_ARCH_ARM64 |
8 | 8 |
9 #include "src/ic/call-optimization.h" | 9 #include "src/ic/call-optimization.h" |
10 #include "src/ic/handler-compiler.h" | 10 #include "src/ic/handler-compiler.h" |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 DCHECK(!receiver.is(store_parameter)); | 161 DCHECK(!receiver.is(store_parameter)); |
162 DCHECK(!scratch.is(store_parameter)); | 162 DCHECK(!scratch.is(store_parameter)); |
163 queue.Queue(store_parameter); | 163 queue.Queue(store_parameter); |
164 } | 164 } |
165 queue.PushQueued(); | 165 queue.PushQueued(); |
166 | 166 |
167 DCHECK(optimization.is_simple_api_call()); | 167 DCHECK(optimization.is_simple_api_call()); |
168 | 168 |
169 // Abi for CallApiFunctionStub. | 169 // Abi for CallApiFunctionStub. |
170 Register callee = x0; | 170 Register callee = x0; |
171 Register call_data = x4; | 171 Register data = x4; |
172 Register holder = x2; | 172 Register holder = x2; |
173 Register api_function_address = x1; | 173 Register api_function_address = x1; |
174 | 174 |
175 // Put callee in place. | 175 // Put callee in place. |
176 __ LoadAccessor(callee, accessor_holder, accessor_index, | 176 __ LoadAccessor(callee, accessor_holder, accessor_index, |
177 is_store ? ACCESSOR_SETTER : ACCESSOR_GETTER); | 177 is_store ? ACCESSOR_SETTER : ACCESSOR_GETTER); |
178 | 178 |
179 // Put holder in place. | 179 // Put holder in place. |
180 CallOptimization::HolderLookup holder_lookup; | 180 CallOptimization::HolderLookup holder_lookup; |
181 Handle<JSObject> api_holder = | 181 Handle<JSObject> api_holder = |
182 optimization.LookupHolderOfExpectedType(receiver_map, &holder_lookup); | 182 optimization.LookupHolderOfExpectedType(receiver_map, &holder_lookup); |
183 switch (holder_lookup) { | 183 switch (holder_lookup) { |
184 case CallOptimization::kHolderIsReceiver: | 184 case CallOptimization::kHolderIsReceiver: |
185 __ Mov(holder, receiver); | 185 __ Mov(holder, receiver); |
186 break; | 186 break; |
187 case CallOptimization::kHolderFound: | 187 case CallOptimization::kHolderFound: |
188 __ LoadObject(holder, api_holder); | 188 __ LoadObject(holder, api_holder); |
189 break; | 189 break; |
190 case CallOptimization::kHolderNotFound: | 190 case CallOptimization::kHolderNotFound: |
191 UNREACHABLE(); | 191 UNREACHABLE(); |
192 break; | 192 break; |
193 } | 193 } |
194 | 194 |
195 Isolate* isolate = masm->isolate(); | 195 Isolate* isolate = masm->isolate(); |
196 Handle<CallHandlerInfo> api_call_info = optimization.api_call_info(); | 196 Handle<CallHandlerInfo> api_call_info = optimization.api_call_info(); |
197 Handle<Object> call_data_obj(api_call_info->data(), isolate); | |
198 | |
199 bool call_data_undefined = false; | 197 bool call_data_undefined = false; |
200 // Put call_data in place. | 198 // Put call data in place. |
201 if (isolate->heap()->InNewSpace(*call_data_obj)) { | 199 if (api_call_info->data()->IsUndefined()) { |
202 __ LoadObject(call_data, api_call_info); | |
203 __ Ldr(call_data, FieldMemOperand(call_data, CallHandlerInfo::kDataOffset)); | |
204 } else if (call_data_obj->IsUndefined()) { | |
205 call_data_undefined = true; | 200 call_data_undefined = true; |
206 __ LoadRoot(call_data, Heap::kUndefinedValueRootIndex); | 201 __ LoadRoot(data, Heap::kUndefinedValueRootIndex); |
207 } else { | 202 } else { |
208 __ LoadObject(call_data, call_data_obj); | 203 __ Ldr(data, |
| 204 FieldMemOperand(callee, JSFunction::kSharedFunctionInfoOffset)); |
| 205 __ Ldr(data, |
| 206 FieldMemOperand(data, SharedFunctionInfo::kFunctionDataOffset)); |
| 207 __ Ldr(data, FieldMemOperand(data, FunctionTemplateInfo::kCallCodeOffset)); |
| 208 __ Ldr(data, FieldMemOperand(data, CallHandlerInfo::kDataOffset)); |
209 } | 209 } |
210 | 210 |
211 // Put api_function_address in place. | 211 // Put api_function_address in place. |
212 Address function_address = v8::ToCData<Address>(api_call_info->callback()); | 212 Address function_address = v8::ToCData<Address>(api_call_info->callback()); |
213 ApiFunction fun(function_address); | 213 ApiFunction fun(function_address); |
214 ExternalReference ref = ExternalReference( | 214 ExternalReference ref = ExternalReference( |
215 &fun, ExternalReference::DIRECT_API_CALL, masm->isolate()); | 215 &fun, ExternalReference::DIRECT_API_CALL, masm->isolate()); |
216 __ Mov(api_function_address, ref); | 216 __ Mov(api_function_address, ref); |
217 | 217 |
218 // Jump to stub. | 218 // Jump to stub. |
(...skipping 537 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
756 // Return the generated code. | 756 // Return the generated code. |
757 return GetCode(kind(), Code::FAST, name); | 757 return GetCode(kind(), Code::FAST, name); |
758 } | 758 } |
759 | 759 |
760 | 760 |
761 #undef __ | 761 #undef __ |
762 } | 762 } |
763 } // namespace v8::internal | 763 } // namespace v8::internal |
764 | 764 |
765 #endif // V8_TARGET_ARCH_IA32 | 765 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |