OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 <limits.h> // For LONG_MIN, LONG_MAX. | 5 #include <limits.h> // For LONG_MIN, LONG_MAX. |
6 | 6 |
7 #if V8_TARGET_ARCH_ARM | 7 #if V8_TARGET_ARCH_ARM |
8 | 8 |
9 #include "src/assembler-inl.h" | 9 #include "src/assembler-inl.h" |
10 #include "src/base/bits.h" | 10 #include "src/base/bits.h" |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 | 84 |
85 | 85 |
86 int MacroAssembler::CallSize( | 86 int MacroAssembler::CallSize( |
87 Address target, RelocInfo::Mode rmode, Condition cond) { | 87 Address target, RelocInfo::Mode rmode, Condition cond) { |
88 Instr mov_instr = cond | MOV | LeaveCC; | 88 Instr mov_instr = cond | MOV | LeaveCC; |
89 Operand mov_operand = Operand(reinterpret_cast<intptr_t>(target), rmode); | 89 Operand mov_operand = Operand(reinterpret_cast<intptr_t>(target), rmode); |
90 return kInstrSize + | 90 return kInstrSize + |
91 mov_operand.InstructionsRequired(this, mov_instr) * kInstrSize; | 91 mov_operand.InstructionsRequired(this, mov_instr) * kInstrSize; |
92 } | 92 } |
93 | 93 |
94 | 94 int MacroAssembler::CallStubSize(CodeStub* stub, Condition cond) { |
95 int MacroAssembler::CallStubSize( | 95 return CallSize(stub->GetCode(), RelocInfo::CODE_TARGET, cond); |
96 CodeStub* stub, TypeFeedbackId ast_id, Condition cond) { | |
97 return CallSize(stub->GetCode(), RelocInfo::CODE_TARGET, ast_id, cond); | |
98 } | 96 } |
99 | 97 |
100 void MacroAssembler::Call(Address target, RelocInfo::Mode rmode, Condition cond, | 98 void MacroAssembler::Call(Address target, RelocInfo::Mode rmode, Condition cond, |
101 TargetAddressStorageMode mode, | 99 TargetAddressStorageMode mode, |
102 bool check_constant_pool) { | 100 bool check_constant_pool) { |
103 // Check if we have to emit the constant pool before we block it. | 101 // Check if we have to emit the constant pool before we block it. |
104 if (check_constant_pool) MaybeCheckConstPool(); | 102 if (check_constant_pool) MaybeCheckConstPool(); |
105 // Block constant pool for the call instruction sequence. | 103 // Block constant pool for the call instruction sequence. |
106 BlockConstPoolScope block_const_pool(this); | 104 BlockConstPoolScope block_const_pool(this); |
107 Label start; | 105 Label start; |
(...skipping 26 matching lines...) Expand all Loading... |
134 | 132 |
135 DCHECK_EQ(expected_size, SizeOfCodeGeneratedSince(&start)); | 133 DCHECK_EQ(expected_size, SizeOfCodeGeneratedSince(&start)); |
136 if (mode == NEVER_INLINE_TARGET_ADDRESS) { | 134 if (mode == NEVER_INLINE_TARGET_ADDRESS) { |
137 set_predictable_code_size(old_predictable_code_size); | 135 set_predictable_code_size(old_predictable_code_size); |
138 } | 136 } |
139 } | 137 } |
140 | 138 |
141 | 139 |
142 int MacroAssembler::CallSize(Handle<Code> code, | 140 int MacroAssembler::CallSize(Handle<Code> code, |
143 RelocInfo::Mode rmode, | 141 RelocInfo::Mode rmode, |
144 TypeFeedbackId ast_id, | |
145 Condition cond) { | 142 Condition cond) { |
146 AllowDeferredHandleDereference using_raw_address; | 143 AllowDeferredHandleDereference using_raw_address; |
147 return CallSize(reinterpret_cast<Address>(code.location()), rmode, cond); | 144 return CallSize(reinterpret_cast<Address>(code.location()), rmode, cond); |
148 } | 145 } |
149 | 146 |
150 void MacroAssembler::Call(Handle<Code> code, RelocInfo::Mode rmode, | 147 void MacroAssembler::Call(Handle<Code> code, RelocInfo::Mode rmode, |
151 TypeFeedbackId ast_id, Condition cond, | 148 Condition cond, TargetAddressStorageMode mode, |
152 TargetAddressStorageMode mode, | |
153 bool check_constant_pool) { | 149 bool check_constant_pool) { |
154 Label start; | 150 Label start; |
155 bind(&start); | 151 bind(&start); |
156 DCHECK(RelocInfo::IsCodeTarget(rmode)); | 152 DCHECK(RelocInfo::IsCodeTarget(rmode)); |
157 if (rmode == RelocInfo::CODE_TARGET && !ast_id.IsNone()) { | |
158 SetRecordedAstId(ast_id); | |
159 rmode = RelocInfo::CODE_TARGET_WITH_ID; | |
160 } | |
161 // 'code' is always generated ARM code, never THUMB code | 153 // 'code' is always generated ARM code, never THUMB code |
162 AllowDeferredHandleDereference embedding_raw_address; | 154 AllowDeferredHandleDereference embedding_raw_address; |
163 Call(reinterpret_cast<Address>(code.location()), rmode, cond, mode); | 155 Call(reinterpret_cast<Address>(code.location()), rmode, cond, mode); |
164 } | 156 } |
165 | 157 |
166 void MacroAssembler::CallDeoptimizer(Address target) { | 158 void MacroAssembler::CallDeoptimizer(Address target) { |
167 BlockConstPoolScope block_const_pool(this); | 159 BlockConstPoolScope block_const_pool(this); |
168 | 160 |
169 uintptr_t target_raw = reinterpret_cast<uintptr_t>(target); | 161 uintptr_t target_raw = reinterpret_cast<uintptr_t>(target); |
170 | 162 |
(...skipping 2139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2310 bind(&loop); | 2302 bind(&loop); |
2311 JumpIfSmi(result, &done); | 2303 JumpIfSmi(result, &done); |
2312 CompareObjectType(result, temp, temp2, MAP_TYPE); | 2304 CompareObjectType(result, temp, temp2, MAP_TYPE); |
2313 b(ne, &done); | 2305 b(ne, &done); |
2314 ldr(result, FieldMemOperand(result, Map::kConstructorOrBackPointerOffset)); | 2306 ldr(result, FieldMemOperand(result, Map::kConstructorOrBackPointerOffset)); |
2315 b(&loop); | 2307 b(&loop); |
2316 bind(&done); | 2308 bind(&done); |
2317 } | 2309 } |
2318 | 2310 |
2319 void MacroAssembler::CallStub(CodeStub* stub, | 2311 void MacroAssembler::CallStub(CodeStub* stub, |
2320 TypeFeedbackId ast_id, | |
2321 Condition cond) { | 2312 Condition cond) { |
2322 DCHECK(AllowThisStubCall(stub)); // Stub calls are not allowed in some stubs. | 2313 DCHECK(AllowThisStubCall(stub)); // Stub calls are not allowed in some stubs. |
2323 Call(stub->GetCode(), RelocInfo::CODE_TARGET, ast_id, cond, | 2314 Call(stub->GetCode(), RelocInfo::CODE_TARGET, cond, CAN_INLINE_TARGET_ADDRESS, |
2324 CAN_INLINE_TARGET_ADDRESS, false); | 2315 false); |
2325 } | 2316 } |
2326 | 2317 |
2327 | 2318 |
2328 void MacroAssembler::TailCallStub(CodeStub* stub, Condition cond) { | 2319 void MacroAssembler::TailCallStub(CodeStub* stub, Condition cond) { |
2329 Jump(stub->GetCode(), RelocInfo::CODE_TARGET, cond); | 2320 Jump(stub->GetCode(), RelocInfo::CODE_TARGET, cond); |
2330 } | 2321 } |
2331 | 2322 |
2332 | 2323 |
2333 bool MacroAssembler::AllowThisStubCall(CodeStub* stub) { | 2324 bool MacroAssembler::AllowThisStubCall(CodeStub* stub) { |
2334 return has_frame_ || !stub->SometimesSetsUpAFrame(); | 2325 return has_frame_ || !stub->SometimesSetsUpAFrame(); |
(...skipping 1392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3727 } | 3718 } |
3728 } | 3719 } |
3729 if (mag.shift > 0) mov(result, Operand(result, ASR, mag.shift)); | 3720 if (mag.shift > 0) mov(result, Operand(result, ASR, mag.shift)); |
3730 add(result, result, Operand(dividend, LSR, 31)); | 3721 add(result, result, Operand(dividend, LSR, 31)); |
3731 } | 3722 } |
3732 | 3723 |
3733 } // namespace internal | 3724 } // namespace internal |
3734 } // namespace v8 | 3725 } // namespace v8 |
3735 | 3726 |
3736 #endif // V8_TARGET_ARCH_ARM | 3727 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |