| Index: src/hydrogen.cc
|
| diff --git a/src/hydrogen.cc b/src/hydrogen.cc
|
| index 153bd9aae9cb02a5121a45ce991363a50f109f94..7705d0059936ba7e46c1535fc8eda556e0604a47 100644
|
| --- a/src/hydrogen.cc
|
| +++ b/src/hydrogen.cc
|
| @@ -2930,6 +2930,27 @@ 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);
|
| + Handle<JSFunction> closure = info->closure();
|
| + Context* context = closure->context();
|
| + for (int i = 0; i < context_chain_length; i++) {
|
| + context = context->closure()->context();
|
| + }
|
| + // 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(Handle<Context>(context), slot->index());
|
| + ast_context()->ReturnInstruction(instr, expr->id());
|
| } else if (variable->is_global()) {
|
| LookupResult lookup;
|
| LookupGlobalPropertyCell(variable, &lookup, false);
|
| @@ -3441,6 +3462,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, Top(), expr->position(), expr->id());
|
|
|