Index: src/compiler/ast-graph-builder.cc |
diff --git a/src/compiler/ast-graph-builder.cc b/src/compiler/ast-graph-builder.cc |
index 161a33a10d4ac8663c2e57e81b99a737b8468cfc..6cd47ec5dd1cf3db103b6138250767c9e74f7b2f 100644 |
--- a/src/compiler/ast-graph-builder.cc |
+++ b/src/compiler/ast-graph-builder.cc |
@@ -3359,7 +3359,11 @@ Node* AstGraphBuilder::BuildVariableLoad(Variable* variable, |
case VariableLocation::CONTEXT: { |
// Context variable (potentially up the context chain). |
int depth = current_scope()->ContextChainLength(variable->scope()); |
- bool immutable = variable->maybe_assigned() == kNotAssigned; |
+ // TODO(mstarzinger): The {maybe_assigned} flag computed during variable |
+ // resolution is highly inaccurate and cannot be trusted. We are only |
+ // taking this information into account when asm.js compilation is used. |
+ bool immutable = variable->maybe_assigned() == kNotAssigned && |
+ info()->is_function_context_specializing(); |
const Operator* op = |
javascript()->LoadContext(depth, variable->index(), immutable); |
Node* value = NewNode(op, current_context()); |