| 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 3693 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3704 context()->Plug(eax); | 3704 context()->Plug(eax); |
| 3705 } | 3705 } |
| 3706 | 3706 |
| 3707 | 3707 |
| 3708 void FullCodeGenerator::VisitUnaryOperation(UnaryOperation* expr) { | 3708 void FullCodeGenerator::VisitUnaryOperation(UnaryOperation* expr) { |
| 3709 switch (expr->op()) { | 3709 switch (expr->op()) { |
| 3710 case Token::DELETE: { | 3710 case Token::DELETE: { |
| 3711 Comment cmnt(masm_, "[ UnaryOperation (DELETE)"); | 3711 Comment cmnt(masm_, "[ UnaryOperation (DELETE)"); |
| 3712 Property* prop = expr->expression()->AsProperty(); | 3712 Property* prop = expr->expression()->AsProperty(); |
| 3713 Variable* var = expr->expression()->AsVariableProxy()->AsVariable(); | 3713 Variable* var = expr->expression()->AsVariableProxy()->AsVariable(); |
| 3714 if (prop == NULL && var == NULL) { | 3714 |
| 3715 // Result of deleting non-property, non-variable reference is true. | 3715 if (prop != NULL) { |
| 3716 // The subexpression may have side effects. | |
| 3717 VisitForEffect(expr->expression()); | |
| 3718 context()->Plug(true); | |
| 3719 } else if (var != NULL && | |
| 3720 !var->is_global() && | |
| 3721 var->AsSlot() != NULL && | |
| 3722 var->AsSlot()->type() != Slot::LOOKUP) { | |
| 3723 // Result of deleting non-global, non-dynamic variables is false. | |
| 3724 // The subexpression does not have side effects. | |
| 3725 context()->Plug(false); | |
| 3726 } else if (prop != NULL) { | |
| 3727 if (prop->is_synthetic()) { | 3716 if (prop->is_synthetic()) { |
| 3728 // Result of deleting parameters is false, even when they rewrite | 3717 // Result of deleting parameters is false, even when they rewrite |
| 3729 // to accesses on the arguments object. | 3718 // to accesses on the arguments object. |
| 3730 context()->Plug(false); | 3719 context()->Plug(false); |
| 3731 } else { | 3720 } else { |
| 3732 VisitForStackValue(prop->obj()); | 3721 VisitForStackValue(prop->obj()); |
| 3733 VisitForStackValue(prop->key()); | 3722 VisitForStackValue(prop->key()); |
| 3734 __ InvokeBuiltin(Builtins::DELETE, CALL_FUNCTION); | 3723 __ InvokeBuiltin(Builtins::DELETE, CALL_FUNCTION); |
| 3735 context()->Plug(eax); | 3724 context()->Plug(eax); |
| 3736 } | 3725 } |
| 3737 } else if (var->is_global()) { | 3726 } else if (var != NULL) { |
| 3738 __ push(GlobalObjectOperand()); | 3727 if (var->is_global()) { |
| 3739 __ push(Immediate(var->name())); | 3728 __ push(GlobalObjectOperand()); |
| 3740 __ InvokeBuiltin(Builtins::DELETE, CALL_FUNCTION); | 3729 __ push(Immediate(var->name())); |
| 3741 context()->Plug(eax); | 3730 __ InvokeBuiltin(Builtins::DELETE, CALL_FUNCTION); |
| 3731 context()->Plug(eax); |
| 3732 } else if (var->AsSlot() != NULL && |
| 3733 var->AsSlot()->type() != Slot::LOOKUP) { |
| 3734 // Result of deleting non-global, non-dynamic variables is false. |
| 3735 // The subexpression does not have side effects. |
| 3736 context()->Plug(false); |
| 3737 } else { |
| 3738 // Non-global variable. Call the runtime to try to delete from the |
| 3739 // context where the variable was introduced. |
| 3740 __ push(context_register()); |
| 3741 __ push(Immediate(var->name())); |
| 3742 __ CallRuntime(Runtime::kDeleteContextSlot, 2); |
| 3743 context()->Plug(eax); |
| 3744 } |
| 3742 } else { | 3745 } else { |
| 3743 // Non-global variable. Call the runtime to try to delete from the | 3746 // Result of deleting non-property, non-variable reference is true. |
| 3744 // context where the variable was introduced. | 3747 // The subexpression may have side effects. |
| 3745 __ push(context_register()); | 3748 VisitForEffect(expr->expression()); |
| 3746 __ push(Immediate(var->name())); | 3749 context()->Plug(true); |
| 3747 __ CallRuntime(Runtime::kDeleteContextSlot, 2); | |
| 3748 context()->Plug(eax); | |
| 3749 } | 3750 } |
| 3750 break; | 3751 break; |
| 3751 } | 3752 } |
| 3752 | 3753 |
| 3753 case Token::VOID: { | 3754 case Token::VOID: { |
| 3754 Comment cmnt(masm_, "[ UnaryOperation (VOID)"); | 3755 Comment cmnt(masm_, "[ UnaryOperation (VOID)"); |
| 3755 VisitForEffect(expr->expression()); | 3756 VisitForEffect(expr->expression()); |
| 3756 context()->Plug(Factory::undefined_value()); | 3757 context()->Plug(Factory::undefined_value()); |
| 3757 break; | 3758 break; |
| 3758 } | 3759 } |
| (...skipping 648 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4407 // And return. | 4408 // And return. |
| 4408 __ ret(0); | 4409 __ ret(0); |
| 4409 } | 4410 } |
| 4410 | 4411 |
| 4411 | 4412 |
| 4412 #undef __ | 4413 #undef __ |
| 4413 | 4414 |
| 4414 } } // namespace v8::internal | 4415 } } // namespace v8::internal |
| 4415 | 4416 |
| 4416 #endif // V8_TARGET_ARCH_IA32 | 4417 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |