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/arm64/frames-arm64.h" | 7 #include "src/arm64/frames-arm64.h" |
8 #include "src/base/bits.h" | 8 #include "src/base/bits.h" |
9 #include "src/base/division-by-constant.h" | 9 #include "src/base/division-by-constant.h" |
10 #include "src/bootstrapper.h" | 10 #include "src/bootstrapper.h" |
(...skipping 1669 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1680 | 1680 |
1681 | 1681 |
1682 void MacroAssembler::JumpToExternalReference(const ExternalReference& builtin) { | 1682 void MacroAssembler::JumpToExternalReference(const ExternalReference& builtin) { |
1683 Mov(x1, builtin); | 1683 Mov(x1, builtin); |
1684 CEntryStub stub(isolate(), 1); | 1684 CEntryStub stub(isolate(), 1); |
1685 Jump(stub.GetCode(), RelocInfo::CODE_TARGET); | 1685 Jump(stub.GetCode(), RelocInfo::CODE_TARGET); |
1686 } | 1686 } |
1687 | 1687 |
1688 | 1688 |
1689 void MacroAssembler::GetBuiltinFunction(Register target, | 1689 void MacroAssembler::GetBuiltinFunction(Register target, |
1690 Builtins::JavaScript id) { | 1690 int native_context_index) { |
1691 // Load the builtins object into target register. | 1691 // Load the builtins object into target register. |
1692 Ldr(target, GlobalObjectMemOperand()); | 1692 Ldr(target, GlobalObjectMemOperand()); |
1693 Ldr(target, FieldMemOperand(target, GlobalObject::kBuiltinsOffset)); | 1693 Ldr(target, FieldMemOperand(target, GlobalObject::kNativeContextOffset)); |
1694 // Load the JavaScript builtin function from the builtins object. | 1694 // Load the JavaScript builtin function from the builtins object. |
1695 Ldr(target, FieldMemOperand(target, | 1695 Ldr(target, ContextMemOperand(target, native_context_index)); |
1696 JSBuiltinsObject::OffsetOfFunctionWithId(id))); | |
1697 } | 1696 } |
1698 | 1697 |
1699 | 1698 |
1700 void MacroAssembler::GetBuiltinEntry(Register target, | 1699 void MacroAssembler::GetBuiltinEntry(Register target, Register function, |
1701 Register function, | 1700 int native_context_index) { |
1702 Builtins::JavaScript id) { | |
1703 DCHECK(!AreAliased(target, function)); | 1701 DCHECK(!AreAliased(target, function)); |
1704 GetBuiltinFunction(function, id); | 1702 GetBuiltinFunction(function, native_context_index); |
1705 // Load the code entry point from the builtins object. | 1703 // Load the code entry point from the builtins object. |
1706 Ldr(target, FieldMemOperand(function, JSFunction::kCodeEntryOffset)); | 1704 Ldr(target, FieldMemOperand(function, JSFunction::kCodeEntryOffset)); |
1707 } | 1705 } |
1708 | 1706 |
1709 | 1707 |
1710 void MacroAssembler::InvokeBuiltin(Builtins::JavaScript id, | 1708 void MacroAssembler::InvokeBuiltin(int native_context_index, InvokeFlag flag, |
1711 InvokeFlag flag, | |
1712 const CallWrapper& call_wrapper) { | 1709 const CallWrapper& call_wrapper) { |
1713 ASM_LOCATION("MacroAssembler::InvokeBuiltin"); | 1710 ASM_LOCATION("MacroAssembler::InvokeBuiltin"); |
1714 // You can't call a builtin without a valid frame. | 1711 // You can't call a builtin without a valid frame. |
1715 DCHECK(flag == JUMP_FUNCTION || has_frame()); | 1712 DCHECK(flag == JUMP_FUNCTION || has_frame()); |
1716 | 1713 |
1717 // Get the builtin entry in x2 and setup the function object in x1. | 1714 // Get the builtin entry in x2 and setup the function object in x1. |
1718 GetBuiltinEntry(x2, x1, id); | 1715 GetBuiltinEntry(x2, x1, native_context_index); |
1719 if (flag == CALL_FUNCTION) { | 1716 if (flag == CALL_FUNCTION) { |
1720 call_wrapper.BeforeCall(CallSize(x2)); | 1717 call_wrapper.BeforeCall(CallSize(x2)); |
1721 Call(x2); | 1718 Call(x2); |
1722 call_wrapper.AfterCall(); | 1719 call_wrapper.AfterCall(); |
1723 } else { | 1720 } else { |
1724 DCHECK(flag == JUMP_FUNCTION); | 1721 DCHECK(flag == JUMP_FUNCTION); |
1725 Jump(x2); | 1722 Jump(x2); |
1726 } | 1723 } |
1727 } | 1724 } |
1728 | 1725 |
(...skipping 3374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5103 } | 5100 } |
5104 | 5101 |
5105 | 5102 |
5106 #undef __ | 5103 #undef __ |
5107 | 5104 |
5108 | 5105 |
5109 } // namespace internal | 5106 } // namespace internal |
5110 } // namespace v8 | 5107 } // namespace v8 |
5111 | 5108 |
5112 #endif // V8_TARGET_ARCH_ARM64 | 5109 #endif // V8_TARGET_ARCH_ARM64 |
OLD | NEW |