| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_ARM64. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_ARM64. |
| 6 #if defined(TARGET_ARCH_ARM64) | 6 #if defined(TARGET_ARCH_ARM64) |
| 7 | 7 |
| 8 #include "vm/code_patcher.h" | 8 #include "vm/code_patcher.h" |
| 9 | 9 |
| 10 #include "vm/instructions.h" | 10 #include "vm/instructions.h" |
| 11 #include "vm/object.h" | 11 #include "vm/object.h" |
| 12 | 12 |
| 13 namespace dart { | 13 namespace dart { |
| 14 | 14 |
| 15 RawArray* CodePatcher::GetClosureArgDescAt(uword return_address, | 15 RawArray* CodePatcher::GetClosureArgDescAt(uword return_address, |
| 16 const Code& code) { | 16 const Code& code) { |
| 17 UNIMPLEMENTED(); | 17 ASSERT(code.ContainsInstructionAt(return_address)); |
| 18 return NULL; | 18 CallPattern call(return_address, code); |
| 19 return call.ClosureArgumentsDescriptor(); |
| 19 } | 20 } |
| 20 | 21 |
| 21 | 22 |
| 22 uword CodePatcher::GetStaticCallTargetAt(uword return_address, | 23 uword CodePatcher::GetStaticCallTargetAt(uword return_address, |
| 23 const Code& code) { | 24 const Code& code) { |
| 24 UNIMPLEMENTED(); | 25 ASSERT(code.ContainsInstructionAt(return_address)); |
| 25 return 0; | 26 CallPattern call(return_address, code); |
| 27 return call.TargetAddress(); |
| 26 } | 28 } |
| 27 | 29 |
| 28 | 30 |
| 29 void CodePatcher::PatchStaticCallAt(uword return_address, | 31 void CodePatcher::PatchStaticCallAt(uword return_address, |
| 30 const Code& code, | 32 const Code& code, |
| 31 uword new_target) { | 33 uword new_target) { |
| 32 UNIMPLEMENTED(); | 34 ASSERT(code.ContainsInstructionAt(return_address)); |
| 35 CallPattern call(return_address, code); |
| 36 call.SetTargetAddress(new_target); |
| 33 } | 37 } |
| 34 | 38 |
| 35 | 39 |
| 36 void CodePatcher::PatchInstanceCallAt(uword return_address, | 40 void CodePatcher::PatchInstanceCallAt(uword return_address, |
| 37 const Code& code, | 41 const Code& code, |
| 38 uword new_target) { | 42 uword new_target) { |
| 39 UNIMPLEMENTED(); | 43 ASSERT(code.ContainsInstructionAt(return_address)); |
| 44 CallPattern call(return_address, code); |
| 45 call.SetTargetAddress(new_target); |
| 40 } | 46 } |
| 41 | 47 |
| 42 | 48 |
| 43 int32_t CodePatcher::GetPoolOffsetAt(uword return_address) { | 49 int32_t CodePatcher::GetPoolOffsetAt(uword return_address) { |
| 50 // TODO(zra): Needed for debugger. |
| 44 UNIMPLEMENTED(); | 51 UNIMPLEMENTED(); |
| 45 return 0; | 52 return 0; |
| 46 } | 53 } |
| 47 | 54 |
| 48 | 55 |
| 49 void CodePatcher::SetPoolOffsetAt(uword return_address, int32_t offset) { | 56 void CodePatcher::SetPoolOffsetAt(uword return_address, int32_t offset) { |
| 57 // TODO(zra): Needed for debugger. |
| 50 UNIMPLEMENTED(); | 58 UNIMPLEMENTED(); |
| 51 } | 59 } |
| 52 | 60 |
| 53 | 61 |
| 54 void CodePatcher::InsertCallAt(uword start, uword target) { | 62 void CodePatcher::InsertCallAt(uword start, uword target) { |
| 55 UNIMPLEMENTED(); | 63 // The inserted call should not overlap the lazy deopt jump code. |
| 64 ASSERT(start + CallPattern::kLengthInBytes <= target); |
| 65 CallPattern::InsertAt(start, target); |
| 56 } | 66 } |
| 57 | 67 |
| 58 | 68 |
| 59 uword CodePatcher::GetInstanceCallAt(uword return_address, | 69 uword CodePatcher::GetInstanceCallAt(uword return_address, |
| 60 const Code& code, | 70 const Code& code, |
| 61 ICData* ic_data) { | 71 ICData* ic_data) { |
| 62 UNIMPLEMENTED(); | 72 ASSERT(code.ContainsInstructionAt(return_address)); |
| 63 return 0; | 73 CallPattern call(return_address, code); |
| 74 if (ic_data != NULL) { |
| 75 *ic_data = call.IcData(); |
| 76 } |
| 77 return call.TargetAddress(); |
| 64 } | 78 } |
| 65 | 79 |
| 66 | 80 |
| 67 intptr_t CodePatcher::InstanceCallSizeInBytes() { | 81 intptr_t CodePatcher::InstanceCallSizeInBytes() { |
| 68 // The instance call instruction sequence has a variable size on ARM. | 82 // The instance call instruction sequence has a variable size on ARM64. |
| 69 UNREACHABLE(); | 83 UNREACHABLE(); |
| 70 return 0; | 84 return 0; |
| 71 } | 85 } |
| 72 | 86 |
| 73 | 87 |
| 74 RawFunction* CodePatcher::GetUnoptimizedStaticCallAt( | 88 RawFunction* CodePatcher::GetUnoptimizedStaticCallAt( |
| 75 uword return_address, const Code& code, ICData* ic_data_result) { | 89 uword return_address, const Code& code, ICData* ic_data_result) { |
| 76 UNIMPLEMENTED(); | 90 ASSERT(code.ContainsInstructionAt(return_address)); |
| 77 return NULL; | 91 CallPattern static_call(return_address, code); |
| 92 ICData& ic_data = ICData::Handle(); |
| 93 ic_data ^= static_call.IcData(); |
| 94 if (ic_data_result != NULL) { |
| 95 *ic_data_result = ic_data.raw(); |
| 96 } |
| 97 return ic_data.GetTargetAt(0); |
| 78 } | 98 } |
| 79 | 99 |
| 80 | 100 |
| 81 RawObject* CodePatcher::GetEdgeCounterAt(uword pc, const Code& code) { | 101 RawObject* CodePatcher::GetEdgeCounterAt(uword pc, const Code& code) { |
| 82 UNIMPLEMENTED(); | 102 UNIMPLEMENTED(); |
| 83 return NULL; | 103 return NULL; |
| 84 } | 104 } |
| 85 | 105 |
| 86 } // namespace dart | 106 } // namespace dart |
| 87 | 107 |
| 88 #endif // defined TARGET_ARCH_ARM64 | 108 #endif // defined TARGET_ARCH_ARM64 |
| OLD | NEW |