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

Side by Side Diff: src/runtime/runtime-observe.cc

Issue 1552473002: Revert of [runtime] Introduce dedicated JSBoundFunction to represent bound functions. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@FunctionConstructor
Patch Set: Created 4 years, 11 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
« no previous file with comments | « src/runtime/runtime-object.cc ('k') | src/snapshot/serialize.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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 "src/runtime/runtime-utils.h" 5 #include "src/runtime/runtime-utils.h"
6 6
7 #include "src/arguments.h" 7 #include "src/arguments.h"
8 #include "src/debug/debug.h" 8 #include "src/debug/debug.h"
9 #include "src/isolate-inl.h" 9 #include "src/isolate-inl.h"
10 10
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 HandleScope scope(isolate); 49 HandleScope scope(isolate);
50 DCHECK(args.length() == 0); 50 DCHECK(args.length() == 0);
51 isolate->RunMicrotasks(); 51 isolate->RunMicrotasks();
52 return isolate->heap()->undefined_value(); 52 return isolate->heap()->undefined_value();
53 } 53 }
54 54
55 55
56 RUNTIME_FUNCTION(Runtime_DeliverObservationChangeRecords) { 56 RUNTIME_FUNCTION(Runtime_DeliverObservationChangeRecords) {
57 HandleScope scope(isolate); 57 HandleScope scope(isolate);
58 DCHECK(args.length() == 2); 58 DCHECK(args.length() == 2);
59 CONVERT_ARG_HANDLE_CHECKED(JSReceiver, callback, 0); 59 CONVERT_ARG_HANDLE_CHECKED(JSFunction, callback, 0);
60 CONVERT_ARG_HANDLE_CHECKED(Object, argument, 1); 60 CONVERT_ARG_HANDLE_CHECKED(Object, argument, 1);
61 v8::TryCatch catcher(reinterpret_cast<v8::Isolate*>(isolate)); 61 v8::TryCatch catcher(reinterpret_cast<v8::Isolate*>(isolate));
62 // We should send a message on uncaught exception thrown during 62 // We should send a message on uncaught exception thrown during
63 // Object.observe delivery while not interrupting further delivery, thus 63 // Object.observe delivery while not interrupting further delivery, thus
64 // we make a call inside a verbose TryCatch. 64 // we make a call inside a verbose TryCatch.
65 catcher.SetVerbose(true); 65 catcher.SetVerbose(true);
66 Handle<Object> argv[] = {argument}; 66 Handle<Object> argv[] = {argument};
67 67
68 // If we are in step-in mode, flood the handler. 68 // If we are in step-in mode, flood the handler.
69 isolate->debug()->EnableStepIn(); 69 isolate->debug()->EnableStepIn();
(...skipping 19 matching lines...) Expand all
89 89
90 static bool ContextsHaveSameOrigin(Handle<Context> context1, 90 static bool ContextsHaveSameOrigin(Handle<Context> context1,
91 Handle<Context> context2) { 91 Handle<Context> context2) {
92 return context1->security_token() == context2->security_token(); 92 return context1->security_token() == context2->security_token();
93 } 93 }
94 94
95 95
96 RUNTIME_FUNCTION(Runtime_ObserverObjectAndRecordHaveSameOrigin) { 96 RUNTIME_FUNCTION(Runtime_ObserverObjectAndRecordHaveSameOrigin) {
97 HandleScope scope(isolate); 97 HandleScope scope(isolate);
98 DCHECK(args.length() == 3); 98 DCHECK(args.length() == 3);
99 CONVERT_ARG_HANDLE_CHECKED(JSReceiver, observer, 0); 99 CONVERT_ARG_HANDLE_CHECKED(JSFunction, observer, 0);
100 CONVERT_ARG_HANDLE_CHECKED(JSObject, object, 1); 100 CONVERT_ARG_HANDLE_CHECKED(JSObject, object, 1);
101 CONVERT_ARG_HANDLE_CHECKED(JSObject, record, 2); 101 CONVERT_ARG_HANDLE_CHECKED(JSObject, record, 2);
102 102
103 while (observer->IsJSBoundFunction()) { 103 Handle<Context> observer_context(observer->context()->native_context());
104 observer = handle(
105 Handle<JSBoundFunction>::cast(observer)->bound_target_function());
106 }
107 if (!observer->IsJSFunction()) return isolate->heap()->false_value();
108
109 Handle<Context> observer_context(
110 Handle<JSFunction>::cast(observer)->context()->native_context());
111 Handle<Context> object_context(object->GetCreationContext()); 104 Handle<Context> object_context(object->GetCreationContext());
112 Handle<Context> record_context(record->GetCreationContext()); 105 Handle<Context> record_context(record->GetCreationContext());
113 106
114 return isolate->heap()->ToBoolean( 107 return isolate->heap()->ToBoolean(
115 ContextsHaveSameOrigin(object_context, observer_context) && 108 ContextsHaveSameOrigin(object_context, observer_context) &&
116 ContextsHaveSameOrigin(object_context, record_context)); 109 ContextsHaveSameOrigin(object_context, record_context));
117 } 110 }
118 111
119 112
120 RUNTIME_FUNCTION(Runtime_ObjectWasCreatedInCurrentOrigin) { 113 RUNTIME_FUNCTION(Runtime_ObjectWasCreatedInCurrentOrigin) {
(...skipping 30 matching lines...) Expand all
151 RUNTIME_FUNCTION(Runtime_GetObjectContextNotifierPerformChange) { 144 RUNTIME_FUNCTION(Runtime_GetObjectContextNotifierPerformChange) {
152 HandleScope scope(isolate); 145 HandleScope scope(isolate);
153 DCHECK(args.length() == 1); 146 DCHECK(args.length() == 1);
154 CONVERT_ARG_HANDLE_CHECKED(JSObject, object_info, 0); 147 CONVERT_ARG_HANDLE_CHECKED(JSObject, object_info, 0);
155 148
156 Handle<Context> context(object_info->GetCreationContext(), isolate); 149 Handle<Context> context(object_info->GetCreationContext(), isolate);
157 return context->native_object_notifier_perform_change(); 150 return context->native_object_notifier_perform_change();
158 } 151 }
159 } // namespace internal 152 } // namespace internal
160 } // namespace v8 153 } // namespace v8
OLDNEW
« no previous file with comments | « src/runtime/runtime-object.cc ('k') | src/snapshot/serialize.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698