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

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: one more test 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);
+ 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) {
+ 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,

Powered by Google App Engine
This is Rietveld 408576698