| Index: src/runtime/runtime-wasm.cc
|
| diff --git a/src/runtime/runtime-wasm.cc b/src/runtime/runtime-wasm.cc
|
| index 924ca0df01a9f31974704268ca588ed6c4a5a56f..9f609df5b4357aec4c2014a7398f1481f01a6ea1 100644
|
| --- a/src/runtime/runtime-wasm.cc
|
| +++ b/src/runtime/runtime-wasm.cc
|
| @@ -109,82 +109,5 @@ RUNTIME_FUNCTION(Runtime_WasmGrowMemory) {
|
| return *isolate->factory()->NewNumberFromInt(old_size /
|
| wasm::WasmModule::kPageSize);
|
| }
|
| -
|
| -RUNTIME_FUNCTION(Runtime_JITSingleFunction) {
|
| - const int fixed_args = 6;
|
| -
|
| - HandleScope scope(isolate);
|
| - DCHECK_LE(fixed_args, args.length());
|
| - CONVERT_SMI_ARG_CHECKED(base, 0);
|
| - CONVERT_SMI_ARG_CHECKED(length, 1);
|
| - CONVERT_SMI_ARG_CHECKED(index, 2);
|
| - CONVERT_ARG_HANDLE_CHECKED(FixedArray, function_table, 3);
|
| - CONVERT_UINT32_ARG_CHECKED(sig_index, 4);
|
| - CONVERT_SMI_ARG_CHECKED(return_count, 5);
|
| -
|
| - Handle<JSObject> module_object;
|
| -
|
| - {
|
| - // Get the module JSObject
|
| - DisallowHeapAllocation no_allocation;
|
| - const Address entry = Isolate::c_entry_fp(isolate->thread_local_top());
|
| - Address pc =
|
| - Memory::Address_at(entry + StandardFrameConstants::kCallerPCOffset);
|
| - Code* code =
|
| - isolate->inner_pointer_to_code_cache()->GetCacheEntry(pc)->code;
|
| - FixedArray* deopt_data = code->deoptimization_data();
|
| - DCHECK(deopt_data->length() == 2);
|
| - module_object = Handle<JSObject>::cast(handle(deopt_data->get(0), isolate));
|
| - CHECK(!module_object->IsNull(isolate));
|
| - }
|
| -
|
| - // Get mem buffer associated with module object
|
| - Handle<Object> obj(module_object->GetInternalField(kWasmMemArrayBuffer),
|
| - isolate);
|
| -
|
| - if (obj->IsUndefined(isolate)) {
|
| - return isolate->heap()->undefined_value();
|
| - }
|
| -
|
| - Handle<JSArrayBuffer> mem_buffer = Handle<JSArrayBuffer>::cast(obj);
|
| -
|
| - wasm::WasmModule module(reinterpret_cast<byte*>(mem_buffer->backing_store()));
|
| - wasm::ErrorThrower thrower(isolate, "JITSingleFunction");
|
| - wasm::ModuleEnv module_env;
|
| - module_env.module = &module;
|
| - module_env.instance = nullptr;
|
| - module_env.origin = wasm::kWasmOrigin;
|
| -
|
| - uint32_t signature_size = args.length() - fixed_args;
|
| - wasm::LocalType* sig_types = new wasm::LocalType[signature_size];
|
| -
|
| - for (uint32_t i = 0; i < signature_size; ++i) {
|
| - CONVERT_SMI_ARG_CHECKED(sig_type, i + fixed_args);
|
| - sig_types[i] = static_cast<wasm::LocalType>(sig_type);
|
| - }
|
| - wasm::FunctionSig sig(return_count, signature_size - return_count, sig_types);
|
| -
|
| - wasm::WasmFunction func;
|
| - func.sig = &sig;
|
| - func.func_index = index;
|
| - func.sig_index = sig_index;
|
| - func.name_offset = 0;
|
| - func.name_length = 0;
|
| - func.code_start_offset = base;
|
| - func.code_end_offset = base + length;
|
| -
|
| - Handle<Code> code = compiler::WasmCompilationUnit::CompileWasmFunction(
|
| - &thrower, isolate, &module_env, &func);
|
| -
|
| - delete[] sig_types;
|
| - if (thrower.error()) {
|
| - return isolate->heap()->undefined_value();
|
| - }
|
| -
|
| - function_table->set(index, Smi::FromInt(sig_index));
|
| - function_table->set(index + function_table->length() / 2, *code);
|
| -
|
| - return isolate->heap()->undefined_value();
|
| -}
|
| } // namespace internal
|
| } // namespace v8
|
|
|