Ignore:
Timestamp:
Dec 4, 2016, 1:23:56 PM (9 years ago)
Author:
[email protected]
Message:

We should have a Wasm callee
https://bugs.webkit.org/show_bug.cgi?id=165163

Reviewed by Keith Miller.

This patch adds JSWebAssemblyCallee and stores it into the
callee slot in the call frame as part of the prologue of a
wasm function. This is the first step in implementing
unwinding from/through wasm frames. We will use the callee
to identify that a machine frame belongs to wasm code.

(callWasmFunction):
(functionTestWasmModuleFunctions):

  • llint/LowLevelInterpreter64.asm:
  • runtime/JSGlobalObject.cpp:
  • runtime/VM.cpp:

(JSC::VM::VM):

  • runtime/VM.h:
  • wasm/JSWebAssembly.h:
  • wasm/WasmB3IRGenerator.cpp:

(JSC::Wasm::B3IRGenerator::B3IRGenerator):
(JSC::Wasm::parseAndCompile):

  • wasm/WasmCallingConvention.h:

(JSC::Wasm::CallingConvention::setupFrameInPrologue):

  • wasm/WasmFormat.h:
  • wasm/WasmPlan.cpp:

(JSC::Wasm::Plan::initializeCallees):

  • wasm/WasmPlan.h:

(JSC::Wasm::Plan::compiledFunction):
(JSC::Wasm::Plan::getCompiledFunctions): Deleted.

  • wasm/js/JSWebAssemblyCallee.cpp: Added.

(JSC::JSWebAssemblyCallee::JSWebAssemblyCallee):
(JSC::JSWebAssemblyCallee::finishCreation):
(JSC::JSWebAssemblyCallee::destroy):

  • wasm/js/JSWebAssemblyCallee.h: Added.

(JSC::JSWebAssemblyCallee::create):
(JSC::JSWebAssemblyCallee::createStructure):
(JSC::JSWebAssemblyCallee::jsEntryPoint):

  • wasm/js/JSWebAssemblyModule.cpp:

(JSC::JSWebAssemblyModule::create):
(JSC::JSWebAssemblyModule::JSWebAssemblyModule):
(JSC::JSWebAssemblyModule::visitChildren):

  • wasm/js/JSWebAssemblyModule.h:

(JSC::JSWebAssemblyModule::moduleInformation):
(JSC::JSWebAssemblyModule::callee):
(JSC::JSWebAssemblyModule::callees):
(JSC::JSWebAssemblyModule::offsetOfCallees):
(JSC::JSWebAssemblyModule::allocationSize):
(JSC::JSWebAssemblyModule::compiledFunctions): Deleted.

  • wasm/js/WebAssemblyFunction.cpp:

(JSC::callWebAssemblyFunction):
(JSC::WebAssemblyFunction::create):
(JSC::WebAssemblyFunction::visitChildren):
(JSC::WebAssemblyFunction::finishCreation):

  • wasm/js/WebAssemblyFunction.h:

(JSC::WebAssemblyFunction::webAssemblyCallee):
(JSC::WebAssemblyFunction::instance):
(JSC::WebAssemblyFunction::signature):
(JSC::CallableWebAssemblyFunction::CallableWebAssemblyFunction): Deleted.
(JSC::WebAssemblyFunction::webAssemblyFunctionCell): Deleted.

  • wasm/js/WebAssemblyFunctionCell.cpp:

(JSC::WebAssemblyFunctionCell::create): Deleted.
(JSC::WebAssemblyFunctionCell::WebAssemblyFunctionCell): Deleted.
(JSC::WebAssemblyFunctionCell::destroy): Deleted.
(JSC::WebAssemblyFunctionCell::createStructure): Deleted.

  • wasm/js/WebAssemblyFunctionCell.h:

(JSC::WebAssemblyFunctionCell::function): Deleted.

  • wasm/js/WebAssemblyModuleConstructor.cpp:

(JSC::constructJSWebAssemblyModule):

  • wasm/js/WebAssemblyModuleRecord.cpp:

(JSC::WebAssemblyModuleRecord::link):

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/wasm/WasmPlan.cpp

    r209123 r209312  
    3030
    3131#include "B3Compilation.h"
     32#include "JSCInlines.h"
     33#include "JSGlobalObject.h"
     34#include "JSWebAssemblyCallee.h"
    3235#include "WasmB3IRGenerator.h"
    3336#include "WasmCallingConvention.h"
     
    111114}
    112115
     116void Plan::initializeCallees(JSGlobalObject* globalObject, std::function<void(unsigned, JSWebAssemblyCallee*)> callback)
     117{
     118    ASSERT(!failed());
     119    for (unsigned i = 0; i < m_compiledFunctions.size(); i++) {
     120        std::unique_ptr<FunctionCompilation>& compilation = m_compiledFunctions[i];
     121        CodeLocationDataLabelPtr calleeMoveLocation = compilation->calleeMoveLocation;
     122        JSWebAssemblyCallee* callee = JSWebAssemblyCallee::create(globalObject->vm(), WTFMove(compilation));
     123
     124        MacroAssembler::repatchPointer(calleeMoveLocation, callee);
     125
     126        if (verbose)
     127            dataLogLn("Made Wasm callee: ", RawPointer(callee));
     128
     129        callback(i, callee);
     130    }
     131}
     132
    113133Plan::~Plan() { }
    114134
Note: See TracChangeset for help on using the changeset viewer.