Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(185)

Unified Diff: src/runtime/runtime-observe.cc

Issue 1909433003: Remove support for Object.observe (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebased Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/runtime/runtime-internal.cc ('k') | src/transitions-inl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/runtime/runtime-observe.cc
diff --git a/src/runtime/runtime-observe.cc b/src/runtime/runtime-observe.cc
deleted file mode 100644
index 0407b8a9df1bed970abc727614a8803d230161f0..0000000000000000000000000000000000000000
--- a/src/runtime/runtime-observe.cc
+++ /dev/null
@@ -1,160 +0,0 @@
-// Copyright 2014 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.
-
-#include "src/runtime/runtime-utils.h"
-
-#include "src/arguments.h"
-#include "src/debug/debug.h"
-#include "src/isolate-inl.h"
-
-namespace v8 {
-namespace internal {
-
-RUNTIME_FUNCTION(Runtime_IsObserved) {
- SealHandleScope shs(isolate);
- DCHECK(args.length() == 1);
-
- if (!args[0]->IsJSReceiver()) return isolate->heap()->false_value();
- CONVERT_ARG_CHECKED(JSReceiver, obj, 0);
- DCHECK(!obj->IsJSGlobalProxy() || !obj->map()->is_observed());
- return isolate->heap()->ToBoolean(obj->map()->is_observed());
-}
-
-
-RUNTIME_FUNCTION(Runtime_SetIsObserved) {
- HandleScope scope(isolate);
- DCHECK(args.length() == 1);
- CONVERT_ARG_HANDLE_CHECKED(JSReceiver, obj, 0);
- RUNTIME_ASSERT(!obj->IsJSGlobalProxy());
- if (obj->IsJSProxy()) return isolate->heap()->undefined_value();
- RUNTIME_ASSERT(!obj->map()->is_observed());
-
- DCHECK(obj->IsJSObject());
- JSObject::SetObserved(Handle<JSObject>::cast(obj));
- return isolate->heap()->undefined_value();
-}
-
-
-RUNTIME_FUNCTION(Runtime_EnqueueMicrotask) {
- HandleScope scope(isolate);
- DCHECK(args.length() == 1);
- CONVERT_ARG_HANDLE_CHECKED(JSFunction, microtask, 0);
- isolate->EnqueueMicrotask(microtask);
- return isolate->heap()->undefined_value();
-}
-
-
-RUNTIME_FUNCTION(Runtime_RunMicrotasks) {
- HandleScope scope(isolate);
- DCHECK(args.length() == 0);
- isolate->RunMicrotasks();
- return isolate->heap()->undefined_value();
-}
-
-
-RUNTIME_FUNCTION(Runtime_DeliverObservationChangeRecords) {
- HandleScope scope(isolate);
- DCHECK(args.length() == 2);
- CONVERT_ARG_HANDLE_CHECKED(JSReceiver, callback, 0);
- CONVERT_ARG_HANDLE_CHECKED(Object, argument, 1);
- v8::TryCatch catcher(reinterpret_cast<v8::Isolate*>(isolate));
- // We should send a message on uncaught exception thrown during
- // Object.observe delivery while not interrupting further delivery, thus
- // we make a call inside a verbose TryCatch.
- catcher.SetVerbose(true);
- Handle<Object> argv[] = {argument};
-
- // If we are in step-in mode, flood the handler.
- isolate->debug()->EnableStepIn();
-
- USE(Execution::Call(isolate, callback, isolate->factory()->undefined_value(),
- arraysize(argv), argv));
- if (isolate->has_pending_exception()) {
- isolate->ReportPendingMessages();
- isolate->clear_pending_exception();
- isolate->set_external_caught_exception(false);
- }
- return isolate->heap()->undefined_value();
-}
-
-
-RUNTIME_FUNCTION(Runtime_GetObservationState) {
- HandleScope scope(isolate);
- DCHECK(args.length() == 0);
- isolate->CountUsage(v8::Isolate::kObjectObserve);
- return isolate->heap()->observation_state();
-}
-
-
-static bool ContextsHaveSameOrigin(Handle<Context> context1,
- Handle<Context> context2) {
- return context1->security_token() == context2->security_token();
-}
-
-
-RUNTIME_FUNCTION(Runtime_ObserverObjectAndRecordHaveSameOrigin) {
- HandleScope scope(isolate);
- DCHECK(args.length() == 3);
- CONVERT_ARG_HANDLE_CHECKED(JSReceiver, observer, 0);
- CONVERT_ARG_HANDLE_CHECKED(JSObject, object, 1);
- CONVERT_ARG_HANDLE_CHECKED(JSObject, record, 2);
-
- while (observer->IsJSBoundFunction()) {
- observer = handle(
- Handle<JSBoundFunction>::cast(observer)->bound_target_function());
- }
- if (!observer->IsJSFunction()) return isolate->heap()->false_value();
-
- Handle<Context> observer_context(
- Handle<JSFunction>::cast(observer)->context()->native_context());
- Handle<Context> object_context(object->GetCreationContext());
- Handle<Context> record_context(record->GetCreationContext());
-
- return isolate->heap()->ToBoolean(
- ContextsHaveSameOrigin(object_context, observer_context) &&
- ContextsHaveSameOrigin(object_context, record_context));
-}
-
-
-RUNTIME_FUNCTION(Runtime_ObjectWasCreatedInCurrentOrigin) {
- HandleScope scope(isolate);
- DCHECK(args.length() == 1);
- CONVERT_ARG_HANDLE_CHECKED(JSObject, object, 0);
-
- Handle<Context> creation_context(object->GetCreationContext(), isolate);
- return isolate->heap()->ToBoolean(
- ContextsHaveSameOrigin(creation_context, isolate->native_context()));
-}
-
-
-RUNTIME_FUNCTION(Runtime_GetObjectContextObjectObserve) {
- HandleScope scope(isolate);
- DCHECK(args.length() == 1);
- CONVERT_ARG_HANDLE_CHECKED(JSObject, object, 0);
-
- Handle<Context> context(object->GetCreationContext(), isolate);
- return context->native_object_observe();
-}
-
-
-RUNTIME_FUNCTION(Runtime_GetObjectContextObjectGetNotifier) {
- HandleScope scope(isolate);
- DCHECK(args.length() == 1);
- CONVERT_ARG_HANDLE_CHECKED(JSObject, object, 0);
-
- Handle<Context> context(object->GetCreationContext(), isolate);
- return context->native_object_get_notifier();
-}
-
-
-RUNTIME_FUNCTION(Runtime_GetObjectContextNotifierPerformChange) {
- HandleScope scope(isolate);
- DCHECK(args.length() == 1);
- CONVERT_ARG_HANDLE_CHECKED(JSObject, object_info, 0);
-
- Handle<Context> context(object_info->GetCreationContext(), isolate);
- return context->native_object_notifier_perform_change();
-}
-} // namespace internal
-} // namespace v8
« no previous file with comments | « src/runtime/runtime-internal.cc ('k') | src/transitions-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698