1 // Copyright 2016 the V8 project authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #include "src/builtins/builtins-utils-inl.h" 6 #include "src/builtins/builtins.h" 7 #include "src/logging/counters.h" 8 #include "src/objects/js-collection-inl.h" 9 #include "src/objects/objects-inl.h" 10 11 namespace v8 { 12 namespace internal { 13 BUILTIN(MapPrototypeClear)14BUILTIN(MapPrototypeClear) { 15 HandleScope scope(isolate); 16 const char* const kMethodName = "Map.prototype.clear"; 17 CHECK_RECEIVER(JSMap, map, kMethodName); 18 JSMap::Clear(isolate, map); 19 return ReadOnlyRoots(isolate).undefined_value(); 20 } 21 BUILTIN(SetPrototypeClear)22BUILTIN(SetPrototypeClear) { 23 HandleScope scope(isolate); 24 const char* const kMethodName = "Set.prototype.clear"; 25 CHECK_RECEIVER(JSSet, set, kMethodName); 26 JSSet::Clear(isolate, set); 27 return ReadOnlyRoots(isolate).undefined_value(); 28 } 29 30 } // namespace internal 31 } // namespace v8 32