| 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 Handle<JSFunction> getter) { | 21 Register holder, int accessor_index, int expected_arguments) { |
| 22 // ----------- S t a t e ------------- | 22 // ----------- S t a t e ------------- |
| 23 // -- r0 : receiver | 23 // -- r0 : receiver |
| 24 // -- r2 : name | 24 // -- r2 : name |
| 25 // -- lr : return address | 25 // -- lr : return address |
| 26 // ----------------------------------- | 26 // ----------------------------------- |
| 27 { | 27 { |
| 28 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); | 28 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); |
| 29 | 29 |
| 30 if (!getter.is_null()) { | 30 if (accessor_index >= 0) { |
| 31 // Call the JavaScript getter with the receiver on the stack. | 31 // Call the JavaScript getter with the receiver on the stack. |
| 32 if (IC::TypeToMap(*type, masm->isolate())->IsJSGlobalObjectMap()) { | 32 if (IC::TypeToMap(*type, masm->isolate())->IsJSGlobalObjectMap()) { |
| 33 // Swap in the global receiver. | 33 // Swap in the global receiver. |
| 34 __ ldr(receiver, | 34 __ ldr(receiver, |
| 35 FieldMemOperand(receiver, JSGlobalObject::kGlobalProxyOffset)); | 35 FieldMemOperand(receiver, JSGlobalObject::kGlobalProxyOffset)); |
| 36 } | 36 } |
| 37 __ push(receiver); | 37 __ push(receiver); |
| 38 ParameterCount actual(0); | 38 ParameterCount actual(0); |
| 39 ParameterCount expected(getter); | 39 ParameterCount expected(expected_arguments); |
| 40 __ InvokeFunction(getter, expected, actual, CALL_FUNCTION, | 40 Register scratch = holder; |
| 41 NullCallWrapper()); | 41 __ ldr(scratch, FieldMemOperand(holder, HeapObject::kMapOffset)); |
| 42 __ LoadInstanceDescriptors(scratch, scratch); |
| 43 __ ldr(scratch, FieldMemOperand(scratch, DescriptorArray::GetValueOffset( |
| 44 accessor_index))); |
| 45 __ ldr(r1, FieldMemOperand(scratch, AccessorPair::kGetterOffset)); |
| 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(); |
| (...skipping 678 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 730 // Return the generated code. | 735 // Return the generated code. |
| 731 return GetCode(kind(), Code::NORMAL, name); | 736 return GetCode(kind(), Code::NORMAL, name); |
| 732 } | 737 } |
| 733 | 738 |
| 734 | 739 |
| 735 #undef __ | 740 #undef __ |
| 736 } | 741 } |
| 737 } // namespace v8::internal | 742 } // namespace v8::internal |
| 738 | 743 |
| 739 #endif // V8_TARGET_ARCH_ARM | 744 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |