OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 4635 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4646 VISIT_FOR_EFFECT(expr->expression()); | 4646 VISIT_FOR_EFFECT(expr->expression()); |
4647 ast_context()->ReturnValue(graph()->GetConstantTrue()); | 4647 ast_context()->ReturnValue(graph()->GetConstantTrue()); |
4648 } else if (var != NULL && | 4648 } else if (var != NULL && |
4649 !var->is_global() && | 4649 !var->is_global() && |
4650 var->AsSlot() != NULL && | 4650 var->AsSlot() != NULL && |
4651 var->AsSlot()->type() != Slot::LOOKUP) { | 4651 var->AsSlot()->type() != Slot::LOOKUP) { |
4652 // Result of deleting non-global, non-dynamic variables is false. | 4652 // Result of deleting non-global, non-dynamic variables is false. |
4653 // The subexpression does not have side effects. | 4653 // The subexpression does not have side effects. |
4654 ast_context()->ReturnValue(graph()->GetConstantFalse()); | 4654 ast_context()->ReturnValue(graph()->GetConstantFalse()); |
4655 } else if (prop != NULL) { | 4655 } else if (prop != NULL) { |
4656 VISIT_FOR_VALUE(prop->obj()); | 4656 if (prop->is_synthetic()) { |
4657 VISIT_FOR_VALUE(prop->key()); | 4657 // Result of deleting parameters is false, even when they rewrite |
4658 HValue* key = Pop(); | 4658 // to accesses on the arguments object. |
4659 HValue* obj = Pop(); | 4659 ast_context()->ReturnValue(graph()->GetConstantFalse()); |
4660 ast_context()->ReturnInstruction(new HDeleteProperty(obj, key), | 4660 } else { |
4661 expr->id()); | 4661 VISIT_FOR_VALUE(prop->obj()); |
| 4662 VISIT_FOR_VALUE(prop->key()); |
| 4663 HValue* key = Pop(); |
| 4664 HValue* obj = Pop(); |
| 4665 HDeleteProperty* instr = new HDeleteProperty(obj, key); |
| 4666 ast_context()->ReturnInstruction(instr, expr->id()); |
| 4667 } |
4662 } else if (var->is_global()) { | 4668 } else if (var->is_global()) { |
4663 BAILOUT("delete with global variable"); | 4669 BAILOUT("delete with global variable"); |
4664 } else { | 4670 } else { |
4665 BAILOUT("delete with non-global variable"); | 4671 BAILOUT("delete with non-global variable"); |
4666 } | 4672 } |
4667 } else if (op == Token::NOT) { | 4673 } else if (op == Token::NOT) { |
4668 if (ast_context()->IsTest()) { | 4674 if (ast_context()->IsTest()) { |
4669 TestContext* context = TestContext::cast(ast_context()); | 4675 TestContext* context = TestContext::cast(ast_context()); |
4670 VisitForControl(expr->expression(), | 4676 VisitForControl(expr->expression(), |
4671 context->if_false(), | 4677 context->if_false(), |
(...skipping 1334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6006 } | 6012 } |
6007 } | 6013 } |
6008 | 6014 |
6009 #ifdef DEBUG | 6015 #ifdef DEBUG |
6010 if (graph_ != NULL) graph_->Verify(); | 6016 if (graph_ != NULL) graph_->Verify(); |
6011 if (allocator_ != NULL) allocator_->Verify(); | 6017 if (allocator_ != NULL) allocator_->Verify(); |
6012 #endif | 6018 #endif |
6013 } | 6019 } |
6014 | 6020 |
6015 } } // namespace v8::internal | 6021 } } // namespace v8::internal |
OLD | NEW |