Index: src/x64/macro-assembler-x64.cc |
diff --git a/src/x64/macro-assembler-x64.cc b/src/x64/macro-assembler-x64.cc |
index 2781a8489885e43e72a572b29a4efda3a5c4272f..70d89c0a5ceb53bb8572f994ad9f5730f0045508 100644 |
--- a/src/x64/macro-assembler-x64.cc |
+++ b/src/x64/macro-assembler-x64.cc |
@@ -445,16 +445,18 @@ void MacroAssembler::InvokeBuiltin(Builtins::JavaScript id, InvokeFlag flag) { |
void MacroAssembler::GetBuiltinEntry(Register target, Builtins::JavaScript id) { |
+ ASSERT(!target.is(rdi)); |
+ |
+ // Load the builtins object into target register. |
+ movq(target, Operand(rsi, Context::SlotOffset(Context::GLOBAL_INDEX))); |
+ movq(target, FieldOperand(target, GlobalObject::kBuiltinsOffset)); |
+ |
// Load the JavaScript builtin function from the builtins object. |
- movq(rdi, Operand(rsi, Context::SlotOffset(Context::GLOBAL_INDEX))); |
- movq(rdi, FieldOperand(rdi, GlobalObject::kBuiltinsOffset)); |
- int builtins_offset = |
- JSBuiltinsObject::kJSBuiltinsOffset + (id * kPointerSize); |
- movq(rdi, FieldOperand(rdi, builtins_offset)); |
- // Load the code entry point from the function into the target register. |
- movq(target, FieldOperand(rdi, JSFunction::kSharedFunctionInfoOffset)); |
- movq(target, FieldOperand(target, SharedFunctionInfo::kCodeOffset)); |
- addq(target, Immediate(Code::kHeaderSize - kHeapObjectTag)); |
+ movq(rdi, FieldOperand(target, JSBuiltinsObject::OffsetOfFunctionWithId(id))); |
+ |
+ // Load the code entry point from the builtins object. |
+ movq(target, FieldOperand(target, JSBuiltinsObject::OffsetOfCodeWithId(id))); |
+ lea(target, FieldOperand(target, Code::kHeaderSize)); |
} |