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

Unified Diff: src/hydrogen.cc

Issue 7020021: Disable context-allocated const variables. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 7 months 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/hydrogen.cc
diff --git a/src/hydrogen.cc b/src/hydrogen.cc
index c109133c8faab654988891bd21fd49fea05f6bc5..85fb18765b1e275281f7229a532fc21a9e775099 100644
--- a/src/hydrogen.cc
+++ b/src/hydrogen.cc
@@ -3577,6 +3577,9 @@ void HGraphBuilder::VisitAssignment(Assignment* expr) {
if (expr->op() != Token::INIT_CONST) {
return Bailout("non-initializer assignment to const");
}
+ if (!var->IsStackAllocated()) {
+ return Bailout("assignment to const context slot");
+ }
// We insert a use of the old value to detect unsupported uses of const
// variables (e.g. initialization inside a loop).
HValue* old_value = environment()->Lookup(var);
@@ -3595,7 +3598,8 @@ void HGraphBuilder::VisitAssignment(Assignment* expr) {
Bind(var, value);
ast_context()->ReturnValue(value);
- } else if (var->IsContextSlot() && var->mode() != Variable::CONST) {
+ } else if (var->IsContextSlot()) {
+ ASSERT(var->mode() != Variable::CONST);
CHECK_ALIVE(VisitForValue(expr->value()));
HValue* context = BuildContextChainWalk(var);
int index = var->AsSlot()->index();
@@ -5381,6 +5385,7 @@ void HGraphBuilder::VisitDeclaration(Declaration* decl) {
}
if (decl->mode() == Variable::CONST) {
+ ASSERT(var->IsStackAllocated());
environment()->Bind(var, graph()->GetConstantHole());
}
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698