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

Side by Side Diff: src/ppc/builtins-ppc.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/mips64/builtins-mips64.cc ('k') | src/x64/builtins-x64.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 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 #if V8_TARGET_ARCH_PPC 5 #if V8_TARGET_ARCH_PPC
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 1291 matching lines...) Expand 10 before | Expand all | Expand 10 after
1302 Register scratch = r10; 1302 Register scratch = r10;
1303 1303
1304 // If there is no signature, return the holder. 1304 // If there is no signature, return the holder.
1305 __ LoadP(signature, FieldMemOperand(function_template_info, 1305 __ LoadP(signature, FieldMemOperand(function_template_info,
1306 FunctionTemplateInfo::kSignatureOffset)); 1306 FunctionTemplateInfo::kSignatureOffset));
1307 Label receiver_check_passed; 1307 Label receiver_check_passed;
1308 __ JumpIfRoot(signature, Heap::kUndefinedValueRootIndex, 1308 __ JumpIfRoot(signature, Heap::kUndefinedValueRootIndex,
1309 &receiver_check_passed); 1309 &receiver_check_passed);
1310 1310
1311 // Walk the prototype chain. 1311 // Walk the prototype chain.
1312 __ LoadP(map, FieldMemOperand(receiver, HeapObject::kMapOffset));
1312 Label prototype_loop_start; 1313 Label prototype_loop_start;
1313 __ bind(&prototype_loop_start); 1314 __ bind(&prototype_loop_start);
1314 1315
1315 // End if the receiver is null or if it's a hidden type.
1316 __ JumpIfRoot(receiver, Heap::kNullValueRootIndex, receiver_check_failed);
1317 __ LoadP(map, FieldMemOperand(receiver, HeapObject::kMapOffset));
1318 __ LoadP(scratch, FieldMemOperand(map, Map::kBitField3Offset));
1319 __ DecodeField<Map::IsHiddenPrototype>(scratch, SetRC);
1320 __ bne(receiver_check_failed, cr0);
1321
1322
1323 // Get the constructor, if any. 1316 // Get the constructor, if any.
1324 __ GetMapConstructor(constructor, map, scratch, scratch); 1317 __ GetMapConstructor(constructor, map, scratch, scratch);
1325 __ cmpi(scratch, Operand(JS_FUNCTION_TYPE)); 1318 __ cmpi(scratch, Operand(JS_FUNCTION_TYPE));
1326 Label next_prototype; 1319 Label next_prototype;
1327 __ bne(&next_prototype); 1320 __ bne(&next_prototype);
1328 Register type = constructor; 1321 Register type = constructor;
1329 __ LoadP(type, 1322 __ LoadP(type,
1330 FieldMemOperand(constructor, JSFunction::kSharedFunctionInfoOffset)); 1323 FieldMemOperand(constructor, JSFunction::kSharedFunctionInfoOffset));
1331 __ LoadP(type, 1324 __ LoadP(type,
1332 FieldMemOperand(type, SharedFunctionInfo::kFunctionDataOffset)); 1325 FieldMemOperand(type, SharedFunctionInfo::kFunctionDataOffset));
(...skipping 10 matching lines...) Expand all
1343 // in the chain. 1336 // in the chain.
1344 __ JumpIfSmi(type, &next_prototype); 1337 __ JumpIfSmi(type, &next_prototype);
1345 __ CompareObjectType(type, scratch, scratch, FUNCTION_TEMPLATE_INFO_TYPE); 1338 __ CompareObjectType(type, scratch, scratch, FUNCTION_TEMPLATE_INFO_TYPE);
1346 __ bne(&next_prototype); 1339 __ bne(&next_prototype);
1347 1340
1348 // Otherwise load the parent function template and iterate. 1341 // Otherwise load the parent function template and iterate.
1349 __ LoadP(type, 1342 __ LoadP(type,
1350 FieldMemOperand(type, FunctionTemplateInfo::kParentTemplateOffset)); 1343 FieldMemOperand(type, FunctionTemplateInfo::kParentTemplateOffset));
1351 __ b(&function_template_loop); 1344 __ b(&function_template_loop);
1352 1345
1353 // Load the next prototype and iterate. 1346 // Load the next prototype.
1354 __ bind(&next_prototype); 1347 __ bind(&next_prototype);
1355 __ LoadP(receiver, FieldMemOperand(map, Map::kPrototypeOffset)); 1348 __ LoadP(receiver, FieldMemOperand(map, Map::kPrototypeOffset));
1349 // End if the prototype is null or not hidden.
1350 __ JumpIfRoot(receiver, Heap::kNullValueRootIndex, receiver_check_failed);
1351 __ LoadP(map, FieldMemOperand(receiver, HeapObject::kMapOffset));
1352 __ LoadP(scratch, FieldMemOperand(map, Map::kBitField3Offset));
1353 __ DecodeField<Map::IsHiddenPrototype>(scratch, SetRC);
1354 __ beq(receiver_check_failed, cr0);
1355 // Iterate.
1356 __ b(&prototype_loop_start); 1356 __ b(&prototype_loop_start);
1357 1357
1358 __ bind(&receiver_check_passed); 1358 __ bind(&receiver_check_passed);
1359 } 1359 }
1360 1360
1361 1361
1362 void Builtins::Generate_HandleFastApiCall(MacroAssembler* masm) { 1362 void Builtins::Generate_HandleFastApiCall(MacroAssembler* masm) {
1363 // ----------- S t a t e ------------- 1363 // ----------- S t a t e -------------
1364 // -- r3 : number of arguments excluding receiver 1364 // -- r3 : number of arguments excluding receiver
1365 // -- r4 : callee 1365 // -- r4 : callee
(...skipping 1132 matching lines...) Expand 10 before | Expand all | Expand 10 after
2498 __ bkpt(0); 2498 __ bkpt(0);
2499 } 2499 }
2500 } 2500 }
2501 2501
2502 2502
2503 #undef __ 2503 #undef __
2504 } // namespace internal 2504 } // namespace internal
2505 } // namespace v8 2505 } // namespace v8
2506 2506
2507 #endif // V8_TARGET_ARCH_PPC 2507 #endif // V8_TARGET_ARCH_PPC
OLDNEW
« no previous file with comments | « src/mips64/builtins-mips64.cc ('k') | src/x64/builtins-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698