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_ARM | 7 #if V8_TARGET_ARCH_ARM |
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 Register holder, int accessor_index, int expected_arguments) { | 21 Register holder, int accessor_index, int expected_arguments, |
| 22 Register scratch) { |
22 // ----------- S t a t e ------------- | 23 // ----------- S t a t e ------------- |
23 // -- r0 : receiver | 24 // -- r0 : receiver |
24 // -- r2 : name | 25 // -- r2 : name |
25 // -- lr : return address | 26 // -- lr : return address |
26 // ----------------------------------- | 27 // ----------------------------------- |
27 { | 28 { |
28 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); | 29 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); |
29 | 30 |
30 if (accessor_index >= 0) { | 31 if (accessor_index >= 0) { |
| 32 DCHECK(!holder.is(scratch)); |
| 33 DCHECK(!receiver.is(scratch)); |
31 // Call the JavaScript getter with the receiver on the stack. | 34 // Call the JavaScript getter with the receiver on the stack. |
32 if (IC::TypeToMap(*type, masm->isolate())->IsJSGlobalObjectMap()) { | 35 if (IC::TypeToMap(*type, masm->isolate())->IsJSGlobalObjectMap()) { |
33 // Swap in the global receiver. | 36 // Swap in the global receiver. |
34 __ ldr(receiver, | 37 __ ldr(scratch, |
35 FieldMemOperand(receiver, JSGlobalObject::kGlobalProxyOffset)); | 38 FieldMemOperand(receiver, JSGlobalObject::kGlobalProxyOffset)); |
| 39 receiver = scratch; |
36 } | 40 } |
37 __ push(receiver); | 41 __ push(receiver); |
38 ParameterCount actual(0); | 42 ParameterCount actual(0); |
39 ParameterCount expected(expected_arguments); | 43 ParameterCount expected(expected_arguments); |
40 __ LoadAccessor(r1, holder, accessor_index, ACCESSOR_GETTER); | 44 __ LoadAccessor(r1, holder, accessor_index, ACCESSOR_GETTER); |
41 __ InvokeFunction(r1, expected, actual, CALL_FUNCTION, NullCallWrapper()); | 45 __ InvokeFunction(r1, expected, actual, CALL_FUNCTION, NullCallWrapper()); |
42 } else { | 46 } else { |
43 // If we generate a global code snippet for deoptimization only, remember | 47 // If we generate a global code snippet for deoptimization only, remember |
44 // the place to continue after deoptimization. | 48 // the place to continue after deoptimization. |
45 masm->isolate()->heap()->SetGetterStubDeoptPCOffset(masm->pc_offset()); | 49 masm->isolate()->heap()->SetGetterStubDeoptPCOffset(masm->pc_offset()); |
46 } | 50 } |
47 | 51 |
48 // Restore context register. | 52 // Restore context register. |
49 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 53 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
50 } | 54 } |
51 __ Ret(); | 55 __ Ret(); |
52 } | 56 } |
53 | 57 |
54 | 58 |
55 void NamedStoreHandlerCompiler::GenerateStoreViaSetter( | 59 void NamedStoreHandlerCompiler::GenerateStoreViaSetter( |
56 MacroAssembler* masm, Handle<HeapType> type, Register receiver, | 60 MacroAssembler* masm, Handle<HeapType> type, Register receiver, |
57 Register holder, int accessor_index, int expected_arguments) { | 61 Register holder, int accessor_index, int expected_arguments, |
| 62 Register scratch) { |
58 // ----------- S t a t e ------------- | 63 // ----------- S t a t e ------------- |
59 // -- lr : return address | 64 // -- lr : return address |
60 // ----------------------------------- | 65 // ----------------------------------- |
61 { | 66 { |
62 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); | 67 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); |
63 | 68 |
64 // Save value register, so we can restore it later. | 69 // Save value register, so we can restore it later. |
65 __ push(value()); | 70 __ push(value()); |
66 | 71 |
67 if (accessor_index >= 0) { | 72 if (accessor_index >= 0) { |
| 73 DCHECK(!holder.is(scratch)); |
| 74 DCHECK(!receiver.is(scratch)); |
| 75 DCHECK(!value().is(scratch)); |
68 // Call the JavaScript setter with receiver and value on the stack. | 76 // Call the JavaScript setter with receiver and value on the stack. |
69 if (IC::TypeToMap(*type, masm->isolate())->IsJSGlobalObjectMap()) { | 77 if (IC::TypeToMap(*type, masm->isolate())->IsJSGlobalObjectMap()) { |
70 // Swap in the global receiver. | 78 // Swap in the global receiver. |
71 __ ldr(receiver, | 79 __ ldr(scratch, |
72 FieldMemOperand(receiver, JSGlobalObject::kGlobalProxyOffset)); | 80 FieldMemOperand(receiver, JSGlobalObject::kGlobalProxyOffset)); |
| 81 receiver = scratch; |
73 } | 82 } |
74 __ Push(receiver, value()); | 83 __ Push(receiver, value()); |
75 ParameterCount actual(1); | 84 ParameterCount actual(1); |
76 ParameterCount expected(expected_arguments); | 85 ParameterCount expected(expected_arguments); |
77 __ LoadAccessor(r1, holder, accessor_index, ACCESSOR_SETTER); | 86 __ LoadAccessor(r1, holder, accessor_index, ACCESSOR_SETTER); |
78 __ InvokeFunction(r1, expected, actual, CALL_FUNCTION, NullCallWrapper()); | 87 __ InvokeFunction(r1, expected, actual, CALL_FUNCTION, NullCallWrapper()); |
79 } else { | 88 } else { |
80 // If we generate a global code snippet for deoptimization only, remember | 89 // If we generate a global code snippet for deoptimization only, remember |
81 // the place to continue after deoptimization. | 90 // the place to continue after deoptimization. |
82 masm->isolate()->heap()->SetSetterStubDeoptPCOffset(masm->pc_offset()); | 91 masm->isolate()->heap()->SetSetterStubDeoptPCOffset(masm->pc_offset()); |
(...skipping 647 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
730 // Return the generated code. | 739 // Return the generated code. |
731 return GetCode(kind(), Code::NORMAL, name); | 740 return GetCode(kind(), Code::NORMAL, name); |
732 } | 741 } |
733 | 742 |
734 | 743 |
735 #undef __ | 744 #undef __ |
736 } | 745 } |
737 } // namespace v8::internal | 746 } // namespace v8::internal |
738 | 747 |
739 #endif // V8_TARGET_ARCH_ARM | 748 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |