Index: src/ia32/code-stubs-ia32.cc |
diff --git a/src/ia32/code-stubs-ia32.cc b/src/ia32/code-stubs-ia32.cc |
index 3d359327fb4098c9aea58fa84267042a6d7e90fb..a5564d7ab9002b16cbf2db45c254bb7ab831b5f8 100644 |
--- a/src/ia32/code-stubs-ia32.cc |
+++ b/src/ia32/code-stubs-ia32.cc |
@@ -2137,6 +2137,11 @@ void InstanceOfStub::Generate(MacroAssembler* masm) { |
__ CmpObjectType(function, JS_FUNCTION_TYPE, function_map); |
__ j(not_equal, &slow_case); |
+ // Go to the runtime if the function is not a constructor. |
+ __ test_b(FieldOperand(function_map, Map::kBitFieldOffset), |
+ static_cast<uint8_t>(1 << Map::kIsConstructor)); |
+ __ j(zero, &slow_case); |
+ |
// Ensure that {function} has an instance prototype. |
__ test_b(FieldOperand(function_map, Map::kBitFieldOffset), |
static_cast<uint8_t>(1 << Map::kHasNonInstancePrototype)); |