| 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 "src/api.h" | 5 #include "src/api.h" |
| 6 | 6 |
| 7 #include <string.h> // For memcpy, strlen. | 7 #include <string.h> // For memcpy, strlen. |
| 8 #ifdef V8_USE_ADDRESS_SANITIZER | 8 #ifdef V8_USE_ADDRESS_SANITIZER |
| 9 #include <sanitizer/asan_interface.h> | 9 #include <sanitizer/asan_interface.h> |
| 10 #endif // V8_USE_ADDRESS_SANITIZER | 10 #endif // V8_USE_ADDRESS_SANITIZER |
| (...skipping 4264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4275 | 4275 |
| 4276 | 4276 |
| 4277 Local<v8::Value> Object::CallAsConstructor(int argc, | 4277 Local<v8::Value> Object::CallAsConstructor(int argc, |
| 4278 v8::Handle<v8::Value> argv[]) { | 4278 v8::Handle<v8::Value> argv[]) { |
| 4279 auto context = ContextFromHeapObject(Utils::OpenHandle(this)); | 4279 auto context = ContextFromHeapObject(Utils::OpenHandle(this)); |
| 4280 Local<Value>* argv_cast = reinterpret_cast<Local<Value>*>(argv); | 4280 Local<Value>* argv_cast = reinterpret_cast<Local<Value>*>(argv); |
| 4281 RETURN_TO_LOCAL_UNCHECKED(CallAsConstructor(context, argc, argv_cast), Value); | 4281 RETURN_TO_LOCAL_UNCHECKED(CallAsConstructor(context, argc, argv_cast), Value); |
| 4282 } | 4282 } |
| 4283 | 4283 |
| 4284 | 4284 |
| 4285 Local<Function> Function::New(Isolate* v8_isolate, | 4285 MaybeLocal<Function> Function::New(Local<Context> context, |
| 4286 FunctionCallback callback, | 4286 FunctionCallback callback, Local<Value> data, |
| 4287 Local<Value> data, | 4287 int length) { |
| 4288 int length) { | 4288 i::Isolate* isolate = Utils::OpenHandle(*context)->GetIsolate(); |
| 4289 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate); | |
| 4290 LOG_API(isolate, "Function::New"); | 4289 LOG_API(isolate, "Function::New"); |
| 4291 ENTER_V8(isolate); | 4290 ENTER_V8(isolate); |
| 4292 return FunctionTemplateNew( | 4291 return FunctionTemplateNew(isolate, callback, data, Local<Signature>(), |
| 4293 isolate, callback, data, Local<Signature>(), length, true)-> | 4292 length, true)->GetFunction(context); |
| 4294 GetFunction(); | |
| 4295 } | 4293 } |
| 4296 | 4294 |
| 4297 | 4295 |
| 4296 Local<Function> Function::New(Isolate* v8_isolate, FunctionCallback callback, |
| 4297 Local<Value> data, int length) { |
| 4298 return Function::New(v8_isolate->GetCurrentContext(), callback, data, length) |
| 4299 .FromMaybe(Local<Function>()); |
| 4300 } |
| 4301 |
| 4302 |
| 4298 Local<v8::Object> Function::NewInstance() const { | 4303 Local<v8::Object> Function::NewInstance() const { |
| 4299 return NewInstance(0, NULL); | 4304 return NewInstance(0, NULL); |
| 4300 } | 4305 } |
| 4301 | 4306 |
| 4302 | 4307 |
| 4303 MaybeLocal<Object> Function::NewInstance(Local<Context> context, int argc, | 4308 MaybeLocal<Object> Function::NewInstance(Local<Context> context, int argc, |
| 4304 v8::Handle<v8::Value> argv[]) const { | 4309 v8::Handle<v8::Value> argv[]) const { |
| 4305 PREPARE_FOR_EXECUTION_WITH_CALLBACK(context, "v8::Function::NewInstance()", | 4310 PREPARE_FOR_EXECUTION_WITH_CALLBACK(context, "v8::Function::NewInstance()", |
| 4306 Object); | 4311 Object); |
| 4307 i::TimerEventScope<i::TimerEventExecute> timer_scope(isolate); | 4312 i::TimerEventScope<i::TimerEventExecute> timer_scope(isolate); |
| (...skipping 3713 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8021 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); | 8026 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); |
| 8022 Address callback_address = | 8027 Address callback_address = |
| 8023 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 8028 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
| 8024 VMState<EXTERNAL> state(isolate); | 8029 VMState<EXTERNAL> state(isolate); |
| 8025 ExternalCallbackScope call_scope(isolate, callback_address); | 8030 ExternalCallbackScope call_scope(isolate, callback_address); |
| 8026 callback(info); | 8031 callback(info); |
| 8027 } | 8032 } |
| 8028 | 8033 |
| 8029 | 8034 |
| 8030 } } // namespace v8::internal | 8035 } } // namespace v8::internal |
| OLD | NEW |