Index: src/arm/macro-assembler-arm.cc |
diff --git a/src/arm/macro-assembler-arm.cc b/src/arm/macro-assembler-arm.cc |
index 57ee26cd79c3b7414849ca14cac6b6c68ec1998a..e56ac6e98816fddf7a8119ba312a0ee7eaa7b5f0 100644 |
--- a/src/arm/macro-assembler-arm.cc |
+++ b/src/arm/macro-assembler-arm.cc |
@@ -1171,6 +1171,26 @@ void MacroAssembler::Abort(const char* msg) { |
} |
+void MacroAssembler::LoadContext(Register dst, int context_chain_length) { |
+ if (context_chain_length > 0) { |
+ // Move up the chain of contexts to the context containing the slot. |
+ ldr(dst, MemOperand(cp, Context::SlotOffset(Context::CLOSURE_INDEX))); |
+ // Load the function context (which is the incoming, outer context). |
+ ldr(dst, FieldMemOperand(dst, JSFunction::kContextOffset)); |
+ for (int i = 1; i < context_chain_length; i++) { |
+ ldr(dst, MemOperand(dst, Context::SlotOffset(Context::CLOSURE_INDEX))); |
+ ldr(dst, FieldMemOperand(dst, JSFunction::kContextOffset)); |
+ } |
+ // The context may be an intermediate context, not a function context. |
+ ldr(dst, MemOperand(dst, Context::SlotOffset(Context::FCONTEXT_INDEX))); |
+ } else { // Slot is in the current function context. |
+ // The context may be an intermediate context, not a function context. |
+ ldr(dst, MemOperand(cp, Context::SlotOffset(Context::FCONTEXT_INDEX))); |
+ } |
+} |
+ |
+ |
+ |
#ifdef ENABLE_DEBUGGER_SUPPORT |
CodePatcher::CodePatcher(byte* address, int instructions) |
: address_(address), |