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/code-factory.h" | 7 #include "src/code-factory.h" |
8 #include "src/code-stubs.h" | 8 #include "src/code-stubs.h" |
9 #include "src/codegen.h" | 9 #include "src/codegen.h" |
10 #include "src/compiler.h" | 10 #include "src/compiler.h" |
(...skipping 4548 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4559 void FullCodeGenerator::VisitUnaryOperation(UnaryOperation* expr) { | 4559 void FullCodeGenerator::VisitUnaryOperation(UnaryOperation* expr) { |
4560 switch (expr->op()) { | 4560 switch (expr->op()) { |
4561 case Token::DELETE: { | 4561 case Token::DELETE: { |
4562 Comment cmnt(masm_, "[ UnaryOperation (DELETE)"); | 4562 Comment cmnt(masm_, "[ UnaryOperation (DELETE)"); |
4563 Property* property = expr->expression()->AsProperty(); | 4563 Property* property = expr->expression()->AsProperty(); |
4564 VariableProxy* proxy = expr->expression()->AsVariableProxy(); | 4564 VariableProxy* proxy = expr->expression()->AsVariableProxy(); |
4565 | 4565 |
4566 if (property != NULL) { | 4566 if (property != NULL) { |
4567 VisitForStackValue(property->obj()); | 4567 VisitForStackValue(property->obj()); |
4568 VisitForStackValue(property->key()); | 4568 VisitForStackValue(property->key()); |
4569 __ Push(Smi::FromInt(language_mode())); | 4569 __ CallRuntime(is_strict(language_mode()) |
4570 __ InvokeBuiltin(Builtins::DELETE, CALL_FUNCTION); | 4570 ? Runtime::kDeleteProperty_Strict |
| 4571 : Runtime::kDeleteProperty_Sloppy, |
| 4572 2); |
4571 context()->Plug(rax); | 4573 context()->Plug(rax); |
4572 } else if (proxy != NULL) { | 4574 } else if (proxy != NULL) { |
4573 Variable* var = proxy->var(); | 4575 Variable* var = proxy->var(); |
4574 // Delete of an unqualified identifier is disallowed in strict mode but | 4576 // Delete of an unqualified identifier is disallowed in strict mode but |
4575 // "delete this" is allowed. | 4577 // "delete this" is allowed. |
4576 bool is_this = var->HasThisName(isolate()); | 4578 bool is_this = var->HasThisName(isolate()); |
4577 DCHECK(is_sloppy(language_mode()) || is_this); | 4579 DCHECK(is_sloppy(language_mode()) || is_this); |
4578 if (var->IsUnallocatedOrGlobalSlot()) { | 4580 if (var->IsUnallocatedOrGlobalSlot()) { |
4579 __ Push(GlobalObjectOperand()); | 4581 __ Push(GlobalObjectOperand()); |
4580 __ Push(var->name()); | 4582 __ Push(var->name()); |
4581 __ Push(Smi::FromInt(SLOPPY)); | 4583 __ CallRuntime(Runtime::kDeleteProperty_Sloppy, 2); |
4582 __ InvokeBuiltin(Builtins::DELETE, CALL_FUNCTION); | |
4583 context()->Plug(rax); | 4584 context()->Plug(rax); |
4584 } else if (var->IsStackAllocated() || var->IsContextSlot()) { | 4585 } else if (var->IsStackAllocated() || var->IsContextSlot()) { |
4585 // Result of deleting non-global variables is false. 'this' is | 4586 // Result of deleting non-global variables is false. 'this' is |
4586 // not really a variable, though we implement it as one. The | 4587 // not really a variable, though we implement it as one. The |
4587 // subexpression does not have side effects. | 4588 // subexpression does not have side effects. |
4588 context()->Plug(is_this); | 4589 context()->Plug(is_this); |
4589 } else { | 4590 } else { |
4590 // Non-global variable. Call the runtime to try to delete from the | 4591 // Non-global variable. Call the runtime to try to delete from the |
4591 // context where the variable was introduced. | 4592 // context where the variable was introduced. |
4592 __ Push(context_register()); | 4593 __ Push(context_register()); |
(...skipping 707 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5300 Assembler::target_address_at(call_target_address, | 5301 Assembler::target_address_at(call_target_address, |
5301 unoptimized_code)); | 5302 unoptimized_code)); |
5302 return OSR_AFTER_STACK_CHECK; | 5303 return OSR_AFTER_STACK_CHECK; |
5303 } | 5304 } |
5304 | 5305 |
5305 | 5306 |
5306 } // namespace internal | 5307 } // namespace internal |
5307 } // namespace v8 | 5308 } // namespace v8 |
5308 | 5309 |
5309 #endif // V8_TARGET_ARCH_X64 | 5310 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |