Index: src/interpreter/bytecode-array-builder.cc |
diff --git a/src/interpreter/bytecode-array-builder.cc b/src/interpreter/bytecode-array-builder.cc |
index 77b3d7e93cc60a4501a4918c1d569598ca31cf51..13899b1e153f892d3d7c6eba0c7afc14c27672f9 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) { |
+ OutputLdaCurrentContextSlot(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) { |
+ OutputStaCurrentContextSlot(slot_index); |
+ } else { |
+ OutputStaContextSlot(context, slot_index, depth); |
+ } |
return *this; |
} |