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_IA32 | 7 #if V8_TARGET_ARCH_IA32 |
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" |
11 #include "src/ic/ic.h" | 11 #include "src/ic/ic.h" |
12 | 12 |
13 namespace v8 { | 13 namespace v8 { |
14 namespace internal { | 14 namespace internal { |
15 | 15 |
16 #define __ ACCESS_MASM(masm) | 16 #define __ ACCESS_MASM(masm) |
17 | 17 |
18 | 18 |
19 void NamedLoadHandlerCompiler::GenerateLoadViaGetter( | 19 void NamedLoadHandlerCompiler::GenerateLoadViaGetter( |
20 MacroAssembler* masm, Handle<HeapType> type, Register receiver, | 20 MacroAssembler* masm, Handle<HeapType> type, Register receiver, |
21 Handle<JSFunction> getter) { | 21 Register holder, int accessor_index, int expected_arguments) { |
22 { | 22 { |
23 FrameScope scope(masm, StackFrame::INTERNAL); | 23 FrameScope scope(masm, StackFrame::INTERNAL); |
24 | 24 |
25 if (!getter.is_null()) { | 25 if (accessor_index >= 0) { |
26 // Call the JavaScript getter with the receiver on the stack. | 26 // Call the JavaScript getter with the receiver on the stack. |
27 if (IC::TypeToMap(*type, masm->isolate())->IsJSGlobalObjectMap()) { | 27 if (IC::TypeToMap(*type, masm->isolate())->IsJSGlobalObjectMap()) { |
28 // Swap in the global receiver. | 28 // Swap in the global receiver. |
29 __ mov(receiver, | 29 __ mov(receiver, |
30 FieldOperand(receiver, JSGlobalObject::kGlobalProxyOffset)); | 30 FieldOperand(receiver, JSGlobalObject::kGlobalProxyOffset)); |
31 } | 31 } |
32 __ push(receiver); | 32 __ push(receiver); |
33 ParameterCount actual(0); | 33 ParameterCount actual(0); |
34 ParameterCount expected(getter); | 34 ParameterCount expected(expected_arguments); |
35 __ InvokeFunction(getter, expected, actual, CALL_FUNCTION, | 35 Register scratch = holder; |
| 36 __ mov(scratch, FieldOperand(holder, HeapObject::kMapOffset)); |
| 37 __ LoadInstanceDescriptors(scratch, scratch); |
| 38 __ mov(scratch, FieldOperand(scratch, DescriptorArray::GetValueOffset( |
| 39 accessor_index))); |
| 40 __ mov(edi, FieldOperand(scratch, AccessorPair::kGetterOffset)); |
| 41 __ InvokeFunction(edi, expected, actual, CALL_FUNCTION, |
36 NullCallWrapper()); | 42 NullCallWrapper()); |
37 } else { | 43 } else { |
38 // If we generate a global code snippet for deoptimization only, remember | 44 // If we generate a global code snippet for deoptimization only, remember |
39 // the place to continue after deoptimization. | 45 // the place to continue after deoptimization. |
40 masm->isolate()->heap()->SetGetterStubDeoptPCOffset(masm->pc_offset()); | 46 masm->isolate()->heap()->SetGetterStubDeoptPCOffset(masm->pc_offset()); |
41 } | 47 } |
42 | 48 |
43 // Restore context register. | 49 // Restore context register. |
44 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); | 50 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); |
45 } | 51 } |
(...skipping 708 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
754 // Return the generated code. | 760 // Return the generated code. |
755 return GetCode(kind(), Code::NORMAL, name); | 761 return GetCode(kind(), Code::NORMAL, name); |
756 } | 762 } |
757 | 763 |
758 | 764 |
759 #undef __ | 765 #undef __ |
760 } | 766 } |
761 } // namespace v8::internal | 767 } // namespace v8::internal |
762 | 768 |
763 #endif // V8_TARGET_ARCH_IA32 | 769 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |