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 6978 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6989 i::Object::GetPropertyOrElement(registry, part).ToHandleChecked()); | 6989 i::Object::GetPropertyOrElement(registry, part).ToHandleChecked()); |
6990 i::Handle<i::Object> symbol = | 6990 i::Handle<i::Object> symbol = |
6991 i::Object::GetPropertyOrElement(symbols, name).ToHandleChecked(); | 6991 i::Object::GetPropertyOrElement(symbols, name).ToHandleChecked(); |
6992 if (!symbol->IsSymbol()) { | 6992 if (!symbol->IsSymbol()) { |
6993 DCHECK(symbol->IsUndefined()); | 6993 DCHECK(symbol->IsUndefined()); |
6994 if (private_symbol) | 6994 if (private_symbol) |
6995 symbol = isolate->factory()->NewPrivateSymbol(); | 6995 symbol = isolate->factory()->NewPrivateSymbol(); |
6996 else | 6996 else |
6997 symbol = isolate->factory()->NewSymbol(); | 6997 symbol = isolate->factory()->NewSymbol(); |
6998 i::Handle<i::Symbol>::cast(symbol)->set_name(*name); | 6998 i::Handle<i::Symbol>::cast(symbol)->set_name(*name); |
6999 i::JSObject::SetProperty(symbols, name, symbol, i::STRICT).Assert(); | 6999 i::Object::SetPropertyOrElement(symbols, name, symbol, i::STRICT).Assert(); |
7000 } | 7000 } |
7001 return i::Handle<i::Symbol>::cast(symbol); | 7001 return i::Handle<i::Symbol>::cast(symbol); |
7002 } | 7002 } |
7003 | 7003 |
7004 | 7004 |
7005 Local<Symbol> v8::Symbol::For(Isolate* isolate, Local<String> name) { | 7005 Local<Symbol> v8::Symbol::For(Isolate* isolate, Local<String> name) { |
7006 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); | 7006 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); |
7007 i::Handle<i::String> i_name = Utils::OpenHandle(*name); | 7007 i::Handle<i::String> i_name = Utils::OpenHandle(*name); |
7008 i::Handle<i::String> part = i_isolate->factory()->for_string(); | 7008 i::Handle<i::String> part = i_isolate->factory()->for_string(); |
7009 return Utils::ToLocal(SymbolFor(i_isolate, i_name, part, false)); | 7009 return Utils::ToLocal(SymbolFor(i_isolate, i_name, part, false)); |
(...skipping 1824 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8834 Address callback_address = | 8834 Address callback_address = |
8835 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 8835 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
8836 VMState<EXTERNAL> state(isolate); | 8836 VMState<EXTERNAL> state(isolate); |
8837 ExternalCallbackScope call_scope(isolate, callback_address); | 8837 ExternalCallbackScope call_scope(isolate, callback_address); |
8838 callback(info); | 8838 callback(info); |
8839 } | 8839 } |
8840 | 8840 |
8841 | 8841 |
8842 } // namespace internal | 8842 } // namespace internal |
8843 } // namespace v8 | 8843 } // namespace v8 |
OLD | NEW |