DFGOSRExitCompilerProxy.cpp 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. // Copyright (C) 2013 Sony Computer Entertainment Inc.
  2. // All Rights Reserved.
  3. #include "config.h"
  4. #include "DFGOSRExitCompiler.h"
  5. #include "jit_detached/JSCBridgeToll.h"
  6. #include "jit_detached/JSCBridge.h"
  7. #include "CodeBlock.h"
  8. #include "JSCJSValueInlines.h"
  9. #include <wtf/OwnPtr.h>
  10. #if ENABLE(DFG_JIT) && ENABLE(DETACHED_JIT) && !BUILDING_DETACHED_JIT
  11. namespace JSC {
  12. namespace DFG {
  13. void DFG_OPERATION compileOSRExit_vmstub(ExecState* exec)
  14. {
  15. PROFILE_FUNCTION_CALL;
  16. CodeBlock* codeBlock = exec->codeBlock();
  17. VM* vm = &exec->vm();
  18. uint32_t exitIndex = vm->osrExitIndex;
  19. OSRExit& exit = codeBlock->osrExit(exitIndex);
  20. // we perform this here before we create the toll for performing DFG
  21. // OSR exit compilation to ensure we don't clobber the data stored in
  22. // the shared data section since each call to jitCompile() will invoke
  23. // the JIT compiler process.
  24. // for more information as to why we perform jitCompile() here and not
  25. // in the JIT compiler process, see comment inside compileOSRExit()
  26. {
  27. for (CodeOrigin codeOrigin = exit.m_codeOrigin; codeOrigin.inlineCallFrame; codeOrigin = codeOrigin.inlineCallFrame->caller) {
  28. static_cast<FunctionExecutable*>(codeOrigin.inlineCallFrame->executable.get())
  29. ->baselineCodeBlockFor(codeOrigin.inlineCallFrame->isCall ? CodeForCall : CodeForConstruct)
  30. ->jitCompile(exec);
  31. }
  32. }
  33. JSCBridge * const bridge(JSCBridge::sharedInstance());
  34. OwnPtr<JSCBridge::Payload> payload(adoptPtr(bridge->createPayload()));
  35. payload->sendArgument(reinterpret_cast<uintptr_t>(exec));
  36. // prepare toll
  37. OwnPtr<JSCBridgeToll> toll(adoptPtr(bridge->createToll(payload.get())));
  38. toll->prepare(vm);
  39. toll->prepare(codeBlock);
  40. for (CodeOrigin codeOrigin = exit.m_codeOrigin; codeOrigin.inlineCallFrame; codeOrigin = codeOrigin.inlineCallFrame->caller) {
  41. FunctionExecutable *executable(static_cast<FunctionExecutable*>(codeOrigin.inlineCallFrame->executable.get()));
  42. CodeBlock * codeBlock(executable->baselineCodeBlockFor(codeOrigin.inlineCallFrame->isCall ? CodeForCall : CodeForConstruct));
  43. toll->prepare(codeBlock);
  44. }
  45. bridge->requestCompilerTask(JSCBridge::e_DFG_compileOSRExit);
  46. return;
  47. }
  48. } // namespace DFG
  49. } // namespace JSC
  50. #endif // #if ENABLE(DFG_JIT) && ENABLE(DETACHED_JIT) && !BUILDING_DETACHED_JIT