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

Side by Side Diff: src/mips/builtins-mips.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/ia32/builtins-ia32.cc ('k') | src/mips64/builtins-mips64.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_MIPS 5 #if V8_TARGET_ARCH_MIPS
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 1304 matching lines...) Expand 10 before | Expand all | Expand 10 after
1315 Register scratch = t5; 1315 Register scratch = t5;
1316 1316
1317 // If there is no signature, return the holder. 1317 // If there is no signature, return the holder.
1318 __ lw(signature, FieldMemOperand(function_template_info, 1318 __ lw(signature, FieldMemOperand(function_template_info,
1319 FunctionTemplateInfo::kSignatureOffset)); 1319 FunctionTemplateInfo::kSignatureOffset));
1320 Label receiver_check_passed; 1320 Label receiver_check_passed;
1321 __ JumpIfRoot(signature, Heap::kUndefinedValueRootIndex, 1321 __ JumpIfRoot(signature, Heap::kUndefinedValueRootIndex,
1322 &receiver_check_passed); 1322 &receiver_check_passed);
1323 1323
1324 // Walk the prototype chain. 1324 // Walk the prototype chain.
1325 __ lw(map, FieldMemOperand(receiver, HeapObject::kMapOffset));
1325 Label prototype_loop_start; 1326 Label prototype_loop_start;
1326 __ bind(&prototype_loop_start); 1327 __ bind(&prototype_loop_start);
1327 1328
1328 // End if the receiver is null or if it's a hidden type.
1329 __ JumpIfRoot(receiver, Heap::kNullValueRootIndex, receiver_check_failed);
1330 __ lw(map, FieldMemOperand(receiver, HeapObject::kMapOffset));
1331 __ lw(scratch, FieldMemOperand(map, Map::kBitField3Offset));
1332 __ DecodeField<Map::IsHiddenPrototype>(scratch);
1333 __ Branch(receiver_check_failed, ne, scratch, Operand(zero_reg));
1334
1335 // Get the constructor, if any. 1329 // Get the constructor, if any.
1336 __ GetMapConstructor(constructor, map, scratch, scratch); 1330 __ GetMapConstructor(constructor, map, scratch, scratch);
1337 Label next_prototype; 1331 Label next_prototype;
1338 __ Branch(&next_prototype, ne, scratch, Operand(JS_FUNCTION_TYPE)); 1332 __ Branch(&next_prototype, ne, scratch, Operand(JS_FUNCTION_TYPE));
1339 Register type = constructor; 1333 Register type = constructor;
1340 __ lw(type, 1334 __ lw(type,
1341 FieldMemOperand(constructor, JSFunction::kSharedFunctionInfoOffset)); 1335 FieldMemOperand(constructor, JSFunction::kSharedFunctionInfoOffset));
1342 __ lw(type, FieldMemOperand(type, SharedFunctionInfo::kFunctionDataOffset)); 1336 __ lw(type, FieldMemOperand(type, SharedFunctionInfo::kFunctionDataOffset));
1343 1337
1344 // Loop through the chain of inheriting function templates. 1338 // Loop through the chain of inheriting function templates.
(...skipping 11 matching lines...) Expand all
1356 __ Branch(&next_prototype, ne, scratch, Operand(FUNCTION_TEMPLATE_INFO_TYPE)); 1350 __ Branch(&next_prototype, ne, scratch, Operand(FUNCTION_TEMPLATE_INFO_TYPE));
1357 1351
1358 // Otherwise load the parent function template and iterate. 1352 // Otherwise load the parent function template and iterate.
1359 __ lw(type, 1353 __ lw(type,
1360 FieldMemOperand(type, FunctionTemplateInfo::kParentTemplateOffset)); 1354 FieldMemOperand(type, FunctionTemplateInfo::kParentTemplateOffset));
1361 __ Branch(&function_template_loop); 1355 __ Branch(&function_template_loop);
1362 1356
1363 // Load the next prototype and iterate. 1357 // Load the next prototype and iterate.
1364 __ bind(&next_prototype); 1358 __ bind(&next_prototype);
1365 __ lw(receiver, FieldMemOperand(map, Map::kPrototypeOffset)); 1359 __ lw(receiver, FieldMemOperand(map, Map::kPrototypeOffset));
1360 // End if the prototype is null or not hidden.
1361 __ JumpIfRoot(receiver, Heap::kNullValueRootIndex, receiver_check_failed);
1362 __ lw(map, FieldMemOperand(receiver, HeapObject::kMapOffset));
1363 __ lw(scratch, FieldMemOperand(map, Map::kBitField3Offset));
1364 __ DecodeField<Map::IsHiddenPrototype>(scratch);
1365 __ Branch(receiver_check_failed, eq, scratch, Operand(zero_reg));
1366
1366 __ Branch(&prototype_loop_start); 1367 __ Branch(&prototype_loop_start);
1367 1368
1368 __ bind(&receiver_check_passed); 1369 __ bind(&receiver_check_passed);
1369 } 1370 }
1370 1371
1371 1372
1372 void Builtins::Generate_HandleFastApiCall(MacroAssembler* masm) { 1373 void Builtins::Generate_HandleFastApiCall(MacroAssembler* masm) {
1373 // ----------- S t a t e ------------- 1374 // ----------- S t a t e -------------
1374 // -- a0 : number of arguments excluding receiver 1375 // -- a0 : number of arguments excluding receiver
1375 // -- a1 : callee 1376 // -- a1 : callee
(...skipping 1162 matching lines...) Expand 10 before | Expand all | Expand 10 after
2538 } 2539 }
2539 } 2540 }
2540 2541
2541 2542
2542 #undef __ 2543 #undef __
2543 2544
2544 } // namespace internal 2545 } // namespace internal
2545 } // namespace v8 2546 } // namespace v8
2546 2547
2547 #endif // V8_TARGET_ARCH_MIPS 2548 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « src/ia32/builtins-ia32.cc ('k') | src/mips64/builtins-mips64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698