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_IA32 | 5 #if V8_TARGET_ARCH_IA32 |
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 4536 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4547 void FullCodeGenerator::VisitUnaryOperation(UnaryOperation* expr) { | 4547 void FullCodeGenerator::VisitUnaryOperation(UnaryOperation* expr) { |
4548 switch (expr->op()) { | 4548 switch (expr->op()) { |
4549 case Token::DELETE: { | 4549 case Token::DELETE: { |
4550 Comment cmnt(masm_, "[ UnaryOperation (DELETE)"); | 4550 Comment cmnt(masm_, "[ UnaryOperation (DELETE)"); |
4551 Property* property = expr->expression()->AsProperty(); | 4551 Property* property = expr->expression()->AsProperty(); |
4552 VariableProxy* proxy = expr->expression()->AsVariableProxy(); | 4552 VariableProxy* proxy = expr->expression()->AsVariableProxy(); |
4553 | 4553 |
4554 if (property != NULL) { | 4554 if (property != NULL) { |
4555 VisitForStackValue(property->obj()); | 4555 VisitForStackValue(property->obj()); |
4556 VisitForStackValue(property->key()); | 4556 VisitForStackValue(property->key()); |
4557 __ push(Immediate(Smi::FromInt(language_mode()))); | 4557 __ CallRuntime(is_strict(language_mode()) |
4558 __ InvokeBuiltin(Builtins::DELETE, CALL_FUNCTION); | 4558 ? Runtime::kDeleteProperty_Strict |
| 4559 : Runtime::kDeleteProperty_Sloppy, |
| 4560 2); |
4559 context()->Plug(eax); | 4561 context()->Plug(eax); |
4560 } else if (proxy != NULL) { | 4562 } else if (proxy != NULL) { |
4561 Variable* var = proxy->var(); | 4563 Variable* var = proxy->var(); |
4562 // Delete of an unqualified identifier is disallowed in strict mode but | 4564 // Delete of an unqualified identifier is disallowed in strict mode but |
4563 // "delete this" is allowed. | 4565 // "delete this" is allowed. |
4564 bool is_this = var->HasThisName(isolate()); | 4566 bool is_this = var->HasThisName(isolate()); |
4565 DCHECK(is_sloppy(language_mode()) || is_this); | 4567 DCHECK(is_sloppy(language_mode()) || is_this); |
4566 if (var->IsUnallocatedOrGlobalSlot()) { | 4568 if (var->IsUnallocatedOrGlobalSlot()) { |
4567 __ push(GlobalObjectOperand()); | 4569 __ push(GlobalObjectOperand()); |
4568 __ push(Immediate(var->name())); | 4570 __ push(Immediate(var->name())); |
4569 __ push(Immediate(Smi::FromInt(SLOPPY))); | 4571 __ CallRuntime(Runtime::kDeleteProperty_Sloppy, 2); |
4570 __ InvokeBuiltin(Builtins::DELETE, CALL_FUNCTION); | |
4571 context()->Plug(eax); | 4572 context()->Plug(eax); |
4572 } else if (var->IsStackAllocated() || var->IsContextSlot()) { | 4573 } else if (var->IsStackAllocated() || var->IsContextSlot()) { |
4573 // Result of deleting non-global variables is false. 'this' is | 4574 // Result of deleting non-global variables is false. 'this' is |
4574 // not really a variable, though we implement it as one. The | 4575 // not really a variable, though we implement it as one. The |
4575 // subexpression does not have side effects. | 4576 // subexpression does not have side effects. |
4576 context()->Plug(is_this); | 4577 context()->Plug(is_this); |
4577 } else { | 4578 } else { |
4578 // Non-global variable. Call the runtime to try to delete from the | 4579 // Non-global variable. Call the runtime to try to delete from the |
4579 // context where the variable was introduced. | 4580 // context where the variable was introduced. |
4580 __ push(context_register()); | 4581 __ push(context_register()); |
(...skipping 709 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5290 Assembler::target_address_at(call_target_address, | 5291 Assembler::target_address_at(call_target_address, |
5291 unoptimized_code)); | 5292 unoptimized_code)); |
5292 return OSR_AFTER_STACK_CHECK; | 5293 return OSR_AFTER_STACK_CHECK; |
5293 } | 5294 } |
5294 | 5295 |
5295 | 5296 |
5296 } // namespace internal | 5297 } // namespace internal |
5297 } // namespace v8 | 5298 } // namespace v8 |
5298 | 5299 |
5299 #endif // V8_TARGET_ARCH_IA32 | 5300 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |