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 4425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4436 if (!self->IsJSFunction()) { | 4436 if (!self->IsJSFunction()) { |
4437 return ToApiHandle<Primitive>( | 4437 return ToApiHandle<Primitive>( |
4438 self->GetIsolate()->factory()->undefined_value()); | 4438 self->GetIsolate()->factory()->undefined_value()); |
4439 } | 4439 } |
4440 auto func = i::Handle<i::JSFunction>::cast(self); | 4440 auto func = i::Handle<i::JSFunction>::cast(self); |
4441 return Utils::ToLocal(i::Handle<i::Object>(func->shared()->inferred_name(), | 4441 return Utils::ToLocal(i::Handle<i::Object>(func->shared()->inferred_name(), |
4442 func->GetIsolate())); | 4442 func->GetIsolate())); |
4443 } | 4443 } |
4444 | 4444 |
4445 | 4445 |
| 4446 Local<Value> Function::GetDebugName() const { |
| 4447 auto self = Utils::OpenHandle(this); |
| 4448 if (!self->IsJSFunction()) { |
| 4449 return ToApiHandle<Primitive>( |
| 4450 self->GetIsolate()->factory()->undefined_value()); |
| 4451 } |
| 4452 auto func = i::Handle<i::JSFunction>::cast(self); |
| 4453 i::Handle<i::String> name = i::JSFunction::GetDebugName(func); |
| 4454 return Utils::ToLocal(i::Handle<i::Object>(*name, name->GetIsolate())); |
| 4455 } |
| 4456 |
| 4457 |
4446 Local<Value> Function::GetDisplayName() const { | 4458 Local<Value> Function::GetDisplayName() const { |
4447 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); | 4459 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); |
4448 ENTER_V8(isolate); | 4460 ENTER_V8(isolate); |
4449 auto self = Utils::OpenHandle(this); | 4461 auto self = Utils::OpenHandle(this); |
4450 if (!self->IsJSFunction()) { | 4462 if (!self->IsJSFunction()) { |
4451 return ToApiHandle<Primitive>(isolate->factory()->undefined_value()); | 4463 return ToApiHandle<Primitive>(isolate->factory()->undefined_value()); |
4452 } | 4464 } |
4453 auto func = i::Handle<i::JSFunction>::cast(self); | 4465 auto func = i::Handle<i::JSFunction>::cast(self); |
4454 i::Handle<i::String> property_name = | 4466 i::Handle<i::String> property_name = |
4455 isolate->factory()->NewStringFromStaticChars("displayName"); | 4467 isolate->factory()->NewStringFromStaticChars("displayName"); |
(...skipping 4044 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8500 Address callback_address = | 8512 Address callback_address = |
8501 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 8513 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
8502 VMState<EXTERNAL> state(isolate); | 8514 VMState<EXTERNAL> state(isolate); |
8503 ExternalCallbackScope call_scope(isolate, callback_address); | 8515 ExternalCallbackScope call_scope(isolate, callback_address); |
8504 callback(info); | 8516 callback(info); |
8505 } | 8517 } |
8506 | 8518 |
8507 | 8519 |
8508 } // namespace internal | 8520 } // namespace internal |
8509 } // namespace v8 | 8521 } // namespace v8 |
OLD | NEW |