OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 #if V8_TARGET_ARCH_ARM64 | 5 #if V8_TARGET_ARCH_ARM64 |
6 | 6 |
7 #include "src/arm64/frames-arm64.h" | 7 #include "src/arm64/frames-arm64.h" |
8 #include "src/codegen.h" | 8 #include "src/codegen.h" |
9 #include "src/debug/debug.h" | 9 #include "src/debug/debug.h" |
10 #include "src/deoptimizer.h" | 10 #include "src/deoptimizer.h" |
(...skipping 1268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1279 Register constructor = scratch2; | 1279 Register constructor = scratch2; |
1280 | 1280 |
1281 // If there is no signature, return the holder. | 1281 // If there is no signature, return the holder. |
1282 __ Ldr(signature, FieldMemOperand(function_template_info, | 1282 __ Ldr(signature, FieldMemOperand(function_template_info, |
1283 FunctionTemplateInfo::kSignatureOffset)); | 1283 FunctionTemplateInfo::kSignatureOffset)); |
1284 __ CompareRoot(signature, Heap::kUndefinedValueRootIndex); | 1284 __ CompareRoot(signature, Heap::kUndefinedValueRootIndex); |
1285 Label receiver_check_passed; | 1285 Label receiver_check_passed; |
1286 __ B(eq, &receiver_check_passed); | 1286 __ B(eq, &receiver_check_passed); |
1287 | 1287 |
1288 // Walk the prototype chain. | 1288 // Walk the prototype chain. |
| 1289 __ Ldr(map, FieldMemOperand(receiver, HeapObject::kMapOffset)); |
1289 Label prototype_loop_start; | 1290 Label prototype_loop_start; |
1290 __ Bind(&prototype_loop_start); | 1291 __ Bind(&prototype_loop_start); |
1291 | 1292 |
1292 // End if the receiver is null or if it's a hidden type. | |
1293 __ CompareRoot(receiver, Heap::kNullValueRootIndex); | |
1294 __ B(eq, receiver_check_failed); | |
1295 __ Ldr(map, FieldMemOperand(receiver, HeapObject::kMapOffset)); | |
1296 __ Ldr(x16, FieldMemOperand(map, Map::kBitField3Offset)); | |
1297 __ Tst(x16, Operand(Map::IsHiddenPrototype::kMask)); | |
1298 __ B(ne, receiver_check_failed); | |
1299 | |
1300 // Get the constructor, if any | 1293 // Get the constructor, if any |
1301 __ GetMapConstructor(constructor, map, x16, x16); | 1294 __ GetMapConstructor(constructor, map, x16, x16); |
1302 __ cmp(x16, Operand(JS_FUNCTION_TYPE)); | 1295 __ cmp(x16, Operand(JS_FUNCTION_TYPE)); |
1303 Label next_prototype; | 1296 Label next_prototype; |
1304 __ B(ne, &next_prototype); | 1297 __ B(ne, &next_prototype); |
1305 Register type = constructor; | 1298 Register type = constructor; |
1306 __ Ldr(type, | 1299 __ Ldr(type, |
1307 FieldMemOperand(constructor, JSFunction::kSharedFunctionInfoOffset)); | 1300 FieldMemOperand(constructor, JSFunction::kSharedFunctionInfoOffset)); |
1308 __ Ldr(type, FieldMemOperand(type, SharedFunctionInfo::kFunctionDataOffset)); | 1301 __ Ldr(type, FieldMemOperand(type, SharedFunctionInfo::kFunctionDataOffset)); |
1309 | 1302 |
1310 // Loop through the chain of inheriting function templates. | 1303 // Loop through the chain of inheriting function templates. |
1311 Label function_template_loop; | 1304 Label function_template_loop; |
1312 __ Bind(&function_template_loop); | 1305 __ Bind(&function_template_loop); |
1313 | 1306 |
1314 // If the signatures match, we have a compatible receiver. | 1307 // If the signatures match, we have a compatible receiver. |
1315 __ Cmp(signature, type); | 1308 __ Cmp(signature, type); |
1316 __ B(eq, &receiver_check_passed); | 1309 __ B(eq, &receiver_check_passed); |
1317 | 1310 |
1318 // If the current type is not a FunctionTemplateInfo, load the next prototype | 1311 // If the current type is not a FunctionTemplateInfo, load the next prototype |
1319 // in the chain. | 1312 // in the chain. |
1320 __ JumpIfSmi(type, &next_prototype); | 1313 __ JumpIfSmi(type, &next_prototype); |
1321 __ CompareObjectType(type, x16, x17, FUNCTION_TEMPLATE_INFO_TYPE); | 1314 __ CompareObjectType(type, x16, x17, FUNCTION_TEMPLATE_INFO_TYPE); |
1322 __ B(ne, &next_prototype); | 1315 __ B(ne, &next_prototype); |
1323 | 1316 |
1324 // Otherwise load the parent function template and iterate. | 1317 // Otherwise load the parent function template and iterate. |
1325 __ Ldr(type, | 1318 __ Ldr(type, |
1326 FieldMemOperand(type, FunctionTemplateInfo::kParentTemplateOffset)); | 1319 FieldMemOperand(type, FunctionTemplateInfo::kParentTemplateOffset)); |
1327 __ B(&function_template_loop); | 1320 __ B(&function_template_loop); |
1328 | 1321 |
1329 // Load the next prototype and iterate. | 1322 // Load the next prototype. |
1330 __ Bind(&next_prototype); | 1323 __ Bind(&next_prototype); |
1331 __ Ldr(receiver, FieldMemOperand(map, Map::kPrototypeOffset)); | 1324 __ Ldr(receiver, FieldMemOperand(map, Map::kPrototypeOffset)); |
| 1325 // End if the prototype is null or not hidden. |
| 1326 __ CompareRoot(receiver, Heap::kNullValueRootIndex); |
| 1327 __ B(eq, receiver_check_failed); |
| 1328 __ Ldr(map, FieldMemOperand(receiver, HeapObject::kMapOffset)); |
| 1329 __ Ldr(x16, FieldMemOperand(map, Map::kBitField3Offset)); |
| 1330 __ Tst(x16, Operand(Map::IsHiddenPrototype::kMask)); |
| 1331 __ B(eq, receiver_check_failed); |
| 1332 // Iterate. |
1332 __ B(&prototype_loop_start); | 1333 __ B(&prototype_loop_start); |
1333 | 1334 |
1334 __ Bind(&receiver_check_passed); | 1335 __ Bind(&receiver_check_passed); |
1335 } | 1336 } |
1336 | 1337 |
1337 | 1338 |
1338 void Builtins::Generate_HandleFastApiCall(MacroAssembler* masm) { | 1339 void Builtins::Generate_HandleFastApiCall(MacroAssembler* masm) { |
1339 // ----------- S t a t e ------------- | 1340 // ----------- S t a t e ------------- |
1340 // -- x0 : number of arguments excluding receiver | 1341 // -- x0 : number of arguments excluding receiver |
1341 // -- x1 : callee | 1342 // -- x1 : callee |
(...skipping 1236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2578 } | 2579 } |
2579 } | 2580 } |
2580 | 2581 |
2581 | 2582 |
2582 #undef __ | 2583 #undef __ |
2583 | 2584 |
2584 } // namespace internal | 2585 } // namespace internal |
2585 } // namespace v8 | 2586 } // namespace v8 |
2586 | 2587 |
2587 #endif // V8_TARGET_ARCH_ARM | 2588 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |