Index: src/arm64/macro-assembler-arm64.cc |
diff --git a/src/arm64/macro-assembler-arm64.cc b/src/arm64/macro-assembler-arm64.cc |
index ae570a2c7ee7b2dc232cbbcc7d1d1f98e56e8c18..51ff64babb8406d4b0a4b7c1ad3bb961d82b8909 100644 |
--- a/src/arm64/macro-assembler-arm64.cc |
+++ b/src/arm64/macro-assembler-arm64.cc |
@@ -1701,6 +1701,25 @@ |
} |
+void MacroAssembler::GetBuiltinFunction(Register target, |
+ int native_context_index) { |
+ // Load the builtins object into target register. |
+ Ldr(target, GlobalObjectMemOperand()); |
+ Ldr(target, FieldMemOperand(target, JSGlobalObject::kNativeContextOffset)); |
+ // Load the JavaScript builtin function from the builtins object. |
+ Ldr(target, ContextMemOperand(target, native_context_index)); |
+} |
+ |
+ |
+void MacroAssembler::GetBuiltinEntry(Register target, Register function, |
+ int native_context_index) { |
+ DCHECK(!AreAliased(target, function)); |
+ GetBuiltinFunction(function, native_context_index); |
+ // Load the code entry point from the builtins object. |
+ Ldr(target, FieldMemOperand(function, JSFunction::kCodeEntryOffset)); |
+} |
+ |
+ |
void MacroAssembler::InvokeBuiltin(int native_context_index, InvokeFlag flag, |
const CallWrapper& call_wrapper) { |
ASM_LOCATION("MacroAssembler::InvokeBuiltin"); |
@@ -1708,8 +1727,7 @@ |
DCHECK(flag == JUMP_FUNCTION || has_frame()); |
// Get the builtin entry in x2 and setup the function object in x1. |
- LoadNativeContextSlot(native_context_index, x1); |
- Ldr(x2, FieldMemOperand(x1, JSFunction::kCodeEntryOffset)); |
+ GetBuiltinEntry(x2, x1, native_context_index); |
if (flag == CALL_FUNCTION) { |
call_wrapper.BeforeCall(CallSize(x2)); |
Call(x2); |
@@ -2871,6 +2889,12 @@ |
// cannot be allowed to destroy the context in cp). |
Mov(dst, cp); |
} |
+} |
+ |
+ |
+void MacroAssembler::LoadGlobalProxy(Register dst) { |
+ Ldr(dst, GlobalObjectMemOperand()); |
+ Ldr(dst, FieldMemOperand(dst, JSGlobalObject::kGlobalProxyOffset)); |
} |
@@ -3647,7 +3671,11 @@ |
#endif |
// Load the native context of the current context. |
- Ldr(scratch1, ContextMemOperand(scratch1, Context::NATIVE_CONTEXT_INDEX)); |
+ int offset = |
+ Context::kHeaderSize + Context::GLOBAL_OBJECT_INDEX * kPointerSize; |
+ Ldr(scratch1, FieldMemOperand(scratch1, offset)); |
+ Ldr(scratch1, |
+ FieldMemOperand(scratch1, JSGlobalObject::kNativeContextOffset)); |
// Check the context is a native context. |
if (emit_debug_code()) { |
@@ -4479,8 +4507,13 @@ |
Register scratch1, |
Register scratch2, |
Label* no_map_match) { |
+ // Load the global or builtins object from the current context. |
+ Ldr(scratch1, GlobalObjectMemOperand()); |
+ Ldr(scratch1, |
+ FieldMemOperand(scratch1, JSGlobalObject::kNativeContextOffset)); |
+ |
// Check that the function's map is the same as the expected cached map. |
- LoadNativeContextSlot(Context::JS_ARRAY_MAPS_INDEX, scratch1); |
+ Ldr(scratch1, ContextMemOperand(scratch1, Context::JS_ARRAY_MAPS_INDEX)); |
int offset = (expected_kind * kPointerSize) + FixedArrayBase::kHeaderSize; |
Ldr(scratch2, FieldMemOperand(scratch1, offset)); |
Cmp(map_in_out, scratch2); |
@@ -4492,9 +4525,14 @@ |
} |
-void MacroAssembler::LoadNativeContextSlot(int index, Register dst) { |
- Ldr(dst, NativeContextMemOperand()); |
- Ldr(dst, ContextMemOperand(dst, index)); |
+void MacroAssembler::LoadGlobalFunction(int index, Register function) { |
+ // Load the global or builtins object from the current context. |
+ Ldr(function, GlobalObjectMemOperand()); |
+ // Load the native context from the global or builtins object. |
+ Ldr(function, |
+ FieldMemOperand(function, JSGlobalObject::kNativeContextOffset)); |
+ // Load the function from the native context. |
+ Ldr(function, ContextMemOperand(function, index)); |
} |