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