Convert a couple of loops over to range-based for
https://bugs.webkit.org/show_bug.cgi?id=133287

Reviewed by Simon Fraser.

* UIProcess/Plugins/PluginInfoStore.cpp:
(WebKit::PluginInfoStore::findPluginForMIMEType):
(WebKit::PluginInfoStore::findPluginForExtension):
(WebKit::PluginInfoStore::infoForPluginWithPath):
* UIProcess/Plugins/mac/PluginProcessManagerMac.mm:
(WebKit::PluginProcessManager::setProcessSuppressionEnabled):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@169353 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Latest emscripten life benchmark is 4x slower because the DFG doesn't realize that arithmetic on booleans is a thing
https://bugs.webkit.org/show_bug.cgi?id=133136

Reviewed by Oliver Hunt.

Source/JavaScriptCore: 
        
Some key concepts:

- Except for the prediction propagation and type fixup phases, which are super early in
  the pipeline, nobody has to know about the fact that booleans may flow into numerical
  operations because there will just be a BooleanToNumber node that will take a value
  and, if that value is a boolean, will convert it to the equivalent numerical value. It
  will have a BooleanUse mode where it will also speculate that the input is a boolean
  but it can also do UntypedUse in which case it will pass through any non-booleans.
  This operation is very easy to model in all of the compiler tiers.

- No changes to the baseline JIT. The Baseline JIT will still believe that boolean
  inputs require taking the slow path and it will still report that it took slow path
  for any such operations.  The DFG will now be smart enough to ignore baseline JIT slow
  path profiling on operations that were known to have had boolean inputs.  That's a
  little quirky, but it's probably easier than modifying the baseline JIT to track
  booleans correctly.
        
4.1x speed-up on the emscripten "life" benchmark. Up to 10x speed-up on microbenchmarks.

* bytecode/SpeculatedType.h:
(JSC::isInt32OrBooleanSpeculation):
(JSC::isInt32SpeculationForArithmetic):
(JSC::isInt32OrBooleanSpeculationForArithmetic):
(JSC::isInt32OrBooleanSpeculationExpectingDefined):
(JSC::isInt52Speculation):
(JSC::isMachineIntSpeculation):
(JSC::isFullNumberOrBooleanSpeculation):
(JSC::isFullNumberOrBooleanSpeculationExpectingDefined):
(JSC::isInt32SpeculationExpectingDefined): Deleted.
(JSC::isMachineIntSpeculationExpectingDefined): Deleted.
(JSC::isMachineIntSpeculationForArithmetic): Deleted.
(JSC::isBytecodeNumberSpeculationExpectingDefined): Deleted.
(JSC::isFullNumberSpeculationExpectingDefined): Deleted.
* dfg/DFGAbstractInterpreterInlines.h:
(JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects):
* dfg/DFGAllocator.h:
(JSC::DFG::Allocator<T>::indexOf):
* dfg/DFGByteCodeParser.cpp:
(JSC::DFG::ByteCodeParser::makeSafe):
(JSC::DFG::ByteCodeParser::makeDivSafe):
(JSC::DFG::ByteCodeParser::handleIntrinsic):
* dfg/DFGCSEPhase.cpp:
(JSC::DFG::CSEPhase::performNodeCSE):
* dfg/DFGClobberize.h:
(JSC::DFG::clobberize):
* dfg/DFGCommon.h:
* dfg/DFGConstantFoldingPhase.cpp:
(JSC::DFG::ConstantFoldingPhase::foldConstants):
* dfg/DFGFixupPhase.cpp:
(JSC::DFG::FixupPhase::fixupNode):
(JSC::DFG::FixupPhase::fixIntConvertingEdge):
(JSC::DFG::FixupPhase::fixIntOrBooleanEdge):
(JSC::DFG::FixupPhase::fixDoubleOrBooleanEdge):
(JSC::DFG::FixupPhase::attemptToMakeIntegerAdd):
(JSC::DFG::FixupPhase::fixIntEdge): Deleted.
* dfg/DFGGraph.h:
(JSC::DFG::Graph::addSpeculationMode):
(JSC::DFG::Graph::valueAddSpeculationMode):
(JSC::DFG::Graph::arithAddSpeculationMode):
(JSC::DFG::Graph::addShouldSpeculateInt32):
(JSC::DFG::Graph::mulShouldSpeculateInt32):
(JSC::DFG::Graph::mulShouldSpeculateMachineInt):
(JSC::DFG::Graph::negateShouldSpeculateInt32):
(JSC::DFG::Graph::negateShouldSpeculateMachineInt):
(JSC::DFG::Graph::addImmediateShouldSpeculateInt32):
(JSC::DFG::Graph::mulImmediateShouldSpeculateInt32): Deleted.
* dfg/DFGNode.h:
(JSC::DFG::Node::sawBooleans):
(JSC::DFG::Node::shouldSpeculateInt32OrBoolean):
(JSC::DFG::Node::shouldSpeculateInt32ForArithmetic):
(JSC::DFG::Node::shouldSpeculateInt32OrBooleanForArithmetic):
(JSC::DFG::Node::shouldSpeculateInt32OrBooleanExpectingDefined):
(JSC::DFG::Node::shouldSpeculateMachineInt):
(JSC::DFG::Node::shouldSpeculateDouble):
(JSC::DFG::Node::shouldSpeculateNumberOrBoolean):
(JSC::DFG::Node::shouldSpeculateNumberOrBooleanExpectingDefined):
(JSC::DFG::Node::shouldSpeculateNumber):
(JSC::DFG::Node::canSpeculateInt32):
(JSC::DFG::Node::canSpeculateInt52):
(JSC::DFG::Node::sourceFor):
(JSC::DFG::Node::shouldSpeculateInt32ExpectingDefined): Deleted.
(JSC::DFG::Node::shouldSpeculateMachineIntForArithmetic): Deleted.
(JSC::DFG::Node::shouldSpeculateMachineIntExpectingDefined): Deleted.
(JSC::DFG::Node::shouldSpeculateDoubleForArithmetic): Deleted.
(JSC::DFG::Node::shouldSpeculateNumberExpectingDefined): Deleted.
* dfg/DFGNodeFlags.cpp:
(JSC::DFG::dumpNodeFlags):
* dfg/DFGNodeFlags.h:
(JSC::DFG::nodeMayOverflow):
(JSC::DFG::nodeMayNegZero):
(JSC::DFG::nodeCanSpeculateInt32):
(JSC::DFG::nodeCanSpeculateInt52):
* dfg/DFGNodeType.h:
* dfg/DFGPredictionPropagationPhase.cpp:
(JSC::DFG::PredictionPropagationPhase::run):
(JSC::DFG::PredictionPropagationPhase::propagateToFixpoint):
(JSC::DFG::PredictionPropagationPhase::speculatedDoubleTypeForPrediction):
(JSC::DFG::PredictionPropagationPhase::propagate):
(JSC::DFG::PredictionPropagationPhase::doDoubleVoting):
* dfg/DFGSafeToExecute.h:
(JSC::DFG::safeToExecute):
* dfg/DFGSpeculativeJIT.cpp:
(JSC::DFG::SpeculativeJIT::compileValueToInt32):
* dfg/DFGSpeculativeJIT32_64.cpp:
(JSC::DFG::SpeculativeJIT::compile):
* dfg/DFGSpeculativeJIT64.cpp:
(JSC::DFG::SpeculativeJIT::compile):
* ftl/FTLCapabilities.cpp:
(JSC::FTL::canCompile):
* ftl/FTLLowerDFGToLLVM.cpp:
(JSC::FTL::LowerDFGToLLVM::compileNode):
(JSC::FTL::LowerDFGToLLVM::compileValueToInt32):
(JSC::FTL::LowerDFGToLLVM::compileBooleanToNumber):
* runtime/JSCJSValue.h:
* runtime/JSCJSValueInlines.h:
(JSC::JSValue::asInt32ForArithmetic):
* tests/stress/max-boolean-exit.js: Added.
(foo):
(test):
* tests/stress/mul-boolean-exit.js: Added.
(foo):
(test):
* tests/stress/plus-boolean-exit.js: Added.
(foo):
(test):
* tests/stress/plus-boolean-or-double.js: Added.
(foo):
(test):
* tests/stress/plus-boolean-or-int.js: Added.
(foo):
(test):

LayoutTests: 

* js/regress/abs-boolean-expected.txt: Added.
* js/regress/abs-boolean.html: Added.
* js/regress/div-boolean-double-expected.txt: Added.
* js/regress/div-boolean-double.html: Added.
* js/regress/div-boolean-expected.txt: Added.
* js/regress/div-boolean.html: Added.
* js/regress/max-boolean-expected.txt: Added.
* js/regress/max-boolean.html: Added.
* js/regress/min-boolean-expected.txt: Added.
* js/regress/min-boolean.html: Added.
* js/regress/minus-boolean-double-expected.txt: Added.
* js/regress/minus-boolean-double.html: Added.
* js/regress/minus-boolean-expected.txt: Added.
* js/regress/minus-boolean.html: Added.
* js/regress/mod-boolean-double-expected.txt: Added.
* js/regress/mod-boolean-double.html: Added.
* js/regress/mod-boolean-expected.txt: Added.
* js/regress/mod-boolean.html: Added.
* js/regress/mul-boolean-double-expected.txt: Added.
* js/regress/mul-boolean-double.html: Added.
* js/regress/mul-boolean-expected.txt: Added.
* js/regress/mul-boolean.html: Added.
* js/regress/neg-boolean-expected.txt: Added.
* js/regress/neg-boolean.html: Added.
* js/regress/plus-boolean-arith-expected.txt: Added.
* js/regress/plus-boolean-arith.html: Added.
* js/regress/plus-boolean-double-expected.txt: Added.
* js/regress/plus-boolean-double.html: Added.
* js/regress/plus-boolean-expected.txt: Added.
* js/regress/plus-boolean.html: Added.
* js/regress/script-tests/abs-boolean.js: Added.
* js/regress/script-tests/div-boolean-double.js: Added.
* js/regress/script-tests/div-boolean.js: Added.
* js/regress/script-tests/max-boolean.js: Added.
* js/regress/script-tests/min-boolean.js: Added.
* js/regress/script-tests/minus-boolean-double.js: Added.
* js/regress/script-tests/minus-boolean.js: Added.
* js/regress/script-tests/mod-boolean-double.js: Added.
* js/regress/script-tests/mod-boolean.js: Added.
* js/regress/script-tests/mul-boolean-double.js: Added.
* js/regress/script-tests/mul-boolean.js: Added.
* js/regress/script-tests/neg-boolean.js: Added.
* js/regress/script-tests/plus-boolean-arith.js: Added.
* js/regress/script-tests/plus-boolean-double.js: Added.
* js/regress/script-tests/plus-boolean.js: Added.
* js/regress/script-tests/sin-boolean.js: Added.
* js/regress/sin-boolean-expected.txt: Added.
* js/regress/sin-boolean.html: Added.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@169354 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Unreviewed, rolling out r169122.
https://bugs.webkit.org/show_bug.cgi?id=133288

Broke CJK font fallback (Requested by ap on #webkit).

Reverted changeset:

"[Mac] WebProcess doesn't follow localization of UI process
when run as a service"
https://bugs.webkit.org/show_bug.cgi?id=133126
http://trac.webkit.org/changeset/169122

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@169355 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[Cocoa] Rewrite WK_DESIGNATED_INITIALIZER in installed headers
https://bugs.webkit.org/show_bug.cgi?id=133290

Reviewed by Anders Carlsson.

* Shared/API/Cocoa/WKFoundation.h: When WK_API_AVAILABILITY_ENABLED is defined, don’t
provide definitions of WK_DESIGNATED_INITIALIZER and WK_UNAVAILABLE, since those macros will
be rewritten out of the headers. When WK_API_AVAILABILITY_ENABLED isn’t defined, provide
definitions of the other two macros as appropriate for the target OS.
* UIProcess/API/Cocoa/WKProcessPoolPrivate.h: Removed WK_DESIGNATED_INITIALIZER from a
category method declaration.
* UIProcess/API/Cocoa/WKWebView.h: Mark the superclass designated initializer
-initWithCoder: as unavailable.
* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView initWithCoder:]): Override this designated initializer of the superclass by
returning nil.
* mac/rewrite-availability-macros.sh: Rewrite WK_DESIGNATED_INITIALIZER to
NS_DESIGNATED_INITIALIZER and WK_UNAVAILABLE to NS_UNAVAILABLE. Also make sure to process
all headers if the script has changed since the last time it was run.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@169356 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[WebKit2] Add better default preferences while keeping backward compatibility for the C-SPI
https://bugs.webkit.org/show_bug.cgi?id=133289

Reviewed by Anders Carlsson.

* Shared/WebPreferencesStore.h:
Change a few defaults:
- PluginsEnabled -> false
- JavaEnabled -> false
- JavaEnabledForLocalFiles -> false
- StorageBlockingPolicy -> BlockThirdPartyStorage

* UIProcess/API/C/WKPreferences.cpp:
(WKPreferencesCreate):
(WKPreferencesCreateWithIdentifier):
* UIProcess/WebPageGroup.cpp:
(WebKit::WebPageGroup::WebPageGroup):
Switch to using WebPreferences::createWithLegacyDefaults().

* UIProcess/WebPreferences.cpp:
(WebKit::WebPreferences::create):
(WebKit::WebPreferences::createWithLegacyDefaults):
* UIProcess/WebPreferences.h:
Move create functions to the cpp file and add createWithLegacyDefaults() which keeps
the old defaults;

* UIProcess/API/C/WKPreferencesRef.h:
Fix the comment.

* UIProcess/API/Cocoa/WKPreferences.h:
Update the comment to reflect the new defaults.

* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::updatePreferences):
Unconditionally set setShouldDispatchJavaScriptWindowOnErrorEvents() to true. This setting only
exists for legacy WebKit.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@169357 268f45cc-cd09-0410-ab3c-d52691b4dbfc