[JSC] Introduce BytecodeIntrinsic constant rep like @undefined
authorutatane.tea@gmail.com <utatane.tea@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 2 Feb 2016 19:33:05 +0000 (19:33 +0000)
committerutatane.tea@gmail.com <utatane.tea@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 2 Feb 2016 19:33:05 +0000 (19:33 +0000)
commit0b9969da1fd660a3d40bcff6e3ad70a66fe6f614
tree0d26777aa51bffb3e15c526d0b544b62adf9142f
parentcbda4343586a235e86e0464a347ea2a3d4f1c0d3
[JSC] Introduce BytecodeIntrinsic constant rep like @undefined
https://bugs.webkit.org/show_bug.cgi?id=153737

Reviewed by Darin Adler.

Source/JavaScriptCore:

This patch enhances existing BytecodeIntrinsic mechanism to accept `@xxx` form,
that will be used to represent bytecode intrinsic constants.
After this change, we can use 2 forms for bytecode intrinsics. (1) Function form (like, @toString(value))
and (2) Constant form (like @undefined).

Bytecode intrinsic constants allow us to easily expose constant values from C++ world.
For example, we can expose ArrayIterationKind flags to JS world without using private global variables.
Exposed constant values are loaded from bytecodes directly through constant registers.
While previously we expose them through private global variables, bytecode intrinsic constants
can be loaded directly from CodeBlock. And later, it will become JSConstant in DFG.

And by using this mechanism, we implement several constants. @undefined, @arrayIterationKindKeyValue etc.

* builtins/ArrayConstructor.js:
(from):
* builtins/ArrayIteratorPrototype.js:
(next):
* builtins/ArrayPrototype.js:
(reduce):
(reduceRight):
(every):
(forEach):
(filter):
(map):
(some):
(fill):
(find):
(findIndex):
(includes):
(sort.compactSparse):
(sort.compactSlow):
(sort.compact):
(sort):
(copyWithin):
* builtins/DatePrototype.js:
(toLocaleString.toDateTimeOptionsAnyAll):
(toLocaleString):
(toLocaleDateString.toDateTimeOptionsDateDate):
(toLocaleDateString):
(toLocaleTimeString.toDateTimeOptionsTimeTime):
(toLocaleTimeString):
* builtins/GeneratorPrototype.js:
(generatorResume):
* builtins/GlobalObject.js:
(isDictionary):
* builtins/InternalPromiseConstructor.js:
(internalAll.newResolveElement):
(internalAll):
* builtins/IteratorPrototype.js:
(symbolIteratorGetter):
(symbolIterator): Deleted.
* builtins/MapPrototype.js:
(forEach):
* builtins/ModuleLoaderObject.js:
(newRegistryEntry):
(forceFulfillPromise):
(commitInstantiated):
(requestFetch):
(requestTranslate):
(requestInstantiate):
(requestLink):
(provide):
* builtins/PromiseConstructor.js:
(all.newResolveElement):
(all):
(race):
(reject):
(resolve):
* builtins/PromiseOperations.js:
(newPromiseCapability.executor):
(newPromiseCapability):
(rejectPromise):
(fulfillPromise):
(createResolvingFunctions.resolve):
(createResolvingFunctions.reject):
(createResolvingFunctions):
(promiseReactionJob):
(promiseResolveThenableJob):
(initializePromise):
* builtins/PromisePrototype.js:
(catch):
(then):
* builtins/SetPrototype.js:
(forEach):
* builtins/StringConstructor.js:
(raw):
* builtins/StringIteratorPrototype.js:
(next):
* builtins/StringPrototype.js:
(localeCompare):
* builtins/TypedArrayConstructor.js:
(of):
(from):
* builtins/TypedArrayPrototype.js:
(every):
(find):
(findIndex):
(forEach):
(some):
(reduce):
(reduceRight):
(map):
(filter):
* bytecode/BytecodeIntrinsicRegistry.cpp:
(JSC::BytecodeIntrinsicRegistry::BytecodeIntrinsicRegistry):
(JSC::BytecodeIntrinsicRegistry::lookup):
* bytecode/BytecodeIntrinsicRegistry.h:
* bytecompiler/NodesCodegen.cpp:
* parser/ASTBuilder.h:
(JSC::ASTBuilder::createResolve):
(JSC::ASTBuilder::makeFunctionCallNode):
* parser/NodeConstructors.h:
(JSC::BytecodeIntrinsicNode::BytecodeIntrinsicNode):
* parser/Nodes.h:
(JSC::ExpressionNode::isBytecodeIntrinsicNode):
(JSC::BytecodeIntrinsicNode::type):
(JSC::BytecodeIntrinsicNode::emitter):
* parser/Parser.cpp:
(JSC::Parser<LexerType>::parseProperty):
(JSC::Parser<LexerType>::parsePrimaryExpression):
* parser/SyntaxChecker.h:
(JSC::SyntaxChecker::createResolve):
* runtime/CommonIdentifiers.cpp:
(JSC::CommonIdentifiers::CommonIdentifiers): Deleted.
* runtime/CommonIdentifiers.h:
(JSC::CommonIdentifiers::bytecodeIntrinsicRegistry): Deleted.
* runtime/IteratorPrototype.cpp:
(JSC::IteratorPrototype::finishCreation):
* runtime/JSGlobalObject.cpp:
(JSC::JSGlobalObject::init): Deleted.
* runtime/VM.cpp:
(JSC::VM::VM):
* runtime/VM.h:
(JSC::VM::bytecodeIntrinsicRegistry):

Source/WebCore:

* Modules/fetch/FetchHeaders.js:
(initializeFetchHeaders):
* Modules/streams/ReadableStream.js:
(initializeReadableStream):
(closeDestination):
(abortDestination):
(pipeTo):
* Modules/streams/ReadableStreamInternals.js:
(privateInitializeReadableStreamController):
(teeReadableStream):
(isReadableStreamReader):
(errorReadableStream):
(finishClosingReadableStream):
(enqueueInReadableStream):
(readFromReadableStreamReader):
* Modules/streams/ReadableStreamReader.js:
(releaseLock):
* Modules/streams/StreamInternals.js:
(shieldingPromiseResolve):
(promiseInvokeOrNoopNoCatch):
(promiseInvokeOrFallbackOrNoop):
(validateAndNormalizeQueuingStrategy):
* Modules/streams/WritableStream.js:
(initializeWritableStream):
(write):
* Modules/streams/WritableStreamInternals.js:
(errorWritableStream):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@196022 268f45cc-cd09-0410-ab3c-d52691b4dbfc
42 files changed:
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/builtins/ArrayConstructor.js
Source/JavaScriptCore/builtins/ArrayIteratorPrototype.js
Source/JavaScriptCore/builtins/ArrayPrototype.js
Source/JavaScriptCore/builtins/DatePrototype.js
Source/JavaScriptCore/builtins/GeneratorPrototype.js
Source/JavaScriptCore/builtins/GlobalObject.js
Source/JavaScriptCore/builtins/InternalPromiseConstructor.js
Source/JavaScriptCore/builtins/IteratorPrototype.js
Source/JavaScriptCore/builtins/MapPrototype.js
Source/JavaScriptCore/builtins/ModuleLoaderObject.js
Source/JavaScriptCore/builtins/PromiseConstructor.js
Source/JavaScriptCore/builtins/PromiseOperations.js
Source/JavaScriptCore/builtins/PromisePrototype.js
Source/JavaScriptCore/builtins/SetPrototype.js
Source/JavaScriptCore/builtins/StringConstructor.js
Source/JavaScriptCore/builtins/StringIteratorPrototype.js
Source/JavaScriptCore/builtins/StringPrototype.js
Source/JavaScriptCore/builtins/TypedArrayConstructor.js
Source/JavaScriptCore/builtins/TypedArrayPrototype.js
Source/JavaScriptCore/bytecode/BytecodeIntrinsicRegistry.cpp
Source/JavaScriptCore/bytecode/BytecodeIntrinsicRegistry.h
Source/JavaScriptCore/bytecompiler/NodesCodegen.cpp
Source/JavaScriptCore/parser/ASTBuilder.h
Source/JavaScriptCore/parser/NodeConstructors.h
Source/JavaScriptCore/parser/Nodes.h
Source/JavaScriptCore/parser/Parser.cpp
Source/JavaScriptCore/parser/SyntaxChecker.h
Source/JavaScriptCore/runtime/CommonIdentifiers.cpp
Source/JavaScriptCore/runtime/CommonIdentifiers.h
Source/JavaScriptCore/runtime/IteratorPrototype.cpp
Source/JavaScriptCore/runtime/JSGlobalObject.cpp
Source/JavaScriptCore/runtime/VM.cpp
Source/JavaScriptCore/runtime/VM.h
Source/WebCore/ChangeLog
Source/WebCore/Modules/fetch/FetchHeaders.js
Source/WebCore/Modules/streams/ReadableStream.js
Source/WebCore/Modules/streams/ReadableStreamInternals.js
Source/WebCore/Modules/streams/ReadableStreamReader.js
Source/WebCore/Modules/streams/StreamInternals.js
Source/WebCore/Modules/streams/WritableStream.js
Source/WebCore/Modules/streams/WritableStreamInternals.js