Index: src/x64/codegen-x64.cc |
diff --git a/src/x64/codegen-x64.cc b/src/x64/codegen-x64.cc |
index 150ed664b0a4b6c300e0551f54c4fa1bdd212d92..c07bcf90447340dddf0f4c08cf47a7251ffbb763 100644 |
--- a/src/x64/codegen-x64.cc |
+++ b/src/x64/codegen-x64.cc |
@@ -7239,8 +7239,8 @@ void CodeGenerator::VisitUnaryOperation(UnaryOperation* node) { |
Variable* variable = node->expression()->AsVariableProxy()->AsVariable(); |
if (variable != NULL) { |
// Delete of an unqualified identifier is disallowed in strict mode |
- // so this code can only be reached in non-strict mode. |
- ASSERT(strict_mode_flag() == kNonStrictMode); |
+ // but "delete this" is. |
+ ASSERT(strict_mode_flag() == kNonStrictMode || variable->is_this()); |
Slot* slot = variable->AsSlot(); |
if (variable->is_global()) { |
LoadGlobal(); |
@@ -7249,7 +7249,6 @@ void CodeGenerator::VisitUnaryOperation(UnaryOperation* node) { |
Result answer = frame_->InvokeBuiltin(Builtins::DELETE, |
CALL_FUNCTION, 3); |
frame_->Push(&answer); |
- return; |
} else if (slot != NULL && slot->type() == Slot::LOOKUP) { |
// Call the runtime to delete from the context holding the named |
@@ -7260,13 +7259,11 @@ void CodeGenerator::VisitUnaryOperation(UnaryOperation* node) { |
frame_->EmitPush(variable->name()); |
Result answer = frame_->CallRuntime(Runtime::kDeleteContextSlot, 2); |
frame_->Push(&answer); |
- return; |
+ } else { |
+ // Default: Result of deleting non-global, not dynamically |
+ // introduced variables is false. |
+ frame_->Push(Factory::false_value()); |
} |
- |
- // Default: Result of deleting non-global, not dynamically |
- // introduced variables is false. |
- frame_->Push(Factory::false_value()); |
- |
} else { |
// Default: Result of deleting expressions is true. |
Load(node->expression()); // may have side-effects |