builtins-collections.cc 930 Bytes
Newer Older
1 2 3 4
// Copyright 2016 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

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 12 13

namespace v8 {
namespace internal {

14
BUILTIN(MapPrototypeClear) {
15 16 17
  HandleScope scope(isolate);
  const char* const kMethodName = "Map.prototype.clear";
  CHECK_RECEIVER(JSMap, map, kMethodName);
18
  JSMap::Clear(isolate, map);
19
  return ReadOnlyRoots(isolate).undefined_value();
20 21
}

22
BUILTIN(SetPrototypeClear) {
23 24 25
  HandleScope scope(isolate);
  const char* const kMethodName = "Set.prototype.clear";
  CHECK_RECEIVER(JSSet, set, kMethodName);
26
  JSSet::Clear(isolate, set);
27
  return ReadOnlyRoots(isolate).undefined_value();
28 29 30 31
}

}  // namespace internal
}  // namespace v8