OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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_ARM64 | 5 #if V8_TARGET_ARCH_ARM64 |
6 | 6 |
7 #include "src/bootstrapper.h" | 7 #include "src/bootstrapper.h" |
8 #include "src/code-stubs.h" | 8 #include "src/code-stubs.h" |
9 #include "src/codegen.h" | 9 #include "src/codegen.h" |
10 #include "src/ic/handler-compiler.h" | 10 #include "src/ic/handler-compiler.h" |
(...skipping 1567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1578 __ Bind(&function_prototype_valid); | 1578 __ Bind(&function_prototype_valid); |
1579 __ AssertNotSmi(function_prototype); | 1579 __ AssertNotSmi(function_prototype); |
1580 | 1580 |
1581 // Update the global instanceof cache with the current {object} map and | 1581 // Update the global instanceof cache with the current {object} map and |
1582 // {function}. The cached answer will be set when it is known below. | 1582 // {function}. The cached answer will be set when it is known below. |
1583 __ StoreRoot(function, Heap::kInstanceofCacheFunctionRootIndex); | 1583 __ StoreRoot(function, Heap::kInstanceofCacheFunctionRootIndex); |
1584 __ StoreRoot(object_map, Heap::kInstanceofCacheMapRootIndex); | 1584 __ StoreRoot(object_map, Heap::kInstanceofCacheMapRootIndex); |
1585 | 1585 |
1586 // Loop through the prototype chain looking for the {function} prototype. | 1586 // Loop through the prototype chain looking for the {function} prototype. |
1587 // Assume true, and change to false if not found. | 1587 // Assume true, and change to false if not found. |
1588 Register const object_prototype = object_map; | 1588 Register const object_instance_type = function_map; |
1589 Register const null = scratch; | 1589 Register const null = scratch; |
1590 Label done, loop; | 1590 Register const result = x0; |
1591 __ LoadRoot(x0, Heap::kTrueValueRootIndex); | 1591 Label done, loop, proxy_case; |
| 1592 __ LoadRoot(result, Heap::kTrueValueRootIndex); |
1592 __ LoadRoot(null, Heap::kNullValueRootIndex); | 1593 __ LoadRoot(null, Heap::kNullValueRootIndex); |
1593 __ Bind(&loop); | 1594 __ Bind(&loop); |
1594 __ Ldr(object_prototype, FieldMemOperand(object_map, Map::kPrototypeOffset)); | 1595 __ CompareInstanceType(object_map, object_instance_type, JS_PROXY_TYPE); |
1595 __ Cmp(object_prototype, function_prototype); | 1596 __ B(eq, &proxy_case); |
| 1597 __ Ldr(object, FieldMemOperand(object_map, Map::kPrototypeOffset)); |
| 1598 __ Cmp(object, function_prototype); |
1596 __ B(eq, &done); | 1599 __ B(eq, &done); |
1597 __ Cmp(object_prototype, null); | 1600 __ Cmp(object, null); |
1598 __ Ldr(object_map, FieldMemOperand(object_prototype, HeapObject::kMapOffset)); | 1601 __ Ldr(object_map, FieldMemOperand(object, HeapObject::kMapOffset)); |
1599 __ B(ne, &loop); | 1602 __ B(ne, &loop); |
1600 __ LoadRoot(x0, Heap::kFalseValueRootIndex); | 1603 __ LoadRoot(result, Heap::kFalseValueRootIndex); |
1601 __ Bind(&done); | 1604 __ Bind(&done); |
1602 __ StoreRoot(x0, Heap::kInstanceofCacheAnswerRootIndex); | 1605 __ StoreRoot(result, Heap::kInstanceofCacheAnswerRootIndex); |
1603 __ Ret(); | 1606 __ Ret(); |
1604 | 1607 |
1605 // Slow-case: Call the runtime function. | 1608 // Proxy-case: Call the %HasInPrototypeChain runtime function. |
| 1609 __ Bind(&proxy_case); |
| 1610 __ Push(object, function_prototype); |
| 1611 // Invalidate the instanceof cache. |
| 1612 __ Move(scratch, Smi::FromInt(0)); |
| 1613 __ StoreRoot(scratch, Heap::kInstanceofCacheFunctionRootIndex); |
| 1614 __ TailCallRuntime(Runtime::kHasInPrototypeChain, 2, 1); |
| 1615 |
| 1616 // Slow-case: Call the %InstanceOf runtime function. |
1606 __ bind(&slow_case); | 1617 __ bind(&slow_case); |
1607 __ Push(object, function); | 1618 __ Push(object, function); |
1608 __ TailCallRuntime(Runtime::kInstanceOf, 2, 1); | 1619 __ TailCallRuntime(Runtime::kInstanceOf, 2, 1); |
1609 } | 1620 } |
1610 | 1621 |
1611 | 1622 |
1612 void ArgumentsAccessStub::GenerateReadElement(MacroAssembler* masm) { | 1623 void ArgumentsAccessStub::GenerateReadElement(MacroAssembler* masm) { |
1613 Register arg_count = ArgumentsAccessReadDescriptor::parameter_count(); | 1624 Register arg_count = ArgumentsAccessReadDescriptor::parameter_count(); |
1614 Register key = ArgumentsAccessReadDescriptor::index(); | 1625 Register key = ArgumentsAccessReadDescriptor::index(); |
1615 DCHECK(arg_count.is(x0)); | 1626 DCHECK(arg_count.is(x0)); |
(...skipping 4200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5816 MemOperand(fp, 6 * kPointerSize), NULL); | 5827 MemOperand(fp, 6 * kPointerSize), NULL); |
5817 } | 5828 } |
5818 | 5829 |
5819 | 5830 |
5820 #undef __ | 5831 #undef __ |
5821 | 5832 |
5822 } // namespace internal | 5833 } // namespace internal |
5823 } // namespace v8 | 5834 } // namespace v8 |
5824 | 5835 |
5825 #endif // V8_TARGET_ARCH_ARM64 | 5836 #endif // V8_TARGET_ARCH_ARM64 |
OLD | NEW |