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

Unified Diff: src/wasm/wasm-module.cc

Issue 1974933002: [wasm] Remove the use of the "external" bit on OldFunctions section. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Remove unused variable. Created 4 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/wasm/wasm-module.h ('k') | test/cctest/wasm/test-wasm-function-name-table.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/wasm/wasm-module.cc
diff --git a/src/wasm/wasm-module.cc b/src/wasm/wasm-module.cc
index 0f7df4d6064e0d542367da780486db8a6002f65e..09071eadd2d412a6b499fd7b0c77c8360638a1e4 100644
--- a/src/wasm/wasm-module.cc
+++ b/src/wasm/wasm-module.cc
@@ -504,12 +504,8 @@ void InitializeParallelCompilation(
}
for (uint32_t i = FLAG_skip_compiling_wasm_funcs; i < functions.size(); i++) {
- if (!functions[i].external) {
- compilation_units[i] = compiler::CreateWasmCompilationUnit(
- &thrower, isolate, &module_env, &functions[i], i);
- } else {
- compilation_units[i] = nullptr;
- }
+ compilation_units[i] = compiler::CreateWasmCompilationUnit(
+ &thrower, isolate, &module_env, &functions[i], i);
}
}
@@ -564,9 +560,7 @@ void FinishCompilationUnits(
executed_units.pop();
}
int j = compiler::GetIndexOfWasmCompilationUnit(unit);
- if (!module->functions[j].external) {
- results[j] = compiler::FinishCompilation(unit);
- }
+ results[j] = compiler::FinishCompilation(unit);
}
}
@@ -585,39 +579,26 @@ bool FinishCompilation(Isolate* isolate, WasmModule* module,
DCHECK_EQ(i, func.func_index);
WasmName str = module->GetName(func.name_offset, func.name_length);
- WasmName str_null = {nullptr, 0};
Handle<Code> code = Handle<Code>::null();
Handle<JSFunction> function = Handle<JSFunction>::null();
Handle<String> function_name = Handle<String>::null();
- if (func.external) {
- // Lookup external function in FFI object.
- MaybeHandle<JSFunction> function =
- LookupFunction(thrower, factory, ffi, i, str, str_null);
- if (function.is_null()) {
- return false;
- }
- code = compiler::CompileWasmToJSWrapper(isolate, &module_env,
- function.ToHandleChecked(),
- func.sig, str, str_null);
+ if (FLAG_wasm_num_compilation_tasks != 0) {
+ code = results[i];
} else {
- if (FLAG_wasm_num_compilation_tasks != 0) {
- code = results[i];
- } else {
- // Compile the function.
- code = compiler::CompileWasmFunction(&thrower, isolate, &module_env,
- &func);
- }
- if (code.is_null()) {
- thrower.Error("Compilation of #%d:%.*s failed.", i, str.length(),
- str.start());
- return false;
- }
- if (func.exported) {
- function_name = factory->InternalizeUtf8String(str);
- function = compiler::CompileJSToWasmWrapper(
- isolate, &module_env, function_name, code, instance.js_object, i);
- record_code_size(total_code_size, function->code());
- }
+ // Compile the function.
+ code =
+ compiler::CompileWasmFunction(&thrower, isolate, &module_env, &func);
+ }
+ if (code.is_null()) {
+ thrower.Error("Compilation of #%d:%.*s failed.", i, str.length(),
+ str.start());
+ return false;
+ }
+ if (func.exported) {
+ function_name = factory->InternalizeUtf8String(str);
+ function = compiler::CompileJSToWasmWrapper(
+ isolate, &module_env, function_name, code, instance.js_object, i);
+ record_code_size(total_code_size, function->code());
}
if (!code.is_null()) {
// Install the code into the linker table.
@@ -954,19 +935,17 @@ int32_t CompileAndRunWasmModule(Isolate* isolate, WasmModule* module) {
int main_index = 0;
for (const WasmFunction& func : module->functions) {
DCHECK_EQ(index, func.func_index);
- if (!func.external) {
- // Compile the function and install it in the code table.
- Handle<Code> code =
- compiler::CompileWasmFunction(&thrower, isolate, &module_env, &func);
- if (!code.is_null()) {
- if (func.exported) {
- main_code = code;
- main_index = index;
- }
- linker.Finish(index, code);
+ // Compile the function and install it in the code table.
+ Handle<Code> code =
+ compiler::CompileWasmFunction(&thrower, isolate, &module_env, &func);
+ if (!code.is_null()) {
+ if (func.exported) {
+ main_code = code;
+ main_index = index;
}
- if (thrower.error()) return -1;
+ linker.Finish(index, code);
}
+ if (thrower.error()) return -1;
index++;
}
« no previous file with comments | « src/wasm/wasm-module.h ('k') | test/cctest/wasm/test-wasm-function-name-table.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698