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

Unified Diff: src/hydrogen.cc

Issue 1179893002: Add script context with context-allocated "const this" (Closed) Base URL: https://chromium.googlesource.com/v8/v8@master
Patch Set: arm64 fixups Created 5 years, 6 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
Index: src/hydrogen.cc
diff --git a/src/hydrogen.cc b/src/hydrogen.cc
index 810a8b92210d4bb2389d024490c65b0b88e22eb1..672ff51aa3f2bbcd74138f99fad982f0741d338a 100644
--- a/src/hydrogen.cc
+++ b/src/hydrogen.cc
@@ -10197,12 +10197,14 @@ void HOptimizedGraphBuilder::VisitDelete(UnaryOperation* expr) {
if (var->IsUnallocated()) {
Bailout(kDeleteWithGlobalVariable);
} else if (var->IsStackAllocated() || var->IsContextSlot()) {
- // Result of deleting non-global variables is false. 'this' is not
- // really a variable, though we implement it as one. The
- // subexpression does not have side effects.
- HValue* value = var->is_this()
- ? graph()->GetConstantTrue()
- : graph()->GetConstantFalse();
+ // Result of deleting non-global variables is false. 'this' is not really
+ // a variable, though we implement it as one. The subexpression does not
+ // have side effects. (It could be that the "this" variable has DYNAMIC
+ // resolution though so we haven't been able to map it to Variable::THIS,
+ // but regardless if its name is "this" then it is "this".)
+ bool is_this = *var->name() == *isolate()->factory()->this_string();
+ HValue* value =
+ is_this ? graph()->GetConstantTrue() : graph()->GetConstantFalse();
return ast_context()->ReturnValue(value);
} else {
Bailout(kDeleteWithNonGlobalVariable);

Powered by Google App Engine
This is Rietveld 408576698