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_X64 | 7 #if V8_TARGET_ARCH_X64 |
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 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 | 248 |
249 // Restore context register. | 249 // Restore context register. |
250 __ movp(rsi, Operand(rbp, StandardFrameConstants::kContextOffset)); | 250 __ movp(rsi, Operand(rbp, StandardFrameConstants::kContextOffset)); |
251 } | 251 } |
252 __ ret(0); | 252 __ ret(0); |
253 } | 253 } |
254 | 254 |
255 | 255 |
256 void NamedLoadHandlerCompiler::GenerateLoadViaGetter( | 256 void NamedLoadHandlerCompiler::GenerateLoadViaGetter( |
257 MacroAssembler* masm, Handle<HeapType> type, Register receiver, | 257 MacroAssembler* masm, Handle<HeapType> type, Register receiver, |
258 Handle<JSFunction> getter) { | 258 Register holder, int accessor_index, int expected_arguments) { |
259 // ----------- S t a t e ------------- | 259 // ----------- S t a t e ------------- |
260 // -- rax : receiver | 260 // -- rax : receiver |
261 // -- rcx : name | 261 // -- rcx : name |
262 // -- rsp[0] : return address | 262 // -- rsp[0] : return address |
263 // ----------------------------------- | 263 // ----------------------------------- |
264 { | 264 { |
265 FrameScope scope(masm, StackFrame::INTERNAL); | 265 FrameScope scope(masm, StackFrame::INTERNAL); |
266 | 266 |
267 if (!getter.is_null()) { | 267 if (accessor_index >= 0) { |
268 // Call the JavaScript getter with the receiver on the stack. | 268 // Call the JavaScript getter with the receiver on the stack. |
269 if (IC::TypeToMap(*type, masm->isolate())->IsJSGlobalObjectMap()) { | 269 if (IC::TypeToMap(*type, masm->isolate())->IsJSGlobalObjectMap()) { |
270 // Swap in the global receiver. | 270 // Swap in the global receiver. |
271 __ movp(receiver, | 271 __ movp(receiver, |
272 FieldOperand(receiver, JSGlobalObject::kGlobalProxyOffset)); | 272 FieldOperand(receiver, JSGlobalObject::kGlobalProxyOffset)); |
273 } | 273 } |
274 __ Push(receiver); | 274 __ Push(receiver); |
275 ParameterCount actual(0); | 275 ParameterCount actual(0); |
276 ParameterCount expected(getter); | 276 ParameterCount expected(expected_arguments); |
277 __ InvokeFunction(getter, expected, actual, CALL_FUNCTION, | 277 Register scratch = holder; |
| 278 __ movp(scratch, FieldOperand(holder, HeapObject::kMapOffset)); |
| 279 __ LoadInstanceDescriptors(scratch, scratch); |
| 280 __ movp(scratch, FieldOperand(scratch, DescriptorArray::GetValueOffset( |
| 281 accessor_index))); |
| 282 __ movp(rdi, FieldOperand(scratch, AccessorPair::kGetterOffset)); |
| 283 __ InvokeFunction(rdi, expected, actual, CALL_FUNCTION, |
278 NullCallWrapper()); | 284 NullCallWrapper()); |
279 } else { | 285 } else { |
280 // If we generate a global code snippet for deoptimization only, remember | 286 // If we generate a global code snippet for deoptimization only, remember |
281 // the place to continue after deoptimization. | 287 // the place to continue after deoptimization. |
282 masm->isolate()->heap()->SetGetterStubDeoptPCOffset(masm->pc_offset()); | 288 masm->isolate()->heap()->SetGetterStubDeoptPCOffset(masm->pc_offset()); |
283 } | 289 } |
284 | 290 |
285 // Restore context register. | 291 // Restore context register. |
286 __ movp(rsi, Operand(rbp, StandardFrameConstants::kContextOffset)); | 292 __ movp(rsi, Operand(rbp, StandardFrameConstants::kContextOffset)); |
287 } | 293 } |
(...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
741 // Return the generated code. | 747 // Return the generated code. |
742 return GetCode(kind(), Code::NORMAL, name); | 748 return GetCode(kind(), Code::NORMAL, name); |
743 } | 749 } |
744 | 750 |
745 | 751 |
746 #undef __ | 752 #undef __ |
747 } | 753 } |
748 } // namespace v8::internal | 754 } // namespace v8::internal |
749 | 755 |
750 #endif // V8_TARGET_ARCH_X64 | 756 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |