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/objects-inl.h" 8 #include "src/objects/js-collection-inl.h" 9 10 namespace v8 { 11 namespace internal { 12 BUILTIN(MapPrototypeClear)13BUILTIN(MapPrototypeClear) { 14 HandleScope scope(isolate); 15 const char* const kMethodName = "Map.prototype.clear"; 16 CHECK_RECEIVER(JSMap, map, kMethodName); 17 JSMap::Clear(isolate, map); 18 return ReadOnlyRoots(isolate).undefined_value(); 19 } 20 BUILTIN(SetPrototypeClear)21BUILTIN(SetPrototypeClear) { 22 HandleScope scope(isolate); 23 const char* const kMethodName = "Set.prototype.clear"; 24 CHECK_RECEIVER(JSSet, set, kMethodName); 25 JSSet::Clear(isolate, set); 26 return ReadOnlyRoots(isolate).undefined_value(); 27 } 28 29 } // namespace internal 30 } // namespace v8 31