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 3588 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3599 i::Handle<i::Object> key_obj = Utils::OpenHandle(*key); | 3599 i::Handle<i::Object> key_obj = Utils::OpenHandle(*key); |
3600 i::Handle<i::Object> value_obj = Utils::OpenHandle(*value); | 3600 i::Handle<i::Object> value_obj = Utils::OpenHandle(*value); |
3601 has_pending_exception = | 3601 has_pending_exception = |
3602 DefineObjectProperty(self, key_obj, value_obj, | 3602 DefineObjectProperty(self, key_obj, value_obj, |
3603 static_cast<PropertyAttributes>(attribs)).is_null(); | 3603 static_cast<PropertyAttributes>(attribs)).is_null(); |
3604 EXCEPTION_BAILOUT_CHECK_SCOPED(isolate, false); | 3604 EXCEPTION_BAILOUT_CHECK_SCOPED(isolate, false); |
3605 return true; | 3605 return true; |
3606 } | 3606 } |
3607 | 3607 |
3608 | 3608 |
| 3609 Maybe<bool> v8::Object::SetPrivate(Local<Context> context, Local<Private> key, |
| 3610 Local<Value> value) { |
| 3611 return DefineOwnProperty(context, Local<Name>(reinterpret_cast<Name*>(*key)), |
| 3612 value, DontEnum); |
| 3613 } |
| 3614 |
| 3615 |
3609 MaybeLocal<Value> v8::Object::Get(Local<v8::Context> context, | 3616 MaybeLocal<Value> v8::Object::Get(Local<v8::Context> context, |
3610 Local<Value> key) { | 3617 Local<Value> key) { |
3611 PREPARE_FOR_EXECUTION(context, "v8::Object::Get()", Value); | 3618 PREPARE_FOR_EXECUTION(context, "v8::Object::Get()", Value); |
3612 auto self = Utils::OpenHandle(this); | 3619 auto self = Utils::OpenHandle(this); |
3613 auto key_obj = Utils::OpenHandle(*key); | 3620 auto key_obj = Utils::OpenHandle(*key); |
3614 i::Handle<i::Object> result; | 3621 i::Handle<i::Object> result; |
3615 has_pending_exception = | 3622 has_pending_exception = |
3616 !i::Runtime::GetObjectProperty(isolate, self, key_obj).ToHandle(&result); | 3623 !i::Runtime::GetObjectProperty(isolate, self, key_obj).ToHandle(&result); |
3617 RETURN_ON_FAILED_EXECUTION(Value); | 3624 RETURN_ON_FAILED_EXECUTION(Value); |
3618 RETURN_ESCAPED(Utils::ToLocal(result)); | 3625 RETURN_ESCAPED(Utils::ToLocal(result)); |
(...skipping 16 matching lines...) Expand all Loading... |
3635 RETURN_ESCAPED(Utils::ToLocal(result)); | 3642 RETURN_ESCAPED(Utils::ToLocal(result)); |
3636 } | 3643 } |
3637 | 3644 |
3638 | 3645 |
3639 Local<Value> v8::Object::Get(uint32_t index) { | 3646 Local<Value> v8::Object::Get(uint32_t index) { |
3640 auto context = ContextFromHeapObject(Utils::OpenHandle(this)); | 3647 auto context = ContextFromHeapObject(Utils::OpenHandle(this)); |
3641 RETURN_TO_LOCAL_UNCHECKED(Get(context, index), Value); | 3648 RETURN_TO_LOCAL_UNCHECKED(Get(context, index), Value); |
3642 } | 3649 } |
3643 | 3650 |
3644 | 3651 |
| 3652 MaybeLocal<Value> v8::Object::GetPrivate(Local<Context> context, |
| 3653 Local<Private> key) { |
| 3654 return Get(context, Local<Value>(reinterpret_cast<Value*>(*key))); |
| 3655 } |
| 3656 |
| 3657 |
3645 Maybe<PropertyAttribute> v8::Object::GetPropertyAttributes( | 3658 Maybe<PropertyAttribute> v8::Object::GetPropertyAttributes( |
3646 Local<Context> context, Local<Value> key) { | 3659 Local<Context> context, Local<Value> key) { |
3647 PREPARE_FOR_EXECUTION_PRIMITIVE( | 3660 PREPARE_FOR_EXECUTION_PRIMITIVE( |
3648 context, "v8::Object::GetPropertyAttributes()", PropertyAttribute); | 3661 context, "v8::Object::GetPropertyAttributes()", PropertyAttribute); |
3649 auto self = Utils::OpenHandle(this); | 3662 auto self = Utils::OpenHandle(this); |
3650 auto key_obj = Utils::OpenHandle(*key); | 3663 auto key_obj = Utils::OpenHandle(*key); |
3651 if (!key_obj->IsName()) { | 3664 if (!key_obj->IsName()) { |
3652 has_pending_exception = | 3665 has_pending_exception = |
3653 !i::Object::ToString(isolate, key_obj).ToHandle(&key_obj); | 3666 !i::Object::ToString(isolate, key_obj).ToHandle(&key_obj); |
3654 RETURN_ON_FAILED_EXECUTION_PRIMITIVE(PropertyAttribute); | 3667 RETURN_ON_FAILED_EXECUTION_PRIMITIVE(PropertyAttribute); |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3871 return Just(obj->IsTrue()); | 3884 return Just(obj->IsTrue()); |
3872 } | 3885 } |
3873 | 3886 |
3874 | 3887 |
3875 bool v8::Object::Delete(v8::Local<Value> key) { | 3888 bool v8::Object::Delete(v8::Local<Value> key) { |
3876 auto context = ContextFromHeapObject(Utils::OpenHandle(this)); | 3889 auto context = ContextFromHeapObject(Utils::OpenHandle(this)); |
3877 return Delete(context, key).FromMaybe(false); | 3890 return Delete(context, key).FromMaybe(false); |
3878 } | 3891 } |
3879 | 3892 |
3880 | 3893 |
| 3894 Maybe<bool> v8::Object::DeletePrivate(Local<Context> context, |
| 3895 Local<Private> key) { |
| 3896 return Delete(context, Local<Value>(reinterpret_cast<Value*>(*key))); |
| 3897 } |
| 3898 |
| 3899 |
3881 Maybe<bool> v8::Object::Has(Local<Context> context, Local<Value> key) { | 3900 Maybe<bool> v8::Object::Has(Local<Context> context, Local<Value> key) { |
3882 PREPARE_FOR_EXECUTION_PRIMITIVE(context, "v8::Object::Get()", bool); | 3901 PREPARE_FOR_EXECUTION_PRIMITIVE(context, "v8::Object::Get()", bool); |
3883 auto self = Utils::OpenHandle(this); | 3902 auto self = Utils::OpenHandle(this); |
3884 auto key_obj = Utils::OpenHandle(*key); | 3903 auto key_obj = Utils::OpenHandle(*key); |
3885 Maybe<bool> maybe = Nothing<bool>(); | 3904 Maybe<bool> maybe = Nothing<bool>(); |
3886 // Check if the given key is an array index. | 3905 // Check if the given key is an array index. |
3887 uint32_t index = 0; | 3906 uint32_t index = 0; |
3888 if (key_obj->ToArrayIndex(&index)) { | 3907 if (key_obj->ToArrayIndex(&index)) { |
3889 maybe = i::JSReceiver::HasElement(self, index); | 3908 maybe = i::JSReceiver::HasElement(self, index); |
3890 } else { | 3909 } else { |
3891 // Convert the key to a name - possibly by calling back into JavaScript. | 3910 // Convert the key to a name - possibly by calling back into JavaScript. |
3892 i::Handle<i::Name> name; | 3911 i::Handle<i::Name> name; |
3893 if (i::Object::ToName(isolate, key_obj).ToHandle(&name)) { | 3912 if (i::Object::ToName(isolate, key_obj).ToHandle(&name)) { |
3894 maybe = i::JSReceiver::HasProperty(self, name); | 3913 maybe = i::JSReceiver::HasProperty(self, name); |
3895 } | 3914 } |
3896 } | 3915 } |
3897 has_pending_exception = maybe.IsNothing(); | 3916 has_pending_exception = maybe.IsNothing(); |
3898 RETURN_ON_FAILED_EXECUTION_PRIMITIVE(bool); | 3917 RETURN_ON_FAILED_EXECUTION_PRIMITIVE(bool); |
3899 return maybe; | 3918 return maybe; |
3900 } | 3919 } |
3901 | 3920 |
3902 | 3921 |
3903 bool v8::Object::Has(v8::Local<Value> key) { | 3922 bool v8::Object::Has(v8::Local<Value> key) { |
3904 auto context = ContextFromHeapObject(Utils::OpenHandle(this)); | 3923 auto context = ContextFromHeapObject(Utils::OpenHandle(this)); |
3905 return Has(context, key).FromMaybe(false); | 3924 return Has(context, key).FromMaybe(false); |
3906 } | 3925 } |
3907 | 3926 |
3908 | 3927 |
| 3928 Maybe<bool> v8::Object::HasPrivate(Local<Context> context, Local<Private> key) { |
| 3929 return HasOwnProperty(context, Local<Name>(reinterpret_cast<Name*>(*key))); |
| 3930 } |
| 3931 |
| 3932 |
3909 Maybe<bool> v8::Object::Delete(Local<Context> context, uint32_t index) { | 3933 Maybe<bool> v8::Object::Delete(Local<Context> context, uint32_t index) { |
3910 PREPARE_FOR_EXECUTION_PRIMITIVE(context, "v8::Object::DeleteProperty()", | 3934 PREPARE_FOR_EXECUTION_PRIMITIVE(context, "v8::Object::DeleteProperty()", |
3911 bool); | 3935 bool); |
3912 auto self = Utils::OpenHandle(this); | 3936 auto self = Utils::OpenHandle(this); |
3913 i::Handle<i::Object> obj; | 3937 i::Handle<i::Object> obj; |
3914 has_pending_exception = | 3938 has_pending_exception = |
3915 !i::JSReceiver::DeleteElement(self, index).ToHandle(&obj); | 3939 !i::JSReceiver::DeleteElement(self, index).ToHandle(&obj); |
3916 RETURN_ON_FAILED_EXECUTION_PRIMITIVE(bool); | 3940 RETURN_ON_FAILED_EXECUTION_PRIMITIVE(bool); |
3917 return Just(obj->IsTrue()); | 3941 return Just(obj->IsTrue()); |
3918 } | 3942 } |
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4231 auto isolate = Utils::OpenHandle(this)->GetIsolate(); | 4255 auto isolate = Utils::OpenHandle(this)->GetIsolate(); |
4232 i::HandleScope scope(isolate); | 4256 i::HandleScope scope(isolate); |
4233 auto self = Utils::OpenHandle(this); | 4257 auto self = Utils::OpenHandle(this); |
4234 return i::JSReceiver::GetOrCreateIdentityHash(self)->value(); | 4258 return i::JSReceiver::GetOrCreateIdentityHash(self)->value(); |
4235 } | 4259 } |
4236 | 4260 |
4237 | 4261 |
4238 bool v8::Object::SetHiddenValue(v8::Local<v8::String> key, | 4262 bool v8::Object::SetHiddenValue(v8::Local<v8::String> key, |
4239 v8::Local<v8::Value> value) { | 4263 v8::Local<v8::Value> value) { |
4240 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); | 4264 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); |
4241 if (value.IsEmpty()) return DeleteHiddenValue(key); | |
4242 ENTER_V8(isolate); | 4265 ENTER_V8(isolate); |
4243 i::HandleScope scope(isolate); | 4266 i::HandleScope scope(isolate); |
4244 i::Handle<i::JSObject> self = Utils::OpenHandle(this); | 4267 i::Handle<i::JSObject> self = Utils::OpenHandle(this); |
4245 i::Handle<i::String> key_obj = Utils::OpenHandle(*key); | 4268 i::Handle<i::String> key_obj = Utils::OpenHandle(*key); |
4246 i::Handle<i::String> key_string = | 4269 i::Handle<i::String> key_string = |
4247 isolate->factory()->InternalizeString(key_obj); | 4270 isolate->factory()->InternalizeString(key_obj); |
| 4271 if (value.IsEmpty()) { |
| 4272 i::JSObject::DeleteHiddenProperty(self, key_string); |
| 4273 return true; |
| 4274 } |
4248 i::Handle<i::Object> value_obj = Utils::OpenHandle(*value); | 4275 i::Handle<i::Object> value_obj = Utils::OpenHandle(*value); |
4249 i::Handle<i::Object> result = | 4276 i::Handle<i::Object> result = |
4250 i::JSObject::SetHiddenProperty(self, key_string, value_obj); | 4277 i::JSObject::SetHiddenProperty(self, key_string, value_obj); |
4251 return *result == *self; | 4278 return *result == *self; |
4252 } | 4279 } |
4253 | 4280 |
4254 | 4281 |
4255 v8::Local<v8::Value> v8::Object::GetHiddenValue(v8::Local<v8::String> key) { | 4282 v8::Local<v8::Value> v8::Object::GetHiddenValue(v8::Local<v8::String> key) { |
4256 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); | 4283 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); |
4257 ENTER_V8(isolate); | 4284 ENTER_V8(isolate); |
(...skipping 984 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5242 } | 5269 } |
5243 | 5270 |
5244 | 5271 |
5245 Local<Value> Symbol::Name() const { | 5272 Local<Value> Symbol::Name() const { |
5246 i::Handle<i::Symbol> sym = Utils::OpenHandle(this); | 5273 i::Handle<i::Symbol> sym = Utils::OpenHandle(this); |
5247 i::Handle<i::Object> name(sym->name(), sym->GetIsolate()); | 5274 i::Handle<i::Object> name(sym->name(), sym->GetIsolate()); |
5248 return Utils::ToLocal(name); | 5275 return Utils::ToLocal(name); |
5249 } | 5276 } |
5250 | 5277 |
5251 | 5278 |
| 5279 Local<Value> Private::Name() const { |
| 5280 return reinterpret_cast<const Symbol*>(this)->Name(); |
| 5281 } |
| 5282 |
| 5283 |
5252 double Number::Value() const { | 5284 double Number::Value() const { |
5253 i::Handle<i::Object> obj = Utils::OpenHandle(this); | 5285 i::Handle<i::Object> obj = Utils::OpenHandle(this); |
5254 return obj->Number(); | 5286 return obj->Number(); |
5255 } | 5287 } |
5256 | 5288 |
5257 | 5289 |
5258 bool Boolean::Value() const { | 5290 bool Boolean::Value() const { |
5259 i::Handle<i::Object> obj = Utils::OpenHandle(this); | 5291 i::Handle<i::Object> obj = Utils::OpenHandle(this); |
5260 return obj->IsTrue(); | 5292 return obj->IsTrue(); |
5261 } | 5293 } |
(...skipping 1552 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6814 LOG_API(i_isolate, "Symbol::New()"); | 6846 LOG_API(i_isolate, "Symbol::New()"); |
6815 ENTER_V8(i_isolate); | 6847 ENTER_V8(i_isolate); |
6816 i::Handle<i::Symbol> result = i_isolate->factory()->NewSymbol(); | 6848 i::Handle<i::Symbol> result = i_isolate->factory()->NewSymbol(); |
6817 if (!name.IsEmpty()) result->set_name(*Utils::OpenHandle(*name)); | 6849 if (!name.IsEmpty()) result->set_name(*Utils::OpenHandle(*name)); |
6818 return Utils::ToLocal(result); | 6850 return Utils::ToLocal(result); |
6819 } | 6851 } |
6820 | 6852 |
6821 | 6853 |
6822 static i::Handle<i::Symbol> SymbolFor(i::Isolate* isolate, | 6854 static i::Handle<i::Symbol> SymbolFor(i::Isolate* isolate, |
6823 i::Handle<i::String> name, | 6855 i::Handle<i::String> name, |
6824 i::Handle<i::String> part) { | 6856 i::Handle<i::String> part, |
| 6857 bool private_symbol) { |
6825 i::Handle<i::JSObject> registry = isolate->GetSymbolRegistry(); | 6858 i::Handle<i::JSObject> registry = isolate->GetSymbolRegistry(); |
6826 i::Handle<i::JSObject> symbols = | 6859 i::Handle<i::JSObject> symbols = |
6827 i::Handle<i::JSObject>::cast( | 6860 i::Handle<i::JSObject>::cast( |
6828 i::Object::GetPropertyOrElement(registry, part).ToHandleChecked()); | 6861 i::Object::GetPropertyOrElement(registry, part).ToHandleChecked()); |
6829 i::Handle<i::Object> symbol = | 6862 i::Handle<i::Object> symbol = |
6830 i::Object::GetPropertyOrElement(symbols, name).ToHandleChecked(); | 6863 i::Object::GetPropertyOrElement(symbols, name).ToHandleChecked(); |
6831 if (!symbol->IsSymbol()) { | 6864 if (!symbol->IsSymbol()) { |
6832 DCHECK(symbol->IsUndefined()); | 6865 DCHECK(symbol->IsUndefined()); |
6833 symbol = isolate->factory()->NewSymbol(); | 6866 if (private_symbol) |
| 6867 symbol = isolate->factory()->NewPrivateSymbol(); |
| 6868 else |
| 6869 symbol = isolate->factory()->NewSymbol(); |
6834 i::Handle<i::Symbol>::cast(symbol)->set_name(*name); | 6870 i::Handle<i::Symbol>::cast(symbol)->set_name(*name); |
6835 i::JSObject::SetProperty(symbols, name, symbol, i::STRICT).Assert(); | 6871 i::JSObject::SetProperty(symbols, name, symbol, i::STRICT).Assert(); |
6836 } | 6872 } |
6837 return i::Handle<i::Symbol>::cast(symbol); | 6873 return i::Handle<i::Symbol>::cast(symbol); |
6838 } | 6874 } |
6839 | 6875 |
6840 | 6876 |
6841 Local<Symbol> v8::Symbol::For(Isolate* isolate, Local<String> name) { | 6877 Local<Symbol> v8::Symbol::For(Isolate* isolate, Local<String> name) { |
6842 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); | 6878 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); |
6843 i::Handle<i::String> i_name = Utils::OpenHandle(*name); | 6879 i::Handle<i::String> i_name = Utils::OpenHandle(*name); |
6844 i::Handle<i::String> part = i_isolate->factory()->for_string(); | 6880 i::Handle<i::String> part = i_isolate->factory()->for_string(); |
6845 return Utils::ToLocal(SymbolFor(i_isolate, i_name, part)); | 6881 return Utils::ToLocal(SymbolFor(i_isolate, i_name, part, false)); |
6846 } | 6882 } |
6847 | 6883 |
6848 | 6884 |
6849 Local<Symbol> v8::Symbol::ForApi(Isolate* isolate, Local<String> name) { | 6885 Local<Symbol> v8::Symbol::ForApi(Isolate* isolate, Local<String> name) { |
6850 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); | 6886 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); |
6851 i::Handle<i::String> i_name = Utils::OpenHandle(*name); | 6887 i::Handle<i::String> i_name = Utils::OpenHandle(*name); |
6852 i::Handle<i::String> part = i_isolate->factory()->for_api_string(); | 6888 i::Handle<i::String> part = i_isolate->factory()->for_api_string(); |
6853 return Utils::ToLocal(SymbolFor(i_isolate, i_name, part)); | 6889 return Utils::ToLocal(SymbolFor(i_isolate, i_name, part, false)); |
6854 } | 6890 } |
6855 | 6891 |
6856 | 6892 |
6857 Local<Symbol> v8::Symbol::GetIterator(Isolate* isolate) { | 6893 Local<Symbol> v8::Symbol::GetIterator(Isolate* isolate) { |
6858 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); | 6894 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); |
6859 return Utils::ToLocal(i_isolate->factory()->iterator_symbol()); | 6895 return Utils::ToLocal(i_isolate->factory()->iterator_symbol()); |
6860 } | 6896 } |
6861 | 6897 |
6862 | 6898 |
6863 Local<Symbol> v8::Symbol::GetUnscopables(Isolate* isolate) { | 6899 Local<Symbol> v8::Symbol::GetUnscopables(Isolate* isolate) { |
6864 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); | 6900 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); |
6865 return Utils::ToLocal(i_isolate->factory()->unscopables_symbol()); | 6901 return Utils::ToLocal(i_isolate->factory()->unscopables_symbol()); |
6866 } | 6902 } |
6867 | 6903 |
6868 | 6904 |
6869 Local<Symbol> v8::Symbol::GetToStringTag(Isolate* isolate) { | 6905 Local<Symbol> v8::Symbol::GetToStringTag(Isolate* isolate) { |
6870 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); | 6906 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); |
6871 return Utils::ToLocal(i_isolate->factory()->to_string_tag_symbol()); | 6907 return Utils::ToLocal(i_isolate->factory()->to_string_tag_symbol()); |
6872 } | 6908 } |
6873 | 6909 |
6874 | 6910 |
6875 Local<Symbol> v8::Symbol::GetIsConcatSpreadable(Isolate* isolate) { | 6911 Local<Symbol> v8::Symbol::GetIsConcatSpreadable(Isolate* isolate) { |
6876 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); | 6912 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); |
6877 return Utils::ToLocal(i_isolate->factory()->is_concat_spreadable_symbol()); | 6913 return Utils::ToLocal(i_isolate->factory()->is_concat_spreadable_symbol()); |
6878 } | 6914 } |
6879 | 6915 |
6880 | 6916 |
| 6917 Local<Private> v8::Private::New(Isolate* isolate, Local<String> name) { |
| 6918 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); |
| 6919 LOG_API(i_isolate, "Private::New()"); |
| 6920 ENTER_V8(i_isolate); |
| 6921 i::Handle<i::Symbol> symbol = i_isolate->factory()->NewPrivateSymbol(); |
| 6922 if (!name.IsEmpty()) symbol->set_name(*Utils::OpenHandle(*name)); |
| 6923 Local<Symbol> result = Utils::ToLocal(symbol); |
| 6924 return v8::Local<Private>(reinterpret_cast<Private*>(*result)); |
| 6925 } |
| 6926 |
| 6927 |
| 6928 Local<Private> v8::Private::ForApi(Isolate* isolate, Local<String> name) { |
| 6929 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); |
| 6930 i::Handle<i::String> i_name = Utils::OpenHandle(*name); |
| 6931 i::Handle<i::String> part = i_isolate->factory()->private_api_string(); |
| 6932 Local<Symbol> result = |
| 6933 Utils::ToLocal(SymbolFor(i_isolate, i_name, part, true)); |
| 6934 return v8::Local<Private>(reinterpret_cast<Private*>(*result)); |
| 6935 } |
| 6936 |
| 6937 |
6881 Local<Number> v8::Number::New(Isolate* isolate, double value) { | 6938 Local<Number> v8::Number::New(Isolate* isolate, double value) { |
6882 i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(isolate); | 6939 i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(isolate); |
6883 if (std::isnan(value)) { | 6940 if (std::isnan(value)) { |
6884 // Introduce only canonical NaN value into the VM, to avoid signaling NaNs. | 6941 // Introduce only canonical NaN value into the VM, to avoid signaling NaNs. |
6885 value = std::numeric_limits<double>::quiet_NaN(); | 6942 value = std::numeric_limits<double>::quiet_NaN(); |
6886 } | 6943 } |
6887 ENTER_V8(internal_isolate); | 6944 ENTER_V8(internal_isolate); |
6888 i::Handle<i::Object> result = internal_isolate->factory()->NewNumber(value); | 6945 i::Handle<i::Object> result = internal_isolate->factory()->NewNumber(value); |
6889 return Utils::NumberToLocal(result); | 6946 return Utils::NumberToLocal(result); |
6890 } | 6947 } |
(...skipping 1571 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8462 Address callback_address = | 8519 Address callback_address = |
8463 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 8520 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
8464 VMState<EXTERNAL> state(isolate); | 8521 VMState<EXTERNAL> state(isolate); |
8465 ExternalCallbackScope call_scope(isolate, callback_address); | 8522 ExternalCallbackScope call_scope(isolate, callback_address); |
8466 callback(info); | 8523 callback(info); |
8467 } | 8524 } |
8468 | 8525 |
8469 | 8526 |
8470 } // namespace internal | 8527 } // namespace internal |
8471 } // namespace v8 | 8528 } // namespace v8 |
OLD | NEW |