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

Side by Side Diff: src/api.cc

Issue 23661004: add isolate parameter for Execution::Call (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: rebase Created 7 years, 3 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 | « no previous file | src/bootstrapper.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 1859 matching lines...) Expand 10 before | Expand all | Expand 10 after
1870 i::Handle<i::SharedFunctionInfo> 1870 i::Handle<i::SharedFunctionInfo>
1871 function_info(i::SharedFunctionInfo::cast(*obj), isolate); 1871 function_info(i::SharedFunctionInfo::cast(*obj), isolate);
1872 fun = isolate->factory()->NewFunctionFromSharedFunctionInfo( 1872 fun = isolate->factory()->NewFunctionFromSharedFunctionInfo(
1873 function_info, isolate->global_context()); 1873 function_info, isolate->global_context());
1874 } else { 1874 } else {
1875 fun = i::Handle<i::JSFunction>(i::JSFunction::cast(*obj), isolate); 1875 fun = i::Handle<i::JSFunction>(i::JSFunction::cast(*obj), isolate);
1876 } 1876 }
1877 EXCEPTION_PREAMBLE(isolate); 1877 EXCEPTION_PREAMBLE(isolate);
1878 i::Handle<i::Object> receiver( 1878 i::Handle<i::Object> receiver(
1879 isolate->context()->global_proxy(), isolate); 1879 isolate->context()->global_proxy(), isolate);
1880 i::Handle<i::Object> result = 1880 i::Handle<i::Object> result = i::Execution::Call(
1881 i::Execution::Call(fun, receiver, 0, NULL, &has_pending_exception); 1881 isolate, fun, receiver, 0, NULL, &has_pending_exception);
1882 EXCEPTION_BAILOUT_CHECK_DO_CALLBACK(isolate, Local<Value>()); 1882 EXCEPTION_BAILOUT_CHECK_DO_CALLBACK(isolate, Local<Value>());
1883 raw_result = *result; 1883 raw_result = *result;
1884 } 1884 }
1885 i::Handle<i::Object> result(raw_result, isolate); 1885 i::Handle<i::Object> result(raw_result, isolate);
1886 return Utils::ToLocal(result); 1886 return Utils::ToLocal(result);
1887 } 1887 }
1888 1888
1889 1889
1890 static i::Handle<i::SharedFunctionInfo> OpenScript(Script* script) { 1890 static i::Handle<i::SharedFunctionInfo> OpenScript(Script* script) {
1891 i::Handle<i::Object> obj = Utils::OpenHandle(script); 1891 i::Handle<i::Object> obj = Utils::OpenHandle(script);
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
2170 int argc, 2170 int argc,
2171 i::Handle<i::Object> argv[], 2171 i::Handle<i::Object> argv[],
2172 bool* has_pending_exception) { 2172 bool* has_pending_exception) {
2173 i::Isolate* isolate = i::Isolate::Current(); 2173 i::Isolate* isolate = i::Isolate::Current();
2174 i::Handle<i::String> fmt_str = 2174 i::Handle<i::String> fmt_str =
2175 isolate->factory()->InternalizeUtf8String(name); 2175 isolate->factory()->InternalizeUtf8String(name);
2176 i::Object* object_fun = 2176 i::Object* object_fun =
2177 isolate->js_builtins_object()->GetPropertyNoExceptionThrown(*fmt_str); 2177 isolate->js_builtins_object()->GetPropertyNoExceptionThrown(*fmt_str);
2178 i::Handle<i::JSFunction> fun = 2178 i::Handle<i::JSFunction> fun =
2179 i::Handle<i::JSFunction>(i::JSFunction::cast(object_fun)); 2179 i::Handle<i::JSFunction>(i::JSFunction::cast(object_fun));
2180 i::Handle<i::Object> value = 2180 i::Handle<i::Object> value = i::Execution::Call(
2181 i::Execution::Call(fun, recv, argc, argv, has_pending_exception); 2181 isolate, fun, recv, argc, argv, has_pending_exception);
2182 return value; 2182 return value;
2183 } 2183 }
2184 2184
2185 2185
2186 static i::Handle<i::Object> CallV8HeapFunction(const char* name, 2186 static i::Handle<i::Object> CallV8HeapFunction(const char* name,
2187 i::Handle<i::Object> data, 2187 i::Handle<i::Object> data,
2188 bool* has_pending_exception) { 2188 bool* has_pending_exception) {
2189 i::Handle<i::Object> argv[] = { data }; 2189 i::Handle<i::Object> argv[] = { data };
2190 return CallV8HeapFunction(name, 2190 return CallV8HeapFunction(name,
2191 i::Isolate::Current()->js_builtins_object(), 2191 i::Isolate::Current()->js_builtins_object(),
(...skipping 1944 matching lines...) Expand 10 before | Expand all | Expand 10 after
4136 fun = i::Handle<i::JSFunction>::cast(obj); 4136 fun = i::Handle<i::JSFunction>::cast(obj);
4137 } else { 4137 } else {
4138 EXCEPTION_PREAMBLE(isolate); 4138 EXCEPTION_PREAMBLE(isolate);
4139 i::Handle<i::Object> delegate = i::Execution::TryGetFunctionDelegate( 4139 i::Handle<i::Object> delegate = i::Execution::TryGetFunctionDelegate(
4140 isolate, obj, &has_pending_exception); 4140 isolate, obj, &has_pending_exception);
4141 EXCEPTION_BAILOUT_CHECK(isolate, Local<Value>()); 4141 EXCEPTION_BAILOUT_CHECK(isolate, Local<Value>());
4142 fun = i::Handle<i::JSFunction>::cast(delegate); 4142 fun = i::Handle<i::JSFunction>::cast(delegate);
4143 recv_obj = obj; 4143 recv_obj = obj;
4144 } 4144 }
4145 EXCEPTION_PREAMBLE(isolate); 4145 EXCEPTION_PREAMBLE(isolate);
4146 i::Handle<i::Object> returned = 4146 i::Handle<i::Object> returned = i::Execution::Call(
4147 i::Execution::Call(fun, recv_obj, argc, args, &has_pending_exception); 4147 isolate, fun, recv_obj, argc, args, &has_pending_exception);
4148 EXCEPTION_BAILOUT_CHECK_DO_CALLBACK(isolate, Local<Value>()); 4148 EXCEPTION_BAILOUT_CHECK_DO_CALLBACK(isolate, Local<Value>());
4149 return Utils::ToLocal(scope.CloseAndEscape(returned)); 4149 return Utils::ToLocal(scope.CloseAndEscape(returned));
4150 } 4150 }
4151 4151
4152 4152
4153 Local<v8::Value> Object::CallAsConstructor(int argc, 4153 Local<v8::Value> Object::CallAsConstructor(int argc,
4154 v8::Handle<v8::Value> argv[]) { 4154 v8::Handle<v8::Value> argv[]) {
4155 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); 4155 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
4156 ON_BAILOUT(isolate, "v8::Object::CallAsConstructor()", 4156 ON_BAILOUT(isolate, "v8::Object::CallAsConstructor()",
4157 return Local<v8::Object>()); 4157 return Local<v8::Object>());
(...skipping 14 matching lines...) Expand all
4172 return Utils::ToLocal(scope.CloseAndEscape( 4172 return Utils::ToLocal(scope.CloseAndEscape(
4173 i::Handle<i::JSObject>::cast(returned))); 4173 i::Handle<i::JSObject>::cast(returned)));
4174 } 4174 }
4175 EXCEPTION_PREAMBLE(isolate); 4175 EXCEPTION_PREAMBLE(isolate);
4176 i::Handle<i::Object> delegate = i::Execution::TryGetConstructorDelegate( 4176 i::Handle<i::Object> delegate = i::Execution::TryGetConstructorDelegate(
4177 isolate, obj, &has_pending_exception); 4177 isolate, obj, &has_pending_exception);
4178 EXCEPTION_BAILOUT_CHECK(isolate, Local<v8::Object>()); 4178 EXCEPTION_BAILOUT_CHECK(isolate, Local<v8::Object>());
4179 if (!delegate->IsUndefined()) { 4179 if (!delegate->IsUndefined()) {
4180 i::Handle<i::JSFunction> fun = i::Handle<i::JSFunction>::cast(delegate); 4180 i::Handle<i::JSFunction> fun = i::Handle<i::JSFunction>::cast(delegate);
4181 EXCEPTION_PREAMBLE(isolate); 4181 EXCEPTION_PREAMBLE(isolate);
4182 i::Handle<i::Object> returned = 4182 i::Handle<i::Object> returned = i::Execution::Call(
4183 i::Execution::Call(fun, obj, argc, args, &has_pending_exception); 4183 isolate, fun, obj, argc, args, &has_pending_exception);
4184 EXCEPTION_BAILOUT_CHECK_DO_CALLBACK(isolate, Local<v8::Object>()); 4184 EXCEPTION_BAILOUT_CHECK_DO_CALLBACK(isolate, Local<v8::Object>());
4185 ASSERT(!delegate->IsUndefined()); 4185 ASSERT(!delegate->IsUndefined());
4186 return Utils::ToLocal(scope.CloseAndEscape(returned)); 4186 return Utils::ToLocal(scope.CloseAndEscape(returned));
4187 } 4187 }
4188 return Local<v8::Object>(); 4188 return Local<v8::Object>();
4189 } 4189 }
4190 4190
4191 4191
4192 Local<v8::Object> Function::NewInstance() const { 4192 Local<v8::Object> Function::NewInstance() const {
4193 return NewInstance(0, NULL); 4193 return NewInstance(0, NULL);
(...skipping 30 matching lines...) Expand all
4224 i::Logger::TimerEventScope timer_scope( 4224 i::Logger::TimerEventScope timer_scope(
4225 isolate, i::Logger::TimerEventScope::v8_execute); 4225 isolate, i::Logger::TimerEventScope::v8_execute);
4226 i::Object* raw_result = NULL; 4226 i::Object* raw_result = NULL;
4227 { 4227 {
4228 i::HandleScope scope(isolate); 4228 i::HandleScope scope(isolate);
4229 i::Handle<i::JSFunction> fun = Utils::OpenHandle(this); 4229 i::Handle<i::JSFunction> fun = Utils::OpenHandle(this);
4230 i::Handle<i::Object> recv_obj = Utils::OpenHandle(*recv); 4230 i::Handle<i::Object> recv_obj = Utils::OpenHandle(*recv);
4231 STATIC_ASSERT(sizeof(v8::Handle<v8::Value>) == sizeof(i::Object**)); 4231 STATIC_ASSERT(sizeof(v8::Handle<v8::Value>) == sizeof(i::Object**));
4232 i::Handle<i::Object>* args = reinterpret_cast<i::Handle<i::Object>*>(argv); 4232 i::Handle<i::Object>* args = reinterpret_cast<i::Handle<i::Object>*>(argv);
4233 EXCEPTION_PREAMBLE(isolate); 4233 EXCEPTION_PREAMBLE(isolate);
4234 i::Handle<i::Object> returned = 4234 i::Handle<i::Object> returned = i::Execution::Call(
4235 i::Execution::Call(fun, recv_obj, argc, args, &has_pending_exception); 4235 isolate, fun, recv_obj, argc, args, &has_pending_exception);
4236 EXCEPTION_BAILOUT_CHECK_DO_CALLBACK(isolate, Local<Object>()); 4236 EXCEPTION_BAILOUT_CHECK_DO_CALLBACK(isolate, Local<Object>());
4237 raw_result = *returned; 4237 raw_result = *returned;
4238 } 4238 }
4239 i::Handle<i::Object> result(raw_result, isolate); 4239 i::Handle<i::Object> result(raw_result, isolate);
4240 return Utils::ToLocal(result); 4240 return Utils::ToLocal(result);
4241 } 4241 }
4242 4242
4243 4243
4244 void Function::SetName(v8::Handle<v8::String> name) { 4244 void Function::SetName(v8::Handle<v8::String> name) {
4245 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); 4245 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
(...skipping 3645 matching lines...) Expand 10 before | Expand all | Expand 10 after
7891 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); 7891 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate());
7892 Address callback_address = 7892 Address callback_address =
7893 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); 7893 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback));
7894 VMState<EXTERNAL> state(isolate); 7894 VMState<EXTERNAL> state(isolate);
7895 ExternalCallbackScope call_scope(isolate, callback_address); 7895 ExternalCallbackScope call_scope(isolate, callback_address);
7896 return callback(info); 7896 return callback(info);
7897 } 7897 }
7898 7898
7899 7899
7900 } } // namespace v8::internal 7900 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/bootstrapper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698