| Index: Source/build/scripts/templates/MakeNames.cpp.tmpl
|
| diff --git a/Source/build/scripts/templates/MakeNames.cpp.tmpl b/Source/build/scripts/templates/MakeNames.cpp.tmpl
|
| index 27bad7d23aeb5cf5dbd3a557f3bb638c568248d9..68af7d3d89ef7e589edb1121cb511d044f3867d0 100644
|
| --- a/Source/build/scripts/templates/MakeNames.cpp.tmpl
|
| +++ b/Source/build/scripts/templates/MakeNames.cpp.tmpl
|
| @@ -5,32 +5,42 @@
|
|
|
| #include "{{namespace}}{{suffix}}Names.h"
|
|
|
| -#include "wtf/StaticConstructors.h"
|
| +#include "wtf/StdLibExtras.h"
|
|
|
| namespace blink {
|
| namespace {{namespace}}Names {
|
|
|
| using namespace WTF;
|
|
|
| -{% for entry in entries|sort %}
|
| +const int k{{suffix}}NameCount = {{entries|length}};
|
| +
|
| +void* {{suffix}}NamesStorage[k{{suffix}}NameCount * ((sizeof(AtomicString) + sizeof(void *) - 1) / sizeof(void *))];
|
| +
|
| +{% for entry in entries|sort(attribute='name', case_sensitive=True) %}
|
| {% filter enable_conditional(entry.Conditional) %}
|
| -DEFINE_GLOBAL(AtomicString, {{entry|symbol}})
|
| +const AtomicString& {{entry|symbol}} = reinterpret_cast<AtomicString*>(&{{suffix}}NamesStorage)[{{loop.index0}}];
|
| {% endfilter %}
|
| {% endfor %}
|
|
|
| void init{{suffix}}()
|
| {
|
| - {% for entry in entries|sort %}
|
| - {% filter enable_conditional(entry.Conditional) %}
|
| - StringImpl* {{entry|symbol}}Impl = StringImpl::createStatic("{{entry|cpp_name}}", {{entry|cpp_name|length}}, {{entry|cpp_name|hash}});
|
| - {% endfilter %}
|
| + struct NameEntry {
|
| + const char* name;
|
| + unsigned hash;
|
| + unsigned char length;
|
| + };
|
| +
|
| + static const NameEntry kNames[] = {
|
| + {% for entry in entries|sort(attribute='name', case_sensitive=True) %}
|
| + { "{{entry|cpp_name}}", {{entry|cpp_name|hash}}, {{entry|cpp_name|length}} },
|
| {% endfor %}
|
| + };
|
|
|
| - {% for entry in entries|sort %}
|
| - {% filter enable_conditional(entry.Conditional) %}
|
| - new ((void*)&{{entry|symbol}}) AtomicString({{entry|symbol}}Impl);
|
| - {% endfilter %}
|
| - {% endfor %}
|
| + for (size_t i = 0; i < WTF_ARRAY_LENGTH(kNames); i++) {
|
| + StringImpl* stringImpl = StringImpl::createStatic(kNames[i].name, kNames[i].length, kNames[i].hash);
|
| + void* address = reinterpret_cast<AtomicString*>(&{{suffix}}NamesStorage) + i;
|
| + new (address) AtomicString(stringImpl);
|
| + }
|
| }
|
|
|
| } // {{namespace}}Names
|
|
|