Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(382)

Side by Side Diff: src/mips64/builtins-mips64.cc

Issue 1576423003: Fix the receiver check in the HandleFastApiCall builtin. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebased. Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/mips/builtins-mips.cc ('k') | src/ppc/builtins-ppc.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #if V8_TARGET_ARCH_MIPS64 5 #if V8_TARGET_ARCH_MIPS64
6 6
7 #include "src/codegen.h" 7 #include "src/codegen.h"
8 #include "src/debug/debug.h" 8 #include "src/debug/debug.h"
9 #include "src/deoptimizer.h" 9 #include "src/deoptimizer.h"
10 #include "src/full-codegen/full-codegen.h" 10 #include "src/full-codegen/full-codegen.h"
(...skipping 1294 matching lines...) Expand 10 before | Expand all | Expand 10 after
1305 Register scratch = a5; 1305 Register scratch = a5;
1306 1306
1307 // If there is no signature, return the holder. 1307 // If there is no signature, return the holder.
1308 __ ld(signature, FieldMemOperand(function_template_info, 1308 __ ld(signature, FieldMemOperand(function_template_info,
1309 FunctionTemplateInfo::kSignatureOffset)); 1309 FunctionTemplateInfo::kSignatureOffset));
1310 Label receiver_check_passed; 1310 Label receiver_check_passed;
1311 __ JumpIfRoot(signature, Heap::kUndefinedValueRootIndex, 1311 __ JumpIfRoot(signature, Heap::kUndefinedValueRootIndex,
1312 &receiver_check_passed); 1312 &receiver_check_passed);
1313 1313
1314 // Walk the prototype chain. 1314 // Walk the prototype chain.
1315 __ ld(map, FieldMemOperand(receiver, HeapObject::kMapOffset));
1315 Label prototype_loop_start; 1316 Label prototype_loop_start;
1316 __ bind(&prototype_loop_start); 1317 __ bind(&prototype_loop_start);
1317 1318
1318 // End if the receiver is null or if it's a hidden type.
1319 __ JumpIfRoot(receiver, Heap::kNullValueRootIndex, receiver_check_failed);
1320 __ ld(map, FieldMemOperand(receiver, HeapObject::kMapOffset));
1321 __ lwu(scratch, FieldMemOperand(map, Map::kBitField3Offset));
1322 __ DecodeField<Map::IsHiddenPrototype>(scratch);
1323 __ Branch(receiver_check_failed, ne, scratch, Operand(zero_reg));
1324
1325 // Get the constructor, if any. 1319 // Get the constructor, if any.
1326 __ GetMapConstructor(constructor, map, scratch, scratch); 1320 __ GetMapConstructor(constructor, map, scratch, scratch);
1327 Label next_prototype; 1321 Label next_prototype;
1328 __ Branch(&next_prototype, ne, scratch, Operand(JS_FUNCTION_TYPE)); 1322 __ Branch(&next_prototype, ne, scratch, Operand(JS_FUNCTION_TYPE));
1329 Register type = constructor; 1323 Register type = constructor;
1330 __ ld(type, 1324 __ ld(type,
1331 FieldMemOperand(constructor, JSFunction::kSharedFunctionInfoOffset)); 1325 FieldMemOperand(constructor, JSFunction::kSharedFunctionInfoOffset));
1332 __ ld(type, FieldMemOperand(type, SharedFunctionInfo::kFunctionDataOffset)); 1326 __ ld(type, FieldMemOperand(type, SharedFunctionInfo::kFunctionDataOffset));
1333 1327
1334 // Loop through the chain of inheriting function templates. 1328 // Loop through the chain of inheriting function templates.
1335 Label function_template_loop; 1329 Label function_template_loop;
1336 __ bind(&function_template_loop); 1330 __ bind(&function_template_loop);
1337 1331
1338 // If the signatures match, we have a compatible receiver. 1332 // If the signatures match, we have a compatible receiver.
1339 __ Branch(&receiver_check_passed, eq, signature, Operand(type), 1333 __ Branch(&receiver_check_passed, eq, signature, Operand(type),
1340 USE_DELAY_SLOT); 1334 USE_DELAY_SLOT);
1341 1335
1342 // If the current type is not a FunctionTemplateInfo, load the next prototype 1336 // If the current type is not a FunctionTemplateInfo, load the next prototype
1343 // in the chain. 1337 // in the chain.
1344 __ JumpIfSmi(type, &next_prototype); 1338 __ JumpIfSmi(type, &next_prototype);
1345 __ GetObjectType(type, scratch, scratch); 1339 __ GetObjectType(type, scratch, scratch);
1346 __ Branch(&next_prototype, ne, scratch, Operand(FUNCTION_TEMPLATE_INFO_TYPE)); 1340 __ Branch(&next_prototype, ne, scratch, Operand(FUNCTION_TEMPLATE_INFO_TYPE));
1347 1341
1348 // Otherwise load the parent function template and iterate. 1342 // Otherwise load the parent function template and iterate.
1349 __ ld(type, 1343 __ ld(type,
1350 FieldMemOperand(type, FunctionTemplateInfo::kParentTemplateOffset)); 1344 FieldMemOperand(type, FunctionTemplateInfo::kParentTemplateOffset));
1351 __ Branch(&function_template_loop); 1345 __ Branch(&function_template_loop);
1352 1346
1353 // Load the next prototype and iterate. 1347 // Load the next prototype.
1354 __ bind(&next_prototype); 1348 __ bind(&next_prototype);
1355 __ ld(receiver, FieldMemOperand(map, Map::kPrototypeOffset)); 1349 __ ld(receiver, FieldMemOperand(map, Map::kPrototypeOffset));
1350 // End if the prototype is null or not hidden.
1351 __ JumpIfRoot(receiver, Heap::kNullValueRootIndex, receiver_check_failed);
1352 __ ld(map, FieldMemOperand(receiver, HeapObject::kMapOffset));
1353 __ lwu(scratch, FieldMemOperand(map, Map::kBitField3Offset));
1354 __ DecodeField<Map::IsHiddenPrototype>(scratch);
1355 __ Branch(receiver_check_failed, eq, scratch, Operand(zero_reg));
1356 // Iterate.
1356 __ Branch(&prototype_loop_start); 1357 __ Branch(&prototype_loop_start);
1357 1358
1358 __ bind(&receiver_check_passed); 1359 __ bind(&receiver_check_passed);
1359 } 1360 }
1360 1361
1361 1362
1362 void Builtins::Generate_HandleFastApiCall(MacroAssembler* masm) { 1363 void Builtins::Generate_HandleFastApiCall(MacroAssembler* masm) {
1363 // ----------- S t a t e ------------- 1364 // ----------- S t a t e -------------
1364 // -- a0 : number of arguments excluding receiver 1365 // -- a0 : number of arguments excluding receiver
1365 // -- a1 : callee 1366 // -- a1 : callee
(...skipping 1161 matching lines...) Expand 10 before | Expand all | Expand 10 after
2527 } 2528 }
2528 } 2529 }
2529 2530
2530 2531
2531 #undef __ 2532 #undef __
2532 2533
2533 } // namespace internal 2534 } // namespace internal
2534 } // namespace v8 2535 } // namespace v8
2535 2536
2536 #endif // V8_TARGET_ARCH_MIPS64 2537 #endif // V8_TARGET_ARCH_MIPS64
OLDNEW
« no previous file with comments | « src/mips/builtins-mips.cc ('k') | src/ppc/builtins-ppc.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698