OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #if V8_TARGET_ARCH_X64 | 5 #if V8_TARGET_ARCH_X64 |
6 | 6 |
7 #include "src/assembler-inl.h" | 7 #include "src/assembler-inl.h" |
8 #include "src/ast/compile-time-value.h" | 8 #include "src/ast/compile-time-value.h" |
9 #include "src/ast/scopes.h" | 9 #include "src/ast/scopes.h" |
10 #include "src/builtins/builtins-constructor.h" | 10 #include "src/builtins/builtins-constructor.h" |
(...skipping 2128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2139 void FullCodeGenerator::VisitUnaryOperation(UnaryOperation* expr) { | 2139 void FullCodeGenerator::VisitUnaryOperation(UnaryOperation* expr) { |
2140 switch (expr->op()) { | 2140 switch (expr->op()) { |
2141 case Token::DELETE: { | 2141 case Token::DELETE: { |
2142 Comment cmnt(masm_, "[ UnaryOperation (DELETE)"); | 2142 Comment cmnt(masm_, "[ UnaryOperation (DELETE)"); |
2143 Property* property = expr->expression()->AsProperty(); | 2143 Property* property = expr->expression()->AsProperty(); |
2144 VariableProxy* proxy = expr->expression()->AsVariableProxy(); | 2144 VariableProxy* proxy = expr->expression()->AsVariableProxy(); |
2145 | 2145 |
2146 if (property != NULL) { | 2146 if (property != NULL) { |
2147 VisitForStackValue(property->obj()); | 2147 VisitForStackValue(property->obj()); |
2148 VisitForStackValue(property->key()); | 2148 VisitForStackValue(property->key()); |
2149 CallRuntimeWithOperands(is_strict(language_mode()) | 2149 PushOperand(Smi::FromInt(language_mode())); |
2150 ? Runtime::kDeleteProperty_Strict | 2150 CallRuntimeWithOperands(Runtime::kDeleteProperty); |
2151 : Runtime::kDeleteProperty_Sloppy); | |
2152 context()->Plug(rax); | 2151 context()->Plug(rax); |
2153 } else if (proxy != NULL) { | 2152 } else if (proxy != NULL) { |
2154 Variable* var = proxy->var(); | 2153 Variable* var = proxy->var(); |
2155 // Delete of an unqualified identifier is disallowed in strict mode but | 2154 // Delete of an unqualified identifier is disallowed in strict mode but |
2156 // "delete this" is allowed. | 2155 // "delete this" is allowed. |
2157 bool is_this = var->is_this(); | 2156 bool is_this = var->is_this(); |
2158 DCHECK(is_sloppy(language_mode()) || is_this); | 2157 DCHECK(is_sloppy(language_mode()) || is_this); |
2159 if (var->IsUnallocated()) { | 2158 if (var->IsUnallocated()) { |
2160 __ movp(rax, NativeContextOperand()); | 2159 __ movp(rax, NativeContextOperand()); |
2161 __ Push(ContextOperand(rax, Context::EXTENSION_INDEX)); | 2160 __ Push(ContextOperand(rax, Context::EXTENSION_INDEX)); |
2162 __ Push(var->name()); | 2161 __ Push(var->name()); |
2163 __ CallRuntime(Runtime::kDeleteProperty_Sloppy); | 2162 __ Push(Smi::FromInt(SLOPPY)); |
| 2163 __ CallRuntime(Runtime::kDeleteProperty); |
2164 context()->Plug(rax); | 2164 context()->Plug(rax); |
2165 } else { | 2165 } else { |
2166 DCHECK(!var->IsLookupSlot()); | 2166 DCHECK(!var->IsLookupSlot()); |
2167 DCHECK(var->IsStackAllocated() || var->IsContextSlot()); | 2167 DCHECK(var->IsStackAllocated() || var->IsContextSlot()); |
2168 // Result of deleting non-global variables is false. 'this' is | 2168 // Result of deleting non-global variables is false. 'this' is |
2169 // not really a variable, though we implement it as one. The | 2169 // not really a variable, though we implement it as one. The |
2170 // subexpression does not have side effects. | 2170 // subexpression does not have side effects. |
2171 context()->Plug(is_this); | 2171 context()->Plug(is_this); |
2172 } | 2172 } |
2173 } else { | 2173 } else { |
(...skipping 567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2741 DCHECK_EQ( | 2741 DCHECK_EQ( |
2742 isolate->builtins()->OnStackReplacement()->entry(), | 2742 isolate->builtins()->OnStackReplacement()->entry(), |
2743 Assembler::target_address_at(call_target_address, unoptimized_code)); | 2743 Assembler::target_address_at(call_target_address, unoptimized_code)); |
2744 return ON_STACK_REPLACEMENT; | 2744 return ON_STACK_REPLACEMENT; |
2745 } | 2745 } |
2746 | 2746 |
2747 } // namespace internal | 2747 } // namespace internal |
2748 } // namespace v8 | 2748 } // namespace v8 |
2749 | 2749 |
2750 #endif // V8_TARGET_ARCH_X64 | 2750 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |