| 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 2129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2140 LoadP(result, FieldMemOperand(map, Map::kConstructorOrBackPointerOffset)); | 2140 LoadP(result, FieldMemOperand(map, Map::kConstructorOrBackPointerOffset)); |
| 2141 bind(&loop); | 2141 bind(&loop); |
| 2142 JumpIfSmi(result, &done); | 2142 JumpIfSmi(result, &done); |
| 2143 CompareObjectType(result, temp, temp2, MAP_TYPE); | 2143 CompareObjectType(result, temp, temp2, MAP_TYPE); |
| 2144 bne(&done); | 2144 bne(&done); |
| 2145 LoadP(result, FieldMemOperand(result, Map::kConstructorOrBackPointerOffset)); | 2145 LoadP(result, FieldMemOperand(result, Map::kConstructorOrBackPointerOffset)); |
| 2146 b(&loop); | 2146 b(&loop); |
| 2147 bind(&done); | 2147 bind(&done); |
| 2148 } | 2148 } |
| 2149 | 2149 |
| 2150 | |
| 2151 void MacroAssembler::TryGetFunctionPrototype(Register function, Register result, | |
| 2152 Register scratch, Label* miss) { | |
| 2153 // Get the prototype or initial map from the function. | |
| 2154 LoadP(result, | |
| 2155 FieldMemOperand(function, JSFunction::kPrototypeOrInitialMapOffset)); | |
| 2156 | |
| 2157 // If the prototype or initial map is the hole, don't return it and | |
| 2158 // simply miss the cache instead. This will allow us to allocate a | |
| 2159 // prototype object on-demand in the runtime system. | |
| 2160 LoadRoot(r0, Heap::kTheHoleValueRootIndex); | |
| 2161 cmp(result, r0); | |
| 2162 beq(miss); | |
| 2163 | |
| 2164 // If the function does not have an initial map, we're done. | |
| 2165 Label done; | |
| 2166 CompareObjectType(result, scratch, scratch, MAP_TYPE); | |
| 2167 bne(&done); | |
| 2168 | |
| 2169 // Get the prototype from the initial map. | |
| 2170 LoadP(result, FieldMemOperand(result, Map::kPrototypeOffset)); | |
| 2171 | |
| 2172 // All done. | |
| 2173 bind(&done); | |
| 2174 } | |
| 2175 | |
| 2176 | |
| 2177 void MacroAssembler::CallStub(CodeStub* stub, TypeFeedbackId ast_id, | 2150 void MacroAssembler::CallStub(CodeStub* stub, TypeFeedbackId ast_id, |
| 2178 Condition cond) { | 2151 Condition cond) { |
| 2179 DCHECK(AllowThisStubCall(stub)); // Stub calls are not allowed in some stubs. | 2152 DCHECK(AllowThisStubCall(stub)); // Stub calls are not allowed in some stubs. |
| 2180 Call(stub->GetCode(), RelocInfo::CODE_TARGET, ast_id, cond); | 2153 Call(stub->GetCode(), RelocInfo::CODE_TARGET, ast_id, cond); |
| 2181 } | 2154 } |
| 2182 | 2155 |
| 2183 | 2156 |
| 2184 void MacroAssembler::TailCallStub(CodeStub* stub, Condition cond) { | 2157 void MacroAssembler::TailCallStub(CodeStub* stub, Condition cond) { |
| 2185 Jump(stub->GetCode(), RelocInfo::CODE_TARGET, cond); | 2158 Jump(stub->GetCode(), RelocInfo::CODE_TARGET, cond); |
| 2186 } | 2159 } |
| (...skipping 2194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4381 } | 4354 } |
| 4382 if (mag.shift > 0) srawi(result, result, mag.shift); | 4355 if (mag.shift > 0) srawi(result, result, mag.shift); |
| 4383 ExtractBit(r0, dividend, 31); | 4356 ExtractBit(r0, dividend, 31); |
| 4384 add(result, result, r0); | 4357 add(result, result, r0); |
| 4385 } | 4358 } |
| 4386 | 4359 |
| 4387 } // namespace internal | 4360 } // namespace internal |
| 4388 } // namespace v8 | 4361 } // namespace v8 |
| 4389 | 4362 |
| 4390 #endif // V8_TARGET_ARCH_PPC | 4363 #endif // V8_TARGET_ARCH_PPC |
| OLD | NEW |