| Index: src/x64/macro-assembler-x64.cc
|
| diff --git a/src/x64/macro-assembler-x64.cc b/src/x64/macro-assembler-x64.cc
|
| index 8b93d24c924fb98a5e6d15089029e7462ada6173..2729ca52d53135e1bcb2c83a0d4a745b81786837 100644
|
| --- a/src/x64/macro-assembler-x64.cc
|
| +++ b/src/x64/macro-assembler-x64.cc
|
| @@ -708,8 +708,17 @@
|
| // arguments match the expected number of arguments. Fake a
|
| // parameter count to avoid emitting code to do the check.
|
| ParameterCount expected(0);
|
| - LoadNativeContextSlot(native_context_index, rdi);
|
| + GetBuiltinFunction(rdi, native_context_index);
|
| InvokeFunctionCode(rdi, no_reg, expected, expected, flag, call_wrapper);
|
| +}
|
| +
|
| +
|
| +void MacroAssembler::GetBuiltinFunction(Register target,
|
| + int native_context_index) {
|
| + // Load the builtins object into target register.
|
| + movp(target, Operand(rsi, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX)));
|
| + movp(target, FieldOperand(target, JSGlobalObject::kNativeContextOffset));
|
| + movp(target, ContextOperand(target, native_context_index));
|
| }
|
|
|
|
|
| @@ -4404,7 +4413,10 @@
|
| Check(not_equal, kWeShouldNotHaveAnEmptyLexicalContext);
|
| }
|
| // Load the native context of the current context.
|
| - movp(scratch, ContextOperand(scratch, Context::NATIVE_CONTEXT_INDEX));
|
| + int offset =
|
| + Context::kHeaderSize + Context::GLOBAL_OBJECT_INDEX * kPointerSize;
|
| + movp(scratch, FieldOperand(scratch, offset));
|
| + movp(scratch, FieldOperand(scratch, JSGlobalObject::kNativeContextOffset));
|
|
|
| // Check the context is a native context.
|
| if (emit_debug_code()) {
|
| @@ -5060,14 +5072,26 @@
|
| }
|
|
|
|
|
| +void MacroAssembler::LoadGlobalProxy(Register dst) {
|
| + movp(dst, GlobalObjectOperand());
|
| + movp(dst, FieldOperand(dst, JSGlobalObject::kGlobalProxyOffset));
|
| +}
|
| +
|
| +
|
| void MacroAssembler::LoadTransitionedArrayMapConditional(
|
| ElementsKind expected_kind,
|
| ElementsKind transitioned_kind,
|
| Register map_in_out,
|
| Register scratch,
|
| Label* no_map_match) {
|
| + // Load the global or builtins object from the current context.
|
| + movp(scratch,
|
| + Operand(rsi, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX)));
|
| + movp(scratch, FieldOperand(scratch, JSGlobalObject::kNativeContextOffset));
|
| +
|
| // Check that the function's map is the same as the expected cached map.
|
| - LoadNativeContextSlot(Context::JS_ARRAY_MAPS_INDEX, scratch);
|
| + movp(scratch, Operand(scratch,
|
| + Context::SlotOffset(Context::JS_ARRAY_MAPS_INDEX)));
|
|
|
| int offset = expected_kind * kPointerSize +
|
| FixedArrayBase::kHeaderSize;
|
| @@ -5087,10 +5111,14 @@
|
| static const int kRegisterPassedArguments = 6;
|
| #endif
|
|
|
| -
|
| -void MacroAssembler::LoadNativeContextSlot(int index, Register dst) {
|
| - movp(dst, NativeContextOperand());
|
| - movp(dst, ContextOperand(dst, index));
|
| +void MacroAssembler::LoadGlobalFunction(int index, Register function) {
|
| + // Load the global or builtins object from the current context.
|
| + movp(function,
|
| + Operand(rsi, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX)));
|
| + // Load the native context from the global or builtins object.
|
| + movp(function, FieldOperand(function, JSGlobalObject::kNativeContextOffset));
|
| + // Load the function from the native context.
|
| + movp(function, Operand(function, Context::SlotOffset(index)));
|
| }
|
|
|
|
|
|
|