| OLD | NEW |
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 7221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7232 Load(property->key()); | 7232 Load(property->key()); |
| 7233 frame_->Push(Smi::FromInt(strict_mode_flag())); | 7233 frame_->Push(Smi::FromInt(strict_mode_flag())); |
| 7234 Result answer = frame_->InvokeBuiltin(Builtins::DELETE, CALL_FUNCTION, 3); | 7234 Result answer = frame_->InvokeBuiltin(Builtins::DELETE, CALL_FUNCTION, 3); |
| 7235 frame_->Push(&answer); | 7235 frame_->Push(&answer); |
| 7236 return; | 7236 return; |
| 7237 } | 7237 } |
| 7238 | 7238 |
| 7239 Variable* variable = node->expression()->AsVariableProxy()->AsVariable(); | 7239 Variable* variable = node->expression()->AsVariableProxy()->AsVariable(); |
| 7240 if (variable != NULL) { | 7240 if (variable != NULL) { |
| 7241 // Delete of an unqualified identifier is disallowed in strict mode | 7241 // Delete of an unqualified identifier is disallowed in strict mode |
| 7242 // so this code can only be reached in non-strict mode. | 7242 // but "delete this" is. |
| 7243 ASSERT(strict_mode_flag() == kNonStrictMode); | 7243 ASSERT(strict_mode_flag() == kNonStrictMode || variable->is_this()); |
| 7244 Slot* slot = variable->AsSlot(); | 7244 Slot* slot = variable->AsSlot(); |
| 7245 if (variable->is_global()) { | 7245 if (variable->is_global()) { |
| 7246 LoadGlobal(); | 7246 LoadGlobal(); |
| 7247 frame_->Push(variable->name()); | 7247 frame_->Push(variable->name()); |
| 7248 frame_->Push(Smi::FromInt(kNonStrictMode)); | 7248 frame_->Push(Smi::FromInt(kNonStrictMode)); |
| 7249 Result answer = frame_->InvokeBuiltin(Builtins::DELETE, | 7249 Result answer = frame_->InvokeBuiltin(Builtins::DELETE, |
| 7250 CALL_FUNCTION, 3); | 7250 CALL_FUNCTION, 3); |
| 7251 frame_->Push(&answer); | 7251 frame_->Push(&answer); |
| 7252 return; | |
| 7253 | 7252 |
| 7254 } else if (slot != NULL && slot->type() == Slot::LOOKUP) { | 7253 } else if (slot != NULL && slot->type() == Slot::LOOKUP) { |
| 7255 // Call the runtime to delete from the context holding the named | 7254 // Call the runtime to delete from the context holding the named |
| 7256 // variable. Sync the virtual frame eagerly so we can push the | 7255 // variable. Sync the virtual frame eagerly so we can push the |
| 7257 // arguments directly into place. | 7256 // arguments directly into place. |
| 7258 frame_->SyncRange(0, frame_->element_count() - 1); | 7257 frame_->SyncRange(0, frame_->element_count() - 1); |
| 7259 frame_->EmitPush(rsi); | 7258 frame_->EmitPush(rsi); |
| 7260 frame_->EmitPush(variable->name()); | 7259 frame_->EmitPush(variable->name()); |
| 7261 Result answer = frame_->CallRuntime(Runtime::kDeleteContextSlot, 2); | 7260 Result answer = frame_->CallRuntime(Runtime::kDeleteContextSlot, 2); |
| 7262 frame_->Push(&answer); | 7261 frame_->Push(&answer); |
| 7263 return; | 7262 } else { |
| 7263 // Default: Result of deleting non-global, not dynamically |
| 7264 // introduced variables is false. |
| 7265 frame_->Push(Factory::false_value()); |
| 7264 } | 7266 } |
| 7265 | |
| 7266 // Default: Result of deleting non-global, not dynamically | |
| 7267 // introduced variables is false. | |
| 7268 frame_->Push(Factory::false_value()); | |
| 7269 | |
| 7270 } else { | 7267 } else { |
| 7271 // Default: Result of deleting expressions is true. | 7268 // Default: Result of deleting expressions is true. |
| 7272 Load(node->expression()); // may have side-effects | 7269 Load(node->expression()); // may have side-effects |
| 7273 frame_->SetElementAt(0, Factory::true_value()); | 7270 frame_->SetElementAt(0, Factory::true_value()); |
| 7274 } | 7271 } |
| 7275 | 7272 |
| 7276 } else if (op == Token::TYPEOF) { | 7273 } else if (op == Token::TYPEOF) { |
| 7277 // Special case for loading the typeof expression; see comment on | 7274 // Special case for loading the typeof expression; see comment on |
| 7278 // LoadTypeofExpression(). | 7275 // LoadTypeofExpression(). |
| 7279 LoadTypeofExpression(node->expression()); | 7276 LoadTypeofExpression(node->expression()); |
| (...skipping 1535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8815 } | 8812 } |
| 8816 | 8813 |
| 8817 #endif | 8814 #endif |
| 8818 | 8815 |
| 8819 | 8816 |
| 8820 #undef __ | 8817 #undef __ |
| 8821 | 8818 |
| 8822 } } // namespace v8::internal | 8819 } } // namespace v8::internal |
| 8823 | 8820 |
| 8824 #endif // V8_TARGET_ARCH_X64 | 8821 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |