Index: src/ia32/macro-assembler-ia32.cc |
diff --git a/src/ia32/macro-assembler-ia32.cc b/src/ia32/macro-assembler-ia32.cc |
index 79b40641b29783a33519765555f59cbd2f5acf3c..ff48d54f15096b3bc488c69850493f0977fc815d 100644 |
--- a/src/ia32/macro-assembler-ia32.cc |
+++ b/src/ia32/macro-assembler-ia32.cc |
@@ -1369,6 +1369,30 @@ void MacroAssembler::LoadContext(Register dst, int context_chain_length) { |
} |
+void MacroAssembler::LoadGlobalFunction(int index, Register function) { |
+ // Load the global or builtins object from the current context. |
+ mov(function, Operand(esi, Context::SlotOffset(Context::GLOBAL_INDEX))); |
+ // Load the global context from the global or builtins object. |
+ mov(function, FieldOperand(function, GlobalObject::kGlobalContextOffset)); |
+ // Load the function from the global context. |
+ mov(function, Operand(function, Context::SlotOffset(index))); |
+} |
+ |
+ |
+void MacroAssembler::LoadGlobalFunctionInitialMap(Register function, |
+ Register map) { |
+ // Load the initial map. The global functions all have initial maps. |
+ mov(map, FieldOperand(function, JSFunction::kPrototypeOrInitialMapOffset)); |
+ if (FLAG_debug_code) { |
+ Label ok, fail; |
+ CheckMap(map, Factory::meta_map(), &fail, false); |
+ jmp(&ok); |
+ bind(&fail); |
+ Abort("Global functions must have initial map"); |
+ bind(&ok); |
+ } |
+} |
+ |
void MacroAssembler::Ret() { |
ret(0); |