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