| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1258,6 +1258,16 @@ | |||
| 1258 | 1258 | ], | |
| 1259 | 1259 | ||
| 1260 | 1260 | 'conditions': [ | |
| 1261 | + [ 'node_use_openssl=="true"', { | ||
| 1262 | + 'defines': [ | ||
| 1263 | + 'HAVE_OPENSSL=1', | ||
| 1264 | + ], | ||
| 1265 | + }], | ||
| 1266 | + ['v8_enable_inspector==1', { | ||
| 1267 | + 'defines': [ | ||
| 1268 | + 'HAVE_INSPECTOR=1', | ||
| 1269 | + ], | ||
| 1270 | + }], | ||
| 1261 | 1271 | ['OS=="win"', { | |
| 1262 | 1272 | 'libraries': [ | |
| 1263 | 1273 | 'dbghelp.lib', | |
@@ -1302,6 +1312,16 @@ | |||
| 1302 | 1312 | ], | |
| 1303 | 1313 | ||
| 1304 | 1314 | 'conditions': [ | |
| 1315 | + [ 'node_use_openssl=="true"', { | ||
| 1316 | + 'defines': [ | ||
| 1317 | + 'HAVE_OPENSSL=1', | ||
| 1318 | + ], | ||
| 1319 | + }], | ||
| 1320 | + ['v8_enable_inspector==1', { | ||
| 1321 | + 'defines': [ | ||
| 1322 | + 'HAVE_INSPECTOR=1', | ||
| 1323 | + ], | ||
| 1324 | + }], | ||
| 1305 | 1325 | ['OS=="win"', { | |
| 1306 | 1326 | 'libraries': [ | |
| 1307 | 1327 | 'Dbghelp.lib', | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -42,6 +42,7 @@ void FWrite(FILE* file, const std::string& str); | |||
| 42 | 42 | NODE_ASYNC_PROVIDER_TYPES(V) \ | |
| 43 | 43 | V(INSPECTOR_SERVER) \ | |
| 44 | 44 | V(INSPECTOR_PROFILER) \ | |
| 45 | + V(CODE_CACHE) \ | ||
| 45 | 46 | V(WASI) | |
| 46 | 47 | ||
| 47 | 48 | enum class DebugCategory { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,4 +1,5 @@ | |||
| 1 | 1 | #include "cache_builder.h" | |
| 2 | + #include "debug_utils-inl.h" | ||
| 2 | 3 | #include "node_native_module.h" | |
| 3 | 4 | #include "util.h" | |
| 4 | 5 | ||
@@ -67,8 +68,7 @@ static void GetInitializer(const std::string& id, std::stringstream& ss) { | |||
| 67 | 68 | } | |
| 68 | 69 | ||
| 69 | 70 | static std::string GenerateCodeCache( | |
| 70 | - const std::map<std::string, ScriptCompiler::CachedData*>& data, | ||
| 71 | - bool log_progress) { | ||
| 71 | + const std::map<std::string, ScriptCompiler::CachedData*>& data) { | ||
| 72 | 72 | std::stringstream ss; | |
| 73 | 73 | ss << R"(#include <cinttypes> | |
| 74 | 74 | #include "node_native_module_env.h" | |
@@ -89,11 +89,13 @@ const bool has_code_cache = true; | |||
| 89 | 89 | total += cached_data->length; | |
| 90 | 90 | std::string def = GetDefinition(id, cached_data->length, cached_data->data); | |
| 91 | 91 | ss << def << "\n\n"; | |
| 92 | - if (log_progress) { | ||
| 93 | - std::cout << "Generated cache for " << id | ||
| 94 | - << ", size = " << FormatSize(cached_data->length) | ||
| 95 | - << ", total = " << FormatSize(total) << "\n"; | ||
| 96 | - } | ||
| 92 | + std::string size_str = FormatSize(cached_data->length); | ||
| 93 | + std::string total_str = FormatSize(total); | ||
| 94 | + per_process::Debug(DebugCategory::CODE_CACHE, | ||
| 95 | + "Generated cache for %s, size = %s, total = %s\n", | ||
| 96 | + id.c_str(), | ||
| 97 | + size_str.c_str(), | ||
| 98 | + total_str.c_str()); | ||
| 97 | 99 | } | |
| 98 | 100 | ||
| 99 | 101 | ss << R"(void NativeModuleEnv::InitializeCodeCache() { | |
@@ -142,14 +144,7 @@ std::string CodeCacheBuilder::Generate(Local<Context> context) { | |||
| 142 | 144 | } | |
| 143 | 145 | } | |
| 144 | 146 | ||
| 145 | - char env_buf[32]; | ||
| 146 | - size_t env_size = sizeof(env_buf); | ||
| 147 | - int ret = uv_os_getenv("NODE_DEBUG", env_buf, &env_size); | ||
| 148 | - bool log_progress = false; | ||
| 149 | - if (ret == 0 && strcmp(env_buf, "mkcodecache") == 0) { | ||
| 150 | - log_progress = true; | ||
| 151 | - } | ||
| 152 | - return GenerateCodeCache(data, log_progress); | ||
| 147 | + return GenerateCodeCache(data); | ||
| 153 | 148 | } | |
| 154 | 149 | ||
| 155 | 150 | } // namespace native_module | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -6,6 +6,7 @@ | |||
| 6 | 6 | #include <vector> | |
| 7 | 7 | ||
| 8 | 8 | #include "cache_builder.h" | |
| 9 | + #include "debug_utils-inl.h" | ||
| 9 | 10 | #include "libplatform/libplatform.h" | |
| 10 | 11 | #include "v8.h" | |
| 11 | 12 | ||
@@ -40,6 +41,8 @@ int main(int argc, char* argv[]) { | |||
| 40 | 41 | return 1; | |
| 41 | 42 | } | |
| 42 | 43 | ||
| 44 | + node::per_process::enabled_debug_list.Parse(nullptr); | ||
| 45 | + | ||
| 43 | 46 | std::unique_ptr<v8::Platform> platform = v8::platform::NewDefaultPlatform(); | |
| 44 | 47 | v8::V8::InitializePlatform(platform.get()); | |
| 45 | 48 | v8::V8::Initialize(); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments