| 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 3025 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3036 context()->Plug(r0); | 3036 context()->Plug(r0); |
| 3037 } | 3037 } |
| 3038 | 3038 |
| 3039 | 3039 |
| 3040 void FullCodeGenerator::VisitUnaryOperation(UnaryOperation* expr) { | 3040 void FullCodeGenerator::VisitUnaryOperation(UnaryOperation* expr) { |
| 3041 switch (expr->op()) { | 3041 switch (expr->op()) { |
| 3042 case Token::DELETE: { | 3042 case Token::DELETE: { |
| 3043 Comment cmnt(masm_, "[ UnaryOperation (DELETE)"); | 3043 Comment cmnt(masm_, "[ UnaryOperation (DELETE)"); |
| 3044 Property* prop = expr->expression()->AsProperty(); | 3044 Property* prop = expr->expression()->AsProperty(); |
| 3045 Variable* var = expr->expression()->AsVariableProxy()->AsVariable(); | 3045 Variable* var = expr->expression()->AsVariableProxy()->AsVariable(); |
| 3046 if (prop == NULL && var == NULL) { | 3046 |
| 3047 // Result of deleting non-property, non-variable reference is true. | 3047 if (prop != NULL) { |
| 3048 // The subexpression may have side effects. | |
| 3049 VisitForEffect(expr->expression()); | |
| 3050 context()->Plug(true); | |
| 3051 } else if (var != NULL && | |
| 3052 !var->is_global() && | |
| 3053 var->AsSlot() != NULL && | |
| 3054 var->AsSlot()->type() != Slot::LOOKUP) { | |
| 3055 // Result of deleting non-global, non-dynamic variables is false. | |
| 3056 // The subexpression does not have side effects. | |
| 3057 context()->Plug(false); | |
| 3058 } else if (prop != NULL) { | |
| 3059 if (prop->is_synthetic()) { | 3048 if (prop->is_synthetic()) { |
| 3060 // Result of deleting parameters is false, even when they rewrite | 3049 // Result of deleting parameters is false, even when they rewrite |
| 3061 // to accesses on the arguments object. | 3050 // to accesses on the arguments object. |
| 3062 context()->Plug(false); | 3051 context()->Plug(false); |
| 3063 } else { | 3052 } else { |
| 3064 VisitForStackValue(prop->obj()); | 3053 VisitForStackValue(prop->obj()); |
| 3065 VisitForStackValue(prop->key()); | 3054 VisitForStackValue(prop->key()); |
| 3066 __ InvokeBuiltin(Builtins::DELETE, CALL_JS); | 3055 __ InvokeBuiltin(Builtins::DELETE, CALL_JS); |
| 3067 context()->Plug(r0); | 3056 context()->Plug(r0); |
| 3068 } | 3057 } |
| 3069 } else if (var->is_global()) { | 3058 } else if (var != NULL) { |
| 3070 __ ldr(r1, GlobalObjectOperand()); | 3059 if (var->is_global()) { |
| 3071 __ mov(r0, Operand(var->name())); | 3060 __ ldr(r1, GlobalObjectOperand()); |
| 3072 __ Push(r1, r0); | 3061 __ mov(r0, Operand(var->name())); |
| 3073 __ InvokeBuiltin(Builtins::DELETE, CALL_JS); | 3062 __ Push(r1, r0); |
| 3074 context()->Plug(r0); | 3063 __ InvokeBuiltin(Builtins::DELETE, CALL_JS); |
| 3064 context()->Plug(r0); |
| 3065 } else if (var->AsSlot() != NULL && |
| 3066 var->AsSlot()->type() != Slot::LOOKUP) { |
| 3067 // Result of deleting non-global, non-dynamic variables is false. |
| 3068 // The subexpression does not have side effects. |
| 3069 context()->Plug(false); |
| 3070 } else { |
| 3071 // Non-global variable. Call the runtime to try to delete from the |
| 3072 // context where the variable was introduced. |
| 3073 __ push(context_register()); |
| 3074 __ mov(r2, Operand(var->name())); |
| 3075 __ push(r2); |
| 3076 __ CallRuntime(Runtime::kDeleteContextSlot, 2); |
| 3077 context()->Plug(r0); |
| 3078 } |
| 3075 } else { | 3079 } else { |
| 3076 // Non-global variable. Call the runtime to try to delete from the | 3080 // Result of deleting non-property, non-variable reference is true. |
| 3077 // context where the variable was introduced. | 3081 // The subexpression may have side effects. |
| 3078 __ push(context_register()); | 3082 VisitForEffect(expr->expression()); |
| 3079 __ mov(r2, Operand(var->name())); | 3083 context()->Plug(true); |
| 3080 __ push(r2); | |
| 3081 __ CallRuntime(Runtime::kDeleteContextSlot, 2); | |
| 3082 context()->Plug(r0); | |
| 3083 } | 3084 } |
| 3084 break; | 3085 break; |
| 3085 } | 3086 } |
| 3086 | 3087 |
| 3087 case Token::VOID: { | 3088 case Token::VOID: { |
| 3088 Comment cmnt(masm_, "[ UnaryOperation (VOID)"); | 3089 Comment cmnt(masm_, "[ UnaryOperation (VOID)"); |
| 3089 VisitForEffect(expr->expression()); | 3090 VisitForEffect(expr->expression()); |
| 3090 context()->Plug(Heap::kUndefinedValueRootIndex); | 3091 context()->Plug(Heap::kUndefinedValueRootIndex); |
| 3091 break; | 3092 break; |
| 3092 } | 3093 } |
| (...skipping 602 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3695 __ mov(r1, Operand(r1, ASR, 1)); // Un-smi-tag value. | 3696 __ mov(r1, Operand(r1, ASR, 1)); // Un-smi-tag value. |
| 3696 __ add(pc, r1, Operand(masm_->CodeObject())); | 3697 __ add(pc, r1, Operand(masm_->CodeObject())); |
| 3697 } | 3698 } |
| 3698 | 3699 |
| 3699 | 3700 |
| 3700 #undef __ | 3701 #undef __ |
| 3701 | 3702 |
| 3702 } } // namespace v8::internal | 3703 } } // namespace v8::internal |
| 3703 | 3704 |
| 3704 #endif // V8_TARGET_ARCH_ARM | 3705 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |