Index: src/x64/macro-assembler-x64.cc |
diff --git a/src/x64/macro-assembler-x64.cc b/src/x64/macro-assembler-x64.cc |
index a5e2972620ad4f147bcc6c80e53b98f748f9c2dc..079f9b057113ad9b08b7b43f9164cc78584c88f3 100644 |
--- a/src/x64/macro-assembler-x64.cc |
+++ b/src/x64/macro-assembler-x64.cc |
@@ -3745,15 +3745,16 @@ void MacroAssembler::TryGetFunctionPrototype(Register function, |
Register result, |
Label* miss, |
bool miss_on_bound_function) { |
- // Check that the receiver isn't a smi. |
- testl(function, Immediate(kSmiTagMask)); |
- j(zero, miss); |
+ Label non_instance; |
+ if (miss_on_bound_function) { |
+ // Check that the receiver isn't a smi. |
+ testl(function, Immediate(kSmiTagMask)); |
+ j(zero, miss); |
- // Check that the function really is a function. |
- CmpObjectType(function, JS_FUNCTION_TYPE, result); |
- j(not_equal, miss); |
+ // Check that the function really is a function. |
+ CmpObjectType(function, JS_FUNCTION_TYPE, result); |
+ j(not_equal, miss); |
- if (miss_on_bound_function) { |
movp(kScratchRegister, |
FieldOperand(function, JSFunction::kSharedFunctionInfoOffset)); |
// It's not smi-tagged (stored in the top half of a smi-tagged 8-byte |
@@ -3762,13 +3763,12 @@ void MacroAssembler::TryGetFunctionPrototype(Register function, |
SharedFunctionInfo::kCompilerHintsOffset, |
SharedFunctionInfo::kBoundFunction); |
j(not_zero, miss); |
- } |
- // Make sure that the function has an instance prototype. |
- Label non_instance; |
- testb(FieldOperand(result, Map::kBitFieldOffset), |
- Immediate(1 << Map::kHasNonInstancePrototype)); |
- j(not_zero, &non_instance, Label::kNear); |
+ // Make sure that the function has an instance prototype. |
+ testb(FieldOperand(result, Map::kBitFieldOffset), |
+ Immediate(1 << Map::kHasNonInstancePrototype)); |
+ j(not_zero, &non_instance, Label::kNear); |
+ } |
// Get the prototype or initial map from the function. |
movp(result, |
@@ -3787,12 +3787,15 @@ void MacroAssembler::TryGetFunctionPrototype(Register function, |
// Get the prototype from the initial map. |
movp(result, FieldOperand(result, Map::kPrototypeOffset)); |
- jmp(&done, Label::kNear); |
- // Non-instance prototype: Fetch prototype from constructor field |
- // in initial map. |
- bind(&non_instance); |
- movp(result, FieldOperand(result, Map::kConstructorOffset)); |
+ if (miss_on_bound_function) { |
+ jmp(&done, Label::kNear); |
+ |
+ // Non-instance prototype: Fetch prototype from constructor field |
+ // in initial map. |
+ bind(&non_instance); |
+ movp(result, FieldOperand(result, Map::kConstructorOffset)); |
+ } |
// All done. |
bind(&done); |