<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[163918] trunk</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/163918">163918</a></dd>
<dt>Author</dt> <dd>bburg@apple.com</dd>
<dt>Date</dt> <dd>2014-02-11 16:22:01 -0800 (Tue, 11 Feb 2014)</dd>
</dl>
<h3>Log Message</h3>
<pre>Web Replay: upstream replay input code generator and EncodedValue class
https://bugs.webkit.org/show_bug.cgi?id=128215
Reviewed by Joseph Pecoraro.
Source/JavaScriptCore:
Add the replay inputs code generator. Most features of the input generator are
exercised by included generator regression tests, which produce useful but
non-compilable test replay inputs.
Add EncodedValue, the main replay input serialization class that encodes and
decodes inputs and their data between C++ types and the JSON-based replay recording
format. EncodedValue uses EncodingTraits specializations for type-specific encoding.
Relative to other WebKit marshalling mechanisms, EncodedValue is key/value based.
EncodedValue uses InspectorValue subclasses as its backing data structure.
Add some missing numerical conversions to InspectorValue.
* JavaScriptCore.xcodeproj/project.pbxproj:
* inspector/InspectorValues.cpp:
(Inspector::InspectorValue::asNumber):
(Inspector::InspectorBasicValue::asNumber):
* inspector/InspectorValues.h:
* replay/EncodedValue.cpp: Added.
(JSC::EncodedValue::asObject):
(JSC::EncodedValue::asArray):
(JSC::ScalarEncodingTraits<bool>::encodeValue):
(JSC::ScalarEncodingTraits<double>::encodeValue):
(JSC::ScalarEncodingTraits<float>::encodeValue):
(JSC::ScalarEncodingTraits<int32_t>::encodeValue):
(JSC::ScalarEncodingTraits<int64_t>::encodeValue):
(JSC::ScalarEncodingTraits<uint32_t>::encodeValue):
(JSC::ScalarEncodingTraits<uint64_t>::encodeValue):
(JSC::long>::encodeValue):
(JSC::EncodedValue::convertTo<bool>):
(JSC::EncodedValue::convertTo<double>):
(JSC::EncodedValue::convertTo<float>):
(JSC::EncodedValue::convertTo<int32_t>):
(JSC::EncodedValue::convertTo<int64_t>):
(JSC::EncodedValue::convertTo<uint32_t>):
(JSC::EncodedValue::convertTo<uint64_t>):
(JSC::long>):
(JSC::EncodedValue::convertTo<String>):
(JSC::EncodedValue::put<EncodedValue>):
(JSC::EncodedValue::append<EncodedValue>):
(JSC::EncodedValue::get<EncodedValue>):
* replay/EncodedValue.h: Added.
(JSC::EncodedValue::EncodedValue):
(JSC::EncodedValue::createObject):
(JSC::EncodedValue::createArray):
(JSC::EncodedValue::createString):
(JSC::EncodedValue::~EncodedValue):
(JSC::ScalarEncodingTraits::decodeValue):
(JSC::EncodingTraits<String>::encodeValue):
(JSC::EncodedValue::put):
(JSC::EncodedValue::append):
(JSC::EncodedValue::get):
* replay/scripts/CodeGeneratorReplayInputs.py: Added.
(ParseException):
(TypecheckException):
(Framework):
(Framework.__init__):
(Framework.setting):
(Framework.fromString):
(Frameworks):
(InputQueue):
(InputQueue.__init__):
(InputQueue.setting):
(InputQueue.fromString):
(InputQueues):
(Input):
(Input.__init__):
(Input.setting):
(InputMember):
(InputMember.__init__):
(InputMember.has_flag):
(TypeMode):
(TypeMode.__init__):
(TypeMode.fromString):
(TypeModes):
(Type):
(Type.__init__):
(Type.__eq__):
(Type.__hash__):
(Type.has_flag):
(Type.is_struct):
(Type.is_enum):
(Type.is_enum_class):
(Type.declaration_kind):
(Type.qualified_prefix):
(Type.qualified_prefix.is):
(Type.type_name):
(Type.storage_type):
(Type.borrow_type):
(Type.argument_type):
(check_properties):
(VectorType):
(VectorType.__init__):
(VectorType.has_flag):
(VectorType.is_struct):
(VectorType.is_enum):
(VectorType.is_enum_class):
(VectorType.qualified_prefix):
(VectorType.type_name):
(VectorType.argument_type):
(InputsModel):
(InputsModel.__init__):
(InputsModel.enum_types):
(InputsModel.get_type_for_member):
(InputsModel.parse_toplevel):
(InputsModel.parse_type_with_framework_name):
(InputsModel.parse_input):
(InputsModel.typecheck):
(InputsModel.typecheck_type):
(InputsModel.typecheck_input):
(InputsModel.typecheck_input_member):
(IncrementalFileWriter):
(IncrementalFileWriter.__init__):
(IncrementalFileWriter.write):
(IncrementalFileWriter.close):
(lcfirst):
(wrap_with_guard):
(Generator):
(Generator.__init__):
(Generator.setting):
(Generator.output_filename):
(Generator.write_output_files):
(Generator.generate_header):
(Generator.generate_implementation):
(Generator.generate_license):
(Generator.generate_includes):
(Generator.generate_includes.declaration):
(Generator.generate_includes.declaration.is):
(Generator.generate_type_forward_declarations):
(Generator.generate_type_forward_declarations.is):
(Generator.generate_class_declaration):
(Generator.generate_input_constructor_declaration):
(Generator.generate_input_destructor_declaration):
(Generator.generate_input_member_getter):
(Generator.generate_input_member_declaration):
(Generator.generate_input_member_tuples):
(Generator.qualified_input_name):
(Generator.generate_input_trait_declaration):
(Generator.generate_enum_trait_declaration):
(Generator.generate_for_each_macro):
(Generator.generate_class_implementation):
(Generator.generate_enum_trait_implementation):
(Generator.generate_enum_trait_implementation.is):
(Generator.generate_input_trait_implementation):
(Generator.generate_input_encode_implementation):
(Generator.generate_input_decode_implementation):
(Generator.generate_constructor_initializer_list):
(Generator.generate_constructor_formals_list):
(Generator.generate_member_borrow_expression):
(Generator.generate_member_move_expression):
(Generator.generate_constructor_arguments_list):
(generate_from_specification):
* replay/scripts/CodeGeneratorReplayInputsTemplates.py: Added.
(Templates):
* replay/scripts/tests/expected/JSInputs.json-TestReplayInputs.cpp: Added.
* replay/scripts/tests/expected/JSInputs.json-TestReplayInputs.h: Added.
* replay/scripts/tests/expected/fail-on-c-style-enum-no-storage.json-error: Added.
* replay/scripts/tests/expected/fail-on-duplicate-input-names.json-error: Added.
* replay/scripts/tests/expected/fail-on-duplicate-type-names.json-error: Added.
* replay/scripts/tests/expected/fail-on-enum-type-missing-values.json-error: Added.
* replay/scripts/tests/expected/fail-on-missing-input-member-name.json-error: Added.
* replay/scripts/tests/expected/fail-on-missing-input-name.json-error: Added.
* replay/scripts/tests/expected/fail-on-missing-input-queue.json-error: Added.
* replay/scripts/tests/expected/fail-on-missing-type-mode.json-error: Added.
* replay/scripts/tests/expected/fail-on-missing-type-name.json-error: Added.
* replay/scripts/tests/expected/fail-on-no-inputs.json-error: Added.
* replay/scripts/tests/expected/fail-on-no-types.json-error: Added.
* replay/scripts/tests/expected/fail-on-unknown-input-queue.json-error: Added.
* replay/scripts/tests/expected/fail-on-unknown-member-type.json-error: Added.
* replay/scripts/tests/expected/fail-on-unknown-type-mode.json-error: Added.
* replay/scripts/tests/expected/generate-enum-encoding-helpers-with-guarded-values.json-TestReplayInputs.cpp: Added.
* replay/scripts/tests/expected/generate-enum-encoding-helpers-with-guarded-values.json-TestReplayInputs.h: Added.
* replay/scripts/tests/expected/generate-enum-encoding-helpers.json-TestReplayInputs.cpp: Added.
* replay/scripts/tests/expected/generate-enum-encoding-helpers.json-TestReplayInputs.h: Added.
* replay/scripts/tests/expected/generate-enum-encoding-helpers.json-error: Added.
* replay/scripts/tests/expected/generate-event-loop-shape-types.json-error: Added.
* replay/scripts/tests/expected/generate-input-with-guard.json-TestReplayInputs.cpp: Added.
* replay/scripts/tests/expected/generate-input-with-guard.json-TestReplayInputs.h: Added.
* replay/scripts/tests/expected/generate-input-with-vector-members.json-TestReplayInputs.cpp: Added.
* replay/scripts/tests/expected/generate-input-with-vector-members.json-TestReplayInputs.h: Added.
* replay/scripts/tests/expected/generate-inputs-with-flags.json-error: Added.
* replay/scripts/tests/expected/generate-memoized-type-modes.json-TestReplayInputs.cpp: Added.
* replay/scripts/tests/expected/generate-memoized-type-modes.json-TestReplayInputs.h: Added.
* replay/scripts/tests/fail-on-c-style-enum-no-storage.json: Added.
* replay/scripts/tests/fail-on-duplicate-input-names.json: Added.
* replay/scripts/tests/fail-on-duplicate-type-names.json: Added.
* replay/scripts/tests/fail-on-enum-type-missing-values.json: Added.
* replay/scripts/tests/fail-on-missing-input-member-name.json: Added.
* replay/scripts/tests/fail-on-missing-input-name.json: Added.
* replay/scripts/tests/fail-on-missing-input-queue.json: Added.
* replay/scripts/tests/fail-on-missing-type-mode.json: Added.
* replay/scripts/tests/fail-on-missing-type-name.json: Added.
* replay/scripts/tests/fail-on-no-inputs.json: Added.
* replay/scripts/tests/fail-on-no-types.json: Added.
* replay/scripts/tests/fail-on-unknown-input-queue.json: Added.
* replay/scripts/tests/fail-on-unknown-member-type.json: Added.
* replay/scripts/tests/fail-on-unknown-type-mode.json: Added.
* replay/scripts/tests/generate-enum-encoding-helpers-with-guarded-values.json: Added.
* replay/scripts/tests/generate-enum-encoding-helpers.json: Added.
* replay/scripts/tests/generate-event-loop-shape-types.json: Added.
* replay/scripts/tests/generate-input-with-guard.json: Added.
* replay/scripts/tests/generate-input-with-vector-members.json: Added.
* replay/scripts/tests/generate-inputs-with-flags.json: Added.
* replay/scripts/tests/generate-memoized-type-modes.json: Added.
Tools:
Add an executable script to launch the replay input generator tests.
Add a test harness for running the code generator tests, mostly taken
from the bindings test harness (but simplified).
* Scripts/run-input-generator-tests: Added.
(main):
* Scripts/webkitpy/replay/__init__.py: Added.
* Scripts/webkitpy/replay/main.py: Added.
(InputGeneratorTests):
(InputGeneratorTests.__init__):
(InputGeneratorTests.generate_from_json):
(InputGeneratorTests.write_error_file):
(InputGeneratorTests.detect_changes):
(InputGeneratorTests.run_tests):
(InputGeneratorTests.main):</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceJavaScriptCoreChangeLog">trunk/Source/JavaScriptCore/ChangeLog</a></li>
<li><a href="#trunkSourceJavaScriptCoreJavaScriptCorexcodeprojprojectpbxproj">trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkSourceJavaScriptCoreinspectorInspectorValuescpp">trunk/Source/JavaScriptCore/inspector/InspectorValues.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreinspectorInspectorValuesh">trunk/Source/JavaScriptCore/inspector/InspectorValues.h</a></li>
<li><a href="#trunkToolsChangeLog">trunk/Tools/ChangeLog</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#trunkSourceJavaScriptCorereplayEncodedValuecpp">trunk/Source/JavaScriptCore/replay/EncodedValue.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCorereplayEncodedValueh">trunk/Source/JavaScriptCore/replay/EncodedValue.h</a></li>
<li>trunk/Source/JavaScriptCore/replay/scripts/</li>
<li><a href="#trunkSourceJavaScriptCorereplayscriptsCodeGeneratorReplayInputspy">trunk/Source/JavaScriptCore/replay/scripts/CodeGeneratorReplayInputs.py</a></li>
<li><a href="#trunkSourceJavaScriptCorereplayscriptsCodeGeneratorReplayInputsTemplatespy">trunk/Source/JavaScriptCore/replay/scripts/CodeGeneratorReplayInputsTemplates.py</a></li>
<li>trunk/Source/JavaScriptCore/replay/scripts/tests/</li>
<li>trunk/Source/JavaScriptCore/replay/scripts/tests/expected/</li>
<li><a href="#trunkSourceJavaScriptCorereplayscriptstestsexpectedfailoncstyleenumnostoragejsonerror">trunk/Source/JavaScriptCore/replay/scripts/tests/expected/fail-on-c-style-enum-no-storage.json-error</a></li>
<li><a href="#trunkSourceJavaScriptCorereplayscriptstestsexpectedfailonduplicateinputnamesjsonerror">trunk/Source/JavaScriptCore/replay/scripts/tests/expected/fail-on-duplicate-input-names.json-error</a></li>
<li><a href="#trunkSourceJavaScriptCorereplayscriptstestsexpectedfailonduplicatetypenamesjsonerror">trunk/Source/JavaScriptCore/replay/scripts/tests/expected/fail-on-duplicate-type-names.json-error</a></li>
<li><a href="#trunkSourceJavaScriptCorereplayscriptstestsexpectedfailonenumtypemissingvaluesjsonerror">trunk/Source/JavaScriptCore/replay/scripts/tests/expected/fail-on-enum-type-missing-values.json-error</a></li>
<li><a href="#trunkSourceJavaScriptCorereplayscriptstestsexpectedfailonmissinginputmembernamejsonerror">trunk/Source/JavaScriptCore/replay/scripts/tests/expected/fail-on-missing-input-member-name.json-error</a></li>
<li><a href="#trunkSourceJavaScriptCorereplayscriptstestsexpectedfailonmissinginputnamejsonerror">trunk/Source/JavaScriptCore/replay/scripts/tests/expected/fail-on-missing-input-name.json-error</a></li>
<li><a href="#trunkSourceJavaScriptCorereplayscriptstestsexpectedfailonmissinginputqueuejsonerror">trunk/Source/JavaScriptCore/replay/scripts/tests/expected/fail-on-missing-input-queue.json-error</a></li>
<li><a href="#trunkSourceJavaScriptCorereplayscriptstestsexpectedfailonmissingtypemodejsonerror">trunk/Source/JavaScriptCore/replay/scripts/tests/expected/fail-on-missing-type-mode.json-error</a></li>
<li><a href="#trunkSourceJavaScriptCorereplayscriptstestsexpectedfailonmissingtypenamejsonerror">trunk/Source/JavaScriptCore/replay/scripts/tests/expected/fail-on-missing-type-name.json-error</a></li>
<li><a href="#trunkSourceJavaScriptCorereplayscriptstestsexpectedfailonnoinputsjsonerror">trunk/Source/JavaScriptCore/replay/scripts/tests/expected/fail-on-no-inputs.json-error</a></li>
<li><a href="#trunkSourceJavaScriptCorereplayscriptstestsexpectedfailonnotypesjsonerror">trunk/Source/JavaScriptCore/replay/scripts/tests/expected/fail-on-no-types.json-error</a></li>
<li><a href="#trunkSourceJavaScriptCorereplayscriptstestsexpectedfailonunknowninputqueuejsonerror">trunk/Source/JavaScriptCore/replay/scripts/tests/expected/fail-on-unknown-input-queue.json-error</a></li>
<li><a href="#trunkSourceJavaScriptCorereplayscriptstestsexpectedfailonunknownmembertypejsonerror">trunk/Source/JavaScriptCore/replay/scripts/tests/expected/fail-on-unknown-member-type.json-error</a></li>
<li><a href="#trunkSourceJavaScriptCorereplayscriptstestsexpectedfailonunknowntypemodejsonerror">trunk/Source/JavaScriptCore/replay/scripts/tests/expected/fail-on-unknown-type-mode.json-error</a></li>
<li><a href="#trunkSourceJavaScriptCorereplayscriptstestsexpectedgenerateenumencodinghelperswithguardedvaluesjsonTestReplayInputscpp">trunk/Source/JavaScriptCore/replay/scripts/tests/expected/generate-enum-encoding-helpers-with-guarded-values.json-TestReplayInputs.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCorereplayscriptstestsexpectedgenerateenumencodinghelperswithguardedvaluesjsonTestReplayInputsh">trunk/Source/JavaScriptCore/replay/scripts/tests/expected/generate-enum-encoding-helpers-with-guarded-values.json-TestReplayInputs.h</a></li>
<li><a href="#trunkSourceJavaScriptCorereplayscriptstestsexpectedgenerateenumencodinghelpersjsonTestReplayInputscpp">trunk/Source/JavaScriptCore/replay/scripts/tests/expected/generate-enum-encoding-helpers.json-TestReplayInputs.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCorereplayscriptstestsexpectedgenerateenumencodinghelpersjsonTestReplayInputsh">trunk/Source/JavaScriptCore/replay/scripts/tests/expected/generate-enum-encoding-helpers.json-TestReplayInputs.h</a></li>
<li><a href="#trunkSourceJavaScriptCorereplayscriptstestsexpectedgenerateeventloopshapetypesjsonerror">trunk/Source/JavaScriptCore/replay/scripts/tests/expected/generate-event-loop-shape-types.json-error</a></li>
<li><a href="#trunkSourceJavaScriptCorereplayscriptstestsexpectedgenerateinputwithguardjsonTestReplayInputscpp">trunk/Source/JavaScriptCore/replay/scripts/tests/expected/generate-input-with-guard.json-TestReplayInputs.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCorereplayscriptstestsexpectedgenerateinputwithguardjsonTestReplayInputsh">trunk/Source/JavaScriptCore/replay/scripts/tests/expected/generate-input-with-guard.json-TestReplayInputs.h</a></li>
<li><a href="#trunkSourceJavaScriptCorereplayscriptstestsexpectedgenerateinputwithvectormembersjsonTestReplayInputscpp">trunk/Source/JavaScriptCore/replay/scripts/tests/expected/generate-input-with-vector-members.json-TestReplayInputs.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCorereplayscriptstestsexpectedgenerateinputwithvectormembersjsonTestReplayInputsh">trunk/Source/JavaScriptCore/replay/scripts/tests/expected/generate-input-with-vector-members.json-TestReplayInputs.h</a></li>
<li><a href="#trunkSourceJavaScriptCorereplayscriptstestsexpectedgenerateinputswithflagsjsonTestReplayInputscpp">trunk/Source/JavaScriptCore/replay/scripts/tests/expected/generate-inputs-with-flags.json-TestReplayInputs.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCorereplayscriptstestsexpectedgenerateinputswithflagsjsonTestReplayInputsh">trunk/Source/JavaScriptCore/replay/scripts/tests/expected/generate-inputs-with-flags.json-TestReplayInputs.h</a></li>
<li><a href="#trunkSourceJavaScriptCorereplayscriptstestsexpectedgeneratememoizedtypemodesjsonTestReplayInputscpp">trunk/Source/JavaScriptCore/replay/scripts/tests/expected/generate-memoized-type-modes.json-TestReplayInputs.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCorereplayscriptstestsexpectedgeneratememoizedtypemodesjsonTestReplayInputsh">trunk/Source/JavaScriptCore/replay/scripts/tests/expected/generate-memoized-type-modes.json-TestReplayInputs.h</a></li>
<li><a href="#trunkSourceJavaScriptCorereplayscriptstestsfailoncstyleenumnostoragejson">trunk/Source/JavaScriptCore/replay/scripts/tests/fail-on-c-style-enum-no-storage.json</a></li>
<li><a href="#trunkSourceJavaScriptCorereplayscriptstestsfailonduplicateinputnamesjson">trunk/Source/JavaScriptCore/replay/scripts/tests/fail-on-duplicate-input-names.json</a></li>
<li><a href="#trunkSourceJavaScriptCorereplayscriptstestsfailonduplicatetypenamesjson">trunk/Source/JavaScriptCore/replay/scripts/tests/fail-on-duplicate-type-names.json</a></li>
<li><a href="#trunkSourceJavaScriptCorereplayscriptstestsfailonenumtypemissingvaluesjson">trunk/Source/JavaScriptCore/replay/scripts/tests/fail-on-enum-type-missing-values.json</a></li>
<li><a href="#trunkSourceJavaScriptCorereplayscriptstestsfailonmissinginputmembernamejson">trunk/Source/JavaScriptCore/replay/scripts/tests/fail-on-missing-input-member-name.json</a></li>
<li><a href="#trunkSourceJavaScriptCorereplayscriptstestsfailonmissinginputnamejson">trunk/Source/JavaScriptCore/replay/scripts/tests/fail-on-missing-input-name.json</a></li>
<li><a href="#trunkSourceJavaScriptCorereplayscriptstestsfailonmissinginputqueuejson">trunk/Source/JavaScriptCore/replay/scripts/tests/fail-on-missing-input-queue.json</a></li>
<li><a href="#trunkSourceJavaScriptCorereplayscriptstestsfailonmissingtypemodejson">trunk/Source/JavaScriptCore/replay/scripts/tests/fail-on-missing-type-mode.json</a></li>
<li><a href="#trunkSourceJavaScriptCorereplayscriptstestsfailonmissingtypenamejson">trunk/Source/JavaScriptCore/replay/scripts/tests/fail-on-missing-type-name.json</a></li>
<li><a href="#trunkSourceJavaScriptCorereplayscriptstestsfailonnoinputsjson">trunk/Source/JavaScriptCore/replay/scripts/tests/fail-on-no-inputs.json</a></li>
<li><a href="#trunkSourceJavaScriptCorereplayscriptstestsfailonnotypesjson">trunk/Source/JavaScriptCore/replay/scripts/tests/fail-on-no-types.json</a></li>
<li><a href="#trunkSourceJavaScriptCorereplayscriptstestsfailonunknowninputqueuejson">trunk/Source/JavaScriptCore/replay/scripts/tests/fail-on-unknown-input-queue.json</a></li>
<li><a href="#trunkSourceJavaScriptCorereplayscriptstestsfailonunknownmembertypejson">trunk/Source/JavaScriptCore/replay/scripts/tests/fail-on-unknown-member-type.json</a></li>
<li><a href="#trunkSourceJavaScriptCorereplayscriptstestsfailonunknowntypemodejson">trunk/Source/JavaScriptCore/replay/scripts/tests/fail-on-unknown-type-mode.json</a></li>
<li><a href="#trunkSourceJavaScriptCorereplayscriptstestsgenerateenumencodinghelperswithguardedvaluesjson">trunk/Source/JavaScriptCore/replay/scripts/tests/generate-enum-encoding-helpers-with-guarded-values.json</a></li>
<li><a href="#trunkSourceJavaScriptCorereplayscriptstestsgenerateenumencodinghelpersjson">trunk/Source/JavaScriptCore/replay/scripts/tests/generate-enum-encoding-helpers.json</a></li>
<li><a href="#trunkSourceJavaScriptCorereplayscriptstestsgenerateeventloopshapetypesjson">trunk/Source/JavaScriptCore/replay/scripts/tests/generate-event-loop-shape-types.json</a></li>
<li><a href="#trunkSourceJavaScriptCorereplayscriptstestsgenerateinputwithguardjson">trunk/Source/JavaScriptCore/replay/scripts/tests/generate-input-with-guard.json</a></li>
<li><a href="#trunkSourceJavaScriptCorereplayscriptstestsgenerateinputwithvectormembersjson">trunk/Source/JavaScriptCore/replay/scripts/tests/generate-input-with-vector-members.json</a></li>
<li><a href="#trunkSourceJavaScriptCorereplayscriptstestsgenerateinputswithflagsjson">trunk/Source/JavaScriptCore/replay/scripts/tests/generate-inputs-with-flags.json</a></li>
<li><a href="#trunkSourceJavaScriptCorereplayscriptstestsgeneratememoizedtypemodesjson">trunk/Source/JavaScriptCore/replay/scripts/tests/generate-memoized-type-modes.json</a></li>
<li><a href="#trunkToolsScriptsruninputgeneratortests">trunk/Tools/Scripts/run-input-generator-tests</a></li>
<li>trunk/Tools/Scripts/webkitpy/replay/</li>
<li><a href="#trunkToolsScriptswebkitpyreplay__init__py">trunk/Tools/Scripts/webkitpy/replay/__init__.py</a></li>
<li><a href="#trunkToolsScriptswebkitpyreplaymainpy">trunk/Tools/Scripts/webkitpy/replay/main.py</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ChangeLog (163917 => 163918)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ChangeLog        2014-02-12 00:08:16 UTC (rev 163917)
+++ trunk/Source/JavaScriptCore/ChangeLog        2014-02-12 00:22:01 UTC (rev 163918)
</span><span class="lines">@@ -1,3 +1,214 @@
</span><ins>+2014-02-11 Brian Burg <bburg@apple.com>
+
+ Web Replay: upstream replay input code generator and EncodedValue class
+ https://bugs.webkit.org/show_bug.cgi?id=128215
+
+ Reviewed by Joseph Pecoraro.
+
+ Add the replay inputs code generator. Most features of the input generator are
+ exercised by included generator regression tests, which produce useful but
+ non-compilable test replay inputs.
+
+ Add EncodedValue, the main replay input serialization class that encodes and
+ decodes inputs and their data between C++ types and the JSON-based replay recording
+ format. EncodedValue uses EncodingTraits specializations for type-specific encoding.
+ Relative to other WebKit marshalling mechanisms, EncodedValue is key/value based.
+ EncodedValue uses InspectorValue subclasses as its backing data structure.
+
+ Add some missing numerical conversions to InspectorValue.
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * inspector/InspectorValues.cpp:
+ (Inspector::InspectorValue::asNumber):
+ (Inspector::InspectorBasicValue::asNumber):
+ * inspector/InspectorValues.h:
+ * replay/EncodedValue.cpp: Added.
+ (JSC::EncodedValue::asObject):
+ (JSC::EncodedValue::asArray):
+ (JSC::ScalarEncodingTraits<bool>::encodeValue):
+ (JSC::ScalarEncodingTraits<double>::encodeValue):
+ (JSC::ScalarEncodingTraits<float>::encodeValue):
+ (JSC::ScalarEncodingTraits<int32_t>::encodeValue):
+ (JSC::ScalarEncodingTraits<int64_t>::encodeValue):
+ (JSC::ScalarEncodingTraits<uint32_t>::encodeValue):
+ (JSC::ScalarEncodingTraits<uint64_t>::encodeValue):
+ (JSC::long>::encodeValue):
+ (JSC::EncodedValue::convertTo<bool>):
+ (JSC::EncodedValue::convertTo<double>):
+ (JSC::EncodedValue::convertTo<float>):
+ (JSC::EncodedValue::convertTo<int32_t>):
+ (JSC::EncodedValue::convertTo<int64_t>):
+ (JSC::EncodedValue::convertTo<uint32_t>):
+ (JSC::EncodedValue::convertTo<uint64_t>):
+ (JSC::long>):
+ (JSC::EncodedValue::convertTo<String>):
+ (JSC::EncodedValue::put<EncodedValue>):
+ (JSC::EncodedValue::append<EncodedValue>):
+ (JSC::EncodedValue::get<EncodedValue>):
+ * replay/EncodedValue.h: Added.
+ (JSC::EncodedValue::EncodedValue):
+ (JSC::EncodedValue::createObject):
+ (JSC::EncodedValue::createArray):
+ (JSC::EncodedValue::createString):
+ (JSC::EncodedValue::~EncodedValue):
+ (JSC::ScalarEncodingTraits::decodeValue):
+ (JSC::EncodingTraits<String>::encodeValue):
+ (JSC::EncodedValue::put):
+ (JSC::EncodedValue::append):
+ (JSC::EncodedValue::get):
+ * replay/scripts/CodeGeneratorReplayInputs.py: Added.
+ (ParseException):
+ (TypecheckException):
+ (Framework):
+ (Framework.__init__):
+ (Framework.setting):
+ (Framework.fromString):
+ (Frameworks):
+ (InputQueue):
+ (InputQueue.__init__):
+ (InputQueue.setting):
+ (InputQueue.fromString):
+ (InputQueues):
+ (Input):
+ (Input.__init__):
+ (Input.setting):
+ (InputMember):
+ (InputMember.__init__):
+ (InputMember.has_flag):
+ (TypeMode):
+ (TypeMode.__init__):
+ (TypeMode.fromString):
+ (TypeModes):
+ (Type):
+ (Type.__init__):
+ (Type.__eq__):
+ (Type.__hash__):
+ (Type.has_flag):
+ (Type.is_struct):
+ (Type.is_enum):
+ (Type.is_enum_class):
+ (Type.declaration_kind):
+ (Type.qualified_prefix):
+ (Type.qualified_prefix.is):
+ (Type.type_name):
+ (Type.storage_type):
+ (Type.borrow_type):
+ (Type.argument_type):
+ (check_properties):
+ (VectorType):
+ (VectorType.__init__):
+ (VectorType.has_flag):
+ (VectorType.is_struct):
+ (VectorType.is_enum):
+ (VectorType.is_enum_class):
+ (VectorType.qualified_prefix):
+ (VectorType.type_name):
+ (VectorType.argument_type):
+ (InputsModel):
+ (InputsModel.__init__):
+ (InputsModel.enum_types):
+ (InputsModel.get_type_for_member):
+ (InputsModel.parse_toplevel):
+ (InputsModel.parse_type_with_framework_name):
+ (InputsModel.parse_input):
+ (InputsModel.typecheck):
+ (InputsModel.typecheck_type):
+ (InputsModel.typecheck_input):
+ (InputsModel.typecheck_input_member):
+ (IncrementalFileWriter):
+ (IncrementalFileWriter.__init__):
+ (IncrementalFileWriter.write):
+ (IncrementalFileWriter.close):
+ (lcfirst):
+ (wrap_with_guard):
+ (Generator):
+ (Generator.__init__):
+ (Generator.setting):
+ (Generator.output_filename):
+ (Generator.write_output_files):
+ (Generator.generate_header):
+ (Generator.generate_implementation):
+ (Generator.generate_license):
+ (Generator.generate_includes):
+ (Generator.generate_includes.declaration):
+ (Generator.generate_includes.declaration.is):
+ (Generator.generate_type_forward_declarations):
+ (Generator.generate_type_forward_declarations.is):
+ (Generator.generate_class_declaration):
+ (Generator.generate_input_constructor_declaration):
+ (Generator.generate_input_destructor_declaration):
+ (Generator.generate_input_member_getter):
+ (Generator.generate_input_member_declaration):
+ (Generator.generate_input_member_tuples):
+ (Generator.qualified_input_name):
+ (Generator.generate_input_trait_declaration):
+ (Generator.generate_enum_trait_declaration):
+ (Generator.generate_for_each_macro):
+ (Generator.generate_class_implementation):
+ (Generator.generate_enum_trait_implementation):
+ (Generator.generate_enum_trait_implementation.is):
+ (Generator.generate_input_trait_implementation):
+ (Generator.generate_input_encode_implementation):
+ (Generator.generate_input_decode_implementation):
+ (Generator.generate_constructor_initializer_list):
+ (Generator.generate_constructor_formals_list):
+ (Generator.generate_member_borrow_expression):
+ (Generator.generate_member_move_expression):
+ (Generator.generate_constructor_arguments_list):
+ (generate_from_specification):
+ * replay/scripts/CodeGeneratorReplayInputsTemplates.py: Added.
+ (Templates):
+ * replay/scripts/tests/expected/JSInputs.json-TestReplayInputs.cpp: Added.
+ * replay/scripts/tests/expected/JSInputs.json-TestReplayInputs.h: Added.
+ * replay/scripts/tests/expected/fail-on-c-style-enum-no-storage.json-error: Added.
+ * replay/scripts/tests/expected/fail-on-duplicate-input-names.json-error: Added.
+ * replay/scripts/tests/expected/fail-on-duplicate-type-names.json-error: Added.
+ * replay/scripts/tests/expected/fail-on-enum-type-missing-values.json-error: Added.
+ * replay/scripts/tests/expected/fail-on-missing-input-member-name.json-error: Added.
+ * replay/scripts/tests/expected/fail-on-missing-input-name.json-error: Added.
+ * replay/scripts/tests/expected/fail-on-missing-input-queue.json-error: Added.
+ * replay/scripts/tests/expected/fail-on-missing-type-mode.json-error: Added.
+ * replay/scripts/tests/expected/fail-on-missing-type-name.json-error: Added.
+ * replay/scripts/tests/expected/fail-on-no-inputs.json-error: Added.
+ * replay/scripts/tests/expected/fail-on-no-types.json-error: Added.
+ * replay/scripts/tests/expected/fail-on-unknown-input-queue.json-error: Added.
+ * replay/scripts/tests/expected/fail-on-unknown-member-type.json-error: Added.
+ * replay/scripts/tests/expected/fail-on-unknown-type-mode.json-error: Added.
+ * replay/scripts/tests/expected/generate-enum-encoding-helpers-with-guarded-values.json-TestReplayInputs.cpp: Added.
+ * replay/scripts/tests/expected/generate-enum-encoding-helpers-with-guarded-values.json-TestReplayInputs.h: Added.
+ * replay/scripts/tests/expected/generate-enum-encoding-helpers.json-TestReplayInputs.cpp: Added.
+ * replay/scripts/tests/expected/generate-enum-encoding-helpers.json-TestReplayInputs.h: Added.
+ * replay/scripts/tests/expected/generate-enum-encoding-helpers.json-error: Added.
+ * replay/scripts/tests/expected/generate-event-loop-shape-types.json-error: Added.
+ * replay/scripts/tests/expected/generate-input-with-guard.json-TestReplayInputs.cpp: Added.
+ * replay/scripts/tests/expected/generate-input-with-guard.json-TestReplayInputs.h: Added.
+ * replay/scripts/tests/expected/generate-input-with-vector-members.json-TestReplayInputs.cpp: Added.
+ * replay/scripts/tests/expected/generate-input-with-vector-members.json-TestReplayInputs.h: Added.
+ * replay/scripts/tests/expected/generate-inputs-with-flags.json-error: Added.
+ * replay/scripts/tests/expected/generate-memoized-type-modes.json-TestReplayInputs.cpp: Added.
+ * replay/scripts/tests/expected/generate-memoized-type-modes.json-TestReplayInputs.h: Added.
+ * replay/scripts/tests/fail-on-c-style-enum-no-storage.json: Added.
+ * replay/scripts/tests/fail-on-duplicate-input-names.json: Added.
+ * replay/scripts/tests/fail-on-duplicate-type-names.json: Added.
+ * replay/scripts/tests/fail-on-enum-type-missing-values.json: Added.
+ * replay/scripts/tests/fail-on-missing-input-member-name.json: Added.
+ * replay/scripts/tests/fail-on-missing-input-name.json: Added.
+ * replay/scripts/tests/fail-on-missing-input-queue.json: Added.
+ * replay/scripts/tests/fail-on-missing-type-mode.json: Added.
+ * replay/scripts/tests/fail-on-missing-type-name.json: Added.
+ * replay/scripts/tests/fail-on-no-inputs.json: Added.
+ * replay/scripts/tests/fail-on-no-types.json: Added.
+ * replay/scripts/tests/fail-on-unknown-input-queue.json: Added.
+ * replay/scripts/tests/fail-on-unknown-member-type.json: Added.
+ * replay/scripts/tests/fail-on-unknown-type-mode.json: Added.
+ * replay/scripts/tests/generate-enum-encoding-helpers-with-guarded-values.json: Added.
+ * replay/scripts/tests/generate-enum-encoding-helpers.json: Added.
+ * replay/scripts/tests/generate-event-loop-shape-types.json: Added.
+ * replay/scripts/tests/generate-input-with-guard.json: Added.
+ * replay/scripts/tests/generate-input-with-vector-members.json: Added.
+ * replay/scripts/tests/generate-inputs-with-flags.json: Added.
+ * replay/scripts/tests/generate-memoized-type-modes.json: Added.
+
</ins><span class="cx"> 2014-02-11 Joseph Pecoraro <pecoraro@apple.com>
</span><span class="cx">
</span><span class="cx"> Add Availability Macros to new JSC APIs
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreJavaScriptCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj (163917 => 163918)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj        2014-02-12 00:08:16 UTC (rev 163917)
+++ trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj        2014-02-12 00:22:01 UTC (rev 163918)
</span><span class="lines">@@ -929,9 +929,11 @@
</span><span class="cx">                 969A079B0ED1D3AE00F1F681 /* Opcode.h in Headers */ = {isa = PBXBuildFile; fileRef = 969A07950ED1D3AE00F1F681 /* Opcode.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 978801401471AD920041B016 /* JSDateMath.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9788FC221471AD0C0068CE2D /* JSDateMath.cpp */; };
</span><span class="cx">                 978801411471AD920041B016 /* JSDateMath.h in Headers */ = {isa = PBXBuildFile; fileRef = 9788FC231471AD0C0068CE2D /* JSDateMath.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><del>-                99E45A1018A01F350026D88F /* EmptyInputCursor.h in Headers */ = {isa = PBXBuildFile; fileRef = 99E45A0D18A01F350026D88F /* EmptyInputCursor.h */; settings = {ATTRIBUTES = (Private, ); }; };
-                99E45A1118A01F350026D88F /* InputCursor.h in Headers */ = {isa = PBXBuildFile; fileRef = 99E45A0E18A01F350026D88F /* InputCursor.h */; settings = {ATTRIBUTES = (Private, ); }; };
-                99E45A1218A01F350026D88F /* NondeterministicInput.h in Headers */ = {isa = PBXBuildFile; fileRef = 99E45A0F18A01F350026D88F /* NondeterministicInput.h */; settings = {ATTRIBUTES = (Private, ); }; };
</del><ins>+                99E45A2418A1B2590026D88F /* EmptyInputCursor.h in Headers */ = {isa = PBXBuildFile; fileRef = 99E45A1F18A1B2590026D88F /* EmptyInputCursor.h */; settings = {ATTRIBUTES = (Private, ); }; };
+                99E45A2518A1B2590026D88F /* EncodedValue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 99E45A2018A1B2590026D88F /* EncodedValue.cpp */; };
+                99E45A2618A1B2590026D88F /* EncodedValue.h in Headers */ = {isa = PBXBuildFile; fileRef = 99E45A2118A1B2590026D88F /* EncodedValue.h */; settings = {ATTRIBUTES = (Private, ); }; };
+                99E45A2718A1B2590026D88F /* InputCursor.h in Headers */ = {isa = PBXBuildFile; fileRef = 99E45A2218A1B2590026D88F /* InputCursor.h */; settings = {ATTRIBUTES = (Private, ); }; };
+                99E45A2818A1B2590026D88F /* NondeterministicInput.h in Headers */ = {isa = PBXBuildFile; fileRef = 99E45A2318A1B2590026D88F /* NondeterministicInput.h */; settings = {ATTRIBUTES = (Private, ); }; };
</ins><span class="cx">                 A1712B3B11C7B212007A5315 /* RegExpCache.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A1712B3A11C7B212007A5315 /* RegExpCache.cpp */; };
</span><span class="cx">                 A1712B3F11C7B228007A5315 /* RegExpCache.h in Headers */ = {isa = PBXBuildFile; fileRef = A1712B3E11C7B228007A5315 /* RegExpCache.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 A1712B4111C7B235007A5315 /* RegExpKey.h in Headers */ = {isa = PBXBuildFile; fileRef = A1712B4011C7B235007A5315 /* RegExpKey.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="lines">@@ -2400,9 +2402,13 @@
</span><span class="cx">                 969A09220ED1E09C00F1F681 /* Completion.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Completion.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 9788FC221471AD0C0068CE2D /* JSDateMath.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSDateMath.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 9788FC231471AD0C0068CE2D /* JSDateMath.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSDateMath.h; sourceTree = "<group>"; };
</span><del>-                99E45A0D18A01F350026D88F /* EmptyInputCursor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = EmptyInputCursor.h; path = replay/EmptyInputCursor.h; sourceTree = "<group>"; };
-                99E45A0E18A01F350026D88F /* InputCursor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = InputCursor.h; path = replay/InputCursor.h; sourceTree = "<group>"; };
-                99E45A0F18A01F350026D88F /* NondeterministicInput.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = NondeterministicInput.h; path = replay/NondeterministicInput.h; sourceTree = "<group>"; };
</del><ins>+                99E45A1D18A1B1E70026D88F /* CodeGeneratorReplayInputs.py */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; path = CodeGeneratorReplayInputs.py; sourceTree = "<group>"; };
+                99E45A1E18A1B1E70026D88F /* CodeGeneratorReplayInputsTemplates.py */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; path = CodeGeneratorReplayInputsTemplates.py; sourceTree = "<group>"; };
+                99E45A1F18A1B2590026D88F /* EmptyInputCursor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EmptyInputCursor.h; sourceTree = "<group>"; };
+                99E45A2018A1B2590026D88F /* EncodedValue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = EncodedValue.cpp; sourceTree = "<group>"; };
+                99E45A2118A1B2590026D88F /* EncodedValue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EncodedValue.h; sourceTree = "<group>"; };
+                99E45A2218A1B2590026D88F /* InputCursor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InputCursor.h; sourceTree = "<group>"; };
+                99E45A2318A1B2590026D88F /* NondeterministicInput.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NondeterministicInput.h; sourceTree = "<group>"; };
</ins><span class="cx">                 A1712B3A11C7B212007A5315 /* RegExpCache.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RegExpCache.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 A1712B3E11C7B228007A5315 /* RegExpCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RegExpCache.h; sourceTree = "<group>"; };
</span><span class="cx">                 A1712B4011C7B235007A5315 /* RegExpKey.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RegExpKey.h; sourceTree = "<group>"; };
</span><span class="lines">@@ -4545,13 +4551,25 @@
</span><span class="cx">                 99E45A0C18A01E930026D88F /* replay */ = {
</span><span class="cx">                         isa = PBXGroup;
</span><span class="cx">                         children = (
</span><del>-                                99E45A0D18A01F350026D88F /* EmptyInputCursor.h */,
-                                99E45A0E18A01F350026D88F /* InputCursor.h */,
-                                99E45A0F18A01F350026D88F /* NondeterministicInput.h */,
</del><ins>+                                99E45A1C18A1B1B80026D88F /* scripts */,
+                                99E45A2018A1B2590026D88F /* EncodedValue.cpp */,
+                                99E45A2118A1B2590026D88F /* EncodedValue.h */,
+                                99E45A1F18A1B2590026D88F /* EmptyInputCursor.h */,
+                                99E45A2218A1B2590026D88F /* InputCursor.h */,
+                                99E45A2318A1B2590026D88F /* NondeterministicInput.h */,
</ins><span class="cx">                         );
</span><del>-                        name = replay;
</del><ins>+                        path = replay;
</ins><span class="cx">                         sourceTree = "<group>";
</span><span class="cx">                 };
</span><ins>+                99E45A1C18A1B1B80026D88F /* scripts */ = {
+                        isa = PBXGroup;
+                        children = (
+                                99E45A1D18A1B1E70026D88F /* CodeGeneratorReplayInputs.py */,
+                                99E45A1E18A1B1E70026D88F /* CodeGeneratorReplayInputsTemplates.py */,
+                        );
+                        path = scripts;
+                        sourceTree = "<group>";
+                };
</ins><span class="cx">                 A513E5CC185FB992007E95AD /* agents */ = {
</span><span class="cx">                         isa = PBXGroup;
</span><span class="cx">                         children = (
</span><span class="lines">@@ -4777,6 +4795,7 @@
</span><span class="cx">                                 969A07230ED1CE3300F1F681 /* BytecodeGenerator.h in Headers */,
</span><span class="cx">                                 0F8023EA1613832B00A0BA45 /* ByValInfo.h in Headers */,
</span><span class="cx">                                 BC18C3ED0E16F5CD00B34460 /* CallData.h in Headers */,
</span><ins>+                                99E45A2618A1B2590026D88F /* EncodedValue.h in Headers */,
</ins><span class="cx">                                 1429D8DE0ED2205B00B89619 /* CallFrame.h in Headers */,
</span><span class="cx">                                 A7C1EAEF17987AB600299DB2 /* CallFrameInlines.h in Headers */,
</span><span class="cx">                                 95E3BC050E1AE68200B2D1C1 /* CallIdentifier.h in Headers */,
</span><span class="lines">@@ -4943,6 +4962,7 @@
</span><span class="cx">                                 0FEFC9AB1681A3B600567F53 /* DFGOSRExitJumpPlaceholder.h in Headers */,
</span><span class="cx">                                 0F235BEE17178E7300690C7F /* DFGOSRExitPreparation.h in Headers */,
</span><span class="cx">                                 0FFFC95C14EF90AF00C72532 /* DFGPhase.h in Headers */,
</span><ins>+                                99E45A2718A1B2590026D88F /* InputCursor.h in Headers */,
</ins><span class="cx">                                 A78A977B179738B8009DF744 /* DFGPlan.h in Headers */,
</span><span class="cx">                                 0FBE0F7516C1DB0B0082C5E8 /* DFGPredictionInjectionPhase.h in Headers */,
</span><span class="cx">                                 0FFFC95E14EF90B700C72532 /* DFGPredictionPropagationPhase.h in Headers */,
</span><span class="lines">@@ -5028,7 +5048,6 @@
</span><span class="cx">                                 0FEA0A10170513DB00BB722C /* FTLLowerDFGToLLVM.h in Headers */,
</span><span class="cx">                                 A7D89D0217A0B90400773AD8 /* FTLLoweredNodeValue.h in Headers */,
</span><span class="cx">                                 0FD8A31C17D51F2200CA2C40 /* FTLOSREntry.h in Headers */,
</span><del>-                                99E45A1118A01F350026D88F /* InputCursor.h in Headers */,
</del><span class="cx">                                 0F235BDD17178E1C00690C7F /* FTLOSRExit.h in Headers */,
</span><span class="cx">                                 0F235BDE17178E1C00690C7F /* FTLOSRExitCompilationInfo.h in Headers */,
</span><span class="cx">                                 0F235BE017178E1C00690C7F /* FTLOSRExitCompiler.h in Headers */,
</span><span class="lines">@@ -5049,6 +5068,7 @@
</span><span class="cx">                                 DDF7ABD411F60ED200108E36 /* GCActivityCallback.h in Headers */,
</span><span class="cx">                                 BCBE2CAE14E985AA000593AD /* GCAssertions.h in Headers */,
</span><span class="cx">                                 0F766D3015A8DCE2008F363E /* GCAwareJITStubRoutine.h in Headers */,
</span><ins>+                                99E45A2418A1B2590026D88F /* EmptyInputCursor.h in Headers */,
</ins><span class="cx">                                 0F2B66AC17B6B53F00A7AE3F /* GCIncomingRefCounted.h in Headers */,
</span><span class="cx">                                 0F2B66AD17B6B54500A7AE3F /* GCIncomingRefCountedInlines.h in Headers */,
</span><span class="cx">                                 0F2B66AE17B6B54500A7AE3F /* GCIncomingRefCountedSet.h in Headers */,
</span><span class="lines">@@ -5202,7 +5222,6 @@
</span><span class="cx">                                 BC18C45E0E16F5CD00B34460 /* JSStack.h in Headers */,
</span><span class="cx">                                 A7C1EAF017987AB600299DB2 /* JSStackInlines.h in Headers */,
</span><span class="cx">                                 BC18C4270E16F5CD00B34460 /* JSString.h in Headers */,
</span><del>-                                99E45A1218A01F350026D88F /* NondeterministicInput.h in Headers */,
</del><span class="cx">                                 86E85539111B9968001AF51E /* JSStringBuilder.h in Headers */,
</span><span class="cx">                                 2600B5A7152BAAA70091EE5F /* JSStringJoiner.h in Headers */,
</span><span class="cx">                                 BC18C4280E16F5CD00B34460 /* JSStringRef.h in Headers */,
</span><span class="lines">@@ -5352,6 +5371,7 @@
</span><span class="cx">                                 86158AB3155C8B4000B45C9C /* PropertyName.h in Headers */,
</span><span class="cx">                                 BC18C4540E16F5CD00B34460 /* PropertyNameArray.h in Headers */,
</span><span class="cx">                                 0FF7168C15A3B235008F5DAA /* PropertyOffset.h in Headers */,
</span><ins>+                                99E45A2818A1B2590026D88F /* NondeterministicInput.h in Headers */,
</ins><span class="cx">                                 BC18C4550E16F5CD00B34460 /* PropertySlot.h in Headers */,
</span><span class="cx">                                 0FB7F39C15ED8E4600F167B2 /* PropertyStorage.h in Headers */,
</span><span class="cx">                                 A532438818568335002ED692 /* InspectorJSBackendDispatchers.h in Headers */,
</span><span class="lines">@@ -5404,7 +5424,6 @@
</span><span class="cx">                                 E49DC16D12EF295300184A1F /* SourceProviderCacheItem.h in Headers */,
</span><span class="cx">                                 0FB7F39E15ED8E4600F167B2 /* SparseArrayValueMap.h in Headers */,
</span><span class="cx">                                 A7386554118697B400540279 /* SpecializedThunkJIT.h in Headers */,
</span><del>-                                99E45A1018A01F350026D88F /* EmptyInputCursor.h in Headers */,
</del><span class="cx">                                 0F5541B21613C1FB00CE3E25 /* SpecialPointer.h in Headers */,
</span><span class="cx">                                 0FD82E54141DAEEE00179C94 /* SpeculatedType.h in Headers */,
</span><span class="cx">                                 A7C1EAF217987AB600299DB2 /* StackVisitor.h in Headers */,
</span><span class="lines">@@ -6240,6 +6259,7 @@
</span><span class="cx">                                 1482B74E0A43032800517CFC /* JSStringRef.cpp in Sources */,
</span><span class="cx">                                 146AAB380B66A94400E55F16 /* JSStringRefCF.cpp in Sources */,
</span><span class="cx">                                 0F919D0C157EE09F004A4E7D /* JSSymbolTableObject.cpp in Sources */,
</span><ins>+                                99E45A2518A1B2590026D88F /* EncodedValue.cpp in Sources */,
</ins><span class="cx">                                 0F2B66FA17B6B5AB00A7AE3F /* JSTypedArrayConstructors.cpp in Sources */,
</span><span class="cx">                                 A532438B18568335002ED692 /* InspectorJSTypeBuilders.cpp in Sources */,
</span><span class="cx">                                 0F2B66FC17B6B5AB00A7AE3F /* JSTypedArrayPrototypes.cpp in Sources */,
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreinspectorInspectorValuescpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/inspector/InspectorValues.cpp (163917 => 163918)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/inspector/InspectorValues.cpp        2014-02-12 00:08:16 UTC (rev 163917)
+++ trunk/Source/JavaScriptCore/inspector/InspectorValues.cpp        2014-02-12 00:22:01 UTC (rev 163918)
</span><span class="lines">@@ -492,7 +492,7 @@
</span><span class="cx"> return false;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-bool InspectorValue::asNumber(long*) const
</del><ins>+bool InspectorValue::asNumber(float*) const
</ins><span class="cx"> {
</span><span class="cx"> return false;
</span><span class="cx"> }
</span><span class="lines">@@ -502,12 +502,27 @@
</span><span class="cx"> return false;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+bool InspectorValue::asNumber(unsigned*) const
+{
+ return false;
+}
+
+bool InspectorValue::asNumber(long*) const
+{
+ return false;
+}
+
+bool InspectorValue::asNumber(long long*) const
+{
+ return false;
+}
+
</ins><span class="cx"> bool InspectorValue::asNumber(unsigned long*) const
</span><span class="cx"> {
</span><span class="cx"> return false;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-bool InspectorValue::asNumber(unsigned int*) const
</del><ins>+bool InspectorValue::asNumber(unsigned long long*) const
</ins><span class="cx"> {
</span><span class="cx"> return false;
</span><span class="cx"> }
</span><span class="lines">@@ -584,11 +599,11 @@
</span><span class="cx"> return true;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-bool InspectorBasicValue::asNumber(long* output) const
</del><ins>+bool InspectorBasicValue::asNumber(float* output) const
</ins><span class="cx"> {
</span><span class="cx"> if (type() != TypeNumber)
</span><span class="cx"> return false;
</span><del>- *output = static_cast<long>(m_doubleValue);
</del><ins>+ *output = static_cast<float>(m_doubleValue);
</ins><span class="cx"> return true;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -600,6 +615,30 @@
</span><span class="cx"> return true;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+bool InspectorBasicValue::asNumber(unsigned* output) const
+{
+ if (type() != TypeNumber)
+ return false;
+ *output = static_cast<unsigned>(m_doubleValue);
+ return true;
+}
+
+bool InspectorBasicValue::asNumber(long* output) const
+{
+ if (type() != TypeNumber)
+ return false;
+ *output = static_cast<long>(m_doubleValue);
+ return true;
+}
+
+bool InspectorBasicValue::asNumber(long long* output) const
+{
+ if (type() != TypeNumber)
+ return false;
+ *output = static_cast<long long>(m_doubleValue);
+ return true;
+}
+
</ins><span class="cx"> bool InspectorBasicValue::asNumber(unsigned long* output) const
</span><span class="cx"> {
</span><span class="cx"> if (type() != TypeNumber)
</span><span class="lines">@@ -608,11 +647,11 @@
</span><span class="cx"> return true;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-bool InspectorBasicValue::asNumber(unsigned int* output) const
</del><ins>+bool InspectorBasicValue::asNumber(unsigned long long* output) const
</ins><span class="cx"> {
</span><span class="cx"> if (type() != TypeNumber)
</span><span class="cx"> return false;
</span><del>- *output = static_cast<unsigned int>(m_doubleValue);
</del><ins>+ *output = static_cast<unsigned long long>(m_doubleValue);
</ins><span class="cx"> return true;
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreinspectorInspectorValuesh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/inspector/InspectorValues.h (163917 => 163918)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/inspector/InspectorValues.h        2014-02-12 00:08:16 UTC (rev 163917)
+++ trunk/Source/JavaScriptCore/inspector/InspectorValues.h        2014-02-12 00:22:01 UTC (rev 163918)
</span><span class="lines">@@ -67,10 +67,13 @@
</span><span class="cx">
</span><span class="cx"> virtual bool asBoolean(bool* output) const;
</span><span class="cx"> virtual bool asNumber(double* output) const;
</span><ins>+ virtual bool asNumber(float* output) const;
+ virtual bool asNumber(int* output) const;
+ virtual bool asNumber(unsigned* output) const;
</ins><span class="cx"> virtual bool asNumber(long* output) const;
</span><del>- virtual bool asNumber(int* output) const;
</del><ins>+ virtual bool asNumber(long long* output) const;
</ins><span class="cx"> virtual bool asNumber(unsigned long* output) const;
</span><del>- virtual bool asNumber(unsigned int* output) const;
</del><ins>+ virtual bool asNumber(unsigned long long* output) const;
</ins><span class="cx"> virtual bool asString(String* output) const;
</span><span class="cx"> virtual bool asValue(RefPtr<InspectorValue>* output);
</span><span class="cx"> virtual bool asObject(RefPtr<InspectorObject>* output);
</span><span class="lines">@@ -99,10 +102,13 @@
</span><span class="cx">
</span><span class="cx"> virtual bool asBoolean(bool* output) const override;
</span><span class="cx"> virtual bool asNumber(double* output) const override;
</span><ins>+ virtual bool asNumber(float* output) const override;
+ virtual bool asNumber(int* output) const override;
+ virtual bool asNumber(unsigned* output) const override;
</ins><span class="cx"> virtual bool asNumber(long* output) const override;
</span><del>- virtual bool asNumber(int* output) const override;
</del><ins>+ virtual bool asNumber(long long* output) const override;
</ins><span class="cx"> virtual bool asNumber(unsigned long* output) const override;
</span><del>- virtual bool asNumber(unsigned* output) const override;
</del><ins>+ virtual bool asNumber(unsigned long long* output) const override;
</ins><span class="cx">
</span><span class="cx"> virtual void writeJSON(StringBuilder* output) const override;
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorereplayEncodedValuecpp"></a>
<div class="addfile"><h4>Added: trunk/Source/JavaScriptCore/replay/EncodedValue.cpp (0 => 163918)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/replay/EncodedValue.cpp         (rev 0)
+++ trunk/Source/JavaScriptCore/replay/EncodedValue.cpp        2014-02-12 00:22:01 UTC (rev 163918)
</span><span class="lines">@@ -0,0 +1,196 @@
</span><ins>+/*
+ * Copyright (C) 2013 University of Washington. All rights reserved.
+ * Copyright (C) 2014 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "EncodedValue.h"
+
+#if ENABLE(WEB_REPLAY)
+
+#include "InspectorValues.h"
+#include <wtf/text/Base64.h>
+
+using namespace Inspector;
+
+namespace JSC {
+
+PassRefPtr<InspectorObject> EncodedValue::asObject()
+{
+ RefPtr<InspectorObject> result;
+ bool castSucceeded = m_value->asObject(&result);
+ ASSERT_UNUSED(castSucceeded, castSucceeded);
+
+ return result.release();
+}
+
+PassRefPtr<InspectorArray> EncodedValue::asArray()
+{
+ RefPtr<InspectorArray> result;
+ bool castSucceeded = m_value->asArray(&result);
+ ASSERT_UNUSED(castSucceeded, castSucceeded);
+
+ return result.release();
+}
+
+template<> EncodedValue ScalarEncodingTraits<bool>::encodeValue(const bool& value)
+{
+ return EncodedValue(InspectorBasicValue::create(value));
+}
+
+template<> EncodedValue ScalarEncodingTraits<double>::encodeValue(const double& value)
+{
+ return EncodedValue(InspectorBasicValue::create(value));
+}
+
+template<> EncodedValue ScalarEncodingTraits<float>::encodeValue(const float& value)
+{
+ return EncodedValue(InspectorBasicValue::create((double)value));
+}
+
+template<> EncodedValue ScalarEncodingTraits<int32_t>::encodeValue(const int32_t& value)
+{
+ return EncodedValue(InspectorBasicValue::create((double)value));
+}
+
+template<> EncodedValue ScalarEncodingTraits<int64_t>::encodeValue(const int64_t& value)
+{
+ return EncodedValue(InspectorBasicValue::create((double)value));
+}
+
+template<> EncodedValue ScalarEncodingTraits<uint32_t>::encodeValue(const uint32_t& value)
+{
+ return EncodedValue(InspectorBasicValue::create((double)value));
+}
+
+template<> EncodedValue ScalarEncodingTraits<uint64_t>::encodeValue(const uint64_t& value)
+{
+ return EncodedValue(InspectorBasicValue::create((double)value));
+}
+
+template<> EncodedValue ScalarEncodingTraits<unsigned long>::encodeValue(const unsigned long& value)
+{
+ return EncodedValue(InspectorBasicValue::create((double)value));
+}
+
+template<> bool EncodedValue::convertTo<bool>()
+{
+ bool result;
+ bool castSucceeded = m_value->asBoolean(&result);
+ ASSERT_UNUSED(castSucceeded, castSucceeded);
+
+ return result;
+}
+
+template<> double EncodedValue::convertTo<double>()
+{
+ double result;
+ bool castSucceeded = m_value->asNumber(&result);
+ ASSERT_UNUSED(castSucceeded, castSucceeded);
+
+ return result;
+}
+
+template<> float EncodedValue::convertTo<float>()
+{
+ float result;
+ bool castSucceeded = m_value->asNumber(&result);
+ ASSERT_UNUSED(castSucceeded, castSucceeded);
+
+ return result;
+}
+
+template<> int32_t EncodedValue::convertTo<int32_t>()
+{
+ int32_t result;
+ bool castSucceeded = m_value->asNumber(&result);
+ ASSERT_UNUSED(castSucceeded, castSucceeded);
+
+ return result;
+}
+
+template<> int64_t EncodedValue::convertTo<int64_t>()
+{
+ int64_t result;
+ bool castSucceeded = m_value->asNumber(&result);
+ ASSERT_UNUSED(castSucceeded, castSucceeded);
+
+ return result;
+}
+
+template<> uint32_t EncodedValue::convertTo<uint32_t>()
+{
+ uint32_t result;
+ bool castSucceeded = m_value->asNumber(&result);
+ ASSERT_UNUSED(castSucceeded, castSucceeded);
+
+ return result;
+}
+
+template<> uint64_t EncodedValue::convertTo<uint64_t>()
+{
+ uint64_t result;
+ bool castSucceeded = m_value->asNumber(&result);
+ ASSERT_UNUSED(castSucceeded, castSucceeded);
+
+ return result;
+}
+
+template<> String EncodedValue::convertTo<String>()
+{
+ String result;
+ bool castSucceeded = m_value->asString(&result);
+ ASSERT_UNUSED(castSucceeded, castSucceeded);
+
+ return result;
+}
+
+template<>
+void EncodedValue::put<EncodedValue>(const String& key, const typename EncodingTraits<EncodedValue>::DecodedType& value)
+{
+ asObject()->setValue(key, value.m_value);
+}
+
+template<>
+void EncodedValue::append<EncodedValue>(const typename EncodingTraits<EncodedValue>::DecodedType& value)
+{
+ asArray()->pushValue(value.m_value);
+}
+
+template<>
+bool EncodedValue::get<EncodedValue>(const String& key, typename EncodingTraits<EncodedValue>::DecodedType& decodedValue)
+{
+ RefPtr<Inspector::InspectorValue> inspectorValue(asObject()->get(key));
+ if (!inspectorValue)
+ return false;
+
+ decodedValue = EncodedValue(inspectorValue);
+ return true;
+}
+
+
+}; // namespace JSC
+
+#endif // ENABLE(WEB_REPLAY)
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCorereplayEncodedValueh"></a>
<div class="addfile"><h4>Added: trunk/Source/JavaScriptCore/replay/EncodedValue.h (0 => 163918)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/replay/EncodedValue.h         (rev 0)
+++ trunk/Source/JavaScriptCore/replay/EncodedValue.h        2014-02-12 00:22:01 UTC (rev 163918)
</span><span class="lines">@@ -0,0 +1,219 @@
</span><ins>+/*
+ * Copyright (C) 2013 University of Washington. All rights reserved.
+ * Copyright (C) 2014 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef EncodedValue_h
+#define EncodedValue_h
+
+#if ENABLE(WEB_REPLAY)
+
+#include "InspectorValues.h"
+#include <wtf/Forward.h>
+#include <wtf/Vector.h>
+
+namespace JSC {
+
+class NondeterministicInputBase;
+template<typename T> struct EncodingTraits;
+
+class EncodedValue final {
+public:
+ explicit EncodedValue(PassRefPtr<Inspector::InspectorValue> value)
+ : m_value(value) { }
+
+ EncodedValue()
+ : m_value(nullptr) { }
+
+ static EncodedValue createObject()
+ {
+ return EncodedValue(Inspector::InspectorObject::create());
+ }
+
+ static EncodedValue createArray()
+ {
+ return EncodedValue(Inspector::InspectorArray::create());
+ }
+
+ static EncodedValue createString(const String& value)
+ {
+ return EncodedValue(Inspector::InspectorString::create(value));
+ }
+
+ static EncodedValue createString(const char* value)
+ {
+ return EncodedValue(Inspector::InspectorString::create(value));
+ }
+
+ template<typename T>
+ void put(const String&, const typename EncodingTraits<T>::DecodedType&);
+
+ template<typename T>
+ void append(const typename EncodingTraits<T>::DecodedType&);
+
+ template<typename T> bool get(const String&, typename EncodingTraits<T>::DecodedType&);
+ template<typename T> bool get(const String&, std::unique_ptr<typename EncodingTraits<T>::DecodedType>&);
+
+ template<typename T> T convertTo();
+
+ JS_EXPORT_PRIVATE PassRefPtr<Inspector::InspectorObject> asObject();
+ JS_EXPORT_PRIVATE PassRefPtr<Inspector::InspectorArray> asArray();
+
+private:
+ RefPtr<Inspector::InspectorValue> m_value;
+};
+
+template<> JS_EXPORT_PRIVATE bool EncodedValue::convertTo<bool>();
+template<> JS_EXPORT_PRIVATE double EncodedValue::convertTo<double>();
+template<> JS_EXPORT_PRIVATE float EncodedValue::convertTo<float>();
+template<> JS_EXPORT_PRIVATE int32_t EncodedValue::convertTo<int32_t>();
+template<> JS_EXPORT_PRIVATE int64_t EncodedValue::convertTo<int64_t>();
+template<> JS_EXPORT_PRIVATE uint32_t EncodedValue::convertTo<uint32_t>();
+template<> JS_EXPORT_PRIVATE uint64_t EncodedValue::convertTo<uint64_t>();
+template<> JS_EXPORT_PRIVATE String EncodedValue::convertTo<String>();
+
+template<typename T>
+struct EncodingTraits {
+ typedef T DecodedType;
+
+ static EncodedValue encodeValue(DecodedType);
+ static EncodedValue encodeValue(const DecodedType&);
+
+ static bool decodeValue(EncodedValue&, DecodedType&);
+ static bool decodeValue(EncodedValue&, std::unique_ptr<DecodedType>&);
+};
+
+template<typename T, size_t inlineCapacity, typename OverflowHandler>
+struct EncodingTraits<Vector<T, inlineCapacity, OverflowHandler>> {
+ typedef Vector<typename EncodingTraits<T>::DecodedType, inlineCapacity, OverflowHandler> DecodedType;
+
+ static EncodedValue encodeValue(const DecodedType& vectorOfValues)
+ {
+ EncodedValue encodedVector = EncodedValue::createArray();
+ for (const typename EncodingTraits<T>::DecodedType& value : vectorOfValues)
+ encodedVector.append<typename EncodingTraits<T>::DecodedType>(value);
+
+ return std::move(encodedVector);
+ }
+
+ static bool decodeValue(EncodedValue& encodedVector, DecodedType& decodedValue)
+ {
+ RefPtr<Inspector::InspectorArray> inspectorArray = encodedVector.asArray();
+ decodedValue = Vector<typename EncodingTraits<T>::DecodedType, inlineCapacity, OverflowHandler>(inspectorArray->length());
+ for (size_t i = 0; i < inspectorArray->length(); ++i) {
+ EncodedValue encodedElement(inspectorArray->get(i));
+ if (!EncodingTraits<T>::decodeValue(encodedElement, decodedValue.at(i)))
+ return false;
+ }
+ return true;
+ }
+};
+
+template<> struct EncodingTraits<EncodedValue> {
+ typedef EncodedValue DecodedType;
+ // We should never attempt to decode or encode an encoded value,
+ // so encodeValue and decodeValue are intentionally omitted here.
+};
+
+template<typename T>
+struct ScalarEncodingTraits {
+ typedef T DecodedType;
+
+ static JS_EXPORT_PRIVATE EncodedValue encodeValue(const DecodedType& decodedValue);
+ static bool decodeValue(EncodedValue& encodedValue, DecodedType& decodedValue)
+ {
+ decodedValue = encodedValue.convertTo<DecodedType>();
+ return true;
+ }
+};
+
+template<> struct EncodingTraits<bool> : public ScalarEncodingTraits<bool> { };
+template<> struct EncodingTraits<double> : public ScalarEncodingTraits<double> { };
+template<> struct EncodingTraits<float> : public ScalarEncodingTraits<float> { };
+template<> struct EncodingTraits<int32_t> : public ScalarEncodingTraits<int32_t> { };
+template<> struct EncodingTraits<int64_t> : public ScalarEncodingTraits<int64_t> { };
+template<> struct EncodingTraits<uint32_t> : public ScalarEncodingTraits<uint32_t> { };
+template<> struct EncodingTraits<uint64_t> : public ScalarEncodingTraits<uint64_t> { };
+
+template<> struct EncodingTraits<String> : public ScalarEncodingTraits<String> {
+ static EncodedValue encodeValue(const String& value)
+ {
+ return EncodedValue::createString(value);
+ }
+};
+
+// Base cases for loading and storing values.
+template<> JS_EXPORT_PRIVATE
+void EncodedValue::put<EncodedValue>(const String& key, const typename EncodingTraits<EncodedValue>::DecodedType&);
+
+template<> JS_EXPORT_PRIVATE
+void EncodedValue::append<EncodedValue>(const typename EncodingTraits<EncodedValue>::DecodedType&);
+
+template<> JS_EXPORT_PRIVATE
+bool EncodedValue::get<EncodedValue>(const String& key, typename EncodingTraits<EncodedValue>::DecodedType&);
+
+// Load and store types with an accompanying EncodingTraits implementation.
+template<typename T>
+void EncodedValue::put(const String& key, const typename EncodingTraits<T>::DecodedType& value)
+{
+ EncodedValue encodedValue = EncodingTraits<T>::encodeValue(value);
+ put<EncodedValue>(key, encodedValue);
+}
+
+template<typename T>
+void EncodedValue::append(const typename EncodingTraits<T>::DecodedType& value)
+{
+ EncodedValue encodedValue = EncodingTraits<T>::encodeValue(value);
+ append<EncodedValue>(encodedValue);
+}
+
+template<typename T>
+bool EncodedValue::get(const String& key, typename EncodingTraits<T>::DecodedType& decodedValue)
+{
+ EncodedValue encodedValue;
+ if (!get<EncodedValue>(key, encodedValue))
+ return false;
+
+ return EncodingTraits<T>::decodeValue(encodedValue, decodedValue);
+}
+
+template<typename T>
+bool EncodedValue::get(const String& key, std::unique_ptr<typename EncodingTraits<T>::DecodedType>& decodedValue)
+{
+ EncodedValue encodedValue;
+ if (!get<EncodedValue>(key, encodedValue))
+ return false;
+
+ return EncodingTraits<T>::decodeValue(encodedValue, decodedValue);
+}
+
+} // namespace JSC
+
+using JSC::EncodedValue;
+using JSC::EncodingTraits;
+
+#endif // ENABLE(WEB_REPLAY)
+
+#endif // EncodedValue_h
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCorereplayscriptsCodeGeneratorReplayInputspy"></a>
<div class="addfile"><h4>Added: trunk/Source/JavaScriptCore/replay/scripts/CodeGeneratorReplayInputs.py (0 => 163918)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/replay/scripts/CodeGeneratorReplayInputs.py         (rev 0)
+++ trunk/Source/JavaScriptCore/replay/scripts/CodeGeneratorReplayInputs.py        2014-02-12 00:22:01 UTC (rev 163918)
</span><span class="lines">@@ -0,0 +1,982 @@
</span><ins>+#!/usr/bin/env python
+# Copyright (c) 2014 Apple Inc. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above
+# copyright notice, this list of conditions and the following disclaimer
+# in the documentation and/or other materials provided with the
+# distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+import os.path
+import re
+import sys
+import string
+from string import Template
+import optparse
+import logging
+from CodeGeneratorReplayInputsTemplates import Templates
+
+try:
+ import json
+except ImportError:
+ import simplejson as json
+
+# Configuration values are first looked up in the framework configuration,
+# and then in the global configuration if there is no framework-specific value.
+GLOBAL_CONFIG = {
+ "baseFilename": "ReplayInputs",
+ "guardCondition": "ENABLE(WEB_REPLAY)",
+ "traitsFrameworkName": "JavaScriptCore",
+
+ # These are formatted as ([allowed_frameworks], (framework, header_path)).
+ # The generator can figure out how to format the includes.
+ "headerIncludes": [
+ (["WebCore"],
+ ("WebCore", "replay/EventLoopInput.h")
+ ),
+ (["JavaScriptCore", "WebCore"],
+ ("JavaScriptCore", "replay/EncodedValue.h")
+ ),
+ (["JavaScriptCore"],
+ ("JavaScriptCore", "replay/NondeterministicInput.h")
+ ),
+ (["WebCore"],
+ ("WTF", "wtf/text/WTFString.h")
+ ),
+
+ # Testing fixtures.
+ (["Test"],
+ ("WebCore", "platform/ExternalNamespaceHeaderIncludeDummy.h")
+ ),
+ (["Test"],
+ ("Test", "platform/InternalNamespaceHeaderIncludeDummy.h")
+ )
+ ],
+
+ "implIncludes": [
+ (["WebCore"],
+ ("WebCore", "replay/ReplayInputTypes.h")
+ ),
+ (["WebCore"],
+ ("WebCore", "replay/SerializationMethods.h")
+ ),
+ (["WebCore", "JavaScriptCore"],
+ ("JavaScriptCore", "inspector/InspectorValues.h")
+ ),
+ (["JavaScriptCore"],
+ ("WTF", "wtf/NeverDestroyed.h")
+ ),
+ (["JavaScriptCore"],
+ ("WTF", "wtf/text/AtomicString.h")
+ ),
+
+ # Testing fixtures.
+ (["Test"],
+ ("WebCore", "platform/ExternalNamespaceImplIncludeDummy.h")
+ ),
+ (["Test"],
+ ("Test", "platform/InternalNamespaceImplIncludeDummy.h")
+ )
+ ],
+}
+
+FRAMEWORK_CONFIG_MAP = {
+ "Global": {
+ "prefix": "",
+ "namespace": ""
+ },
+
+ "JavaScriptCore": {
+ "prefix": "JS",
+ "namespace": "JSC",
+ "exportMacro": "JS_EXPORT_PRIVATE",
+ "inputTypeTemplate": Templates.InputTypeFromStaticLocal,
+ },
+ "WebCore": {
+ "prefix": "Web",
+ "namespace": "WebCore",
+ "inputTypeTemplate": Templates.InputTypeFromThreadLocal,
+ },
+ # Used for bindings tests.
+ "Test": {
+ "prefix": "Test",
+ "namespace": "Test",
+ "inputTypeTemplate": Templates.InputTypeFromStaticLocal,
+ }
+}
+
+# These settings are specific to an input queue.
+QUEUE_CONFIG_MAP = {
+ "SCRIPT_MEMOIZED": {
+ "enumValue": "ScriptMemoizedData",
+ "baseClass": "NondeterministicInput<%s>",
+ },
+ "LOADER_MEMOIZED": {
+ "enumValue": "LoaderMemoizedData",
+ "baseClass": "NondeterministicInput<%s>",
+ },
+ "EVENT_LOOP": {
+ "enumValue": "EventLoopInput",
+ "baseClass": "EventLoopInput<%s>",
+ },
+}
+
+# Use a global logger, which normally only logs errors.
+# It can be configured to log debug messages from the CLI.
+logging.basicConfig(format='%(levelname)s: %(message)s', level=logging.ERROR)
+log = logging.getLogger('global')
+
+
+# Model classes, which transliterate JSON input.
+class ParseException(Exception):
+ pass
+
+
+class TypecheckException(Exception):
+ pass
+
+
+class Framework:
+ def __init__(self, name):
+ self._settings = FRAMEWORK_CONFIG_MAP[name]
+ self.name = name
+
+ def setting(self, key, default=''):
+ return self._settings.get(key, default)
+
+ @staticmethod
+ def fromString(frameworkString):
+ if frameworkString == "Global":
+ return Frameworks.Global
+
+ if frameworkString == "JavaScriptCore":
+ return Frameworks.JavaScriptCore
+
+ if frameworkString == "WebCore":
+ return Frameworks.WebCore
+
+ if frameworkString == "Test":
+ return Frameworks.Test
+
+ raise ParseException("Unknown framework: " + frameworkString)
+
+
+class Frameworks:
+ Global = Framework("Global")
+ JavaScriptCore = Framework("JavaScriptCore")
+ WebCore = Framework("WebCore")
+ Test = Framework("Test")
+
+
+class InputQueue:
+ def __init__(self, settings):
+ self._settings = settings
+
+ def setting(self, key, default=''):
+ return self._settings.get(key, default)
+
+ @staticmethod
+ def fromString(queueString):
+ if queueString == "SCRIPT_MEMOIZED":
+ return InputQueues.SCRIPT_MEMOIZED
+
+ if queueString == "LOADER_MEMOIZED":
+ return InputQueues.LOADER_MEMOIZED
+
+ if queueString == "EVENT_LOOP":
+ return InputQueues.EVENT_LOOP
+
+ raise ParseException("Unknown input queue: " + queueString)
+
+
+class InputQueues:
+ SCRIPT_MEMOIZED = InputQueue(QUEUE_CONFIG_MAP["SCRIPT_MEMOIZED"])
+ LOADER_MEMOIZED = InputQueue(QUEUE_CONFIG_MAP["LOADER_MEMOIZED"])
+ EVENT_LOOP = InputQueue(QUEUE_CONFIG_MAP["EVENT_LOOP"])
+
+
+class Input:
+ def __init__(self, name, description, queueString, flags, guard=None):
+ self.name = name
+ self.description = description
+ self.queue = InputQueue.fromString(queueString)
+ self._flags = flags
+ self.guard = guard
+ self.members = [] # names should be unique, but ordered.
+
+ def setting(self, key, default=''):
+ if key in self._flags:
+ return True
+
+ return self.queue.setting(key, default)
+
+
+class InputMember:
+ def __init__(self, memberName, typeName, flags=[]):
+ self.memberName = memberName
+ self.typeName = typeName
+ self._flags = flags
+
+ def has_flag(self, key, default=''):
+ return key in self._flags
+
+
+class TypeMode:
+ def __init__(self, name):
+ self._name = name
+
+ @staticmethod
+ def fromString(modeString):
+ modeString = modeString.upper()
+ if modeString == 'SCALAR':
+ return TypeModes.SCALAR
+ if modeString == 'HEAVY_SCALAR':
+ return TypeModes.HEAVY_SCALAR
+ if modeString == 'OWNED':
+ return TypeModes.OWNED
+ if modeString == 'SHARED':
+ return TypeModes.SHARED
+ if modeString == 'VECTOR':
+ return TypeModes.VECTOR
+
+ raise ParseException("Unknown type mode: " + modeString)
+
+
+class TypeModes:
+ # Copy for assignment and for getter
+ SCALAR = TypeMode("SCALAR")
+ # Copy for assignment, pass by reference for getter
+ HEAVY_SCALAR = TypeMode("HEAVY_SCALAR")
+ # Move for assignment, pass by reference for getter
+ OWNED = TypeMode("OWNED")
+ # Copy a RefPtr for assignment and getter
+ SHARED = TypeMode("SHARED")
+ # Move operator for assignment, pass by reference for getter
+ VECTOR = TypeMode("VECTOR")
+
+
+class Type:
+ def __init__(self, name, mode, framework, header, enclosing_class, values, guard_values_map, underlying_storage, flags):
+ self._name = name
+ self.mode = mode
+ self.framework = framework
+ self.header = header
+ self.enclosing_class = enclosing_class
+ self.values = values
+ self.guard_values_map = guard_values_map
+ self.underlying_storage = underlying_storage
+ self._flags = flags
+
+ def __eq__(self, other):
+ return self.type_name() == other.type_name() and self.mode == other.mode
+
+ def __hash__(self):
+ return self._name.__hash__()
+
+ def has_flag(self, flagString):
+ return flagString in self._flags
+
+ def is_struct(self):
+ return self.has_flag("STRUCT")
+
+ def is_enum(self):
+ return self.has_flag("ENUM")
+
+ def is_enum_class(self):
+ return self.has_flag("ENUM_CLASS")
+
+ def declaration_kind(self):
+ if self.is_enum():
+ return "enum"
+ elif self.is_enum_class():
+ return "enum class"
+ elif self.is_struct():
+ return "struct"
+ else:
+ return "class"
+
+ def qualified_prefix(self):
+ components = []
+ if self.framework != Frameworks.Global:
+ components.append(self.framework.setting('namespace'))
+ if self.enclosing_class is not None:
+ components.append(self.enclosing_class)
+ components.append("")
+ return "::".join(components)
+
+ def type_name(self, qualified=False):
+ return "%s%s" % (self.qualified_prefix(), self._name) if qualified else self._name
+
+ def storage_type(self, qualified=False):
+ if self.mode == TypeModes.OWNED:
+ return "std::unique_ptr<%s>" % self.type_name(qualified)
+ elif self.mode == TypeModes.SHARED:
+ return "RefPtr<%s>" % self.type_name(qualified)
+ else:
+ return self.type_name(qualified)
+
+ def borrow_type(self, qualified=False):
+ if self.mode == TypeModes.SCALAR:
+ return self.type_name(qualified)
+ elif self.mode == TypeModes.SHARED:
+ return "PassRefPtr<%s>" % self.type_name(qualified)
+ else:
+ return "const %s&" % self.type_name(qualified)
+
+ def argument_type(self, qualified=False):
+ if self.mode == TypeModes.SHARED:
+ return "PassRefPtr<%s>" % self.type_name(qualified)
+ else:
+ return self.storage_type()
+
+
+def check_for_required_properties(props, obj, what):
+ for prop in props:
+ if prop not in obj:
+ raise ParseException("When parsing %s, required property missing: %s" % (what, prop))
+
+
+class VectorType(Type):
+ def __init__(self, element_type):
+ self._element_type = element_type
+ self.mode = TypeModes.VECTOR
+ self.framework = element_type.framework
+ self.enclosing_class = None
+
+ def has_flag(self):
+ return False
+
+ def is_struct(self):
+ return False
+
+ def is_enum(self):
+ return False
+
+ def is_enum_class(self):
+ return False
+
+ def qualified_prefix(self):
+ return ""
+
+ def type_name(self, qualified=False):
+ return "Vector<%s>" % self._element_type.type_name(qualified=qualified)
+
+ def argument_type(self, qualified=False):
+ return self.type_name(qualified=qualified) + "&"
+
+
+class InputsModel:
+ def __init__(self, parsed_json):
+ self.inputs = []
+ self.types = []
+
+ # Types have associated frameworks and are in their namespace, but within the specification
+ # file types are in a flat namespace. Types with the same name are not allowed.
+ self.types_by_name = {}
+ self.inputs_by_name = {}
+
+ self.parse_toplevel(parsed_json)
+
+ def enum_types(self):
+ _enums = filter(lambda x: x.is_enum() or x.is_enum_class(), self.types)
+ return sorted(_enums, key=lambda _enum: _enum.type_name())
+
+ def get_type_for_member(self, member):
+ if member.has_flag("VECTOR"):
+ return VectorType(self.types_by_name.get(member.typeName))
+ else:
+ return self.types_by_name.get(member.typeName)
+
+ def parse_toplevel(self, json):
+ check_for_required_properties(['types', 'inputs'], json, 'toplevel')
+ if not isinstance(json['types'], dict):
+ raise ParseException("Malformed specification: types is not a dict of framework->type list")
+
+ if not isinstance(json['inputs'], list):
+ raise ParseException("Malformed specification: inputs is not an array")
+
+ for type_framework_name, type_list in json['types'].iteritems():
+ if not isinstance(type_list, list):
+ raise ParseException("Malformed specification: type list for framework %s is not a list" % type_framework_name)
+
+ for _type in type_list:
+ self.parse_type_with_framework_name(_type, type_framework_name)
+
+ for val in json['inputs']:
+ self.parse_input(val)
+
+ def parse_type_with_framework_name(self, json, framework_name):
+ check_for_required_properties(['name', 'mode'], json, 'type')
+ framework = Framework.fromString(framework_name)
+ if framework is not Frameworks.Global:
+ check_for_required_properties(['header'], json, 'non-global type')
+
+ type_name = json['name']
+ type_mode = TypeMode.fromString(json['mode'])
+ header = json.get('header')
+ enclosing_class = json.get('enclosing_class')
+ enum_values = json.get('values')
+ guarded_enum_values = json.get('guarded_values', {})
+ type_storage = json.get('storage')
+ type_flags = json.get('flags', [])
+ _type = Type(type_name, type_mode, framework, header, enclosing_class, enum_values, guarded_enum_values, type_storage, type_flags)
+ if _type.is_enum() or _type.is_enum_class():
+ check_for_required_properties(['values'], json, 'enum')
+ if not isinstance(json['values'], list) or len(_type.values) == 0:
+ raise ParseException("Malformed specification: enum %s does not supply a list of values" % type_name)
+
+ if _type.is_enum() and "storage" not in json:
+ raise ParseException("Could not parse enum %s: C-style enums must also specify their storage type so they can be forward declared." % type_name)
+
+ self.types.append(_type)
+
+ def parse_input(self, json):
+ check_for_required_properties(['name', 'description', 'queue', 'members'], json, 'input')
+ _input = Input(json['name'], json['description'], json['queue'], json.get('flags', []), json.get('guard'))
+ if isinstance(json['members'], list):
+ for member in json['members']:
+ check_for_required_properties(['name', 'type'], member, 'member')
+ _input.members.append(InputMember(member['name'], member['type'], member.get('flags', [])))
+
+ self.inputs.append(_input)
+
+ # Types cannot (yet) reference other types, so we can check references in one pass.
+ def resolve_types(self):
+ for _type in self.types:
+ self.typecheck_type(_type)
+
+ for _input in self.inputs:
+ self.typecheck_input(_input)
+
+ def typecheck_type(self, _type):
+ log.debug("typecheck type " + _type.type_name())
+
+ if _type.type_name() in self.types_by_name:
+ raise TypecheckException("Duplicate type with name: " + _type.type_name())
+
+ self.types_by_name[_type.type_name()] = _type
+
+ def typecheck_input(self, _input):
+ log.debug("typecheck input " + _input.name)
+
+ if _input.name in self.inputs_by_name:
+ raise TypecheckException("Duplicate input with name: " + _input.name)
+
+ seen_members = {}
+
+ for member in _input.members:
+ if member.memberName in seen_members:
+ raise TypecheckException("Duplicate input member with name: " + member.memberName)
+
+ self.typecheck_input_member(member, _input)
+ seen_members[member.memberName] = member
+
+ self.inputs_by_name[_input.name] = _input
+
+ def typecheck_input_member(self, input_member, _input):
+ log.debug("typecheck member '%s' of '%s'" % (input_member.memberName, _input.name))
+
+ if not input_member.typeName in self.types_by_name:
+ raise TypecheckException("Unknown type '%s' referenced by member '%s' of input '%s'" % (input_member.typeName, input_member.memberName, _input.name))
+
+
+# A writer that only updates file if it actually changed.
+class IncrementalFileWriter:
+ def __init__(self, filepath, force_output):
+ self._filepath = filepath
+ self._output = ""
+ self.force_output = force_output
+
+ def write(self, text):
+ self._output += text
+
+ def close(self):
+ text_changed = True
+ self._output = self._output.rstrip() + "\n"
+
+ try:
+ read_file = open(self._filepath, "r")
+ old_text = read_file.read()
+ read_file.close()
+ text_changed = old_text != self._output
+ except:
+ # Ignore, just overwrite by default
+ pass
+
+ if text_changed or self.force_output:
+ out_file = open(self._filepath, "w")
+ out_file.write(self._output)
+ out_file.close()
+
+
+def wrap_with_guard(contents, condition=None):
+ if condition is None:
+ return contents
+
+ return "\n".join([
+ "#if %s" % condition,
+ contents,
+ "#endif // %s" % condition
+ ])
+
+
+class Generator:
+ def __init__(self, model, target_framework_name, input_filepath, output_prefix):
+ self._model = model
+ self.target_framework = Framework.fromString(target_framework_name)
+ self.traits_framework = Framework.fromString(self.setting('traitsFrameworkName'))
+ self._input_filepath = input_filepath
+ self._output_prefix = output_prefix
+
+ def setting(self, key, default=''):
+ return self.target_framework.setting(key, GLOBAL_CONFIG.get(key, default))
+
+ # This does not account for any filename mangling performed on behalf of the test harness.
+ def output_filename(self, extension=None):
+ components = []
+ if len(self._output_prefix) > 0:
+ components.extend([self._output_prefix, '-'])
+
+ components.extend([self.setting('prefix'), self.setting('baseFilename')])
+
+ if extension is not None:
+ components.extend(['.', extension])
+
+ return "".join(components)
+
+ def write_output_files(self, _dir, force=False):
+ header_file = IncrementalFileWriter(os.path.join(_dir, self.output_filename('h')), force)
+ implementation_file = IncrementalFileWriter(os.path.join(_dir, self.output_filename('cpp')), force)
+
+ header_file.write(self.generate_header())
+ implementation_file.write(self.generate_implementation())
+
+ header_file.close()
+ implementation_file.close()
+
+ def generate_header(self):
+ template_arguments = {
+ 'licenseBlock': self.generate_license(),
+ 'headerGuard': re.sub('[-./]', '_', self.output_filename() + ".h"),
+ 'filename': self.output_filename(),
+ 'guardCondition': self.setting('guardCondition'),
+ 'traitsNamespace': self.traits_framework.setting('namespace'),
+ 'inputsNamespace': self.target_framework.setting('namespace'),
+ 'includes': self.generate_includes(defaults=self.setting('headerIncludes')),
+ 'typeForwardDeclarations': self.generate_type_forward_declarations(),
+ 'inputForwardDeclarations': "\n".join([wrap_with_guard("class %s;", _input.guard) % _input.name for _input in self._model.inputs]),
+ 'inputClassDeclarations': "\n\n".join([self.generate_class_declaration(_input) for _input in self._model.inputs]),
+ 'inputTraitDeclarations': "\n\n".join([self.generate_input_trait_declaration(_input) for _input in self._model.inputs]),
+ 'enumTraitDeclarations': "\n\n".join([self.generate_enum_trait_declaration(_type) for _type in self._model.enum_types()]),
+ 'forEachMacro': self.generate_for_each_macro(),
+ }
+
+ return Template(Templates.HeaderSkeleton).substitute(template_arguments)
+
+ def generate_implementation(self):
+ template_arguments = {
+ 'licenseBlock': self.generate_license(),
+ 'filename': self.output_filename(),
+ 'guardCondition': self.setting('guardCondition'),
+ 'traitsNamespace': self.traits_framework.setting('namespace'),
+ 'inputsNamespace': self.target_framework.setting('namespace'),
+ 'includes': self.generate_includes(defaults=self.setting('implIncludes'), includes_for_types=True),
+ 'inputClassImplementations': "\n\n".join([self.generate_class_implementation(_input) for _input in self._model.inputs]),
+ 'inputTraitImplementations': "\n\n".join([self.generate_input_trait_implementation(_input) for _input in self._model.inputs]),
+ 'enumTraitImplementations': "\n\n".join([self.generate_enum_trait_implementation(_type) for _type in self._model.enum_types()]),
+ }
+
+ return Template(Templates.ImplementationSkeleton).substitute(template_arguments)
+
+ def generate_license(self):
+ return Template(Templates.CopyrightBlock).substitute(None, inputFilename=os.path.basename(self._input_filepath))
+
+ def generate_includes(self, defaults=[], includes_for_types=False):
+ lines = set()
+
+ for _type in self._model.types:
+ # Types in the "global" framework are implicitly declared and available in all namespaces.
+ if _type.framework is Frameworks.Global:
+ continue
+ # For RefCounted types, we reverse when to include the header so that the destructor can be
+ # used in the header file. Enums within classes cannot be forward declared, so we include
+ # headers with the relevant class declaration.
+ include_for_destructor = _type.mode is TypeModes.SHARED
+ include_for_enclosing_class = _type.is_enum() and _type.enclosing_class is not None
+ if (not includes_for_types) ^ (include_for_destructor or include_for_enclosing_class):
+ continue
+
+ if self.target_framework != _type.framework:
+ lines.add("#include <%s>" % _type.header)
+ else:
+ lines.add("#include \"%s\"" % os.path.basename(_type.header))
+
+ for entry in defaults:
+ (allowed_framework_names, data) = entry
+ (framework_name, header_path) = data
+
+ if self.target_framework.name not in allowed_framework_names:
+ continue
+ if self.target_framework.name != framework_name:
+ lines.add("#include <%s>" % header_path)
+ else:
+ lines.add("#include \"%s\"" % os.path.basename(header_path))
+
+ return "\n".join(sorted(list(lines)))
+
+ def generate_type_forward_declarations(self):
+ lines = []
+
+ decls_by_framework = {}
+ frameworks = [Framework.fromString(s) for s in FRAMEWORK_CONFIG_MAP.keys() if s != Frameworks.Global.name]
+ for framework in frameworks:
+ decls_by_framework[framework] = []
+
+ for _type in self._model.types:
+ if _type.framework not in frameworks:
+ continue
+ if _type.enclosing_class is not None:
+ continue
+ if _type.is_enum():
+ declaration = "enum %s : %s;" % (_type.type_name(), _type.underlying_storage)
+ else:
+ declaration = "%s %s;" % (_type.declaration_kind(), _type.type_name())
+ decls_by_framework[_type.framework].append(declaration)
+
+ # Declare all namespaces explicitly, even if it's the main namespace.
+ for framework in frameworks:
+ if len(decls_by_framework[framework]) == 0:
+ continue
+
+ decls_by_framework[framework].sort()
+ lines.append("namespace %s {" % framework.setting('namespace'))
+ lines.extend(decls_by_framework[framework])
+ lines.append("}")
+ lines.append("")
+
+ return "\n".join(lines)
+
+ def generate_class_declaration(self, _input):
+ extra_declarations = []
+ if _input.queue == InputQueues.EVENT_LOOP:
+ extra_declarations.extend([
+ "",
+ " // EventLoopInput API",
+ " virtual void dispatch(ReplayController&) override final;",
+ ])
+
+ if _input.setting('CREATE_FROM_PAGE'):
+ extra_declarations.extend([
+ " static std::unique_ptr<%s> createFromPage(const Page&);" % _input.name
+ ])
+
+ member_getters = [self.generate_input_member_getter(_member) for _member in _input.members]
+
+ member_declarations = [self.generate_input_member_declaration(_member) for _member in _input.members]
+ if len(member_declarations) > 0:
+ member_declarations.insert(0, "private:")
+
+ template_arguments = {
+ 'inputConstructor': self.generate_input_constructor_declaration(_input),
+ 'inputDestructor': self.generate_input_destructor_declaration(_input),
+ 'inputName': _input.name,
+ 'inputQueue': _input.setting('enumValue'),
+ 'baseClass': _input.setting('baseClass') % _input.name,
+ 'extraDeclarations': "\n".join(extra_declarations),
+ 'memberGetters': "\n".join(member_getters),
+ 'memberDeclarations': "\n".join(member_declarations),
+ }
+
+ return wrap_with_guard(Template(Templates.InputClassDeclaration).substitute(template_arguments), _input.guard)
+
+ def generate_input_constructor_declaration(self, _input):
+ formals_list = self.generate_constructor_formals_list(_input)
+ terms = []
+ if self.setting('exportMacro'):
+ terms.append(self.setting('exportMacro'))
+ terms.append("%s(%s)" % (_input.name, formals_list))
+ return " %s;" % " ".join(terms)
+
+ def generate_input_destructor_declaration(self, _input):
+ return " virtual ~%s();" % _input.name
+
+ def generate_input_member_getter(self, _member):
+ member_type = self._model.get_type_for_member(_member)
+ return " %s %s() const { return %s; }" % (member_type.borrow_type(), _member.memberName, self.generate_member_borrow_expression(_member))
+
+ def generate_input_member_declaration(self, _member):
+ member_type = self._model.get_type_for_member(_member)
+ return " %s m_%s;" % (member_type.storage_type(), _member.memberName)
+
+ def generate_input_member_tuples(self, _input):
+ return [(_member, self._model.get_type_for_member(_member)) for _member in _input.members]
+
+ def qualified_input_name(self, _input):
+ if self.target_framework == self.traits_framework:
+ return _input.name
+ else:
+ return "%s::%s" % (self.target_framework.setting('namespace'), _input.name)
+
+ def generate_input_trait_declaration(self, _input):
+ decl_type = ['struct']
+ if len(self.setting('exportMacro')) > 0:
+ decl_type.append(self.setting('exportMacro'))
+
+ template_arguments = {
+ 'structOrClass': " ".join(decl_type),
+ 'queueType': _input.queue.setting('enumValue'),
+ 'qualifiedInputName': self.qualified_input_name(_input),
+ }
+
+ return wrap_with_guard(Template(Templates.InputTraitsDeclaration).substitute(template_arguments), _input.guard)
+
+ def generate_enum_trait_declaration(self, _type):
+ should_qualify_type = _type.framework != self.traits_framework
+ template = Templates.EnumTraitDeclaration if _type.is_enum() else Templates.EnumClassTraitDeclaration
+ template_arguments = {
+ 'enumName': _type.type_name(qualified=should_qualify_type),
+ }
+ return Template(template).substitute(template_arguments)
+
+ def generate_for_each_macro(self):
+ macro_name = "%s_REPLAY_INPUT_NAMES_FOR_EACH" % self.setting('prefix').upper()
+ lines = []
+ lines.append("#define %s(macro) \\" % macro_name)
+ lines.extend([" macro(%s) \\" % _input.name for _input in self._model.inputs])
+ lines.append(" \\")
+ lines.append("// end of %s" % macro_name)
+ return "\n".join(lines)
+
+ def generate_class_implementation(self, _input):
+ template_arguments = {
+ 'inputName': _input.name,
+ 'inputsNamespace': self.target_framework.setting('namespace'),
+ 'initializerList': self.generate_constructor_initializer_list(_input),
+ 'constructorFormalsList': self.generate_constructor_formals_list(_input),
+ }
+
+ return wrap_with_guard(Template(Templates.InputClassImplementation).substitute(template_arguments), _input.guard)
+
+ def generate_enum_trait_implementation(self, _type):
+ should_qualify_type = _type.framework != self.traits_framework
+ prefix_components = []
+ if should_qualify_type:
+ prefix_components.append(_type.framework.setting('namespace'))
+ if _type.is_enum_class():
+ prefix_components.append(_type.type_name())
+ if _type.enclosing_class is not None:
+ prefix_components.append(_type.enclosing_class)
+ prefix_components.append("")
+ enum_prefix = "::".join(prefix_components)
+ encodeLines = []
+
+ if _type.is_enum():
+ encode_template = Templates.EnumEncodeCase
+ decode_template = Templates.EnumDecodeCase
+ enum_trait_template = Templates.EnumTraitImplementation
+ else:
+ encode_template = Templates.EnumClassEncodeCase
+ decode_template = Templates.EnumClassDecodeCase
+ enum_trait_template = Templates.EnumClassTraitImplementation
+
+ # Generate body for encode.
+ for _value in _type.values:
+ template_arguments = {
+ 'enumStringValue': _value,
+ 'qualifiedEnumValue': "%s%s" % (enum_prefix, _value),
+ }
+ encodeLines.append(Template(encode_template).substitute(template_arguments))
+
+ for guard, guard_values in _type.guard_values_map.iteritems():
+ guardedLines = []
+ for guard_value in guard_values:
+ template_arguments = {
+ 'enumStringValue': guard_value,
+ 'qualifiedEnumValue': "%s%s" % (enum_prefix, guard_value),
+ }
+ guardedLines.append(Template(encode_template).substitute(template_arguments))
+ encodeLines.append(wrap_with_guard("\n".join(guardedLines), guard))
+
+ # Generate body for decode.
+ decodeLines = []
+ for _value in _type.values:
+ template_arguments = {
+ 'enumStringValue': _value,
+ 'qualifiedEnumValue': "%s%s" % (enum_prefix, _value),
+ 'qualifiedEnumName': _type.type_name(qualified=should_qualify_type)
+ }
+ decodeLines.append(Template(decode_template).substitute(template_arguments))
+
+ for guard, guard_values in _type.guard_values_map.iteritems():
+ guardedLines = []
+ for guard_value in guard_values:
+ template_arguments = {
+ 'enumStringValue': guard_value,
+ 'qualifiedEnumValue': "%s%s" % (enum_prefix, guard_value),
+ 'qualifiedEnumName': _type.type_name(qualified=should_qualify_type)
+ }
+ guardedLines.append(Template(decode_template).substitute(template_arguments))
+ decodeLines.append(wrap_with_guard("\n".join(guardedLines), guard))
+
+ template_arguments = {
+ 'enumName': _type.type_name(qualified=should_qualify_type),
+ 'encodeCases': "\n".join(encodeLines),
+ 'decodeCases': "\n".join(decodeLines)
+ }
+
+ return Template(enum_trait_template).substitute(template_arguments)
+
+ def generate_input_trait_implementation(self, _input):
+ template_arguments = {
+ 'inputsNamespace': self.target_framework.setting('namespace'),
+ 'inputTypeImplementation': Template(self.setting('inputTypeTemplate')).substitute(None, inputName=_input.name),
+ 'qualifiedInputName': self.qualified_input_name(_input),
+ 'constructorArguments': self.generate_constructor_arguments_list(_input),
+ 'constructorFormalsList': self.generate_constructor_formals_list(_input),
+ 'encodeSteps': self.generate_input_encode_implementation(_input),
+ 'decodeSteps': self.generate_input_decode_implementation(_input),
+ }
+ return wrap_with_guard(Template(Templates.InputTraitsImplementation).substitute(template_arguments), _input.guard)
+
+ def generate_input_encode_implementation(self, _input):
+ steps = []
+ for (_member, _type) in self.generate_input_member_tuples(_input):
+ should_qualify_type = _type.framework != self.traits_framework
+ put_method = "put<%s>" % _type.type_name(qualified=should_qualify_type)
+
+ steps.extend([
+ " encodedValue.%s(ASCIILiteral(\"%s\"), input.%s());" % (put_method, _member.memberName, _member.memberName)
+ ])
+
+ if len(steps) == 0:
+ steps.extend([
+ " UNUSED_PARAM(encodedValue);",
+ " UNUSED_PARAM(input);",
+ ])
+
+ return "\n".join(steps)
+
+ def generate_input_decode_implementation(self, _input):
+ steps = []
+ for (_member, _type) in self.generate_input_member_tuples(_input):
+ should_qualify_type = _type.framework != self.traits_framework
+ get_method = "get<%s>" % _type.type_name(qualified=should_qualify_type)
+
+ lines = [
+ " %s %s;" % (_type.storage_type(qualified=should_qualify_type), _member.memberName),
+ " if (!encodedValue.%s(ASCIILiteral(\"%s\"), %s))" % (get_method, _member.memberName, _member.memberName),
+ " return false;",
+ ""
+ ]
+
+ steps.append("\n".join(lines))
+
+ if len(steps) == 0:
+ steps.extend([
+ " UNUSED_PARAM(encodedValue);",
+ ])
+
+ return "\n".join(steps)
+
+ def generate_constructor_initializer_list(self, _input):
+ initializers = []
+ initializers.append(" : %s()" % (_input.setting('baseClass') % _input.name))
+ for _member in _input.members:
+ initializers.append(" , m_%s(%s)" % (_member.memberName, self.generate_member_move_expression(_member)))
+
+ return "\n".join(initializers)
+
+ def generate_constructor_formals_list(self, _input):
+ member_tuples = self.generate_input_member_tuples(_input)
+ return ", ".join(["%s %s" % (_type.argument_type(), _member.memberName) for (_member, _type) in member_tuples])
+
+ def generate_member_borrow_expression(self, _member):
+ _type = self._model.get_type_for_member(_member)
+ expression = "m_%s" % _member.memberName
+ if _type.mode == TypeModes.OWNED:
+ expression = "*" + expression
+
+ return expression
+
+ def generate_member_move_expression(self, _member):
+ _type = self._model.get_type_for_member(_member)
+ if _type.mode == TypeModes.OWNED:
+ return "std::move(%s)" % _member.memberName
+ else:
+ return _member.memberName
+
+ def generate_constructor_arguments_list(self, _input):
+ return ", ".join([self.generate_member_move_expression(_member) for _member in _input.members])
+
+
+def generate_from_specification(input_filepath=None, output_prefix="", output_dirpath=None, framework_name=None, force_output=False):
+ try:
+ with open(input_filepath, "r") as input_file:
+ parsed_json = json.load(input_file)
+ except ValueError as e:
+ raise Exception("Error parsing valid JSON in file: " + input_filepath)
+
+ if not framework_name in FRAMEWORK_CONFIG_MAP:
+ raise ParseException("Unknown or unsupported framework name supplied: " + framework_name)
+
+ model = InputsModel(parsed_json)
+ model.resolve_types()
+ generator = Generator(model, framework_name, input_filepath, output_prefix)
+
+ generator.write_output_files(output_dirpath, force_output)
+
+
+if __name__ == '__main__':
+ allowed_framework_names = FRAMEWORK_CONFIG_MAP.keys()
+
+ cli_parser = optparse.OptionParser(usage="usage: %prog [options] <Inputs.json>")
+ cli_parser.add_option("-o", "--outputDir", help="Directory where generated files should be written.")
+ cli_parser.add_option("--framework", type="choice", choices=allowed_framework_names, help="The framework these inputs belong to.") # JavaScriptCore, WebCore
+ cli_parser.add_option("--force", action="store_true", help="Force output of generated scripts, even if nothing changed.")
+ cli_parser.add_option("-v", "--debug", action="store_true", help="Log extra output for debugging the generator itself.")
+ cli_parser.add_option("-t", "--test", action="store_true", help="Enable test mode. Use unique output filenames created by prepending the input filename.")
+
+ options = None
+
+ arg_options, arg_values = cli_parser.parse_args()
+ if (len(arg_values) < 1):
+ raise ParseException("At least one plain argument expected")
+
+ if not arg_options.outputDir:
+ raise ParseException("Missing output directory")
+
+ if arg_options.debug:
+ log.setLevel(logging.DEBUG)
+
+ options = {
+ 'input_filepath': arg_values[0],
+ 'output_dirpath': arg_options.outputDir,
+ 'output_prefix': os.path.basename(arg_values[0]) if arg_options.test else "",
+ 'framework_name': arg_options.framework,
+ 'force_output': arg_options.force
+ }
+
+ try:
+ generate_from_specification(**options)
+ except (ParseException, TypecheckException) as e:
+ if arg_options.test:
+ log.error(e.message)
+ else:
+ raise e # Force the build to fail.
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCorereplayscriptsCodeGeneratorReplayInputsTemplatespy"></a>
<div class="addfile"><h4>Added: trunk/Source/JavaScriptCore/replay/scripts/CodeGeneratorReplayInputsTemplates.py (0 => 163918)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/replay/scripts/CodeGeneratorReplayInputsTemplates.py         (rev 0)
+++ trunk/Source/JavaScriptCore/replay/scripts/CodeGeneratorReplayInputsTemplates.py        2014-02-12 00:22:01 UTC (rev 163918)
</span><span class="lines">@@ -0,0 +1,243 @@
</span><ins>+#!/usr/bin/env python
+# Copyright (c) 2011 Google Inc. All rights reserved.
+# Copyright (c) 2012 Intel Corporation. All rights reserved.
+# Copyright (c) 2013, 2014 Apple Inc. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above
+# copyright notice, this list of conditions and the following disclaimer
+# in the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of Google Inc. nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+# Generator templates, which can be filled with string.Template.
+# Following are classes that fill the templates from the typechecked model.
+
+class Templates:
+ CopyrightBlock = (
+ """/*
+ * Copyright (C) 2014 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from ${inputFilename}
+// by the script: JavaScriptCore/replay/scripts/CodeGeneratorReplayInputs.py""")
+
+ HeaderSkeleton = (
+ """${licenseBlock}
+
+#ifndef ${headerGuard}
+#define ${headerGuard}
+
+#if ${guardCondition}
+${includes}
+
+${typeForwardDeclarations}
+
+namespace ${inputsNamespace} {
+${inputForwardDeclarations}
+} // namespace ${inputsNamespace}
+
+namespace ${traitsNamespace} {
+${inputTraitDeclarations}
+${enumTraitDeclarations}
+} // namespace ${traitsNamespace}
+
+namespace ${inputsNamespace} {
+${inputClassDeclarations}
+} // namespace ${inputsNamespace}
+
+${forEachMacro}
+
+#endif // ${guardCondition}
+
+#endif // ${filename}_h
+""")
+
+ InputTraitsDeclaration = (
+ """template<> ${structOrClass} InputTraits<${qualifiedInputName}> {
+ static InputQueue queue() { return InputQueue::${queueType}; }
+ static const AtomicString& type();
+
+ static void encode(JSC::EncodedValue&, const ${qualifiedInputName}&);
+ static bool decode(JSC::EncodedValue&, std::unique_ptr<${qualifiedInputName}>&);
+};""")
+
+ EnumTraitDeclaration = (
+ """template<> struct EncodingTraits<${enumName}> {
+ typedef ${enumName} DecodedType;
+
+ static EncodedValue encodeValue(const ${enumName}& value);
+ static bool decodeValue(EncodedValue&, ${enumName}& value);
+};""")
+
+ EnumClassTraitDeclaration = (
+ """template<> struct EncodingTraits<${enumName}> {
+ typedef ${enumName} DecodedType;
+
+ static EncodedValue encodeValue(const ${enumName}& value);
+ static bool decodeValue(EncodedValue&, ${enumName}& value);
+};""")
+
+ InputClassDeclaration = (
+ """class ${inputName} : public ${baseClass} {
+public:
+${inputConstructor}
+${inputDestructor}
+${extraDeclarations}
+${memberGetters}
+${memberDeclarations}
+};""")
+
+ ImplementationSkeleton = (
+ """${licenseBlock}
+
+#include "config.h"
+#include "${filename}.h"
+
+#if ${guardCondition}
+${includes}
+
+namespace ${inputsNamespace} {
+${inputClassImplementations}
+} // namespace ${inputsNamespace}
+
+namespace ${traitsNamespace} {
+${inputTraitImplementations}
+${enumTraitImplementations}
+} // namespace ${traitsNamespace}
+
+#endif // ${guardCondition}
+""")
+
+ InputTraitsImplementation = (
+ """const AtomicString& InputTraits<${qualifiedInputName}>::type()
+{
+$inputTypeImplementation
+}
+
+void InputTraits<${qualifiedInputName}>::encode(EncodedValue& encodedValue, const ${qualifiedInputName}& input)
+{
+${encodeSteps}
+}
+
+bool InputTraits<${qualifiedInputName}>::decode(EncodedValue& encodedValue, std::unique_ptr<${qualifiedInputName}>& input)
+{
+${decodeSteps}
+ input = std::make_unique<${qualifiedInputName}>(${constructorArguments});
+ return true;
+}""")
+
+ EnumClassTraitImplementation = (
+ """EncodedValue EncodingTraits<${enumName}>::encodeValue(const ${enumName}& enumValue)
+{
+ switch (enumValue) {
+${encodeCases}
+ default: ASSERT_NOT_REACHED(); return EncodedValue::createString("Error!");
+ }
+}
+
+bool EncodingTraits<${enumName}>::decodeValue(EncodedValue& encodedValue, ${enumName}& enumValue)
+{
+ String enumString = encodedValue.convertTo<String>();
+${decodeCases}
+ return false;
+}""")
+
+ EnumClassEncodeCase = (
+ """ case ${qualifiedEnumValue}: return EncodedValue::createString("${enumStringValue}");""")
+
+ EnumClassDecodeCase = (
+ """ if (enumString == "${enumStringValue}") {
+ enumValue = ${qualifiedEnumValue};
+ return true;
+ }""")
+
+ EnumTraitImplementation = (
+ """EncodedValue EncodingTraits<${enumName}>::encodeValue(const ${enumName}& enumValue)
+{
+ EncodedValue encodedValue = EncodedValue::createArray();
+${encodeCases}
+ return encodedValue;
+}
+
+bool EncodingTraits<${enumName}>::decodeValue(EncodedValue& encodedValue, ${enumName}& enumValue)
+{
+ Vector<String> enumStrings;
+ if (!EncodingTraits<Vector<String>>::decodeValue(encodedValue, enumStrings))
+ return false;
+
+ for (String enumString : enumStrings) {
+${decodeCases}
+ }
+
+ return true;
+}""")
+
+ EnumEncodeCase = (
+ """ if (enumValue & ${qualifiedEnumValue}) {
+ encodedValue.append<String>(ASCIILiteral("${enumStringValue}"));
+ if (enumValue == ${qualifiedEnumValue})
+ return encodedValue;
+ }""")
+
+ EnumDecodeCase = (
+ """ if (enumString == "${enumStringValue}")
+ enumValue = static_cast<${qualifiedEnumName}>(enumValue | ${qualifiedEnumValue});""")
+
+ InputTypeFromStaticLocal = (
+ """ static NeverDestroyed<const AtomicString> type("${inputName}", AtomicString::ConstructFromLiteral);
+ return type;""")
+
+ InputTypeFromThreadLocal = " return WebCore::inputTypes().${inputName};"
+
+ InputClassImplementation = (
+ """${inputName}::${inputName}(${constructorFormalsList})
+${initializerList}
+{
+}
+
+${inputName}::~${inputName}()
+{
+}""")
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCorereplayscriptstestsexpectedfailoncstyleenumnostoragejsonerror"></a>
<div class="addfile"><h4>Added: trunk/Source/JavaScriptCore/replay/scripts/tests/expected/fail-on-c-style-enum-no-storage.json-error (0 => 163918)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/replay/scripts/tests/expected/fail-on-c-style-enum-no-storage.json-error         (rev 0)
+++ trunk/Source/JavaScriptCore/replay/scripts/tests/expected/fail-on-c-style-enum-no-storage.json-error        2014-02-12 00:22:01 UTC (rev 163918)
</span><span class="lines">@@ -0,0 +1 @@
</span><ins>+ERROR: Could not parse enum MouseButton: C-style enums must also specify their storage type so they can be forward declared.
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCorereplayscriptstestsexpectedfailonduplicateinputnamesjsonerror"></a>
<div class="addfile"><h4>Added: trunk/Source/JavaScriptCore/replay/scripts/tests/expected/fail-on-duplicate-input-names.json-error (0 => 163918)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/replay/scripts/tests/expected/fail-on-duplicate-input-names.json-error         (rev 0)
+++ trunk/Source/JavaScriptCore/replay/scripts/tests/expected/fail-on-duplicate-input-names.json-error        2014-02-12 00:22:01 UTC (rev 163918)
</span><span class="lines">@@ -0,0 +1 @@
</span><ins>+ERROR: Duplicate input with name: GetCurrentTime
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCorereplayscriptstestsexpectedfailonduplicatetypenamesjsonerror"></a>
<div class="addfile"><h4>Added: trunk/Source/JavaScriptCore/replay/scripts/tests/expected/fail-on-duplicate-type-names.json-error (0 => 163918)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/replay/scripts/tests/expected/fail-on-duplicate-type-names.json-error         (rev 0)
+++ trunk/Source/JavaScriptCore/replay/scripts/tests/expected/fail-on-duplicate-type-names.json-error        2014-02-12 00:22:01 UTC (rev 163918)
</span><span class="lines">@@ -0,0 +1 @@
</span><ins>+ERROR: Duplicate type with name: uint64_t
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCorereplayscriptstestsexpectedfailonenumtypemissingvaluesjsonerror"></a>
<div class="addfile"><h4>Added: trunk/Source/JavaScriptCore/replay/scripts/tests/expected/fail-on-enum-type-missing-values.json-error (0 => 163918)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/replay/scripts/tests/expected/fail-on-enum-type-missing-values.json-error         (rev 0)
+++ trunk/Source/JavaScriptCore/replay/scripts/tests/expected/fail-on-enum-type-missing-values.json-error        2014-02-12 00:22:01 UTC (rev 163918)
</span><span class="lines">@@ -0,0 +1 @@
</span><ins>+ERROR: When parsing enum, required property missing: values
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCorereplayscriptstestsexpectedfailonmissinginputmembernamejsonerror"></a>
<div class="addfile"><h4>Added: trunk/Source/JavaScriptCore/replay/scripts/tests/expected/fail-on-missing-input-member-name.json-error (0 => 163918)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/replay/scripts/tests/expected/fail-on-missing-input-member-name.json-error         (rev 0)
+++ trunk/Source/JavaScriptCore/replay/scripts/tests/expected/fail-on-missing-input-member-name.json-error        2014-02-12 00:22:01 UTC (rev 163918)
</span><span class="lines">@@ -0,0 +1 @@
</span><ins>+ERROR: When parsing member, required property missing: name
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCorereplayscriptstestsexpectedfailonmissinginputnamejsonerror"></a>
<div class="addfile"><h4>Added: trunk/Source/JavaScriptCore/replay/scripts/tests/expected/fail-on-missing-input-name.json-error (0 => 163918)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/replay/scripts/tests/expected/fail-on-missing-input-name.json-error         (rev 0)
+++ trunk/Source/JavaScriptCore/replay/scripts/tests/expected/fail-on-missing-input-name.json-error        2014-02-12 00:22:01 UTC (rev 163918)
</span><span class="lines">@@ -0,0 +1 @@
</span><ins>+ERROR: When parsing input, required property missing: name
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCorereplayscriptstestsexpectedfailonmissinginputqueuejsonerror"></a>
<div class="addfile"><h4>Added: trunk/Source/JavaScriptCore/replay/scripts/tests/expected/fail-on-missing-input-queue.json-error (0 => 163918)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/replay/scripts/tests/expected/fail-on-missing-input-queue.json-error         (rev 0)
+++ trunk/Source/JavaScriptCore/replay/scripts/tests/expected/fail-on-missing-input-queue.json-error        2014-02-12 00:22:01 UTC (rev 163918)
</span><span class="lines">@@ -0,0 +1 @@
</span><ins>+ERROR: When parsing input, required property missing: queue
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCorereplayscriptstestsexpectedfailonmissingtypemodejsonerror"></a>
<div class="addfile"><h4>Added: trunk/Source/JavaScriptCore/replay/scripts/tests/expected/fail-on-missing-type-mode.json-error (0 => 163918)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/replay/scripts/tests/expected/fail-on-missing-type-mode.json-error         (rev 0)
+++ trunk/Source/JavaScriptCore/replay/scripts/tests/expected/fail-on-missing-type-mode.json-error        2014-02-12 00:22:01 UTC (rev 163918)
</span><span class="lines">@@ -0,0 +1 @@
</span><ins>+ERROR: When parsing type, required property missing: mode
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCorereplayscriptstestsexpectedfailonmissingtypenamejsonerror"></a>
<div class="addfile"><h4>Added: trunk/Source/JavaScriptCore/replay/scripts/tests/expected/fail-on-missing-type-name.json-error (0 => 163918)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/replay/scripts/tests/expected/fail-on-missing-type-name.json-error         (rev 0)
+++ trunk/Source/JavaScriptCore/replay/scripts/tests/expected/fail-on-missing-type-name.json-error        2014-02-12 00:22:01 UTC (rev 163918)
</span><span class="lines">@@ -0,0 +1 @@
</span><ins>+ERROR: When parsing type, required property missing: name
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCorereplayscriptstestsexpectedfailonnoinputsjsonerror"></a>
<div class="addfile"><h4>Added: trunk/Source/JavaScriptCore/replay/scripts/tests/expected/fail-on-no-inputs.json-error (0 => 163918)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/replay/scripts/tests/expected/fail-on-no-inputs.json-error         (rev 0)
+++ trunk/Source/JavaScriptCore/replay/scripts/tests/expected/fail-on-no-inputs.json-error        2014-02-12 00:22:01 UTC (rev 163918)
</span><span class="lines">@@ -0,0 +1 @@
</span><ins>+ERROR: When parsing toplevel, required property missing: inputs
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCorereplayscriptstestsexpectedfailonnotypesjsonerror"></a>
<div class="addfile"><h4>Added: trunk/Source/JavaScriptCore/replay/scripts/tests/expected/fail-on-no-types.json-error (0 => 163918)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/replay/scripts/tests/expected/fail-on-no-types.json-error         (rev 0)
+++ trunk/Source/JavaScriptCore/replay/scripts/tests/expected/fail-on-no-types.json-error        2014-02-12 00:22:01 UTC (rev 163918)
</span><span class="lines">@@ -0,0 +1 @@
</span><ins>+ERROR: When parsing toplevel, required property missing: types
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCorereplayscriptstestsexpectedfailonunknowninputqueuejsonerror"></a>
<div class="addfile"><h4>Added: trunk/Source/JavaScriptCore/replay/scripts/tests/expected/fail-on-unknown-input-queue.json-error (0 => 163918)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/replay/scripts/tests/expected/fail-on-unknown-input-queue.json-error         (rev 0)
+++ trunk/Source/JavaScriptCore/replay/scripts/tests/expected/fail-on-unknown-input-queue.json-error        2014-02-12 00:22:01 UTC (rev 163918)
</span><span class="lines">@@ -0,0 +1 @@
</span><ins>+ERROR: Unknown input queue: SCRIPT_MEOIZED
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCorereplayscriptstestsexpectedfailonunknownmembertypejsonerror"></a>
<div class="addfile"><h4>Added: trunk/Source/JavaScriptCore/replay/scripts/tests/expected/fail-on-unknown-member-type.json-error (0 => 163918)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/replay/scripts/tests/expected/fail-on-unknown-member-type.json-error         (rev 0)
+++ trunk/Source/JavaScriptCore/replay/scripts/tests/expected/fail-on-unknown-member-type.json-error        2014-02-12 00:22:01 UTC (rev 163918)
</span><span class="lines">@@ -0,0 +1 @@
</span><ins>+ERROR: Unknown type 'double' referenced by member 'randomSeed' of input 'SetRandomSeed'
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCorereplayscriptstestsexpectedfailonunknowntypemodejsonerror"></a>
<div class="addfile"><h4>Added: trunk/Source/JavaScriptCore/replay/scripts/tests/expected/fail-on-unknown-type-mode.json-error (0 => 163918)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/replay/scripts/tests/expected/fail-on-unknown-type-mode.json-error         (rev 0)
+++ trunk/Source/JavaScriptCore/replay/scripts/tests/expected/fail-on-unknown-type-mode.json-error        2014-02-12 00:22:01 UTC (rev 163918)
</span><span class="lines">@@ -0,0 +1 @@
</span><ins>+ERROR: Unknown type mode: BONKERS
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCorereplayscriptstestsexpectedgenerateenumencodinghelperswithguardedvaluesjsonTestReplayInputscpp"></a>
<div class="addfile"><h4>Added: trunk/Source/JavaScriptCore/replay/scripts/tests/expected/generate-enum-encoding-helpers-with-guarded-values.json-TestReplayInputs.cpp (0 => 163918)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/replay/scripts/tests/expected/generate-enum-encoding-helpers-with-guarded-values.json-TestReplayInputs.cpp         (rev 0)
+++ trunk/Source/JavaScriptCore/replay/scripts/tests/expected/generate-enum-encoding-helpers-with-guarded-values.json-TestReplayInputs.cpp        2014-02-12 00:22:01 UTC (rev 163918)
</span><span class="lines">@@ -0,0 +1,147 @@
</span><ins>+/*
+ * Copyright (C) 2014 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from generate-enum-encoding-helpers-with-guarded-values.json
+// by the script: JavaScriptCore/replay/scripts/CodeGeneratorReplayInputs.py
+
+#include "config.h"
+#include "generate-enum-encoding-helpers-with-guarded-values.json-TestReplayInputs.h"
+
+#if ENABLE(WEB_REPLAY)
+#include "InternalNamespaceImplIncludeDummy.h"
+#include <platform/ExternalNamespaceImplIncludeDummy.h>
+#include <platform/PlatformMouseEvent.h>
+
+namespace Test {
+SavedMouseButton::SavedMouseButton(MouseButton button)
+ : NondeterministicInput<SavedMouseButton>()
+ , m_button(button)
+{
+}
+
+SavedMouseButton::~SavedMouseButton()
+{
+}
+} // namespace Test
+
+namespace JSC {
+const AtomicString& InputTraits<Test::SavedMouseButton>::type()
+{
+ static NeverDestroyed<const AtomicString> type("SavedMouseButton", AtomicString::ConstructFromLiteral);
+ return type;
+}
+
+void InputTraits<Test::SavedMouseButton>::encode(EncodedValue& encodedValue, const Test::SavedMouseButton& input)
+{
+ encodedValue.put<WebCore::MouseButton>(ASCIILiteral("button"), input.button());
+}
+
+bool InputTraits<Test::SavedMouseButton>::decode(EncodedValue& encodedValue, std::unique_ptr<Test::SavedMouseButton>& input)
+{
+ WebCore::MouseButton button;
+ if (!encodedValue.get<WebCore::MouseButton>(ASCIILiteral("button"), button))
+ return false;
+
+ input = std::make_unique<Test::SavedMouseButton>(button);
+ return true;
+}
+EncodedValue EncodingTraits<WebCore::MouseButton>::encodeValue(const WebCore::MouseButton& enumValue)
+{
+ EncodedValue encodedValue = EncodedValue::createArray();
+ if (enumValue & WebCore::NoButton) {
+ encodedValue.append<String>(ASCIILiteral("NoButton"));
+ if (enumValue == WebCore::NoButton)
+ return encodedValue;
+ }
+ if (enumValue & WebCore::LeftButton) {
+ encodedValue.append<String>(ASCIILiteral("LeftButton"));
+ if (enumValue == WebCore::LeftButton)
+ return encodedValue;
+ }
+ if (enumValue & WebCore::MiddleButton) {
+ encodedValue.append<String>(ASCIILiteral("MiddleButton"));
+ if (enumValue == WebCore::MiddleButton)
+ return encodedValue;
+ }
+ if (enumValue & WebCore::RightButton) {
+ encodedValue.append<String>(ASCIILiteral("RightButton"));
+ if (enumValue == WebCore::RightButton)
+ return encodedValue;
+ }
+#if ENABLE(SIDE_BUTTONS)
+ if (enumValue & WebCore::LeftSideButton) {
+ encodedValue.append<String>(ASCIILiteral("LeftSideButton"));
+ if (enumValue == WebCore::LeftSideButton)
+ return encodedValue;
+ }
+ if (enumValue & WebCore::RightSideButton) {
+ encodedValue.append<String>(ASCIILiteral("RightSideButton"));
+ if (enumValue == WebCore::RightSideButton)
+ return encodedValue;
+ }
+#endif // ENABLE(SIDE_BUTTONS)
+#if PLATFORM(WINDOWS)
+ if (enumValue & WebCore::WindowsButton) {
+ encodedValue.append<String>(ASCIILiteral("WindowsButton"));
+ if (enumValue == WebCore::WindowsButton)
+ return encodedValue;
+ }
+#endif // PLATFORM(WINDOWS)
+ return encodedValue;
+}
+
+bool EncodingTraits<WebCore::MouseButton>::decodeValue(EncodedValue& encodedValue, WebCore::MouseButton& enumValue)
+{
+ Vector<String> enumStrings;
+ if (!EncodingTraits<Vector<String>>::decodeValue(encodedValue, enumStrings))
+ return false;
+
+ for (String enumString : enumStrings) {
+ if (enumString == "NoButton")
+ enumValue = static_cast<WebCore::MouseButton>(enumValue | WebCore::NoButton);
+ if (enumString == "LeftButton")
+ enumValue = static_cast<WebCore::MouseButton>(enumValue | WebCore::LeftButton);
+ if (enumString == "MiddleButton")
+ enumValue = static_cast<WebCore::MouseButton>(enumValue | WebCore::MiddleButton);
+ if (enumString == "RightButton")
+ enumValue = static_cast<WebCore::MouseButton>(enumValue | WebCore::RightButton);
+#if ENABLE(SIDE_BUTTONS)
+ if (enumString == "LeftSideButton")
+ enumValue = static_cast<WebCore::MouseButton>(enumValue | WebCore::LeftSideButton);
+ if (enumString == "RightSideButton")
+ enumValue = static_cast<WebCore::MouseButton>(enumValue | WebCore::RightSideButton);
+#endif // ENABLE(SIDE_BUTTONS)
+#if PLATFORM(WINDOWS)
+ if (enumString == "WindowsButton")
+ enumValue = static_cast<WebCore::MouseButton>(enumValue | WebCore::WindowsButton);
+#endif // PLATFORM(WINDOWS)
+ }
+
+ return true;
+}
+} // namespace JSC
+
+#endif // ENABLE(WEB_REPLAY)
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCorereplayscriptstestsexpectedgenerateenumencodinghelperswithguardedvaluesjsonTestReplayInputsh"></a>
<div class="addfile"><h4>Added: trunk/Source/JavaScriptCore/replay/scripts/tests/expected/generate-enum-encoding-helpers-with-guarded-values.json-TestReplayInputs.h (0 => 163918)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/replay/scripts/tests/expected/generate-enum-encoding-helpers-with-guarded-values.json-TestReplayInputs.h         (rev 0)
+++ trunk/Source/JavaScriptCore/replay/scripts/tests/expected/generate-enum-encoding-helpers-with-guarded-values.json-TestReplayInputs.h        2014-02-12 00:22:01 UTC (rev 163918)
</span><span class="lines">@@ -0,0 +1,81 @@
</span><ins>+/*
+ * Copyright (C) 2014 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from generate-enum-encoding-helpers-with-guarded-values.json
+// by the script: JavaScriptCore/replay/scripts/CodeGeneratorReplayInputs.py
+
+#ifndef generate_enum_encoding_helpers_with_guarded_values_json_TestReplayInputs_h
+#define generate_enum_encoding_helpers_with_guarded_values_json_TestReplayInputs_h
+
+#if ENABLE(WEB_REPLAY)
+#include "InternalNamespaceHeaderIncludeDummy.h"
+#include <platform/ExternalNamespaceHeaderIncludeDummy.h>
+
+namespace WebCore {
+enum MouseButton : unsigned;
+}
+
+
+namespace Test {
+class SavedMouseButton;
+} // namespace Test
+
+namespace JSC {
+template<> struct InputTraits<Test::SavedMouseButton> {
+ static InputQueue queue() { return InputQueue::ScriptMemoizedData; }
+ static const AtomicString& type();
+
+ static void encode(JSC::EncodedValue&, const Test::SavedMouseButton&);
+ static bool decode(JSC::EncodedValue&, std::unique_ptr<Test::SavedMouseButton>&);
+};
+template<> struct EncodingTraits<WebCore::MouseButton> {
+ typedef WebCore::MouseButton DecodedType;
+
+ static EncodedValue encodeValue(const WebCore::MouseButton& value);
+ static bool decodeValue(EncodedValue&, WebCore::MouseButton& value);
+};
+} // namespace JSC
+
+namespace Test {
+class SavedMouseButton : public NondeterministicInput<SavedMouseButton> {
+public:
+ SavedMouseButton(MouseButton button);
+ virtual ~SavedMouseButton();
+
+ MouseButton button() const { return m_button; }
+private:
+ MouseButton m_button;
+};
+} // namespace Test
+
+#define TEST_REPLAY_INPUT_NAMES_FOR_EACH(macro) \
+ macro(SavedMouseButton) \
+ \
+// end of TEST_REPLAY_INPUT_NAMES_FOR_EACH
+
+#endif // ENABLE(WEB_REPLAY)
+
+#endif // generate-enum-encoding-helpers-with-guarded-values.json-TestReplayInputs_h
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCorereplayscriptstestsexpectedgenerateenumencodinghelpersjsonTestReplayInputscpp"></a>
<div class="addfile"><h4>Added: trunk/Source/JavaScriptCore/replay/scripts/tests/expected/generate-enum-encoding-helpers.json-TestReplayInputs.cpp (0 => 163918)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/replay/scripts/tests/expected/generate-enum-encoding-helpers.json-TestReplayInputs.cpp         (rev 0)
+++ trunk/Source/JavaScriptCore/replay/scripts/tests/expected/generate-enum-encoding-helpers.json-TestReplayInputs.cpp        2014-02-12 00:22:01 UTC (rev 163918)
</span><span class="lines">@@ -0,0 +1,147 @@
</span><ins>+/*
+ * Copyright (C) 2014 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from generate-enum-encoding-helpers.json
+// by the script: JavaScriptCore/replay/scripts/CodeGeneratorReplayInputs.py
+
+#include "config.h"
+#include "generate-enum-encoding-helpers.json-TestReplayInputs.h"
+
+#if ENABLE(WEB_REPLAY)
+#include "InternalNamespaceImplIncludeDummy.h"
+#include <platform/ExternalNamespaceImplIncludeDummy.h>
+#include <platform/PlatformMouseEvent.h>
+#include <replay/NondeterministicInput.h>
+
+namespace Test {
+SavedMouseButton::SavedMouseButton(MouseButton button)
+ : NondeterministicInput<SavedMouseButton>()
+ , m_button(button)
+{
+}
+
+SavedMouseButton::~SavedMouseButton()
+{
+}
+} // namespace Test
+
+namespace JSC {
+const AtomicString& InputTraits<Test::SavedMouseButton>::type()
+{
+ static NeverDestroyed<const AtomicString> type("SavedMouseButton", AtomicString::ConstructFromLiteral);
+ return type;
+}
+
+void InputTraits<Test::SavedMouseButton>::encode(EncodedValue& encodedValue, const Test::SavedMouseButton& input)
+{
+ encodedValue.put<WebCore::MouseButton>(ASCIILiteral("button"), input.button());
+}
+
+bool InputTraits<Test::SavedMouseButton>::decode(EncodedValue& encodedValue, std::unique_ptr<Test::SavedMouseButton>& input)
+{
+ WebCore::MouseButton button;
+ if (!encodedValue.get<WebCore::MouseButton>(ASCIILiteral("button"), button))
+ return false;
+
+ input = std::make_unique<Test::SavedMouseButton>(button);
+ return true;
+}
+EncodedValue EncodingTraits<InputQueue>::encodeValue(const InputQueue& enumValue)
+{
+ switch (enumValue) {
+ case InputQueue::EventLoopInput: return EncodedValue::createString("EventLoopInput");
+ case InputQueue::LoaderMemoizedData: return EncodedValue::createString("LoaderMemoizedData");
+ case InputQueue::ScriptMemoizedData: return EncodedValue::createString("ScriptMemoizedData");
+ default: ASSERT_NOT_REACHED(); return EncodedValue::createString("Error!");
+ }
+}
+
+bool EncodingTraits<InputQueue>::decodeValue(EncodedValue& encodedValue, InputQueue& enumValue)
+{
+ String enumString = encodedValue.convertTo<String>();
+ if (enumString == "EventLoopInput") {
+ enumValue = InputQueue::EventLoopInput;
+ return true;
+ }
+ if (enumString == "LoaderMemoizedData") {
+ enumValue = InputQueue::LoaderMemoizedData;
+ return true;
+ }
+ if (enumString == "ScriptMemoizedData") {
+ enumValue = InputQueue::ScriptMemoizedData;
+ return true;
+ }
+ return false;
+}
+
+EncodedValue EncodingTraits<WebCore::MouseButton>::encodeValue(const WebCore::MouseButton& enumValue)
+{
+ EncodedValue encodedValue = EncodedValue::createArray();
+ if (enumValue & WebCore::NoButton) {
+ encodedValue.append<String>(ASCIILiteral("NoButton"));
+ if (enumValue == WebCore::NoButton)
+ return encodedValue;
+ }
+ if (enumValue & WebCore::LeftButton) {
+ encodedValue.append<String>(ASCIILiteral("LeftButton"));
+ if (enumValue == WebCore::LeftButton)
+ return encodedValue;
+ }
+ if (enumValue & WebCore::MiddleButton) {
+ encodedValue.append<String>(ASCIILiteral("MiddleButton"));
+ if (enumValue == WebCore::MiddleButton)
+ return encodedValue;
+ }
+ if (enumValue & WebCore::RightButton) {
+ encodedValue.append<String>(ASCIILiteral("RightButton"));
+ if (enumValue == WebCore::RightButton)
+ return encodedValue;
+ }
+ return encodedValue;
+}
+
+bool EncodingTraits<WebCore::MouseButton>::decodeValue(EncodedValue& encodedValue, WebCore::MouseButton& enumValue)
+{
+ Vector<String> enumStrings;
+ if (!EncodingTraits<Vector<String>>::decodeValue(encodedValue, enumStrings))
+ return false;
+
+ for (String enumString : enumStrings) {
+ if (enumString == "NoButton")
+ enumValue = static_cast<WebCore::MouseButton>(enumValue | WebCore::NoButton);
+ if (enumString == "LeftButton")
+ enumValue = static_cast<WebCore::MouseButton>(enumValue | WebCore::LeftButton);
+ if (enumString == "MiddleButton")
+ enumValue = static_cast<WebCore::MouseButton>(enumValue | WebCore::MiddleButton);
+ if (enumString == "RightButton")
+ enumValue = static_cast<WebCore::MouseButton>(enumValue | WebCore::RightButton);
+ }
+
+ return true;
+}
+} // namespace JSC
+
+#endif // ENABLE(WEB_REPLAY)
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCorereplayscriptstestsexpectedgenerateenumencodinghelpersjsonTestReplayInputsh"></a>
<div class="addfile"><h4>Added: trunk/Source/JavaScriptCore/replay/scripts/tests/expected/generate-enum-encoding-helpers.json-TestReplayInputs.h (0 => 163918)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/replay/scripts/tests/expected/generate-enum-encoding-helpers.json-TestReplayInputs.h         (rev 0)
+++ trunk/Source/JavaScriptCore/replay/scripts/tests/expected/generate-enum-encoding-helpers.json-TestReplayInputs.h        2014-02-12 00:22:01 UTC (rev 163918)
</span><span class="lines">@@ -0,0 +1,92 @@
</span><ins>+/*
+ * Copyright (C) 2014 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from generate-enum-encoding-helpers.json
+// by the script: JavaScriptCore/replay/scripts/CodeGeneratorReplayInputs.py
+
+#ifndef generate_enum_encoding_helpers_json_TestReplayInputs_h
+#define generate_enum_encoding_helpers_json_TestReplayInputs_h
+
+#if ENABLE(WEB_REPLAY)
+#include "InternalNamespaceHeaderIncludeDummy.h"
+#include <platform/ExternalNamespaceHeaderIncludeDummy.h>
+
+namespace WebCore {
+enum MouseButton : unsigned;
+}
+
+namespace JSC {
+enum class InputQueue;
+}
+
+
+namespace Test {
+class SavedMouseButton;
+} // namespace Test
+
+namespace JSC {
+template<> struct InputTraits<Test::SavedMouseButton> {
+ static InputQueue queue() { return InputQueue::ScriptMemoizedData; }
+ static const AtomicString& type();
+
+ static void encode(JSC::EncodedValue&, const Test::SavedMouseButton&);
+ static bool decode(JSC::EncodedValue&, std::unique_ptr<Test::SavedMouseButton>&);
+};
+template<> struct EncodingTraits<InputQueue> {
+ typedef InputQueue DecodedType;
+
+ static EncodedValue encodeValue(const InputQueue& value);
+ static bool decodeValue(EncodedValue&, InputQueue& value);
+};
+
+template<> struct EncodingTraits<WebCore::MouseButton> {
+ typedef WebCore::MouseButton DecodedType;
+
+ static EncodedValue encodeValue(const WebCore::MouseButton& value);
+ static bool decodeValue(EncodedValue&, WebCore::MouseButton& value);
+};
+} // namespace JSC
+
+namespace Test {
+class SavedMouseButton : public NondeterministicInput<SavedMouseButton> {
+public:
+ SavedMouseButton(MouseButton button);
+ virtual ~SavedMouseButton();
+
+ MouseButton button() const { return m_button; }
+private:
+ MouseButton m_button;
+};
+} // namespace Test
+
+#define TEST_REPLAY_INPUT_NAMES_FOR_EACH(macro) \
+ macro(SavedMouseButton) \
+ \
+// end of TEST_REPLAY_INPUT_NAMES_FOR_EACH
+
+#endif // ENABLE(WEB_REPLAY)
+
+#endif // generate-enum-encoding-helpers.json-TestReplayInputs_h
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCorereplayscriptstestsexpectedgenerateeventloopshapetypesjsonerror"></a>
<div class="addfile"><h4>Added: trunk/Source/JavaScriptCore/replay/scripts/tests/expected/generate-event-loop-shape-types.json-error (0 => 163918)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/replay/scripts/tests/expected/generate-event-loop-shape-types.json-error         (rev 0)
+++ trunk/Source/JavaScriptCore/replay/scripts/tests/expected/generate-event-loop-shape-types.json-error        2014-02-12 00:22:01 UTC (rev 163918)
</span><span class="lines">@@ -0,0 +1 @@
</span><ins>+ERROR: Unknown type mode: MAP
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCorereplayscriptstestsexpectedgenerateinputwithguardjsonTestReplayInputscpp"></a>
<div class="addfile"><h4>Added: trunk/Source/JavaScriptCore/replay/scripts/tests/expected/generate-input-with-guard.json-TestReplayInputs.cpp (0 => 163918)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/replay/scripts/tests/expected/generate-input-with-guard.json-TestReplayInputs.cpp         (rev 0)
+++ trunk/Source/JavaScriptCore/replay/scripts/tests/expected/generate-input-with-guard.json-TestReplayInputs.cpp        2014-02-12 00:22:01 UTC (rev 163918)
</span><span class="lines">@@ -0,0 +1,108 @@
</span><ins>+/*
+ * Copyright (C) 2014 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from generate-input-with-guard.json
+// by the script: JavaScriptCore/replay/scripts/CodeGeneratorReplayInputs.py
+
+#include "config.h"
+#include "generate-input-with-guard.json-TestReplayInputs.h"
+
+#if ENABLE(WEB_REPLAY)
+#include "InternalNamespaceImplIncludeDummy.h"
+#include <platform/ExternalNamespaceImplIncludeDummy.h>
+
+namespace Test {
+#if ENABLE(DUMMY_FEATURE)
+GetCurrentTime::GetCurrentTime(double currentTime)
+ : NondeterministicInput<GetCurrentTime>()
+ , m_currentTime(currentTime)
+{
+}
+
+GetCurrentTime::~GetCurrentTime()
+{
+}
+#endif // ENABLE(DUMMY_FEATURE)
+
+SetRandomSeed::SetRandomSeed(uint64_t randomSeed)
+ : NondeterministicInput<SetRandomSeed>()
+ , m_randomSeed(randomSeed)
+{
+}
+
+SetRandomSeed::~SetRandomSeed()
+{
+}
+} // namespace Test
+
+namespace JSC {
+#if ENABLE(DUMMY_FEATURE)
+const AtomicString& InputTraits<Test::GetCurrentTime>::type()
+{
+ static NeverDestroyed<const AtomicString> type("GetCurrentTime", AtomicString::ConstructFromLiteral);
+ return type;
+}
+
+void InputTraits<Test::GetCurrentTime>::encode(EncodedValue& encodedValue, const Test::GetCurrentTime& input)
+{
+ encodedValue.put<double>(ASCIILiteral("currentTime"), input.currentTime());
+}
+
+bool InputTraits<Test::GetCurrentTime>::decode(EncodedValue& encodedValue, std::unique_ptr<Test::GetCurrentTime>& input)
+{
+ double currentTime;
+ if (!encodedValue.get<double>(ASCIILiteral("currentTime"), currentTime))
+ return false;
+
+ input = std::make_unique<Test::GetCurrentTime>(currentTime);
+ return true;
+}
+#endif // ENABLE(DUMMY_FEATURE)
+
+const AtomicString& InputTraits<Test::SetRandomSeed>::type()
+{
+ static NeverDestroyed<const AtomicString> type("SetRandomSeed", AtomicString::ConstructFromLiteral);
+ return type;
+}
+
+void InputTraits<Test::SetRandomSeed>::encode(EncodedValue& encodedValue, const Test::SetRandomSeed& input)
+{
+ encodedValue.put<uint64_t>(ASCIILiteral("randomSeed"), input.randomSeed());
+}
+
+bool InputTraits<Test::SetRandomSeed>::decode(EncodedValue& encodedValue, std::unique_ptr<Test::SetRandomSeed>& input)
+{
+ uint64_t randomSeed;
+ if (!encodedValue.get<uint64_t>(ASCIILiteral("randomSeed"), randomSeed))
+ return false;
+
+ input = std::make_unique<Test::SetRandomSeed>(randomSeed);
+ return true;
+}
+
+} // namespace JSC
+
+#endif // ENABLE(WEB_REPLAY)
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCorereplayscriptstestsexpectedgenerateinputwithguardjsonTestReplayInputsh"></a>
<div class="addfile"><h4>Added: trunk/Source/JavaScriptCore/replay/scripts/tests/expected/generate-input-with-guard.json-TestReplayInputs.h (0 => 163918)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/replay/scripts/tests/expected/generate-input-with-guard.json-TestReplayInputs.h         (rev 0)
+++ trunk/Source/JavaScriptCore/replay/scripts/tests/expected/generate-input-with-guard.json-TestReplayInputs.h        2014-02-12 00:22:01 UTC (rev 163918)
</span><span class="lines">@@ -0,0 +1,99 @@
</span><ins>+/*
+ * Copyright (C) 2014 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from generate-input-with-guard.json
+// by the script: JavaScriptCore/replay/scripts/CodeGeneratorReplayInputs.py
+
+#ifndef generate_input_with_guard_json_TestReplayInputs_h
+#define generate_input_with_guard_json_TestReplayInputs_h
+
+#if ENABLE(WEB_REPLAY)
+#include "InternalNamespaceHeaderIncludeDummy.h"
+#include <platform/ExternalNamespaceHeaderIncludeDummy.h>
+
+
+
+namespace Test {
+#if ENABLE(DUMMY_FEATURE)
+class GetCurrentTime;
+#endif // ENABLE(DUMMY_FEATURE)
+class SetRandomSeed;
+} // namespace Test
+
+namespace JSC {
+#if ENABLE(DUMMY_FEATURE)
+template<> struct InputTraits<Test::GetCurrentTime> {
+ static InputQueue queue() { return InputQueue::ScriptMemoizedData; }
+ static const AtomicString& type();
+
+ static void encode(JSC::EncodedValue&, const Test::GetCurrentTime&);
+ static bool decode(JSC::EncodedValue&, std::unique_ptr<Test::GetCurrentTime>&);
+};
+#endif // ENABLE(DUMMY_FEATURE)
+
+template<> struct InputTraits<Test::SetRandomSeed> {
+ static InputQueue queue() { return InputQueue::ScriptMemoizedData; }
+ static const AtomicString& type();
+
+ static void encode(JSC::EncodedValue&, const Test::SetRandomSeed&);
+ static bool decode(JSC::EncodedValue&, std::unique_ptr<Test::SetRandomSeed>&);
+};
+
+} // namespace JSC
+
+namespace Test {
+#if ENABLE(DUMMY_FEATURE)
+class GetCurrentTime : public NondeterministicInput<GetCurrentTime> {
+public:
+ GetCurrentTime(double currentTime);
+ virtual ~GetCurrentTime();
+
+ double currentTime() const { return m_currentTime; }
+private:
+ double m_currentTime;
+};
+#endif // ENABLE(DUMMY_FEATURE)
+
+class SetRandomSeed : public NondeterministicInput<SetRandomSeed> {
+public:
+ SetRandomSeed(uint64_t randomSeed);
+ virtual ~SetRandomSeed();
+
+ uint64_t randomSeed() const { return m_randomSeed; }
+private:
+ uint64_t m_randomSeed;
+};
+} // namespace Test
+
+#define TEST_REPLAY_INPUT_NAMES_FOR_EACH(macro) \
+ macro(GetCurrentTime) \
+ macro(SetRandomSeed) \
+ \
+// end of TEST_REPLAY_INPUT_NAMES_FOR_EACH
+
+#endif // ENABLE(WEB_REPLAY)
+
+#endif // generate-input-with-guard.json-TestReplayInputs_h
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCorereplayscriptstestsexpectedgenerateinputwithvectormembersjsonTestReplayInputscpp"></a>
<div class="addfile"><h4>Added: trunk/Source/JavaScriptCore/replay/scripts/tests/expected/generate-input-with-vector-members.json-TestReplayInputs.cpp (0 => 163918)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/replay/scripts/tests/expected/generate-input-with-vector-members.json-TestReplayInputs.cpp         (rev 0)
+++ trunk/Source/JavaScriptCore/replay/scripts/tests/expected/generate-input-with-vector-members.json-TestReplayInputs.cpp        2014-02-12 00:22:01 UTC (rev 163918)
</span><span class="lines">@@ -0,0 +1,87 @@
</span><ins>+/*
+ * Copyright (C) 2014 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from generate-input-with-vector-members.json
+// by the script: JavaScriptCore/replay/scripts/CodeGeneratorReplayInputs.py
+
+#include "config.h"
+#include "generate-input-with-vector-members.json-TestReplayInputs.h"
+
+#if ENABLE(WEB_REPLAY)
+#include "InternalNamespaceImplIncludeDummy.h"
+#include <platform/ExternalNamespaceImplIncludeDummy.h>
+#include <things/JSThing.h>
+#include <things/WebThing.h>
+
+namespace Test {
+ArrayOfThings::ArrayOfThings(Vector<double>& doubles, Vector<JSThing>& jsthings, Vector<WebThing>& webthings)
+ : NondeterministicInput<ArrayOfThings>()
+ , m_doubles(doubles)
+ , m_jsthings(jsthings)
+ , m_webthings(webthings)
+{
+}
+
+ArrayOfThings::~ArrayOfThings()
+{
+}
+} // namespace Test
+
+namespace JSC {
+const AtomicString& InputTraits<Test::ArrayOfThings>::type()
+{
+ static NeverDestroyed<const AtomicString> type("ArrayOfThings", AtomicString::ConstructFromLiteral);
+ return type;
+}
+
+void InputTraits<Test::ArrayOfThings>::encode(EncodedValue& encodedValue, const Test::ArrayOfThings& input)
+{
+ encodedValue.put<Vector<double>>(ASCIILiteral("doubles"), input.doubles());
+ encodedValue.put<Vector<JSThing>>(ASCIILiteral("jsthings"), input.jsthings());
+ encodedValue.put<Vector<WebCore::WebThing>>(ASCIILiteral("webthings"), input.webthings());
+}
+
+bool InputTraits<Test::ArrayOfThings>::decode(EncodedValue& encodedValue, std::unique_ptr<Test::ArrayOfThings>& input)
+{
+ Vector<double> doubles;
+ if (!encodedValue.get<Vector<double>>(ASCIILiteral("doubles"), doubles))
+ return false;
+
+ Vector<JSThing> jsthings;
+ if (!encodedValue.get<Vector<JSThing>>(ASCIILiteral("jsthings"), jsthings))
+ return false;
+
+ Vector<WebCore::WebThing> webthings;
+ if (!encodedValue.get<Vector<WebCore::WebThing>>(ASCIILiteral("webthings"), webthings))
+ return false;
+
+ input = std::make_unique<Test::ArrayOfThings>(doubles, jsthings, webthings);
+ return true;
+}
+
+} // namespace JSC
+
+#endif // ENABLE(WEB_REPLAY)
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCorereplayscriptstestsexpectedgenerateinputwithvectormembersjsonTestReplayInputsh"></a>
<div class="addfile"><h4>Added: trunk/Source/JavaScriptCore/replay/scripts/tests/expected/generate-input-with-vector-members.json-TestReplayInputs.h (0 => 163918)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/replay/scripts/tests/expected/generate-input-with-vector-members.json-TestReplayInputs.h         (rev 0)
+++ trunk/Source/JavaScriptCore/replay/scripts/tests/expected/generate-input-with-vector-members.json-TestReplayInputs.h        2014-02-12 00:22:01 UTC (rev 163918)
</span><span class="lines">@@ -0,0 +1,84 @@
</span><ins>+/*
+ * Copyright (C) 2014 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from generate-input-with-vector-members.json
+// by the script: JavaScriptCore/replay/scripts/CodeGeneratorReplayInputs.py
+
+#ifndef generate_input_with_vector_members_json_TestReplayInputs_h
+#define generate_input_with_vector_members_json_TestReplayInputs_h
+
+#if ENABLE(WEB_REPLAY)
+#include "InternalNamespaceHeaderIncludeDummy.h"
+#include <platform/ExternalNamespaceHeaderIncludeDummy.h>
+
+namespace WebCore {
+class WebThing;
+}
+
+namespace JSC {
+class JSThing;
+}
+
+
+namespace Test {
+class ArrayOfThings;
+} // namespace Test
+
+namespace JSC {
+template<> struct InputTraits<Test::ArrayOfThings> {
+ static InputQueue queue() { return InputQueue::ScriptMemoizedData; }
+ static const AtomicString& type();
+
+ static void encode(JSC::EncodedValue&, const Test::ArrayOfThings&);
+ static bool decode(JSC::EncodedValue&, std::unique_ptr<Test::ArrayOfThings>&);
+};
+
+} // namespace JSC
+
+namespace Test {
+class ArrayOfThings : public NondeterministicInput<ArrayOfThings> {
+public:
+ ArrayOfThings(Vector<double>& doubles, Vector<JSThing>& jsthings, Vector<WebThing>& webthings);
+ virtual ~ArrayOfThings();
+
+ const Vector<double>& doubles() const { return m_doubles; }
+ const Vector<JSThing>& jsthings() const { return m_jsthings; }
+ const Vector<WebThing>& webthings() const { return m_webthings; }
+private:
+ Vector<double> m_doubles;
+ Vector<JSThing> m_jsthings;
+ Vector<WebThing> m_webthings;
+};
+} // namespace Test
+
+#define TEST_REPLAY_INPUT_NAMES_FOR_EACH(macro) \
+ macro(ArrayOfThings) \
+ \
+// end of TEST_REPLAY_INPUT_NAMES_FOR_EACH
+
+#endif // ENABLE(WEB_REPLAY)
+
+#endif // generate-input-with-vector-members.json-TestReplayInputs_h
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCorereplayscriptstestsexpectedgenerateinputswithflagsjsonTestReplayInputscpp"></a>
<div class="addfile"><h4>Added: trunk/Source/JavaScriptCore/replay/scripts/tests/expected/generate-inputs-with-flags.json-TestReplayInputs.cpp (0 => 163918)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/replay/scripts/tests/expected/generate-inputs-with-flags.json-TestReplayInputs.cpp         (rev 0)
+++ trunk/Source/JavaScriptCore/replay/scripts/tests/expected/generate-inputs-with-flags.json-TestReplayInputs.cpp        2014-02-12 00:22:01 UTC (rev 163918)
</span><span class="lines">@@ -0,0 +1,104 @@
</span><ins>+/*
+ * Copyright (C) 2014 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from generate-inputs-with-flags.json
+// by the script: JavaScriptCore/replay/scripts/CodeGeneratorReplayInputs.py
+
+#include "config.h"
+#include "generate-inputs-with-flags.json-TestReplayInputs.h"
+
+#if ENABLE(WEB_REPLAY)
+#include "InternalNamespaceImplIncludeDummy.h"
+#include <platform/ExternalNamespaceImplIncludeDummy.h>
+
+namespace Test {
+ScalarInput1::ScalarInput1(ScalarType data)
+ : NondeterministicInput<ScalarInput1>()
+ , m_data(data)
+{
+}
+
+ScalarInput1::~ScalarInput1()
+{
+}
+
+ScalarInput2::ScalarInput2(ScalarType data)
+ : NondeterministicInput<ScalarInput2>()
+ , m_data(data)
+{
+}
+
+ScalarInput2::~ScalarInput2()
+{
+}
+} // namespace Test
+
+namespace JSC {
+const AtomicString& InputTraits<Test::ScalarInput1>::type()
+{
+ static NeverDestroyed<const AtomicString> type("ScalarInput1", AtomicString::ConstructFromLiteral);
+ return type;
+}
+
+void InputTraits<Test::ScalarInput1>::encode(EncodedValue& encodedValue, const Test::ScalarInput1& input)
+{
+ encodedValue.put<ScalarType>(ASCIILiteral("data"), input.data());
+}
+
+bool InputTraits<Test::ScalarInput1>::decode(EncodedValue& encodedValue, std::unique_ptr<Test::ScalarInput1>& input)
+{
+ ScalarType data;
+ if (!encodedValue.get<ScalarType>(ASCIILiteral("data"), data))
+ return false;
+
+ input = std::make_unique<Test::ScalarInput1>(data);
+ return true;
+}
+
+const AtomicString& InputTraits<Test::ScalarInput2>::type()
+{
+ static NeverDestroyed<const AtomicString> type("ScalarInput2", AtomicString::ConstructFromLiteral);
+ return type;
+}
+
+void InputTraits<Test::ScalarInput2>::encode(EncodedValue& encodedValue, const Test::ScalarInput2& input)
+{
+ encodedValue.put<ScalarType>(ASCIILiteral("data"), input.data());
+}
+
+bool InputTraits<Test::ScalarInput2>::decode(EncodedValue& encodedValue, std::unique_ptr<Test::ScalarInput2>& input)
+{
+ ScalarType data;
+ if (!encodedValue.get<ScalarType>(ASCIILiteral("data"), data))
+ return false;
+
+ input = std::make_unique<Test::ScalarInput2>(data);
+ return true;
+}
+
+} // namespace JSC
+
+#endif // ENABLE(WEB_REPLAY)
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCorereplayscriptstestsexpectedgenerateinputswithflagsjsonTestReplayInputsh"></a>
<div class="addfile"><h4>Added: trunk/Source/JavaScriptCore/replay/scripts/tests/expected/generate-inputs-with-flags.json-TestReplayInputs.h (0 => 163918)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/replay/scripts/tests/expected/generate-inputs-with-flags.json-TestReplayInputs.h         (rev 0)
+++ trunk/Source/JavaScriptCore/replay/scripts/tests/expected/generate-inputs-with-flags.json-TestReplayInputs.h        2014-02-12 00:22:01 UTC (rev 163918)
</span><span class="lines">@@ -0,0 +1,93 @@
</span><ins>+/*
+ * Copyright (C) 2014 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from generate-inputs-with-flags.json
+// by the script: JavaScriptCore/replay/scripts/CodeGeneratorReplayInputs.py
+
+#ifndef generate_inputs_with_flags_json_TestReplayInputs_h
+#define generate_inputs_with_flags_json_TestReplayInputs_h
+
+#if ENABLE(WEB_REPLAY)
+#include "InternalNamespaceHeaderIncludeDummy.h"
+#include <platform/ExternalNamespaceHeaderIncludeDummy.h>
+
+
+
+namespace Test {
+class ScalarInput1;
+class ScalarInput2;
+} // namespace Test
+
+namespace JSC {
+template<> struct InputTraits<Test::ScalarInput1> {
+ static InputQueue queue() { return InputQueue::ScriptMemoizedData; }
+ static const AtomicString& type();
+
+ static void encode(JSC::EncodedValue&, const Test::ScalarInput1&);
+ static bool decode(JSC::EncodedValue&, std::unique_ptr<Test::ScalarInput1>&);
+};
+
+template<> struct InputTraits<Test::ScalarInput2> {
+ static InputQueue queue() { return InputQueue::ScriptMemoizedData; }
+ static const AtomicString& type();
+
+ static void encode(JSC::EncodedValue&, const Test::ScalarInput2&);
+ static bool decode(JSC::EncodedValue&, std::unique_ptr<Test::ScalarInput2>&);
+};
+
+} // namespace JSC
+
+namespace Test {
+class ScalarInput1 : public NondeterministicInput<ScalarInput1> {
+public:
+ ScalarInput1(ScalarType data);
+ virtual ~ScalarInput1();
+
+ ScalarType data() const { return m_data; }
+private:
+ ScalarType m_data;
+};
+
+class ScalarInput2 : public NondeterministicInput<ScalarInput2> {
+public:
+ ScalarInput2(ScalarType data);
+ virtual ~ScalarInput2();
+
+ ScalarType data() const { return m_data; }
+private:
+ ScalarType m_data;
+};
+} // namespace Test
+
+#define TEST_REPLAY_INPUT_NAMES_FOR_EACH(macro) \
+ macro(ScalarInput1) \
+ macro(ScalarInput2) \
+ \
+// end of TEST_REPLAY_INPUT_NAMES_FOR_EACH
+
+#endif // ENABLE(WEB_REPLAY)
+
+#endif // generate-inputs-with-flags.json-TestReplayInputs_h
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCorereplayscriptstestsexpectedgeneratememoizedtypemodesjsonTestReplayInputscpp"></a>
<div class="addfile"><h4>Added: trunk/Source/JavaScriptCore/replay/scripts/tests/expected/generate-memoized-type-modes.json-TestReplayInputs.cpp (0 => 163918)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/replay/scripts/tests/expected/generate-memoized-type-modes.json-TestReplayInputs.cpp         (rev 0)
+++ trunk/Source/JavaScriptCore/replay/scripts/tests/expected/generate-memoized-type-modes.json-TestReplayInputs.cpp        2014-02-12 00:22:01 UTC (rev 163918)
</span><span class="lines">@@ -0,0 +1,104 @@
</span><ins>+/*
+ * Copyright (C) 2014 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from generate-memoized-type-modes.json
+// by the script: JavaScriptCore/replay/scripts/CodeGeneratorReplayInputs.py
+
+#include "config.h"
+#include "generate-memoized-type-modes.json-TestReplayInputs.h"
+
+#if ENABLE(WEB_REPLAY)
+#include "InternalNamespaceImplIncludeDummy.h"
+#include <platform/ExternalNamespaceImplIncludeDummy.h>
+
+namespace Test {
+ScalarInput::ScalarInput(ScalarType data)
+ : NondeterministicInput<ScalarInput>()
+ , m_data(data)
+{
+}
+
+ScalarInput::~ScalarInput()
+{
+}
+
+MapInput::MapInput(std::unique_ptr<MapType> data)
+ : NondeterministicInput<MapInput>()
+ , m_data(std::move(data))
+{
+}
+
+MapInput::~MapInput()
+{
+}
+} // namespace Test
+
+namespace JSC {
+const AtomicString& InputTraits<Test::ScalarInput>::type()
+{
+ static NeverDestroyed<const AtomicString> type("ScalarInput", AtomicString::ConstructFromLiteral);
+ return type;
+}
+
+void InputTraits<Test::ScalarInput>::encode(EncodedValue& encodedValue, const Test::ScalarInput& input)
+{
+ encodedValue.put<ScalarType>(ASCIILiteral("data"), input.data());
+}
+
+bool InputTraits<Test::ScalarInput>::decode(EncodedValue& encodedValue, std::unique_ptr<Test::ScalarInput>& input)
+{
+ ScalarType data;
+ if (!encodedValue.get<ScalarType>(ASCIILiteral("data"), data))
+ return false;
+
+ input = std::make_unique<Test::ScalarInput>(data);
+ return true;
+}
+
+const AtomicString& InputTraits<Test::MapInput>::type()
+{
+ static NeverDestroyed<const AtomicString> type("MapInput", AtomicString::ConstructFromLiteral);
+ return type;
+}
+
+void InputTraits<Test::MapInput>::encode(EncodedValue& encodedValue, const Test::MapInput& input)
+{
+ encodedValue.put<MapType>(ASCIILiteral("data"), input.data());
+}
+
+bool InputTraits<Test::MapInput>::decode(EncodedValue& encodedValue, std::unique_ptr<Test::MapInput>& input)
+{
+ std::unique_ptr<MapType> data;
+ if (!encodedValue.get<MapType>(ASCIILiteral("data"), data))
+ return false;
+
+ input = std::make_unique<Test::MapInput>(std::move(data));
+ return true;
+}
+
+} // namespace JSC
+
+#endif // ENABLE(WEB_REPLAY)
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCorereplayscriptstestsexpectedgeneratememoizedtypemodesjsonTestReplayInputsh"></a>
<div class="addfile"><h4>Added: trunk/Source/JavaScriptCore/replay/scripts/tests/expected/generate-memoized-type-modes.json-TestReplayInputs.h (0 => 163918)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/replay/scripts/tests/expected/generate-memoized-type-modes.json-TestReplayInputs.h         (rev 0)
+++ trunk/Source/JavaScriptCore/replay/scripts/tests/expected/generate-memoized-type-modes.json-TestReplayInputs.h        2014-02-12 00:22:01 UTC (rev 163918)
</span><span class="lines">@@ -0,0 +1,93 @@
</span><ins>+/*
+ * Copyright (C) 2014 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from generate-memoized-type-modes.json
+// by the script: JavaScriptCore/replay/scripts/CodeGeneratorReplayInputs.py
+
+#ifndef generate_memoized_type_modes_json_TestReplayInputs_h
+#define generate_memoized_type_modes_json_TestReplayInputs_h
+
+#if ENABLE(WEB_REPLAY)
+#include "InternalNamespaceHeaderIncludeDummy.h"
+#include <platform/ExternalNamespaceHeaderIncludeDummy.h>
+
+
+
+namespace Test {
+class ScalarInput;
+class MapInput;
+} // namespace Test
+
+namespace JSC {
+template<> struct InputTraits<Test::ScalarInput> {
+ static InputQueue queue() { return InputQueue::ScriptMemoizedData; }
+ static const AtomicString& type();
+
+ static void encode(JSC::EncodedValue&, const Test::ScalarInput&);
+ static bool decode(JSC::EncodedValue&, std::unique_ptr<Test::ScalarInput>&);
+};
+
+template<> struct InputTraits<Test::MapInput> {
+ static InputQueue queue() { return InputQueue::ScriptMemoizedData; }
+ static const AtomicString& type();
+
+ static void encode(JSC::EncodedValue&, const Test::MapInput&);
+ static bool decode(JSC::EncodedValue&, std::unique_ptr<Test::MapInput>&);
+};
+
+} // namespace JSC
+
+namespace Test {
+class ScalarInput : public NondeterministicInput<ScalarInput> {
+public:
+ ScalarInput(ScalarType data);
+ virtual ~ScalarInput();
+
+ ScalarType data() const { return m_data; }
+private:
+ ScalarType m_data;
+};
+
+class MapInput : public NondeterministicInput<MapInput> {
+public:
+ MapInput(std::unique_ptr<MapType> data);
+ virtual ~MapInput();
+
+ const MapType& data() const { return *m_data; }
+private:
+ std::unique_ptr<MapType> m_data;
+};
+} // namespace Test
+
+#define TEST_REPLAY_INPUT_NAMES_FOR_EACH(macro) \
+ macro(ScalarInput) \
+ macro(MapInput) \
+ \
+// end of TEST_REPLAY_INPUT_NAMES_FOR_EACH
+
+#endif // ENABLE(WEB_REPLAY)
+
+#endif // generate-memoized-type-modes.json-TestReplayInputs_h
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCorereplayscriptstestsfailoncstyleenumnostoragejson"></a>
<div class="addfile"><h4>Added: trunk/Source/JavaScriptCore/replay/scripts/tests/fail-on-c-style-enum-no-storage.json (0 => 163918)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/replay/scripts/tests/fail-on-c-style-enum-no-storage.json         (rev 0)
+++ trunk/Source/JavaScriptCore/replay/scripts/tests/fail-on-c-style-enum-no-storage.json        2014-02-12 00:22:01 UTC (rev 163918)
</span><span class="lines">@@ -0,0 +1,23 @@
</span><ins>+{
+ "types": {
+ "WebCore": [
+ {
+ "name": "MouseButton", "mode": "SCALAR",
+ "flags": ["ENUM"],
+ "values": ["NoButton", "LeftButton", "MiddleButton", "RightButton"],
+ "header": "path/to/MouseButton.h"
+ }
+ ]
+ },
+
+ "inputs": [
+ {
+ "name": "SavedMouseButton",
+ "description": "Supplies a mouse button enum value.",
+ "queue": "SCRIPT_MEMOIZED",
+ "members": [
+ { "name": "button", "type": "MouseButton" }
+ ]
+ }
+ ]
+}
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCorereplayscriptstestsfailonduplicateinputnamesjson"></a>
<div class="addfile"><h4>Added: trunk/Source/JavaScriptCore/replay/scripts/tests/fail-on-duplicate-input-names.json (0 => 163918)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/replay/scripts/tests/fail-on-duplicate-input-names.json         (rev 0)
+++ trunk/Source/JavaScriptCore/replay/scripts/tests/fail-on-duplicate-input-names.json        2014-02-12 00:22:01 UTC (rev 163918)
</span><span class="lines">@@ -0,0 +1,27 @@
</span><ins>+{
+ "types": {
+ "Global": [
+ { "name": "double", "mode": "SCALAR" },
+ { "name": "uint64_t", "mode": "SCALAR" }
+ ]
+ },
+
+ "inputs": [
+ {
+ "name": "GetCurrentTime",
+ "description": "Supplies the system time to Date.now() and new Date().",
+ "queue": "SCRIPT_MEMOIZED",
+ "members": [
+ { "name": "currentTime", "type": "double" }
+ ]
+ },
+ {
+ "name": "GetCurrentTime",
+ "description": "Sets the PRNG seed used by Math.random().",
+ "queue": "SCRIPT_MEMOIZED",
+ "members": [
+ { "name": "randomSeed", "type": "uint64_t" }
+ ]
+ }
+ ]
+}
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCorereplayscriptstestsfailonduplicatetypenamesjson"></a>
<div class="addfile"><h4>Added: trunk/Source/JavaScriptCore/replay/scripts/tests/fail-on-duplicate-type-names.json (0 => 163918)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/replay/scripts/tests/fail-on-duplicate-type-names.json         (rev 0)
+++ trunk/Source/JavaScriptCore/replay/scripts/tests/fail-on-duplicate-type-names.json        2014-02-12 00:22:01 UTC (rev 163918)
</span><span class="lines">@@ -0,0 +1,22 @@
</span><ins>+{
+ "types": {
+ "Global": [
+ { "name": "uint64_t", "mode": "SCALAR" },
+ { "name": "uint64_t", "mode": "SCALAR" }
+ ]
+ },
+
+ "inputs": [
+ {
+ "name": "SetRandomSeed",
+ "description": "Sets the PRNG seed used by Math.random().",
+ "queue": "SCRIPT_MEMOIZED",
+ "members": [
+ {
+ "name": "randomSeed",
+ "type": "uint64_t"
+ }
+ ]
+ }
+ ]
+}
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCorereplayscriptstestsfailonenumtypemissingvaluesjson"></a>
<div class="addfile"><h4>Added: trunk/Source/JavaScriptCore/replay/scripts/tests/fail-on-enum-type-missing-values.json (0 => 163918)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/replay/scripts/tests/fail-on-enum-type-missing-values.json         (rev 0)
+++ trunk/Source/JavaScriptCore/replay/scripts/tests/fail-on-enum-type-missing-values.json        2014-02-12 00:22:01 UTC (rev 163918)
</span><span class="lines">@@ -0,0 +1,21 @@
</span><ins>+{
+ "types": {
+ "Global": [
+ {
+ "name": "MouseButton", "mode": "SCALAR",
+ "flags": ["ENUM"]
+ }
+ ]
+ },
+
+ "inputs": [
+ {
+ "name": "SavedMouseButton",
+ "description": "Supplies a mouse button enum value.",
+ "queue": "SCRIPT_MEMOIZED",
+ "members": [
+ { "name": "currentTime", "type": "MouseButton" }
+ ]
+ }
+ ]
+}
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCorereplayscriptstestsfailonmissinginputmembernamejson"></a>
<div class="addfile"><h4>Added: trunk/Source/JavaScriptCore/replay/scripts/tests/fail-on-missing-input-member-name.json (0 => 163918)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/replay/scripts/tests/fail-on-missing-input-member-name.json         (rev 0)
+++ trunk/Source/JavaScriptCore/replay/scripts/tests/fail-on-missing-input-member-name.json        2014-02-12 00:22:01 UTC (rev 163918)
</span><span class="lines">@@ -0,0 +1,20 @@
</span><ins>+{
+ "types": {
+ "Global": [
+ { "name": "double", "mode": "SCALAR" }
+ ]
+ },
+
+ "inputs": [
+ {
+ "name": "GetCurrentTime",
+ "description": "Supplies the system time to Date.now() and new Date().",
+ "queue": "SCRIPT_MEMOIZED",
+ "members": [
+ {
+ "type": "double"
+ }
+ ]
+ }
+ ]
+}
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCorereplayscriptstestsfailonmissinginputnamejson"></a>
<div class="addfile"><h4>Added: trunk/Source/JavaScriptCore/replay/scripts/tests/fail-on-missing-input-name.json (0 => 163918)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/replay/scripts/tests/fail-on-missing-input-name.json         (rev 0)
+++ trunk/Source/JavaScriptCore/replay/scripts/tests/fail-on-missing-input-name.json        2014-02-12 00:22:01 UTC (rev 163918)
</span><span class="lines">@@ -0,0 +1,20 @@
</span><ins>+{
+ "types": {
+ "Global": [
+ { "name": "double", "mode": "SCALAR" }
+ ]
+ },
+
+ "inputs": [
+ {
+ "description": "Supplies the system time to Date.now() and new Date().",
+ "queue": "SCRIPT_MEMOIZED",
+ "members": [
+ {
+ "name": "currentTime",
+ "type": "double"
+ }
+ ]
+ }
+ ]
+}
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCorereplayscriptstestsfailonmissinginputqueuejson"></a>
<div class="addfile"><h4>Added: trunk/Source/JavaScriptCore/replay/scripts/tests/fail-on-missing-input-queue.json (0 => 163918)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/replay/scripts/tests/fail-on-missing-input-queue.json         (rev 0)
+++ trunk/Source/JavaScriptCore/replay/scripts/tests/fail-on-missing-input-queue.json        2014-02-12 00:22:01 UTC (rev 163918)
</span><span class="lines">@@ -0,0 +1,20 @@
</span><ins>+{
+ "types": {
+ "Global": [
+ { "name": "double", "mode": "SCALAR" }
+ ]
+ },
+
+ "inputs": [
+ {
+ "name": "GetCurrentTime",
+ "description": "Supplies the system time to Date.now() and new Date().",
+ "members": [
+ {
+ "name": "currentTime",
+ "type": "double"
+ }
+ ]
+ }
+ ]
+}
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCorereplayscriptstestsfailonmissingtypemodejson"></a>
<div class="addfile"><h4>Added: trunk/Source/JavaScriptCore/replay/scripts/tests/fail-on-missing-type-mode.json (0 => 163918)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/replay/scripts/tests/fail-on-missing-type-mode.json         (rev 0)
+++ trunk/Source/JavaScriptCore/replay/scripts/tests/fail-on-missing-type-mode.json        2014-02-12 00:22:01 UTC (rev 163918)
</span><span class="lines">@@ -0,0 +1,21 @@
</span><ins>+{
+ "types": {
+ "Global": [
+ { "name": "double" }
+ ]
+ },
+
+ "inputs": [
+ {
+ "name": "GetCurrentTime",
+ "description": "Supplies the system time to Date.now() and new Date().",
+ "queue": "SCRIPT_MEMOIZED",
+ "members": [
+ {
+ "name": "currentTime",
+ "type": "double"
+ }
+ ]
+ }
+ ]
+}
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCorereplayscriptstestsfailonmissingtypenamejson"></a>
<div class="addfile"><h4>Added: trunk/Source/JavaScriptCore/replay/scripts/tests/fail-on-missing-type-name.json (0 => 163918)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/replay/scripts/tests/fail-on-missing-type-name.json         (rev 0)
+++ trunk/Source/JavaScriptCore/replay/scripts/tests/fail-on-missing-type-name.json        2014-02-12 00:22:01 UTC (rev 163918)
</span><span class="lines">@@ -0,0 +1,21 @@
</span><ins>+{
+ "types": {
+ "Global": [
+ { "mode": "SCALAR" }
+ ]
+ },
+
+ "inputs": [
+ {
+ "name": "GetCurrentTime",
+ "description": "Supplies the system time to Date.now() and new Date().",
+ "queue": "SCRIPT_MEMOIZED",
+ "members": [
+ {
+ "name": "currentTime",
+ "type": "double"
+ }
+ ]
+ }
+ ]
+}
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCorereplayscriptstestsfailonnoinputsjson"></a>
<div class="addfile"><h4>Added: trunk/Source/JavaScriptCore/replay/scripts/tests/fail-on-no-inputs.json (0 => 163918)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/replay/scripts/tests/fail-on-no-inputs.json         (rev 0)
+++ trunk/Source/JavaScriptCore/replay/scripts/tests/fail-on-no-inputs.json        2014-02-12 00:22:01 UTC (rev 163918)
</span><span class="lines">@@ -0,0 +1,7 @@
</span><ins>+{
+ "types": {
+ "Global": [
+ { "name": "double", "mode": "SCALAR" }
+ ]
+ }
+}
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCorereplayscriptstestsfailonnotypesjson"></a>
<div class="addfile"><h4>Added: trunk/Source/JavaScriptCore/replay/scripts/tests/fail-on-no-types.json (0 => 163918)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/replay/scripts/tests/fail-on-no-types.json         (rev 0)
+++ trunk/Source/JavaScriptCore/replay/scripts/tests/fail-on-no-types.json        2014-02-12 00:22:01 UTC (rev 163918)
</span><span class="lines">@@ -0,0 +1,15 @@
</span><ins>+{
+ "inputs": [
+ {
+ "name": "GetCurrentTime",
+ "description": "Supplies the system time to Date.now() and new Date().",
+ "queue": "SCRIPT_MEMOIZED",
+ "members": [
+ {
+ "name": "currentTime",
+ "type": "double"
+ }
+ ]
+ }
+ ]
+ }
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCorereplayscriptstestsfailonunknowninputqueuejson"></a>
<div class="addfile"><h4>Added: trunk/Source/JavaScriptCore/replay/scripts/tests/fail-on-unknown-input-queue.json (0 => 163918)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/replay/scripts/tests/fail-on-unknown-input-queue.json         (rev 0)
+++ trunk/Source/JavaScriptCore/replay/scripts/tests/fail-on-unknown-input-queue.json        2014-02-12 00:22:01 UTC (rev 163918)
</span><span class="lines">@@ -0,0 +1,21 @@
</span><ins>+{
+ "types": {
+ "Global": [
+ { "name": "double", "mode": "SCALAR" }
+ ]
+ },
+
+ "inputs": [
+ {
+ "name": "GetCurrentTime",
+ "description": "Supplies the system time to Date.now() and new Date().",
+ "queue": "SCRIPT_MEOIZED",
+ "members": [
+ {
+ "name": "currentTime",
+ "type": "double"
+ }
+ ]
+ }
+ ]
+}
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCorereplayscriptstestsfailonunknownmembertypejson"></a>
<div class="addfile"><h4>Added: trunk/Source/JavaScriptCore/replay/scripts/tests/fail-on-unknown-member-type.json (0 => 163918)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/replay/scripts/tests/fail-on-unknown-member-type.json         (rev 0)
+++ trunk/Source/JavaScriptCore/replay/scripts/tests/fail-on-unknown-member-type.json        2014-02-12 00:22:01 UTC (rev 163918)
</span><span class="lines">@@ -0,0 +1,21 @@
</span><ins>+{
+ "types": {
+ "Global": [
+ { "name": "uint64_t", "mode": "SCALAR" }
+ ]
+ },
+
+ "inputs": [
+ {
+ "name": "SetRandomSeed",
+ "description": "Sets the PRNG seed used by Math.random().",
+ "queue": "SCRIPT_MEMOIZED",
+ "members": [
+ {
+ "name": "randomSeed",
+ "type": "double"
+ }
+ ]
+ }
+ ]
+}
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCorereplayscriptstestsfailonunknowntypemodejson"></a>
<div class="addfile"><h4>Added: trunk/Source/JavaScriptCore/replay/scripts/tests/fail-on-unknown-type-mode.json (0 => 163918)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/replay/scripts/tests/fail-on-unknown-type-mode.json         (rev 0)
+++ trunk/Source/JavaScriptCore/replay/scripts/tests/fail-on-unknown-type-mode.json        2014-02-12 00:22:01 UTC (rev 163918)
</span><span class="lines">@@ -0,0 +1,21 @@
</span><ins>+{
+ "types": {
+ "Global": [
+ { "name": "double", "mode": "BONKERS" }
+ ]
+ },
+
+ "inputs": [
+ {
+ "name": "GetCurrentTime",
+ "description": "Supplies the system time to Date.now() and new Date().",
+ "queue": "SCRIPT_MEMOIZED",
+ "members": [
+ {
+ "name": "currentTime",
+ "type": "double"
+ }
+ ]
+ }
+ ]
+}
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCorereplayscriptstestsgenerateenumencodinghelperswithguardedvaluesjson"></a>
<div class="addfile"><h4>Added: trunk/Source/JavaScriptCore/replay/scripts/tests/generate-enum-encoding-helpers-with-guarded-values.json (0 => 163918)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/replay/scripts/tests/generate-enum-encoding-helpers-with-guarded-values.json         (rev 0)
+++ trunk/Source/JavaScriptCore/replay/scripts/tests/generate-enum-encoding-helpers-with-guarded-values.json        2014-02-12 00:22:01 UTC (rev 163918)
</span><span class="lines">@@ -0,0 +1,27 @@
</span><ins>+{
+ "types": {
+ "WebCore": [
+ {
+ "name": "MouseButton", "mode": "SCALAR", "storage": "unsigned",
+ "flags": ["ENUM"],
+ "values": ["NoButton", "LeftButton", "MiddleButton", "RightButton"],
+ "guarded_values": {
+ "ENABLE(SIDE_BUTTONS)": ["LeftSideButton", "RightSideButton"],
+ "PLATFORM(WINDOWS)": ["WindowsButton"]
+ },
+ "header": "platform/PlatformMouseEvent.h"
+ }
+ ]
+ },
+
+ "inputs": [
+ {
+ "name": "SavedMouseButton",
+ "description": "Supplies a mouse button enum value.",
+ "queue": "SCRIPT_MEMOIZED",
+ "members": [
+ { "name": "button", "type": "MouseButton" }
+ ]
+ }
+ ]
+}
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCorereplayscriptstestsgenerateenumencodinghelpersjson"></a>
<div class="addfile"><h4>Added: trunk/Source/JavaScriptCore/replay/scripts/tests/generate-enum-encoding-helpers.json (0 => 163918)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/replay/scripts/tests/generate-enum-encoding-helpers.json         (rev 0)
+++ trunk/Source/JavaScriptCore/replay/scripts/tests/generate-enum-encoding-helpers.json        2014-02-12 00:22:01 UTC (rev 163918)
</span><span class="lines">@@ -0,0 +1,31 @@
</span><ins>+{
+ "types": {
+ "JavaScriptCore": [
+ {
+ "name": "InputQueue", "mode": "SCALAR",
+ "flags": ["ENUM_CLASS"],
+ "values": ["EventLoopInput", "LoaderMemoizedData", "ScriptMemoizedData"],
+ "header": "replay/NondeterministicInput.h"
+ }
+ ],
+ "WebCore": [
+ {
+ "name": "MouseButton", "mode": "SCALAR", "storage": "unsigned",
+ "flags": ["ENUM"],
+ "values": ["NoButton", "LeftButton", "MiddleButton", "RightButton"],
+ "header": "platform/PlatformMouseEvent.h"
+ }
+ ]
+ },
+
+ "inputs": [
+ {
+ "name": "SavedMouseButton",
+ "description": "Supplies a mouse button enum value.",
+ "queue": "SCRIPT_MEMOIZED",
+ "members": [
+ { "name": "button", "type": "MouseButton" }
+ ]
+ }
+ ]
+}
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCorereplayscriptstestsgenerateeventloopshapetypesjson"></a>
<div class="addfile"><h4>Added: trunk/Source/JavaScriptCore/replay/scripts/tests/generate-event-loop-shape-types.json (0 => 163918)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/replay/scripts/tests/generate-event-loop-shape-types.json         (rev 0)
+++ trunk/Source/JavaScriptCore/replay/scripts/tests/generate-event-loop-shape-types.json        2014-02-12 00:22:01 UTC (rev 163918)
</span><span class="lines">@@ -0,0 +1,36 @@
</span><ins>+{
+ "types": {
+ "Global": [
+ { "name": "ScalarType", "mode": "SCALAR" },
+ { "name": "MapType", "mode": "MAP" },
+ { "name": "SharedMapType", "mode": "SHARED_MAP" }
+ ]
+ },
+
+ "inputs": [
+ {
+ "name": "ScalarInput",
+ "description": "",
+ "queue": "EVENT_LOOP",
+ "members": [
+ { "name": "data", "type": "ScalarType" }
+ ]
+ },
+ {
+ "name": "MapInput",
+ "description": "",
+ "queue": "EVENT_LOOP",
+ "members": [
+ { "name": "data", "type": "MapType" }
+ ]
+ },
+ {
+ "name": "SharedMapInput",
+ "description": "",
+ "queue": "EVENT_LOOP",
+ "members": [
+ { "name": "data", "type": "SharedMapType" }
+ ]
+ }
+ ]
+}
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCorereplayscriptstestsgenerateinputwithguardjson"></a>
<div class="addfile"><h4>Added: trunk/Source/JavaScriptCore/replay/scripts/tests/generate-input-with-guard.json (0 => 163918)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/replay/scripts/tests/generate-input-with-guard.json         (rev 0)
+++ trunk/Source/JavaScriptCore/replay/scripts/tests/generate-input-with-guard.json        2014-02-12 00:22:01 UTC (rev 163918)
</span><span class="lines">@@ -0,0 +1,28 @@
</span><ins>+{
+ "types": {
+ "Global": [
+ { "name": "double", "mode": "SCALAR" },
+ { "name": "uint64_t", "mode": "SCALAR" }
+ ]
+ },
+
+ "inputs": [
+ {
+ "name": "GetCurrentTime",
+ "description": "Supplies the system time to Date.now() and new Date().",
+ "queue": "SCRIPT_MEMOIZED",
+ "guard": "ENABLE(DUMMY_FEATURE)",
+ "members": [
+ { "name": "currentTime", "type": "double" }
+ ]
+ },
+ {
+ "name": "SetRandomSeed",
+ "description": "Sets the PRNG seed used by Math.random().",
+ "queue": "SCRIPT_MEMOIZED",
+ "members": [
+ {"name": "randomSeed", "type": "uint64_t" }
+ ]
+ }
+ ]
+}
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCorereplayscriptstestsgenerateinputwithvectormembersjson"></a>
<div class="addfile"><h4>Added: trunk/Source/JavaScriptCore/replay/scripts/tests/generate-input-with-vector-members.json (0 => 163918)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/replay/scripts/tests/generate-input-with-vector-members.json         (rev 0)
+++ trunk/Source/JavaScriptCore/replay/scripts/tests/generate-input-with-vector-members.json        2014-02-12 00:22:01 UTC (rev 163918)
</span><span class="lines">@@ -0,0 +1,28 @@
</span><ins>+{
+ "types": {
+ "Global": [
+ { "name": "double", "mode": "SCALAR" }
+ ],
+
+ "JavaScriptCore": [
+ { "name": "JSThing", "mode": "SCALAR", "header": "things/JSThing.h" }
+ ],
+
+ "WebCore": [
+ { "name": "WebThing", "mode": "SCALAR", "header": "things/WebThing.h" }
+ ]
+ },
+
+ "inputs": [
+ {
+ "name": "ArrayOfThings",
+ "description": "Supplies arrays of things.",
+ "queue": "SCRIPT_MEMOIZED",
+ "members": [
+ { "name": "doubles", "type": "double", "flags": ["VECTOR"] },
+ { "name": "jsthings", "type": "JSThing", "flags": ["VECTOR"] },
+ { "name": "webthings", "type": "WebThing", "flags": ["VECTOR"] }
+ ]
+ }
+ ]
+}
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCorereplayscriptstestsgenerateinputswithflagsjson"></a>
<div class="addfile"><h4>Added: trunk/Source/JavaScriptCore/replay/scripts/tests/generate-inputs-with-flags.json (0 => 163918)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/replay/scripts/tests/generate-inputs-with-flags.json         (rev 0)
+++ trunk/Source/JavaScriptCore/replay/scripts/tests/generate-inputs-with-flags.json        2014-02-12 00:22:01 UTC (rev 163918)
</span><span class="lines">@@ -0,0 +1,27 @@
</span><ins>+{
+ "types": {
+ "Global": [
+ { "name": "ScalarType", "mode": "SCALAR" }
+ ]
+ },
+
+ "inputs": [
+ {
+ "name": "ScalarInput1",
+ "description": "",
+ "queue": "SCRIPT_MEMOIZED",
+ "members": [
+ { "name": "data", "type": "ScalarType" }
+ ]
+ },
+ {
+ "name": "ScalarInput2",
+ "description": "",
+ "queue": "SCRIPT_MEMOIZED",
+ "flags": ["CREATE_FROM_PAGE"],
+ "members": [
+ { "name": "data", "type": "ScalarType" }
+ ]
+ }
+ ]
+}
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCorereplayscriptstestsgeneratememoizedtypemodesjson"></a>
<div class="addfile"><h4>Added: trunk/Source/JavaScriptCore/replay/scripts/tests/generate-memoized-type-modes.json (0 => 163918)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/replay/scripts/tests/generate-memoized-type-modes.json         (rev 0)
+++ trunk/Source/JavaScriptCore/replay/scripts/tests/generate-memoized-type-modes.json        2014-02-12 00:22:01 UTC (rev 163918)
</span><span class="lines">@@ -0,0 +1,27 @@
</span><ins>+{
+ "types": {
+ "Global": [
+ { "name": "ScalarType", "mode": "SCALAR" },
+ { "name": "MapType", "mode": "OWNED" }
+ ]
+ },
+
+ "inputs": [
+ {
+ "name": "ScalarInput",
+ "description": "",
+ "queue": "SCRIPT_MEMOIZED",
+ "members": [
+ { "name": "data", "type": "ScalarType" }
+ ]
+ },
+ {
+ "name": "MapInput",
+ "description": "",
+ "queue": "SCRIPT_MEMOIZED",
+ "members": [
+ { "name": "data", "type": "MapType" }
+ ]
+ }
+ ]
+}
</ins></span></pre></div>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (163917 => 163918)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog        2014-02-12 00:08:16 UTC (rev 163917)
+++ trunk/Tools/ChangeLog        2014-02-12 00:22:01 UTC (rev 163918)
</span><span class="lines">@@ -1,3 +1,26 @@
</span><ins>+2014-02-11 Brian Burg <bburg@apple.com>
+
+ Web Replay: upstream replay input code generator and EncodedValue class
+ https://bugs.webkit.org/show_bug.cgi?id=128215
+
+ Reviewed by Joseph Pecoraro.
+
+ Add an executable script to launch the replay input generator tests.
+ Add a test harness for running the code generator tests, mostly taken
+ from the bindings test harness (but simplified).
+
+ * Scripts/run-input-generator-tests: Added.
+ (main):
+ * Scripts/webkitpy/replay/__init__.py: Added.
+ * Scripts/webkitpy/replay/main.py: Added.
+ (InputGeneratorTests):
+ (InputGeneratorTests.__init__):
+ (InputGeneratorTests.generate_from_json):
+ (InputGeneratorTests.write_error_file):
+ (InputGeneratorTests.detect_changes):
+ (InputGeneratorTests.run_tests):
+ (InputGeneratorTests.main):
+
</ins><span class="cx"> 2014-02-11 James Craig <jcraig@apple.com>
</span><span class="cx">
</span><span class="cx"> Web Inspector: AX: Accessibility Node Inspection
</span></span></pre></div>
<a id="trunkToolsScriptsruninputgeneratortests"></a>
<div class="addfile"><h4>Added: trunk/Tools/Scripts/run-input-generator-tests (0 => 163918)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/Scripts/run-input-generator-tests         (rev 0)
+++ trunk/Tools/Scripts/run-input-generator-tests        2014-02-12 00:22:01 UTC (rev 163918)
</span><span class="lines">@@ -0,0 +1,43 @@
</span><ins>+#!/usr/bin/env python
+# Copyright (C) 2014 Apple Inc. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+# IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+import sys
+from webkitpy.common.system import executive
+
+def main(argv):
+ """Runs replay input code generator on test specification files and compares
+ the results with reference files.
+
+ Options:
+ --reset-results: Overwrites the reference files with the generated results.
+
+ """
+ reset_results = "--reset-results" in argv
+
+ from webkitpy.replay.main import InputGeneratorTests
+ return InputGeneratorTests(reset_results, executive.Executive()).main()
+
+if __name__ == '__main__':
+ sys.exit(main(sys.argv))
</ins><span class="cx">Property changes on: trunk/Tools/Scripts/run-input-generator-tests
</span><span class="cx">___________________________________________________________________
</span></span></pre></div>
<a id="svnexecutable"></a>
<div class="addfile"><h4>Added: svn:executable</h4></div>
<a id="trunkToolsScriptswebkitpyreplay__init__py"></a>
<div class="addfile"><h4>Added: trunk/Tools/Scripts/webkitpy/replay/__init__.py (0 => 163918)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/Scripts/webkitpy/replay/__init__.py         (rev 0)
+++ trunk/Tools/Scripts/webkitpy/replay/__init__.py        2014-02-12 00:22:01 UTC (rev 163918)
</span><span class="lines">@@ -0,0 +1 @@
</span><ins>+# Required for Python to search this directory for module files
</ins></span></pre></div>
<a id="trunkToolsScriptswebkitpyreplaymainpy"></a>
<div class="addfile"><h4>Added: trunk/Tools/Scripts/webkitpy/replay/main.py (0 => 163918)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/Scripts/webkitpy/replay/main.py         (rev 0)
+++ trunk/Tools/Scripts/webkitpy/replay/main.py        2014-02-12 00:22:01 UTC (rev 163918)
</span><span class="lines">@@ -0,0 +1,134 @@
</span><ins>+# Copyright (C) 2011 Google Inc. All rights reserved.
+# Copyright (C) 2014 Apple Inc. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+# IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+import os
+import os.path
+import shutil
+import sys
+import tempfile
+from webkitpy.common.checkout.scm.detection import detect_scm_system
+from webkitpy.common.system.executive import ScriptError
+
+
+class InputGeneratorTests:
+
+ def __init__(self, reset_results, executive):
+ self.reset_results = reset_results
+ self.executive = executive
+
+ def generate_from_json(self, json_file, output_directory):
+ cmd = ['python',
+ 'JavaScriptCore/replay/scripts/CodeGeneratorReplayInputs.py',
+ '--outputDir', output_directory,
+ '--force',
+ '--framework', 'Test',
+ '--test',
+ json_file]
+
+ exit_code = 0
+ try:
+ stderr_output = self.executive.run_command(cmd)
+ if stderr_output:
+ self.write_error_file(json_file, output_directory, stderr_output)
+ except ScriptError, e:
+ print e.output
+ exit_code = e.exit_code
+ return exit_code
+
+ def write_error_file(self, input_filepath, output_directory, error_output):
+ output_filepath = os.path.join(output_directory, os.path.basename(input_filepath) + '-error')
+
+ with open(output_filepath, "w") as output_file:
+ output_file.write(error_output)
+
+ def detect_changes(self, work_directory, reference_directory):
+ changes_found = False
+ for output_file in os.listdir(work_directory):
+ cmd = ['diff',
+ '-u',
+ '-N',
+ os.path.join(reference_directory, output_file),
+ os.path.join(work_directory, output_file)]
+
+ exit_code = 0
+ try:
+ output = self.executive.run_command(cmd)
+ except ScriptError, e:
+ output = e.output
+ exit_code = e.exit_code
+
+ if exit_code or output:
+ print 'FAIL: %s' % output_file
+ print output
+ changes_found = True
+ else:
+ print 'PASS: %s' % output_file
+ return changes_found
+
+ def run_tests(self, input_directory, reference_directory):
+ work_directory = reference_directory
+
+ passed = True
+ for input_file in os.listdir(input_directory):
+ (name, extension) = os.path.splitext(input_file)
+ if extension != '.json':
+ continue
+ # Generate output into the work directory (either the given one or a
+ # temp one if not reset_results is performed)
+ if not self.reset_results:
+ work_directory = tempfile.mkdtemp()
+
+ if self.generate_from_json(os.path.join(input_directory, input_file), work_directory):
+ passed = False
+
+ if self.reset_results:
+ print "Reset results for test: %s" % (input_file)
+ continue
+
+ # Detect changes
+ if self.detect_changes(work_directory, reference_directory):
+ passed = False
+ shutil.rmtree(work_directory)
+
+ return passed
+
+ def main(self):
+ current_scm = detect_scm_system(os.curdir)
+ os.chdir(os.path.join(current_scm.checkout_root, 'Source'))
+
+ all_tests_passed = True
+
+ input_directory = os.path.join('JavaScriptCore', 'replay', 'scripts', 'tests')
+ reference_directory = os.path.join('JavaScriptCore', 'replay', 'scripts', 'tests', 'expected')
+ if not self.run_tests(input_directory, reference_directory):
+ all_tests_passed = False
+
+ print ''
+ if all_tests_passed:
+ print 'All tests PASS!'
+ return 0
+ else:
+ print 'Some tests FAIL! (To update the reference files, execute "run-input-generator-tests --reset-results")'
+ return -1
</ins></span></pre>
</div>
</div>
</body>
</html>