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

Side by Side 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, 7 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <stdlib.h> 5 #include <stdlib.h>
6 #include <limits> 6 #include <limits>
7 7
8 #include "v8.h" 8 #include "v8.h"
9 9
10 #include "accessors.h" 10 #include "accessors.h"
(...skipping 14978 matching lines...) Expand 10 before | Expand all | Expand 10 after
14989 HandleScope scope(isolate); 14989 HandleScope scope(isolate);
14990 ASSERT(args.length() == 1); 14990 ASSERT(args.length() == 1);
14991 CONVERT_ARG_HANDLE_CHECKED(JSObject, object, 0); 14991 CONVERT_ARG_HANDLE_CHECKED(JSObject, object, 0);
14992 14992
14993 Handle<Context> creation_context(object->GetCreationContext(), isolate); 14993 Handle<Context> creation_context(object->GetCreationContext(), isolate);
14994 return isolate->heap()->ToBoolean( 14994 return isolate->heap()->ToBoolean(
14995 ContextsHaveSameOrigin(creation_context, isolate->native_context())); 14995 ContextsHaveSameOrigin(creation_context, isolate->native_context()));
14996 } 14996 }
14997 14997
14998 14998
14999 RUNTIME_FUNCTION(Runtime_NativeObjectObserve) {
15000 HandleScope scope(isolate);
15001 ASSERT(args.length() == 3);
15002 CONVERT_ARG_HANDLE_CHECKED(JSObject, object, 0);
15003 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
15004 CONVERT_ARG_HANDLE_CHECKED(Object, accept, 2);
15005
15006 Handle<Context> context(object->GetCreationContext(), isolate);
15007 Handle<JSFunction> function(context->native_object_observe(), isolate);
15008 Handle<Object> call_args[] = { object, callback, accept };
15009 Handle<Object> result;
15010
15011 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
15012 isolate, result,
15013 Execution::Call(isolate, function,
15014 handle(context->object_function(), isolate), 3, call_args, true));
15015 return *result;
15016 }
15017
15018
15019 RUNTIME_FUNCTION(Runtime_NativeObjectGetNotifier) {
15020 HandleScope scope(isolate);
15021 ASSERT(args.length() == 1);
15022 CONVERT_ARG_HANDLE_CHECKED(JSObject, object, 0);
15023
15024 Handle<Context> context(object->GetCreationContext(), isolate);
15025 Handle<JSFunction> function(context->native_object_get_notifier(), isolate);
15026 Handle<Object> call_args[] = { object };
15027 Handle<Object> result;
15028
15029 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
15030 isolate, result,
15031 Execution::Call(isolate, function,
15032 handle(context->object_function(), isolate), 1, call_args, true));
15033 return *result;
15034 }
15035
15036
15037 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
15038 HandleScope scope(isolate);
15039 ASSERT(args.length() == 3);
15040 CONVERT_ARG_HANDLE_CHECKED(JSObject, object_info, 0);
15041 CONVERT_ARG_HANDLE_CHECKED(Object, change_type, 1);
15042 CONVERT_ARG_HANDLE_CHECKED(Object, change_fn, 2);
15043
15044 Handle<Context> context(object_info->GetCreationContext(), isolate);
15045 Handle<JSFunction> function(context->native_object_notifier_perform_change(),
15046 isolate);
15047 Handle<Object> call_args[] = { change_type, change_fn };
15048 Handle<Object> result;
15049
15050 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
15051 isolate, result,
15052 Execution::Call(isolate, function, isolate->factory()->undefined_value(),
15053 2, call_args, true));
15054 return *result;
15055 }
15056
15057
14999 static Object* ArrayConstructorCommon(Isolate* isolate, 15058 static Object* ArrayConstructorCommon(Isolate* isolate,
15000 Handle<JSFunction> constructor, 15059 Handle<JSFunction> constructor,
15001 Handle<AllocationSite> site, 15060 Handle<AllocationSite> site,
15002 Arguments* caller_args) { 15061 Arguments* caller_args) {
15003 Factory* factory = isolate->factory(); 15062 Factory* factory = isolate->factory();
15004 15063
15005 bool holey = false; 15064 bool holey = false;
15006 bool can_use_type_feedback = true; 15065 bool can_use_type_feedback = true;
15007 if (caller_args->length() == 1) { 15066 if (caller_args->length() == 1) {
15008 Handle<Object> argument_one = caller_args->at<Object>(0); 15067 Handle<Object> argument_one = caller_args->at<Object>(0);
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
15204 } 15263 }
15205 return NULL; 15264 return NULL;
15206 } 15265 }
15207 15266
15208 15267
15209 const Runtime::Function* Runtime::FunctionForId(Runtime::FunctionId id) { 15268 const Runtime::Function* Runtime::FunctionForId(Runtime::FunctionId id) {
15210 return &(kIntrinsicFunctions[static_cast<int>(id)]); 15269 return &(kIntrinsicFunctions[static_cast<int>(id)]);
15211 } 15270 }
15212 15271
15213 } } // namespace v8::internal 15272 } } // namespace v8::internal
OLDNEW
« 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