OLD | NEW |
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 Loading... |
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) { | 14999 RUNTIME_FUNCTION(Runtime_ObjectObserveInObjectContext) { |
15000 HandleScope scope(isolate); | 15000 HandleScope scope(isolate); |
15001 ASSERT(args.length() == 3); | 15001 ASSERT(args.length() == 3); |
15002 CONVERT_ARG_HANDLE_CHECKED(JSObject, object, 0); | 15002 CONVERT_ARG_HANDLE_CHECKED(JSObject, object, 0); |
15003 CONVERT_ARG_HANDLE_CHECKED(Object, callback, 1); | 15003 CONVERT_ARG_HANDLE_CHECKED(JSFunction, callback, 1); |
15004 CONVERT_ARG_HANDLE_CHECKED(Object, accept, 2); | 15004 CONVERT_ARG_HANDLE_CHECKED(Object, accept, 2); |
| 15005 RUNTIME_ASSERT(accept->IsUndefined() || accept->IsJSObject()); |
15005 | 15006 |
15006 Handle<Context> context(object->GetCreationContext(), isolate); | 15007 Handle<Context> context(object->GetCreationContext(), isolate); |
15007 Handle<JSFunction> function(context->native_object_observe(), isolate); | 15008 Handle<JSFunction> function(context->native_object_observe(), isolate); |
15008 Handle<Object> call_args[] = { object, callback, accept }; | 15009 Handle<Object> call_args[] = { object, callback, accept }; |
15009 Handle<Object> result; | 15010 Handle<Object> result; |
15010 | 15011 |
15011 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( | 15012 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
15012 isolate, result, | 15013 isolate, result, |
15013 Execution::Call(isolate, function, | 15014 Execution::Call(isolate, function, |
15014 handle(context->object_function(), isolate), 3, call_args, true)); | 15015 handle(context->object_function(), isolate), |
| 15016 ARRAY_SIZE(call_args), call_args, true)); |
15015 return *result; | 15017 return *result; |
15016 } | 15018 } |
15017 | 15019 |
15018 | 15020 |
15019 RUNTIME_FUNCTION(Runtime_NativeObjectGetNotifier) { | 15021 RUNTIME_FUNCTION(Runtime_ObjectGetNotifierInObjectContext) { |
15020 HandleScope scope(isolate); | 15022 HandleScope scope(isolate); |
15021 ASSERT(args.length() == 1); | 15023 ASSERT(args.length() == 1); |
15022 CONVERT_ARG_HANDLE_CHECKED(JSObject, object, 0); | 15024 CONVERT_ARG_HANDLE_CHECKED(JSObject, object, 0); |
15023 | 15025 |
15024 Handle<Context> context(object->GetCreationContext(), isolate); | 15026 Handle<Context> context(object->GetCreationContext(), isolate); |
15025 Handle<JSFunction> function(context->native_object_get_notifier(), isolate); | 15027 Handle<JSFunction> function(context->native_object_get_notifier(), isolate); |
15026 Handle<Object> call_args[] = { object }; | 15028 Handle<Object> call_args[] = { object }; |
15027 Handle<Object> result; | 15029 Handle<Object> result; |
15028 | 15030 |
15029 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( | 15031 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
15030 isolate, result, | 15032 isolate, result, |
15031 Execution::Call(isolate, function, | 15033 Execution::Call(isolate, function, |
15032 handle(context->object_function(), isolate), 1, call_args, true)); | 15034 handle(context->object_function(), isolate), |
| 15035 ARRAY_SIZE(call_args), call_args, true)); |
15033 return *result; | 15036 return *result; |
15034 } | 15037 } |
15035 | 15038 |
15036 | 15039 |
15037 RUNTIME_FUNCTION(Runtime_NativeObjectNotifierPerformChange) { | 15040 RUNTIME_FUNCTION(Runtime_ObjectNotifierPerformChangeInObjectContext) { |
15038 HandleScope scope(isolate); | 15041 HandleScope scope(isolate); |
15039 ASSERT(args.length() == 3); | 15042 ASSERT(args.length() == 3); |
15040 CONVERT_ARG_HANDLE_CHECKED(JSObject, object_info, 0); | 15043 CONVERT_ARG_HANDLE_CHECKED(JSObject, object_info, 0); |
15041 CONVERT_ARG_HANDLE_CHECKED(Object, change_type, 1); | 15044 CONVERT_ARG_HANDLE_CHECKED(String, change_type, 1); |
15042 CONVERT_ARG_HANDLE_CHECKED(Object, change_fn, 2); | 15045 CONVERT_ARG_HANDLE_CHECKED(JSFunction, change_fn, 2); |
15043 | 15046 |
15044 Handle<Context> context(object_info->GetCreationContext(), isolate); | 15047 Handle<Context> context(object_info->GetCreationContext(), isolate); |
15045 Handle<JSFunction> function(context->native_object_notifier_perform_change(), | 15048 Handle<JSFunction> function(context->native_object_notifier_perform_change(), |
15046 isolate); | 15049 isolate); |
15047 Handle<Object> call_args[] = { change_type, change_fn }; | 15050 Handle<Object> call_args[] = { object_info, change_type, change_fn }; |
15048 Handle<Object> result; | 15051 Handle<Object> result; |
15049 | 15052 |
15050 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( | 15053 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
15051 isolate, result, | 15054 isolate, result, |
15052 Execution::Call(isolate, function, isolate->factory()->undefined_value(), | 15055 Execution::Call(isolate, function, isolate->factory()->undefined_value(), |
15053 2, call_args, true)); | 15056 ARRAY_SIZE(call_args), call_args, true)); |
15054 return *result; | 15057 return *result; |
15055 } | 15058 } |
15056 | 15059 |
15057 | 15060 |
15058 static Object* ArrayConstructorCommon(Isolate* isolate, | 15061 static Object* ArrayConstructorCommon(Isolate* isolate, |
15059 Handle<JSFunction> constructor, | 15062 Handle<JSFunction> constructor, |
15060 Handle<AllocationSite> site, | 15063 Handle<AllocationSite> site, |
15061 Arguments* caller_args) { | 15064 Arguments* caller_args) { |
15062 Factory* factory = isolate->factory(); | 15065 Factory* factory = isolate->factory(); |
15063 | 15066 |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
15263 } | 15266 } |
15264 return NULL; | 15267 return NULL; |
15265 } | 15268 } |
15266 | 15269 |
15267 | 15270 |
15268 const Runtime::Function* Runtime::FunctionForId(Runtime::FunctionId id) { | 15271 const Runtime::Function* Runtime::FunctionForId(Runtime::FunctionId id) { |
15269 return &(kIntrinsicFunctions[static_cast<int>(id)]); | 15272 return &(kIntrinsicFunctions[static_cast<int>(id)]); |
15270 } | 15273 } |
15271 | 15274 |
15272 } } // namespace v8::internal | 15275 } } // namespace v8::internal |
OLD | NEW |