Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(440)

Unified Diff: src/hydrogen.cc

Issue 5753005: Make closures optimizable by Crankshaft compiler. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Minor fix in hash function Created 10 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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,
« no previous file with comments | « src/flag-definitions.h ('k') | src/hydrogen-instructions.h » ('j') | src/hydrogen-instructions.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698