Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Side by Side Diff: src/api.cc

Issue 1899283003: Allow for creating Private API symbols that have a number as an ID (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: updates Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | src/objects.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « no previous file | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698