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

Unified Diff: src/x87/builtins-x87.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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/x64/builtins-x64.cc ('k') | test/cctest/cctest.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/x87/builtins-x87.cc
diff --git a/src/x87/builtins-x87.cc b/src/x87/builtins-x87.cc
index 5e53333c95452397be6c5cd5597fdf4b31de39d2..55ec55fc6f8683e8c335fa5a587bb612388d4557 100644
--- a/src/x87/builtins-x87.cc
+++ b/src/x87/builtins-x87.cc
@@ -2355,17 +2355,10 @@ static void CompatibleReceiverCheck(MacroAssembler* masm, Register receiver,
__ j(equal, &receiver_check_passed, Label::kNear);
// Walk the prototype chain.
+ __ mov(scratch0, FieldOperand(receiver, HeapObject::kMapOffset));
Label prototype_loop_start;
__ bind(&prototype_loop_start);
- // End if receiver is null or if it's a hidden prototype.
- __ CompareRoot(receiver, Heap::kNullValueRootIndex);
- __ j(equal, receiver_check_failed, Label::kNear);
- __ mov(scratch0, FieldOperand(receiver, HeapObject::kMapOffset));
- __ test(FieldOperand(scratch0, Map::kBitField3Offset),
- Immediate(Map::IsHiddenPrototype::kMask));
- __ j(not_zero, receiver_check_failed, Label::kNear);
-
// Get the constructor, if any.
__ GetMapConstructor(scratch0, scratch0, scratch1);
__ CmpInstanceType(scratch1, JS_FUNCTION_TYPE);
@@ -2398,10 +2391,18 @@ static void CompatibleReceiverCheck(MacroAssembler* masm, Register receiver,
FieldOperand(scratch0, FunctionTemplateInfo::kParentTemplateOffset));
__ jmp(&function_template_loop, Label::kNear);
- // Load the next prototype and iterate.
+ // Load the next prototype.
__ bind(&next_prototype);
__ mov(receiver, FieldOperand(receiver, HeapObject::kMapOffset));
__ mov(receiver, FieldOperand(receiver, Map::kPrototypeOffset));
+ // End if the prototype is null or not hidden.
+ __ CompareRoot(receiver, Heap::kNullValueRootIndex);
+ __ j(equal, receiver_check_failed);
+ __ mov(scratch0, FieldOperand(receiver, HeapObject::kMapOffset));
+ __ test(FieldOperand(scratch0, Map::kBitField3Offset),
+ Immediate(Map::IsHiddenPrototype::kMask));
+ __ j(zero, receiver_check_failed);
+ // Iterate.
__ jmp(&prototype_loop_start, Label::kNear);
__ bind(&receiver_check_passed);
« no previous file with comments | « src/x64/builtins-x64.cc ('k') | test/cctest/cctest.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698