Index: src/runtime/runtime-object.cc |
diff --git a/src/runtime/runtime-object.cc b/src/runtime/runtime-object.cc |
index b0546640df0ce604ea2aa57ecbe9a3239dffae7f..064e4c216291dc7d56261dc195a0db1d6d2f54ab 100644 |
--- a/src/runtime/runtime-object.cc |
+++ b/src/runtime/runtime-object.cc |
@@ -671,12 +671,16 @@ RUNTIME_FUNCTION(Runtime_SetProperty) { |
} |
-RUNTIME_FUNCTION(Runtime_DeleteProperty) { |
- HandleScope scope(isolate); |
- DCHECK(args.length() == 3); |
- CONVERT_ARG_HANDLE_CHECKED(JSReceiver, receiver, 0); |
- CONVERT_ARG_HANDLE_CHECKED(Object, key, 1); |
- CONVERT_LANGUAGE_MODE_ARG_CHECKED(language_mode, 2); |
+namespace { |
+ |
+// ES6 section 12.5.4. |
+Object* DeleteProperty(Isolate* isolate, Handle<Object> object, |
+ Handle<Object> key, LanguageMode language_mode) { |
+ Handle<JSReceiver> receiver; |
+ if (!JSReceiver::ToObject(isolate, object).ToHandle(&receiver)) { |
+ THROW_NEW_ERROR_RETURN_FAILURE( |
+ isolate, NewTypeError(MessageTemplate::kUndefinedOrNullToObject)); |
+ } |
Handle<Object> result; |
ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
isolate, result, |
@@ -684,6 +688,26 @@ RUNTIME_FUNCTION(Runtime_DeleteProperty) { |
return *result; |
} |
+} // namespace |
+ |
+ |
+RUNTIME_FUNCTION(Runtime_DeleteProperty_Sloppy) { |
+ HandleScope scope(isolate); |
+ DCHECK_EQ(2, args.length()); |
+ CONVERT_ARG_HANDLE_CHECKED(Object, object, 0); |
+ CONVERT_ARG_HANDLE_CHECKED(Object, key, 1); |
+ return DeleteProperty(isolate, object, key, SLOPPY); |
+} |
+ |
+ |
+RUNTIME_FUNCTION(Runtime_DeleteProperty_Strict) { |
+ HandleScope scope(isolate); |
+ DCHECK_EQ(2, args.length()); |
+ CONVERT_ARG_HANDLE_CHECKED(Object, object, 0); |
+ CONVERT_ARG_HANDLE_CHECKED(Object, key, 1); |
+ return DeleteProperty(isolate, object, key, STRICT); |
+} |
+ |
static Object* HasOwnPropertyImplementation(Isolate* isolate, |
Handle<JSObject> object, |