Ignore:
Timestamp:
Oct 6, 2017, 7:29:19 PM (8 years ago)
Author:
[email protected]
Message:

Enable gigacage on iOS
https://bugs.webkit.org/show_bug.cgi?id=177586

Reviewed by JF Bastien.
JSTests:


Add tests for when Gigacage gets runtime disabled.

  • stress/disable-gigacage-arrays.js: Added.

(foo):

  • stress/disable-gigacage-strings.js: Added.

(foo):

  • stress/disable-gigacage-typed-arrays.js: Added.

(foo):

Source/bmalloc:


Introduce the ability to disable gigacage at runtime if allocation fails. If any step of gigacage
allocation fails, we free all of the gigacages and turn off gigacage support.

  • CMakeLists.txt:
  • bmalloc.xcodeproj/project.pbxproj:
  • bmalloc/Cache.cpp:

(bmalloc::Cache::scavenge):

  • bmalloc/Cache.h:

(bmalloc::Cache::tryAllocate):
(bmalloc::Cache::allocate):
(bmalloc::Cache::deallocate):
(bmalloc::Cache::reallocate):

  • bmalloc/Gigacage.cpp:

(Gigacage::ensureGigacage):
(Gigacage::runway):
(Gigacage::totalSize):
(Gigacage::shouldBeEnabled):
(): Deleted.
(Gigacage::Callback::Callback): Deleted.
(Gigacage::Callback::function): Deleted.
(Gigacage::PrimitiveDisableCallbacks::PrimitiveDisableCallbacks): Deleted.

  • bmalloc/Gigacage.h:

(Gigacage::wasEnabled):
(Gigacage::isEnabled):
(Gigacage::runway): Deleted.
(Gigacage::totalSize): Deleted.

  • bmalloc/HeapKind.cpp: Added.

(bmalloc::isActiveHeapKind):
(bmalloc::mapToActiveHeapKind):

  • bmalloc/HeapKind.h:

(bmalloc::isActiveHeapKindAfterEnsuringGigacage):
(bmalloc::mapToActiveHeapKindAfterEnsuringGigacage):

  • bmalloc/Scavenger.cpp:

(bmalloc::Scavenger::scavenge):

  • bmalloc/bmalloc.h:

(bmalloc::api::tryLargeMemalignVirtual):
(bmalloc::api::freeLargeVirtual):
(bmalloc::api::isEnabled):

Source/JavaScriptCore:

The hardest part of enabling Gigacage on iOS is that it requires loading global variables while
executing JS, so the LLInt needs to know how to load from global variables on all platforms that
have Gigacage. So, this teaches ARM64 how to load from global variables.

Also, this makes the code handle disabling the gigacage a bit better.

  • ftl/FTLLowerDFGToB3.cpp:

(JSC::FTL::DFG::LowerDFGToB3::caged):

  • jit/AssemblyHelpers.h:

(JSC::AssemblyHelpers::cage):
(JSC::AssemblyHelpers::cageConditionally):

  • offlineasm/arm64.rb:
  • offlineasm/asm.rb:
  • offlineasm/instructions.rb:

Tools:


Add a mode to test disabling Gigacage.

  • Scripts/run-jsc-stress-tests:
  • Scripts/webkitruby/jsc-stress-test-writer-default.rb:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/offlineasm/asm.rb

    r222651 r223015  
    4747        @numLocalLabels = 0
    4848        @numGlobalLabels = 0
     49        @deferredActions = []
     50        @count = 0
    4951
    5052        @newlineSpacerState = :none
     
    7476        end
    7577        putsLastComment
     78        @deferredActions.each {
     79            | action |
     80            action.call()
     81        }
    7682        @outp.puts "OFFLINE_ASM_END" if !$emitWinAsm
    7783        @state = :cpp
     84    end
     85   
     86    def deferAction(&proc)
     87        @deferredActions << proc
     88    end
     89   
     90    def newUID
     91        @count += 1
     92        @count
    7893    end
    7994   
Note: See TracChangeset for help on using the changeset viewer.