From e50161e549579d6b4ea6a525c0b274b06d8d1ad2 Mon Sep 17 00:00:00 2001
From: Camillo Bruni <cbruni@chromium.org>
Date: Mon, 16 Nov 2020 17:12:20 +0100
Subject: [PATCH] [API] Advance API deprecation

Bug: v8:11165, v8:10096
Change-Id: I4be596f74a231641b8032e70063f47f4776ec6a8
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2539919
Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
Commit-Queue: Camillo Bruni <cbruni@chromium.org>
Cr-Commit-Position: refs/heads/master@{#71212}
---
 include/v8.h   | 52 ++++++--------------------------------------------
 src/api/api.cc | 21 --------------------
 2 files changed, 6 insertions(+), 67 deletions(-)

diff --git a/include/v8.h b/include/v8.h
index 835178204ad..45a136ecbab 100644
--- a/include/v8.h
+++ b/include/v8.h
@@ -1654,7 +1654,7 @@ class V8_EXPORT Module : public Data {
    */
   V8_WARN_UNUSED_RESULT Maybe<bool> SetSyntheticModuleExport(
       Isolate* isolate, Local<String> export_name, Local<Value> export_value);
-  V8_DEPRECATE_SOON(
+  V8_DEPRECATED(
       "Use the preceding SetSyntheticModuleExport with an Isolate parameter, "
       "instead of the one that follows.  The former will throw a runtime "
       "error if called for an export that doesn't exist (as per spec); "
@@ -1839,7 +1839,7 @@ class V8_EXPORT ScriptCompiler {
    public:
     enum Encoding { ONE_BYTE, TWO_BYTE, UTF8 };
 
-    V8_DEPRECATE_SOON(
+    V8_DEPRECATED(
         "This class takes ownership of source_stream, so use the constructor "
         "taking a unique_ptr to make these semantics clearer")
     StreamedSource(ExternalSourceStream* source_stream, Encoding encoding);
@@ -1946,7 +1946,7 @@ class V8_EXPORT ScriptCompiler {
    * This API allows to start the streaming with as little data as possible, and
    * the remaining data (for example, the ScriptOrigin) is passed to Compile.
    */
-  V8_DEPRECATE_SOON("Use ScriptCompiler::StartStreamingScript instead.")
+  V8_DEPRECATED("Use ScriptCompiler::StartStreamingScript instead.")
   static ScriptStreamingTask* StartStreamingScript(
       Isolate* isolate, StreamedSource* source,
       CompileOptions options = kNoCompileOptions);
@@ -3452,7 +3452,7 @@ class V8_EXPORT Symbol : public Name {
    */
   Local<Value> Description() const;
 
-  V8_DEPRECATE_SOON("Use Symbol::Description()")
+  V8_DEPRECATED("Use Symbol::Description()")
   Local<Value> Name() const { return Description(); }
 
   /**
@@ -7228,36 +7228,11 @@ class V8_EXPORT ResourceConstraints {
     initial_young_generation_size_ = initial_size;
   }
 
-  /**
-   * Deprecated functions. Do not use in new code.
-   */
-  V8_DEPRECATED("Use code_range_size_in_bytes.")
-  size_t code_range_size() const { return code_range_size_ / kMB; }
-  V8_DEPRECATED("Use set_code_range_size_in_bytes.")
-  void set_code_range_size(size_t limit_in_mb) {
-    code_range_size_ = limit_in_mb * kMB;
-  }
-  V8_DEPRECATED("Use max_young_generation_size_in_bytes.")
-  size_t max_semi_space_size_in_kb() const;
-  V8_DEPRECATED("Use set_max_young_generation_size_in_bytes.")
-  void set_max_semi_space_size_in_kb(size_t limit_in_kb);
-  V8_DEPRECATED("Use max_old_generation_size_in_bytes.")
-  size_t max_old_space_size() const { return max_old_generation_size_ / kMB; }
-  V8_DEPRECATED("Use set_max_old_generation_size_in_bytes.")
-  void set_max_old_space_size(size_t limit_in_mb) {
-    max_old_generation_size_ = limit_in_mb * kMB;
-  }
-  V8_DEPRECATED("Zone does not pool memory any more.")
-  size_t max_zone_pool_size() const { return max_zone_pool_size_; }
-  V8_DEPRECATED("Zone does not pool memory any more.")
-  void set_max_zone_pool_size(size_t bytes) { max_zone_pool_size_ = bytes; }
-
  private:
   static constexpr size_t kMB = 1048576u;
   size_t code_range_size_ = 0;
   size_t max_old_generation_size_ = 0;
   size_t max_young_generation_size_ = 0;
-  size_t max_zone_pool_size_ = 0;
   size_t initial_old_generation_size_ = 0;
   size_t initial_young_generation_size_ = 0;
   uint32_t* stack_limit_ = nullptr;
@@ -8843,7 +8818,7 @@ class V8_EXPORT Isolate {
       std::unique_ptr<MeasureMemoryDelegate> delegate,
       MeasureMemoryExecution execution = MeasureMemoryExecution::kDefault);
 
-  V8_DEPRECATE_SOON("Use the version with a delegate")
+  V8_DEPRECATED("Use the version with a delegate")
   MaybeLocal<Promise> MeasureMemory(Local<Context> context,
                                     MeasureMemoryMode mode);
 
@@ -8906,10 +8881,6 @@ class V8_EXPORT Isolate {
    */
   Local<Context> GetCurrentContext();
 
-  /** Returns the last context entered through V8's C++ API. */
-  V8_DEPRECATED("Use GetEnteredOrMicrotaskContext().")
-  Local<Context> GetEnteredContext();
-
   /**
    * Returns either the last context entered through V8's C++ API, or the
    * context of the currently running microtask while processing microtasks.
@@ -9188,12 +9159,6 @@ class V8_EXPORT Isolate {
    */
   void SetPromiseRejectCallback(PromiseRejectCallback callback);
 
-  /**
-   * An alias for PerformMicrotaskCheckpoint.
-   */
-  V8_DEPRECATED("Use PerformMicrotaskCheckpoint.")
-  void RunMicrotasks() { PerformMicrotaskCheckpoint(); }
-
   /**
    * Runs the default MicrotaskQueue until it gets empty and perform other
    * microtask checkpoint steps, such as calling ClearKeptObjects. Asserts that
@@ -9487,11 +9452,6 @@ class V8_EXPORT Isolate {
    * strings should be allowed.
    */
   V8_DEPRECATED(
-      "Use Isolate::SetModifyCodeGenerationFromStringsCallback instead. "
-      "See http://crbug.com/v8/10096.")
-  void SetAllowCodeGenerationFromStringsCallback(
-      AllowCodeGenerationFromStringsCallback callback);
-  V8_DEPRECATE_SOON(
       "Use Isolate::SetModifyCodeGenerationFromStringsCallback with "
       "ModifyCodeGenerationFromStringsCallback2 instead. See "
       "http://crbug.com/1096017 and TC39 Dynamic Code Brand Checks proposal "
@@ -9856,7 +9816,7 @@ class V8_EXPORT V8 {
    * \param context The third argument passed to the Linux signal handler, which
    * points to a ucontext_t structure.
    */
-  V8_DEPRECATE_SOON("Use TryHandleWebAssemblyTrapPosix")
+  V8_DEPRECATED("Use TryHandleWebAssemblyTrapPosix")
   static bool TryHandleSignal(int signal_number, void* info, void* context);
 #endif  // V8_OS_POSIX
 
diff --git a/src/api/api.cc b/src/api/api.cc
index 88f0475d7fd..5a73587c852 100644
--- a/src/api/api.cc
+++ b/src/api/api.cc
@@ -954,17 +954,6 @@ void ResourceConstraints::ConfigureDefaults(uint64_t physical_memory,
   }
 }
 
-size_t ResourceConstraints::max_semi_space_size_in_kb() const {
-  return i::Heap::SemiSpaceSizeFromYoungGenerationSize(
-             max_young_generation_size_) /
-         i::KB;
-}
-
-void ResourceConstraints::set_max_semi_space_size_in_kb(size_t limit_in_kb) {
-  set_max_young_generation_size_in_bytes(
-      i::Heap::YoungGenerationSizeFromSemiSpaceSize(limit_in_kb * i::KB));
-}
-
 i::Address* V8::GlobalizeReference(i::Isolate* isolate, i::Address* obj) {
   LOG_API(isolate, Persistent, New);
   i::Handle<i::Object> result = isolate->global_handles()->Create(*obj);
@@ -8172,14 +8161,6 @@ v8::Local<v8::Context> Isolate::GetCurrentContext() {
   return Utils::ToLocal(i::Handle<i::Context>(native_context, isolate));
 }
 
-v8::Local<v8::Context> Isolate::GetEnteredContext() {
-  i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this);
-  i::Handle<i::Object> last =
-      isolate->handle_scope_implementer()->LastEnteredContext();
-  if (last.is_null()) return Local<Context>();
-  return Utils::ToLocal(i::Handle<i::Context>::cast(last));
-}
-
 v8::Local<v8::Context> Isolate::GetEnteredOrMicrotaskContext() {
   i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this);
   i::Handle<i::Object> last =
@@ -9063,8 +9044,6 @@ size_t Isolate::CopyCodePages(size_t capacity, MemoryRange* code_pages_out) {
 
 CALLBACK_SETTER(FatalErrorHandler, FatalErrorCallback, exception_behavior)
 CALLBACK_SETTER(OOMErrorHandler, OOMErrorCallback, oom_behavior)
-CALLBACK_SETTER(AllowCodeGenerationFromStringsCallback,
-                AllowCodeGenerationFromStringsCallback, allow_code_gen_callback)
 CALLBACK_SETTER(ModifyCodeGenerationFromStringsCallback,
                 ModifyCodeGenerationFromStringsCallback,
                 modify_code_gen_callback)
-- 
2.18.1