| 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 <assert.h> // For assert | 5 #include <assert.h> // For assert |
| 6 #include <limits.h> // For LONG_MIN, LONG_MAX. | 6 #include <limits.h> // For LONG_MIN, LONG_MAX. |
| 7 | 7 |
| 8 #if V8_TARGET_ARCH_PPC | 8 #if V8_TARGET_ARCH_PPC |
| 9 | 9 |
| 10 #include "src/base/bits.h" | 10 #include "src/base/bits.h" |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 | 133 |
| 134 mov(ip, Operand(reinterpret_cast<intptr_t>(target), rmode)); | 134 mov(ip, Operand(reinterpret_cast<intptr_t>(target), rmode)); |
| 135 mtctr(ip); | 135 mtctr(ip); |
| 136 bctrl(); | 136 bctrl(); |
| 137 | 137 |
| 138 DCHECK_EQ(expected_size, SizeOfCodeGeneratedSince(&start)); | 138 DCHECK_EQ(expected_size, SizeOfCodeGeneratedSince(&start)); |
| 139 } | 139 } |
| 140 | 140 |
| 141 | 141 |
| 142 int MacroAssembler::CallSize(Handle<Code> code, RelocInfo::Mode rmode, | 142 int MacroAssembler::CallSize(Handle<Code> code, RelocInfo::Mode rmode, |
| 143 TypeFeedbackId ast_id, Condition cond) { | 143 Condition cond) { |
| 144 AllowDeferredHandleDereference using_raw_address; | 144 AllowDeferredHandleDereference using_raw_address; |
| 145 return CallSize(reinterpret_cast<Address>(code.location()), rmode, cond); | 145 return CallSize(reinterpret_cast<Address>(code.location()), rmode, cond); |
| 146 } | 146 } |
| 147 | 147 |
| 148 | 148 |
| 149 void MacroAssembler::Call(Handle<Code> code, RelocInfo::Mode rmode, | 149 void MacroAssembler::Call(Handle<Code> code, RelocInfo::Mode rmode, |
| 150 TypeFeedbackId ast_id, Condition cond) { | 150 Condition cond) { |
| 151 BlockTrampolinePoolScope block_trampoline_pool(this); | 151 BlockTrampolinePoolScope block_trampoline_pool(this); |
| 152 DCHECK(RelocInfo::IsCodeTarget(rmode)); | 152 DCHECK(RelocInfo::IsCodeTarget(rmode)); |
| 153 | 153 |
| 154 #ifdef DEBUG | 154 #ifdef DEBUG |
| 155 // Check the expected size before generating code to ensure we assume the same | 155 // Check the expected size before generating code to ensure we assume the same |
| 156 // constant pool availability (e.g., whether constant pool is full or not). | 156 // constant pool availability (e.g., whether constant pool is full or not). |
| 157 int expected_size = CallSize(code, rmode, ast_id, cond); | 157 int expected_size = CallSize(code, rmode, cond); |
| 158 Label start; | 158 Label start; |
| 159 bind(&start); | 159 bind(&start); |
| 160 #endif | 160 #endif |
| 161 | 161 |
| 162 if (rmode == RelocInfo::CODE_TARGET && !ast_id.IsNone()) { | |
| 163 SetRecordedAstId(ast_id); | |
| 164 rmode = RelocInfo::CODE_TARGET_WITH_ID; | |
| 165 } | |
| 166 AllowDeferredHandleDereference using_raw_address; | 162 AllowDeferredHandleDereference using_raw_address; |
| 167 Call(reinterpret_cast<Address>(code.location()), rmode, cond); | 163 Call(reinterpret_cast<Address>(code.location()), rmode, cond); |
| 168 DCHECK_EQ(expected_size, SizeOfCodeGeneratedSince(&start)); | 164 DCHECK_EQ(expected_size, SizeOfCodeGeneratedSince(&start)); |
| 169 } | 165 } |
| 170 | 166 |
| 171 | 167 |
| 172 void MacroAssembler::Drop(int count) { | 168 void MacroAssembler::Drop(int count) { |
| 173 if (count > 0) { | 169 if (count > 0) { |
| 174 Add(sp, sp, count * kPointerSize, r0); | 170 Add(sp, sp, count * kPointerSize, r0); |
| 175 } | 171 } |
| (...skipping 1922 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2098 LoadP(result, FieldMemOperand(map, Map::kConstructorOrBackPointerOffset)); | 2094 LoadP(result, FieldMemOperand(map, Map::kConstructorOrBackPointerOffset)); |
| 2099 bind(&loop); | 2095 bind(&loop); |
| 2100 JumpIfSmi(result, &done); | 2096 JumpIfSmi(result, &done); |
| 2101 CompareObjectType(result, temp, temp2, MAP_TYPE); | 2097 CompareObjectType(result, temp, temp2, MAP_TYPE); |
| 2102 bne(&done); | 2098 bne(&done); |
| 2103 LoadP(result, FieldMemOperand(result, Map::kConstructorOrBackPointerOffset)); | 2099 LoadP(result, FieldMemOperand(result, Map::kConstructorOrBackPointerOffset)); |
| 2104 b(&loop); | 2100 b(&loop); |
| 2105 bind(&done); | 2101 bind(&done); |
| 2106 } | 2102 } |
| 2107 | 2103 |
| 2108 void MacroAssembler::CallStub(CodeStub* stub, TypeFeedbackId ast_id, | 2104 void MacroAssembler::CallStub(CodeStub* stub, Condition cond) { |
| 2109 Condition cond) { | |
| 2110 DCHECK(AllowThisStubCall(stub)); // Stub calls are not allowed in some stubs. | 2105 DCHECK(AllowThisStubCall(stub)); // Stub calls are not allowed in some stubs. |
| 2111 Call(stub->GetCode(), RelocInfo::CODE_TARGET, ast_id, cond); | 2106 Call(stub->GetCode(), RelocInfo::CODE_TARGET, cond); |
| 2112 } | 2107 } |
| 2113 | 2108 |
| 2114 | 2109 |
| 2115 void MacroAssembler::TailCallStub(CodeStub* stub, Condition cond) { | 2110 void MacroAssembler::TailCallStub(CodeStub* stub, Condition cond) { |
| 2116 Jump(stub->GetCode(), RelocInfo::CODE_TARGET, cond); | 2111 Jump(stub->GetCode(), RelocInfo::CODE_TARGET, cond); |
| 2117 } | 2112 } |
| 2118 | 2113 |
| 2119 | 2114 |
| 2120 bool MacroAssembler::AllowThisStubCall(CodeStub* stub) { | 2115 bool MacroAssembler::AllowThisStubCall(CodeStub* stub) { |
| 2121 return has_frame_ || !stub->SometimesSetsUpAFrame(); | 2116 return has_frame_ || !stub->SometimesSetsUpAFrame(); |
| (...skipping 2144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4266 } | 4261 } |
| 4267 if (mag.shift > 0) srawi(result, result, mag.shift); | 4262 if (mag.shift > 0) srawi(result, result, mag.shift); |
| 4268 ExtractBit(r0, dividend, 31); | 4263 ExtractBit(r0, dividend, 31); |
| 4269 add(result, result, r0); | 4264 add(result, result, r0); |
| 4270 } | 4265 } |
| 4271 | 4266 |
| 4272 } // namespace internal | 4267 } // namespace internal |
| 4273 } // namespace v8 | 4268 } // namespace v8 |
| 4274 | 4269 |
| 4275 #endif // V8_TARGET_ARCH_PPC | 4270 #endif // V8_TARGET_ARCH_PPC |
| OLD | NEW |