| 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 4504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4515 if (!func->shared()->script()->IsScript()) { | 4515 if (!func->shared()->script()->IsScript()) { |
| 4516 return v8::UnboundScript::kNoScriptId; | 4516 return v8::UnboundScript::kNoScriptId; |
| 4517 } | 4517 } |
| 4518 i::Handle<i::Script> script(i::Script::cast(func->shared()->script())); | 4518 i::Handle<i::Script> script(i::Script::cast(func->shared()->script())); |
| 4519 return script->id(); | 4519 return script->id(); |
| 4520 } | 4520 } |
| 4521 | 4521 |
| 4522 | 4522 |
| 4523 Local<v8::Value> Function::GetBoundFunction() const { | 4523 Local<v8::Value> Function::GetBoundFunction() const { |
| 4524 auto self = Utils::OpenHandle(this); | 4524 auto self = Utils::OpenHandle(this); |
| 4525 if (!self->IsJSFunction()) { | 4525 if (self->IsJSBoundFunction()) { |
| 4526 return v8::Undefined(reinterpret_cast<v8::Isolate*>(self->GetIsolate())); | 4526 auto bound_function = i::Handle<i::JSBoundFunction>::cast(self); |
| 4527 auto bound_target_function = i::handle( |
| 4528 bound_function->bound_target_function(), bound_function->GetIsolate()); |
| 4529 return Utils::CallableToLocal(bound_target_function); |
| 4527 } | 4530 } |
| 4528 auto func = i::Handle<i::JSFunction>::cast(self); | 4531 return v8::Undefined(reinterpret_cast<v8::Isolate*>(self->GetIsolate())); |
| 4529 if (!func->shared()->bound()) { | |
| 4530 return v8::Undefined(reinterpret_cast<v8::Isolate*>(func->GetIsolate())); | |
| 4531 } | |
| 4532 i::Handle<i::BindingsArray> bound_args = i::Handle<i::BindingsArray>( | |
| 4533 i::BindingsArray::cast(func->function_bindings())); | |
| 4534 i::Handle<i::Object> original(bound_args->bound_function(), | |
| 4535 func->GetIsolate()); | |
| 4536 return Utils::CallableToLocal(i::Handle<i::JSFunction>::cast(original)); | |
| 4537 } | 4532 } |
| 4538 | 4533 |
| 4539 | 4534 |
| 4540 int Name::GetIdentityHash() { | 4535 int Name::GetIdentityHash() { |
| 4541 auto self = Utils::OpenHandle(this); | 4536 auto self = Utils::OpenHandle(this); |
| 4542 return static_cast<int>(self->Hash()); | 4537 return static_cast<int>(self->Hash()); |
| 4543 } | 4538 } |
| 4544 | 4539 |
| 4545 | 4540 |
| 4546 int String::Length() const { | 4541 int String::Length() const { |
| (...skipping 3945 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8492 Address callback_address = | 8487 Address callback_address = |
| 8493 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 8488 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
| 8494 VMState<EXTERNAL> state(isolate); | 8489 VMState<EXTERNAL> state(isolate); |
| 8495 ExternalCallbackScope call_scope(isolate, callback_address); | 8490 ExternalCallbackScope call_scope(isolate, callback_address); |
| 8496 callback(info); | 8491 callback(info); |
| 8497 } | 8492 } |
| 8498 | 8493 |
| 8499 | 8494 |
| 8500 } // namespace internal | 8495 } // namespace internal |
| 8501 } // namespace v8 | 8496 } // namespace v8 |
| OLD | NEW |