Index: src/arm64/code-stubs-arm64.cc |
diff --git a/src/arm64/code-stubs-arm64.cc b/src/arm64/code-stubs-arm64.cc |
index f0bc691e835934466eb3a9ac577b317450d10e3b..9967847c62c38c01fb838687edafb6c962835c8c 100644 |
--- a/src/arm64/code-stubs-arm64.cc |
+++ b/src/arm64/code-stubs-arm64.cc |
@@ -1586,14 +1586,23 @@ void InstanceOfStub::Generate(MacroAssembler* masm) { |
// Loop through the prototype chain looking for the {function} prototype. |
// Assume true, and change to false if not found. |
Register const object_instance_type = function_map; |
+ Register const map_bit_field = function_map; |
Register const null = scratch; |
Register const result = x0; |
- Label done, loop, proxy_case; |
+ |
+ Label done, loop, fast_runtime_fallback; |
__ LoadRoot(result, Heap::kTrueValueRootIndex); |
__ LoadRoot(null, Heap::kNullValueRootIndex); |
__ Bind(&loop); |
+ |
+ // Check if the object needs to be access checked. |
+ __ Ldrb(map_bit_field, FieldMemOperand(object_map, Map::kBitFieldOffset)); |
+ __ TestAndBranchIfAnySet(map_bit_field, 1 << Map::kIsAccessCheckNeeded, |
+ &fast_runtime_fallback); |
+ // Check if the current object is a Proxy. |
__ CompareInstanceType(object_map, object_instance_type, JS_PROXY_TYPE); |
- __ B(eq, &proxy_case); |
+ __ B(eq, &fast_runtime_fallback); |
+ |
__ Ldr(object, FieldMemOperand(object_map, Map::kPrototypeOffset)); |
__ Cmp(object, function_prototype); |
__ B(eq, &done); |
@@ -1605,8 +1614,8 @@ void InstanceOfStub::Generate(MacroAssembler* masm) { |
__ StoreRoot(result, Heap::kInstanceofCacheAnswerRootIndex); |
__ Ret(); |
- // Proxy-case: Call the %HasInPrototypeChain runtime function. |
- __ Bind(&proxy_case); |
+ // Found Proxy or access check needed: Call the runtime |
+ __ Bind(&fast_runtime_fallback); |
__ Push(object, function_prototype); |
// Invalidate the instanceof cache. |
__ Move(scratch, Smi::FromInt(0)); |