Index: src/interpreter/bytecode-array-builder.cc |
diff --git a/src/interpreter/bytecode-array-builder.cc b/src/interpreter/bytecode-array-builder.cc |
index 7f22ccbb4b7eb00efcecdecc0b6e0f38c59bf9fc..33c8317519df8ca5ae42018e653e803fd3cd58a0 100644 |
--- a/src/interpreter/bytecode-array-builder.cc |
+++ b/src/interpreter/bytecode-array-builder.cc |
@@ -461,14 +461,22 @@ BytecodeArrayBuilder& BytecodeArrayBuilder::StoreGlobal( |
BytecodeArrayBuilder& BytecodeArrayBuilder::LoadContextSlot(Register context, |
int slot_index, |
int depth) { |
- OutputLdaContextSlot(context, slot_index, depth); |
+ if (context.is_current_context() && depth == 0) { |
+ OutputLdaLocalContextSlot(slot_index); |
+ } else { |
+ OutputLdaContextSlot(context, slot_index, depth); |
+ } |
return *this; |
} |
BytecodeArrayBuilder& BytecodeArrayBuilder::StoreContextSlot(Register context, |
int slot_index, |
int depth) { |
- OutputStaContextSlot(context, slot_index, depth); |
+ if (context.is_current_context() && depth == 0) { |
+ OutputStaLocalContextSlot(slot_index); |
+ } else { |
+ OutputStaContextSlot(context, slot_index, depth); |
+ } |
return *this; |
} |