| 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 3032 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3043 context()->Plug(rax); | 3043 context()->Plug(rax); |
| 3044 } | 3044 } |
| 3045 | 3045 |
| 3046 | 3046 |
| 3047 void FullCodeGenerator::VisitUnaryOperation(UnaryOperation* expr) { | 3047 void FullCodeGenerator::VisitUnaryOperation(UnaryOperation* expr) { |
| 3048 switch (expr->op()) { | 3048 switch (expr->op()) { |
| 3049 case Token::DELETE: { | 3049 case Token::DELETE: { |
| 3050 Comment cmnt(masm_, "[ UnaryOperation (DELETE)"); | 3050 Comment cmnt(masm_, "[ UnaryOperation (DELETE)"); |
| 3051 Property* prop = expr->expression()->AsProperty(); | 3051 Property* prop = expr->expression()->AsProperty(); |
| 3052 Variable* var = expr->expression()->AsVariableProxy()->AsVariable(); | 3052 Variable* var = expr->expression()->AsVariableProxy()->AsVariable(); |
| 3053 if (prop == NULL && var == NULL) { | 3053 |
| 3054 // Result of deleting non-property, non-variable reference is true. | 3054 if (prop != NULL) { |
| 3055 // The subexpression may have side effects. | |
| 3056 VisitForEffect(expr->expression()); | |
| 3057 context()->Plug(true); | |
| 3058 } else if (var != NULL && | |
| 3059 !var->is_global() && | |
| 3060 var->AsSlot() != NULL && | |
| 3061 var->AsSlot()->type() != Slot::LOOKUP) { | |
| 3062 // Result of deleting non-global, non-dynamic variables is false. | |
| 3063 // The subexpression does not have side effects. | |
| 3064 context()->Plug(false); | |
| 3065 } else if (prop != NULL) { | |
| 3066 if (prop->is_synthetic()) { | 3055 if (prop->is_synthetic()) { |
| 3067 // Result of deleting parameters is false, even when they rewrite | 3056 // Result of deleting parameters is false, even when they rewrite |
| 3068 // to accesses on the arguments object. | 3057 // to accesses on the arguments object. |
| 3069 context()->Plug(false); | 3058 context()->Plug(false); |
| 3070 } else { | 3059 } else { |
| 3071 VisitForStackValue(prop->obj()); | 3060 VisitForStackValue(prop->obj()); |
| 3072 VisitForStackValue(prop->key()); | 3061 VisitForStackValue(prop->key()); |
| 3073 __ InvokeBuiltin(Builtins::DELETE, CALL_FUNCTION); | 3062 __ InvokeBuiltin(Builtins::DELETE, CALL_FUNCTION); |
| 3074 context()->Plug(rax); | 3063 context()->Plug(rax); |
| 3075 } | 3064 } |
| 3076 } else if (var->is_global()) { | 3065 } else if (var != NULL) { |
| 3077 __ push(GlobalObjectOperand()); | 3066 if (var->is_global()) { |
| 3078 __ Push(var->name()); | 3067 __ push(GlobalObjectOperand()); |
| 3079 __ InvokeBuiltin(Builtins::DELETE, CALL_FUNCTION); | 3068 __ Push(var->name()); |
| 3080 context()->Plug(rax); | 3069 __ InvokeBuiltin(Builtins::DELETE, CALL_FUNCTION); |
| 3070 context()->Plug(rax); |
| 3071 } else if (var->AsSlot() != NULL && |
| 3072 var->AsSlot()->type() != Slot::LOOKUP) { |
| 3073 // Result of deleting non-global, non-dynamic variables is false. |
| 3074 // The subexpression does not have side effects. |
| 3075 context()->Plug(false); |
| 3076 } else { |
| 3077 // Non-global variable. Call the runtime to try to delete from the |
| 3078 // context where the variable was introduced. |
| 3079 __ push(context_register()); |
| 3080 __ Push(var->name()); |
| 3081 __ CallRuntime(Runtime::kDeleteContextSlot, 2); |
| 3082 context()->Plug(rax); |
| 3083 } |
| 3081 } else { | 3084 } else { |
| 3082 // Non-global variable. Call the runtime to try to delete from the | 3085 // Result of deleting non-property, non-variable reference is true. |
| 3083 // context where the variable was introduced. | 3086 // The subexpression may have side effects. |
| 3084 __ push(context_register()); | 3087 VisitForEffect(expr->expression()); |
| 3085 __ Push(var->name()); | 3088 context()->Plug(true); |
| 3086 __ CallRuntime(Runtime::kDeleteContextSlot, 2); | |
| 3087 context()->Plug(rax); | |
| 3088 } | 3089 } |
| 3089 break; | 3090 break; |
| 3090 } | 3091 } |
| 3091 | 3092 |
| 3092 case Token::VOID: { | 3093 case Token::VOID: { |
| 3093 Comment cmnt(masm_, "[ UnaryOperation (VOID)"); | 3094 Comment cmnt(masm_, "[ UnaryOperation (VOID)"); |
| 3094 VisitForEffect(expr->expression()); | 3095 VisitForEffect(expr->expression()); |
| 3095 context()->Plug(Heap::kUndefinedValueRootIndex); | 3096 context()->Plug(Heap::kUndefinedValueRootIndex); |
| 3096 break; | 3097 break; |
| 3097 } | 3098 } |
| (...skipping 648 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3746 __ ret(0); | 3747 __ ret(0); |
| 3747 } | 3748 } |
| 3748 | 3749 |
| 3749 | 3750 |
| 3750 #undef __ | 3751 #undef __ |
| 3751 | 3752 |
| 3752 | 3753 |
| 3753 } } // namespace v8::internal | 3754 } } // namespace v8::internal |
| 3754 | 3755 |
| 3755 #endif // V8_TARGET_ARCH_X64 | 3756 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |