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

Side by Side Diff: src/execution.cc

Issue 10832365: Rename Context::global to Context::global_object, (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed Michael's comments. Created 8 years, 4 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
« no previous file with comments | « src/deoptimizer.cc ('k') | src/heap.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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 // Convert calls on global objects to be calls on the global 93 // Convert calls on global objects to be calls on the global
94 // receiver instead to avoid having a 'this' pointer which refers 94 // receiver instead to avoid having a 'this' pointer which refers
95 // directly to a global object. 95 // directly to a global object.
96 if (receiver->IsGlobalObject()) { 96 if (receiver->IsGlobalObject()) {
97 Handle<GlobalObject> global = Handle<GlobalObject>::cast(receiver); 97 Handle<GlobalObject> global = Handle<GlobalObject>::cast(receiver);
98 receiver = Handle<JSObject>(global->global_receiver()); 98 receiver = Handle<JSObject>(global->global_receiver());
99 } 99 }
100 100
101 // Make sure that the global object of the context we're about to 101 // Make sure that the global object of the context we're about to
102 // make the current one is indeed a global object. 102 // make the current one is indeed a global object.
103 ASSERT(function->context()->global()->IsGlobalObject()); 103 ASSERT(function->context()->global_object()->IsGlobalObject());
104 104
105 { 105 {
106 // Save and restore context around invocation and block the 106 // Save and restore context around invocation and block the
107 // allocation of handles without explicit handle scopes. 107 // allocation of handles without explicit handle scopes.
108 SaveContext save(isolate); 108 SaveContext save(isolate);
109 NoHandleAllocation na; 109 NoHandleAllocation na;
110 JSEntryFunction stub_entry = FUNCTION_CAST<JSEntryFunction>(code->entry()); 110 JSEntryFunction stub_entry = FUNCTION_CAST<JSEntryFunction>(code->entry());
111 111
112 // Call the function through the right JS entry stub. 112 // Call the function through the right JS entry stub.
113 byte* function_entry = function->code()->entry(); 113 byte* function_entry = function->code()->entry();
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 if (!callable->IsJSFunction()) { 158 if (!callable->IsJSFunction()) {
159 callable = TryGetFunctionDelegate(callable, pending_exception); 159 callable = TryGetFunctionDelegate(callable, pending_exception);
160 if (*pending_exception) return callable; 160 if (*pending_exception) return callable;
161 } 161 }
162 Handle<JSFunction> func = Handle<JSFunction>::cast(callable); 162 Handle<JSFunction> func = Handle<JSFunction>::cast(callable);
163 163
164 // In non-strict mode, convert receiver. 164 // In non-strict mode, convert receiver.
165 if (convert_receiver && !receiver->IsJSReceiver() && 165 if (convert_receiver && !receiver->IsJSReceiver() &&
166 !func->shared()->native() && func->shared()->is_classic_mode()) { 166 !func->shared()->native() && func->shared()->is_classic_mode()) {
167 if (receiver->IsUndefined() || receiver->IsNull()) { 167 if (receiver->IsUndefined() || receiver->IsNull()) {
168 Object* global = func->context()->global()->global_receiver(); 168 Object* global = func->context()->global_object()->global_receiver();
169 // Under some circumstances, 'global' can be the JSBuiltinsObject 169 // Under some circumstances, 'global' can be the JSBuiltinsObject
170 // In that case, don't rewrite. 170 // In that case, don't rewrite. (FWIW, the same holds for
171 // (FWIW, the same holds for GetIsolate()->global()->global_receiver().) 171 // GetIsolate()->global_object()->global_receiver().)
172 if (!global->IsJSBuiltinsObject()) receiver = Handle<Object>(global); 172 if (!global->IsJSBuiltinsObject()) receiver = Handle<Object>(global);
173 } else { 173 } else {
174 receiver = ToObject(receiver, pending_exception); 174 receiver = ToObject(receiver, pending_exception);
175 } 175 }
176 if (*pending_exception) return callable; 176 if (*pending_exception) return callable;
177 } 177 }
178 178
179 return Invoke(false, func, receiver, argc, argv, pending_exception); 179 return Invoke(false, func, receiver, argc, argv, pending_exception);
180 } 180 }
181 181
182 182
183 Handle<Object> Execution::New(Handle<JSFunction> func, 183 Handle<Object> Execution::New(Handle<JSFunction> func,
184 int argc, 184 int argc,
185 Handle<Object> argv[], 185 Handle<Object> argv[],
186 bool* pending_exception) { 186 bool* pending_exception) {
187 return Invoke(true, func, Isolate::Current()->global(), argc, argv, 187 return Invoke(true, func, Isolate::Current()->global_object(), argc, argv,
188 pending_exception); 188 pending_exception);
189 } 189 }
190 190
191 191
192 Handle<Object> Execution::TryCall(Handle<JSFunction> func, 192 Handle<Object> Execution::TryCall(Handle<JSFunction> func,
193 Handle<Object> receiver, 193 Handle<Object> receiver,
194 int argc, 194 int argc,
195 Handle<Object> args[], 195 Handle<Object> args[],
196 bool* caught_exception) { 196 bool* caught_exception) {
197 // Enter a try-block while executing the JavaScript code. To avoid 197 // Enter a try-block while executing the JavaScript code. To avoid
(...skipping 665 matching lines...) Expand 10 before | Expand all | Expand 10 after
863 863
864 { 864 {
865 JavaScriptFrameIterator it(isolate); 865 JavaScriptFrameIterator it(isolate);
866 ASSERT(!it.done()); 866 ASSERT(!it.done());
867 Object* fun = it.frame()->function(); 867 Object* fun = it.frame()->function();
868 if (fun && fun->IsJSFunction()) { 868 if (fun && fun->IsJSFunction()) {
869 // Don't stop in builtin functions. 869 // Don't stop in builtin functions.
870 if (JSFunction::cast(fun)->IsBuiltin()) { 870 if (JSFunction::cast(fun)->IsBuiltin()) {
871 return isolate->heap()->undefined_value(); 871 return isolate->heap()->undefined_value();
872 } 872 }
873 GlobalObject* global = JSFunction::cast(fun)->context()->global(); 873 GlobalObject* global = JSFunction::cast(fun)->context()->global_object();
874 // Don't stop in debugger functions. 874 // Don't stop in debugger functions.
875 if (isolate->debug()->IsDebugGlobal(global)) { 875 if (isolate->debug()->IsDebugGlobal(global)) {
876 return isolate->heap()->undefined_value(); 876 return isolate->heap()->undefined_value();
877 } 877 }
878 } 878 }
879 } 879 }
880 880
881 // Collect the break state before clearing the flags. 881 // Collect the break state before clearing the flags.
882 bool debug_command_only = 882 bool debug_command_only =
883 isolate->stack_guard()->IsDebugCommand() && 883 isolate->stack_guard()->IsDebugCommand() &&
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
961 } 961 }
962 if (stack_guard->IsInterrupted()) { 962 if (stack_guard->IsInterrupted()) {
963 stack_guard->Continue(INTERRUPT); 963 stack_guard->Continue(INTERRUPT);
964 return isolate->StackOverflow(); 964 return isolate->StackOverflow();
965 } 965 }
966 return isolate->heap()->undefined_value(); 966 return isolate->heap()->undefined_value();
967 } 967 }
968 968
969 969
970 } } // namespace v8::internal 970 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/deoptimizer.cc ('k') | src/heap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698