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

Unified Diff: src/runtime.cc

Issue 263833007: Don't leak contexts in Object.observe (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: cr comments Created 6 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
Index: src/runtime.cc
diff --git a/src/runtime.cc b/src/runtime.cc
index a62a0f978b50b99c69edf6becf889249b232ab21..7c5d9c71572bf6161047ca7060826af2e65ec573 100644
--- a/src/runtime.cc
+++ b/src/runtime.cc
@@ -14996,6 +14996,65 @@ RUNTIME_FUNCTION(Runtime_ObjectWasCreatedInCurrentOrigin) {
}
+RUNTIME_FUNCTION(Runtime_NativeObjectObserve) {
+ HandleScope scope(isolate);
+ ASSERT(args.length() == 3);
+ CONVERT_ARG_HANDLE_CHECKED(JSObject, object, 0);
+ CONVERT_ARG_HANDLE_CHECKED(Object, callback, 1);
Jakob Kummerow 2014/05/02 19:31:37 Please be as specific as you can regarding the obj
adamk 2014/05/02 20:09:13 Done.
Toon Verwaest 2014/05/03 05:28:26 I think this should become JSReceiver to handle fu
adamk 2014/05/05 19:55:05 I've filed a but to track the fact that proxies do
rossberg 2014/05/06 10:03:50 Thanks! While you're at it, can you please also cr
+ CONVERT_ARG_HANDLE_CHECKED(Object, accept, 2);
+
+ Handle<Context> context(object->GetCreationContext(), isolate);
+ Handle<JSFunction> function(context->native_object_observe(), isolate);
+ Handle<Object> call_args[] = { object, callback, accept };
+ Handle<Object> result;
+
+ ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
+ isolate, result,
+ Execution::Call(isolate, function,
+ handle(context->object_function(), isolate), 3, call_args, true));
+ return *result;
+}
+
+
+RUNTIME_FUNCTION(Runtime_NativeObjectGetNotifier) {
+ HandleScope scope(isolate);
+ ASSERT(args.length() == 1);
+ CONVERT_ARG_HANDLE_CHECKED(JSObject, object, 0);
+
+ Handle<Context> context(object->GetCreationContext(), isolate);
+ Handle<JSFunction> function(context->native_object_get_notifier(), isolate);
+ Handle<Object> call_args[] = { object };
+ Handle<Object> result;
+
+ ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
+ isolate, result,
+ Execution::Call(isolate, function,
+ handle(context->object_function(), isolate), 1, call_args, true));
+ return *result;
+}
+
+
+RUNTIME_FUNCTION(Runtime_NativeObjectNotifierPerformChange) {
Jakob Kummerow 2014/05/02 19:31:37 I don't see this function declared in runtime.h, i
adamk 2014/05/02 20:09:13 That is not intentional, and combined with the sam
+ HandleScope scope(isolate);
+ ASSERT(args.length() == 3);
+ CONVERT_ARG_HANDLE_CHECKED(JSObject, object_info, 0);
+ CONVERT_ARG_HANDLE_CHECKED(Object, change_type, 1);
+ CONVERT_ARG_HANDLE_CHECKED(Object, change_fn, 2);
+
+ Handle<Context> context(object_info->GetCreationContext(), isolate);
+ Handle<JSFunction> function(context->native_object_notifier_perform_change(),
+ isolate);
+ Handle<Object> call_args[] = { change_type, change_fn };
+ Handle<Object> result;
+
+ ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
+ isolate, result,
+ Execution::Call(isolate, function, isolate->factory()->undefined_value(),
+ 2, call_args, true));
+ return *result;
+}
+
+
static Object* ArrayConstructorCommon(Isolate* isolate,
Handle<JSFunction> constructor,
Handle<AllocationSite> site,
« src/object-observe.js ('K') | « src/runtime.h ('k') | test/cctest/test-object-observe.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698