OLD | NEW |
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 1058 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1069 int next_serial_number = isolate->next_serial_number(); | 1069 int next_serial_number = isolate->next_serial_number(); |
1070 isolate->set_next_serial_number(next_serial_number + 1); | 1070 isolate->set_next_serial_number(next_serial_number + 1); |
1071 obj->set_serial_number(i::Smi::FromInt(next_serial_number)); | 1071 obj->set_serial_number(i::Smi::FromInt(next_serial_number)); |
1072 if (callback != 0) { | 1072 if (callback != 0) { |
1073 if (data.IsEmpty()) data = v8::Undefined(); | 1073 if (data.IsEmpty()) data = v8::Undefined(); |
1074 Utils::ToLocal(obj)->SetCallHandler(callback, data); | 1074 Utils::ToLocal(obj)->SetCallHandler(callback, data); |
1075 } | 1075 } |
1076 obj->set_length(length); | 1076 obj->set_length(length); |
1077 obj->set_undetectable(false); | 1077 obj->set_undetectable(false); |
1078 obj->set_needs_access_check(false); | 1078 obj->set_needs_access_check(false); |
| 1079 obj->set_do_not_cache(false); |
1079 | 1080 |
1080 if (!signature.IsEmpty()) | 1081 if (!signature.IsEmpty()) |
1081 obj->set_signature(*Utils::OpenHandle(*signature)); | 1082 obj->set_signature(*Utils::OpenHandle(*signature)); |
1082 return Utils::ToLocal(obj); | 1083 return Utils::ToLocal(obj); |
1083 } | 1084 } |
1084 | 1085 |
1085 | 1086 |
1086 Local<Signature> Signature::New(Handle<FunctionTemplate> receiver, | 1087 Local<Signature> Signature::New(Handle<FunctionTemplate> receiver, |
1087 int argc, Handle<FunctionTemplate> argv[]) { | 1088 int argc, Handle<FunctionTemplate> argv[]) { |
1088 i::Isolate* isolate = i::Isolate::Current(); | 1089 i::Isolate* isolate = i::Isolate::Current(); |
(...skipping 3093 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4182 i::Handle<i::Object> returned = i::Execution::Call( | 4183 i::Handle<i::Object> returned = i::Execution::Call( |
4183 isolate, fun, obj, argc, args, &has_pending_exception); | 4184 isolate, fun, obj, argc, args, &has_pending_exception); |
4184 EXCEPTION_BAILOUT_CHECK_DO_CALLBACK(isolate, Local<v8::Object>()); | 4185 EXCEPTION_BAILOUT_CHECK_DO_CALLBACK(isolate, Local<v8::Object>()); |
4185 ASSERT(!delegate->IsUndefined()); | 4186 ASSERT(!delegate->IsUndefined()); |
4186 return Utils::ToLocal(scope.CloseAndEscape(returned)); | 4187 return Utils::ToLocal(scope.CloseAndEscape(returned)); |
4187 } | 4188 } |
4188 return Local<v8::Object>(); | 4189 return Local<v8::Object>(); |
4189 } | 4190 } |
4190 | 4191 |
4191 | 4192 |
| 4193 Local<Function> Function::New(Isolate* v8_isolate, |
| 4194 FunctionCallback callback, |
| 4195 Local<Value> data, |
| 4196 int length) { |
| 4197 HandleScope scope(reinterpret_cast<Isolate*>(v8_isolate)); |
| 4198 Local<FunctionTemplate> info = |
| 4199 FunctionTemplate::New(callback, data, Local<Signature>(), length); |
| 4200 Utils::OpenHandle(*info)->set_do_not_cache(true); |
| 4201 return scope.Close(info->GetFunction()); |
| 4202 } |
| 4203 |
| 4204 |
4192 Local<v8::Object> Function::NewInstance() const { | 4205 Local<v8::Object> Function::NewInstance() const { |
4193 return NewInstance(0, NULL); | 4206 return NewInstance(0, NULL); |
4194 } | 4207 } |
4195 | 4208 |
4196 | 4209 |
4197 Local<v8::Object> Function::NewInstance(int argc, | 4210 Local<v8::Object> Function::NewInstance(int argc, |
4198 v8::Handle<v8::Value> argv[]) const { | 4211 v8::Handle<v8::Value> argv[]) const { |
4199 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); | 4212 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); |
4200 ON_BAILOUT(isolate, "v8::Function::NewInstance()", | 4213 ON_BAILOUT(isolate, "v8::Function::NewInstance()", |
4201 return Local<v8::Object>()); | 4214 return Local<v8::Object>()); |
(...skipping 3672 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7874 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); | 7887 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); |
7875 Address callback_address = | 7888 Address callback_address = |
7876 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 7889 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
7877 VMState<EXTERNAL> state(isolate); | 7890 VMState<EXTERNAL> state(isolate); |
7878 ExternalCallbackScope call_scope(isolate, callback_address); | 7891 ExternalCallbackScope call_scope(isolate, callback_address); |
7879 return callback(info); | 7892 return callback(info); |
7880 } | 7893 } |
7881 | 7894 |
7882 | 7895 |
7883 } } // namespace v8::internal | 7896 } } // namespace v8::internal |
OLD | NEW |