| 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_MIPS | 7 #if V8_TARGET_ARCH_MIPS |
| 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 // -- a0 : receiver | 24 // -- a0 : receiver |
| 24 // -- a2 : name | 25 // -- a2 : name |
| 25 // -- ra : return address | 26 // -- ra : return address |
| 26 // ----------------------------------- | 27 // ----------------------------------- |
| 27 { | 28 { |
| 28 FrameScope scope(masm, StackFrame::INTERNAL); | 29 FrameScope 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 __ lw(receiver, | 37 __ lw(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(a1, holder, accessor_index, ACCESSOR_GETTER); | 44 __ LoadAccessor(a1, holder, accessor_index, ACCESSOR_GETTER); |
| 41 __ InvokeFunction(a1, expected, actual, CALL_FUNCTION, NullCallWrapper()); | 45 __ InvokeFunction(a1, 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 __ lw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 53 __ lw(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 // -- ra : return address | 64 // -- ra : return address |
| 60 // ----------------------------------- | 65 // ----------------------------------- |
| 61 { | 66 { |
| 62 FrameScope scope(masm, StackFrame::INTERNAL); | 67 FrameScope 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 __ lw(receiver, | 79 __ lw(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(a1, holder, accessor_index, ACCESSOR_SETTER); | 86 __ LoadAccessor(a1, holder, accessor_index, ACCESSOR_SETTER); |
| 78 __ InvokeFunction(a1, expected, actual, CALL_FUNCTION, NullCallWrapper()); | 87 __ InvokeFunction(a1, 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 641 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 724 // Return the generated code. | 733 // Return the generated code. |
| 725 return GetCode(kind(), Code::NORMAL, name); | 734 return GetCode(kind(), Code::NORMAL, name); |
| 726 } | 735 } |
| 727 | 736 |
| 728 | 737 |
| 729 #undef __ | 738 #undef __ |
| 730 } | 739 } |
| 731 } // namespace v8::internal | 740 } // namespace v8::internal |
| 732 | 741 |
| 733 #endif // V8_TARGET_ARCH_MIPS | 742 #endif // V8_TARGET_ARCH_MIPS |
| OLD | NEW |