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 #include "src/v8.h" | 7 #include "src/v8.h" |
8 | 8 |
9 #if V8_TARGET_ARCH_ARM | 9 #if V8_TARGET_ARCH_ARM |
10 | 10 |
(...skipping 2265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2276 Jump(success, RelocInfo::CODE_TARGET, eq); | 2276 Jump(success, RelocInfo::CODE_TARGET, eq); |
2277 bind(&fail); | 2277 bind(&fail); |
2278 } | 2278 } |
2279 | 2279 |
2280 | 2280 |
2281 void MacroAssembler::TryGetFunctionPrototype(Register function, | 2281 void MacroAssembler::TryGetFunctionPrototype(Register function, |
2282 Register result, | 2282 Register result, |
2283 Register scratch, | 2283 Register scratch, |
2284 Label* miss, | 2284 Label* miss, |
2285 bool miss_on_bound_function) { | 2285 bool miss_on_bound_function) { |
2286 // Check that the receiver isn't a smi. | 2286 Label non_instance; |
2287 JumpIfSmi(function, miss); | 2287 if (miss_on_bound_function) { |
| 2288 // Check that the receiver isn't a smi. |
| 2289 JumpIfSmi(function, miss); |
2288 | 2290 |
2289 // Check that the function really is a function. Load map into result reg. | 2291 // Check that the function really is a function. Load map into result reg. |
2290 CompareObjectType(function, result, scratch, JS_FUNCTION_TYPE); | 2292 CompareObjectType(function, result, scratch, JS_FUNCTION_TYPE); |
2291 b(ne, miss); | 2293 b(ne, miss); |
2292 | 2294 |
2293 if (miss_on_bound_function) { | |
2294 ldr(scratch, | 2295 ldr(scratch, |
2295 FieldMemOperand(function, JSFunction::kSharedFunctionInfoOffset)); | 2296 FieldMemOperand(function, JSFunction::kSharedFunctionInfoOffset)); |
2296 ldr(scratch, | 2297 ldr(scratch, |
2297 FieldMemOperand(scratch, SharedFunctionInfo::kCompilerHintsOffset)); | 2298 FieldMemOperand(scratch, SharedFunctionInfo::kCompilerHintsOffset)); |
2298 tst(scratch, | 2299 tst(scratch, |
2299 Operand(Smi::FromInt(1 << SharedFunctionInfo::kBoundFunction))); | 2300 Operand(Smi::FromInt(1 << SharedFunctionInfo::kBoundFunction))); |
2300 b(ne, miss); | 2301 b(ne, miss); |
| 2302 |
| 2303 // Make sure that the function has an instance prototype. |
| 2304 ldrb(scratch, FieldMemOperand(result, Map::kBitFieldOffset)); |
| 2305 tst(scratch, Operand(1 << Map::kHasNonInstancePrototype)); |
| 2306 b(ne, &non_instance); |
2301 } | 2307 } |
2302 | 2308 |
2303 // Make sure that the function has an instance prototype. | |
2304 Label non_instance; | |
2305 ldrb(scratch, FieldMemOperand(result, Map::kBitFieldOffset)); | |
2306 tst(scratch, Operand(1 << Map::kHasNonInstancePrototype)); | |
2307 b(ne, &non_instance); | |
2308 | |
2309 // Get the prototype or initial map from the function. | 2309 // Get the prototype or initial map from the function. |
2310 ldr(result, | 2310 ldr(result, |
2311 FieldMemOperand(function, JSFunction::kPrototypeOrInitialMapOffset)); | 2311 FieldMemOperand(function, JSFunction::kPrototypeOrInitialMapOffset)); |
2312 | 2312 |
2313 // If the prototype or initial map is the hole, don't return it and | 2313 // If the prototype or initial map is the hole, don't return it and |
2314 // simply miss the cache instead. This will allow us to allocate a | 2314 // simply miss the cache instead. This will allow us to allocate a |
2315 // prototype object on-demand in the runtime system. | 2315 // prototype object on-demand in the runtime system. |
2316 LoadRoot(ip, Heap::kTheHoleValueRootIndex); | 2316 LoadRoot(ip, Heap::kTheHoleValueRootIndex); |
2317 cmp(result, ip); | 2317 cmp(result, ip); |
2318 b(eq, miss); | 2318 b(eq, miss); |
2319 | 2319 |
2320 // If the function does not have an initial map, we're done. | 2320 // If the function does not have an initial map, we're done. |
2321 Label done; | 2321 Label done; |
2322 CompareObjectType(result, scratch, scratch, MAP_TYPE); | 2322 CompareObjectType(result, scratch, scratch, MAP_TYPE); |
2323 b(ne, &done); | 2323 b(ne, &done); |
2324 | 2324 |
2325 // Get the prototype from the initial map. | 2325 // Get the prototype from the initial map. |
2326 ldr(result, FieldMemOperand(result, Map::kPrototypeOffset)); | 2326 ldr(result, FieldMemOperand(result, Map::kPrototypeOffset)); |
2327 jmp(&done); | |
2328 | 2327 |
2329 // Non-instance prototype: Fetch prototype from constructor field | 2328 if (miss_on_bound_function) { |
2330 // in initial map. | 2329 jmp(&done); |
2331 bind(&non_instance); | 2330 |
2332 ldr(result, FieldMemOperand(result, Map::kConstructorOffset)); | 2331 // Non-instance prototype: Fetch prototype from constructor field |
| 2332 // in initial map. |
| 2333 bind(&non_instance); |
| 2334 ldr(result, FieldMemOperand(result, Map::kConstructorOffset)); |
| 2335 } |
2333 | 2336 |
2334 // All done. | 2337 // All done. |
2335 bind(&done); | 2338 bind(&done); |
2336 } | 2339 } |
2337 | 2340 |
2338 | 2341 |
2339 void MacroAssembler::CallStub(CodeStub* stub, | 2342 void MacroAssembler::CallStub(CodeStub* stub, |
2340 TypeFeedbackId ast_id, | 2343 TypeFeedbackId ast_id, |
2341 Condition cond) { | 2344 Condition cond) { |
2342 ASSERT(AllowThisStubCall(stub)); // Stub calls are not allowed in some stubs. | 2345 ASSERT(AllowThisStubCall(stub)); // Stub calls are not allowed in some stubs. |
(...skipping 1756 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4099 sub(result, result, Operand(dividend)); | 4102 sub(result, result, Operand(dividend)); |
4100 } | 4103 } |
4101 if (ms.shift() > 0) mov(result, Operand(result, ASR, ms.shift())); | 4104 if (ms.shift() > 0) mov(result, Operand(result, ASR, ms.shift())); |
4102 add(result, result, Operand(dividend, LSR, 31)); | 4105 add(result, result, Operand(dividend, LSR, 31)); |
4103 } | 4106 } |
4104 | 4107 |
4105 | 4108 |
4106 } } // namespace v8::internal | 4109 } } // namespace v8::internal |
4107 | 4110 |
4108 #endif // V8_TARGET_ARCH_ARM | 4111 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |