Version 8.0.426.1 (cherry-pick)

Merged fd33223c303f99fd013c3cd2c13ebf25429bc0ee
Merged 99005f337a34d7cafb75ef7e75d14109da9bfeaf

Revert "Introduce and emit "function calls in detached window" use counters."

Revert "Implement top-level await for REPL mode"

R=mslekova@chromium.org
TBR=hablich@chromium.org

Bug: chromium:1029863
Change-Id: I181b0537f2e2c17d6e67159951a1d369f435811a
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1950963
Reviewed-by: Maya Lekova <mslekova@chromium.org>
Cr-Commit-Position: refs/heads/8.0.426@{#2}
Cr-Branched-From: 2fe1552c5809d0dd92e81d36a5535cbb7c518800-refs/heads/master@{#65318}
diff --git a/include/v8-version.h b/include/v8-version.h
index a7a503a..a0c8aad 100644
--- a/include/v8-version.h
+++ b/include/v8-version.h
@@ -11,7 +11,7 @@
 #define V8_MAJOR_VERSION 8
 #define V8_MINOR_VERSION 0
 #define V8_BUILD_NUMBER 426
-#define V8_PATCH_LEVEL 0
+#define V8_PATCH_LEVEL 1
 
 // Use 1 for candidates and 0 otherwise.
 // (Boolean macro values are not supported by all preprocessors.)
diff --git a/include/v8.h b/include/v8.h
index 86a5545..5b9fcd4 100644
--- a/include/v8.h
+++ b/include/v8.h
@@ -8236,19 +8236,7 @@
     kRegExpExecCalledOnSlowRegExp = 79,
     kRegExpReplaceCalledOnSlowRegExp = 80,
     kDisplayNames = 81,
-    // Temporary kCallInDetachedWindowBy* counters are for reporting function
-    // calls within contexts marked using |SetDetachedWindowReason|.
-    // TODO(bartekn,chromium:1018156): Remove once not needed.
-    kCallInDetachedWindowByNavigation = 82,
-    kCallInDetachedWindowByNavigationAfter10s = 83,
-    kCallInDetachedWindowByNavigationAfter1min = 84,
-    kCallInDetachedWindowByClosing = 85,
-    kCallInDetachedWindowByClosingAfter10s = 86,
-    kCallInDetachedWindowByClosingAfter1min = 87,
-    kCallInDetachedWindowByOtherReason = 88,
-    kCallInDetachedWindowByOtherReasonAfter10s = 89,
-    kCallInDetachedWindowByOtherReasonAfter1min = 90,
-    kSharedArrayBufferConstructed = 91,
+    kSharedArrayBufferConstructed = 82,
 
     // If you add new values here, you'll also need to update Chromium's:
     // web_feature.mojom, use_counter_callback.cc, and enums.xml. V8 changes to
diff --git a/src/ast/ast-value-factory.h b/src/ast/ast-value-factory.h
index a555ad5..07ae2c9 100644
--- a/src/ast/ast-value-factory.h
+++ b/src/ast/ast-value-factory.h
@@ -213,7 +213,6 @@
   F(dot_iterator, ".iterator")                  \
   F(dot_promise, ".promise")                    \
   F(dot_result, ".result")                      \
-  F(dot_repl_result, ".repl_result")            \
   F(dot_switch_tag, ".switch_tag")              \
   F(dot_catch, ".catch")                        \
   F(empty, "")                                  \
diff --git a/src/ast/scopes.cc b/src/ast/scopes.cc
index 0cae428..62be325 100644
--- a/src/ast/scopes.cc
+++ b/src/ast/scopes.cc
@@ -110,15 +110,10 @@
 }
 
 DeclarationScope::DeclarationScope(Zone* zone,
-                                   AstValueFactory* ast_value_factory,
-                                   REPLMode repl_mode)
-    : Scope(zone),
-      function_kind_(repl_mode == REPLMode::kYes ? kAsyncFunction
-                                                 : kNormalFunction),
-      params_(4, zone) {
+                                   AstValueFactory* ast_value_factory)
+    : Scope(zone), function_kind_(kNormalFunction), params_(4, zone) {
   DCHECK_EQ(scope_type_, SCRIPT_SCOPE);
   SetDefaults();
-  is_repl_mode_scope_ = repl_mode == REPLMode::kYes;
   receiver_ = DeclareDynamicGlobal(ast_value_factory->this_string(),
                                    THIS_VARIABLE, this);
 }
@@ -673,7 +668,7 @@
 
 Variable* DeclarationScope::DeclareGeneratorObjectVar(
     const AstRawString* name) {
-  DCHECK(is_function_scope() || is_module_scope() || is_repl_mode_scope());
+  DCHECK(is_function_scope() || is_module_scope());
   DCHECK_NULL(generator_object_var());
 
   Variable* result = EnsureRareData()->generator_object =
diff --git a/src/ast/scopes.h b/src/ast/scopes.h
index 355752c..3d09950 100644
--- a/src/ast/scopes.h
+++ b/src/ast/scopes.h
@@ -537,10 +537,7 @@
   bool is_debug_evaluate_scope() const { return is_debug_evaluate_scope_; }
   bool IsSkippableFunctionScope();
   void set_is_repl_mode_scope() { is_repl_mode_scope_ = true; }
-  bool is_repl_mode_scope() const {
-    DCHECK_IMPLIES(is_repl_mode_scope_, is_script_scope());
-    return is_repl_mode_scope_;
-  }
+  bool is_repl_mode_scope() const { return is_repl_mode_scope_; }
 
   bool RemoveInnerScope(Scope* inner_scope) {
     DCHECK_NOT_NULL(inner_scope);
@@ -771,8 +768,7 @@
   DeclarationScope(Zone* zone, ScopeType scope_type,
                    Handle<ScopeInfo> scope_info);
   // Creates a script scope.
-  DeclarationScope(Zone* zone, AstValueFactory* ast_value_factory,
-                   REPLMode repl_mode = REPLMode::kNo);
+  DeclarationScope(Zone* zone, AstValueFactory* ast_value_factory);
 
   FunctionKind function_kind() const { return function_kind_; }
 
@@ -958,9 +954,9 @@
 
   // The variable holding the JSGeneratorObject for generator, async
   // and async generator functions, and modules. Only valid for
-  // function, module and REPL mode script scopes.
+  // function and module scopes.
   Variable* generator_object_var() const {
-    DCHECK(is_function_scope() || is_module_scope() || is_repl_mode_scope());
+    DCHECK(is_function_scope() || is_module_scope());
     return GetRareVariable(RareVariable::kGeneratorObject);
   }
 
diff --git a/src/ast/variables.cc b/src/ast/variables.cc
index da2d838..5afd665 100644
--- a/src/ast/variables.cc
+++ b/src/ast/variables.cc
@@ -31,6 +31,7 @@
 }
 
 bool Variable::IsReplGlobalLet() const {
+  DCHECK_IMPLIES(scope()->is_repl_mode_scope(), scope()->is_script_scope());
   return scope()->is_repl_mode_scope() && mode() == VariableMode::kLet;
 }
 
diff --git a/src/codegen/compiler.cc b/src/codegen/compiler.cc
index bb5f178..b58b3ea 100644
--- a/src/codegen/compiler.cc
+++ b/src/codegen/compiler.cc
@@ -135,6 +135,12 @@
                              outer_origin_options.IsOpaque());
 }
 
+REPLMode OriginReplMode(Object script) {
+  if (!script.IsScript()) return REPLMode::kNo;
+
+  return Script::cast(script).is_repl_mode() ? REPLMode::kYes : REPLMode::kNo;
+}
+
 }  // namespace
 
 // ----------------------------------------------------------------------------
@@ -1549,8 +1555,9 @@
     allow_eval_cache = true;
   } else {
     ParseInfo parse_info(isolate);
-    script = parse_info.CreateScript(
-        isolate, source, OriginOptionsForEval(outer_info->script()));
+    script = parse_info.CreateScript(isolate, source,
+                                     OriginOptionsForEval(outer_info->script()),
+                                     OriginReplMode(outer_info->script()));
     script->set_compilation_type(Script::COMPILATION_TYPE_EVAL);
     script->set_eval_from_shared(*outer_info);
     if (eval_position == kNoSourcePosition) {
diff --git a/src/init/heap-symbols.h b/src/init/heap-symbols.h
index 02638c0..8041b49 100644
--- a/src/init/heap-symbols.h
+++ b/src/init/heap-symbols.h
@@ -174,7 +174,6 @@
   V(_, dot_iterator_string, ".iterator")                             \
   V(_, dot_promise_string, ".promise")                               \
   V(_, dot_result_string, ".result")                                 \
-  V(_, dot_repl_result_string, ".repl_result")                       \
   V(_, dot_string, ".")                                              \
   V(_, dot_switch_tag_string, ".switch_tag")                         \
   V(_, dotAll_string, "dotAll")                                      \
diff --git a/src/inspector/injected-script.cc b/src/inspector/injected-script.cc
index b2c7702..6afc648 100644
--- a/src/inspector/injected-script.cc
+++ b/src/inspector/injected-script.cc
@@ -68,8 +68,7 @@
   static bool add(V8InspectorSessionImpl* session,
                   v8::Local<v8::Context> context, v8::Local<v8::Value> value,
                   int executionContextId, const String16& objectGroup,
-                  WrapMode wrapMode, bool replMode,
-                  EvaluateCallback* callback) {
+                  WrapMode wrapMode, EvaluateCallback* callback) {
     v8::Local<v8::Promise::Resolver> resolver;
     if (!v8::Promise::Resolver::New(context).ToLocal(&resolver)) {
       callback->sendFailure(Response::InternalError());
@@ -83,18 +82,21 @@
     v8::Local<v8::Promise> promise = resolver->GetPromise();
     V8InspectorImpl* inspector = session->inspector();
     ProtocolPromiseHandler* handler = new ProtocolPromiseHandler(
-        session, executionContextId, objectGroup, wrapMode, replMode, callback);
+        session, executionContextId, objectGroup, wrapMode, callback);
     v8::Local<v8::Value> wrapper = handler->m_wrapper.Get(inspector->isolate());
     v8::Local<v8::Function> thenCallbackFunction =
         v8::Function::New(context, thenCallback, wrapper, 0,
                           v8::ConstructorBehavior::kThrow)
             .ToLocalChecked();
+    if (promise->Then(context, thenCallbackFunction).IsEmpty()) {
+      callback->sendFailure(Response::InternalError());
+      return false;
+    }
     v8::Local<v8::Function> catchCallbackFunction =
         v8::Function::New(context, catchCallback, wrapper, 0,
                           v8::ConstructorBehavior::kThrow)
             .ToLocalChecked();
-    if (promise->Then(context, thenCallbackFunction, catchCallbackFunction)
-            .IsEmpty()) {
+    if (promise->Catch(context, catchCallbackFunction).IsEmpty()) {
       callback->sendFailure(Response::InternalError());
       return false;
     }
@@ -102,13 +104,6 @@
   }
 
  private:
-  static v8::Local<v8::String> GetDotReplResultString(v8::Isolate* isolate) {
-    // TODO(szuend): Cache the string in a v8::Persistent handle.
-    return v8::String::NewFromOneByte(
-               isolate, reinterpret_cast<const uint8_t*>(".repl_result"))
-        .ToLocalChecked();
-  }
-
   static void thenCallback(const v8::FunctionCallbackInfo<v8::Value>& info) {
     ProtocolPromiseHandler* handler = static_cast<ProtocolPromiseHandler*>(
         info.Data().As<v8::External>()->Value());
@@ -135,15 +130,13 @@
 
   ProtocolPromiseHandler(V8InspectorSessionImpl* session,
                          int executionContextId, const String16& objectGroup,
-                         WrapMode wrapMode, bool replMode,
-                         EvaluateCallback* callback)
+                         WrapMode wrapMode, EvaluateCallback* callback)
       : m_inspector(session->inspector()),
         m_sessionId(session->sessionId()),
         m_contextGroupId(session->contextGroupId()),
         m_executionContextId(executionContextId),
         m_objectGroup(objectGroup),
         m_wrapMode(wrapMode),
-        m_replMode(replMode),
         m_callback(std::move(callback)),
         m_wrapper(m_inspector->isolate(),
                   v8::External::New(m_inspector->isolate(), this)) {
@@ -161,40 +154,19 @@
     }
   }
 
-  void thenCallback(v8::Local<v8::Value> value) {
+  void thenCallback(v8::Local<v8::Value> result) {
     V8InspectorSessionImpl* session =
         m_inspector->sessionById(m_contextGroupId, m_sessionId);
     if (!session) return;
     InjectedScript::ContextScope scope(session, m_executionContextId);
     Response response = scope.initialize();
     if (!response.isSuccess()) return;
-
-    std::unique_ptr<EvaluateCallback> callback =
-        scope.injectedScript()->takeEvaluateCallback(m_callback);
-    if (!callback) return;
-
-    // In REPL mode the result is additionally wrapped in an object.
-    // The evaluation result can be found at ".repl_result".
-    v8::Local<v8::Value> result = value;
-    if (m_replMode) {
-      v8::Local<v8::Object> object;
-      if (!result->ToObject(scope.context()).ToLocal(&object)) {
-        callback->sendFailure(response);
-        return;
-      }
-
-      v8::Local<v8::String> name =
-          GetDotReplResultString(m_inspector->isolate());
-      if (!object->Get(scope.context(), name).ToLocal(&result)) {
-        callback->sendFailure(response);
-        return;
-      }
-    }
-
     if (m_objectGroup == "console") {
       scope.injectedScript()->setLastEvaluationResult(result);
     }
-
+    std::unique_ptr<EvaluateCallback> callback =
+        scope.injectedScript()->takeEvaluateCallback(m_callback);
+    if (!callback) return;
     std::unique_ptr<protocol::Runtime::RemoteObject> wrappedValue;
     response = scope.injectedScript()->wrapObject(result, m_objectGroup,
                                                   m_wrapMode, &wrappedValue);
@@ -240,18 +212,10 @@
     if (!stack) {
       stack = m_inspector->debugger()->captureStackTrace(true);
     }
-
-    // REPL mode implicitly handles the script like an async function.
-    // Do not prepend the '(in promise)' prefix for these exceptions since that
-    // would be confusing for the user. The stringified error is part of the
-    // exception and does not need to be added in REPL mode, otherwise it would
-    // be printed twice.
-    String16 exceptionDetailsText =
-        m_replMode ? "Uncaught" : "Uncaught (in promise)" + message;
     std::unique_ptr<protocol::Runtime::ExceptionDetails> exceptionDetails =
         protocol::Runtime::ExceptionDetails::create()
             .setExceptionId(m_inspector->nextExceptionId())
-            .setText(exceptionDetailsText)
+            .setText("Uncaught (in promise)" + message)
             .setLineNumber(stack && !stack->isEmpty() ? stack->topLineNumber()
                                                       : 0)
             .setColumnNumber(
@@ -290,7 +254,6 @@
   int m_executionContextId;
   String16 m_objectGroup;
   WrapMode m_wrapMode;
-  bool m_replMode;
   EvaluateCallback* m_callback;
   v8::Global<v8::External> m_wrapper;
 };
@@ -570,7 +533,7 @@
 
 void InjectedScript::addPromiseCallback(
     V8InspectorSessionImpl* session, v8::MaybeLocal<v8::Value> value,
-    const String16& objectGroup, WrapMode wrapMode, bool replMode,
+    const String16& objectGroup, WrapMode wrapMode,
     std::unique_ptr<EvaluateCallback> callback) {
   if (value.IsEmpty()) {
     callback->sendFailure(Response::InternalError());
@@ -578,10 +541,9 @@
   }
   v8::MicrotasksScope microtasksScope(m_context->isolate(),
                                       v8::MicrotasksScope::kRunMicrotasks);
-  if (ProtocolPromiseHandler::add(session, m_context->context(),
-                                  value.ToLocalChecked(),
-                                  m_context->contextId(), objectGroup, wrapMode,
-                                  replMode, callback.get())) {
+  if (ProtocolPromiseHandler::add(
+          session, m_context->context(), value.ToLocalChecked(),
+          m_context->contextId(), objectGroup, wrapMode, callback.get())) {
     m_evaluateCallbacks.insert(callback.release());
   }
 }
diff --git a/src/inspector/injected-script.h b/src/inspector/injected-script.h
index 0797d60..080769f 100644
--- a/src/inspector/injected-script.h
+++ b/src/inspector/injected-script.h
@@ -108,7 +108,6 @@
   void addPromiseCallback(V8InspectorSessionImpl* session,
                           v8::MaybeLocal<v8::Value> value,
                           const String16& objectGroup, WrapMode wrapMode,
-                          bool replMode,
                           std::unique_ptr<EvaluateCallback> callback);
 
   Response findObject(const RemoteObjectId&, v8::Local<v8::Value>*) const;
diff --git a/src/inspector/v8-runtime-agent-impl.cc b/src/inspector/v8-runtime-agent-impl.cc
index ed6cebe..1ae7952 100644
--- a/src/inspector/v8-runtime-agent-impl.cc
+++ b/src/inspector/v8-runtime-agent-impl.cc
@@ -196,7 +196,7 @@
   }
 
   scope.injectedScript()->addPromiseCallback(
-      session, maybeResultValue, objectGroup, wrapMode, false /* replMode */,
+      session, maybeResultValue, objectGroup, wrapMode,
       EvaluateCallbackWrapper<V8RuntimeAgentImpl::CallFunctionOnCallback>::wrap(
           std::move(callback)));
 }
@@ -234,8 +234,8 @@
     Maybe<bool> includeCommandLineAPI, Maybe<bool> silent,
     Maybe<int> executionContextId, Maybe<bool> returnByValue,
     Maybe<bool> generatePreview, Maybe<bool> userGesture,
-    Maybe<bool> maybeAwaitPromise, Maybe<bool> throwOnSideEffect,
-    Maybe<double> timeout, Maybe<bool> disableBreaks, Maybe<bool> maybeReplMode,
+    Maybe<bool> awaitPromise, Maybe<bool> throwOnSideEffect,
+    Maybe<double> timeout, Maybe<bool> disableBreaks, Maybe<bool> replMode,
     std::unique_ptr<EvaluateCallback> callback) {
   TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"),
                "EvaluateScript");
@@ -259,8 +259,6 @@
 
   if (includeCommandLineAPI.fromMaybe(false)) scope.installCommandLineAPI();
 
-  const bool replMode = maybeReplMode.fromMaybe(false);
-
   // Temporarily enable allow evals for inspector.
   scope.allowCodeGenerationFromStrings();
   v8::MaybeLocal<v8::Value> maybeResultValue;
@@ -284,8 +282,8 @@
     }
     const v8::Local<v8::String> source =
         toV8String(m_inspector->isolate(), expression);
-    maybeResultValue = v8::debug::EvaluateGlobal(m_inspector->isolate(), source,
-                                                 mode, replMode);
+    maybeResultValue = v8::debug::EvaluateGlobal(
+        m_inspector->isolate(), source, mode, replMode.fromMaybe(false));
   }  // Run microtasks before returning result.
 
   // Re-initialize after running client's code, as it could have destroyed
@@ -299,17 +297,14 @@
   WrapMode mode = generatePreview.fromMaybe(false) ? WrapMode::kWithPreview
                                                    : WrapMode::kNoPreview;
   if (returnByValue.fromMaybe(false)) mode = WrapMode::kForceValue;
-
-  // REPL mode always returns a promise that must be awaited.
-  const bool await = replMode || maybeAwaitPromise.fromMaybe(false);
-  if (!await || scope.tryCatch().HasCaught()) {
+  if (!awaitPromise.fromMaybe(false) || scope.tryCatch().HasCaught()) {
     wrapEvaluateResultAsync(scope.injectedScript(), maybeResultValue,
                             scope.tryCatch(), objectGroup.fromMaybe(""), mode,
                             callback.get());
     return;
   }
   scope.injectedScript()->addPromiseCallback(
-      m_session, maybeResultValue, objectGroup.fromMaybe(""), mode, replMode,
+      m_session, maybeResultValue, objectGroup.fromMaybe(""), mode,
       EvaluateCallbackWrapper<EvaluateCallback>::wrap(std::move(callback)));
 }
 
@@ -333,7 +328,6 @@
   if (returnByValue.fromMaybe(false)) mode = WrapMode::kForceValue;
   scope.injectedScript()->addPromiseCallback(
       m_session, scope.object(), scope.objectGroupName(), mode,
-      false /* replMode */,
       EvaluateCallbackWrapper<AwaitPromiseCallback>::wrap(std::move(callback)));
 }
 
@@ -594,7 +588,7 @@
   }
   scope.injectedScript()->addPromiseCallback(
       m_session, maybeResultValue.ToLocalChecked(), objectGroup.fromMaybe(""),
-      mode, false /* replMode */,
+      mode,
       EvaluateCallbackWrapper<RunScriptCallback>::wrap(std::move(callback)));
 }
 
diff --git a/src/interpreter/bytecode-generator.cc b/src/interpreter/bytecode-generator.cc
index 8c48065..c25b17a 100644
--- a/src/interpreter/bytecode-generator.cc
+++ b/src/interpreter/bytecode-generator.cc
@@ -4413,8 +4413,7 @@
   // multiple debug events for the same uncaught exception. There is no point
   // in the body of an async function where catch prediction is
   // HandlerTable::UNCAUGHT.
-  DCHECK(catch_prediction() != HandlerTable::UNCAUGHT ||
-         info()->scope()->is_repl_mode_scope());
+  DCHECK(catch_prediction() != HandlerTable::UNCAUGHT);
 
   {
     // Await(operand) and suspend.
diff --git a/src/objects/contexts.cc b/src/objects/contexts.cc
index 71da3f0..fff68b4 100644
--- a/src/objects/contexts.cc
+++ b/src/objects/contexts.cc
@@ -503,10 +503,6 @@
 void NativeContext::SetDetachedWindowReason(
     v8::Context::DetachedWindowReason reason) {
   set_detached_window_reason(Smi::FromEnum(reason));
-
-  Isolate* isolate = GetIsolate();
-  set_detached_window_time_in_seconds(
-      Smi::FromInt(static_cast<int>(isolate->time_millis_since_init() / 1000)));
 }
 
 v8::Context::DetachedWindowReason NativeContext::GetDetachedWindowReason()
@@ -515,11 +511,5 @@
       detached_window_reason().value());
 }
 
-int NativeContext::SecondsSinceDetachedWindow() const {
-  Isolate* isolate = GetIsolate();
-  return static_cast<int>(isolate->time_millis_since_init() / 1000 -
-                          detached_window_time_in_seconds().value());
-}
-
 }  // namespace internal
 }  // namespace v8
diff --git a/src/objects/contexts.h b/src/objects/contexts.h
index bef5d64..c6609e2 100644
--- a/src/objects/contexts.h
+++ b/src/objects/contexts.h
@@ -369,7 +369,6 @@
   V(WEAKSET_ADD_INDEX, JSFunction, weakset_add)                                \
   V(OSR_CODE_CACHE_INDEX, WeakFixedArray, osr_code_cache)                      \
   V(DETACHED_WINDOW_REASON_INDEX, Smi, detached_window_reason)                 \
-  V(DETACHED_WINDOW_TIME_INDEX, Smi, detached_window_time_in_seconds)          \
   NATIVE_CONTEXT_INTRINSIC_FUNCTIONS(V)
 
 // A table of all script contexts. Every loaded top-level script with top-level
@@ -735,8 +734,6 @@
 
   void SetDetachedWindowReason(v8::Context::DetachedWindowReason reason);
   v8::Context::DetachedWindowReason GetDetachedWindowReason() const;
-  // This can be off up to 1s in each direction.
-  int SecondsSinceDetachedWindow() const;
 
  private:
   STATIC_ASSERT(OffsetOfElementAt(EMBEDDER_DATA_INDEX) ==
diff --git a/src/parsing/parser-base.h b/src/parsing/parser-base.h
index d58f92e..e67332a 100644
--- a/src/parsing/parser-base.h
+++ b/src/parsing/parser-base.h
@@ -658,9 +658,8 @@
     return ast_value_factory->GetOneByteString(name.c_str());
   }
 
-  DeclarationScope* NewScriptScope(REPLMode repl_mode) const {
-    return new (zone())
-        DeclarationScope(zone(), ast_value_factory(), repl_mode);
+  DeclarationScope* NewScriptScope() const {
+    return new (zone()) DeclarationScope(zone(), ast_value_factory());
   }
 
   DeclarationScope* NewVarblockScope() const {
diff --git a/src/parsing/parser.cc b/src/parsing/parser.cc
index ee0b4bc..48eb89b 100644
--- a/src/parsing/parser.cc
+++ b/src/parsing/parser.cc
@@ -438,10 +438,10 @@
 void Parser::InitializeEmptyScopeChain(ParseInfo* info) {
   DCHECK_NULL(original_scope_);
   DCHECK_NULL(info->script_scope());
-  DeclarationScope* script_scope =
-      NewScriptScope(info->is_repl_mode() ? REPLMode::kYes : REPLMode::kNo);
+  DeclarationScope* script_scope = NewScriptScope();
   info->set_script_scope(script_scope);
   original_scope_ = script_scope;
+  if (info->is_repl_mode()) script_scope->set_is_repl_mode_scope();
 }
 
 void Parser::DeserializeScopeChain(
@@ -612,8 +612,6 @@
       }
     } else if (info->is_wrapped_as_function()) {
       ParseWrapped(isolate, info, &body, scope, zone());
-    } else if (info->is_repl_mode()) {
-      ParseREPLProgram(info, &body, scope);
     } else {
       // Don't count the mode in the use counters--give the program a chance
       // to enable script-wide strict mode below.
@@ -714,59 +712,6 @@
   body->Add(return_statement);
 }
 
-void Parser::ParseREPLProgram(ParseInfo* info, ScopedPtrList<Statement>* body,
-                              DeclarationScope* scope) {
-  // REPL scripts are handled nearly the same way as the body of an async
-  // function. The difference is the value used to resolve the async
-  // promise.
-  // For a REPL script this is the completion value of the
-  // script instead of the expression of some "return" statement. The
-  // completion value of the script is obtained by manually invoking
-  // the {Rewriter} which will return a VariableProxy referencing the
-  // result.
-  DCHECK(info->is_repl_mode());
-  this->scope()->SetLanguageMode(info->language_mode());
-  PrepareGeneratorVariables();
-
-  BlockT block = impl()->NullBlock();
-  {
-    StatementListT statements(pointer_buffer());
-    ParseStatementList(&statements, Token::EOS);
-    block = factory()->NewBlock(true, statements);
-  }
-
-  base::Optional<VariableProxy*> maybe_result =
-      Rewriter::RewriteBody(info, scope, block->statements());
-  Expression* result_value =
-      (maybe_result && *maybe_result)
-          ? static_cast<Expression*>(*maybe_result)
-          : factory()->NewUndefinedLiteral(kNoSourcePosition);
-
-  impl()->RewriteAsyncFunctionBody(body, block, WrapREPLResult(result_value));
-}
-
-Expression* Parser::WrapREPLResult(Expression* value) {
-  // REPL scripts additionally wrap the ".result" variable in an
-  // object literal:
-  //
-  //     return %_AsyncFunctionResolve(
-  //                .generator_object, {.repl_result: .result});
-  //
-  // Should ".result" be a resolved promise itself, the async return
-  // would chain the promises and return the resolve value instead of
-  // the promise.
-
-  Literal* property_name = factory()->NewStringLiteral(
-      ast_value_factory()->dot_repl_result_string(), kNoSourcePosition);
-  ObjectLiteralProperty* property =
-      factory()->NewObjectLiteralProperty(property_name, value, true);
-
-  ScopedPtrList<ObjectLiteralProperty> properties(pointer_buffer());
-  properties.Add(property);
-  return factory()->NewObjectLiteral(properties, false, kNoSourcePosition,
-                                     false);
-}
-
 FunctionLiteral* Parser::ParseFunction(Isolate* isolate, ParseInfo* info,
                                        Handle<SharedFunctionInfo> shared_info) {
   // It's OK to use the Isolate & counters here, since this function is only
diff --git a/src/parsing/parser.h b/src/parsing/parser.h
index 0a6dcaf..6f570b8 100644
--- a/src/parsing/parser.h
+++ b/src/parsing/parser.h
@@ -225,10 +225,6 @@
                     ScopedPtrList<Statement>* body, DeclarationScope* scope,
                     Zone* zone);
 
-  void ParseREPLProgram(ParseInfo* info, ScopedPtrList<Statement>* body,
-                        DeclarationScope* scope);
-  Expression* WrapREPLResult(Expression* value);
-
   ZonePtrList<const AstRawString>* PrepareWrappedArguments(Isolate* isolate,
                                                            ParseInfo* info,
                                                            Zone* zone);
diff --git a/src/parsing/preparser.cc b/src/parsing/preparser.cc
index 5ed443f..bc046a4 100644
--- a/src/parsing/preparser.cc
+++ b/src/parsing/preparser.cc
@@ -70,7 +70,7 @@
 
 PreParser::PreParseResult PreParser::PreParseProgram() {
   DCHECK_NULL(scope_);
-  DeclarationScope* scope = NewScriptScope(REPLMode::kNo);
+  DeclarationScope* scope = NewScriptScope();
 #ifdef DEBUG
   scope->set_is_being_lazily_parsed(true);
 #endif
diff --git a/src/parsing/rewriter.cc b/src/parsing/rewriter.cc
index 013ea68..724a4ca 100644
--- a/src/parsing/rewriter.cc
+++ b/src/parsing/rewriter.cc
@@ -360,6 +360,10 @@
 // Assumes code has been parsed.  Mutates the AST, so the AST should not
 // continue to be used in the case of failure.
 bool Rewriter::Rewrite(ParseInfo* info) {
+  DisallowHeapAllocation no_allocation;
+  DisallowHandleAllocation no_handles;
+  DisallowHandleDereference no_deref;
+
   RuntimeCallTimerScope runtimeTimer(
       info->runtime_call_stats(),
       RuntimeCallCounterId::kCompileRewriteReturnResult,
@@ -371,22 +375,12 @@
   DCHECK_NOT_NULL(scope);
   DCHECK_EQ(scope, scope->GetClosureScope());
 
-  if (scope->is_repl_mode_scope()) return true;
   if (!(scope->is_script_scope() || scope->is_eval_scope() ||
         scope->is_module_scope())) {
     return true;
   }
 
   ZonePtrList<Statement>* body = function->body();
-  return RewriteBody(info, scope, body).has_value();
-}
-
-base::Optional<VariableProxy*> Rewriter::RewriteBody(
-    ParseInfo* info, Scope* scope, ZonePtrList<Statement>* body) {
-  DisallowHeapAllocation no_allocation;
-  DisallowHandleAllocation no_handles;
-  DisallowHandleDereference no_deref;
-
   DCHECK_IMPLIES(scope->is_module_scope(), !body->is_empty());
   if (!body->is_empty()) {
     Variable* result = scope->AsDeclarationScope()->NewTemporary(
@@ -398,19 +392,17 @@
     DCHECK_IMPLIES(scope->is_module_scope(), processor.result_assigned());
     if (processor.result_assigned()) {
       int pos = kNoSourcePosition;
-      VariableProxy* result_value =
+      Expression* result_value =
           processor.factory()->NewVariableProxy(result, pos);
-      if (!info->is_repl_mode()) {
-        Statement* result_statement =
-            processor.factory()->NewReturnStatement(result_value, pos);
-        body->Add(result_statement, info->zone());
-      }
-      return result_value;
+      Statement* result_statement =
+          processor.factory()->NewReturnStatement(result_value, pos);
+      body->Add(result_statement, info->zone());
     }
 
-    if (processor.HasStackOverflow()) return base::nullopt;
+    if (processor.HasStackOverflow()) return false;
   }
-  return nullptr;
+
+  return true;
 }
 
 }  // namespace internal
diff --git a/src/parsing/rewriter.h b/src/parsing/rewriter.h
index e820c0e..0ec323a 100644
--- a/src/parsing/rewriter.h
+++ b/src/parsing/rewriter.h
@@ -6,8 +6,6 @@
 #define V8_PARSING_REWRITER_H_
 
 #include "src/base/macros.h"
-#include "src/base/optional.h"
-#include "src/zone/zone.h"
 
 namespace v8 {
 namespace internal {
@@ -18,8 +16,6 @@
 class Parser;
 class DeclarationScope;
 class Scope;
-class Statement;
-class VariableProxy;
 
 class Rewriter {
  public:
@@ -30,13 +26,6 @@
   // Assumes code has been parsed and scopes have been analyzed.  Mutates the
   // AST, so the AST should not continue to be used in the case of failure.
   V8_EXPORT_PRIVATE static bool Rewrite(ParseInfo* info);
-
-  // Helper that does the actual re-writing. Extracted so REPL scripts can
-  // rewrite the body but then use the ".result" VariableProxy to resolve
-  // the async promise that is the result of running a REPL script.
-  // Returns base::nullopt in case something went wrong.
-  static base::Optional<VariableProxy*> RewriteBody(
-      ParseInfo* info, Scope* scope, ZonePtrList<Statement>* body);
 };
 
 
diff --git a/src/runtime/runtime-internal.cc b/src/runtime/runtime-internal.cc
index 206f6ce..e253a19 100644
--- a/src/runtime/runtime-internal.cc
+++ b/src/runtime/runtime-internal.cc
@@ -87,38 +87,9 @@
   DCHECK_EQ(0, args.length());
   Handle<NativeContext> native_context(isolate->context().native_context(),
                                        isolate);
-  v8::Isolate::UseCounterFeature counter_main;
-  v8::Isolate::UseCounterFeature counter_10s;
-  v8::Isolate::UseCounterFeature counter_1min;
-  switch (native_context->GetDetachedWindowReason()) {
-    case v8::Context::kWindowNotDetached:
-      // We should never get here. Just exit early in case we do.
-      return ReadOnlyRoots(isolate).undefined_value();
-    case v8::Context::kDetachedWindowByNavigation:
-      counter_main = v8::Isolate::kCallInDetachedWindowByNavigation;
-      counter_10s = v8::Isolate::kCallInDetachedWindowByNavigationAfter10s;
-      counter_1min = v8::Isolate::kCallInDetachedWindowByNavigationAfter1min;
-      break;
-    case v8::Context::kDetachedWindowByClosing:
-      counter_main = v8::Isolate::kCallInDetachedWindowByClosing;
-      counter_10s = v8::Isolate::kCallInDetachedWindowByClosingAfter10s;
-      counter_1min = v8::Isolate::kCallInDetachedWindowByClosingAfter1min;
-      break;
-    case v8::Context::kDetachedWindowByOtherReason:
-      counter_main = v8::Isolate::kCallInDetachedWindowByOtherReason;
-      counter_10s = v8::Isolate::kCallInDetachedWindowByOtherReasonAfter10s;
-      counter_1min = v8::Isolate::kCallInDetachedWindowByOtherReasonAfter1min;
-      break;
-  }
-  isolate->CountUsage(counter_main);
-  // This can be off by up to 1s in each direction, but that's ok.
-  int secs_passed = native_context->SecondsSinceDetachedWindow();
-  if (secs_passed >= 10) {
-    isolate->CountUsage(counter_10s);
-  }
-  if (secs_passed >= 60) {
-    isolate->CountUsage(counter_1min);
-  }
+  // TODO(bartekn,chromium:1018156): Report this to Blink, for it to emit it
+  // via UKM. Use native_context->detached_window_reason().value()
+  // This will be addressed as the first step after this CL lands.
 
   // The return value isn't needed, but RUNTIME_FUNCTION sets it up.
   return ReadOnlyRoots(isolate).undefined_value();
diff --git a/test/debugger/debug/debug-evaluate-repl-mode-await.js b/test/debugger/debug/debug-evaluate-repl-mode-await.js
deleted file mode 100644
index 768c86b..0000000
--- a/test/debugger/debug/debug-evaluate-repl-mode-await.js
+++ /dev/null
@@ -1,46 +0,0 @@
-// Copyright 2019 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.
-
-Debug = debug.Debug
-
-const evaluate = Debug.evaluateGlobalREPL;
-
-(async () => {
-    // Test that the completion value of the REPL script is the resolve value of the
-    // promise returned by evalute.
-    let result = evaluate('5;');
-    assertPromiseResult(result, (value) => {
-        assertEquals(5, value);
-    }, assertUnreachable);
-
-    // Test that top-level await in REPL mode works.
-    result = evaluate('let x = await Promise.resolve(42);');
-    assertPromiseResult(result, (value) => {
-        assertEquals(undefined, value);
-        assertEquals(42, x);
-    }, assertUnreachable);
-
-    // Test that a throwing REPL script results in a rejected promise.
-    result = evaluate('throw new Error("ba dum tsh");');
-    assertPromiseResult(result, assertUnreachable, (error) => {
-        assertEquals("ba dum tsh", error.message);
-    });
-
-    // Test that a rejected promise throws.
-    result = evaluate('await Promise.reject("Reject promise!");');
-    assertPromiseResult(result, assertUnreachable, (error) => {
-        assertEquals('Reject promise!', error);
-    });
-
-    // Test that we can bind a promise in REPL mode.
-    await evaluate('let y = Promise.resolve(21);');
-    assertPromiseResult(y, (value) => {
-        assertEquals(21, value);
-    }, assertUnreachable);
-})().then(() => {
-    print("Async test completed successfully.");
-}).catch(e => {
-    print(e.stack);
-    %AbortJS("Async test is failing");
-});
diff --git a/test/debugger/debug/debug-evaluate-repl-mode.js b/test/debugger/debug/debug-evaluate-repl-mode.js
index 4001033..139012b 100644
--- a/test/debugger/debug/debug-evaluate-repl-mode.js
+++ b/test/debugger/debug/debug-evaluate-repl-mode.js
@@ -7,56 +7,54 @@
 const evaluate = Debug.evaluateGlobalREPL;
 const evaluateNonREPL = (source) => Debug.evaluateGlobal(source, false).value();
 
-(async () => {
-
 // Declare let and get value
 let result;
-result = await evaluate("let x = 7;");
-result = await evaluate("x;");
+result = evaluate("let x = 7;");
+result = evaluate("x;");
 assertEquals(7, result);
 
 // Re-declare in the same script after declaration in another script.
-assertThrows(() => evaluate("let x = 8; let x = 9;"));
-result = await evaluate("x;");
+assertThrows(() => result = evaluate("let x = 8; let x = 9;"));
+result = evaluate("x;");
 assertEquals(7, result);
 
 // Re-declare let as let
-assertDoesNotThrow(async () => result = await evaluate("let x = 8;"));
-result = await evaluate("x;");
+assertDoesNotThrow(() => result = evaluate("let x = 8;"));
+result = evaluate("x;");
 assertEquals(8, result);
 
-await evaluate("let x = 8;");
+evaluate("let x = 8;");
 
 // Close over let. Inner function is only pre-parsed.
-result = await evaluate("function getter() { return x; }");
+result = evaluate("function getter() { return x; }");
 assertEquals(undefined, result);
-result = await evaluate("getter();");
+result = evaluate("getter();");
 assertEquals(8, result);
-result = await evaluate("x = 9;");
+result = evaluate("x = 9;");
 assertEquals(9, result);
-result = await evaluate("x;");
+result = evaluate("x;");
 assertEquals(9, result);
-result = await evaluate("getter();");
+result = evaluate("getter();");
 assertEquals(9, result);
 // Modifies the original x; does not create a new one/shadow.
-result = await evaluate("let x = 10;");
+result = evaluate("let x = 10;");
 assertEquals(undefined, result);
-result = await evaluate("x;");
+result = evaluate("x;");
 assertEquals(10, result);
-result = await evaluate("getter();");
+result = evaluate("getter();");
 assertEquals(10, result);
 
-await evaluate("let x = 10");
+evaluate("let x = 10");
 
 // Check store from an inner scope.
-result = await evaluate("{ let z; x = 11; } x;");
+result = evaluate("{ let z; x = 11; } x;");
 assertEquals(11, result);
 
 // Check re-declare from an inner scope does nothing.
-result = await evaluate("{ let z; let x = 12; } x;");
+result = evaluate("{ let z; let x = 12; } x;");
 assertEquals(11, result);
 
-assertThrowsAsync(evaluate("{ let qq = 10; } qq;"),
+assertThrows(() => result = evaluate("{ let qq = 10; } qq;"),
     ReferenceError, "qq is not defined");
 
 // Re-declare in the same script (no previous declaration).
@@ -66,30 +64,30 @@
 // Check TDZ; use before initialization.
 // Do not check exact error message, it depends on the path taken through
 // the IC machinery and changes sometimes, causing the test to be flaky.
-assertThrowsAsync(evaluate("a; let a = 7;"), ReferenceError);
-assertThrowsAsync(evaluate("a;"), ReferenceError);
+assertThrows(() => result = evaluate("a; let a = 7;"), ReferenceError);
+assertThrows(() => result = evaluate("a;"), ReferenceError);
 // This is different to non-REPL mode, which throws the kUndefined error here.
-assertThrowsAsync(evaluate("a = 7;"),
+assertThrows(() => result = evaluate("a = 7;"),
     ReferenceError, "Cannot access 'a' before initialization");
 
-result = await evaluate("let a = 8;");
+result = evaluate("let a = 8;");
 assertEquals(undefined, result);
-result = await evaluate("a;")
+result = evaluate("a;")
 assertEquals(8, result);
 
 // Check TDZ; store before initialization.
-assertThrowsAsync(evaluate("b = 10; let b;"),
+assertThrows(() => result = evaluate("b = 10; let b;"),
     ReferenceError, "Cannot access 'b' before initialization");
 // Check that b is still broken.
-assertThrowsAsync(evaluate("b = 10; let b;"),
+assertThrows(() => result = evaluate("b = 10; let b;"),
     ReferenceError, "Cannot access 'b' before initialization");
 // Check that b is still broken when the let defines a value.
-assertThrowsAsync(evaluate("b = 10; let b = 7;"),
+assertThrows(() => result = evaluate("b = 10; let b = 7;"),
     ReferenceError, "Cannot access 'b' before initialization");
-result = await evaluate("let b = 11;");
+result = evaluate("let b = 11;");
 assertEquals(undefined, result);
 // We fixed 'b'!
-result = await evaluate("b;");
+result = evaluate("b;");
 assertEquals(11, result);
 
 // Check that class works the same. Internally there is no difference between
@@ -107,14 +105,14 @@
 evaluate("let z = 10;");
 assertThrows(() => result = evaluate("const z = 9;"),
     SyntaxError, "Identifier 'z' has already been declared");
-result = await evaluate("z;");
+result = evaluate("z;");
 assertEquals(10, result);
 
 // Re-declare const as const
-result = await evaluate("const c = 10;");
+result = evaluate("const c = 10;");
 assertThrows(() => result = evaluate("const c = 11;"),
     SyntaxError, "Identifier 'c' has already been declared");
-result = await evaluate("c;");
+result = evaluate("c;");
 assertEquals(10, result);
 
 // Const vs. const in same script.
@@ -122,29 +120,29 @@
 SyntaxError, "Identifier 'd' has already been declared");
 
 // Close over const
-result = await evaluate("const e = 10; function closure() { return e; }");
-result = await evaluate("e;");
+result = evaluate("const e = 10; function closure() { return e; }");
+result = evaluate("e;");
 assertEquals(10, result);
 
 // Assign to const
-assertThrowsAsync(evaluate("e = 11;"),
+assertThrows(() => result = evaluate("e = 11;"),
     TypeError, "Assignment to constant variable.");
-result = await evaluate("e;");
+result = evaluate("e;");
 assertEquals(10, result);
-result = await evaluate("closure();");
+result = evaluate("closure();");
 assertEquals(10, result);
 
 // Assign to const in TDZ
-assertThrowsAsync(evaluate("f; const f = 11;"),
+assertThrows(() => result = evaluate("f; const f = 11;"),
     ReferenceError, "Cannot access 'f' before initialization");
-assertThrowsAsync(evaluate("f = 12;"),
+assertThrows(() => result = evaluate("f = 12;"),
     TypeError, "Assignment to constant variable.");
 
 // Re-declare const as let
-result = await evaluate("const g = 12;");
+result = evaluate("const g = 12;");
 assertThrows(() => result = evaluate("let g = 13;"),
     SyntaxError, "Identifier 'g' has already been declared");
-result = await evaluate("g;");
+result = evaluate("g;");
 assertEquals(12, result);
 
 // Let vs. const in the same script
@@ -154,61 +152,61 @@
     SyntaxError, "Identifier 'i' has already been declared");
 
 // Configurable properties of the global object can be re-declared as let.
-result = await evaluate(`Object.defineProperty(globalThis, 'j', {
+result = evaluate(`Object.defineProperty(globalThis, 'j', {
   value: 1,
   configurable: true
 });`);
-result = await evaluate("j;");
+result = evaluate("j;");
 assertEquals(1, result);
-result = await evaluate("let j = 2;");
-result = await evaluate("j;");
+result = evaluate("let j = 2;");
+result = evaluate("j;");
 assertEquals(2, result);
 
 // Non-configurable properties of the global object (also created by plain old
 // top-level var declarations) cannot be re-declared as let.
-result = await evaluate(`Object.defineProperty(globalThis, 'k', {
+result = evaluate(`Object.defineProperty(globalThis, 'k', {
   value: 1,
   configurable: false
 });`);
-result = await evaluate("k;");
+result = evaluate("k;");
 assertEquals(1, result);
 assertThrows(() => result = evaluate("let k = 2;"),
     SyntaxError, "Identifier 'k' has already been declared");
-result = await evaluate("k;");
+result = evaluate("k;");
 assertEquals(1, result);
 
 // ... Except if you do it in the same script.
-result = await evaluate(`Object.defineProperty(globalThis, 'k2', {
+result = evaluate(`Object.defineProperty(globalThis, 'k2', {
   value: 1,
   configurable: false
 });
 let k2 = 2;`);
-result = await evaluate("k2;");
+result = evaluate("k2;");
 assertEquals(2, result);
-result = await evaluate("globalThis.k2;");
+result = evaluate("globalThis.k2;");
 assertEquals(1, result);
 
 // But if the property is configurable then both versions are allowed.
-result = await evaluate(`Object.defineProperty(globalThis, 'k3', {
+result = evaluate(`Object.defineProperty(globalThis, 'k3', {
   value: 1,
   configurable: true
 });`);
-result = await evaluate("k3;");
+result = evaluate("k3;");
 assertEquals(1, result);
-result = await evaluate("let k3 = 2;");
-result = await evaluate("k3;");
+result = evaluate("let k3 = 2;");
+result = evaluate("k3;");
 assertEquals(2, result);
-result = await evaluate("globalThis.k3;");
+result = evaluate("globalThis.k3;");
 assertEquals(1, result);
 
-result = await evaluate(`Object.defineProperty(globalThis, 'k4', {
+result = evaluate(`Object.defineProperty(globalThis, 'k4', {
   value: 1,
   configurable: true
 });
 let k4 = 2;`);
-result = await evaluate("k4;");
+result = evaluate("k4;");
 assertEquals(2, result);
-result = await evaluate("globalThis.k4;");
+result = evaluate("globalThis.k4;");
 assertEquals(1, result);
 
 // Check var followed by let in the same script.
@@ -216,7 +214,7 @@
 SyntaxError, "Identifier 'k5' has already been declared");
 
 // In different scripts.
-result = await evaluate("var k6 = 1;");
+result = evaluate("var k6 = 1;");
 assertThrows(() => result = evaluate("let k6 = 2;"),
     SyntaxError, "Identifier 'k6' has already been declared");
 
@@ -230,20 +228,20 @@
     SyntaxError, "Identifier 'k8' has already been declared");
 
 // Check var followed by var in the same script.
-result = await evaluate("var k9 = 1; var k9 = 2;");
-result = await evaluate("k9;");
+result = evaluate("var k9 = 1; var k9 = 2;");
+result = evaluate("k9;");
 assertEquals(2, result);
 
 // In different scripts.
-result = await evaluate("var k10 = 1;");
-result = await evaluate("var k10 = 2;");
-result = await evaluate("k10;");
+result = evaluate("var k10 = 1;");
+result = evaluate("var k10 = 2;");
+result = evaluate("k10;");
 assertEquals(2, result);
-result = await evaluate("globalThis.k10;");
+result = evaluate("globalThis.k10;");
 assertEquals(2, result);
 
 // typeof should not throw for undeclared variables
-result = await evaluate("typeof k11");
+result = evaluate("typeof k11");
 assertEquals("undefined", result);
 
 // Test lets with names on the object prototype e.g. toString to make sure
@@ -254,7 +252,7 @@
 
 // We can still read let values cross-mode.
 result = evaluateNonREPL("let l1 = 1; let l2 = 2; let l3 = 3;");
-result = await evaluate("l1;");
+result = evaluate("l1;");
 assertEquals(1, result);
 
 // But we can't re-declare page script lets in a REPL script. We might want to
@@ -270,30 +268,30 @@
 
 // Re-declaring var across modes works.
 result = evaluateNonREPL("var l4 = 1; const l5 = 1;");
-result = await evaluate("var l4 = 2;");
-result = await evaluate("l4;");
+result = evaluate("var l4 = 2;");
+result = evaluate("l4;");
 assertEquals(2, result);
 
 // Const doesn't.
 assertThrows(() => result = evaluate("const l5 = 2;"),
     SyntaxError, "Identifier 'l5' has already been declared") ;
-result = await evaluate("l5;");
+result = evaluate("l5;");
 assertEquals(1, result);
 
 // Now REPL followed by non-REPL
-result = await evaluate("let l6 = 1; const l7 = 2; let l8 = 3;");
+result = evaluate("let l6 = 1; const l7 = 2; let l8 = 3;");
 result = evaluateNonREPL("l7;");
 assertEquals(2, result);
-result = evaluateNonREPL("l6;");
-assertEquals(1, result);
+// result = evaluateNonREPL("l6;");
+// assertEquals(1, result);
 
 // Check that the pattern of `l9; let l9;` does not throw for REPL scripts.
 // If REPL scripts behaved the same as normal scripts, this case would
 // re-introduce the hole in 'l9's script context slot, causing the IC and feedback
 // to 'lie' about the current state.
-result = await evaluate("let l9;");
-result = await evaluate("l9; let l9;"),
-assertEquals(undefined, await evaluate('l9;'));
+result = evaluate("let l9;");
+result = evaluate("l9; let l9;"),
+assertEquals(undefined, evaluate('l9;'));
 
 // Check that binding and re-declaring a function via let works.
 result = evaluate("let fn1 = function() { return 21; }");
@@ -306,9 +304,3 @@
 evaluate("let l10 = 42; function fn2() { return l10; }");
 evaluate("let l10 = 'foo';");
 assertEquals("foo", fn2());
-
-})().catch(e => {
-    print(e);
-    print(e.stack);
-    %AbortJS("Async test is failing");
-});
diff --git a/test/debugger/test-api.js b/test/debugger/test-api.js
index 73f16e0..5683c81 100644
--- a/test/debugger/test-api.js
+++ b/test/debugger/test-api.js
@@ -635,9 +635,7 @@
   }
 
   evaluateGlobalREPL(expr) {
-    return %RuntimeEvaluateREPL(expr).then(value => {
-      return value[".repl_result"];
-    });
+    return %RuntimeEvaluateREPL(expr);
   }
 
   eventDataException(params) {
diff --git a/tools/v8heapconst.py b/tools/v8heapconst.py
index 46b8ea8..a05ebb9 100644
--- a/tools/v8heapconst.py
+++ b/tools/v8heapconst.py
@@ -281,54 +281,54 @@
   ("read_only_space", 0x01149): (92, "EnumCacheMap"),
   ("read_only_space", 0x01199): (86, "ArrayBoilerplateDescriptionMap"),
   ("read_only_space", 0x01295): (95, "InterceptorInfoMap"),
-  ("read_only_space", 0x032ad): (71, "PromiseFulfillReactionJobTaskMap"),
-  ("read_only_space", 0x032d5): (72, "PromiseRejectReactionJobTaskMap"),
-  ("read_only_space", 0x032fd): (73, "CallableTaskMap"),
-  ("read_only_space", 0x03325): (74, "CallbackTaskMap"),
-  ("read_only_space", 0x0334d): (75, "PromiseResolveThenableJobTaskMap"),
-  ("read_only_space", 0x03375): (78, "FunctionTemplateInfoMap"),
-  ("read_only_space", 0x0339d): (79, "ObjectTemplateInfoMap"),
-  ("read_only_space", 0x033c5): (80, "AccessCheckInfoMap"),
-  ("read_only_space", 0x033ed): (81, "AccessorInfoMap"),
-  ("read_only_space", 0x03415): (82, "AccessorPairMap"),
-  ("read_only_space", 0x0343d): (83, "AliasedArgumentsEntryMap"),
-  ("read_only_space", 0x03465): (84, "AllocationMementoMap"),
-  ("read_only_space", 0x0348d): (87, "AsmWasmDataMap"),
-  ("read_only_space", 0x034b5): (88, "AsyncGeneratorRequestMap"),
-  ("read_only_space", 0x034dd): (90, "ClassPositionsMap"),
-  ("read_only_space", 0x03505): (91, "DebugInfoMap"),
-  ("read_only_space", 0x0352d): (94, "FunctionTemplateRareDataMap"),
-  ("read_only_space", 0x03555): (97, "InterpreterDataMap"),
-  ("read_only_space", 0x0357d): (98, "PromiseCapabilityMap"),
-  ("read_only_space", 0x035a5): (99, "PromiseReactionMap"),
-  ("read_only_space", 0x035cd): (100, "PrototypeInfoMap"),
-  ("read_only_space", 0x035f5): (101, "ScriptMap"),
-  ("read_only_space", 0x0361d): (105, "SourcePositionTableWithFrameCacheMap"),
-  ("read_only_space", 0x03645): (106, "SourceTextModuleInfoEntryMap"),
-  ("read_only_space", 0x0366d): (107, "StackFrameInfoMap"),
-  ("read_only_space", 0x03695): (108, "StackTraceFrameMap"),
-  ("read_only_space", 0x036bd): (109, "TemplateObjectDescriptionMap"),
-  ("read_only_space", 0x036e5): (110, "Tuple2Map"),
-  ("read_only_space", 0x0370d): (111, "Tuple3Map"),
-  ("read_only_space", 0x03735): (112, "WasmCapiFunctionDataMap"),
-  ("read_only_space", 0x0375d): (113, "WasmDebugInfoMap"),
-  ("read_only_space", 0x03785): (114, "WasmExceptionTagMap"),
-  ("read_only_space", 0x037ad): (115, "WasmExportedFunctionDataMap"),
-  ("read_only_space", 0x037d5): (116, "WasmIndirectFunctionTableMap"),
-  ("read_only_space", 0x037fd): (117, "WasmJSFunctionDataMap"),
-  ("read_only_space", 0x03825): (96, "InternalClassMap"),
-  ("read_only_space", 0x0384d): (103, "SmiPairMap"),
-  ("read_only_space", 0x03875): (102, "SmiBoxMap"),
-  ("read_only_space", 0x0389d): (104, "SortStateMap"),
-  ("read_only_space", 0x038c5): (85, "AllocationSiteWithWeakNextMap"),
-  ("read_only_space", 0x038ed): (85, "AllocationSiteWithoutWeakNextMap"),
-  ("read_only_space", 0x03915): (76, "LoadHandler1Map"),
-  ("read_only_space", 0x0393d): (76, "LoadHandler2Map"),
-  ("read_only_space", 0x03965): (76, "LoadHandler3Map"),
-  ("read_only_space", 0x0398d): (77, "StoreHandler0Map"),
-  ("read_only_space", 0x039b5): (77, "StoreHandler1Map"),
-  ("read_only_space", 0x039dd): (77, "StoreHandler2Map"),
-  ("read_only_space", 0x03a05): (77, "StoreHandler3Map"),
+  ("read_only_space", 0x03295): (71, "PromiseFulfillReactionJobTaskMap"),
+  ("read_only_space", 0x032bd): (72, "PromiseRejectReactionJobTaskMap"),
+  ("read_only_space", 0x032e5): (73, "CallableTaskMap"),
+  ("read_only_space", 0x0330d): (74, "CallbackTaskMap"),
+  ("read_only_space", 0x03335): (75, "PromiseResolveThenableJobTaskMap"),
+  ("read_only_space", 0x0335d): (78, "FunctionTemplateInfoMap"),
+  ("read_only_space", 0x03385): (79, "ObjectTemplateInfoMap"),
+  ("read_only_space", 0x033ad): (80, "AccessCheckInfoMap"),
+  ("read_only_space", 0x033d5): (81, "AccessorInfoMap"),
+  ("read_only_space", 0x033fd): (82, "AccessorPairMap"),
+  ("read_only_space", 0x03425): (83, "AliasedArgumentsEntryMap"),
+  ("read_only_space", 0x0344d): (84, "AllocationMementoMap"),
+  ("read_only_space", 0x03475): (87, "AsmWasmDataMap"),
+  ("read_only_space", 0x0349d): (88, "AsyncGeneratorRequestMap"),
+  ("read_only_space", 0x034c5): (90, "ClassPositionsMap"),
+  ("read_only_space", 0x034ed): (91, "DebugInfoMap"),
+  ("read_only_space", 0x03515): (94, "FunctionTemplateRareDataMap"),
+  ("read_only_space", 0x0353d): (97, "InterpreterDataMap"),
+  ("read_only_space", 0x03565): (98, "PromiseCapabilityMap"),
+  ("read_only_space", 0x0358d): (99, "PromiseReactionMap"),
+  ("read_only_space", 0x035b5): (100, "PrototypeInfoMap"),
+  ("read_only_space", 0x035dd): (101, "ScriptMap"),
+  ("read_only_space", 0x03605): (105, "SourcePositionTableWithFrameCacheMap"),
+  ("read_only_space", 0x0362d): (106, "SourceTextModuleInfoEntryMap"),
+  ("read_only_space", 0x03655): (107, "StackFrameInfoMap"),
+  ("read_only_space", 0x0367d): (108, "StackTraceFrameMap"),
+  ("read_only_space", 0x036a5): (109, "TemplateObjectDescriptionMap"),
+  ("read_only_space", 0x036cd): (110, "Tuple2Map"),
+  ("read_only_space", 0x036f5): (111, "Tuple3Map"),
+  ("read_only_space", 0x0371d): (112, "WasmCapiFunctionDataMap"),
+  ("read_only_space", 0x03745): (113, "WasmDebugInfoMap"),
+  ("read_only_space", 0x0376d): (114, "WasmExceptionTagMap"),
+  ("read_only_space", 0x03795): (115, "WasmExportedFunctionDataMap"),
+  ("read_only_space", 0x037bd): (116, "WasmIndirectFunctionTableMap"),
+  ("read_only_space", 0x037e5): (117, "WasmJSFunctionDataMap"),
+  ("read_only_space", 0x0380d): (96, "InternalClassMap"),
+  ("read_only_space", 0x03835): (103, "SmiPairMap"),
+  ("read_only_space", 0x0385d): (102, "SmiBoxMap"),
+  ("read_only_space", 0x03885): (104, "SortStateMap"),
+  ("read_only_space", 0x038ad): (85, "AllocationSiteWithWeakNextMap"),
+  ("read_only_space", 0x038d5): (85, "AllocationSiteWithoutWeakNextMap"),
+  ("read_only_space", 0x038fd): (76, "LoadHandler1Map"),
+  ("read_only_space", 0x03925): (76, "LoadHandler2Map"),
+  ("read_only_space", 0x0394d): (76, "LoadHandler3Map"),
+  ("read_only_space", 0x03975): (77, "StoreHandler0Map"),
+  ("read_only_space", 0x0399d): (77, "StoreHandler1Map"),
+  ("read_only_space", 0x039c5): (77, "StoreHandler2Map"),
+  ("read_only_space", 0x039ed): (77, "StoreHandler3Map"),
   ("map_space", 0x00119): (1057, "ExternalMap"),
   ("map_space", 0x00141): (1073, "JSMessageObjectMap"),
 }