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