Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(943)

Unified Diff: src/runtime/runtime-object.cc

Issue 2810363003: [builtins] Introduce DeleteProperty builtin (Closed)
Patch Set: fix CallableFor not to create handles Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/runtime/runtime.h ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/runtime/runtime-object.cc
diff --git a/src/runtime/runtime-object.cc b/src/runtime/runtime-object.cc
index 4c34b0e563f6dc0ced18be387bd16ca73fe8b826..05c6585917c01a41040437b1632530639b123859 100644
--- a/src/runtime/runtime-object.cc
+++ b/src/runtime/runtime-object.cc
@@ -459,25 +459,28 @@ Object* DeleteProperty(Isolate* isolate, Handle<Object> object,
} // namespace
-
-RUNTIME_FUNCTION(Runtime_DeleteProperty_Sloppy) {
+RUNTIME_FUNCTION(Runtime_DeleteProperty) {
HandleScope scope(isolate);
- DCHECK_EQ(2, args.length());
+ DCHECK_EQ(3, args.length());
CONVERT_ARG_HANDLE_CHECKED(Object, object, 0);
CONVERT_ARG_HANDLE_CHECKED(Object, key, 1);
- return DeleteProperty(isolate, object, key, SLOPPY);
+ CONVERT_SMI_ARG_CHECKED(language_mode, 2);
+ return DeleteProperty(isolate, object, key,
+ static_cast<LanguageMode>(language_mode));
}
-
-RUNTIME_FUNCTION(Runtime_DeleteProperty_Strict) {
+RUNTIME_FUNCTION(Runtime_ShrinkPropertyDictionary) {
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);
+ CONVERT_ARG_HANDLE_CHECKED(JSReceiver, receiver, 0);
+ CONVERT_ARG_HANDLE_CHECKED(Name, key, 1);
+ Handle<NameDictionary> dictionary(receiver->property_dictionary(), isolate);
+ Handle<NameDictionary> new_properties =
+ NameDictionary::Shrink(dictionary, key);
+ receiver->set_properties(*new_properties);
+ return Smi::kZero;
}
-
// ES6 section 12.9.3, operator in.
RUNTIME_FUNCTION(Runtime_HasProperty) {
HandleScope scope(isolate);
« no previous file with comments | « src/runtime/runtime.h ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698