| Index: src/hydrogen.cc
|
| diff --git a/src/hydrogen.cc b/src/hydrogen.cc
|
| index 05a59d26d3dc139ae3ec5aded1c79fb3bda7cfc4..cade33e97f23ce4936e32c507b99d5b5dec00cec 100644
|
| --- a/src/hydrogen.cc
|
| +++ b/src/hydrogen.cc
|
| @@ -2930,6 +2930,22 @@ void HGraphBuilder::VisitVariableProxy(VariableProxy* expr) {
|
| BAILOUT("unsupported context for arguments object");
|
| }
|
| ast_context()->ReturnValue(environment()->Lookup(variable));
|
| + } else if (variable->AsSlot() != NULL &&
|
| + variable->AsSlot()->type() == Slot::CONTEXT) {
|
| + if (variable->mode() == Variable::CONST) {
|
| + BAILOUT("reference to const context slot");
|
| + }
|
| + Slot* slot = variable->AsSlot();
|
| + CompilationInfo* info = graph()->info();
|
| + int context_chain_length = info->function()->scope()->
|
| + ContextChainLength(slot->var()->scope());
|
| + ASSERT(context_chain_length >= 0);
|
| + // TODO(antonm): if slot's value is not modified by closures, instead
|
| + // of reading it out of context, we could just embed the value as
|
| + // a constant.
|
| + HLoadContextSlot* instr =
|
| + new HLoadContextSlot(context_chain_length, slot->index());
|
| + ast_context()->ReturnInstruction(instr, expr->id());
|
| } else if (variable->is_global()) {
|
| LookupResult lookup;
|
| LookupGlobalPropertyCell(variable, &lookup, false);
|
| @@ -3444,6 +3460,9 @@ void HGraphBuilder::VisitAssignment(Assignment* expr) {
|
| if (proxy->IsArguments()) BAILOUT("assignment to arguments");
|
|
|
| // Handle the assignment.
|
| + if (var->AsSlot() != NULL && var->AsSlot()->type() == Slot::CONTEXT) {
|
| + BAILOUT("context slot assignment");
|
| + }
|
| if (var->is_global()) {
|
| VISIT_FOR_VALUE(expr->value());
|
| HandleGlobalVariableAssignment(var,
|
|
|