diff
stringlengths
41
2.03M
msg
stringlengths
1
1.5k
repo
stringlengths
5
40
sha
stringlengths
40
40
time
stringlengths
20
20
mmm a / library . json <nl> ppp b / library . json <nl> <nl> " keywords " : " unittest , unit , test , gtest , gmock " , <nl> " description " : " googletest is a testing framework developed by the Testing Technology team with Google ' s specific requirements and constraints in mind . No matter whether you work on Linux , Windows , or a Mac , if you write C + + code , googletest can help you . And it supports any kind of tests , not just unit tests . " , <nl> " license " : " BSD - 3 - Clause " , <nl> - " homepage " : " https : / / github . com / abseil / googletest / blob / master / README . md " , <nl> + " homepage " : " https : / / github . com / google / googletest / blob / master / README . md " , <nl> " repository " : { <nl> " type " : " git " , <nl> - " url " : " https : / / github . com / abseil / googletest . git " <nl> + " url " : " https : / / github . com / google / googletest . git " <nl> } , <nl> " version " : " 1 . 8 . 1 " , <nl> " exclude " : [ <nl>
fix : Correct GitHub paths
google/googletest
c0ef2cbe42dff0e71ade937c54e12cd93f11ca52
2018-12-21T18:44:54Z
mmm a / documentation / sphinx / source / downloads . rst <nl> ppp b / documentation / sphinx / source / downloads . rst <nl> macOS <nl> <nl> The macOS installation package is supported on macOS 10 . 7 + . It includes the client and ( optionally ) the server . <nl> <nl> - * ` FoundationDB - 6 . 1 . 11 . pkg < https : / / www . foundationdb . org / downloads / 6 . 1 . 11 / macOS / installers / FoundationDB - 6 . 1 . 11 . pkg > ` _ <nl> + * ` FoundationDB - 6 . 1 . 12 . pkg < https : / / www . foundationdb . org / downloads / 6 . 1 . 12 / macOS / installers / FoundationDB - 6 . 1 . 12 . pkg > ` _ <nl> <nl> Ubuntu <nl> mmmmmm <nl> <nl> The Ubuntu packages are supported on 64 - bit Ubuntu 12 . 04 + , but beware of the Linux kernel bug in Ubuntu 12 . x . <nl> <nl> - * ` foundationdb - clients - 6 . 1 . 11 - 1_amd64 . deb < https : / / www . foundationdb . org / downloads / 6 . 1 . 11 / ubuntu / installers / foundationdb - clients_6 . 1 . 11 - 1_amd64 . deb > ` _ <nl> - * ` foundationdb - server - 6 . 1 . 11 - 1_amd64 . deb < https : / / www . foundationdb . org / downloads / 6 . 1 . 11 / ubuntu / installers / foundationdb - server_6 . 1 . 11 - 1_amd64 . deb > ` _ ( depends on the clients package ) <nl> + * ` foundationdb - clients - 6 . 1 . 12 - 1_amd64 . deb < https : / / www . foundationdb . org / downloads / 6 . 1 . 12 / ubuntu / installers / foundationdb - clients_6 . 1 . 12 - 1_amd64 . deb > ` _ <nl> + * ` foundationdb - server - 6 . 1 . 12 - 1_amd64 . deb < https : / / www . foundationdb . org / downloads / 6 . 1 . 12 / ubuntu / installers / foundationdb - server_6 . 1 . 12 - 1_amd64 . deb > ` _ ( depends on the clients package ) <nl> <nl> RHEL / CentOS EL6 <nl> mmmmmmmmmmmmmmm <nl> <nl> The RHEL / CentOS EL6 packages are supported on 64 - bit RHEL / CentOS 6 . x . <nl> <nl> - * ` foundationdb - clients - 6 . 1 . 11 - 1 . el6 . x86_64 . rpm < https : / / www . foundationdb . org / downloads / 6 . 1 . 11 / rhel6 / installers / foundationdb - clients - 6 . 1 . 11 - 1 . el6 . x86_64 . rpm > ` _ <nl> - * ` foundationdb - server - 6 . 1 . 11 - 1 . el6 . x86_64 . rpm < https : / / www . foundationdb . org / downloads / 6 . 1 . 11 / rhel6 / installers / foundationdb - server - 6 . 1 . 11 - 1 . el6 . x86_64 . rpm > ` _ ( depends on the clients package ) <nl> + * ` foundationdb - clients - 6 . 1 . 12 - 1 . el6 . x86_64 . rpm < https : / / www . foundationdb . org / downloads / 6 . 1 . 12 / rhel6 / installers / foundationdb - clients - 6 . 1 . 12 - 1 . el6 . x86_64 . rpm > ` _ <nl> + * ` foundationdb - server - 6 . 1 . 12 - 1 . el6 . x86_64 . rpm < https : / / www . foundationdb . org / downloads / 6 . 1 . 12 / rhel6 / installers / foundationdb - server - 6 . 1 . 12 - 1 . el6 . x86_64 . rpm > ` _ ( depends on the clients package ) <nl> <nl> RHEL / CentOS EL7 <nl> mmmmmmmmmmmmmmm <nl> <nl> The RHEL / CentOS EL7 packages are supported on 64 - bit RHEL / CentOS 7 . x . <nl> <nl> - * ` foundationdb - clients - 6 . 1 . 11 - 1 . el7 . x86_64 . rpm < https : / / www . foundationdb . org / downloads / 6 . 1 . 11 / rhel7 / installers / foundationdb - clients - 6 . 1 . 11 - 1 . el7 . x86_64 . rpm > ` _ <nl> - * ` foundationdb - server - 6 . 1 . 11 - 1 . el7 . x86_64 . rpm < https : / / www . foundationdb . org / downloads / 6 . 1 . 11 / rhel7 / installers / foundationdb - server - 6 . 1 . 11 - 1 . el7 . x86_64 . rpm > ` _ ( depends on the clients package ) <nl> + * ` foundationdb - clients - 6 . 1 . 12 - 1 . el7 . x86_64 . rpm < https : / / www . foundationdb . org / downloads / 6 . 1 . 12 / rhel7 / installers / foundationdb - clients - 6 . 1 . 12 - 1 . el7 . x86_64 . rpm > ` _ <nl> + * ` foundationdb - server - 6 . 1 . 12 - 1 . el7 . x86_64 . rpm < https : / / www . foundationdb . org / downloads / 6 . 1 . 12 / rhel7 / installers / foundationdb - server - 6 . 1 . 12 - 1 . el7 . x86_64 . rpm > ` _ ( depends on the clients package ) <nl> <nl> Windows <nl> mmmmmm - <nl> <nl> The Windows installer is supported on 64 - bit Windows XP and later . It includes the client and ( optionally ) the server . <nl> <nl> - * ` foundationdb - 6 . 1 . 11 - x64 . msi < https : / / www . foundationdb . org / downloads / 6 . 1 . 11 / windows / installers / foundationdb - 6 . 1 . 11 - x64 . msi > ` _ <nl> + * ` foundationdb - 6 . 1 . 12 - x64 . msi < https : / / www . foundationdb . org / downloads / 6 . 1 . 12 / windows / installers / foundationdb - 6 . 1 . 12 - x64 . msi > ` _ <nl> <nl> API Language Bindings <nl> = = = = = = = = = = = = = = = = = = = = = <nl> On macOS and Windows , the FoundationDB Python API bindings are installed as part <nl> <nl> If you need to use the FoundationDB Python API from other Python installations or paths , download the Python package : <nl> <nl> - * ` foundationdb - 6 . 1 . 11 . tar . gz < https : / / www . foundationdb . org / downloads / 6 . 1 . 11 / bindings / python / foundationdb - 6 . 1 . 11 . tar . gz > ` _ <nl> + * ` foundationdb - 6 . 1 . 12 . tar . gz < https : / / www . foundationdb . org / downloads / 6 . 1 . 12 / bindings / python / foundationdb - 6 . 1 . 12 . tar . gz > ` _ <nl> <nl> Ruby 1 . 9 . 3 / 2 . 0 . 0 + <nl> mmmmmmmmmmmmmmm - - <nl> <nl> - * ` fdb - 6 . 1 . 11 . gem < https : / / www . foundationdb . org / downloads / 6 . 1 . 11 / bindings / ruby / fdb - 6 . 1 . 11 . gem > ` _ <nl> + * ` fdb - 6 . 1 . 12 . gem < https : / / www . foundationdb . org / downloads / 6 . 1 . 12 / bindings / ruby / fdb - 6 . 1 . 12 . gem > ` _ <nl> <nl> Java 8 + <nl> mmmmmm - <nl> <nl> - * ` fdb - java - 6 . 1 . 11 . jar < https : / / www . foundationdb . org / downloads / 6 . 1 . 11 / bindings / java / fdb - java - 6 . 1 . 11 . jar > ` _ <nl> - * ` fdb - java - 6 . 1 . 11 - javadoc . jar < https : / / www . foundationdb . org / downloads / 6 . 1 . 11 / bindings / java / fdb - java - 6 . 1 . 11 - javadoc . jar > ` _ <nl> + * ` fdb - java - 6 . 1 . 12 . jar < https : / / www . foundationdb . org / downloads / 6 . 1 . 12 / bindings / java / fdb - java - 6 . 1 . 12 . jar > ` _ <nl> + * ` fdb - java - 6 . 1 . 12 - javadoc . jar < https : / / www . foundationdb . org / downloads / 6 . 1 . 12 / bindings / java / fdb - java - 6 . 1 . 12 - javadoc . jar > ` _ <nl> <nl> Go 1 . 1 + <nl> mmmmmm - <nl> mmm a / documentation / sphinx / source / release - notes . rst <nl> ppp b / documentation / sphinx / source / release - notes . rst <nl> Release Notes <nl> Fixes <nl> mmm - - <nl> <nl> - * Fixed thread safety issue while writing large keys or values . ` ( Issue # 1846 ) < https : / / github . com / apple / foundationdb / issues / 1846 > ` _ <nl> + * Fixed a thread safety issue while writing large keys or values . ` ( Issue # 1846 ) < https : / / github . com / apple / foundationdb / issues / 1846 > ` _ <nl> * An untracked data distributor could prevent a newly recruited data distributor from being started . ` ( PR # 1849 ) < https : / / github . com / apple / foundationdb / pull / 1849 > ` _ <nl> <nl> 6 . 1 . 11 <nl>
Merge pull request from etschannen / release - 6 . 1
apple/foundationdb
90ba203c166c62ae9173b2523081a0c6afaa1604
2019-07-24T02:32:45Z
mmm a / tensorflow / compiler / xla / g3doc / operation_semantics . md <nl> ppp b / tensorflow / compiler / xla / g3doc / operation_semantics . md <nl> Builds a constant literal on device rather than a potentially large host <nl> transfer . Creates a rank 1 array of values starting at zero and incrementing by <nl> one . <nl> <nl> - Arguments | Type | Semantics <nl> mmmmmmmmm - | mmmmmmmmmmmmmmm | mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm <nl> - ` type ` | ` PrimitiveType ` | type U <nl> - ` size ` | ` int64 ` | The number of elements in the array . <nl> + Arguments | Type | Semantics <nl> + mmmmmmmmmmmmmmm - | mmmmmmmmmmmmmmm | mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm <nl> + ` type ` | ` PrimitiveType ` | type U <nl> + ` size ` | ` int64 ` | The number of elements in the array . <nl> + ` iota_dimension ` | ` int64 ` | The dimension to increment along . <nl> <nl> # # Map <nl> <nl>
[ XLA ] Document the iota_dimension attribute for kIota
tensorflow/tensorflow
f5291176d424b05e96c9ebdc4a3f4965ff5f7a1a
2018-11-30T16:41:18Z
mmm a / src / wallet / rpcdump . cpp <nl> ppp b / src / wallet / rpcdump . cpp <nl> UniValue ProcessImport ( CWallet * const pwallet , const UniValue & data , const int6 <nl> pwallet - > SetAddressBook ( vchAddress , label , " receive " ) ; <nl> <nl> if ( pwallet - > HaveKey ( vchAddress ) ) { <nl> - return false ; <nl> + throw JSONRPCError ( RPC_WALLET_ERROR , " The wallet already contains the private key for this address or script " ) ; <nl> } <nl> <nl> pwallet - > mapKeyMetadata [ vchAddress ] . nCreateTime = timestamp ; <nl> mmm a / test / functional / importmulti . py <nl> ppp b / test / functional / importmulti . py <nl> def run_test ( self ) : <nl> assert_equal ( address_assert [ ' ismine ' ] , True ) <nl> assert_equal ( address_assert [ ' timestamp ' ] , timestamp ) <nl> <nl> + self . log . info ( " Should not import an address with private key if is already imported " ) <nl> + result = self . nodes [ 1 ] . importmulti ( [ { <nl> + " scriptPubKey " : { <nl> + " address " : address [ ' address ' ] <nl> + } , <nl> + " timestamp " : " now " , <nl> + " keys " : [ self . nodes [ 0 ] . dumpprivkey ( address [ ' address ' ] ) ] <nl> + } ] ) <nl> + assert_equal ( result [ 0 ] [ ' success ' ] , False ) <nl> + assert_equal ( result [ 0 ] [ ' error ' ] [ ' code ' ] , - 4 ) <nl> + assert_equal ( result [ 0 ] [ ' error ' ] [ ' message ' ] , ' The wallet already contains the private key for this address or script ' ) <nl> + <nl> # Address + Private key + watchonly <nl> self . log . info ( " Should not import an address with private key and with watchonly " ) <nl> address = self . nodes [ 0 ] . validateaddress ( self . nodes [ 0 ] . getnewaddress ( ) ) <nl>
Merge : Fix importmulti bug when importing an already imported key
bitcoin/bitcoin
808c84f89d0edcef9ddaab0b849a382719f6ec9e
2017-10-17T19:40:54Z
mmm a / CMakeLists . txt <nl> ppp b / CMakeLists . txt <nl> if ( gRPC_BUILD_TESTS ) <nl> if ( _gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_MAC OR _gRPC_PLATFORM_POSIX ) <nl> add_dependencies ( buildtests_cxx json_run_localhost ) <nl> endif ( ) <nl> - add_dependencies ( buildtests_cxx memory_test ) <nl> add_dependencies ( buildtests_cxx message_allocator_end2end_test ) <nl> add_dependencies ( buildtests_cxx metrics_client ) <nl> add_dependencies ( buildtests_cxx mock_test ) <nl> endif ( ) <nl> endif ( ) <nl> if ( gRPC_BUILD_TESTS ) <nl> <nl> - add_executable ( memory_test <nl> - test / core / gprpp / memory_test . cc <nl> - third_party / googletest / googletest / src / gtest - all . cc <nl> - third_party / googletest / googlemock / src / gmock - all . cc <nl> - ) <nl> - <nl> - target_include_directories ( memory_test <nl> - PRIVATE <nl> - $ { CMAKE_CURRENT_SOURCE_DIR } <nl> - $ { CMAKE_CURRENT_SOURCE_DIR } / include <nl> - $ { _gRPC_ADDRESS_SORTING_INCLUDE_DIR } <nl> - $ { _gRPC_SSL_INCLUDE_DIR } <nl> - $ { _gRPC_UPB_GENERATED_DIR } <nl> - $ { _gRPC_UPB_GRPC_GENERATED_DIR } <nl> - $ { _gRPC_UPB_INCLUDE_DIR } <nl> - $ { _gRPC_ZLIB_INCLUDE_DIR } <nl> - third_party / googletest / googletest / include <nl> - third_party / googletest / googletest <nl> - third_party / googletest / googlemock / include <nl> - third_party / googletest / googlemock <nl> - $ { _gRPC_PROTO_GENS_DIR } <nl> - ) <nl> - <nl> - target_link_libraries ( memory_test <nl> - $ { _gRPC_PROTOBUF_LIBRARIES } <nl> - $ { _gRPC_ALLTARGETS_LIBRARIES } <nl> - grpc_test_util <nl> - grpc + + <nl> - grpc <nl> - gpr <nl> - $ { _gRPC_GFLAGS_LIBRARIES } <nl> - ) <nl> - <nl> - <nl> - endif ( ) <nl> - if ( gRPC_BUILD_TESTS ) <nl> - <nl> add_executable ( message_allocator_end2end_test <nl> test / cpp / end2end / message_allocator_end2end_test . cc <nl> third_party / googletest / googletest / src / gtest - all . cc <nl> mmm a / Makefile <nl> ppp b / Makefile <nl> interop_client : $ ( BINDIR ) / $ ( CONFIG ) / interop_client <nl> interop_server : $ ( BINDIR ) / $ ( CONFIG ) / interop_server <nl> interop_test : $ ( BINDIR ) / $ ( CONFIG ) / interop_test <nl> json_run_localhost : $ ( BINDIR ) / $ ( CONFIG ) / json_run_localhost <nl> - memory_test : $ ( BINDIR ) / $ ( CONFIG ) / memory_test <nl> message_allocator_end2end_test : $ ( BINDIR ) / $ ( CONFIG ) / message_allocator_end2end_test <nl> metrics_client : $ ( BINDIR ) / $ ( CONFIG ) / metrics_client <nl> mock_test : $ ( BINDIR ) / $ ( CONFIG ) / mock_test <nl> buildtests_cxx : privatelibs_cxx \ <nl> $ ( BINDIR ) / $ ( CONFIG ) / interop_server \ <nl> $ ( BINDIR ) / $ ( CONFIG ) / interop_test \ <nl> $ ( BINDIR ) / $ ( CONFIG ) / json_run_localhost \ <nl> - $ ( BINDIR ) / $ ( CONFIG ) / memory_test \ <nl> $ ( BINDIR ) / $ ( CONFIG ) / message_allocator_end2end_test \ <nl> $ ( BINDIR ) / $ ( CONFIG ) / metrics_client \ <nl> $ ( BINDIR ) / $ ( CONFIG ) / mock_test \ <nl> buildtests_cxx : privatelibs_cxx \ <nl> $ ( BINDIR ) / $ ( CONFIG ) / interop_server \ <nl> $ ( BINDIR ) / $ ( CONFIG ) / interop_test \ <nl> $ ( BINDIR ) / $ ( CONFIG ) / json_run_localhost \ <nl> - $ ( BINDIR ) / $ ( CONFIG ) / memory_test \ <nl> $ ( BINDIR ) / $ ( CONFIG ) / message_allocator_end2end_test \ <nl> $ ( BINDIR ) / $ ( CONFIG ) / metrics_client \ <nl> $ ( BINDIR ) / $ ( CONFIG ) / mock_test \ <nl> test_cxx : buildtests_cxx <nl> $ ( Q ) $ ( BINDIR ) / $ ( CONFIG ) / inproc_sync_unary_ping_pong_test | | ( echo test inproc_sync_unary_ping_pong_test failed ; exit 1 ) <nl> $ ( E ) " [ RUN ] Testing interop_test " <nl> $ ( Q ) $ ( BINDIR ) / $ ( CONFIG ) / interop_test | | ( echo test interop_test failed ; exit 1 ) <nl> - $ ( E ) " [ RUN ] Testing memory_test " <nl> - $ ( Q ) $ ( BINDIR ) / $ ( CONFIG ) / memory_test | | ( echo test memory_test failed ; exit 1 ) <nl> $ ( E ) " [ RUN ] Testing message_allocator_end2end_test " <nl> $ ( Q ) $ ( BINDIR ) / $ ( CONFIG ) / message_allocator_end2end_test | | ( echo test message_allocator_end2end_test failed ; exit 1 ) <nl> $ ( E ) " [ RUN ] Testing mock_test " <nl> endif <nl> endif <nl> <nl> <nl> - MEMORY_TEST_SRC = \ <nl> - test / core / gprpp / memory_test . cc \ <nl> - <nl> - MEMORY_TEST_OBJS = $ ( addprefix $ ( OBJDIR ) / $ ( CONFIG ) / , $ ( addsuffix . o , $ ( basename $ ( MEMORY_TEST_SRC ) ) ) ) <nl> - ifeq ( $ ( NO_SECURE ) , true ) <nl> - <nl> - # You can ' t build secure targets if you don ' t have OpenSSL . <nl> - <nl> - $ ( BINDIR ) / $ ( CONFIG ) / memory_test : openssl_dep_error <nl> - <nl> - else <nl> - <nl> - <nl> - <nl> - <nl> - ifeq ( $ ( NO_PROTOBUF ) , true ) <nl> - <nl> - # You can ' t build the protoc plugins or protobuf - enabled targets if you don ' t have protobuf 3 . 5 . 0 + . <nl> - <nl> - $ ( BINDIR ) / $ ( CONFIG ) / memory_test : protobuf_dep_error <nl> - <nl> - else <nl> - <nl> - $ ( BINDIR ) / $ ( CONFIG ) / memory_test : $ ( PROTOBUF_DEP ) $ ( MEMORY_TEST_OBJS ) $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a <nl> - $ ( E ) " [ LD ] Linking $ @ " <nl> - $ ( Q ) mkdir - p ` dirname $ @ ` <nl> - $ ( Q ) $ ( LDXX ) $ ( LDFLAGS ) $ ( MEMORY_TEST_OBJS ) $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a $ ( LDLIBSXX ) $ ( LDLIBS_PROTOBUF ) $ ( LDLIBS ) $ ( LDLIBS_SECURE ) $ ( GTEST_LIB ) - o $ ( BINDIR ) / $ ( CONFIG ) / memory_test <nl> - <nl> - endif <nl> - <nl> - endif <nl> - <nl> - $ ( OBJDIR ) / $ ( CONFIG ) / test / core / gprpp / memory_test . o : $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a <nl> - <nl> - deps_memory_test : $ ( MEMORY_TEST_OBJS : . o = . dep ) <nl> - <nl> - ifneq ( $ ( NO_SECURE ) , true ) <nl> - ifneq ( $ ( NO_DEPS ) , true ) <nl> - - include $ ( MEMORY_TEST_OBJS : . o = . dep ) <nl> - endif <nl> - endif <nl> - <nl> - <nl> MESSAGE_ALLOCATOR_END2END_TEST_SRC = \ <nl> test / cpp / end2end / message_allocator_end2end_test . cc \ <nl> <nl> mmm a / build . yaml <nl> ppp b / build . yaml <nl> targets : <nl> - mac <nl> - linux <nl> - posix <nl> - - name : memory_test <nl> - gtest : true <nl> - build : test <nl> - language : c + + <nl> - src : <nl> - - test / core / gprpp / memory_test . cc <nl> - deps : <nl> - - grpc_test_util <nl> - - grpc + + <nl> - - grpc <nl> - - gpr <nl> - uses_polling : false <nl> - name : message_allocator_end2end_test <nl> gtest : true <nl> cpu_cost : 0 . 5 <nl> mmm a / src / core / ext / filters / client_channel / client_channel . cc <nl> ppp b / src / core / ext / filters / client_channel / client_channel . cc <nl> class ChannelData { <nl> MutexLock lock ( & external_watchers_mu_ ) ; <nl> / / Will be deleted when the watch is complete . <nl> GPR_ASSERT ( external_watchers_ [ on_complete ] = = nullptr ) ; <nl> - external_watchers_ [ on_complete ] = New < ExternalConnectivityWatcher > ( <nl> + external_watchers_ [ on_complete ] = new ExternalConnectivityWatcher ( <nl> this , pollent , state , on_complete , watcher_timer_init ) ; <nl> } <nl> <nl> class ChannelData : : SubchannelWrapper : public SubchannelInterface { <nl> UniquePtr < ConnectivityStateWatcherInterface > watcher ) override { <nl> auto & watcher_wrapper = watcher_map_ [ watcher . get ( ) ] ; <nl> GPR_ASSERT ( watcher_wrapper = = nullptr ) ; <nl> - watcher_wrapper = New < WatcherWrapper > ( std : : move ( watcher ) , <nl> - Ref ( DEBUG_LOCATION , " WatcherWrapper " ) , <nl> - initial_state ) ; <nl> + watcher_wrapper = new WatcherWrapper ( std : : move ( watcher ) , <nl> + Ref ( DEBUG_LOCATION , " WatcherWrapper " ) , <nl> + initial_state ) ; <nl> subchannel_ - > WatchConnectivityState ( <nl> initial_state , <nl> UniquePtr < char > ( gpr_strdup ( health_check_service_name_ . get ( ) ) ) , <nl> class ChannelData : : SubchannelWrapper : public SubchannelInterface { <nl> connected_subchannel . get ( ) , ConnectivityStateName ( new_state ) ) ; <nl> } <nl> / / Will delete itself . <nl> - New < Updater > ( Ref ( ) , new_state , std : : move ( connected_subchannel ) ) ; <nl> + new Updater ( Ref ( ) , new_state , std : : move ( connected_subchannel ) ) ; <nl> } <nl> <nl> grpc_pollset_set * interested_parties ( ) override { <nl> class ChannelData : : SubchannelWrapper : public SubchannelInterface { <nl> <nl> WatcherWrapper * MakeReplacement ( ) { <nl> auto * replacement = <nl> - New < WatcherWrapper > ( std : : move ( watcher_ ) , parent_ , last_seen_state_ ) ; <nl> + new WatcherWrapper ( std : : move ( watcher_ ) , parent_ , last_seen_state_ ) ; <nl> replacement_ = replacement ; <nl> return replacement ; <nl> } <nl> class ChannelData : : SubchannelWrapper : public SubchannelInterface { <nl> self - > parent_ - > parent_ - > MaybeUpdateConnectedSubchannel ( <nl> std : : move ( self - > connected_subchannel_ ) ) ; <nl> self - > parent_ - > watcher_ - > OnConnectivityStateChange ( self - > state_ ) ; <nl> - Delete ( self ) ; <nl> + delete self ; <nl> } <nl> <nl> RefCountedPtr < WatcherWrapper > parent_ ; <nl> class ChannelData : : ConnectivityWatcherAdder { <nl> std : : move ( self - > watcher_ ) ) ; <nl> GRPC_CHANNEL_STACK_UNREF ( self - > chand_ - > owning_stack_ , <nl> " ConnectivityWatcherAdder " ) ; <nl> - Delete ( self ) ; <nl> + delete self ; <nl> } <nl> <nl> ChannelData * chand_ ; <nl> class ChannelData : : ConnectivityWatcherRemover { <nl> self - > chand_ - > state_tracker_ . RemoveWatcher ( self - > watcher_ ) ; <nl> GRPC_CHANNEL_STACK_UNREF ( self - > chand_ - > owning_stack_ , <nl> " ConnectivityWatcherRemover " ) ; <nl> - Delete ( self ) ; <nl> + delete self ; <nl> } <nl> <nl> ChannelData * chand_ ; <nl> void ChannelData : : CreateResolvingLoadBalancingPolicyLocked ( ) { <nl> lb_args . channel_control_helper = MakeUnique < ClientChannelControlHelper > ( this ) ; <nl> lb_args . args = channel_args_ ; <nl> UniquePtr < char > target_uri ( gpr_strdup ( target_uri_ . get ( ) ) ) ; <nl> - resolving_lb_policy_ . reset ( New < ResolvingLoadBalancingPolicy > ( <nl> + resolving_lb_policy_ . reset ( new ResolvingLoadBalancingPolicy ( <nl> std : : move ( lb_args ) , & grpc_client_channel_routing_trace , <nl> std : : move ( target_uri ) , ProcessResolverResultLocked , this ) ) ; <nl> grpc_pollset_set_add_pollset_set ( resolving_lb_policy_ - > interested_parties ( ) , <nl> grpc_connectivity_state ChannelData : : CheckConnectivityState ( <nl> void ChannelData : : AddConnectivityWatcher ( <nl> grpc_connectivity_state initial_state , <nl> OrphanablePtr < AsyncConnectivityStateWatcherInterface > watcher ) { <nl> - New < ConnectivityWatcherAdder > ( this , initial_state , std : : move ( watcher ) ) ; <nl> + new ConnectivityWatcherAdder ( this , initial_state , std : : move ( watcher ) ) ; <nl> } <nl> <nl> void ChannelData : : RemoveConnectivityWatcher ( <nl> AsyncConnectivityStateWatcherInterface * watcher ) { <nl> - New < ConnectivityWatcherRemover > ( this , watcher ) ; <nl> + new ConnectivityWatcherRemover ( this , watcher ) ; <nl> } <nl> <nl> / / <nl> class CallData : : QueuedPickCanceller { <nl> YieldCallCombinerIfPendingBatchesFound ) ; <nl> } <nl> GRPC_CALL_STACK_UNREF ( calld - > owning_call_ , " QueuedPickCanceller " ) ; <nl> - Delete ( self ) ; <nl> + delete self ; <nl> } <nl> <nl> grpc_call_element * elem_ ; <nl> void CallData : : AddCallToQueuedPicksLocked ( grpc_call_element * elem ) { <nl> pick_ . elem = elem ; <nl> chand - > AddQueuedPick ( & pick_ , pollent_ ) ; <nl> / / Register call combiner cancellation callback . <nl> - pick_canceller_ = New < QueuedPickCanceller > ( elem ) ; <nl> + pick_canceller_ = new QueuedPickCanceller ( elem ) ; <nl> } <nl> <nl> void CallData : : ApplyServiceConfigToCallLocked ( grpc_call_element * elem ) { <nl> mmm a / src / core / ext / filters / client_channel / global_subchannel_pool . cc <nl> ppp b / src / core / ext / filters / client_channel / global_subchannel_pool . cc <nl> GlobalSubchannelPool : : ~ GlobalSubchannelPool ( ) { <nl> } <nl> <nl> void GlobalSubchannelPool : : Init ( ) { <nl> - instance_ = New < RefCountedPtr < GlobalSubchannelPool > > ( <nl> + instance_ = new RefCountedPtr < GlobalSubchannelPool > ( <nl> MakeRefCounted < GlobalSubchannelPool > ( ) ) ; <nl> } <nl> <nl> void GlobalSubchannelPool : : Shutdown ( ) { <nl> / / To ensure Shutdown ( ) was not called before . <nl> GPR_ASSERT ( * instance_ ! = nullptr ) ; <nl> instance_ - > reset ( ) ; <nl> - Delete ( instance_ ) ; <nl> + delete instance_ ; <nl> } <nl> <nl> RefCountedPtr < GlobalSubchannelPool > GlobalSubchannelPool : : instance ( ) { <nl> Subchannel * GlobalSubchannelPool : : RegisterSubchannel ( SubchannelKey * key , <nl> / / Note that we should ref the old map first because grpc_avl_add ( ) will <nl> / / unref it while we still need to access it later . <nl> grpc_avl new_map = grpc_avl_add ( <nl> - grpc_avl_ref ( old_map , nullptr ) , New < SubchannelKey > ( * key ) , <nl> + grpc_avl_ref ( old_map , nullptr ) , new SubchannelKey ( * key ) , <nl> GRPC_SUBCHANNEL_WEAK_REF ( constructed , " subchannel_register + new " ) , <nl> nullptr ) ; <nl> / / Try to publish the change to the shared map . It may happen ( but <nl> namespace { <nl> <nl> void sck_avl_destroy ( void * p , void * / * user_data * / ) { <nl> SubchannelKey * key = static_cast < SubchannelKey * > ( p ) ; <nl> - Delete ( key ) ; <nl> + delete key ; <nl> } <nl> <nl> void * sck_avl_copy ( void * p , void * / * unused * / ) { <nl> const SubchannelKey * key = static_cast < const SubchannelKey * > ( p ) ; <nl> - auto * new_key = New < SubchannelKey > ( * key ) ; <nl> + auto * new_key = new SubchannelKey ( * key ) ; <nl> return static_cast < void * > ( new_key ) ; <nl> } <nl> <nl> mmm a / src / core / ext / filters / client_channel / health / health_check_client . cc <nl> ppp b / src / core / ext / filters / client_channel / health / health_check_client . cc <nl> void HealthCheckClient : : CallState : : AfterCallStackDestruction ( <nl> void * arg , grpc_error * / * error * / ) { <nl> HealthCheckClient : : CallState * self = <nl> static_cast < HealthCheckClient : : CallState * > ( arg ) ; <nl> - Delete ( self ) ; <nl> + delete self ; <nl> } <nl> <nl> void HealthCheckClient : : CallState : : OnCancelComplete ( void * arg , <nl> mmm a / src / core / ext / filters / client_channel / lb_policy / grpclb / grpclb . cc <nl> ppp b / src / core / ext / filters / client_channel / lb_policy / grpclb / grpclb . cc <nl> grpc_channel_args * GrpcLb : : CreateChildPolicyArgsLocked ( <nl> <nl> OrphanablePtr < LoadBalancingPolicy > GrpcLb : : CreateChildPolicyLocked ( <nl> const char * name , const grpc_channel_args * args ) { <nl> - Helper * helper = New < Helper > ( Ref ( ) ) ; <nl> + Helper * helper = new Helper ( Ref ( ) ) ; <nl> LoadBalancingPolicy : : Args lb_policy_args ; <nl> lb_policy_args . combiner = combiner ( ) ; <nl> lb_policy_args . args = args ; <nl> class GrpcLbFactory : public LoadBalancingPolicyFactory { <nl> GPR_DEBUG_ASSERT ( error ! = nullptr & & * error = = GRPC_ERROR_NONE ) ; <nl> if ( json = = nullptr ) { <nl> return RefCountedPtr < LoadBalancingPolicy : : Config > ( <nl> - New < ParsedGrpcLbConfig > ( nullptr ) ) ; <nl> + new ParsedGrpcLbConfig ( nullptr ) ) ; <nl> } <nl> InlinedVector < grpc_error * , 2 > error_list ; <nl> RefCountedPtr < LoadBalancingPolicy : : Config > child_policy ; <nl> class GrpcLbFactory : public LoadBalancingPolicyFactory { <nl> } <nl> if ( error_list . empty ( ) ) { <nl> return RefCountedPtr < LoadBalancingPolicy : : Config > ( <nl> - New < ParsedGrpcLbConfig > ( std : : move ( child_policy ) ) ) ; <nl> + new ParsedGrpcLbConfig ( std : : move ( child_policy ) ) ) ; <nl> } else { <nl> * error = GRPC_ERROR_CREATE_FROM_VECTOR ( " GrpcLb Parser " , & error_list ) ; <nl> return nullptr ; <nl> mmm a / src / core / ext / filters / client_channel / lb_policy / grpclb / grpclb_client_stats . cc <nl> ppp b / src / core / ext / filters / client_channel / lb_policy / grpclb / grpclb_client_stats . cc <nl> void GrpcLbClientStats : : AddCallDropped ( const char * token ) { <nl> / / Record the drop . <nl> MutexLock lock ( & drop_count_mu_ ) ; <nl> if ( drop_token_counts_ = = nullptr ) { <nl> - drop_token_counts_ . reset ( New < DroppedCallCounts > ( ) ) ; <nl> + drop_token_counts_ . reset ( new DroppedCallCounts ( ) ) ; <nl> } <nl> for ( size_t i = 0 ; i < drop_token_counts_ - > size ( ) ; + + i ) { <nl> if ( strcmp ( ( * drop_token_counts_ ) [ i ] . token . get ( ) , token ) = = 0 ) { <nl> mmm a / src / core / ext / filters / client_channel / lb_policy / pick_first / pick_first . cc <nl> ppp b / src / core / ext / filters / client_channel / lb_policy / pick_first / pick_first . cc <nl> class PickFirstFactory : public LoadBalancingPolicyFactory { <nl> GPR_DEBUG_ASSERT ( strcmp ( json - > key , name ( ) ) = = 0 ) ; <nl> } <nl> return RefCountedPtr < LoadBalancingPolicy : : Config > ( <nl> - New < ParsedPickFirstConfig > ( ) ) ; <nl> + new ParsedPickFirstConfig ( ) ) ; <nl> } <nl> } ; <nl> <nl> mmm a / src / core / ext / filters / client_channel / lb_policy / round_robin / round_robin . cc <nl> ppp b / src / core / ext / filters / client_channel / lb_policy / round_robin / round_robin . cc <nl> class RoundRobinFactory : public LoadBalancingPolicyFactory { <nl> GPR_DEBUG_ASSERT ( strcmp ( json - > key , name ( ) ) = = 0 ) ; <nl> } <nl> return RefCountedPtr < LoadBalancingPolicy : : Config > ( <nl> - New < ParsedRoundRobinConfig > ( ) ) ; <nl> + new ParsedRoundRobinConfig ( ) ) ; <nl> } <nl> } ; <nl> <nl> mmm a / src / core / ext / filters / client_channel / lb_policy / subchannel_list . h <nl> ppp b / src / core / ext / filters / client_channel / lb_policy / subchannel_list . h <nl> class SubchannelList : public InternallyRefCounted < SubchannelListType > { <nl> virtual ~ SubchannelList ( ) ; <nl> <nl> private : <nl> - / / So New ( ) can call our private ctor . <nl> - template < typename T , typename . . . Args > <nl> - friend T * New ( Args & & . . . args ) ; <nl> - <nl> / / For accessing Ref ( ) and Unref ( ) . <nl> friend class SubchannelData < SubchannelListType , SubchannelDataType > ; <nl> <nl> void SubchannelData < SubchannelListType , <nl> } <nl> GPR_ASSERT ( pending_watcher_ = = nullptr ) ; <nl> pending_watcher_ = <nl> - New < Watcher > ( this , subchannel_list ( ) - > Ref ( DEBUG_LOCATION , " Watcher " ) ) ; <nl> + new Watcher ( this , subchannel_list ( ) - > Ref ( DEBUG_LOCATION , " Watcher " ) ) ; <nl> subchannel_ - > WatchConnectivityState ( <nl> connectivity_state_ , <nl> UniquePtr < SubchannelInterface : : ConnectivityStateWatcherInterface > ( <nl> mmm a / src / core / ext / filters / client_channel / lb_policy / xds / xds . cc <nl> ppp b / src / core / ext / filters / client_channel / lb_policy / xds / xds . cc <nl> void XdsLb : : UpdateFallbackPolicyLocked ( ) { <nl> OrphanablePtr < LoadBalancingPolicy > XdsLb : : CreateFallbackPolicyLocked ( <nl> const char * name , const grpc_channel_args * args ) { <nl> FallbackHelper * helper = <nl> - New < FallbackHelper > ( Ref ( DEBUG_LOCATION , " FallbackHelper " ) ) ; <nl> + new FallbackHelper ( Ref ( DEBUG_LOCATION , " FallbackHelper " ) ) ; <nl> LoadBalancingPolicy : : Args lb_policy_args ; <nl> lb_policy_args . combiner = combiner ( ) ; <nl> lb_policy_args . args = args ; <nl> void XdsLb : : PriorityList : : UpdateXdsPickerLocked ( ) { <nl> void XdsLb : : PriorityList : : MaybeCreateLocalityMapLocked ( uint32_t priority ) { <nl> / / Exhausted priorities in the update . <nl> if ( ! priority_list_update ( ) . Contains ( priority ) ) return ; <nl> - auto new_locality_map = New < LocalityMap > ( <nl> + auto new_locality_map = new LocalityMap ( <nl> xds_policy_ - > Ref ( DEBUG_LOCATION , " XdsLb + LocalityMap " ) , priority ) ; <nl> priorities_ . emplace_back ( OrphanablePtr < LocalityMap > ( new_locality_map ) ) ; <nl> new_locality_map - > UpdateLocked ( * priority_list_update ( ) . Find ( priority ) ) ; <nl> XdsLb : : PriorityList : : LocalityMap : : Locality : : CreateChildPolicyArgsLocked ( <nl> OrphanablePtr < LoadBalancingPolicy > <nl> XdsLb : : PriorityList : : LocalityMap : : Locality : : CreateChildPolicyLocked ( <nl> const char * name , const grpc_channel_args * args ) { <nl> - Helper * helper = New < Helper > ( this - > Ref ( DEBUG_LOCATION , " Helper " ) ) ; <nl> + Helper * helper = new Helper ( this - > Ref ( DEBUG_LOCATION , " Helper " ) ) ; <nl> LoadBalancingPolicy : : Args lb_policy_args ; <nl> lb_policy_args . combiner = xds_policy ( ) - > combiner ( ) ; <nl> lb_policy_args . args = args ; <nl> mmm a / src / core / ext / filters / client_channel / lb_policy_registry . cc <nl> ppp b / src / core / ext / filters / client_channel / lb_policy_registry . cc <nl> RegistryState * g_state = nullptr ; <nl> / / <nl> <nl> void LoadBalancingPolicyRegistry : : Builder : : InitRegistry ( ) { <nl> - if ( g_state = = nullptr ) g_state = New < RegistryState > ( ) ; <nl> + if ( g_state = = nullptr ) g_state = new RegistryState ( ) ; <nl> } <nl> <nl> void LoadBalancingPolicyRegistry : : Builder : : ShutdownRegistry ( ) { <nl> - Delete ( g_state ) ; <nl> + delete g_state ; <nl> g_state = nullptr ; <nl> } <nl> <nl> mmm a / src / core / ext / filters / client_channel / local_subchannel_pool . cc <nl> ppp b / src / core / ext / filters / client_channel / local_subchannel_pool . cc <nl> Subchannel * LocalSubchannelPool : : RegisterSubchannel ( SubchannelKey * key , <nl> GRPC_SUBCHANNEL_UNREF ( constructed , " subchannel_register + found_existing " ) ; <nl> } else { <nl> / / There hasn ' t been such subchannel . Add one . <nl> - subchannel_map_ = grpc_avl_add ( subchannel_map_ , New < SubchannelKey > ( * key ) , <nl> + subchannel_map_ = grpc_avl_add ( subchannel_map_ , new SubchannelKey ( * key ) , <nl> constructed , nullptr ) ; <nl> c = constructed ; <nl> } <nl> namespace { <nl> <nl> void sck_avl_destroy ( void * p , void * / * user_data * / ) { <nl> SubchannelKey * key = static_cast < SubchannelKey * > ( p ) ; <nl> - Delete ( key ) ; <nl> + delete key ; <nl> } <nl> <nl> void * sck_avl_copy ( void * p , void * / * unused * / ) { <nl> const SubchannelKey * key = static_cast < const SubchannelKey * > ( p ) ; <nl> - auto new_key = New < SubchannelKey > ( * key ) ; <nl> + auto new_key = new SubchannelKey ( * key ) ; <nl> return static_cast < void * > ( new_key ) ; <nl> } <nl> <nl> mmm a / src / core / ext / filters / client_channel / resolver / dns / c_ares / grpc_ares_ev_driver . cc <nl> ppp b / src / core / ext / filters / client_channel / resolver / dns / c_ares / grpc_ares_ev_driver . cc <nl> static void grpc_ares_ev_driver_unref ( grpc_ares_ev_driver * ev_driver ) { <nl> GRPC_COMBINER_UNREF ( ev_driver - > combiner , " free ares event driver " ) ; <nl> ares_destroy ( ev_driver - > channel ) ; <nl> grpc_ares_complete_request_locked ( ev_driver - > request ) ; <nl> - grpc_core : : Delete ( ev_driver ) ; <nl> + delete ev_driver ; <nl> } <nl> } <nl> <nl> static void fd_node_destroy_locked ( fd_node * fdn ) { <nl> GPR_ASSERT ( ! fdn - > readable_registered ) ; <nl> GPR_ASSERT ( ! fdn - > writable_registered ) ; <nl> GPR_ASSERT ( fdn - > already_shutdown ) ; <nl> - grpc_core : : Delete ( fdn - > grpc_polled_fd ) ; <nl> + delete fdn - > grpc_polled_fd ; <nl> gpr_free ( fdn ) ; <nl> } <nl> <nl> grpc_error * grpc_ares_ev_driver_create_locked ( grpc_ares_ev_driver * * ev_driver , <nl> int query_timeout_ms , <nl> grpc_core : : Combiner * combiner , <nl> grpc_ares_request * request ) { <nl> - * ev_driver = grpc_core : : New < grpc_ares_ev_driver > ( ) ; <nl> + * ev_driver = new grpc_ares_ev_driver ( ) ; <nl> ares_options opts ; <nl> memset ( & opts , 0 , sizeof ( opts ) ) ; <nl> opts . flags | = ARES_FLAG_STAYOPEN ; <nl> mmm a / src / core / ext / filters / client_channel / resolver / dns / c_ares / grpc_ares_ev_driver_libuv . cc <nl> ppp b / src / core / ext / filters / client_channel / resolver / dns / c_ares / grpc_ares_ev_driver_libuv . cc <nl> namespace grpc_core { <nl> <nl> void ares_uv_poll_cb ( uv_poll_t * handle , int status , int events ) ; <nl> <nl> - void ares_uv_poll_close_cb ( uv_handle_t * handle ) { Delete ( handle ) ; } <nl> + void ares_uv_poll_close_cb ( uv_handle_t * handle ) { delete handle ; } <nl> <nl> class GrpcPolledFdLibuv : public GrpcPolledFd { <nl> public : <nl> GrpcPolledFdLibuv ( ares_socket_t as , Combiner * combiner ) <nl> : as_ ( as ) , combiner_ ( combiner ) { <nl> gpr_asprintf ( & name_ , " c - ares socket : % " PRIdPTR , ( intptr_t ) as ) ; <nl> - handle_ = New < uv_poll_t > ( ) ; <nl> + handle_ = new uv_poll_t ( ) ; <nl> uv_poll_init_socket ( uv_default_loop ( ) , handle_ , as ) ; <nl> handle_ - > data = this ; <nl> GRPC_COMBINER_REF ( combiner_ , " libuv ares event driver " ) ; <nl> void ares_uv_poll_cb ( uv_poll_t * handle , int status , int events ) { <nl> grpc_core : : ExecCtx exec_ctx ; <nl> GrpcPolledFdLibuv * polled_fd = <nl> reinterpret_cast < GrpcPolledFdLibuv * > ( handle - > data ) ; <nl> - AresUvPollCbArg * arg = New < AresUvPollCbArg > ( handle , status , events ) ; <nl> + AresUvPollCbArg * arg = new AresUvPollCbArg ( handle , status , events ) ; <nl> polled_fd - > combiner_ - > Run ( <nl> GRPC_CLOSURE_CREATE ( ares_uv_poll_cb_locked , arg , nullptr ) , <nl> GRPC_ERROR_NONE ) ; <nl> class GrpcPolledFdFactoryLibuv : public GrpcPolledFdFactory { <nl> GrpcPolledFd * NewGrpcPolledFdLocked ( ares_socket_t as , <nl> grpc_pollset_set * driver_pollset_set , <nl> Combiner * combiner ) override { <nl> - return New < GrpcPolledFdLibuv > ( as , combiner ) ; <nl> + return new GrpcPolledFdLibuv ( as , combiner ) ; <nl> } <nl> <nl> void ConfigureAresChannelLocked ( ares_channel channel ) override { } <nl> mmm a / src / core / ext / filters / client_channel / resolver / dns / c_ares / grpc_ares_ev_driver_posix . cc <nl> ppp b / src / core / ext / filters / client_channel / resolver / dns / c_ares / grpc_ares_ev_driver_posix . cc <nl> class GrpcPolledFdFactoryPosix : public GrpcPolledFdFactory { <nl> GrpcPolledFd * NewGrpcPolledFdLocked ( ares_socket_t as , <nl> grpc_pollset_set * driver_pollset_set , <nl> Combiner * / * combiner * / ) override { <nl> - return New < GrpcPolledFdPosix > ( as , driver_pollset_set ) ; <nl> + return new GrpcPolledFdPosix ( as , driver_pollset_set ) ; <nl> } <nl> <nl> void ConfigureAresChannelLocked ( ares_channel / * channel * / ) override { } <nl> mmm a / src / core / ext / filters / client_channel / resolver / dns / c_ares / grpc_ares_ev_driver_windows . cc <nl> ppp b / src / core / ext / filters / client_channel / resolver / dns / c_ares / grpc_ares_ev_driver_windows . cc <nl> class SockToPolledFdMap { <nl> } <nl> <nl> void AddNewSocket ( SOCKET s , GrpcPolledFdWindows * polled_fd ) { <nl> - SockToPolledFdEntry * new_node = New < SockToPolledFdEntry > ( s , polled_fd ) ; <nl> + SockToPolledFdEntry * new_node = new SockToPolledFdEntry ( s , polled_fd ) ; <nl> new_node - > next = head_ ; <nl> head_ = new_node ; <nl> } <nl> class SockToPolledFdMap { <nl> node = node - > next ) { <nl> if ( node - > socket = = s ) { <nl> * prev = node - > next ; <nl> - Delete ( node ) ; <nl> + delete node ; <nl> return ; <nl> } <nl> prev = & node - > next ; <nl> class SockToPolledFdMap { <nl> } <nl> grpc_tcp_set_non_block ( s ) ; <nl> GrpcPolledFdWindows * polled_fd = <nl> - New < GrpcPolledFdWindows > ( s , map - > combiner_ , af , type ) ; <nl> + new GrpcPolledFdWindows ( s , map - > combiner_ , af , type ) ; <nl> GRPC_CARES_TRACE_LOG ( <nl> " fd : | % s | created with params af : % d type : % d protocol : % d " , <nl> polled_fd - > GetName ( ) , af , type , protocol ) ; <nl> class SockToPolledFdMap { <nl> " Shut down c - ares fd before without it ever having made it into the " <nl> " driver ' s list " ) ) ; <nl> } <nl> - grpc_core : : Delete ( polled_fd ) ; <nl> + delete polled_fd ; <nl> return 0 ; <nl> } <nl> <nl> class GrpcPolledFdFactoryWindows : public GrpcPolledFdFactory { <nl> / / Set a flag so that the virtual socket " close " method knows it <nl> / / doesn ' t need to call ShutdownLocked , since now the driver will . <nl> polled_fd - > set_gotten_into_driver_list ( ) ; <nl> - return grpc_core : : New < GrpcPolledFdWindowsWrapper > ( polled_fd ) ; <nl> + return new GrpcPolledFdWindowsWrapper ( polled_fd ) ; <nl> } <nl> <nl> void ConfigureAresChannelLocked ( ares_channel channel ) override { <nl> mmm a / src / core / ext / filters / client_channel / resolver / dns / c_ares / grpc_ares_wrapper . cc <nl> ppp b / src / core / ext / filters / client_channel / resolver / dns / c_ares / grpc_ares_wrapper . cc <nl> static void on_dns_lookup_done_locked ( void * arg , grpc_error * error ) { <nl> grpc_core : : ExecCtx : : Run ( DEBUG_LOCATION , r - > on_resolve_address_done , <nl> GRPC_ERROR_REF ( error ) ) ; <nl> GRPC_COMBINER_UNREF ( r - > combiner , " on_dns_lookup_done_cb " ) ; <nl> - grpc_core : : Delete ( r ) ; <nl> + delete r ; <nl> } <nl> <nl> static void on_dns_lookup_done ( void * arg , grpc_error * error ) { <nl> static void grpc_resolve_address_ares_impl ( const char * name , <nl> grpc_closure * on_done , <nl> grpc_resolved_addresses * * addrs ) { <nl> grpc_resolve_address_ares_request * r = <nl> - grpc_core : : New < grpc_resolve_address_ares_request > ( ) ; <nl> + new grpc_resolve_address_ares_request ( ) ; <nl> r - > combiner = grpc_combiner_create ( ) ; <nl> r - > addrs_out = addrs ; <nl> r - > on_resolve_address_done = on_done ; <nl> mmm a / src / core / ext / filters / client_channel / resolver / fake / fake_resolver . cc <nl> ppp b / src / core / ext / filters / client_channel / resolver / fake / fake_resolver . cc <nl> void FakeResolverResponseGenerator : : SetResponseLocked ( void * arg , <nl> resolver - > has_next_result_ = true ; <nl> resolver - > MaybeSendResultLocked ( ) ; <nl> } <nl> - Delete ( closure_arg ) ; <nl> + delete closure_arg ; <nl> } <nl> <nl> void FakeResolverResponseGenerator : : SetResponse ( Resolver : : Result result ) { <nl> void FakeResolverResponseGenerator : : SetResponse ( Resolver : : Result result ) { <nl> } <nl> resolver = resolver_ - > Ref ( ) ; <nl> } <nl> - SetResponseClosureArg * closure_arg = New < SetResponseClosureArg > ( ) ; <nl> + SetResponseClosureArg * closure_arg = new SetResponseClosureArg ( ) ; <nl> closure_arg - > resolver = std : : move ( resolver ) ; <nl> closure_arg - > result = std : : move ( result ) ; <nl> closure_arg - > resolver - > combiner ( ) - > Run ( <nl> void FakeResolverResponseGenerator : : SetReresolutionResponseLocked ( <nl> resolver - > reresolution_result_ = std : : move ( closure_arg - > result ) ; <nl> resolver - > has_reresolution_result_ = closure_arg - > has_result ; <nl> } <nl> - Delete ( closure_arg ) ; <nl> + delete closure_arg ; <nl> } <nl> <nl> void FakeResolverResponseGenerator : : SetReresolutionResponse ( <nl> void FakeResolverResponseGenerator : : SetReresolutionResponse ( <nl> GPR_ASSERT ( resolver_ ! = nullptr ) ; <nl> resolver = resolver_ - > Ref ( ) ; <nl> } <nl> - SetResponseClosureArg * closure_arg = New < SetResponseClosureArg > ( ) ; <nl> + SetResponseClosureArg * closure_arg = new SetResponseClosureArg ( ) ; <nl> closure_arg - > resolver = std : : move ( resolver ) ; <nl> closure_arg - > result = std : : move ( result ) ; <nl> closure_arg - > has_result = true ; <nl> void FakeResolverResponseGenerator : : UnsetReresolutionResponse ( ) { <nl> GPR_ASSERT ( resolver_ ! = nullptr ) ; <nl> resolver = resolver_ - > Ref ( ) ; <nl> } <nl> - SetResponseClosureArg * closure_arg = New < SetResponseClosureArg > ( ) ; <nl> + SetResponseClosureArg * closure_arg = new SetResponseClosureArg ( ) ; <nl> closure_arg - > resolver = std : : move ( resolver ) ; <nl> closure_arg - > resolver - > combiner ( ) - > Run ( <nl> GRPC_CLOSURE_INIT ( & closure_arg - > set_response_closure , <nl> void FakeResolverResponseGenerator : : SetFailureLocked ( void * arg , <nl> resolver - > return_failure_ = true ; <nl> if ( closure_arg - > immediate ) resolver - > MaybeSendResultLocked ( ) ; <nl> } <nl> - Delete ( closure_arg ) ; <nl> + delete closure_arg ; <nl> } <nl> <nl> void FakeResolverResponseGenerator : : SetFailure ( ) { <nl> void FakeResolverResponseGenerator : : SetFailure ( ) { <nl> GPR_ASSERT ( resolver_ ! = nullptr ) ; <nl> resolver = resolver_ - > Ref ( ) ; <nl> } <nl> - SetResponseClosureArg * closure_arg = New < SetResponseClosureArg > ( ) ; <nl> + SetResponseClosureArg * closure_arg = new SetResponseClosureArg ( ) ; <nl> closure_arg - > resolver = std : : move ( resolver ) ; <nl> closure_arg - > resolver - > combiner ( ) - > Run ( <nl> GRPC_CLOSURE_INIT ( & closure_arg - > set_response_closure , SetFailureLocked , <nl> void FakeResolverResponseGenerator : : SetFailureOnReresolution ( ) { <nl> GPR_ASSERT ( resolver_ ! = nullptr ) ; <nl> resolver = resolver_ - > Ref ( ) ; <nl> } <nl> - SetResponseClosureArg * closure_arg = New < SetResponseClosureArg > ( ) ; <nl> + SetResponseClosureArg * closure_arg = new SetResponseClosureArg ( ) ; <nl> closure_arg - > resolver = std : : move ( resolver ) ; <nl> closure_arg - > immediate = false ; <nl> closure_arg - > resolver - > combiner ( ) - > Run ( <nl> void FakeResolverResponseGenerator : : SetFakeResolver ( <nl> resolver_ = std : : move ( resolver ) ; <nl> if ( resolver_ = = nullptr ) return ; <nl> if ( has_result_ ) { <nl> - SetResponseClosureArg * closure_arg = New < SetResponseClosureArg > ( ) ; <nl> + SetResponseClosureArg * closure_arg = new SetResponseClosureArg ( ) ; <nl> closure_arg - > resolver = resolver_ - > Ref ( ) ; <nl> closure_arg - > result = std : : move ( result_ ) ; <nl> resolver_ - > combiner ( ) - > Run ( <nl> mmm a / src / core / ext / filters / client_channel / resolver_registry . cc <nl> ppp b / src / core / ext / filters / client_channel / resolver_registry . cc <nl> static RegistryState * g_state = nullptr ; <nl> / / <nl> <nl> void ResolverRegistry : : Builder : : InitRegistry ( ) { <nl> - if ( g_state = = nullptr ) g_state = New < RegistryState > ( ) ; <nl> + if ( g_state = = nullptr ) g_state = new RegistryState ( ) ; <nl> } <nl> <nl> void ResolverRegistry : : Builder : : ShutdownRegistry ( ) { <nl> - Delete ( g_state ) ; <nl> + delete g_state ; <nl> g_state = nullptr ; <nl> } <nl> <nl> mmm a / src / core / ext / filters / client_channel / resolving_lb_policy . cc <nl> ppp b / src / core / ext / filters / client_channel / resolving_lb_policy . cc <nl> OrphanablePtr < LoadBalancingPolicy > <nl> ResolvingLoadBalancingPolicy : : CreateLbPolicyLocked ( <nl> const char * lb_policy_name , const grpc_channel_args & args , <nl> TraceStringVector * trace_strings ) { <nl> - ResolvingControlHelper * helper = New < ResolvingControlHelper > ( Ref ( ) ) ; <nl> + ResolvingControlHelper * helper = new ResolvingControlHelper ( Ref ( ) ) ; <nl> LoadBalancingPolicy : : Args lb_policy_args ; <nl> lb_policy_args . combiner = combiner ( ) ; <nl> lb_policy_args . channel_control_helper = <nl> mmm a / src / core / ext / filters / client_channel / service_config . cc <nl> ppp b / src / core / ext / filters / client_channel / service_config . cc <nl> size_t ServiceConfig : : RegisterParser ( UniquePtr < Parser > parser ) { <nl> <nl> void ServiceConfig : : Init ( ) { <nl> GPR_ASSERT ( g_registered_parsers = = nullptr ) ; <nl> - g_registered_parsers = New < ServiceConfigParserList > ( ) ; <nl> + g_registered_parsers = new ServiceConfigParserList ( ) ; <nl> } <nl> <nl> void ServiceConfig : : Shutdown ( ) { <nl> - Delete ( g_registered_parsers ) ; <nl> + delete g_registered_parsers ; <nl> g_registered_parsers = nullptr ; <nl> } <nl> <nl> mmm a / src / core / ext / filters / client_channel / service_config . h <nl> ppp b / src / core / ext / filters / client_channel / service_config . h <nl> class ServiceConfig : public RefCounted < ServiceConfig > { <nl> static RefCountedPtr < ServiceConfig > Create ( const char * json , <nl> grpc_error * * error ) ; <nl> <nl> + / / Takes ownership of \ a json_tree . <nl> + ServiceConfig ( UniquePtr < char > service_config_json , <nl> + UniquePtr < char > json_string , grpc_json * json_tree , <nl> + grpc_error * * error ) ; <nl> ~ ServiceConfig ( ) ; <nl> <nl> const char * service_config_json ( ) const { return service_config_json_ . get ( ) ; } <nl> class ServiceConfig : public RefCounted < ServiceConfig > { <nl> static void Shutdown ( ) ; <nl> <nl> private : <nl> - / / So New ( ) can call our private ctor . <nl> - template < typename T , typename . . . Args > <nl> - friend T * New ( Args & & . . . args ) ; <nl> - <nl> - / / Takes ownership of \ a json_tree . <nl> - ServiceConfig ( UniquePtr < char > service_config_json , <nl> - UniquePtr < char > json_string , grpc_json * json_tree , <nl> - grpc_error * * error ) ; <nl> - <nl> / / Helper functions to parse the service config <nl> grpc_error * ParseGlobalParams ( const grpc_json * json_tree ) ; <nl> grpc_error * ParsePerMethodParams ( const grpc_json * json_tree ) ; <nl> mmm a / src / core / ext / filters / client_channel / subchannel . cc <nl> ppp b / src / core / ext / filters / client_channel / subchannel . cc <nl> Subchannel : : ~ Subchannel ( ) { <nl> grpc_channel_args_destroy ( args_ ) ; <nl> grpc_connector_unref ( connector_ ) ; <nl> grpc_pollset_set_destroy ( pollset_set_ ) ; <nl> - Delete ( key_ ) ; <nl> + delete key_ ; <nl> } <nl> <nl> Subchannel * Subchannel : : Create ( grpc_connector * connector , <nl> const grpc_channel_args * args ) { <nl> - SubchannelKey * key = New < SubchannelKey > ( args ) ; <nl> + SubchannelKey * key = new SubchannelKey ( args ) ; <nl> SubchannelPoolInterface * subchannel_pool = <nl> SubchannelPoolInterface : : GetSubchannelPoolFromChannelArgs ( args ) ; <nl> GPR_ASSERT ( subchannel_pool ! = nullptr ) ; <nl> Subchannel * c = subchannel_pool - > FindSubchannel ( key ) ; <nl> if ( c ! = nullptr ) { <nl> - Delete ( key ) ; <nl> + delete key ; <nl> return c ; <nl> } <nl> - c = New < Subchannel > ( key , connector , args ) ; <nl> + c = new Subchannel ( key , connector , args ) ; <nl> / / Try to register the subchannel before setting the subchannel pool . <nl> / / Otherwise , in case of a registration race , unreffing c in <nl> / / RegisterSubchannel ( ) will cause c to be tried to be unregistered , while <nl> namespace { <nl> <nl> void subchannel_destroy ( void * arg , grpc_error * / * error * / ) { <nl> Subchannel * self = static_cast < Subchannel * > ( arg ) ; <nl> - Delete ( self ) ; <nl> + delete self ; <nl> } <nl> <nl> } / / namespace <nl> bool Subchannel : : PublishTransportLocked ( ) { <nl> } <nl> / / Publish . <nl> connected_subchannel_ . reset ( <nl> - New < ConnectedSubchannel > ( stk , args_ , channelz_node_ ) ) ; <nl> + new ConnectedSubchannel ( stk , args_ , channelz_node_ ) ) ; <nl> gpr_log ( GPR_INFO , " New connected subchannel at % p for subchannel % p " , <nl> connected_subchannel_ . get ( ) , this ) ; <nl> if ( channelz_node_ ! = nullptr ) { <nl> mmm a / src / core / ext / filters / client_channel / xds / xds_client . cc <nl> ppp b / src / core / ext / filters / client_channel / xds / xds_client . cc <nl> bool XdsClient : : ChannelState : : HasActiveAdsCall ( ) const { <nl> <nl> void XdsClient : : ChannelState : : MaybeStartAdsCall ( ) { <nl> if ( ads_calld_ ! = nullptr ) return ; <nl> - ads_calld_ . reset ( New < RetryableCall < AdsCallState > > ( <nl> - Ref ( DEBUG_LOCATION , " ChannelState + ads " ) ) ) ; <nl> + ads_calld_ . reset ( <nl> + new RetryableCall < AdsCallState > ( Ref ( DEBUG_LOCATION , " ChannelState + ads " ) ) ) ; <nl> } <nl> <nl> void XdsClient : : ChannelState : : StopAdsCall ( ) { ads_calld_ . reset ( ) ; } <nl> <nl> void XdsClient : : ChannelState : : MaybeStartLrsCall ( ) { <nl> if ( lrs_calld_ ! = nullptr ) return ; <nl> - lrs_calld_ . reset ( New < RetryableCall < LrsCallState > > ( <nl> - Ref ( DEBUG_LOCATION , " ChannelState + lrs " ) ) ) ; <nl> + lrs_calld_ . reset ( <nl> + new RetryableCall < LrsCallState > ( Ref ( DEBUG_LOCATION , " ChannelState + lrs " ) ) ) ; <nl> } <nl> <nl> void XdsClient : : ChannelState : : StopLrsCall ( ) { lrs_calld_ . reset ( ) ; } <nl> void XdsClient : : ChannelState : : StartConnectivityWatchLocked ( ) { <nl> grpc_channel_element * client_channel_elem = <nl> grpc_channel_stack_last_element ( grpc_channel_get_channel_stack ( channel_ ) ) ; <nl> GPR_ASSERT ( client_channel_elem - > filter = = & grpc_client_channel_filter ) ; <nl> - watcher_ = New < StateWatcher > ( Ref ( ) ) ; <nl> + watcher_ = new StateWatcher ( Ref ( ) ) ; <nl> grpc_client_channel_start_connectivity_watch ( <nl> client_channel_elem , GRPC_CHANNEL_IDLE , <nl> OrphanablePtr < AsyncConnectivityStateWatcherInterface > ( watcher_ ) ) ; <nl> mmm a / src / core / ext / filters / deadline / deadline_filter . cc <nl> ppp b / src / core / ext / filters / deadline / deadline_filter . cc <nl> static void start_timer_after_init ( void * arg , grpc_error * error ) { <nl> " scheduling deadline timer " ) ; <nl> return ; <nl> } <nl> - grpc_core : : Delete ( state ) ; <nl> + delete state ; <nl> GRPC_CALL_COMBINER_STOP ( deadline_state - > call_combiner , <nl> " done scheduling deadline timer " ) ; <nl> } <nl> grpc_deadline_state : : grpc_deadline_state ( grpc_call_element * elem , <nl> / / create a closure to start the timer , and we schedule that closure <nl> / / to be run after call stack initialization is done . <nl> struct start_timer_after_init_state * state = <nl> - grpc_core : : New < start_timer_after_init_state > ( elem , deadline ) ; <nl> + new start_timer_after_init_state ( elem , deadline ) ; <nl> GRPC_CLOSURE_INIT ( & state - > closure , start_timer_after_init , state , <nl> grpc_schedule_on_exec_ctx ) ; <nl> grpc_core : : ExecCtx : : Run ( DEBUG_LOCATION , & state - > closure , GRPC_ERROR_NONE ) ; <nl> mmm a / src / core / ext / filters / max_age / max_age_filter . cc <nl> ppp b / src / core / ext / filters / max_age / max_age_filter . cc <nl> static void start_max_age_timer_after_init ( void * arg , grpc_error * / * error * / ) { <nl> & chand - > close_max_age_channel ) ; <nl> gpr_mu_unlock ( & chand - > max_age_timer_mu ) ; <nl> grpc_transport_op * op = grpc_make_transport_op ( nullptr ) ; <nl> - op - > start_connectivity_watch . reset ( <nl> - grpc_core : : New < grpc_core : : ConnectivityWatcher > ( chand ) ) ; <nl> + op - > start_connectivity_watch . reset ( new grpc_core : : ConnectivityWatcher ( chand ) ) ; <nl> op - > start_connectivity_watch_state = GRPC_CHANNEL_IDLE ; <nl> grpc_channel_next_op ( grpc_channel_stack_element ( chand - > channel_stack , 0 ) , op ) ; <nl> GRPC_CHANNEL_STACK_UNREF ( chand - > channel_stack , <nl> mmm a / src / core / ext / transport / chttp2 / client / insecure / channel_create . cc <nl> ppp b / src / core / ext / transport / chttp2 / client / insecure / channel_create . cc <nl> grpc_core : : Chttp2InsecureClientChannelFactory * g_factory ; <nl> gpr_once g_factory_once = GPR_ONCE_INIT ; <nl> <nl> void FactoryInit ( ) { <nl> - g_factory = grpc_core : : New < grpc_core : : Chttp2InsecureClientChannelFactory > ( ) ; <nl> + g_factory = new grpc_core : : Chttp2InsecureClientChannelFactory ( ) ; <nl> } <nl> <nl> } / / namespace <nl> mmm a / src / core / ext / transport / chttp2 / client / secure / secure_channel_create . cc <nl> ppp b / src / core / ext / transport / chttp2 / client / secure / secure_channel_create . cc <nl> grpc_core : : Chttp2SecureClientChannelFactory * g_factory ; <nl> gpr_once g_factory_once = GPR_ONCE_INIT ; <nl> <nl> void FactoryInit ( ) { <nl> - g_factory = grpc_core : : New < grpc_core : : Chttp2SecureClientChannelFactory > ( ) ; <nl> + g_factory = new grpc_core : : Chttp2SecureClientChannelFactory ( ) ; <nl> } <nl> <nl> } / / namespace <nl> mmm a / src / core / ext / transport / chttp2 / transport / chttp2_transport . cc <nl> ppp b / src / core / ext / transport / chttp2 / transport / chttp2_transport . cc <nl> grpc_chttp2_transport_get_socket_node ( grpc_transport * transport ) { <nl> grpc_transport * grpc_create_chttp2_transport ( <nl> const grpc_channel_args * channel_args , grpc_endpoint * ep , bool is_client , <nl> grpc_resource_user * resource_user ) { <nl> - auto t = grpc_core : : New < grpc_chttp2_transport > ( channel_args , ep , is_client , <nl> - resource_user ) ; <nl> + auto t = <nl> + new grpc_chttp2_transport ( channel_args , ep , is_client , resource_user ) ; <nl> return & t - > base ; <nl> } <nl> <nl> mmm a / src / core / ext / transport / chttp2 / transport / context_list . cc <nl> ppp b / src / core / ext / transport / chttp2 / transport / context_list . cc <nl> void ContextList : : Append ( ContextList * * head , grpc_chttp2_stream * s ) { <nl> return ; <nl> } <nl> / * Create a new element in the list and add it at the front * / <nl> - ContextList * elem = grpc_core : : New < ContextList > ( ) ; <nl> + ContextList * elem = new ContextList ( ) ; <nl> elem - > trace_context_ = get_copied_context_fn_g ( s - > context ) ; <nl> elem - > byte_offset_ = s - > byte_counter ; <nl> elem - > next_ = * head ; <nl> void ContextList : : Execute ( void * arg , grpc_core : : Timestamps * ts , <nl> } <nl> to_be_freed = head ; <nl> head = head - > next_ ; <nl> - grpc_core : : Delete ( to_be_freed ) ; <nl> + delete to_be_freed ; <nl> } <nl> } <nl> <nl> mmm a / src / core / ext / transport / chttp2 / transport / frame_data . cc <nl> ppp b / src / core / ext / transport / chttp2 / transport / frame_data . cc <nl> grpc_error * grpc_deframe_unprocessed_incoming_frames ( <nl> if ( p - > is_frame_compressed ) { <nl> message_flags | = GRPC_WRITE_INTERNAL_COMPRESS ; <nl> } <nl> - p - > parsing_frame = grpc_core : : New < grpc_core : : Chttp2IncomingByteStream > ( <nl> + p - > parsing_frame = new grpc_core : : Chttp2IncomingByteStream ( <nl> t , s , p - > frame_size , message_flags ) ; <nl> stream_out - > reset ( p - > parsing_frame ) ; <nl> if ( p - > parsing_frame - > remaining_bytes ( ) = = 0 ) { <nl> mmm a / src / core / ext / transport / chttp2 / transport / internal . h <nl> ppp b / src / core / ext / transport / chttp2 / transport / internal . h <nl> class Chttp2IncomingByteStream : public ByteStream { <nl> void Ref ( ) { refs_ . Ref ( ) ; } <nl> void Unref ( ) { <nl> if ( GPR_UNLIKELY ( refs_ . Unref ( ) ) ) { <nl> - grpc_core : : Delete ( this ) ; <nl> + delete this ; <nl> } <nl> } <nl> <nl> inline void grpc_chttp2_unref_transport ( grpc_chttp2_transport * t , <nl> const char * reason , const char * file , <nl> int line ) { <nl> if ( t - > refs . Unref ( grpc_core : : DebugLocation ( file , line ) , reason ) ) { <nl> - grpc_core : : Delete ( t ) ; <nl> + delete t ; <nl> } <nl> } <nl> inline void grpc_chttp2_ref_transport ( grpc_chttp2_transport * t , <nl> inline void grpc_chttp2_ref_transport ( grpc_chttp2_transport * t , <nl> # define GRPC_CHTTP2_UNREF_TRANSPORT ( t , r ) grpc_chttp2_unref_transport ( t ) <nl> inline void grpc_chttp2_unref_transport ( grpc_chttp2_transport * t ) { <nl> if ( t - > refs . Unref ( ) ) { <nl> - grpc_core : : Delete ( t ) ; <nl> + delete t ; <nl> } <nl> } <nl> inline void grpc_chttp2_ref_transport ( grpc_chttp2_transport * t ) { <nl> mmm a / src / core / ext / transport / cronet / transport / cronet_transport . cc <nl> ppp b / src / core / ext / transport / cronet / transport / cronet_transport . cc <nl> static void add_to_storage ( struct stream_obj * s , <nl> struct op_storage * storage = & s - > storage ; <nl> / * add new op at the beginning of the linked list . The memory is freed <nl> in remove_from_storage * / <nl> - op_and_state * new_op = grpc_core : : New < op_and_state > ( s , * op ) ; <nl> + op_and_state * new_op = new op_and_state ( s , * op ) ; <nl> gpr_mu_lock ( & s - > mu ) ; <nl> new_op - > next = storage - > head ; <nl> storage - > head = new_op ; <nl> static void remove_from_storage ( struct stream_obj * s , <nl> } <nl> if ( s - > storage . head = = oas ) { <nl> s - > storage . head = oas - > next ; <nl> - grpc_core : : Delete ( oas ) ; <nl> + delete oas ; <nl> s - > storage . num_pending_ops - - ; <nl> CRONET_LOG ( GPR_DEBUG , " Freed % p . Now % d in the queue " , oas , <nl> s - > storage . num_pending_ops ) ; <nl> static void remove_from_storage ( struct stream_obj * s , <nl> s - > storage . num_pending_ops - - ; <nl> CRONET_LOG ( GPR_DEBUG , " Freed % p . Now % d in the queue " , oas , <nl> s - > storage . num_pending_ops ) ; <nl> - grpc_core : : Delete ( oas ) ; <nl> + delete oas ; <nl> break ; <nl> } else if ( GPR_UNLIKELY ( curr - > next = = nullptr ) ) { <nl> CRONET_LOG ( GPR_ERROR , " Reached end of LL and did not find op to free " ) ; <nl> mmm a / src / core / lib / channel / channel_trace . cc <nl> ppp b / src / core / lib / channel / channel_trace . cc <nl> ChannelTrace : : ~ ChannelTrace ( ) { <nl> while ( it ! = nullptr ) { <nl> TraceEvent * to_free = it ; <nl> it = it - > next ( ) ; <nl> - Delete < TraceEvent > ( to_free ) ; <nl> + delete to_free ; <nl> } <nl> gpr_mu_destroy ( & tracer_mu_ ) ; <nl> } <nl> void ChannelTrace : : AddTraceEventHelper ( TraceEvent * new_trace_event ) { <nl> TraceEvent * to_free = head_trace_ ; <nl> event_list_memory_usage_ - = to_free - > memory_usage ( ) ; <nl> head_trace_ = head_trace_ - > next ( ) ; <nl> - Delete < TraceEvent > ( to_free ) ; <nl> + delete to_free ; <nl> } <nl> } <nl> <nl> void ChannelTrace : : AddTraceEvent ( Severity severity , const grpc_slice & data ) { <nl> grpc_slice_unref_internal ( data ) ; <nl> return ; / / tracing is disabled if max_event_memory_ = = 0 <nl> } <nl> - AddTraceEventHelper ( New < TraceEvent > ( severity , data ) ) ; <nl> + AddTraceEventHelper ( new TraceEvent ( severity , data ) ) ; <nl> } <nl> <nl> void ChannelTrace : : AddTraceEventWithReference ( <nl> void ChannelTrace : : AddTraceEventWithReference ( <nl> } <nl> / / create and fill up the new event <nl> AddTraceEventHelper ( <nl> - New < TraceEvent > ( severity , data , std : : move ( referenced_entity ) ) ) ; <nl> + new TraceEvent ( severity , data , std : : move ( referenced_entity ) ) ) ; <nl> } <nl> <nl> namespace { <nl> mmm a / src / core / lib / channel / channelz_registry . cc <nl> ppp b / src / core / lib / channel / channelz_registry . cc <nl> const int kPaginationLimit = 100 ; <nl> <nl> } / / anonymous namespace <nl> <nl> - void ChannelzRegistry : : Init ( ) { g_channelz_registry = New < ChannelzRegistry > ( ) ; } <nl> + void ChannelzRegistry : : Init ( ) { g_channelz_registry = new ChannelzRegistry ( ) ; } <nl> <nl> - void ChannelzRegistry : : Shutdown ( ) { Delete ( g_channelz_registry ) ; } <nl> + void ChannelzRegistry : : Shutdown ( ) { delete g_channelz_registry ; } <nl> <nl> ChannelzRegistry * ChannelzRegistry : : Default ( ) { <nl> GPR_DEBUG_ASSERT ( g_channelz_registry ! = nullptr ) ; <nl> mmm a / src / core / lib / gprpp / fork . cc <nl> ppp b / src / core / lib / gprpp / fork . cc <nl> void Fork : : GlobalInit ( ) { <nl> MemoryOrder : : RELAXED ) ; <nl> } <nl> if ( support_enabled_ . Load ( MemoryOrder : : RELAXED ) ) { <nl> - exec_ctx_state_ = grpc_core : : New < internal : : ExecCtxState > ( ) ; <nl> - thread_state_ = grpc_core : : New < internal : : ThreadState > ( ) ; <nl> + exec_ctx_state_ = new internal : : ExecCtxState ( ) ; <nl> + thread_state_ = new internal : : ThreadState ( ) ; <nl> } <nl> } <nl> <nl> void Fork : : GlobalShutdown ( ) { <nl> if ( support_enabled_ . Load ( MemoryOrder : : RELAXED ) ) { <nl> - grpc_core : : Delete ( exec_ctx_state_ ) ; <nl> - grpc_core : : Delete ( thread_state_ ) ; <nl> + delete exec_ctx_state_ ; <nl> + delete thread_state_ ; <nl> } <nl> } <nl> <nl> mmm a / src / core / lib / gprpp / memory . h <nl> ppp b / src / core / lib / gprpp / memory . h <nl> <nl> <nl> namespace grpc_core { <nl> <nl> - / / Alternative to new , to ensure memory allocation being wrapped to gpr_malloc <nl> - template < typename T , typename . . . Args > <nl> - inline T * New ( Args & & . . . args ) { <nl> - void * p = gpr_malloc ( sizeof ( T ) ) ; <nl> - return new ( p ) T ( std : : forward < Args > ( args ) . . . ) ; <nl> - } <nl> - <nl> - / / Gets the base pointer of any class , in case of multiple inheritance . <nl> - / / Used by Delete and friends . <nl> - template < typename T , bool isPolymorphic > <nl> - struct BasePointerGetter { <nl> - static void * get ( T * p ) { return p ; } <nl> - } ; <nl> - <nl> - template < typename T > <nl> - struct BasePointerGetter < T , true > { <nl> - static void * get ( T * p ) { return dynamic_cast < void * > ( p ) ; } <nl> - } ; <nl> - <nl> - / / Alternative to delete , to ensure memory allocation being wrapped to gpr_free <nl> template < typename T > <nl> - inline void Delete ( T * p ) { <nl> - if ( p = = nullptr ) return ; <nl> - void * basePtr = BasePointerGetter < T , std : : is_polymorphic < T > : : value > : : get ( p ) ; <nl> - p - > ~ T ( ) ; <nl> - gpr_free ( basePtr ) ; <nl> - } <nl> - <nl> - class DefaultDelete { <nl> - public : <nl> - template < typename T > <nl> - void operator ( ) ( T * p ) { <nl> - / / Delete ( ) checks whether the value is null , but std : : unique_ptr < > is <nl> - / / guaranteed not to call the deleter if the pointer is nullptr <nl> - / / ( i . e . , it already does this check for us ) , and we don ' t want to <nl> - / / do the check twice . So , instead of calling Delete ( ) here , we <nl> - / / manually call the object ' s dtor and free it . <nl> - void * basePtr = BasePointerGetter < T , std : : is_polymorphic < T > : : value > : : get ( p ) ; <nl> - p - > ~ T ( ) ; <nl> - gpr_free ( basePtr ) ; <nl> - } <nl> - } ; <nl> - <nl> - template < typename T , typename Deleter = DefaultDelete > <nl> - using UniquePtr = std : : unique_ptr < T , Deleter > ; <nl> + using UniquePtr = std : : unique_ptr < T > ; <nl> <nl> template < typename T , typename . . . Args > <nl> inline UniquePtr < T > MakeUnique ( Args & & . . . args ) { <nl> - return UniquePtr < T > ( New < T > ( std : : forward < Args > ( args ) . . . ) ) ; <nl> + return UniquePtr < T > ( new T ( std : : forward < Args > ( args ) . . . ) ) ; <nl> } <nl> <nl> / / an allocator that uses gpr_malloc / gpr_free <nl> mmm a / src / core / lib / gprpp / orphanable . h <nl> ppp b / src / core / lib / gprpp / orphanable . h <nl> using OrphanablePtr = std : : unique_ptr < T , Deleter > ; <nl> <nl> template < typename T , typename . . . Args > <nl> inline OrphanablePtr < T > MakeOrphanable ( Args & & . . . args ) { <nl> - return OrphanablePtr < T > ( New < T > ( std : : forward < Args > ( args ) . . . ) ) ; <nl> + return OrphanablePtr < T > ( new T ( std : : forward < Args > ( args ) . . . ) ) ; <nl> } <nl> <nl> / / A type of Orphanable with internal ref - counting . <nl> class InternallyRefCounted : public Orphanable { <nl> <nl> void Unref ( ) { <nl> if ( GPR_UNLIKELY ( refs_ . Unref ( ) ) ) { <nl> - Delete ( static_cast < Child * > ( this ) ) ; <nl> + delete this ; <nl> } <nl> } <nl> void Unref ( const DebugLocation & location , const char * reason ) { <nl> if ( GPR_UNLIKELY ( refs_ . Unref ( location , reason ) ) ) { <nl> - Delete ( static_cast < Child * > ( this ) ) ; <nl> + delete this ; <nl> } <nl> } <nl> <nl> mmm a / src / core / lib / gprpp / ref_counted . h <nl> ppp b / src / core / lib / gprpp / ref_counted . h <nl> class RefCount { <nl> <nl> / / A base class for reference - counted objects . <nl> / / New objects should be created via New ( ) and start with a refcount of 1 . <nl> - / / When the refcount reaches 0 , the object will be deleted via Delete ( ) . <nl> + / / When the refcount reaches 0 , the object will be deleted via delete . <nl> / / <nl> / / This will commonly be used by CRTP ( curiously - recurring template pattern ) <nl> / / e . g . , class MyClass : public RefCounted < MyClass > <nl> class RefCounted : public Impl { <nl> / / friend of this class . <nl> void Unref ( ) { <nl> if ( GPR_UNLIKELY ( refs_ . Unref ( ) ) ) { <nl> - Delete ( static_cast < Child * > ( this ) ) ; <nl> + delete static_cast < Child * > ( this ) ; <nl> } <nl> } <nl> void Unref ( const DebugLocation & location , const char * reason ) { <nl> if ( GPR_UNLIKELY ( refs_ . Unref ( location , reason ) ) ) { <nl> - Delete ( static_cast < Child * > ( this ) ) ; <nl> + delete static_cast < Child * > ( this ) ; <nl> } <nl> } <nl> <nl> mmm a / src / core / lib / gprpp / ref_counted_ptr . h <nl> ppp b / src / core / lib / gprpp / ref_counted_ptr . h <nl> class RefCountedPtr { <nl> <nl> template < typename T , typename . . . Args > <nl> inline RefCountedPtr < T > MakeRefCounted ( Args & & . . . args ) { <nl> - return RefCountedPtr < T > ( New < T > ( std : : forward < Args > ( args ) . . . ) ) ; <nl> + return RefCountedPtr < T > ( new T ( std : : forward < Args > ( args ) . . . ) ) ; <nl> } <nl> <nl> } / / namespace grpc_core <nl> mmm a / src / core / lib / gprpp / thd . h <nl> ppp b / src / core / lib / gprpp / thd . h <nl> class Thread { <nl> void Join ( ) { <nl> if ( impl_ ! = nullptr ) { <nl> impl_ - > Join ( ) ; <nl> - grpc_core : : Delete ( impl_ ) ; <nl> + delete impl_ ; <nl> state_ = DONE ; <nl> impl_ = nullptr ; <nl> } else { <nl> mmm a / src / core / lib / gprpp / thd_posix . cc <nl> ppp b / src / core / lib / gprpp / thd_posix . cc <nl> class ThreadInternalsPosix : public internal : : ThreadInternalsInterface { <nl> gpr_mu_unlock ( & arg . thread - > mu_ ) ; <nl> <nl> if ( ! arg . joinable ) { <nl> - Delete ( arg . thread ) ; <nl> + delete arg . thread ; <nl> } <nl> <nl> ( * arg . body ) ( arg . arg ) ; <nl> Thread : : Thread ( const char * thd_name , void ( * thd_body ) ( void * arg ) , void * arg , <nl> bool * success , const Options & options ) <nl> : options_ ( options ) { <nl> bool outcome = false ; <nl> - impl_ = New < ThreadInternalsPosix > ( thd_name , thd_body , arg , & outcome , options ) ; <nl> + impl_ = new ThreadInternalsPosix ( thd_name , thd_body , arg , & outcome , options ) ; <nl> if ( outcome ) { <nl> state_ = ALIVE ; <nl> } else { <nl> state_ = FAILED ; <nl> - Delete ( impl_ ) ; <nl> + delete impl_ ; <nl> impl_ = nullptr ; <nl> } <nl> <nl> mmm a / src / core / lib / gprpp / thd_windows . cc <nl> ppp b / src / core / lib / gprpp / thd_windows . cc <nl> class ThreadInternalsWindows <nl> } <nl> gpr_mu_unlock ( & g_thd_info - > thread - > mu_ ) ; <nl> if ( ! g_thd_info - > joinable ) { <nl> - grpc_core : : Delete ( g_thd_info - > thread ) ; <nl> + delete g_thd_info - > thread ; <nl> g_thd_info - > thread = nullptr ; <nl> } <nl> g_thd_info - > body ( g_thd_info - > arg ) ; <nl> Thread : : Thread ( const char * thd_name , void ( * thd_body ) ( void * arg ) , void * arg , <nl> bool * success , const Options & options ) <nl> : options_ ( options ) { <nl> bool outcome = false ; <nl> - impl_ = New < ThreadInternalsWindows > ( thd_body , arg , & outcome , options ) ; <nl> + impl_ = new ThreadInternalsWindows ( thd_body , arg , & outcome , options ) ; <nl> if ( outcome ) { <nl> state_ = ALIVE ; <nl> } else { <nl> state_ = FAILED ; <nl> - Delete ( impl_ ) ; <nl> + delete impl_ ; <nl> impl_ = nullptr ; <nl> } <nl> <nl> mmm a / src / core / lib / http / httpcli_security_connector . cc <nl> ppp b / src / core / lib / http / httpcli_security_connector . cc <nl> static void on_handshake_done ( void * arg , grpc_error * error ) { <nl> gpr_free ( args - > read_buffer ) ; <nl> c - > func ( c - > arg , args - > endpoint ) ; <nl> } <nl> - grpc_core : : Delete < on_done_closure > ( c ) ; <nl> + delete c ; <nl> } <nl> <nl> static void ssl_handshake ( void * arg , grpc_endpoint * tcp , const char * host , <nl> grpc_millis deadline , <nl> void ( * on_done ) ( void * arg , grpc_endpoint * endpoint ) ) { <nl> - auto * c = grpc_core : : New < on_done_closure > ( ) ; <nl> + auto * c = new on_done_closure ( ) ; <nl> const char * pem_root_certs = <nl> grpc_core : : DefaultSslRootStore : : GetPemRootCerts ( ) ; <nl> const tsi_ssl_root_certs_store * root_store = <nl> mmm a / src / core / lib / iomgr / buffer_list . cc <nl> ppp b / src / core / lib / iomgr / buffer_list . cc <nl> static int get_socket_tcp_info ( grpc_core : : tcp_info * info , int fd ) { <nl> void TracedBuffer : : AddNewEntry ( TracedBuffer * * head , uint32_t seq_no , int fd , <nl> void * arg ) { <nl> GPR_DEBUG_ASSERT ( head ! = nullptr ) ; <nl> - TracedBuffer * new_elem = New < TracedBuffer > ( seq_no , arg ) ; <nl> + TracedBuffer * new_elem = new TracedBuffer ( seq_no , arg ) ; <nl> / * Store the current time as the sendmsg time . * / <nl> new_elem - > ts_ . sendmsg_time . time = gpr_now ( GPR_CLOCK_REALTIME ) ; <nl> new_elem - > ts_ . scheduled_time . time = gpr_inf_past ( GPR_CLOCK_REALTIME ) ; <nl> void TracedBuffer : : ProcessTimestamp ( TracedBuffer * * head , <nl> * restriction on the lifetime . * / <nl> timestamps_callback ( elem - > arg_ , & ( elem - > ts_ ) , GRPC_ERROR_NONE ) ; <nl> next = elem - > next_ ; <nl> - Delete < TracedBuffer > ( elem ) ; <nl> + delete static_cast < TracedBuffer * > ( elem ) ; <nl> * head = elem = next ; <nl> break ; <nl> default : <nl> void TracedBuffer : : Shutdown ( TracedBuffer * * head , void * remaining , <nl> while ( elem ! = nullptr ) { <nl> timestamps_callback ( elem - > arg_ , & ( elem - > ts_ ) , shutdown_err ) ; <nl> auto * next = elem - > next_ ; <nl> - Delete < TracedBuffer > ( elem ) ; <nl> + delete elem ; <nl> elem = next ; <nl> } <nl> * head = nullptr ; <nl> mmm a / src / core / lib / iomgr / cfstream_handle . cc <nl> ppp b / src / core / lib / iomgr / cfstream_handle . cc <nl> void CFStreamHandle : : Release ( void * info ) { <nl> <nl> CFStreamHandle * CFStreamHandle : : CreateStreamHandle ( <nl> CFReadStreamRef read_stream , CFWriteStreamRef write_stream ) { <nl> - return grpc_core : : New < CFStreamHandle > ( read_stream , write_stream ) ; <nl> + return new CFStreamHandle ( read_stream , write_stream ) ; <nl> } <nl> <nl> void CFStreamHandle : : ReadCallback ( CFReadStreamRef stream , <nl> void CFStreamHandle : : Unref ( const char * file , int line , const char * reason ) { <nl> reason , val , val - 1 ) ; <nl> } <nl> if ( gpr_unref ( & refcount_ ) ) { <nl> - grpc_core : : Delete < CFStreamHandle > ( this ) ; <nl> + delete this ; <nl> } <nl> } <nl> <nl> mmm a / src / core / lib / iomgr / combiner . cc <nl> ppp b / src / core / lib / iomgr / combiner . cc <nl> static void combiner_finally_exec ( grpc_core : : Combiner * lock , <nl> static void offload ( void * arg , grpc_error * error ) ; <nl> <nl> grpc_core : : Combiner * grpc_combiner_create ( void ) { <nl> - grpc_core : : Combiner * lock = grpc_core : : New < grpc_core : : Combiner > ( ) ; <nl> + grpc_core : : Combiner * lock = new grpc_core : : Combiner ( ) ; <nl> gpr_ref_init ( & lock - > refs , 1 ) ; <nl> gpr_atm_no_barrier_store ( & lock - > state , STATE_UNORPHANED ) ; <nl> grpc_closure_list_init ( & lock - > final_list ) ; <nl> grpc_core : : Combiner * grpc_combiner_create ( void ) { <nl> static void really_destroy ( grpc_core : : Combiner * lock ) { <nl> GRPC_COMBINER_TRACE ( gpr_log ( GPR_INFO , " C : % p really_destroy " , lock ) ) ; <nl> GPR_ASSERT ( gpr_atm_no_barrier_load ( & lock - > state ) = = 0 ) ; <nl> - grpc_core : : Delete ( lock ) ; <nl> + delete lock ; <nl> } <nl> <nl> static void start_destroy ( grpc_core : : Combiner * lock ) { <nl> mmm a / src / core / lib / iomgr / executor . cc <nl> ppp b / src / core / lib / iomgr / executor . cc <nl> void Executor : : InitAll ( ) { <nl> } <nl> <nl> executors [ static_cast < size_t > ( ExecutorType : : DEFAULT ) ] = <nl> - grpc_core : : New < Executor > ( " default - executor " ) ; <nl> + new Executor ( " default - executor " ) ; <nl> executors [ static_cast < size_t > ( ExecutorType : : RESOLVER ) ] = <nl> - grpc_core : : New < Executor > ( " resolver - executor " ) ; <nl> + new Executor ( " resolver - executor " ) ; <nl> <nl> executors [ static_cast < size_t > ( ExecutorType : : DEFAULT ) ] - > Init ( ) ; <nl> executors [ static_cast < size_t > ( ExecutorType : : RESOLVER ) ] - > Init ( ) ; <nl> void Executor : : ShutdownAll ( ) { <nl> / / Delete the executor objects . <nl> / / <nl> / / NOTE : It is important to call Shutdown ( ) on all executors first before <nl> - / / calling Delete ( ) because it is possible for one executor ( that is not <nl> + / / calling delete because it is possible for one executor ( that is not <nl> / / shutdown yet ) to call Enqueue ( ) on a different executor which is already <nl> / / shutdown . This is legal and in such cases , the Enqueue ( ) operation <nl> / / effectively " fails " and enqueues that closure on the calling thread ' s <nl> void Executor : : ShutdownAll ( ) { <nl> / / By ensuring that all executors are shutdown first , we are also ensuring <nl> / / that no thread is active across all executors . <nl> <nl> - grpc_core : : Delete < Executor > ( <nl> - executors [ static_cast < size_t > ( ExecutorType : : DEFAULT ) ] ) ; <nl> - grpc_core : : Delete < Executor > ( <nl> - executors [ static_cast < size_t > ( ExecutorType : : RESOLVER ) ] ) ; <nl> + delete executors [ static_cast < size_t > ( ExecutorType : : DEFAULT ) ] ; <nl> + delete executors [ static_cast < size_t > ( ExecutorType : : RESOLVER ) ] ; <nl> executors [ static_cast < size_t > ( ExecutorType : : DEFAULT ) ] = nullptr ; <nl> executors [ static_cast < size_t > ( ExecutorType : : RESOLVER ) ] = nullptr ; <nl> <nl> mmm a / src / core / lib / iomgr / executor / threadpool . cc <nl> ppp b / src / core / lib / iomgr / executor / threadpool . cc <nl> void ThreadPool : : SharedThreadPoolConstructor ( ) { <nl> / / Create at least 1 worker thread . <nl> if ( num_threads_ < = 0 ) num_threads_ = 1 ; <nl> <nl> - queue_ = New < InfLenFIFOQueue > ( ) ; <nl> + queue_ = new InfLenFIFOQueue ( ) ; <nl> threads_ = static_cast < ThreadPoolWorker * * > ( <nl> gpr_zalloc ( num_threads_ * sizeof ( ThreadPoolWorker * ) ) ) ; <nl> for ( int i = 0 ; i < num_threads_ ; + + i ) { <nl> - threads_ [ i ] = New < ThreadPoolWorker > ( thd_name_ , queue_ , thread_options_ , i ) ; <nl> + threads_ [ i ] = new ThreadPoolWorker ( thd_name_ , queue_ , thread_options_ , i ) ; <nl> threads_ [ i ] - > Start ( ) ; <nl> } <nl> } <nl> ThreadPool : : ~ ThreadPool ( ) { <nl> } <nl> <nl> for ( int i = 0 ; i < num_threads_ ; + + i ) { <nl> - Delete ( threads_ [ i ] ) ; <nl> + delete threads_ [ i ] ; <nl> } <nl> gpr_free ( threads_ ) ; <nl> - Delete ( queue_ ) ; <nl> + delete queue_ ; <nl> } <nl> <nl> void ThreadPool : : Add ( grpc_experimental_completion_queue_functor * closure ) { <nl> mmm a / src / core / lib / iomgr / resolve_address_custom . cc <nl> ppp b / src / core / lib / iomgr / resolve_address_custom . cc <nl> static grpc_error * try_split_host_port ( const char * name , <nl> grpc_core : : UniquePtr < char > * port ) { <nl> / * parse name , splitting it into host and port parts * / <nl> grpc_error * error ; <nl> - SplitHostPort ( name , host , port ) ; <nl> + grpc_core : : SplitHostPort ( name , host , port ) ; <nl> if ( * host = = nullptr ) { <nl> char * msg ; <nl> gpr_asprintf ( & msg , " unparseable host : port : ' % s ' " , name ) ; <nl> mmm a / src / core / lib / iomgr / tcp_server_posix . cc <nl> ppp b / src / core / lib / iomgr / tcp_server_posix . cc <nl> static void finish_shutdown ( grpc_tcp_server * s ) { <nl> gpr_free ( sp ) ; <nl> } <nl> grpc_channel_args_destroy ( s - > channel_args ) ; <nl> - grpc_core : : Delete ( s - > fd_handler ) ; <nl> + delete s - > fd_handler ; <nl> <nl> gpr_free ( s ) ; <nl> } <nl> class ExternalConnectionHandler : public grpc_core : : TcpServerFdHandler { <nl> <nl> static grpc_core : : TcpServerFdHandler * tcp_server_create_fd_handler ( <nl> grpc_tcp_server * s ) { <nl> - s - > fd_handler = grpc_core : : New < ExternalConnectionHandler > ( s ) ; <nl> + s - > fd_handler = new ExternalConnectionHandler ( s ) ; <nl> return s - > fd_handler ; <nl> } <nl> <nl> mmm a / src / core / lib / iomgr / udp_server . cc <nl> ppp b / src / core / lib / iomgr / udp_server . cc <nl> static grpc_socket_factory * get_socket_factory ( const grpc_channel_args * args ) { <nl> } <nl> <nl> grpc_udp_server * grpc_udp_server_create ( const grpc_channel_args * args ) { <nl> - grpc_udp_server * s = grpc_core : : New < grpc_udp_server > ( ) ; <nl> + grpc_udp_server * s = new grpc_udp_server ( ) ; <nl> gpr_mu_init ( & s - > mu ) ; <nl> s - > socket_factory = get_socket_factory ( args ) ; <nl> if ( s - > socket_factory ) { <nl> static void finish_shutdown ( grpc_udp_server * s ) { <nl> grpc_socket_factory_unref ( s - > socket_factory ) ; <nl> } <nl> <nl> - grpc_core : : Delete ( s ) ; <nl> + delete s ; <nl> } <nl> <nl> static void destroyed_port ( void * server , grpc_error * / * error * / ) { <nl> mmm a / src / core / lib / security / credentials / alts / alts_credentials . cc <nl> ppp b / src / core / lib / security / credentials / alts / alts_credentials . cc <nl> grpc_channel_credentials * grpc_alts_credentials_create_customized ( <nl> if ( ! enable_untrusted_alts & & ! grpc_alts_is_running_on_gcp ( ) ) { <nl> return nullptr ; <nl> } <nl> - return grpc_core : : New < grpc_alts_credentials > ( options , handshaker_service_url ) ; <nl> + return new grpc_alts_credentials ( options , handshaker_service_url ) ; <nl> } <nl> <nl> grpc_server_credentials * grpc_alts_server_credentials_create_customized ( <nl> grpc_server_credentials * grpc_alts_server_credentials_create_customized ( <nl> if ( ! enable_untrusted_alts & & ! grpc_alts_is_running_on_gcp ( ) ) { <nl> return nullptr ; <nl> } <nl> - return grpc_core : : New < grpc_alts_server_credentials > ( options , <nl> - handshaker_service_url ) ; <nl> + return new grpc_alts_server_credentials ( options , handshaker_service_url ) ; <nl> } <nl> <nl> grpc_channel_credentials * grpc_alts_credentials_create ( <nl> mmm a / src / core / lib / security / credentials / composite / composite_credentials . cc <nl> ppp b / src / core / lib / security / credentials / composite / composite_credentials . cc <nl> bool grpc_composite_call_credentials : : get_request_metadata ( <nl> grpc_credentials_mdelem_array * md_array , grpc_closure * on_request_metadata , <nl> grpc_error * * error ) { <nl> grpc_composite_call_credentials_metadata_context * ctx ; <nl> - ctx = grpc_core : : New < grpc_composite_call_credentials_metadata_context > ( <nl> + ctx = new grpc_composite_call_credentials_metadata_context ( <nl> this , pollent , auth_md_context , md_array , on_request_metadata ) ; <nl> bool synchronous = true ; <nl> const CallCredentialsList & inner = ctx - > composite_creds - > inner ( ) ; <nl> bool grpc_composite_call_credentials : : get_request_metadata ( <nl> break ; <nl> } <nl> } <nl> - if ( synchronous ) grpc_core : : Delete ( ctx ) ; <nl> + if ( synchronous ) delete ctx ; <nl> return synchronous ; <nl> } <nl> <nl> grpc_channel_credentials * grpc_composite_channel_credentials_create ( <nl> " grpc_composite_channel_credentials_create ( channel_creds = % p , " <nl> " call_creds = % p , reserved = % p ) " , <nl> 3 , ( channel_creds , call_creds , reserved ) ) ; <nl> - return grpc_core : : New < grpc_composite_channel_credentials > ( <nl> - channel_creds - > Ref ( ) , call_creds - > Ref ( ) ) ; <nl> + return new grpc_composite_channel_credentials ( channel_creds - > Ref ( ) , <nl> + call_creds - > Ref ( ) ) ; <nl> } <nl> mmm a / src / core / lib / security / credentials / credentials . cc <nl> ppp b / src / core / lib / security / credentials / credentials . cc <nl> static gpr_mu g_control_plane_creds_mu ; <nl> static void do_control_plane_creds_init ( ) { <nl> gpr_mu_init ( & g_control_plane_creds_mu ) ; <nl> GPR_ASSERT ( g_grpc_control_plane_creds = = nullptr ) ; <nl> - g_grpc_control_plane_creds = grpc_core : : New < <nl> - std : : map < grpc_core : : UniquePtr < char > , <nl> - grpc_core : : RefCountedPtr < grpc_channel_credentials > , <nl> - grpc_core : : StringLess > > ( ) ; <nl> + g_grpc_control_plane_creds = <nl> + new std : : map < grpc_core : : UniquePtr < char > , <nl> + grpc_core : : RefCountedPtr < grpc_channel_credentials > , <nl> + grpc_core : : StringLess > ( ) ; <nl> } <nl> <nl> void grpc_control_plane_credentials_init ( ) { <nl> void grpc_control_plane_credentials_init ( ) { <nl> } <nl> <nl> void grpc_test_only_control_plane_credentials_destroy ( ) { <nl> - grpc_core : : Delete ( g_grpc_control_plane_creds ) ; <nl> + delete g_grpc_control_plane_creds ; <nl> g_grpc_control_plane_creds = nullptr ; <nl> gpr_mu_destroy ( & g_control_plane_creds_mu ) ; <nl> } <nl> mmm a / src / core / lib / security / credentials / credentials . h <nl> ppp b / src / core / lib / security / credentials / credentials . h <nl> struct grpc_credentials_metadata_request { <nl> inline grpc_credentials_metadata_request * <nl> grpc_credentials_metadata_request_create ( <nl> grpc_core : : RefCountedPtr < grpc_call_credentials > creds ) { <nl> - return grpc_core : : New < grpc_credentials_metadata_request > ( std : : move ( creds ) ) ; <nl> + return new grpc_credentials_metadata_request ( std : : move ( creds ) ) ; <nl> } <nl> <nl> inline void grpc_credentials_metadata_request_destroy ( <nl> grpc_credentials_metadata_request * r ) { <nl> - grpc_core : : Delete ( r ) ; <nl> + delete r ; <nl> } <nl> <nl> # endif / * GRPC_CORE_LIB_SECURITY_CREDENTIALS_CREDENTIALS_H * / <nl> mmm a / src / core / lib / security / credentials / fake / fake_credentials . cc <nl> ppp b / src / core / lib / security / credentials / fake / fake_credentials . cc <nl> class grpc_fake_server_credentials final : public grpc_server_credentials { <nl> } / / namespace <nl> <nl> grpc_channel_credentials * grpc_fake_transport_security_credentials_create ( ) { <nl> - return grpc_core : : New < grpc_fake_channel_credentials > ( ) ; <nl> + return new grpc_fake_channel_credentials ( ) ; <nl> } <nl> <nl> grpc_server_credentials * <nl> grpc_fake_transport_security_server_credentials_create ( ) { <nl> - return grpc_core : : New < grpc_fake_server_credentials > ( ) ; <nl> + return new grpc_fake_server_credentials ( ) ; <nl> } <nl> <nl> grpc_arg grpc_fake_transport_expected_targets_arg ( char * expected_targets ) { <nl> void grpc_md_only_test_credentials : : cancel_get_request_metadata ( <nl> <nl> grpc_call_credentials * grpc_md_only_test_credentials_create ( <nl> const char * md_key , const char * md_value , bool is_async ) { <nl> - return grpc_core : : New < grpc_md_only_test_credentials > ( md_key , md_value , <nl> - is_async ) ; <nl> + return new grpc_md_only_test_credentials ( md_key , md_value , is_async ) ; <nl> } <nl> mmm a / src / core / lib / security / credentials / local / local_credentials . cc <nl> ppp b / src / core / lib / security / credentials / local / local_credentials . cc <nl> grpc_local_credentials : : grpc_local_credentials ( <nl> <nl> grpc_channel_credentials * grpc_local_credentials_create ( <nl> grpc_local_connect_type connect_type ) { <nl> - return grpc_core : : New < grpc_local_credentials > ( connect_type ) ; <nl> + return new grpc_local_credentials ( connect_type ) ; <nl> } <nl> <nl> grpc_local_server_credentials : : grpc_local_server_credentials ( <nl> grpc_local_server_credentials : : grpc_local_server_credentials ( <nl> <nl> grpc_server_credentials * grpc_local_server_credentials_create ( <nl> grpc_local_connect_type connect_type ) { <nl> - return grpc_core : : New < grpc_local_server_credentials > ( connect_type ) ; <nl> + return new grpc_local_server_credentials ( connect_type ) ; <nl> } <nl> mmm a / src / core / lib / security / credentials / oauth2 / oauth2_credentials . cc <nl> ppp b / src / core / lib / security / credentials / oauth2 / oauth2_credentials . cc <nl> grpc_error * ValidateStsCredentialsOptions ( <nl> } ; <nl> * sts_url_out = nullptr ; <nl> InlinedVector < grpc_error * , 3 > error_list ; <nl> - UniquePtr < grpc_uri , GrpcUriDeleter > sts_url ( <nl> + std : : unique_ptr < grpc_uri , GrpcUriDeleter > sts_url ( <nl> options - > token_exchange_service_uri ! = nullptr <nl> ? grpc_uri_parse ( options - > token_exchange_service_uri , false ) <nl> : nullptr ) ; <nl> mmm a / src / core / lib / security / credentials / plugin / plugin_credentials . cc <nl> ppp b / src / core / lib / security / credentials / plugin / plugin_credentials . cc <nl> grpc_call_credentials * grpc_metadata_credentials_create_from_plugin ( <nl> GRPC_API_TRACE ( " grpc_metadata_credentials_create_from_plugin ( reserved = % p ) " , 1 , <nl> ( reserved ) ) ; <nl> GPR_ASSERT ( reserved = = nullptr ) ; <nl> - return grpc_core : : New < grpc_plugin_credentials > ( plugin ) ; <nl> + return new grpc_plugin_credentials ( plugin ) ; <nl> } <nl> mmm a / src / core / lib / security / credentials / ssl / ssl_credentials . cc <nl> ppp b / src / core / lib / security / credentials / ssl / ssl_credentials . cc <nl> grpc_channel_credentials * grpc_ssl_credentials_create ( <nl> 4 , ( pem_root_certs , pem_key_cert_pair , verify_options , reserved ) ) ; <nl> GPR_ASSERT ( reserved = = nullptr ) ; <nl> <nl> - return grpc_core : : New < grpc_ssl_credentials > ( <nl> + return new grpc_ssl_credentials ( <nl> pem_root_certs , pem_key_cert_pair , <nl> reinterpret_cast < const grpc_ssl_verify_peer_options * > ( verify_options ) ) ; <nl> } <nl> grpc_channel_credentials * grpc_ssl_credentials_create_ex ( <nl> 4 , ( pem_root_certs , pem_key_cert_pair , verify_options , reserved ) ) ; <nl> GPR_ASSERT ( reserved = = nullptr ) ; <nl> <nl> - return grpc_core : : New < grpc_ssl_credentials > ( pem_root_certs , pem_key_cert_pair , <nl> - verify_options ) ; <nl> + return new grpc_ssl_credentials ( pem_root_certs , pem_key_cert_pair , <nl> + verify_options ) ; <nl> } <nl> <nl> / / <nl> grpc_server_credentials * grpc_ssl_server_credentials_create_with_options ( <nl> goto done ; <nl> } <nl> <nl> - retval = grpc_core : : New < grpc_ssl_server_credentials > ( * options ) ; <nl> + retval = new grpc_ssl_server_credentials ( * options ) ; <nl> <nl> done : <nl> grpc_ssl_server_credentials_options_destroy ( options ) ; <nl> mmm a / src / core / lib / security / credentials / tls / grpc_tls_credentials_options . cc <nl> ppp b / src / core / lib / security / credentials / tls / grpc_tls_credentials_options . cc <nl> grpc_tls_server_authorization_check_config : : <nl> <nl> / * * - - Wrapper APIs declared in grpc_security . h - - * * / <nl> grpc_tls_credentials_options * grpc_tls_credentials_options_create ( ) { <nl> - return grpc_core : : New < grpc_tls_credentials_options > ( ) ; <nl> + return new grpc_tls_credentials_options ( ) ; <nl> } <nl> <nl> int grpc_tls_credentials_options_set_cert_request_type ( <nl> int grpc_tls_credentials_options_set_server_authorization_check_config ( <nl> } <nl> <nl> grpc_tls_key_materials_config * grpc_tls_key_materials_config_create ( ) { <nl> - return grpc_core : : New < grpc_tls_key_materials_config > ( ) ; <nl> + return new grpc_tls_key_materials_config ( ) ; <nl> } <nl> <nl> int grpc_tls_key_materials_config_set_key_materials ( <nl> grpc_tls_credential_reload_config * grpc_tls_credential_reload_config_create ( <nl> " Schedule API is nullptr in creating TLS credential reload config . " ) ; <nl> return nullptr ; <nl> } <nl> - return grpc_core : : New < grpc_tls_credential_reload_config > ( <nl> - config_user_data , schedule , cancel , destruct ) ; <nl> + return new grpc_tls_credential_reload_config ( config_user_data , schedule , <nl> + cancel , destruct ) ; <nl> } <nl> <nl> grpc_tls_server_authorization_check_config * <nl> grpc_tls_server_authorization_check_config_create ( <nl> " check config . " ) ; <nl> return nullptr ; <nl> } <nl> - return grpc_core : : New < grpc_tls_server_authorization_check_config > ( <nl> + return new grpc_tls_server_authorization_check_config ( <nl> config_user_data , schedule , cancel , destruct ) ; <nl> } <nl> mmm a / src / core / lib / security / credentials / tls / spiffe_credentials . cc <nl> ppp b / src / core / lib / security / credentials / tls / spiffe_credentials . cc <nl> grpc_channel_credentials * grpc_tls_spiffe_credentials_create ( <nl> if ( ! CredentialOptionSanityCheck ( options , true / * is_client * / ) ) { <nl> return nullptr ; <nl> } <nl> - return grpc_core : : New < SpiffeCredentials > ( <nl> + return new SpiffeCredentials ( <nl> grpc_core : : RefCountedPtr < grpc_tls_credentials_options > ( options ) ) ; <nl> } <nl> <nl> grpc_server_credentials * grpc_tls_spiffe_server_credentials_create ( <nl> if ( ! CredentialOptionSanityCheck ( options , false / * is_client * / ) ) { <nl> return nullptr ; <nl> } <nl> - return grpc_core : : New < SpiffeServerCredentials > ( <nl> + return new SpiffeServerCredentials ( <nl> grpc_core : : RefCountedPtr < grpc_tls_credentials_options > ( options ) ) ; <nl> } <nl> mmm a / src / core / lib / security / security_connector / tls / spiffe_security_connector . cc <nl> ppp b / src / core / lib / security / security_connector / tls / spiffe_security_connector . cc <nl> grpc_status_code TlsFetchKeyMaterials ( <nl> grpc_status_code status = GRPC_STATUS_OK ; <nl> / * Use credential reload config to fetch credentials . * / <nl> if ( options . credential_reload_config ( ) ! = nullptr ) { <nl> - grpc_tls_credential_reload_arg * arg = <nl> - grpc_core : : New < grpc_tls_credential_reload_arg > ( ) ; <nl> + grpc_tls_credential_reload_arg * arg = new grpc_tls_credential_reload_arg ( ) ; <nl> arg - > key_materials_config = key_materials_config . get ( ) ; <nl> int result = options . credential_reload_config ( ) - > Schedule ( arg ) ; <nl> if ( result ) { <nl> grpc_status_code TlsFetchKeyMaterials ( <nl> if ( arg - > destroy_context ! = nullptr ) { <nl> arg - > destroy_context ( arg - > context ) ; <nl> } <nl> - grpc_core : : Delete ( arg ) ; <nl> + delete arg ; <nl> } <nl> return status ; <nl> } <nl> grpc_tls_server_authorization_check_arg * <nl> SpiffeChannelSecurityConnector : : ServerAuthorizationCheckArgCreate ( <nl> void * user_data ) { <nl> grpc_tls_server_authorization_check_arg * arg = <nl> - grpc_core : : New < grpc_tls_server_authorization_check_arg > ( ) ; <nl> + new grpc_tls_server_authorization_check_arg ( ) ; <nl> arg - > cb = ServerAuthorizationCheckDone ; <nl> arg - > cb_user_data = user_data ; <nl> arg - > status = GRPC_STATUS_OK ; <nl> void SpiffeChannelSecurityConnector : : ServerAuthorizationCheckArgDestroy ( <nl> if ( arg - > destroy_context ! = nullptr ) { <nl> arg - > destroy_context ( arg - > context ) ; <nl> } <nl> - grpc_core : : Delete ( arg ) ; <nl> + delete arg ; <nl> } <nl> <nl> SpiffeServerSecurityConnector : : SpiffeServerSecurityConnector ( <nl> mmm a / src / core / lib / security / transport / secure_endpoint . cc <nl> ppp b / src / core / lib / security / transport / secure_endpoint . cc <nl> struct secure_endpoint { <nl> <nl> grpc_core : : TraceFlag grpc_trace_secure_endpoint ( false , " secure_endpoint " ) ; <nl> <nl> - static void destroy ( secure_endpoint * ep ) { grpc_core : : Delete ( ep ) ; } <nl> + static void destroy ( secure_endpoint * ep ) { delete ep ; } <nl> <nl> # ifndef NDEBUG <nl> # define SECURE_ENDPOINT_UNREF ( ep , reason ) \ <nl> grpc_endpoint * grpc_secure_endpoint_create ( <nl> struct tsi_zero_copy_grpc_protector * zero_copy_protector , <nl> grpc_endpoint * transport , grpc_slice * leftover_slices , <nl> size_t leftover_nslices ) { <nl> - secure_endpoint * ep = grpc_core : : New < secure_endpoint > ( <nl> - & vtable , protector , zero_copy_protector , transport , leftover_slices , <nl> - leftover_nslices ) ; <nl> + secure_endpoint * ep = <nl> + new secure_endpoint ( & vtable , protector , zero_copy_protector , transport , <nl> + leftover_slices , leftover_nslices ) ; <nl> return & ep - > base ; <nl> } <nl> mmm a / src / core / lib / slice / slice . cc <nl> ppp b / src / core / lib / slice / slice . cc <nl> static_assert ( std : : is_trivially_destructible < decltype ( kNoopRefcount ) > : : value , <nl> with the user provided data pointer & destroy function * / <nl> class NewSliceRefcount { <nl> public : <nl> - static void Destroy ( void * arg ) { <nl> - Delete ( static_cast < NewSliceRefcount * > ( arg ) ) ; <nl> - } <nl> + static void Destroy ( void * arg ) { delete static_cast < NewSliceRefcount * > ( arg ) ; } <nl> <nl> NewSliceRefcount ( void ( * destroy ) ( void * ) , void * user_data ) <nl> : base_ ( grpc_slice_refcount : : Type : : REGULAR , & refs_ , Destroy , this , <nl> grpc_slice grpc_slice_new_with_user_data ( void * p , size_t len , <nl> void * user_data ) { <nl> grpc_slice slice ; <nl> slice . refcount = <nl> - grpc_core : : New < grpc_core : : NewSliceRefcount > ( destroy , user_data ) <nl> - - > base_refcount ( ) ; <nl> + ( new grpc_core : : NewSliceRefcount ( destroy , user_data ) ) - > base_refcount ( ) ; <nl> slice . data . refcounted . bytes = static_cast < uint8_t * > ( p ) ; <nl> slice . data . refcounted . length = len ; <nl> return slice ; <nl> namespace grpc_core { <nl> class NewWithLenSliceRefcount { <nl> public : <nl> static void Destroy ( void * arg ) { <nl> - Delete ( static_cast < NewWithLenSliceRefcount * > ( arg ) ) ; <nl> + delete static_cast < NewWithLenSliceRefcount * > ( arg ) ; <nl> } <nl> <nl> NewWithLenSliceRefcount ( void ( * destroy ) ( void * , size_t ) , void * user_data , <nl> class MovedStringSliceRefCount { <nl> <nl> private : <nl> static void Destroy ( void * arg ) { <nl> - Delete ( static_cast < MovedStringSliceRefCount * > ( arg ) ) ; <nl> + delete static_cast < MovedStringSliceRefCount * > ( arg ) ; <nl> } <nl> <nl> grpc_slice_refcount base_ ; <nl> class MovedStringSliceRefCount { <nl> grpc_slice grpc_slice_new_with_len ( void * p , size_t len , <nl> void ( * destroy ) ( void * , size_t ) ) { <nl> grpc_slice slice ; <nl> - slice . refcount = <nl> - grpc_core : : New < grpc_core : : NewWithLenSliceRefcount > ( destroy , p , len ) <nl> - - > base_refcount ( ) ; <nl> + slice . refcount = ( new grpc_core : : NewWithLenSliceRefcount ( destroy , p , len ) ) <nl> + - > base_refcount ( ) ; <nl> slice . data . refcounted . bytes = static_cast < uint8_t * > ( p ) ; <nl> slice . data . refcounted . length = len ; <nl> return slice ; <nl> grpc_slice grpc_slice_from_moved_buffer ( grpc_core : : UniquePtr < char > p , <nl> slice . data . inlined . length = len ; <nl> memcpy ( GRPC_SLICE_START_PTR ( slice ) , ptr , len ) ; <nl> } else { <nl> - slice . refcount = <nl> - grpc_core : : New < grpc_core : : MovedStringSliceRefCount > ( std : : move ( p ) ) <nl> - - > base_refcount ( ) ; <nl> + slice . refcount = ( new grpc_core : : MovedStringSliceRefCount ( std : : move ( p ) ) ) <nl> + - > base_refcount ( ) ; <nl> slice . data . refcounted . bytes = ptr ; <nl> slice . data . refcounted . length = len ; <nl> } <nl> mmm a / src / core / lib / surface / server . cc <nl> ppp b / src / core / lib / surface / server . cc <nl> void grpc_server_setup_transport ( <nl> op - > set_accept_stream = true ; <nl> op - > set_accept_stream_fn = accept_stream ; <nl> op - > set_accept_stream_user_data = chand ; <nl> - op - > start_connectivity_watch . reset ( <nl> - grpc_core : : New < ConnectivityWatcher > ( chand ) ) ; <nl> + op - > start_connectivity_watch . reset ( new ConnectivityWatcher ( chand ) ) ; <nl> if ( gpr_atm_acq_load ( & s - > shutdown_flag ) ! = 0 ) { <nl> op - > disconnect_with_error = <nl> GRPC_ERROR_CREATE_FROM_STATIC_STRING ( " Server shutdown " ) ; <nl> mmm a / src / core / lib / transport / connectivity_state . cc <nl> ppp b / src / core / lib / transport / connectivity_state . cc <nl> class AsyncConnectivityStateWatcherInterface : : Notifier { <nl> self - > watcher_ . get ( ) , ConnectivityStateName ( self - > state_ ) ) ; <nl> } <nl> self - > watcher_ - > OnConnectivityStateChange ( self - > state_ ) ; <nl> - Delete ( self ) ; <nl> + delete self ; <nl> } <nl> <nl> RefCountedPtr < AsyncConnectivityStateWatcherInterface > watcher_ ; <nl> class AsyncConnectivityStateWatcherInterface : : Notifier { <nl> <nl> void AsyncConnectivityStateWatcherInterface : : Notify ( <nl> grpc_connectivity_state state ) { <nl> - New < Notifier > ( Ref ( ) , state , combiner_ ) ; / / Deletes itself when done . <nl> + new Notifier ( Ref ( ) , state , combiner_ ) ; / / Deletes itself when done . <nl> } <nl> <nl> / / <nl> mmm a / src / core / lib / transport / metadata . cc <nl> ppp b / src / core / lib / transport / metadata . cc <nl> size_t InternedMetadata : : CleanupLinkedMetadata ( <nl> next = md - > link_ . next ; <nl> if ( md - > AllRefsDropped ( ) ) { <nl> prev_next - > next = next ; <nl> - grpc_core : : Delete ( md ) ; <nl> + delete md ; <nl> num_freed + + ; <nl> } else { <nl> prev_next = & md - > link_ ; <nl> static grpc_mdelem md_create ( <nl> / / We allocate backing store . <nl> return key_definitely_static <nl> ? GRPC_MAKE_MDELEM ( <nl> - grpc_core : : New < AllocatedMetadata > ( <nl> + new AllocatedMetadata ( <nl> key , value , <nl> static_cast < const AllocatedMetadata : : NoRefKey * > ( <nl> nullptr ) ) , <nl> GRPC_MDELEM_STORAGE_ALLOCATED ) <nl> - : GRPC_MAKE_MDELEM ( <nl> - grpc_core : : New < AllocatedMetadata > ( key , value ) , <nl> - GRPC_MDELEM_STORAGE_ALLOCATED ) ; <nl> + : GRPC_MAKE_MDELEM ( new AllocatedMetadata ( key , value ) , <nl> + GRPC_MDELEM_STORAGE_ALLOCATED ) ; <nl> } <nl> } <nl> return md_create_maybe_static < key_definitely_static , value_definitely_static > ( <nl> static grpc_mdelem md_create_must_intern ( const grpc_slice & key , <nl> <nl> / * not found : create a new pair * / <nl> md = key_definitely_static <nl> - ? grpc_core : : New < InternedMetadata > ( <nl> + ? new InternedMetadata ( <nl> key , value , hash , shard - > elems [ idx ] . next , <nl> static_cast < const InternedMetadata : : NoRefKey * > ( nullptr ) ) <nl> - : grpc_core : : New < InternedMetadata > ( key , value , hash , <nl> - shard - > elems [ idx ] . next ) ; <nl> + : new InternedMetadata ( key , value , hash , shard - > elems [ idx ] . next ) ; <nl> shard - > elems [ idx ] . next = md ; <nl> shard - > count + + ; <nl> <nl> void grpc_mdelem_do_unref ( grpc_mdelem gmd DEBUG_ARGS ) { <nl> case GRPC_MDELEM_STORAGE_ALLOCATED : { <nl> auto * md = reinterpret_cast < AllocatedMetadata * > GRPC_MDELEM_DATA ( gmd ) ; <nl> if ( GPR_UNLIKELY ( md - > Unref ( FWD_DEBUG_ARGS ) ) ) { <nl> - grpc_core : : Delete ( md ) ; <nl> + delete md ; <nl> } <nl> break ; <nl> } <nl> void grpc_mdelem_on_final_unref ( grpc_mdelem_data_storage storage , void * ptr , <nl> break ; <nl> } <nl> case GRPC_MDELEM_STORAGE_ALLOCATED : { <nl> - grpc_core : : Delete ( reinterpret_cast < AllocatedMetadata * > ( ptr ) ) ; <nl> + delete reinterpret_cast < AllocatedMetadata * > ( ptr ) ; <nl> break ; <nl> } <nl> } <nl> mmm a / src / core / lib / transport / metadata . h <nl> ppp b / src / core / lib / transport / metadata . h <nl> inline grpc_mdelem grpc_mdelem_from_slices ( <nl> const grpc_core : : ManagedMemorySlice & key , <nl> const grpc_core : : UnmanagedMemorySlice & value ) { <nl> using grpc_core : : AllocatedMetadata ; <nl> - return GRPC_MAKE_MDELEM ( grpc_core : : New < AllocatedMetadata > ( key , value ) , <nl> + return GRPC_MAKE_MDELEM ( new AllocatedMetadata ( key , value ) , <nl> GRPC_MDELEM_STORAGE_ALLOCATED ) ; <nl> } <nl> <nl> inline grpc_mdelem grpc_mdelem_from_slices ( <nl> const grpc_core : : ExternallyManagedSlice & key , <nl> const grpc_core : : UnmanagedMemorySlice & value ) { <nl> using grpc_core : : AllocatedMetadata ; <nl> - return GRPC_MAKE_MDELEM ( grpc_core : : New < AllocatedMetadata > ( key , value ) , <nl> + return GRPC_MAKE_MDELEM ( new AllocatedMetadata ( key , value ) , <nl> GRPC_MDELEM_STORAGE_ALLOCATED ) ; <nl> } <nl> <nl> inline grpc_mdelem grpc_mdelem_from_slices ( <nl> const grpc_core : : StaticMetadataSlice & key , <nl> const grpc_core : : UnmanagedMemorySlice & value ) { <nl> using grpc_core : : AllocatedMetadata ; <nl> - return GRPC_MAKE_MDELEM ( grpc_core : : New < AllocatedMetadata > ( key , value ) , <nl> + return GRPC_MAKE_MDELEM ( new AllocatedMetadata ( key , value ) , <nl> GRPC_MDELEM_STORAGE_ALLOCATED ) ; <nl> } <nl> <nl> mmm a / src / core / lib / transport / static_metadata . cc <nl> ppp b / src / core / lib / transport / static_metadata . cc <nl> uint64_t StaticMetadataInitCanary ( ) { <nl> } / / namespace grpc_core <nl> <nl> void grpc_init_static_metadata_ctx ( void ) { <nl> - grpc_core : : g_static_metadata_slice_ctx = <nl> - grpc_core : : New < grpc_core : : StaticMetadataCtx > ( ) ; <nl> + grpc_core : : g_static_metadata_slice_ctx = new grpc_core : : StaticMetadataCtx ( ) ; <nl> grpc_core : : g_static_metadata_slice_table = <nl> grpc_core : : g_static_metadata_slice_ctx - > slices ; <nl> grpc_core : : g_static_metadata_slice_refcounts = <nl> void grpc_init_static_metadata_ctx ( void ) { <nl> } <nl> <nl> void grpc_destroy_static_metadata_ctx ( void ) { <nl> - grpc_core : : Delete < grpc_core : : StaticMetadataCtx > ( <nl> - grpc_core : : g_static_metadata_slice_ctx ) ; <nl> + delete grpc_core : : g_static_metadata_slice_ctx ; <nl> grpc_core : : g_static_metadata_slice_ctx = nullptr ; <nl> grpc_core : : g_static_metadata_slice_table = nullptr ; <nl> grpc_core : : g_static_metadata_slice_refcounts = nullptr ; <nl> mmm a / src / core / lib / transport / transport . cc <nl> ppp b / src / core / lib / transport / transport . cc <nl> static void destroy_made_transport_op ( void * arg , grpc_error * error ) { <nl> made_transport_op * op = static_cast < made_transport_op * > ( arg ) ; <nl> grpc_core : : ExecCtx : : Run ( DEBUG_LOCATION , op - > inner_on_complete , <nl> GRPC_ERROR_REF ( error ) ) ; <nl> - grpc_core : : Delete < made_transport_op > ( op ) ; <nl> + delete op ; <nl> } <nl> <nl> grpc_transport_op * grpc_make_transport_op ( grpc_closure * on_complete ) { <nl> - made_transport_op * op = grpc_core : : New < made_transport_op > ( ) ; <nl> + made_transport_op * op = new made_transport_op ( ) ; <nl> GRPC_CLOSURE_INIT ( & op - > outer_on_complete , destroy_made_transport_op , op , <nl> grpc_schedule_on_exec_ctx ) ; <nl> op - > inner_on_complete = on_complete ; <nl> mmm a / src / core / tsi / alts / handshaker / alts_tsi_handshaker . cc <nl> ppp b / src / core / tsi / alts / handshaker / alts_tsi_handshaker . cc <nl> static void alts_tsi_handshaker_create_channel ( void * arg , <nl> next_args - > cb ( continue_next_result , next_args - > user_data , nullptr , 0 , <nl> nullptr ) ; <nl> } <nl> - grpc_core : : Delete ( next_args ) ; <nl> + delete next_args ; <nl> } <nl> <nl> static tsi_result handshaker_next ( <nl> static tsi_result handshaker_next ( <nl> } <nl> if ( handshaker - > channel = = nullptr & & ! handshaker - > use_dedicated_cq ) { <nl> alts_tsi_handshaker_continue_handshaker_next_args * args = <nl> - grpc_core : : New < alts_tsi_handshaker_continue_handshaker_next_args > ( ) ; <nl> + new alts_tsi_handshaker_continue_handshaker_next_args ( ) ; <nl> args - > handshaker = handshaker ; <nl> args - > received_bytes = nullptr ; <nl> args - > received_bytes_size = received_bytes_size ; <nl> mmm a / src / core / tsi / ssl / session_cache / ssl_session_cache . cc <nl> ppp b / src / core / tsi / ssl / session_cache / ssl_session_cache . cc <nl> SslSessionLRUCache : : ~ SslSessionLRUCache ( ) { <nl> Node * node = use_order_list_head_ ; <nl> while ( node ) { <nl> Node * next = node - > next_ ; <nl> - grpc_core : : Delete ( node ) ; <nl> + delete node ; <nl> node = next ; <nl> } <nl> grpc_avl_unref ( entry_by_key_ , nullptr ) ; <nl> void SslSessionLRUCache : : Put ( const char * key , SslSessionPtr session ) { <nl> return ; <nl> } <nl> grpc_slice key_slice = grpc_slice_from_copied_string ( key ) ; <nl> - node = grpc_core : : New < Node > ( key_slice , std : : move ( session ) ) ; <nl> + node = new Node ( key_slice , std : : move ( session ) ) ; <nl> PushFront ( node ) ; <nl> entry_by_key_ = grpc_avl_add ( entry_by_key_ , node - > AvlKey ( ) , node , nullptr ) ; <nl> AssertInvariants ( ) ; <nl> void SslSessionLRUCache : : Put ( const char * key , SslSessionPtr session ) { <nl> Remove ( node ) ; <nl> / / Order matters , key is destroyed after deleting node . <nl> entry_by_key_ = grpc_avl_remove ( entry_by_key_ , node - > AvlKey ( ) , nullptr ) ; <nl> - grpc_core : : Delete ( node ) ; <nl> + delete node ; <nl> AssertInvariants ( ) ; <nl> } <nl> } <nl> mmm a / src / objective - c / tests / CronetTests / CoreCronetEnd2EndTests . mm <nl> ppp b / src / objective - c / tests / CronetTests / CoreCronetEnd2EndTests . mm <nl> static grpc_end2end_test_fixture chttp2_create_fixture_secure_fullstack ( <nl> grpc_channel_args * client_args , grpc_channel_args * server_args ) { <nl> grpc_end2end_test_fixture f ; <nl> int port = grpc_pick_unused_port_or_die ( ) ; <nl> - fullstack_secure_fixture_data * ffd = grpc_core : : New < fullstack_secure_fixture_data > ( ) ; <nl> + fullstack_secure_fixture_data * ffd = new fullstack_secure_fixture_data ( ) ; <nl> memset ( & f , 0 , sizeof ( f ) ) ; <nl> <nl> grpc_core : : JoinHostPort ( & ffd - > localaddr , " 127 . 0 . 0 . 1 " , port ) ; <nl> static void chttp2_init_server_secure_fullstack ( grpc_end2end_test_fixture * f , <nl> <nl> static void chttp2_tear_down_secure_fullstack ( grpc_end2end_test_fixture * f ) { <nl> fullstack_secure_fixture_data * ffd = ( fullstack_secure_fixture_data * ) f - > fixture_data ; <nl> - grpc_core : : Delete ( ffd ) ; <nl> + delete ffd ; <nl> } <nl> <nl> static void cronet_init_client_simple_ssl_secure_fullstack ( grpc_end2end_test_fixture * f , <nl> mmm a / test / core / client_channel / resolvers / dns_resolver_connectivity_test . cc <nl> ppp b / test / core / client_channel / resolvers / dns_resolver_connectivity_test . cc <nl> int main ( int argc , char * * argv ) { <nl> <nl> { <nl> grpc_core : : ExecCtx exec_ctx ; <nl> - ResultHandler * result_handler = grpc_core : : New < ResultHandler > ( ) ; <nl> + ResultHandler * result_handler = new ResultHandler ( ) ; <nl> grpc_core : : OrphanablePtr < grpc_core : : Resolver > resolver = create_resolver ( <nl> " dns : test " , grpc_core : : UniquePtr < grpc_core : : Resolver : : ResultHandler > ( <nl> result_handler ) ) ; <nl> mmm a / test / core / client_channel / resolvers / dns_resolver_cooldown_test . cc <nl> ppp b / test / core / client_channel / resolvers / dns_resolver_cooldown_test . cc <nl> static void on_fourth_resolution ( OnResolutionCallbackArg * cb_arg ) { <nl> GRPC_LOG_IF_ERROR ( " pollset_kick " , <nl> grpc_pollset_kick ( g_iomgr_args . pollset , nullptr ) ) ; <nl> gpr_mu_unlock ( g_iomgr_args . mu ) ; <nl> - grpc_core : : Delete ( cb_arg ) ; <nl> + delete cb_arg ; <nl> g_all_callbacks_invoked = true ; <nl> } <nl> <nl> static void on_first_resolution ( OnResolutionCallbackArg * cb_arg ) { <nl> static void start_test_under_combiner ( void * arg , grpc_error * / * error * / ) { <nl> OnResolutionCallbackArg * res_cb_arg = <nl> static_cast < OnResolutionCallbackArg * > ( arg ) ; <nl> - res_cb_arg - > result_handler = grpc_core : : New < ResultHandler > ( ) ; <nl> + res_cb_arg - > result_handler = new ResultHandler ( ) ; <nl> grpc_core : : ResolverFactory * factory = <nl> grpc_core : : ResolverRegistry : : LookupResolverFactory ( " dns " ) ; <nl> grpc_uri * uri = grpc_uri_parse ( res_cb_arg - > uri_str , 0 ) ; <nl> static void start_test_under_combiner ( void * arg , grpc_error * / * error * / ) { <nl> static void test_cooldown ( ) { <nl> grpc_core : : ExecCtx exec_ctx ; <nl> iomgr_args_init ( & g_iomgr_args ) ; <nl> - OnResolutionCallbackArg * res_cb_arg = <nl> - grpc_core : : New < OnResolutionCallbackArg > ( ) ; <nl> + OnResolutionCallbackArg * res_cb_arg = new OnResolutionCallbackArg ( ) ; <nl> res_cb_arg - > uri_str = " dns : 127 . 0 . 0 . 1 " ; <nl> <nl> g_combiner - > Run ( <nl> mmm a / test / core / client_channel / resolvers / fake_resolver_test . cc <nl> ppp b / test / core / client_channel / resolvers / fake_resolver_test . cc <nl> static void test_fake_resolver ( ) { <nl> grpc_core : : ExecCtx exec_ctx ; <nl> grpc_core : : Combiner * combiner = grpc_combiner_create ( ) ; <nl> / / Create resolver . <nl> - ResultHandler * result_handler = grpc_core : : New < ResultHandler > ( ) ; <nl> + ResultHandler * result_handler = new ResultHandler ( ) ; <nl> grpc_core : : RefCountedPtr < grpc_core : : FakeResolverResponseGenerator > <nl> response_generator = <nl> grpc_core : : MakeRefCounted < grpc_core : : FakeResolverResponseGenerator > ( ) ; <nl> mmm a / test / core / end2end / bad_server_response_test . cc <nl> ppp b / test / core / end2end / bad_server_response_test . cc <nl> static grpc_core : : Thread * poll_server_until_read_done ( <nl> poll_args * pa = static_cast < poll_args * > ( gpr_malloc ( sizeof ( * pa ) ) ) ; <nl> pa - > server = server ; <nl> pa - > signal_when_done = signal_when_done ; <nl> - auto * th = grpc_core : : New < grpc_core : : Thread > ( " grpc_poll_server " , <nl> - actually_poll_server , pa ) ; <nl> + auto * th = <nl> + new grpc_core : : Thread ( " grpc_poll_server " , actually_poll_server , pa ) ; <nl> th - > Start ( ) ; <nl> return th ; <nl> } <nl> mmm a / test / core / end2end / fixtures / h2_census . cc <nl> ppp b / test / core / end2end / fixtures / h2_census . cc <nl> static grpc_end2end_test_fixture chttp2_create_fixture_fullstack ( <nl> grpc_channel_args * / * client_args * / , grpc_channel_args * / * server_args * / ) { <nl> grpc_end2end_test_fixture f ; <nl> int port = grpc_pick_unused_port_or_die ( ) ; <nl> - fullstack_fixture_data * ffd = grpc_core : : New < fullstack_fixture_data > ( ) ; <nl> + fullstack_fixture_data * ffd = new fullstack_fixture_data ( ) ; <nl> memset ( & f , 0 , sizeof ( f ) ) ; <nl> grpc_core : : JoinHostPort ( & ffd - > localaddr , " localhost " , port ) ; <nl> <nl> void chttp2_init_server_fullstack ( grpc_end2end_test_fixture * f , <nl> void chttp2_tear_down_fullstack ( grpc_end2end_test_fixture * f ) { <nl> fullstack_fixture_data * ffd = <nl> static_cast < fullstack_fixture_data * > ( f - > fixture_data ) ; <nl> - grpc_core : : Delete ( ffd ) ; <nl> + delete ffd ; <nl> } <nl> <nl> / * All test configurations * / <nl> mmm a / test / core / end2end / fixtures / h2_compress . cc <nl> ppp b / test / core / end2end / fixtures / h2_compress . cc <nl> static grpc_end2end_test_fixture chttp2_create_fixture_fullstack_compression ( <nl> grpc_end2end_test_fixture f ; <nl> int port = grpc_pick_unused_port_or_die ( ) ; <nl> fullstack_compression_fixture_data * ffd = <nl> - grpc_core : : New < fullstack_compression_fixture_data > ( ) ; <nl> + new fullstack_compression_fixture_data ( ) ; <nl> grpc_core : : JoinHostPort ( & ffd - > localaddr , " localhost " , port ) ; <nl> <nl> memset ( & f , 0 , sizeof ( f ) ) ; <nl> void chttp2_tear_down_fullstack_compression ( grpc_end2end_test_fixture * f ) { <nl> grpc_core : : ExecCtx exec_ctx ; <nl> fullstack_compression_fixture_data * ffd = <nl> static_cast < fullstack_compression_fixture_data * > ( f - > fixture_data ) ; <nl> - grpc_core : : Delete ( ffd ) ; <nl> + delete ffd ; <nl> } <nl> <nl> / * All test configurations * / <nl> mmm a / test / core / end2end / fixtures / h2_fakesec . cc <nl> ppp b / test / core / end2end / fixtures / h2_fakesec . cc <nl> static grpc_end2end_test_fixture chttp2_create_fixture_secure_fullstack ( <nl> grpc_channel_args * / * client_args * / , grpc_channel_args * / * server_args * / ) { <nl> grpc_end2end_test_fixture f ; <nl> int port = grpc_pick_unused_port_or_die ( ) ; <nl> - fullstack_secure_fixture_data * ffd = <nl> - grpc_core : : New < fullstack_secure_fixture_data > ( ) ; <nl> + fullstack_secure_fixture_data * ffd = new fullstack_secure_fixture_data ( ) ; <nl> memset ( & f , 0 , sizeof ( f ) ) ; <nl> grpc_core : : JoinHostPort ( & ffd - > localaddr , " localhost " , port ) ; <nl> <nl> static void chttp2_init_server_secure_fullstack ( <nl> void chttp2_tear_down_secure_fullstack ( grpc_end2end_test_fixture * f ) { <nl> fullstack_secure_fixture_data * ffd = <nl> static_cast < fullstack_secure_fixture_data * > ( f - > fixture_data ) ; <nl> - grpc_core : : Delete ( ffd ) ; <nl> + delete ffd ; <nl> } <nl> <nl> static void chttp2_init_client_fake_secure_fullstack ( <nl> mmm a / test / core / end2end / fixtures / h2_full + pipe . cc <nl> ppp b / test / core / end2end / fixtures / h2_full + pipe . cc <nl> static grpc_end2end_test_fixture chttp2_create_fixture_fullstack ( <nl> grpc_channel_args * / * client_args * / , grpc_channel_args * / * server_args * / ) { <nl> grpc_end2end_test_fixture f ; <nl> int port = grpc_pick_unused_port_or_die ( ) ; <nl> - fullstack_fixture_data * ffd = grpc_core : : New < fullstack_fixture_data > ( ) ; <nl> + fullstack_fixture_data * ffd = new fullstack_fixture_data ( ) ; <nl> memset ( & f , 0 , sizeof ( f ) ) ; <nl> <nl> grpc_core : : JoinHostPort ( & ffd - > localaddr , " localhost " , port ) ; <nl> void chttp2_init_server_fullstack ( grpc_end2end_test_fixture * f , <nl> void chttp2_tear_down_fullstack ( grpc_end2end_test_fixture * f ) { <nl> fullstack_fixture_data * ffd = <nl> static_cast < fullstack_fixture_data * > ( f - > fixture_data ) ; <nl> - grpc_core : : Delete ( ffd ) ; <nl> + delete ffd ; <nl> } <nl> <nl> / * All test configurations * / <nl> mmm a / test / core / end2end / fixtures / h2_full + trace . cc <nl> ppp b / test / core / end2end / fixtures / h2_full + trace . cc <nl> static grpc_end2end_test_fixture chttp2_create_fixture_fullstack ( <nl> grpc_channel_args * / * client_args * / , grpc_channel_args * / * server_args * / ) { <nl> grpc_end2end_test_fixture f ; <nl> int port = grpc_pick_unused_port_or_die ( ) ; <nl> - fullstack_fixture_data * ffd = grpc_core : : New < fullstack_fixture_data > ( ) ; <nl> + fullstack_fixture_data * ffd = new fullstack_fixture_data ( ) ; <nl> memset ( & f , 0 , sizeof ( f ) ) ; <nl> <nl> grpc_core : : JoinHostPort ( & ffd - > localaddr , " localhost " , port ) ; <nl> void chttp2_init_server_fullstack ( grpc_end2end_test_fixture * f , <nl> void chttp2_tear_down_fullstack ( grpc_end2end_test_fixture * f ) { <nl> fullstack_fixture_data * ffd = <nl> static_cast < fullstack_fixture_data * > ( f - > fixture_data ) ; <nl> - grpc_core : : Delete ( ffd ) ; <nl> + delete ffd ; <nl> } <nl> <nl> / * All test configurations * / <nl> mmm a / test / core / end2end / fixtures / h2_full + workarounds . cc <nl> ppp b / test / core / end2end / fixtures / h2_full + workarounds . cc <nl> static grpc_end2end_test_fixture chttp2_create_fixture_fullstack ( <nl> grpc_channel_args * / * client_args * / , grpc_channel_args * / * server_args * / ) { <nl> grpc_end2end_test_fixture f ; <nl> int port = grpc_pick_unused_port_or_die ( ) ; <nl> - fullstack_fixture_data * ffd = grpc_core : : New < fullstack_fixture_data > ( ) ; <nl> + fullstack_fixture_data * ffd = new fullstack_fixture_data ( ) ; <nl> memset ( & f , 0 , sizeof ( f ) ) ; <nl> grpc_core : : JoinHostPort ( & ffd - > localaddr , " localhost " , port ) ; <nl> f . fixture_data = ffd ; <nl> void chttp2_init_server_fullstack ( grpc_end2end_test_fixture * f , <nl> void chttp2_tear_down_fullstack ( grpc_end2end_test_fixture * f ) { <nl> fullstack_fixture_data * ffd = <nl> static_cast < fullstack_fixture_data * > ( f - > fixture_data ) ; <nl> - grpc_core : : Delete ( ffd ) ; <nl> + delete ffd ; <nl> } <nl> <nl> / * All test configurations * / <nl> mmm a / test / core / end2end / fixtures / h2_full . cc <nl> ppp b / test / core / end2end / fixtures / h2_full . cc <nl> static grpc_end2end_test_fixture chttp2_create_fixture_fullstack ( <nl> grpc_channel_args * / * client_args * / , grpc_channel_args * / * server_args * / ) { <nl> grpc_end2end_test_fixture f ; <nl> int port = grpc_pick_unused_port_or_die ( ) ; <nl> - fullstack_fixture_data * ffd = grpc_core : : New < fullstack_fixture_data > ( ) ; <nl> + fullstack_fixture_data * ffd = new fullstack_fixture_data ( ) ; <nl> memset ( & f , 0 , sizeof ( f ) ) ; <nl> <nl> grpc_core : : JoinHostPort ( & ffd - > localaddr , " localhost " , port ) ; <nl> void chttp2_init_server_fullstack ( grpc_end2end_test_fixture * f , <nl> void chttp2_tear_down_fullstack ( grpc_end2end_test_fixture * f ) { <nl> fullstack_fixture_data * ffd = <nl> static_cast < fullstack_fixture_data * > ( f - > fixture_data ) ; <nl> - grpc_core : : Delete ( ffd ) ; <nl> + delete ffd ; <nl> } <nl> <nl> / * All test configurations * / <nl> mmm a / test / core / end2end / fixtures / h2_http_proxy . cc <nl> ppp b / test / core / end2end / fixtures / h2_http_proxy . cc <nl> static grpc_end2end_test_fixture chttp2_create_fixture_fullstack ( <nl> grpc_channel_args * client_args , grpc_channel_args * / * server_args * / ) { <nl> grpc_end2end_test_fixture f ; <nl> memset ( & f , 0 , sizeof ( f ) ) ; <nl> - fullstack_fixture_data * ffd = grpc_core : : New < fullstack_fixture_data > ( ) ; <nl> + fullstack_fixture_data * ffd = new fullstack_fixture_data ( ) ; <nl> const int server_port = grpc_pick_unused_port_or_die ( ) ; <nl> grpc_core : : JoinHostPort ( & ffd - > server_addr , " localhost " , server_port ) ; <nl> <nl> void chttp2_init_server_fullstack ( grpc_end2end_test_fixture * f , <nl> void chttp2_tear_down_fullstack ( grpc_end2end_test_fixture * f ) { <nl> fullstack_fixture_data * ffd = <nl> static_cast < fullstack_fixture_data * > ( f - > fixture_data ) ; <nl> - grpc_core : : Delete ( ffd ) ; <nl> + delete ffd ; <nl> } <nl> <nl> / * All test configurations * / <nl> mmm a / test / core / end2end / fixtures / h2_oauth2 . cc <nl> ppp b / test / core / end2end / fixtures / h2_oauth2 . cc <nl> static grpc_end2end_test_fixture chttp2_create_fixture_secure_fullstack ( <nl> grpc_channel_args * / * client_args * / , grpc_channel_args * / * server_args * / ) { <nl> grpc_end2end_test_fixture f ; <nl> int port = grpc_pick_unused_port_or_die ( ) ; <nl> - fullstack_secure_fixture_data * ffd = <nl> - grpc_core : : New < fullstack_secure_fixture_data > ( ) ; <nl> + fullstack_secure_fixture_data * ffd = new fullstack_secure_fixture_data ( ) ; <nl> memset ( & f , 0 , sizeof ( f ) ) ; <nl> grpc_core : : JoinHostPort ( & ffd - > localaddr , " localhost " , port ) ; <nl> f . fixture_data = ffd ; <nl> static void chttp2_init_server_secure_fullstack ( <nl> void chttp2_tear_down_secure_fullstack ( grpc_end2end_test_fixture * f ) { <nl> fullstack_secure_fixture_data * ffd = <nl> static_cast < fullstack_secure_fixture_data * > ( f - > fixture_data ) ; <nl> - grpc_core : : Delete ( ffd ) ; <nl> + delete ffd ; <nl> } <nl> <nl> static void chttp2_init_client_simple_ssl_with_oauth2_secure_fullstack ( <nl> mmm a / test / core / end2end / fixtures / h2_spiffe . cc <nl> ppp b / test / core / end2end / fixtures / h2_spiffe . cc <nl> static grpc_end2end_test_fixture chttp2_create_fixture_secure_fullstack ( <nl> grpc_channel_args * / * client_args * / , grpc_channel_args * / * server_args * / ) { <nl> grpc_end2end_test_fixture f ; <nl> int port = grpc_pick_unused_port_or_die ( ) ; <nl> - fullstack_secure_fixture_data * ffd = <nl> - grpc_core : : New < fullstack_secure_fixture_data > ( ) ; <nl> + fullstack_secure_fixture_data * ffd = new fullstack_secure_fixture_data ( ) ; <nl> memset ( & f , 0 , sizeof ( f ) ) ; <nl> grpc_core : : JoinHostPort ( & ffd - > localaddr , " localhost " , port ) ; <nl> f . fixture_data = ffd ; <nl> static void chttp2_init_server_secure_fullstack ( <nl> void chttp2_tear_down_secure_fullstack ( grpc_end2end_test_fixture * f ) { <nl> fullstack_secure_fixture_data * ffd = <nl> static_cast < fullstack_secure_fixture_data * > ( f - > fixture_data ) ; <nl> - grpc_core : : Delete ( ffd ) ; <nl> + delete ffd ; <nl> } <nl> <nl> / / Application - provided callback for server authorization check . <nl> mmm a / test / core / end2end / fixtures / h2_ssl . cc <nl> ppp b / test / core / end2end / fixtures / h2_ssl . cc <nl> static grpc_end2end_test_fixture chttp2_create_fixture_secure_fullstack ( <nl> grpc_channel_args * / * client_args * / , grpc_channel_args * / * server_args * / ) { <nl> grpc_end2end_test_fixture f ; <nl> int port = grpc_pick_unused_port_or_die ( ) ; <nl> - fullstack_secure_fixture_data * ffd = <nl> - grpc_core : : New < fullstack_secure_fixture_data > ( ) ; <nl> + fullstack_secure_fixture_data * ffd = new fullstack_secure_fixture_data ( ) ; <nl> memset ( & f , 0 , sizeof ( f ) ) ; <nl> <nl> grpc_core : : JoinHostPort ( & ffd - > localaddr , " localhost " , port ) ; <nl> static void chttp2_init_server_secure_fullstack ( <nl> void chttp2_tear_down_secure_fullstack ( grpc_end2end_test_fixture * f ) { <nl> fullstack_secure_fixture_data * ffd = <nl> static_cast < fullstack_secure_fixture_data * > ( f - > fixture_data ) ; <nl> - grpc_core : : Delete ( ffd ) ; <nl> + delete ffd ; <nl> } <nl> <nl> static void chttp2_init_client_simple_ssl_secure_fullstack ( <nl> mmm a / test / core / end2end / fixtures / h2_ssl_cred_reload . cc <nl> ppp b / test / core / end2end / fixtures / h2_ssl_cred_reload . cc <nl> static grpc_end2end_test_fixture chttp2_create_fixture_secure_fullstack ( <nl> grpc_channel_args * / * client_args * / , grpc_channel_args * / * server_args * / ) { <nl> grpc_end2end_test_fixture f ; <nl> int port = grpc_pick_unused_port_or_die ( ) ; <nl> - fullstack_secure_fixture_data * ffd = <nl> - grpc_core : : New < fullstack_secure_fixture_data > ( ) ; <nl> + fullstack_secure_fixture_data * ffd = new fullstack_secure_fixture_data ( ) ; <nl> memset ( & f , 0 , sizeof ( f ) ) ; <nl> grpc_core : : JoinHostPort ( & ffd - > localaddr , " localhost " , port ) ; <nl> <nl> static void chttp2_init_server_secure_fullstack ( <nl> void chttp2_tear_down_secure_fullstack ( grpc_end2end_test_fixture * f ) { <nl> fullstack_secure_fixture_data * ffd = <nl> static_cast < fullstack_secure_fixture_data * > ( f - > fixture_data ) ; <nl> - grpc_core : : Delete ( ffd ) ; <nl> + delete ffd ; <nl> } <nl> <nl> static void chttp2_init_client_simple_ssl_secure_fullstack ( <nl> mmm a / test / core / end2end / fixtures / http_proxy_fixture . cc <nl> ppp b / test / core / end2end / fixtures / http_proxy_fixture . cc <nl> static void thread_main ( void * arg ) { <nl> grpc_end2end_http_proxy * grpc_end2end_http_proxy_create ( <nl> grpc_channel_args * args ) { <nl> grpc_core : : ExecCtx exec_ctx ; <nl> - grpc_end2end_http_proxy * proxy = grpc_core : : New < grpc_end2end_http_proxy > ( ) ; <nl> + grpc_end2end_http_proxy * proxy = new grpc_end2end_http_proxy ( ) ; <nl> / / Construct proxy address . <nl> const int proxy_port = grpc_pick_unused_port_or_die ( ) ; <nl> grpc_core : : JoinHostPort ( & proxy - > proxy_name , " localhost " , proxy_port ) ; <nl> void grpc_end2end_http_proxy_destroy ( grpc_end2end_http_proxy * proxy ) { <nl> GRPC_CLOSURE_CREATE ( destroy_pollset , proxy - > pollset , <nl> grpc_schedule_on_exec_ctx ) ) ; <nl> GRPC_COMBINER_UNREF ( proxy - > combiner , " test " ) ; <nl> - grpc_core : : Delete ( proxy ) ; <nl> + delete proxy ; <nl> } <nl> <nl> const char * grpc_end2end_http_proxy_get_proxy_name ( <nl> mmm a / test / core / end2end / fixtures / local_util . cc <nl> ppp b / test / core / end2end / fixtures / local_util . cc <nl> <nl> grpc_end2end_test_fixture grpc_end2end_local_chttp2_create_fixture_fullstack ( ) { <nl> grpc_end2end_test_fixture f ; <nl> grpc_end2end_local_fullstack_fixture_data * ffd = <nl> - grpc_core : : New < grpc_end2end_local_fullstack_fixture_data > ( ) ; <nl> + new grpc_end2end_local_fullstack_fixture_data ( ) ; <nl> memset ( & f , 0 , sizeof ( f ) ) ; <nl> f . fixture_data = ffd ; <nl> f . cq = grpc_completion_queue_create_for_next ( nullptr ) ; <nl> void grpc_end2end_local_chttp2_tear_down_fullstack ( <nl> grpc_end2end_test_fixture * f ) { <nl> grpc_end2end_local_fullstack_fixture_data * ffd = <nl> static_cast < grpc_end2end_local_fullstack_fixture_data * > ( f - > fixture_data ) ; <nl> - grpc_core : : Delete ( ffd ) ; <nl> + delete ffd ; <nl> } <nl> mmm a / test / core / end2end / fixtures / proxy . cc <nl> ppp b / test / core / end2end / fixtures / proxy . cc <nl> grpc_end2end_proxy * grpc_end2end_proxy_create ( const grpc_end2end_proxy_def * def , <nl> int proxy_port = grpc_pick_unused_port_or_die ( ) ; <nl> int server_port = grpc_pick_unused_port_or_die ( ) ; <nl> <nl> - grpc_end2end_proxy * proxy = grpc_core : : New < grpc_end2end_proxy > ( ) ; <nl> + grpc_end2end_proxy * proxy = new grpc_end2end_proxy ( ) ; <nl> <nl> grpc_core : : JoinHostPort ( & proxy - > proxy_port , " localhost " , proxy_port ) ; <nl> grpc_core : : JoinHostPort ( & proxy - > server_port , " localhost " , server_port ) ; <nl> void grpc_end2end_proxy_destroy ( grpc_end2end_proxy * proxy ) { <nl> grpc_channel_destroy ( proxy - > client ) ; <nl> grpc_completion_queue_destroy ( proxy - > cq ) ; <nl> grpc_call_details_destroy ( & proxy - > new_call_details ) ; <nl> - grpc_core : : Delete ( proxy ) ; <nl> + delete proxy ; <nl> } <nl> <nl> static void unrefpc ( proxy_call * pc , const char * / * reason * / ) { <nl> mmm a / test / core / end2end / fuzzers / api_fuzzer . cc <nl> ppp b / test / core / end2end / fuzzers / api_fuzzer . cc <nl> static void finish_resolve ( void * arg , grpc_error * error ) { <nl> } <nl> <nl> gpr_free ( r - > addr ) ; <nl> - grpc_core : : Delete ( r ) ; <nl> + delete r ; <nl> } <nl> <nl> void my_resolve_address ( const char * addr , const char * / * default_port * / , <nl> grpc_pollset_set * / * interested_parties * / , <nl> grpc_closure * on_done , <nl> grpc_resolved_addresses * * addrs ) { <nl> - addr_req * r = grpc_core : : New < addr_req > ( ) ; <nl> + addr_req * r = new addr_req ( ) ; <nl> r - > addr = gpr_strdup ( addr ) ; <nl> r - > on_done = on_done ; <nl> r - > addrs = addrs ; <nl> mmm a / test / core / end2end / h2_ssl_cert_test . cc <nl> ppp b / test / core / end2end / h2_ssl_cert_test . cc <nl> static grpc_end2end_test_fixture chttp2_create_fixture_secure_fullstack ( <nl> grpc_channel_args * / * client_args * / , grpc_channel_args * / * server_args * / ) { <nl> grpc_end2end_test_fixture f ; <nl> int port = grpc_pick_unused_port_or_die ( ) ; <nl> - fullstack_secure_fixture_data * ffd = <nl> - grpc_core : : New < fullstack_secure_fixture_data > ( ) ; <nl> + fullstack_secure_fixture_data * ffd = new fullstack_secure_fixture_data ( ) ; <nl> memset ( & f , 0 , sizeof ( f ) ) ; <nl> <nl> grpc_core : : JoinHostPort ( & ffd - > localaddr , " localhost " , port ) ; <nl> static void chttp2_init_server_secure_fullstack ( <nl> void chttp2_tear_down_secure_fullstack ( grpc_end2end_test_fixture * f ) { <nl> fullstack_secure_fixture_data * ffd = <nl> static_cast < fullstack_secure_fixture_data * > ( f - > fixture_data ) ; <nl> - grpc_core : : Delete ( ffd ) ; <nl> + delete ffd ; <nl> } <nl> <nl> static int fail_server_auth_check ( grpc_channel_args * server_args ) { <nl> mmm a / test / core / end2end / inproc_callback_test . cc <nl> ppp b / test / core / end2end / inproc_callback_test . cc <nl> class CQDeletingCallback : public grpc_experimental_completion_queue_functor { <nl> static void Run ( grpc_experimental_completion_queue_functor * cb , int ok ) { <nl> auto * callback = static_cast < CQDeletingCallback * > ( cb ) ; <nl> callback - > func_ ( static_cast < bool > ( ok ) ) ; <nl> - grpc_core : : Delete ( callback ) ; <nl> + delete callback ; <nl> } <nl> <nl> private : <nl> class CQDeletingCallback : public grpc_experimental_completion_queue_functor { <nl> <nl> template < typename F > <nl> grpc_experimental_completion_queue_functor * NewDeletingCallback ( F f ) { <nl> - return grpc_core : : New < CQDeletingCallback < F > > ( f ) ; <nl> + return new CQDeletingCallback < F > ( f ) ; <nl> } <nl> <nl> class ShutdownCallback : public grpc_experimental_completion_queue_functor { <nl> static grpc_end2end_test_fixture inproc_create_fixture ( <nl> memset ( & f , 0 , sizeof ( f ) ) ; <nl> <nl> f . fixture_data = ffd ; <nl> - g_shutdown_callback = grpc_core : : New < ShutdownCallback > ( ) ; <nl> + g_shutdown_callback = new ShutdownCallback ( ) ; <nl> f . cq = <nl> grpc_completion_queue_create_for_callback ( g_shutdown_callback , nullptr ) ; <nl> f . shutdown_cq = grpc_completion_queue_create_for_pluck ( nullptr ) ; <nl> static void drain_cq ( grpc_completion_queue * / * cq * / ) { <nl> / / Wait for the shutdown callback to arrive , or fail the test <nl> GPR_ASSERT ( g_shutdown_callback - > Wait ( five_seconds_from_now ( ) ) ) ; <nl> gpr_log ( GPR_DEBUG , " CQ shutdown wait complete " ) ; <nl> - grpc_core : : Delete ( g_shutdown_callback ) ; <nl> + delete g_shutdown_callback ; <nl> } <nl> <nl> static void shutdown_server ( grpc_end2end_test_fixture * f ) { <nl> mmm a / test / core / gprpp / BUILD <nl> ppp b / test / core / gprpp / BUILD <nl> grpc_cc_test ( <nl> ] , <nl> ) <nl> <nl> - grpc_cc_test ( <nl> - name = " memory_test " , <nl> - srcs = [ " memory_test . cc " ] , <nl> - external_deps = [ <nl> - " gtest " , <nl> - ] , <nl> - language = " C + + " , <nl> - uses_polling = False , <nl> - deps = [ <nl> - " / / : gpr_base " , <nl> - " / / test / core / util : grpc_test_util " , <nl> - ] , <nl> - ) <nl> - <nl> grpc_cc_test ( <nl> name = " inlined_vector_test " , <nl> srcs = [ " inlined_vector_test . cc " ] , <nl> mmm a / test / core / gprpp / inlined_vector_test . cc <nl> ppp b / test / core / gprpp / inlined_vector_test . cc <nl> TEST ( InlinedVectorTest , PushBackWithMove ) { <nl> <nl> TEST ( InlinedVectorTest , EmplaceBack ) { <nl> InlinedVector < UniquePtr < int > , 1 > v ; <nl> - v . emplace_back ( New < int > ( 3 ) ) ; <nl> + v . emplace_back ( new int ( 3 ) ) ; <nl> EXPECT_EQ ( 1UL , v . size ( ) ) ; <nl> EXPECT_EQ ( 3 , * v [ 0 ] ) ; <nl> } <nl> deleted file mode 100644 <nl> index b148d7dfccb . . 00000000000 <nl> mmm a / test / core / gprpp / memory_test . cc <nl> ppp / dev / null <nl> <nl> - / * <nl> - * <nl> - * Copyright 2017 gRPC authors . <nl> - * <nl> - * Licensed under the Apache License , Version 2 . 0 ( the " License " ) ; <nl> - * you may not use this file except in compliance with the License . <nl> - * You may obtain a copy of the License at <nl> - * <nl> - * http : / / www . apache . org / licenses / LICENSE - 2 . 0 <nl> - * <nl> - * Unless required by applicable law or agreed to in writing , software <nl> - * distributed under the License is distributed on an " AS IS " BASIS , <nl> - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND , either express or implied . <nl> - * See the License for the specific language governing permissions and <nl> - * limitations under the License . <nl> - * <nl> - * / <nl> - <nl> - # include " src / core / lib / gprpp / memory . h " <nl> - # include < gtest / gtest . h > <nl> - # include " test / core / util / test_config . h " <nl> - <nl> - namespace grpc_core { <nl> - namespace testing { <nl> - <nl> - struct Foo { <nl> - Foo ( int p , int q ) : a ( p ) , b ( q ) { } <nl> - int a ; <nl> - int b ; <nl> - } ; <nl> - <nl> - struct Base1 { <nl> - int a ; <nl> - virtual ~ Base1 ( ) { } <nl> - } ; <nl> - <nl> - struct Base2 { <nl> - int b ; <nl> - virtual ~ Base2 ( ) { } <nl> - } ; <nl> - <nl> - struct Compound : public Base1 , Base2 { <nl> - int c ; <nl> - virtual ~ Compound ( ) { } <nl> - } ; <nl> - <nl> - TEST ( MemoryTest , NewDeleteTest ) { Delete ( New < int > ( ) ) ; } <nl> - <nl> - TEST ( MemoryTest , NewDeleteWithArgTest ) { <nl> - int * i = New < int > ( 42 ) ; <nl> - EXPECT_EQ ( 42 , * i ) ; <nl> - Delete ( i ) ; <nl> - } <nl> - <nl> - TEST ( MemoryTest , NewDeleteWithArgsTest ) { <nl> - Foo * p = New < Foo > ( 1 , 2 ) ; <nl> - EXPECT_EQ ( 1 , p - > a ) ; <nl> - EXPECT_EQ ( 2 , p - > b ) ; <nl> - Delete ( p ) ; <nl> - } <nl> - <nl> - TEST ( MemoryTest , MakeUniqueTest ) { MakeUnique < int > ( ) ; } <nl> - <nl> - TEST ( MemoryTest , MakeUniqueWithArgTest ) { <nl> - auto i = MakeUnique < int > ( 42 ) ; <nl> - EXPECT_EQ ( 42 , * i ) ; <nl> - } <nl> - <nl> - TEST ( MemoryTest , UniquePtrWithCustomDeleter ) { <nl> - int n = 0 ; <nl> - class IncrementingDeleter { <nl> - public : <nl> - void operator ( ) ( int * p ) { + + * p ; } <nl> - } ; <nl> - { <nl> - UniquePtr < int , IncrementingDeleter > p ( & n ) ; <nl> - EXPECT_EQ ( 0 , n ) ; <nl> - } <nl> - EXPECT_EQ ( 1 , n ) ; <nl> - } <nl> - <nl> - TEST ( MemoryTest , MultipleInheritence ) { <nl> - Base2 * p = New < Compound > ( ) ; <nl> - EXPECT_NE ( p , dynamic_cast < void * > ( p ) ) ; <nl> - Delete ( p ) ; <nl> - } <nl> - <nl> - } / / namespace testing <nl> - } / / namespace grpc_core <nl> - <nl> - int main ( int argc , char * * argv ) { <nl> - grpc : : testing : : TestEnvironment env ( argc , argv ) ; <nl> - : : testing : : InitGoogleTest ( & argc , argv ) ; <nl> - return RUN_ALL_TESTS ( ) ; <nl> - } <nl> mmm a / test / core / gprpp / mpscq_test . cc <nl> ppp b / test / core / gprpp / mpscq_test . cc <nl> typedef struct test_node { <nl> } test_node ; <nl> <nl> static test_node * new_node ( size_t i , size_t * ctr ) { <nl> - test_node * n = grpc_core : : New < test_node > ( ) ; <nl> + test_node * n = new test_node ( ) ; <nl> n - > i = i ; <nl> n - > ctr = ctr ; <nl> return n ; <nl> mmm a / test / core / gprpp / orphanable_test . cc <nl> ppp b / test / core / gprpp / orphanable_test . cc <nl> class Foo : public Orphanable { <nl> public : <nl> Foo ( ) : Foo ( 0 ) { } <nl> explicit Foo ( int value ) : value_ ( value ) { } <nl> - void Orphan ( ) override { Delete ( this ) ; } <nl> + void Orphan ( ) override { delete this ; } <nl> int value ( ) const { return value_ ; } <nl> <nl> private : <nl> class Foo : public Orphanable { <nl> } ; <nl> <nl> TEST ( Orphanable , Basic ) { <nl> - Foo * foo = New < Foo > ( ) ; <nl> + Foo * foo = new Foo ( ) ; <nl> foo - > Orphan ( ) ; <nl> } <nl> <nl> TEST ( OrphanablePtr , Basic ) { <nl> - OrphanablePtr < Foo > foo ( New < Foo > ( ) ) ; <nl> + OrphanablePtr < Foo > foo ( new Foo ( ) ) ; <nl> EXPECT_EQ ( 0 , foo - > value ( ) ) ; <nl> } <nl> <nl> mmm a / test / core / gprpp / ref_counted_ptr_test . cc <nl> ppp b / test / core / gprpp / ref_counted_ptr_test . cc <nl> TEST ( RefCountedPtr , ExplicitConstructorEmpty ) { <nl> RefCountedPtr < Foo > foo ( nullptr ) ; <nl> } <nl> <nl> - TEST ( RefCountedPtr , ExplicitConstructor ) { RefCountedPtr < Foo > foo ( New < Foo > ( ) ) ; } <nl> + TEST ( RefCountedPtr , ExplicitConstructor ) { RefCountedPtr < Foo > foo ( new Foo ( ) ) ; } <nl> <nl> TEST ( RefCountedPtr , MoveConstructor ) { <nl> - RefCountedPtr < Foo > foo ( New < Foo > ( ) ) ; <nl> + RefCountedPtr < Foo > foo ( new Foo ( ) ) ; <nl> RefCountedPtr < Foo > foo2 ( std : : move ( foo ) ) ; <nl> EXPECT_EQ ( nullptr , foo . get ( ) ) ; <nl> EXPECT_NE ( nullptr , foo2 . get ( ) ) ; <nl> } <nl> <nl> TEST ( RefCountedPtr , MoveAssignment ) { <nl> - RefCountedPtr < Foo > foo ( New < Foo > ( ) ) ; <nl> + RefCountedPtr < Foo > foo ( new Foo ( ) ) ; <nl> RefCountedPtr < Foo > foo2 = std : : move ( foo ) ; <nl> EXPECT_EQ ( nullptr , foo . get ( ) ) ; <nl> EXPECT_NE ( nullptr , foo2 . get ( ) ) ; <nl> } <nl> <nl> TEST ( RefCountedPtr , CopyConstructor ) { <nl> - RefCountedPtr < Foo > foo ( New < Foo > ( ) ) ; <nl> + RefCountedPtr < Foo > foo ( new Foo ( ) ) ; <nl> const RefCountedPtr < Foo > & foo2 ( foo ) ; <nl> EXPECT_NE ( nullptr , foo . get ( ) ) ; <nl> EXPECT_EQ ( foo . get ( ) , foo2 . get ( ) ) ; <nl> } <nl> <nl> TEST ( RefCountedPtr , CopyAssignment ) { <nl> - RefCountedPtr < Foo > foo ( New < Foo > ( ) ) ; <nl> + RefCountedPtr < Foo > foo ( new Foo ( ) ) ; <nl> const RefCountedPtr < Foo > & foo2 = foo ; <nl> EXPECT_NE ( nullptr , foo . get ( ) ) ; <nl> EXPECT_EQ ( foo . get ( ) , foo2 . get ( ) ) ; <nl> TEST ( RefCountedPtr , CopyAssignmentWhenEmpty ) { <nl> } <nl> <nl> TEST ( RefCountedPtr , CopyAssignmentToSelf ) { <nl> - RefCountedPtr < Foo > foo ( New < Foo > ( ) ) ; <nl> + RefCountedPtr < Foo > foo ( new Foo ( ) ) ; <nl> foo = * & foo ; / / The " * & " avoids warnings from LLVM - Wself - assign . <nl> } <nl> <nl> TEST ( RefCountedPtr , EnclosedScope ) { <nl> - RefCountedPtr < Foo > foo ( New < Foo > ( ) ) ; <nl> + RefCountedPtr < Foo > foo ( new Foo ( ) ) ; <nl> { <nl> RefCountedPtr < Foo > foo2 ( std : : move ( foo ) ) ; <nl> EXPECT_EQ ( nullptr , foo . get ( ) ) ; <nl> TEST ( RefCountedPtr , EnclosedScope ) { <nl> TEST ( RefCountedPtr , ResetFromNullToNonNull ) { <nl> RefCountedPtr < Foo > foo ; <nl> EXPECT_EQ ( nullptr , foo . get ( ) ) ; <nl> - foo . reset ( New < Foo > ( ) ) ; <nl> + foo . reset ( new Foo ( ) ) ; <nl> EXPECT_NE ( nullptr , foo . get ( ) ) ; <nl> } <nl> <nl> TEST ( RefCountedPtr , ResetFromNonNullToNonNull ) { <nl> - RefCountedPtr < Foo > foo ( New < Foo > ( ) ) ; <nl> + RefCountedPtr < Foo > foo ( new Foo ( ) ) ; <nl> EXPECT_NE ( nullptr , foo . get ( ) ) ; <nl> Foo * original = foo . get ( ) ; <nl> - foo . reset ( New < Foo > ( ) ) ; <nl> + foo . reset ( new Foo ( ) ) ; <nl> EXPECT_NE ( nullptr , foo . get ( ) ) ; <nl> EXPECT_NE ( original , foo . get ( ) ) ; <nl> } <nl> <nl> TEST ( RefCountedPtr , ResetFromNonNullToNull ) { <nl> - RefCountedPtr < Foo > foo ( New < Foo > ( ) ) ; <nl> + RefCountedPtr < Foo > foo ( new Foo ( ) ) ; <nl> EXPECT_NE ( nullptr , foo . get ( ) ) ; <nl> foo . reset ( ) ; <nl> EXPECT_EQ ( nullptr , foo . get ( ) ) ; <nl> TEST ( RefCountedPtr , ResetFromNullToNull ) { <nl> } <nl> <nl> TEST ( RefCountedPtr , DerefernceOperators ) { <nl> - RefCountedPtr < Foo > foo ( New < Foo > ( ) ) ; <nl> + RefCountedPtr < Foo > foo ( new Foo ( ) ) ; <nl> foo - > value ( ) ; <nl> Foo & foo_ref = * foo ; <nl> foo_ref . value ( ) ; <nl> } <nl> <nl> TEST ( RefCountedPtr , EqualityOperators ) { <nl> - RefCountedPtr < Foo > foo ( New < Foo > ( ) ) ; <nl> + RefCountedPtr < Foo > foo ( new Foo ( ) ) ; <nl> RefCountedPtr < Foo > bar = foo ; <nl> RefCountedPtr < Foo > empty ; <nl> / / Test equality between RefCountedPtrs . <nl> TEST ( RefCountedPtr , EqualityOperators ) { <nl> } <nl> <nl> TEST ( RefCountedPtr , Swap ) { <nl> - Foo * foo = New < Foo > ( ) ; <nl> - Foo * bar = New < Foo > ( ) ; <nl> + Foo * foo = new Foo ( ) ; <nl> + Foo * bar = new Foo ( ) ; <nl> RefCountedPtr < Foo > ptr1 ( foo ) ; <nl> RefCountedPtr < Foo > ptr2 ( bar ) ; <nl> ptr1 . swap ( ptr2 ) ; <nl> class FooWithTracing : public RefCounted < FooWithTracing > { <nl> } ; <nl> <nl> TEST ( RefCountedPtr , RefCountedWithTracing ) { <nl> - RefCountedPtr < FooWithTracing > foo ( New < FooWithTracing > ( ) ) ; <nl> + RefCountedPtr < FooWithTracing > foo ( new FooWithTracing ( ) ) ; <nl> RefCountedPtr < FooWithTracing > foo2 = foo - > Ref ( DEBUG_LOCATION , " foo " ) ; <nl> foo2 . release ( ) ; <nl> foo - > Unref ( DEBUG_LOCATION , " foo " ) ; <nl> class Subclass : public BaseClass { <nl> } ; <nl> <nl> TEST ( RefCountedPtr , ConstructFromSubclass ) { <nl> - RefCountedPtr < BaseClass > p ( New < Subclass > ( ) ) ; <nl> + RefCountedPtr < BaseClass > p ( new Subclass ( ) ) ; <nl> } <nl> <nl> TEST ( RefCountedPtr , CopyAssignFromSubclass ) { <nl> TEST ( RefCountedPtr , MoveAssignFromSubclass ) { <nl> TEST ( RefCountedPtr , ResetFromSubclass ) { <nl> RefCountedPtr < BaseClass > b ; <nl> EXPECT_EQ ( nullptr , b . get ( ) ) ; <nl> - b . reset ( New < Subclass > ( ) ) ; <nl> + b . reset ( new Subclass ( ) ) ; <nl> EXPECT_NE ( nullptr , b . get ( ) ) ; <nl> } <nl> <nl> TEST ( RefCountedPtr , EqualityWithSubclass ) { <nl> - Subclass * s = New < Subclass > ( ) ; <nl> + Subclass * s = new Subclass ( ) ; <nl> RefCountedPtr < BaseClass > b ( s ) ; <nl> EXPECT_EQ ( b , s ) ; <nl> } <nl> mmm a / test / core / gprpp / ref_counted_test . cc <nl> ppp b / test / core / gprpp / ref_counted_test . cc <nl> class Foo : public RefCounted < Foo > { <nl> } ; <nl> <nl> TEST ( RefCounted , Basic ) { <nl> - Foo * foo = New < Foo > ( ) ; <nl> + Foo * foo = new Foo ( ) ; <nl> foo - > Unref ( ) ; <nl> } <nl> <nl> TEST ( RefCounted , ExtraRef ) { <nl> - Foo * foo = New < Foo > ( ) ; <nl> + Foo * foo = new Foo ( ) ; <nl> RefCountedPtr < Foo > foop = foo - > Ref ( ) ; <nl> foop . release ( ) ; <nl> foo - > Unref ( ) ; <nl> class FooNonPolymorphic <nl> } ; <nl> <nl> TEST ( RefCountedNonPolymorphic , Basic ) { <nl> - FooNonPolymorphic * foo = New < FooNonPolymorphic > ( ) ; <nl> + FooNonPolymorphic * foo = new FooNonPolymorphic ( ) ; <nl> foo - > Unref ( ) ; <nl> } <nl> <nl> TEST ( RefCountedNonPolymorphic , ExtraRef ) { <nl> - FooNonPolymorphic * foo = New < FooNonPolymorphic > ( ) ; <nl> + FooNonPolymorphic * foo = new FooNonPolymorphic ( ) ; <nl> RefCountedPtr < FooNonPolymorphic > foop = foo - > Ref ( ) ; <nl> foop . release ( ) ; <nl> foo - > Unref ( ) ; <nl> class FooWithTracing : public RefCounted < FooWithTracing > { <nl> } ; <nl> <nl> TEST ( RefCountedWithTracing , Basic ) { <nl> - FooWithTracing * foo = New < FooWithTracing > ( ) ; <nl> + FooWithTracing * foo = new FooWithTracing ( ) ; <nl> RefCountedPtr < FooWithTracing > foop = foo - > Ref ( DEBUG_LOCATION , " extra_ref " ) ; <nl> foop . release ( ) ; <nl> foo - > Unref ( DEBUG_LOCATION , " extra_ref " ) ; <nl> class FooNonPolymorphicWithTracing <nl> } ; <nl> <nl> TEST ( RefCountedNonPolymorphicWithTracing , Basic ) { <nl> - FooNonPolymorphicWithTracing * foo = New < FooNonPolymorphicWithTracing > ( ) ; <nl> + FooNonPolymorphicWithTracing * foo = new FooNonPolymorphicWithTracing ( ) ; <nl> RefCountedPtr < FooNonPolymorphicWithTracing > foop = <nl> foo - > Ref ( DEBUG_LOCATION , " extra_ref " ) ; <nl> foop . release ( ) ; <nl> mmm a / test / core / iomgr / mpmcqueue_test . cc <nl> ppp b / test / core / iomgr / mpmcqueue_test . cc <nl> class ProducerThread { <nl> ~ ProducerThread ( ) { <nl> for ( int i = 0 ; i < num_items_ ; + + i ) { <nl> GPR_ASSERT ( items_ [ i ] - > done ) ; <nl> - grpc_core : : Delete ( items_ [ i ] ) ; <nl> + delete items_ [ i ] ; <nl> } <nl> gpr_free ( items_ ) ; <nl> } <nl> class ProducerThread { <nl> items_ = <nl> static_cast < WorkItem * * > ( gpr_zalloc ( num_items_ * sizeof ( WorkItem * ) ) ) ; <nl> for ( int i = 0 ; i < num_items_ ; + + i ) { <nl> - items_ [ i ] = grpc_core : : New < WorkItem > ( start_index_ + i ) ; <nl> + items_ [ i ] = new WorkItem ( start_index_ + i ) ; <nl> queue_ - > Put ( items_ [ i ] ) ; <nl> } <nl> } <nl> static void test_FIFO ( void ) { <nl> gpr_log ( GPR_INFO , " test_FIFO " ) ; <nl> grpc_core : : InfLenFIFOQueue large_queue ; <nl> for ( int i = 0 ; i < TEST_NUM_ITEMS ; + + i ) { <nl> - large_queue . Put ( static_cast < void * > ( grpc_core : : New < WorkItem > ( i ) ) ) ; <nl> + large_queue . Put ( static_cast < void * > ( new WorkItem ( i ) ) ) ; <nl> } <nl> GPR_ASSERT ( large_queue . count ( ) = = TEST_NUM_ITEMS ) ; <nl> for ( int i = 0 ; i < TEST_NUM_ITEMS ; + + i ) { <nl> WorkItem * item = static_cast < WorkItem * > ( large_queue . Get ( ) ) ; <nl> GPR_ASSERT ( i = = item - > index ) ; <nl> - grpc_core : : Delete ( item ) ; <nl> + delete item ; <nl> } <nl> } <nl> <nl> static void test_space_efficiency ( void ) { <nl> gpr_log ( GPR_INFO , " test_space_efficiency " ) ; <nl> grpc_core : : InfLenFIFOQueue queue ; <nl> for ( int i = 0 ; i < queue . init_num_nodes ( ) ; + + i ) { <nl> - queue . Put ( static_cast < void * > ( grpc_core : : New < WorkItem > ( i ) ) ) ; <nl> + queue . Put ( static_cast < void * > ( new WorkItem ( i ) ) ) ; <nl> } <nl> / / Queue should not have been expanded at this time . <nl> GPR_ASSERT ( queue . num_nodes ( ) = = queue . init_num_nodes ( ) ) ; <nl> static void test_space_efficiency ( void ) { <nl> GPR_ASSERT ( queue . num_nodes ( ) = = queue . init_num_nodes ( ) ) ; <nl> for ( int i = 0 ; i < queue . init_num_nodes ( ) ; + + i ) { <nl> WorkItem * item = static_cast < WorkItem * > ( queue . Get ( ) ) ; <nl> - grpc_core : : Delete ( item ) ; <nl> + delete item ; <nl> } <nl> / / Queue never shrinks even it is empty . <nl> GPR_ASSERT ( queue . num_nodes ( ) = = queue . init_num_nodes ( ) ) ; <nl> GPR_ASSERT ( queue . count ( ) = = 0 ) ; <nl> / / queue empty now <nl> for ( int i = 0 ; i < queue . init_num_nodes ( ) * 2 ; + + i ) { <nl> - queue . Put ( static_cast < void * > ( grpc_core : : New < WorkItem > ( i ) ) ) ; <nl> + queue . Put ( static_cast < void * > ( new WorkItem ( i ) ) ) ; <nl> } <nl> GPR_ASSERT ( queue . count ( ) = = queue . init_num_nodes ( ) * 2 ) ; <nl> / / Queue should have been expanded once . <nl> GPR_ASSERT ( queue . num_nodes ( ) = = queue . init_num_nodes ( ) * 2 ) ; <nl> for ( int i = 0 ; i < queue . init_num_nodes ( ) ; + + i ) { <nl> WorkItem * item = static_cast < WorkItem * > ( queue . Get ( ) ) ; <nl> - grpc_core : : Delete ( item ) ; <nl> + delete item ; <nl> } <nl> GPR_ASSERT ( queue . count ( ) = = queue . init_num_nodes ( ) ) ; <nl> / / Queue will never shrink , should keep same number of node as before . <nl> GPR_ASSERT ( queue . num_nodes ( ) = = queue . init_num_nodes ( ) * 2 ) ; <nl> for ( int i = 0 ; i < queue . init_num_nodes ( ) + 1 ; + + i ) { <nl> - queue . Put ( static_cast < void * > ( grpc_core : : New < WorkItem > ( i ) ) ) ; <nl> + queue . Put ( static_cast < void * > ( new WorkItem ( i ) ) ) ; <nl> } <nl> GPR_ASSERT ( queue . count ( ) = = queue . init_num_nodes ( ) * 2 + 1 ) ; <nl> / / Queue should have been expanded twice . <nl> GPR_ASSERT ( queue . num_nodes ( ) = = queue . init_num_nodes ( ) * 4 ) ; <nl> for ( int i = 0 ; i < queue . init_num_nodes ( ) * 2 + 1 ; + + i ) { <nl> WorkItem * item = static_cast < WorkItem * > ( queue . Get ( ) ) ; <nl> - grpc_core : : Delete ( item ) ; <nl> + delete item ; <nl> } <nl> GPR_ASSERT ( queue . count ( ) = = 0 ) ; <nl> GPR_ASSERT ( queue . num_nodes ( ) = = queue . init_num_nodes ( ) * 4 ) ; <nl> static void test_many_thread ( void ) { <nl> <nl> gpr_log ( GPR_DEBUG , " Fork ProducerThreads . . . " ) ; <nl> for ( int i = 0 ; i < num_producer_threads ; + + i ) { <nl> - producer_threads [ i ] = grpc_core : : New < ProducerThread > ( <nl> - & queue , i * TEST_NUM_ITEMS , TEST_NUM_ITEMS ) ; <nl> + producer_threads [ i ] = <nl> + new ProducerThread ( & queue , i * TEST_NUM_ITEMS , TEST_NUM_ITEMS ) ; <nl> producer_threads [ i ] - > Start ( ) ; <nl> } <nl> gpr_log ( GPR_DEBUG , " ProducerThreads Started . " ) ; <nl> gpr_log ( GPR_DEBUG , " Fork ConsumerThreads . . . " ) ; <nl> for ( int i = 0 ; i < num_consumer_threads ; + + i ) { <nl> - consumer_threads [ i ] = grpc_core : : New < ConsumerThread > ( & queue ) ; <nl> + consumer_threads [ i ] = new ConsumerThread ( & queue ) ; <nl> consumer_threads [ i ] - > Start ( ) ; <nl> } <nl> gpr_log ( GPR_DEBUG , " ConsumerThreads Started . " ) ; <nl> static void test_many_thread ( void ) { <nl> gpr_log ( GPR_DEBUG , " Checking WorkItems and Cleaning Up . . . " ) ; <nl> for ( int i = 0 ; i < num_producer_threads ; + + i ) { <nl> / / Destructor of ProducerThread will do the check of WorkItems <nl> - grpc_core : : Delete ( producer_threads [ i ] ) ; <nl> + delete producer_threads [ i ] ; <nl> } <nl> gpr_free ( producer_threads ) ; <nl> for ( int i = 0 ; i < num_consumer_threads ; + + i ) { <nl> - grpc_core : : Delete ( consumer_threads [ i ] ) ; <nl> + delete consumer_threads [ i ] ; <nl> } <nl> gpr_free ( consumer_threads ) ; <nl> gpr_log ( GPR_DEBUG , " Done . " ) ; <nl> mmm a / test / core / iomgr / threadpool_test . cc <nl> ppp b / test / core / iomgr / threadpool_test . cc <nl> static const int kThreadLargeIter = 10000 ; <nl> <nl> static void test_size_zero ( void ) { <nl> gpr_log ( GPR_INFO , " test_size_zero " ) ; <nl> - grpc_core : : ThreadPool * pool_size_zero = <nl> - grpc_core : : New < grpc_core : : ThreadPool > ( 0 ) ; <nl> + grpc_core : : ThreadPool * pool_size_zero = new grpc_core : : ThreadPool ( 0 ) ; <nl> GPR_ASSERT ( pool_size_zero - > pool_capacity ( ) = = 1 ) ; <nl> - Delete ( pool_size_zero ) ; <nl> + delete pool_size_zero ; <nl> } <nl> <nl> static void test_constructor_option ( void ) { <nl> static void test_constructor_option ( void ) { <nl> / / Tests options <nl> grpc_core : : Thread : : Options options ; <nl> options . set_stack_size ( 192 * 1024 ) ; / / Random non - default value <nl> - grpc_core : : ThreadPool * pool = grpc_core : : New < grpc_core : : ThreadPool > ( <nl> - 0 , " test_constructor_option " , options ) ; <nl> + grpc_core : : ThreadPool * pool = <nl> + new grpc_core : : ThreadPool ( 0 , " test_constructor_option " , options ) ; <nl> GPR_ASSERT ( pool - > thread_options ( ) . stack_size ( ) = = options . stack_size ( ) ) ; <nl> - Delete ( pool ) ; <nl> + delete pool ; <nl> } <nl> <nl> / / Simple functor for testing . It will count how many times being called . <nl> class SimpleFunctorForAdd : public grpc_experimental_completion_queue_functor { <nl> static void test_add ( void ) { <nl> gpr_log ( GPR_INFO , " test_add " ) ; <nl> grpc_core : : ThreadPool * pool = <nl> - grpc_core : : New < grpc_core : : ThreadPool > ( kSmallThreadPoolSize , " test_add " ) ; <nl> + new grpc_core : : ThreadPool ( kSmallThreadPoolSize , " test_add " ) ; <nl> <nl> - SimpleFunctorForAdd * functor = grpc_core : : New < SimpleFunctorForAdd > ( ) ; <nl> + SimpleFunctorForAdd * functor = new SimpleFunctorForAdd ( ) ; <nl> for ( int i = 0 ; i < kThreadSmallIter ; + + i ) { <nl> pool - > Add ( functor ) ; <nl> } <nl> - grpc_core : : Delete ( pool ) ; <nl> + delete pool ; <nl> GPR_ASSERT ( functor - > count ( ) = = kThreadSmallIter ) ; <nl> - grpc_core : : Delete ( functor ) ; <nl> + delete functor ; <nl> gpr_log ( GPR_DEBUG , " Done . " ) ; <nl> } <nl> <nl> class WorkThread { <nl> static void test_multi_add ( void ) { <nl> gpr_log ( GPR_INFO , " test_multi_add " ) ; <nl> const int num_work_thds = 10 ; <nl> - grpc_core : : ThreadPool * pool = grpc_core : : New < grpc_core : : ThreadPool > ( <nl> - kLargeThreadPoolSize , " test_multi_add " ) ; <nl> - SimpleFunctorForAdd * functor = grpc_core : : New < SimpleFunctorForAdd > ( ) ; <nl> + grpc_core : : ThreadPool * pool = <nl> + new grpc_core : : ThreadPool ( kLargeThreadPoolSize , " test_multi_add " ) ; <nl> + SimpleFunctorForAdd * functor = new SimpleFunctorForAdd ( ) ; <nl> WorkThread * * work_thds = static_cast < WorkThread * * > ( <nl> gpr_zalloc ( sizeof ( WorkThread * ) * num_work_thds ) ) ; <nl> gpr_log ( GPR_DEBUG , " Fork threads for adding . . . " ) ; <nl> for ( int i = 0 ; i < num_work_thds ; + + i ) { <nl> - work_thds [ i ] = grpc_core : : New < WorkThread > ( pool , functor , kThreadLargeIter ) ; <nl> + work_thds [ i ] = new WorkThread ( pool , functor , kThreadLargeIter ) ; <nl> work_thds [ i ] - > Start ( ) ; <nl> } <nl> / / Wait for all threads finish <nl> gpr_log ( GPR_DEBUG , " Waiting for all work threads finish . . . " ) ; <nl> for ( int i = 0 ; i < num_work_thds ; + + i ) { <nl> work_thds [ i ] - > Join ( ) ; <nl> - grpc_core : : Delete ( work_thds [ i ] ) ; <nl> + delete work_thds [ i ] ; <nl> } <nl> gpr_free ( work_thds ) ; <nl> gpr_log ( GPR_DEBUG , " Done . " ) ; <nl> gpr_log ( GPR_DEBUG , " Waiting for all closures finish . . . " ) ; <nl> / / Destructor of thread pool will wait for all closures to finish <nl> - grpc_core : : Delete ( pool ) ; <nl> + delete pool ; <nl> GPR_ASSERT ( functor - > count ( ) = = kThreadLargeIter * num_work_thds ) ; <nl> - grpc_core : : Delete ( functor ) ; <nl> + delete functor ; <nl> gpr_log ( GPR_DEBUG , " Done . " ) ; <nl> } <nl> <nl> static void test_one_thread_FIFO ( void ) { <nl> gpr_log ( GPR_INFO , " test_one_thread_FIFO " ) ; <nl> int counter = 0 ; <nl> grpc_core : : ThreadPool * pool = <nl> - grpc_core : : New < grpc_core : : ThreadPool > ( 1 , " test_one_thread_FIFO " ) ; <nl> + new grpc_core : : ThreadPool ( 1 , " test_one_thread_FIFO " ) ; <nl> SimpleFunctorCheckForAdd * * check_functors = <nl> static_cast < SimpleFunctorCheckForAdd * * > ( <nl> gpr_zalloc ( sizeof ( SimpleFunctorCheckForAdd * ) * kThreadSmallIter ) ) ; <nl> for ( int i = 0 ; i < kThreadSmallIter ; + + i ) { <nl> - check_functors [ i ] = <nl> - grpc_core : : New < SimpleFunctorCheckForAdd > ( i + 1 , & counter ) ; <nl> + check_functors [ i ] = new SimpleFunctorCheckForAdd ( i + 1 , & counter ) ; <nl> pool - > Add ( check_functors [ i ] ) ; <nl> } <nl> / / Destructor of pool will wait until all closures finished . <nl> - grpc_core : : Delete ( pool ) ; <nl> + delete pool ; <nl> for ( int i = 0 ; i < kThreadSmallIter ; + + i ) { <nl> - grpc_core : : Delete ( check_functors [ i ] ) ; <nl> + delete check_functors [ i ] ; <nl> } <nl> gpr_free ( check_functors ) ; <nl> gpr_log ( GPR_DEBUG , " Done . " ) ; <nl> mmm a / test / core / iomgr / udp_server_test . cc <nl> ppp b / test / core / iomgr / udp_server_test . cc <nl> class TestGrpcUdpHandlerFactory : public GrpcUdpHandlerFactory { <nl> public : <nl> GrpcUdpHandler * CreateUdpHandler ( grpc_fd * emfd , void * user_data ) override { <nl> gpr_log ( GPR_INFO , " create udp handler for fd % d " , grpc_fd_wrapped_fd ( emfd ) ) ; <nl> - return grpc_core : : New < TestGrpcUdpHandler > ( emfd , user_data ) ; <nl> + return new TestGrpcUdpHandler ( emfd , user_data ) ; <nl> } <nl> <nl> void DestroyUdpHandler ( GrpcUdpHandler * handler ) override { <nl> gpr_log ( GPR_INFO , " Destroy handler " ) ; <nl> - grpc_core : : Delete ( reinterpret_cast < TestGrpcUdpHandler * > ( handler ) ) ; <nl> + delete reinterpret_cast < TestGrpcUdpHandler * > ( handler ) ; <nl> } <nl> } ; <nl> <nl> mmm a / test / core / security / credentials_test . cc <nl> ppp b / test / core / security / credentials_test . cc <nl> class check_channel_oauth2 final : public grpc_channel_credentials { <nl> static void test_channel_oauth2_composite_creds ( void ) { <nl> grpc_core : : ExecCtx exec_ctx ; <nl> grpc_channel_args * new_args ; <nl> - grpc_channel_credentials * channel_creds = <nl> - grpc_core : : New < check_channel_oauth2 > ( ) ; <nl> + grpc_channel_credentials * channel_creds = new check_channel_oauth2 ( ) ; <nl> grpc_call_credentials * oauth2_creds = <nl> grpc_access_token_credentials_create ( " blah " , nullptr ) ; <nl> grpc_channel_credentials * channel_oauth2_creds = <nl> static void test_channel_oauth2_google_iam_composite_creds ( void ) { <nl> grpc_core : : ExecCtx exec_ctx ; <nl> grpc_channel_args * new_args ; <nl> grpc_channel_credentials * channel_creds = <nl> - grpc_core : : New < check_channel_oauth2_google_iam > ( ) ; <nl> + new check_channel_oauth2_google_iam ( ) ; <nl> grpc_call_credentials * oauth2_creds = <nl> grpc_access_token_credentials_create ( " blah " , nullptr ) ; <nl> grpc_channel_credentials * channel_oauth2_creds = <nl> mmm a / test / core / surface / completion_queue_test . cc <nl> ppp b / test / core / surface / completion_queue_test . cc <nl> static void test_callback ( void ) { <nl> gpr_cv_signal ( & cv ) ; <nl> } <nl> gpr_mu_unlock ( & mu ) ; <nl> - grpc_core : : Delete ( callback ) ; <nl> + delete callback ; <nl> } ; <nl> <nl> private : <nl> static void test_callback ( void ) { <nl> } ; <nl> <nl> for ( i = 0 ; i < GPR_ARRAY_SIZE ( tags ) ; i + + ) { <nl> - tags [ i ] = static_cast < void * > ( grpc_core : : New < TagCallback > ( & counter , i ) ) ; <nl> + tags [ i ] = static_cast < void * > ( new TagCallback ( & counter , i ) ) ; <nl> sumtags + = i ; <nl> } <nl> <nl> mmm a / test / core / transport / connectivity_state_test . cc <nl> ppp b / test / core / transport / connectivity_state_test . cc <nl> TEST ( StateTracker , SubscribeThenUnsubscribe ) { <nl> bool destroyed = false ; <nl> ConnectivityStateTracker tracker ( " xxx " , GRPC_CHANNEL_IDLE ) ; <nl> ConnectivityStateWatcherInterface * watcher = <nl> - New < Watcher > ( & count , & state , & destroyed ) ; <nl> + new Watcher ( & count , & state , & destroyed ) ; <nl> tracker . AddWatcher ( GRPC_CHANNEL_IDLE , <nl> OrphanablePtr < ConnectivityStateWatcherInterface > ( watcher ) ) ; <nl> / / No initial notification , since we started the watch from the <nl> TEST ( StateTracker , OrphanUponShutdown ) { <nl> bool destroyed = false ; <nl> ConnectivityStateTracker tracker ( " xxx " , GRPC_CHANNEL_IDLE ) ; <nl> ConnectivityStateWatcherInterface * watcher = <nl> - New < Watcher > ( & count , & state , & destroyed ) ; <nl> + new Watcher ( & count , & state , & destroyed ) ; <nl> tracker . AddWatcher ( GRPC_CHANNEL_IDLE , <nl> OrphanablePtr < ConnectivityStateWatcherInterface > ( watcher ) ) ; <nl> / / No initial notification , since we started the watch from the <nl> TEST ( StateTracker , AddWhenAlreadyShutdown ) { <nl> bool destroyed = false ; <nl> ConnectivityStateTracker tracker ( " xxx " , GRPC_CHANNEL_SHUTDOWN ) ; <nl> ConnectivityStateWatcherInterface * watcher = <nl> - New < Watcher > ( & count , & state , & destroyed ) ; <nl> + new Watcher ( & count , & state , & destroyed ) ; <nl> tracker . AddWatcher ( GRPC_CHANNEL_IDLE , <nl> OrphanablePtr < ConnectivityStateWatcherInterface > ( watcher ) ) ; <nl> EXPECT_TRUE ( destroyed ) ; <nl> mmm a / test / core / util / test_lb_policies . cc <nl> ppp b / test / core / util / test_lb_policies . cc <nl> class InterceptRecvTrailingMetadataLoadBalancingPolicy <nl> InterceptRecvTrailingMetadataLoadBalancingPolicy ( <nl> Args args , InterceptRecvTrailingMetadataCallback cb , void * user_data ) <nl> : ForwardingLoadBalancingPolicy ( <nl> - UniquePtr < ChannelControlHelper > ( New < Helper > ( <nl> + UniquePtr < ChannelControlHelper > ( new Helper ( <nl> RefCountedPtr < InterceptRecvTrailingMetadataLoadBalancingPolicy > ( <nl> this ) , <nl> cb , user_data ) ) , <nl> class InterceptRecvTrailingMetadataLoadBalancingPolicy <nl> UniquePtr < SubchannelPicker > picker ) override { <nl> parent_ - > channel_control_helper ( ) - > UpdateState ( <nl> state , UniquePtr < SubchannelPicker > ( <nl> - New < Picker > ( std : : move ( picker ) , cb_ , user_data_ ) ) ) ; <nl> + new Picker ( std : : move ( picker ) , cb_ , user_data_ ) ) ) ; <nl> } <nl> <nl> void RequestReresolution ( ) override { <nl> void RegisterInterceptRecvTrailingMetadataLoadBalancingPolicy ( <nl> InterceptRecvTrailingMetadataCallback cb , void * user_data ) { <nl> LoadBalancingPolicyRegistry : : Builder : : RegisterLoadBalancingPolicyFactory ( <nl> UniquePtr < LoadBalancingPolicyFactory > ( <nl> - New < InterceptTrailingFactory > ( cb , user_data ) ) ) ; <nl> + new InterceptTrailingFactory ( cb , user_data ) ) ) ; <nl> } <nl> <nl> } / / namespace grpc_core <nl> mmm a / test / cpp / client / credentials_test . cc <nl> ppp b / test / cpp / client / credentials_test . cc <nl> TEST_F ( CredentialsTest , TlsCredentialReloadConfigSchedule ) { <nl> new TestTlsCredentialReload ( ) ) ; <nl> std : : shared_ptr < TlsCredentialReloadConfig > config ( <nl> new TlsCredentialReloadConfig ( test_credential_reload ) ) ; <nl> - grpc_tls_credential_reload_arg * c_arg = <nl> - grpc_core : : New < grpc_tls_credential_reload_arg > ( ) ; <nl> + grpc_tls_credential_reload_arg * c_arg = new grpc_tls_credential_reload_arg ( ) ; <nl> c_arg - > context = nullptr ; <nl> TlsCredentialReloadArg * arg = new TlsCredentialReloadArg ( c_arg ) ; <nl> std : : shared_ptr < TlsKeyMaterialsConfig > key_materials_config ( <nl> TEST_F ( CredentialsTest , TlsCredentialReloadConfigSchedule ) { <nl> <nl> / / Cleanup . <nl> gpr_free ( const_cast < char * > ( error_details_before_schedule ) ) ; <nl> - grpc_core : : Delete ( c_arg - > key_materials_config ) ; <nl> + delete c_arg - > key_materials_config ; <nl> if ( c_arg - > destroy_context ! = nullptr ) { <nl> c_arg - > destroy_context ( c_arg - > context ) ; <nl> } <nl> TEST_F ( CredentialsTest , TlsCredentialReloadConfigCppToC ) { <nl> <nl> / / Cleanup . <nl> c_arg . destroy_context ( c_arg . context ) ; <nl> - : : grpc_core : : Delete ( config . c_config ( ) ) ; <nl> + : : delete config . c_config ( ) ; <nl> } <nl> <nl> typedef class : : grpc_impl : : experimental : : TlsServerAuthorizationCheckArg <nl> TEST_F ( CredentialsTest , TlsServerAuthorizationCheckConfigSchedule ) { <nl> test_server_authorization_check ( new TestTlsServerAuthorizationCheck ( ) ) ; <nl> TlsServerAuthorizationCheckConfig config ( test_server_authorization_check ) ; <nl> grpc_tls_server_authorization_check_arg * c_arg = <nl> - grpc_core : : New < grpc_tls_server_authorization_check_arg > ( ) ; <nl> + new grpc_tls_server_authorization_check_arg ( ) ; <nl> c_arg - > context = nullptr ; <nl> TlsServerAuthorizationCheckArg * arg = <nl> new TlsServerAuthorizationCheckArg ( c_arg ) ; <nl> TEST_F ( CredentialsTest , TlsCredentialsOptionsCppToC ) { <nl> " sync_error_details " ) ; <nl> <nl> / / Cleanup . <nl> - : : grpc_core : : Delete ( c_credential_reload_arg . key_materials_config ) ; <nl> + : : delete c_credential_reload_arg . key_materials_config ; <nl> c_credential_reload_arg . destroy_context ( c_credential_reload_arg . context ) ; <nl> c_server_authorization_check_arg . destroy_context ( <nl> c_server_authorization_check_arg . context ) ; <nl> TEST_F ( CredentialsTest , TlsCredentialsOptionsCppToC ) { <nl> gpr_free ( const_cast < char * > ( c_server_authorization_check_arg . target_name ) ) ; <nl> gpr_free ( const_cast < char * > ( c_server_authorization_check_arg . peer_cert ) ) ; <nl> gpr_free ( const_cast < char * > ( c_server_authorization_check_arg . error_details ) ) ; <nl> - : : grpc_core : : Delete ( c_credential_reload_config ) ; <nl> - : : grpc_core : : Delete ( c_server_authorization_check_config ) ; <nl> + : : delete c_credential_reload_config ; <nl> + : : delete c_server_authorization_check_config ; <nl> gpr_free ( c_options ) ; <nl> } <nl> <nl> mmm a / test / cpp / microbenchmarks / bm_chttp2_hpack . cc <nl> ppp b / test / cpp / microbenchmarks / bm_chttp2_hpack . cc <nl> static void BM_HpackParserInitDestroy ( benchmark : : State & state ) { <nl> grpc_chttp2_hpack_parser_init ( & p ) ; <nl> / / Note that grpc_chttp2_hpack_parser_destroy frees the table dynamic <nl> / / elements so we need to recreate it here . In actual operation , <nl> - / / grpc_core : : New < grpc_chttp2_hpack_parser_destroy > allocates the table once <nl> + / / new grpc_chttp2_hpack_parser_destroy allocates the table once <nl> / / and for all . <nl> new ( & p . table ) grpc_chttp2_hptbl ( ) ; <nl> grpc_chttp2_hpack_parser_destroy ( & p ) ; <nl> mmm a / test / cpp / microbenchmarks / bm_threadpool . cc <nl> ppp b / test / cpp / microbenchmarks / bm_threadpool . cc <nl> static void BM_ThreadPoolExternalAdd ( benchmark : : State & state ) { <nl> / / Setup for each run of test . <nl> if ( state . thread_index = = 0 ) { <nl> const int num_threads = state . range ( 1 ) ; <nl> - external_add_pool = grpc_core : : New < grpc_core : : ThreadPool > ( num_threads ) ; <nl> + external_add_pool = new grpc_core : : ThreadPool ( num_threads ) ; <nl> } <nl> const int num_iterations = state . range ( 0 ) / state . threads ; <nl> while ( state . KeepRunningBatch ( num_iterations ) ) { <nl> static void BM_ThreadPoolExternalAdd ( benchmark : : State & state ) { <nl> / / Teardown at the end of each test run . <nl> if ( state . thread_index = = 0 ) { <nl> state . SetItemsProcessed ( state . range ( 0 ) ) ; <nl> - grpc_core : : Delete ( external_add_pool ) ; <nl> + delete external_add_pool ; <nl> } <nl> } <nl> BENCHMARK ( BM_ThreadPoolExternalAdd ) <nl> mmm a / test / cpp / naming / cancel_ares_query_test . cc <nl> ppp b / test / cpp / naming / cancel_ares_query_test . cc <nl> void TestCancelActiveDNSQuery ( ArgsStruct * args ) { <nl> grpc_core : : ResolverRegistry : : CreateResolver ( <nl> client_target , nullptr , args - > pollset_set , args - > lock , <nl> grpc_core : : UniquePtr < grpc_core : : Resolver : : ResultHandler > ( <nl> - grpc_core : : New < AssertFailureResultHandler > ( args ) ) ) ; <nl> + new AssertFailureResultHandler ( args ) ) ) ; <nl> gpr_free ( client_target ) ; <nl> resolver - > StartLocked ( ) ; <nl> / / Without resetting and causing resolver shutdown , the <nl> mmm a / test / cpp / naming / resolver_component_test . cc <nl> ppp b / test / cpp / naming / resolver_component_test . cc <nl> class ResultHandler : public grpc_core : : Resolver : : ResultHandler { <nl> static grpc_core : : UniquePtr < grpc_core : : Resolver : : ResultHandler > Create ( <nl> ArgsStruct * args ) { <nl> return grpc_core : : UniquePtr < grpc_core : : Resolver : : ResultHandler > ( <nl> - grpc_core : : New < ResultHandler > ( args ) ) ; <nl> + new ResultHandler ( args ) ) ; <nl> } <nl> <nl> explicit ResultHandler ( ArgsStruct * args ) : args_ ( args ) { } <nl> class CheckingResultHandler : public ResultHandler { <nl> static grpc_core : : UniquePtr < grpc_core : : Resolver : : ResultHandler > Create ( <nl> ArgsStruct * args ) { <nl> return grpc_core : : UniquePtr < grpc_core : : Resolver : : ResultHandler > ( <nl> - grpc_core : : New < CheckingResultHandler > ( args ) ) ; <nl> + new CheckingResultHandler ( args ) ) ; <nl> } <nl> <nl> explicit CheckingResultHandler ( ArgsStruct * args ) : ResultHandler ( args ) { } <nl> void RunResolvesRelevantRecordsTest ( <nl> if ( FLAGS_inject_broken_nameserver_list = = " True " ) { <nl> g_fake_non_responsive_dns_server_port = grpc_pick_unused_port_or_die ( ) ; <nl> fake_non_responsive_dns_server . reset ( <nl> - grpc_core : : New < grpc : : testing : : FakeNonResponsiveDNSServer > ( <nl> + new grpc : : testing : : FakeNonResponsiveDNSServer ( <nl> g_fake_non_responsive_dns_server_port ) ) ; <nl> grpc_ares_test_only_inject_config = InjectBrokenNameServerList ; <nl> GPR_ASSERT ( <nl> mmm a / tools / codegen / core / gen_static_metadata . py <nl> ppp b / tools / codegen / core / gen_static_metadata . py <nl> def str_idx ( s ) : <nl> <nl> void grpc_init_static_metadata_ctx ( void ) { <nl> grpc_core : : g_static_metadata_slice_ctx <nl> - = grpc_core : : New < grpc_core : : StaticMetadataCtx > ( ) ; <nl> + = new grpc_core : : StaticMetadataCtx ( ) ; <nl> grpc_core : : g_static_metadata_slice_table <nl> = grpc_core : : g_static_metadata_slice_ctx - > slices ; <nl> grpc_core : : g_static_metadata_slice_refcounts <nl> def str_idx ( s ) : <nl> } <nl> <nl> void grpc_destroy_static_metadata_ctx ( void ) { <nl> - grpc_core : : Delete < grpc_core : : StaticMetadataCtx > ( <nl> - grpc_core : : g_static_metadata_slice_ctx ) ; <nl> + delete grpc_core : : g_static_metadata_slice_ctx ; <nl> grpc_core : : g_static_metadata_slice_ctx = nullptr ; <nl> grpc_core : : g_static_metadata_slice_table = nullptr ; <nl> grpc_core : : g_static_metadata_slice_refcounts = nullptr ; <nl> mmm a / tools / run_tests / generated / tests . json <nl> ppp b / tools / run_tests / generated / tests . json <nl> <nl> ] , <nl> " uses_polling " : true <nl> } , <nl> - { <nl> - " args " : [ ] , <nl> - " benchmark " : false , <nl> - " ci_platforms " : [ <nl> - " linux " , <nl> - " mac " , <nl> - " posix " , <nl> - " windows " <nl> - ] , <nl> - " cpu_cost " : 1 . 0 , <nl> - " exclude_configs " : [ ] , <nl> - " exclude_iomgrs " : [ ] , <nl> - " flaky " : false , <nl> - " gtest " : true , <nl> - " language " : " c + + " , <nl> - " name " : " memory_test " , <nl> - " platforms " : [ <nl> - " linux " , <nl> - " mac " , <nl> - " posix " , <nl> - " windows " <nl> - ] , <nl> - " uses_polling " : false <nl> - } , <nl> { <nl> " args " : [ ] , <nl> " benchmark " : false , <nl>
Merge pull request from veblush / no - new
grpc/grpc
b9886150debdd57bc1347e031ae4646b1e3a00d1
2019-11-07T16:25:55Z
mmm a / ReactWindows / ReactNative / ReactNative . csproj <nl> ppp b / ReactWindows / ReactNative / ReactNative . csproj <nl> <nl> < Import Project = " . . \ . . \ Yoga \ csharp \ Facebook . Yoga \ Facebook . Yoga . Shared . projitems " Label = " Shared " / > <nl> < ItemGroup > <nl> < PackageReference Include = " fresco . imagepipeline " > <nl> - < Version > 0 . 1 . 5 < / Version > <nl> + < Version > 0 . 1 . 6 < / Version > <nl> < / PackageReference > <nl> < PackageReference Include = " Microsoft . NETCore . UniversalWindowsPlatform " > <nl> < Version > 6 . 0 . 6 < / Version > <nl>
bump fresco . imagepipeline module for git decoder fix ( )
microsoft/react-native-windows
addc07798bd96f250c1bbcc8af9bd89abc94c485
2018-06-06T15:21:28Z
new file mode 100644 <nl> index 0000000000 . . 78c3414ff5 <nl> mmm / dev / null <nl> ppp b / libraries / cmake / source_migration / modules / Findrapidjson . cmake <nl> <nl> + # Copyright ( c ) 2014 - present , Facebook , Inc . <nl> + # All rights reserved . <nl> + # <nl> + # This source code is licensed in accordance with the terms specified in <nl> + # the LICENSE file found in the root directory of this source tree . <nl> + <nl> + include ( " $ { CMAKE_SOURCE_DIR } / libraries / cmake / source / modules / Findrapidjson . cmake " ) <nl>
Migrate rapidjson to source build on macOS and Windows ( )
osquery/osquery
0bf2245396a952f2ce05942f9f5bada8ad05708d
2019-10-19T00:05:22Z
mmm a / libs / libcommon / src / DateLUT . cpp <nl> ppp b / libs / libcommon / src / DateLUT . cpp <nl> <nl> # include < Poco / DigestStream . h > <nl> # include < fstream > <nl> <nl> + <nl> namespace <nl> { <nl> <nl> Poco : : DigestEngine : : Digest calcSHA1 ( const std : : string & path ) <nl> return digest_engine . digest ( ) ; <nl> } <nl> <nl> + <nl> std : : string determineDefaultTimeZone ( ) <nl> { <nl> namespace fs = boost : : filesystem ; <nl> std : : string determineDefaultTimeZone ( ) <nl> else <nl> { <nl> error_prefix = " Could not determine local time zone : " ; <nl> - tz_file_path = " / etc / localtime " ; / / / FIXME : in case of no TZ use the immediate linked file as tz name . <nl> + tz_file_path = " / etc / localtime " ; <nl> + <nl> + / / / No TZ variable and no tzdata installed ( e . g . Docker ) <nl> + if ( ! fs : : exists ( tz_file_path ) ) <nl> + return " UTC " ; <nl> + <nl> + / / / Read symlink but not transitive . <nl> + / / / Example : <nl> + / / / / etc / localtime - > / usr / share / zoneinfo / / UTC <nl> + / / / / usr / share / zoneinfo / / UTC - > UCT <nl> + / / / But the preferred time zone name is pointed by the first link ( UTC ) , and the second link is just an internal detail . <nl> + if ( fs : : is_symlink ( tz_file_path ) ) <nl> + tz_file_path = fs : : read_symlink ( tz_file_path ) ; <nl> } <nl> <nl> try <nl> { <nl> tz_database_path = fs : : canonical ( tz_database_path ) ; <nl> - tz_file_path = fs : : canonical ( tz_file_path , tz_database_path ) ; <nl> <nl> / / / The tzdata file exists . If it is inside the tz_database_dir , <nl> / / / then the relative path is the time zone id . <nl> - fs : : path relative_path = tz_file_path . lexically_relative ( tz_database_path ) ; <nl> - if ( ! relative_path . empty ( ) & & * relative_path . begin ( ) ! = " . . " & & * relative_path . begin ( ) ! = " . " ) <nl> - return tz_name . empty ( ) ? relative_path . string ( ) : tz_name ; <nl> + { <nl> + fs : : path relative_path = tz_file_path . lexically_relative ( tz_database_path ) ; <nl> + <nl> + if ( ! relative_path . empty ( ) & & * relative_path . begin ( ) ! = " . . " & & * relative_path . begin ( ) ! = " . " ) <nl> + return tz_name . empty ( ) ? relative_path . string ( ) : tz_name ; <nl> + } <nl> + <nl> + / / / Try the same with full symlinks resolution <nl> + { <nl> + tz_file_path = fs : : canonical ( tz_file_path , tz_database_path ) ; <nl> + <nl> + fs : : path relative_path = tz_file_path . lexically_relative ( tz_database_path ) ; <nl> + if ( ! relative_path . empty ( ) & & * relative_path . begin ( ) ! = " . . " & & * relative_path . begin ( ) ! = " . " ) <nl> + return tz_name . empty ( ) ? relative_path . string ( ) : tz_name ; <nl> + } <nl> <nl> - / / / The file is not inside the tz_database_dir , so we hope that it was copied and <nl> - / / / try to find the file with exact same contents in the database . <nl> + / / / The file is not inside the tz_database_dir , so we hope that it was copied ( not symlinked ) <nl> + / / / and try to find the file with exact same contents in the database . <nl> <nl> size_t tzfile_size = fs : : file_size ( tz_file_path ) ; <nl> Poco : : SHA1Engine : : Digest tzfile_sha1 = calcSHA1 ( tz_file_path . string ( ) ) ; <nl>
Merge pull request from yandex / date - lut - fix - uct
ClickHouse/ClickHouse
dc59b245f10e69330ddf45f08308e26ee48524f3
2019-07-02T09:49:48Z
mmm a / lib / Basics / files . cpp <nl> ppp b / lib / Basics / files . cpp <nl> int TRI_CreateRecursiveDirectory ( char const * path , <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> / / / @ brief creates a directory <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + <nl> int TRI_CreateDirectory ( char const * path , <nl> - long & systemError , <nl> - std : : string & systemErrorStr ) { <nl> + long & systemError , <nl> + std : : string & systemErrorStr ) { <nl> TRI_ERRORBUF ; <nl> int res ; <nl> <nl> int TRI_CreateDirectory ( char const * path , <nl> <nl> res = TRI_MKDIR ( path , 0777 ) ; <nl> <nl> + if ( res = = TRI_ERROR_NO_ERROR ) { <nl> + return res ; <nl> + } <nl> + <nl> + / / check errno <nl> + TRI_SYSTEM_ERROR ( ) ; <nl> + res = errno ; <nl> if ( res ! = TRI_ERROR_NO_ERROR ) { <nl> - / / check errno <nl> - TRI_SYSTEM_ERROR ( ) ; <nl> - res = errno ; <nl> - if ( res ! = TRI_ERROR_NO_ERROR ) { <nl> - systemErrorStr = std : : string ( " Failed to create directory [ " ) + path + " ] " + TRI_GET_ERRORBUF ; <nl> + systemErrorStr = std : : string ( " Failed to create directory [ " ) + path + " ] " + TRI_GET_ERRORBUF ; <nl> + systemError = res ; <nl> <nl> - if ( res = = ENOENT ) { <nl> - res = TRI_ERROR_FILE_NOT_FOUND ; <nl> - } <nl> - else if ( res = = EEXIST ) { <nl> - res = TRI_ERROR_FILE_EXISTS ; <nl> - } <nl> - else if ( res = = EPERM ) { <nl> - res = TRI_ERROR_FORBIDDEN ; <nl> - } <nl> - else { <nl> - res = TRI_ERROR_INTERNAL ; <nl> - } <nl> - systemError = errno ; <nl> - / / an unknown error type . will be translated into system error below <nl> + if ( res = = ENOENT ) { <nl> + return TRI_ERROR_FILE_NOT_FOUND ; <nl> } <nl> - <nl> - / / if errno doesn ' t indicate an error , return a system error <nl> - if ( res = = TRI_ERROR_NO_ERROR ) { <nl> - res = TRI_ERROR_SYS_ERROR ; <nl> + if ( res = = EEXIST ) { <nl> + return TRI_ERROR_FILE_EXISTS ; <nl> + } <nl> + if ( res = = EPERM ) { <nl> + return TRI_ERROR_FORBIDDEN ; <nl> } <nl> } <nl> - <nl> - return res ; <nl> + <nl> + return TRI_ERROR_SYS_ERROR ; <nl> } <nl> <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> int TRI_CreateDirectory ( char const * path , <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> <nl> int TRI_RemoveEmptyDirectory ( char const * filename ) { <nl> - int res ; <nl> - <nl> - res = TRI_RMDIR ( filename ) ; <nl> + int res = TRI_RMDIR ( filename ) ; <nl> <nl> if ( res ! = 0 ) { <nl> LOG_TRACE ( " cannot remove directory ' % s ' : % s " , filename , TRI_LAST_ERROR_STR ) ; <nl> int TRI_GetTempName ( char const * directory , <nl> res = TRI_CreateRecursiveDirectory ( dir , systemError , errorMessage ) ; <nl> if ( ( res ! = TRI_ERROR_FILE_EXISTS ) & & <nl> ( res ! = TRI_ERROR_NO_ERROR ) ) { <nl> + TRI_Free ( TRI_CORE_MEM_ZONE , dir ) ; <nl> return res ; <nl> } <nl> if ( ! TRI_IsDirectory ( dir ) ) { <nl> mmm a / lib / Basics / operating - system . h <nl> ppp b / lib / Basics / operating - system . h <nl> <nl> # define TRI_stat_t struct stat <nl> <nl> # define TRI_LAST_ERROR_STR strerror ( errno ) <nl> - # define TRI_SYSTEM_ERROR ( ) strerror ( errno ) <nl> + # define TRI_SYSTEM_ERROR ( ) { } <nl> # define TRI_ERRORBUF { } <nl> # define TRI_GET_ERRORBUF strerror ( errno ) <nl> <nl> <nl> # define TRI_stat_t struct stat <nl> <nl> # define TRI_LAST_ERROR_STR strerror ( errno ) <nl> - # define TRI_SYSTEM_ERROR ( ) strerror ( errno ) <nl> + # define TRI_SYSTEM_ERROR ( ) { } <nl> # define TRI_ERRORBUF { } <nl> # define TRI_GET_ERRORBUF strerror ( errno ) <nl> <nl> <nl> # define TRI_stat_t struct stat <nl> <nl> # define TRI_LAST_ERROR_STR strerror ( errno ) <nl> - # define TRI_SYSTEM_ERROR ( ) strerror ( errno ) <nl> + # define TRI_SYSTEM_ERROR ( ) { } <nl> # define TRI_ERRORBUF { } <nl> # define TRI_GET_ERRORBUF strerror ( errno ) <nl> <nl> typedef unsigned char bool ; <nl> <nl> # define TRI_ERRORBUF char windowsErrorBuf [ 256 ] <nl> # define TRI_GET_ERRORBUF windowsErrorBuf <nl> + <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> / / / @ brief Return system error string <nl> / / / macro requires ERRORBUF to instanciate its buffer before . <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - long mapGetlastErrorToErrno ( DWORD error ) ; <nl> <nl> # define TRI_SYSTEM_ERROR ( ) \ <nl> - windowsErrorBuf ; \ <nl> FormatMessage ( FORMAT_MESSAGE_FROM_SYSTEM , \ <nl> NULL , \ <nl> GetLastError ( ) , \ <nl> 0 , \ <nl> windowsErrorBuf , \ <nl> sizeof ( windowsErrorBuf ) , NULL ) ; \ <nl> - errno = mapGetlastErrorToErrno ( GetLastError ( ) ) <nl> + errno = TRI_MapSystemError ( GetLastError ( ) ) <nl> <nl> <nl> # define STDIN_FILENO 0 <nl> mmm a / lib / Basics / win - utils . cpp <nl> ppp b / lib / Basics / win - utils . cpp <nl> <nl> / / / @ author Copyright 2014 , ArangoDB GmbH , Cologne , Germany <nl> / / / @ author Copyright 2011 - 2013 , triAGENS GmbH , Cologne , Germany <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + <nl> # include < errno . h > <nl> <nl> # include < io . h > <nl> void TRI_FixIcuDataEnv ( ) { <nl> } <nl> } <nl> <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + / / / @ brief converts a Windows error to a * nix system error <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> <nl> - long mapGetlastErrorToErrno ( DWORD error ) { <nl> + int TRI_MapSystemError ( DWORD error ) { <nl> switch ( error ) { <nl> - case ERROR_INVALID_FUNCTION : return EINVAL ; <nl> - case ERROR_FILE_NOT_FOUND : return ENOENT ; <nl> - case ERROR_PATH_NOT_FOUND : return ENOENT ; <nl> - case ERROR_TOO_MANY_OPEN_FILES : return EMFILE ; <nl> - case ERROR_ACCESS_DENIED : return EACCES ; <nl> - case ERROR_INVALID_HANDLE : return EBADF ; <nl> - case ERROR_NOT_ENOUGH_MEMORY : return ENOMEM ; <nl> - case ERROR_INVALID_DATA : return EINVAL ; <nl> - case ERROR_OUTOFMEMORY : return ENOMEM ; <nl> - case ERROR_INVALID_DRIVE : return ENODEV ; <nl> - case ERROR_NOT_SAME_DEVICE : return EXDEV ; <nl> - case ERROR_NO_MORE_FILES : return ENFILE ; <nl> - case ERROR_WRITE_PROTECT : return EROFS ; <nl> - case ERROR_BAD_UNIT : return ENODEV ; <nl> - case ERROR_SHARING_VIOLATION : return EACCES ; <nl> - case ERROR_LOCK_VIOLATION : return EACCES ; <nl> - case ERROR_SHARING_BUFFER_EXCEEDED : return ENOLCK ; <nl> - case ERROR_HANDLE_EOF : return ENODATA ; <nl> - case ERROR_HANDLE_DISK_FULL : return ENOSPC ; <nl> - case ERROR_NOT_SUPPORTED : return ENOSYS ; <nl> - case ERROR_REM_NOT_LIST : return ENFILE ; <nl> - case ERROR_DUP_NAME : return EEXIST ; <nl> - case ERROR_BAD_NETPATH : return EBADF ; <nl> - case ERROR_BAD_NET_NAME : return EBADF ; <nl> - case ERROR_FILE_EXISTS : return EEXIST ; <nl> - case ERROR_CANNOT_MAKE : return EPERM ; <nl> - case ERROR_INVALID_PARAMETER : return EINVAL ; <nl> - case ERROR_NO_PROC_SLOTS : return EAGAIN ; <nl> - case ERROR_BROKEN_PIPE : return EPIPE ; <nl> - case ERROR_OPEN_FAILED : return EIO ; <nl> - case ERROR_NO_MORE_SEARCH_HANDLES : return ENFILE ; <nl> - case ERROR_CALL_NOT_IMPLEMENTED : return ENOSYS ; <nl> - case ERROR_INVALID_NAME : return ENOENT ; <nl> - case ERROR_WAIT_NO_CHILDREN : return ECHILD ; <nl> - case ERROR_CHILD_NOT_COMPLETE : return EBUSY ; <nl> - case ERROR_DIR_NOT_EMPTY : return ENOTEMPTY ; <nl> - case ERROR_SIGNAL_REFUSED : return EIO ; <nl> - case ERROR_BAD_PATHNAME : return ENOENT ; <nl> - case ERROR_SIGNAL_PENDING : return EBUSY ; <nl> - case ERROR_MAX_THRDS_REACHED : return EAGAIN ; <nl> - case ERROR_BUSY : return EBUSY ; <nl> - case ERROR_ALREADY_EXISTS : return EEXIST ; <nl> - case ERROR_NO_SIGNAL_SENT : return EIO ; <nl> - case ERROR_FILENAME_EXCED_RANGE : return ENAMETOOLONG ; <nl> - case ERROR_META_EXPANSION_TOO_LONG : return EINVAL ; <nl> - case ERROR_INVALID_SIGNAL_NUMBER : return EINVAL ; <nl> - case ERROR_THREAD_1_INACTIVE : return EINVAL ; <nl> - case ERROR_BAD_PIPE : return EINVAL ; <nl> - case ERROR_PIPE_BUSY : return EBUSY ; <nl> - case ERROR_NO_DATA : return EPIPE ; <nl> - case ERROR_PIPE_NOT_CONNECTED : return EPIPE ; <nl> - case ERROR_MORE_DATA : return EAGAIN ; <nl> - case ERROR_DIRECTORY : return ENOTDIR ; <nl> - case ERROR_PIPE_CONNECTED : return EBUSY ; <nl> - case ERROR_PIPE_LISTENING : return EPIPE ; <nl> - case ERROR_NO_TOKEN : return EINVAL ; <nl> - case ERROR_PROCESS_ABORTED : return EFAULT ; <nl> - case ERROR_BAD_DEVICE : return ENODEV ; <nl> - case ERROR_BAD_USERNAME : return EINVAL ; <nl> - case ERROR_NOT_CONNECTED : return ENOLINK ; <nl> - case ERROR_OPEN_FILES : return EAGAIN ; <nl> - case ERROR_ACTIVE_CONNECTIONS : return EAGAIN ; <nl> - case ERROR_DEVICE_IN_USE : return EAGAIN ; <nl> - case ERROR_INVALID_AT_INTERRUPT_TIME : return EINTR ; <nl> - case ERROR_IO_DEVICE : return EIO ; <nl> - case ERROR_NOT_OWNER : return EPERM ; <nl> - case ERROR_END_OF_MEDIA : return ENOSPC ; <nl> - case ERROR_EOM_OVERFLOW : return ENOSPC ; <nl> - case ERROR_BEGINNING_OF_MEDIA : return ESPIPE ; <nl> - case ERROR_SETMARK_DETECTED : return ESPIPE ; <nl> - case ERROR_NO_DATA_DETECTED : return ENOSPC ; <nl> - case ERROR_POSSIBLE_DEADLOCK : return EDEADLOCK ; <nl> - case ERROR_CRC : return EIO ; <nl> - case ERROR_NEGATIVE_SEEK : return EINVAL ; <nl> - case ERROR_NOT_READY : return EBADF ; <nl> - case ERROR_DISK_FULL : return ENOSPC ; <nl> - case ERROR_NOACCESS : return EFAULT ; <nl> - case ERROR_FILE_INVALID : return ENXIO ; <nl> - default : return EINVAL ; <nl> - } <nl> + case ERROR_INVALID_FUNCTION : return EINVAL ; <nl> + case ERROR_FILE_NOT_FOUND : return ENOENT ; <nl> + case ERROR_PATH_NOT_FOUND : return ENOENT ; <nl> + case ERROR_TOO_MANY_OPEN_FILES : return EMFILE ; <nl> + case ERROR_ACCESS_DENIED : return EACCES ; <nl> + case ERROR_INVALID_HANDLE : return EBADF ; <nl> + case ERROR_NOT_ENOUGH_MEMORY : return ENOMEM ; <nl> + case ERROR_INVALID_DATA : return EINVAL ; <nl> + case ERROR_OUTOFMEMORY : return ENOMEM ; <nl> + case ERROR_INVALID_DRIVE : return ENODEV ; <nl> + case ERROR_NOT_SAME_DEVICE : return EXDEV ; <nl> + case ERROR_NO_MORE_FILES : return ENFILE ; <nl> + case ERROR_WRITE_PROTECT : return EROFS ; <nl> + case ERROR_BAD_UNIT : return ENODEV ; <nl> + case ERROR_SHARING_VIOLATION : return EACCES ; <nl> + case ERROR_LOCK_VIOLATION : return EACCES ; <nl> + case ERROR_SHARING_BUFFER_EXCEEDED : return ENOLCK ; <nl> + case ERROR_HANDLE_EOF : return ENODATA ; <nl> + case ERROR_HANDLE_DISK_FULL : return ENOSPC ; <nl> + case ERROR_NOT_SUPPORTED : return ENOSYS ; <nl> + case ERROR_REM_NOT_LIST : return ENFILE ; <nl> + case ERROR_DUP_NAME : return EEXIST ; <nl> + case ERROR_BAD_NETPATH : return EBADF ; <nl> + case ERROR_BAD_NET_NAME : return EBADF ; <nl> + case ERROR_FILE_EXISTS : return EEXIST ; <nl> + case ERROR_CANNOT_MAKE : return EPERM ; <nl> + case ERROR_INVALID_PARAMETER : return EINVAL ; <nl> + case ERROR_NO_PROC_SLOTS : return EAGAIN ; <nl> + case ERROR_BROKEN_PIPE : return EPIPE ; <nl> + case ERROR_OPEN_FAILED : return EIO ; <nl> + case ERROR_NO_MORE_SEARCH_HANDLES : return ENFILE ; <nl> + case ERROR_CALL_NOT_IMPLEMENTED : return ENOSYS ; <nl> + case ERROR_INVALID_NAME : return ENOENT ; <nl> + case ERROR_WAIT_NO_CHILDREN : return ECHILD ; <nl> + case ERROR_CHILD_NOT_COMPLETE : return EBUSY ; <nl> + case ERROR_DIR_NOT_EMPTY : return ENOTEMPTY ; <nl> + case ERROR_SIGNAL_REFUSED : return EIO ; <nl> + case ERROR_BAD_PATHNAME : return ENOENT ; <nl> + case ERROR_SIGNAL_PENDING : return EBUSY ; <nl> + case ERROR_MAX_THRDS_REACHED : return EAGAIN ; <nl> + case ERROR_BUSY : return EBUSY ; <nl> + case ERROR_ALREADY_EXISTS : return EEXIST ; <nl> + case ERROR_NO_SIGNAL_SENT : return EIO ; <nl> + case ERROR_FILENAME_EXCED_RANGE : return ENAMETOOLONG ; <nl> + case ERROR_META_EXPANSION_TOO_LONG : return EINVAL ; <nl> + case ERROR_INVALID_SIGNAL_NUMBER : return EINVAL ; <nl> + case ERROR_THREAD_1_INACTIVE : return EINVAL ; <nl> + case ERROR_BAD_PIPE : return EINVAL ; <nl> + case ERROR_PIPE_BUSY : return EBUSY ; <nl> + case ERROR_NO_DATA : return EPIPE ; <nl> + case ERROR_PIPE_NOT_CONNECTED : return EPIPE ; <nl> + case ERROR_MORE_DATA : return EAGAIN ; <nl> + case ERROR_DIRECTORY : return ENOTDIR ; <nl> + case ERROR_PIPE_CONNECTED : return EBUSY ; <nl> + case ERROR_PIPE_LISTENING : return EPIPE ; <nl> + case ERROR_NO_TOKEN : return EINVAL ; <nl> + case ERROR_PROCESS_ABORTED : return EFAULT ; <nl> + case ERROR_BAD_DEVICE : return ENODEV ; <nl> + case ERROR_BAD_USERNAME : return EINVAL ; <nl> + case ERROR_NOT_CONNECTED : return ENOLINK ; <nl> + case ERROR_OPEN_FILES : return EAGAIN ; <nl> + case ERROR_ACTIVE_CONNECTIONS : return EAGAIN ; <nl> + case ERROR_DEVICE_IN_USE : return EAGAIN ; <nl> + case ERROR_INVALID_AT_INTERRUPT_TIME : return EINTR ; <nl> + case ERROR_IO_DEVICE : return EIO ; <nl> + case ERROR_NOT_OWNER : return EPERM ; <nl> + case ERROR_END_OF_MEDIA : return ENOSPC ; <nl> + case ERROR_EOM_OVERFLOW : return ENOSPC ; <nl> + case ERROR_BEGINNING_OF_MEDIA : return ESPIPE ; <nl> + case ERROR_SETMARK_DETECTED : return ESPIPE ; <nl> + case ERROR_NO_DATA_DETECTED : return ENOSPC ; <nl> + case ERROR_POSSIBLE_DEADLOCK : return EDEADLOCK ; <nl> + case ERROR_CRC : return EIO ; <nl> + case ERROR_NEGATIVE_SEEK : return EINVAL ; <nl> + case ERROR_NOT_READY : return EBADF ; <nl> + case ERROR_DISK_FULL : return ENOSPC ; <nl> + case ERROR_NOACCESS : return EFAULT ; <nl> + case ERROR_FILE_INVALID : return ENXIO ; <nl> + default : return EINVAL ; <nl> + } <nl> } <nl> <nl> / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> mmm a / lib / Basics / win - utils . h <nl> ppp b / lib / Basics / win - utils . h <nl> int TRI_OPEN_WIN32 ( const char * filename , int openFlags ) ; <nl> <nl> void TRI_sleep ( unsigned long ) ; <nl> <nl> - <nl> / / . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . <nl> / / there is no usleep ( micro sleep ) in windows , so we create one here <nl> / / . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . <nl> void TRI_usleep ( unsigned long ) ; <nl> <nl> void TRI_FixIcuDataEnv ( ) ; <nl> <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + / / / @ brief converts a Windows error to a * nix system error <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + <nl> + int TRI_MapSystemError ( DWORD ) ; <nl> + <nl> # endif <nl> <nl> / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl>
fixed memleak
arangodb/arangodb
52b200e870dbaea95673142eac0800f672e12794
2015-02-24T10:28:07Z
mmm a / tensorflow / python / keras / callbacks_test . py <nl> ppp b / tensorflow / python / keras / callbacks_test . py <nl> def call ( self , inputs ) : <nl> for epoch in range ( initial_epochs ) : <nl> self . assertTrue ( os . path . exists ( filepath . format ( epoch = epoch + 1 ) ) ) <nl> self . assertFalse ( os . path . exists ( filepath . format ( epoch = initial_epochs + 1 ) ) ) <nl> - self . skipTest ( ' b / 122958618 ' ) <nl> + self . skipTest ( ' b / 131852849 ' ) <nl> self . assertEqual ( <nl> callback . _get_most_recently_modified_file_matching_pattern ( filepath ) , <nl> filepath . format ( epoch = initial_epochs ) ) <nl>
Internal change .
tensorflow/tensorflow
48b2d5bff9316dd14823ae84cbbedc368c3a53ed
2019-05-03T00:38:09Z
mmm a / tensorflow / compiler / jit / BUILD <nl> ppp b / tensorflow / compiler / jit / BUILD <nl> tf_cc_test ( <nl> ] , <nl> ) <nl> <nl> + tf_cc_test ( <nl> + name = " xla_launch_util_test " , <nl> + size = " small " , <nl> + srcs = [ " xla_launch_util_test . cc " ] , <nl> + deps = [ <nl> + " : common " , <nl> + " : xla_compilation_cache " , <nl> + " : xla_launch_util " , <nl> + " : xla_tensor " , <nl> + " / / tensorflow / compiler / tf2xla : common " , <nl> + " / / tensorflow / compiler / tf2xla : xla_compiler " , <nl> + " / / tensorflow / compiler / xla : statusor " , <nl> + " / / tensorflow / compiler / xla / client : client_library " , <nl> + " / / tensorflow / compiler / xla / client : local_client " , <nl> + " / / tensorflow / core : core_cpu_internal " , <nl> + " / / tensorflow / core : framework " , <nl> + " / / tensorflow / core : gpu_runtime " , <nl> + " / / tensorflow / core : lib " , <nl> + " / / tensorflow / core : lib_internal " , <nl> + " / / tensorflow / core : protos_all_cc " , <nl> + " / / tensorflow / core : test " , <nl> + " / / tensorflow / core / kernels : variable_ops " , <nl> + ] , <nl> + ) <nl> + <nl> # This target can be used by XLA device plugins to prevent circular dependencies , and provides access to all of the required headers for building a device library . <nl> cc_header_only_library ( <nl> name = " xla_jit_headers_lib " , <nl> mmm a / tensorflow / compiler / jit / xla_launch_util . cc <nl> ppp b / tensorflow / compiler / jit / xla_launch_util . cc <nl> Status XlaAllocator : : Deallocate ( int device_ordinal , se : : DeviceMemoryBase * mem ) { <nl> return Status : : OK ( ) ; <nl> } <nl> <nl> - namespace { <nl> + namespace internal { <nl> / / Return the ' index ' ' th subtree of the given ShapedBuffer as a <nl> / / ScopedShapedBuffer . The returned ScopedShapedBuffer takes ownership of the <nl> / / subtree , and sets the input ' s buffer pointers to nullptr for the subtree . <nl> ScopedShapedBuffer ExtractSubShapedBuffer ( <nl> ShapedBuffer * shaped_buffer , int index , <nl> xla : : DeviceMemoryAllocator * allocator ) { <nl> - xla : : Shape on_host_shape = xla : : ShapeUtil : : GetTupleElementShape ( <nl> + const xla : : Shape & on_host_shape = xla : : ShapeUtil : : GetTupleElementShape ( <nl> shaped_buffer - > on_host_shape ( ) , index ) ; <nl> - xla : : Shape on_device_shape = xla : : ShapeUtil : : GetTupleElementShape ( <nl> + const xla : : Shape & on_device_shape = xla : : ShapeUtil : : GetTupleElementShape ( <nl> shaped_buffer - > on_device_shape ( ) , index ) ; <nl> <nl> ShapedBuffer sub_shaped_buffer ( on_host_shape , on_device_shape , <nl> ScopedShapedBuffer ExtractSubShapedBuffer ( <nl> sub_shape_tree . CopySubtreeFrom ( shape_tree , <nl> / * source_base_index = * / { index } , <nl> / * target_base_index = * / { } ) ; <nl> - for ( auto & index_to_buffer : shape_tree ) { <nl> - if ( ! index_to_buffer . first . empty ( ) & & index_to_buffer . first [ 0 ] = = index ) { <nl> - index_to_buffer . second = se : : DeviceMemoryBase ( nullptr , 0 ) ; <nl> - } <nl> - } <nl> + shape_tree . ForEachMutableElement ( <nl> + [ index ] ( const xla : : ShapeIndex & shape_index , <nl> + tensorflow : : se : : DeviceMemoryBase * data ) { <nl> + / / shape_index is empty for the root node . Ignore that . <nl> + if ( ! shape_index . empty ( ) & & shape_index [ 0 ] = = index ) { <nl> + * data = tensorflow : : se : : DeviceMemoryBase ( nullptr , 0 ) ; <nl> + } <nl> + } ) ; <nl> return ScopedShapedBuffer ( std : : move ( sub_shaped_buffer ) , allocator ) ; <nl> } <nl> - } / / namespace <nl> + } / / namespace internal <nl> + using internal : : ExtractSubShapedBuffer ; <nl> <nl> XlaComputationLaunchContext : : XlaComputationLaunchContext ( <nl> int64 num_resource_args , xla : : LocalClient * client , <nl> mmm a / tensorflow / compiler / jit / xla_launch_util . h <nl> ppp b / tensorflow / compiler / jit / xla_launch_util . h <nl> class XlaTensorBuffer : public TensorBuffer { <nl> Allocator * allocator_ ; <nl> } ; <nl> <nl> + / / Exposed in this header file for microbenchmarking purposes , but this is an <nl> + / / internal implementation detail . <nl> + namespace internal { <nl> + / / Return the ' index ' ' th subtree of the given ShapedBuffer as a <nl> + / / ScopedShapedBuffer . The returned ScopedShapedBuffer takes ownership of the <nl> + / / subtree , and sets the input ' s buffer pointers to nullptr for the subtree . <nl> + xla : : ScopedShapedBuffer ExtractSubShapedBuffer ( <nl> + xla : : ShapedBuffer * shaped_buffer , int index , <nl> + xla : : DeviceMemoryAllocator * allocator ) ; <nl> + } / / namespace internal <nl> + <nl> } / / namespace tensorflow <nl> <nl> # endif <nl> new file mode 100644 <nl> index 0000000000000 . . 27813efc0bc0a <nl> mmm / dev / null <nl> ppp b / tensorflow / compiler / jit / xla_launch_util_test . cc <nl> <nl> + / * Copyright 2018 The TensorFlow Authors . All Rights Reserved . <nl> + <nl> + Licensed under the Apache License , Version 2 . 0 ( the " License " ) ; <nl> + you may not use this file except in compliance with the License . <nl> + You may obtain a copy of the License at <nl> + <nl> + http : / / www . apache . org / licenses / LICENSE - 2 . 0 <nl> + <nl> + Unless required by applicable law or agreed to in writing , software <nl> + distributed under the License is distributed on an " AS IS " BASIS , <nl> + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND , either express or implied . <nl> + See the License for the specific language governing permissions and <nl> + limitations under the License . <nl> + = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = * / <nl> + <nl> + / / Contains microbenchmarks for performance critical functions in <nl> + / / xla_launch_util . cc . <nl> + <nl> + # include " tensorflow / compiler / jit / xla_launch_util . h " <nl> + # include " tensorflow / compiler / tf2xla / shape_util . h " <nl> + # include " tensorflow / core / platform / test . h " <nl> + # include " tensorflow / core / platform / test_benchmark . h " <nl> + <nl> + / / Test ExtractSubBuffer with different depths ( depth of ShapeTree ) and fan - outs <nl> + / / ( cardinality of each non - leaf node ' s children ) . <nl> + void BM_ExtractSubBuffer ( int iters , int depth , int fan_out ) { <nl> + tensorflow : : testing : : StopTiming ( ) ; <nl> + xla : : Shape shape = xla : : ShapeUtil : : MakeShape ( xla : : F32 , { 32 , 64 , 128 } ) ; <nl> + for ( int i = 0 ; i < depth ; + + i ) { <nl> + std : : vector < xla : : Shape > shapes ( fan_out , shape ) ; <nl> + shape = xla : : ShapeUtil : : MakeTupleShape ( shapes ) ; <nl> + } <nl> + xla : : ShapedBuffer shaped_buffer ( shape , shape , / * platform = * / nullptr , <nl> + / * device_ordinal = * / 0 ) ; <nl> + tensorflow : : testing : : StartTiming ( ) ; <nl> + for ( int i = 0 ; i < iters ; + + i ) { <nl> + / / Extract a buffer from approximately the middle of the first level of the <nl> + / / tree . <nl> + tensorflow : : internal : : ExtractSubShapedBuffer ( & shaped_buffer , <nl> + / * index = * / fan_out / 2 , <nl> + / * allocator = * / nullptr ) <nl> + . release ( ) ; <nl> + } <nl> + } <nl> + <nl> + BENCHMARK ( BM_ExtractSubBuffer ) <nl> + - > ArgPair ( 1 , 4 ) <nl> + - > ArgPair ( 1 , 8 ) <nl> + - > ArgPair ( 1 , 32 ) <nl> + - > ArgPair ( 1 , 64 ) <nl> + - > ArgPair ( 1 , 128 ) <nl> + - > ArgPair ( 1 , 256 ) <nl> + - > ArgPair ( 1 , 512 ) <nl> + - > ArgPair ( 2 , 4 ) <nl> + - > ArgPair ( 2 , 8 ) <nl> + - > ArgPair ( 2 , 32 ) <nl> + - > ArgPair ( 2 , 64 ) <nl> + - > ArgPair ( 2 , 128 ) ; <nl> + <nl> + int main ( int argc , char * * argv ) { <nl> + testing : : InitGoogleTest ( & argc , argv ) ; <nl> + tensorflow : : testing : : RunBenchmarks ( ) ; <nl> + return RUN_ALL_TESTS ( ) ; <nl> + } <nl>
* Don ' t copy on - host and on - device shapes locally .
tensorflow/tensorflow
1284047dca0dd58745a31cd2fd68da3173c7e120
2018-05-04T17:45:14Z
mmm a / tensorflow / python / ops / math_ops . py <nl> ppp b / tensorflow / python / ops / math_ops . py <nl> def linspace_nd ( start , stop , num , axis = 0 , name = None ) : <nl> <nl> ` Start ` and ` stop ` can be tensors of arbitrary size : <nl> <nl> - ` ` ` <nl> > > > tf . linspace_nd ( [ 0 . , 5 . ] , [ 10 . , 40 . ] , 5 , axis = 0 ) <nl> - < tf . Tensor : shape = ( 5 , 2 ) , dtype = float32 , numpy = <nl> - array ( [ [ 0 . , 5 . ] , <nl> - [ 2 . 5 , 13 . 75 ] , <nl> - [ 5 . , 22 . 5 ] , <nl> - [ 7 . 5 , 31 . 25 ] , <nl> - [ 10 . , 40 . ] ] , dtype = float32 ) > <nl> - ` ` ` <nl> + < tf . Tensor : shape = ( 5 , 2 ) , dtype = float32 , numpy = <nl> + array ( [ [ 0 . , 5 . ] , <nl> + [ 2 . 5 , 13 . 75 ] , <nl> + [ 5 . , 22 . 5 ] , <nl> + [ 7 . 5 , 31 . 25 ] , <nl> + [ 10 . , 40 . ] ] , dtype = float32 ) > <nl> <nl> ` Axis ` is where the values will be generated ( the dimension in the <nl> returned tensor which corresponds to the axis will be equal to ` num ` ) <nl> <nl> - ` ` ` <nl> > > > tf . linspace_nd ( [ 0 . , 5 . ] , [ 10 . , 40 . ] , 5 , axis = - 1 ) <nl> - < tf . Tensor : shape = ( 2 , 5 ) , dtype = float32 , numpy = <nl> - array ( [ [ 0 . , 2 . 5 , 5 . , 7 . 5 , 10 . ] , <nl> - [ 5 . , 13 . 75 , 22 . 5 , 31 . 25 , 40 . ] ] , dtype = float32 ) > <nl> + < tf . Tensor : shape = ( 2 , 5 ) , dtype = float32 , numpy = <nl> + array ( [ [ 0 . , 2 . 5 , 5 . , 7 . 5 , 10 . ] , <nl> + [ 5 . , 13 . 75 , 22 . 5 , 31 . 25 , 40 . ] ] , dtype = float32 ) > <nl> <nl> - ` ` ` <nl> <nl> <nl> Args : <nl>
Doctest for linspace is correctly formatted .
tensorflow/tensorflow
674b92e6d1cd88a51512e27378932482041d4ed4
2019-10-13T07:23:06Z
mmm a / db / record . cpp <nl> ppp b / db / record . cpp <nl> namespace mongo { <nl> memset ( _data , 0 , SliceSize * sizeof ( Entry ) ) ; <nl> } <nl> <nl> - State get ( size_t region , short offset ) { <nl> - Entry * e = _get ( region , false ) ; <nl> + State get ( int regionHash , size_t region , short offset ) { <nl> + DEV assert ( hash ( region ) = = regionHash ) ; <nl> + <nl> + Entry * e = _get ( regionHash , region , false ) ; <nl> if ( ! e ) <nl> return Unk ; <nl> <nl> namespace mongo { <nl> / * * <nl> * @ return true if added , false if full <nl> * / <nl> - bool in ( size_t region , short offset ) { <nl> - Entry * e = _get ( region , true ) ; <nl> + bool in ( int regionHash , size_t region , short offset ) { <nl> + DEV assert ( hash ( region ) = = regionHash ) ; <nl> + <nl> + Entry * e = _get ( regionHash , region , true ) ; <nl> if ( ! e ) <nl> return false ; <nl> <nl> namespace mongo { <nl> <nl> private : <nl> <nl> - Entry * _get ( size_t region , bool add ) { <nl> - int start = hash ( region ) ; <nl> + Entry * _get ( int start , size_t region , bool add ) { <nl> for ( int i = 0 ; i < MaxChain ; i + + ) { <nl> <nl> int bucket = ( start + i ) % SliceSize ; <nl> namespace mongo { <nl> * @ return whether we know the page is in ram <nl> * / <nl> bool access ( size_t region , short offset ) { <nl> + int regionHash = hash ( region ) ; <nl> + <nl> scoped_spinlock lk ( _lock ) ; <nl> <nl> RARELY { <nl> namespace mongo { <nl> <nl> for ( int i = 0 ; i < NumSlices ; i + + ) { <nl> int pos = ( _curSlice + i ) % NumSlices ; <nl> - State s = _slices [ pos ] . get ( region , offset ) ; <nl> + State s = _slices [ pos ] . get ( regionHash , region , offset ) ; <nl> <nl> if ( s = = In ) <nl> return true ; <nl> <nl> if ( s = = Out ) { <nl> - _slices [ pos ] . in ( region , offset ) ; <nl> + _slices [ pos ] . in ( regionHash , region , offset ) ; <nl> return false ; <nl> } <nl> } <nl> <nl> / / we weren ' t in any slice <nl> / / so add to cur <nl> - if ( ! _slices [ _curSlice ] . in ( region , offset ) ) { <nl> + if ( ! _slices [ _curSlice ] . in ( regionHash , region , offset ) ) { <nl> _rotate ( ) ; <nl> - _slices [ _curSlice ] . in ( region , offset ) ; <nl> + _slices [ _curSlice ] . in ( regionHash , region , offset ) ; <nl> } <nl> return false ; <nl> } <nl>
a little faster record status
mongodb/mongo
10858a7a5f80ecdc853ec07aea3985281974f09c
2011-06-23T19:57:10Z
mmm a / contracts / eosio . system / delegate_bandwidth . hpp <nl> ppp b / contracts / eosio . system / delegate_bandwidth . hpp <nl> namespace eosiosystem { <nl> refund act ; <nl> act . owner = del . from ; <nl> transaction out ( now ( ) + refund_delay + refund_expiration_time ) ; <nl> - out . actions . emplace_back ( permission_level { self , N ( active ) } , self , N ( refund ) , act ) ; <nl> + out . actions . emplace_back ( permission_level { del . from , N ( active ) } , self , N ( refund ) , act ) ; <nl> out . send ( del . from , now ( ) + refund_delay ) ; <nl> <nl> if ( asset ( 0 ) < del . unstake_net_quantity + del . unstake_cpu_quantity ) { <nl> namespace eosiosystem { <nl> } / / undelegatebw <nl> <nl> static void on ( const refund & r ) { <nl> + require_auth ( r . owner ) ; <nl> + <nl> refunds_table refunds_tbl ( SystemAccount , r . owner ) ; <nl> auto req = refunds_tbl . find ( r . owner ) ; <nl> eosio_assert ( req ! = refunds_tbl . end ( ) , " refund request not found " ) ; <nl> eosio_assert ( req - > request_time + refund_delay < = now ( ) , " refund is not available yet " ) ; <nl> + / / Until now ( ) becomes NOW , the fact that now ( ) is the timestamp of the previous block could in theory <nl> + / / allow people to get their tokens earlier than the 3 day delay if the unstake happened immediately after many <nl> + / / consecutive missed blocks . <nl> <nl> currency : : inline_transfer ( SystemAccount , req - > owner , req - > amount , " unstake " ) ; <nl> refunds_tbl . erase ( req ) ; <nl>
Allow no one else other than owner to initiate the refund .
EOSIO/eos
3af2c7be40d981c186e19791628a6bc9e78d5ece
2018-03-22T22:09:52Z
mmm a / src / catch2 / internal / catch_clara . hpp <nl> ppp b / src / catch2 / internal / catch_clara . hpp <nl> namespace Catch { <nl> TokenStream & operator + + ( ) ; <nl> } ; <nl> <nl> - class ResultBase { <nl> - public : <nl> - enum Type { Ok , LogicError , RuntimeError } ; <nl> + / / ! Denotes type of a parsing result <nl> + enum class ResultType { <nl> + Ok , / / / < No errors <nl> + LogicError , / / / < Error in user - specified arguments for <nl> + / / / < construction <nl> + RuntimeError / / / < Error in parsing inputs <nl> + } ; <nl> <nl> + class ResultBase { <nl> protected : <nl> - ResultBase ( Type type ) : m_type ( type ) { } <nl> + ResultBase ( ResultType type ) : m_type ( type ) { } <nl> virtual ~ ResultBase ( ) = default ; <nl> <nl> virtual void enforceOk ( ) const = 0 ; <nl> <nl> - Type m_type ; <nl> + ResultType m_type ; <nl> } ; <nl> <nl> template < typename T > class ResultValueBase : public ResultBase { <nl> namespace Catch { <nl> } <nl> <nl> protected : <nl> - ResultValueBase ( Type type ) : ResultBase ( type ) { } <nl> + ResultValueBase ( ResultType type ) : ResultBase ( type ) { } <nl> <nl> ResultValueBase ( ResultValueBase const & other ) : <nl> ResultBase ( other ) { <nl> - if ( m_type = = ResultBase : : Ok ) <nl> + if ( m_type = = ResultType : : Ok ) <nl> new ( & m_value ) T ( other . m_value ) ; <nl> } <nl> <nl> - ResultValueBase ( Type , T const & value ) : ResultBase ( Ok ) { <nl> + ResultValueBase ( ResultType , T const & value ) : ResultBase ( ResultType : : Ok ) { <nl> new ( & m_value ) T ( value ) ; <nl> } <nl> <nl> auto operator = ( ResultValueBase const & other ) <nl> - > ResultValueBase & { <nl> - if ( m_type = = ResultBase : : Ok ) <nl> + if ( m_type = = ResultType : : Ok ) <nl> m_value . ~ T ( ) ; <nl> ResultBase : : operator = ( other ) ; <nl> - if ( m_type = = ResultBase : : Ok ) <nl> + if ( m_type = = ResultType : : Ok ) <nl> new ( & m_value ) T ( other . m_value ) ; <nl> return * this ; <nl> } <nl> <nl> ~ ResultValueBase ( ) override { <nl> - if ( m_type = = Ok ) <nl> + if ( m_type = = ResultType : : Ok ) <nl> m_value . ~ T ( ) ; <nl> } <nl> <nl> namespace Catch { <nl> explicit BasicResult ( BasicResult < U > const & other ) : <nl> ResultValueBase < T > ( other . type ( ) ) , <nl> m_errorMessage ( other . errorMessage ( ) ) { <nl> - assert ( type ( ) ! = ResultBase : : Ok ) ; <nl> + assert ( type ( ) ! = ResultType : : Ok ) ; <nl> } <nl> <nl> template < typename U > <nl> static auto ok ( U const & value ) - > BasicResult { <nl> - return { ResultBase : : Ok , value } ; <nl> + return { ResultType : : Ok , value } ; <nl> } <nl> - static auto ok ( ) - > BasicResult { return { ResultBase : : Ok } ; } <nl> + static auto ok ( ) - > BasicResult { return { ResultType : : Ok } ; } <nl> static auto logicError ( std : : string const & message ) <nl> - > BasicResult { <nl> - return { ResultBase : : LogicError , message } ; <nl> + return { ResultType : : LogicError , message } ; <nl> } <nl> static auto runtimeError ( std : : string const & message ) <nl> - > BasicResult { <nl> - return { ResultBase : : RuntimeError , message } ; <nl> + return { ResultType : : RuntimeError , message } ; <nl> } <nl> <nl> explicit operator bool ( ) const { <nl> - return m_type = = ResultBase : : Ok ; <nl> + return m_type = = ResultType : : Ok ; <nl> } <nl> - auto type ( ) const - > ResultBase : : Type { return m_type ; } <nl> + auto type ( ) const - > ResultType { return m_type ; } <nl> auto errorMessage ( ) const - > std : : string { <nl> return m_errorMessage ; <nl> } <nl> namespace Catch { <nl> <nl> / / Errors shouldn ' t reach this point , but if they do <nl> / / the actual error message will be in m_errorMessage <nl> - assert ( m_type ! = ResultBase : : LogicError ) ; <nl> - assert ( m_type ! = ResultBase : : RuntimeError ) ; <nl> - if ( m_type ! = ResultBase : : Ok ) <nl> + assert ( m_type ! = ResultType : : LogicError ) ; <nl> + assert ( m_type ! = ResultType : : RuntimeError ) ; <nl> + if ( m_type ! = ResultType : : Ok ) <nl> std : : abort ( ) ; <nl> } <nl> <nl> std : : string <nl> m_errorMessage ; / / Only populated if resultType is an error <nl> <nl> - BasicResult ( ResultBase : : Type type , <nl> + BasicResult ( ResultType type , <nl> std : : string const & message ) : <nl> ResultValueBase < T > ( type ) , m_errorMessage ( message ) { <nl> - assert ( m_type ! = ResultBase : : Ok ) ; <nl> + assert ( m_type ! = ResultType : : Ok ) ; <nl> } <nl> <nl> using ResultValueBase < T > : : ResultValueBase ; <nl>
Turn Clara : : Detail : : ResultBase : : Type into its own enum class
catchorg/Catch2
7500ad1ffdbe2087522b44b7bbd01ec3859bcec0
2020-08-20T20:59:06Z
new file mode 100644 <nl> index 0000000000000 . . d52b24e01d659 <nl> mmm / dev / null <nl> ppp b / tensorflow / contrib / cmake / make . bat <nl> <nl> + % echo off <nl> + <nl> + cd / d % ~ dp0 <nl> + <nl> + if exist _build rd / s / q _build <nl> + <nl> + mkdir _build <nl> + chdir _build <nl> + <nl> + <nl> + rem cmake . . / - G " Visual Studio 15 Win64 " - DCMAKE_GENERATOR_TOOLSET = v141 , host = x64 - DCMAKE_INSTALL_PREFIX : PATH = . \ install <nl> + <nl> + CALL : NORMALIZEPATH " . . \ . . \ . . \ . . " <nl> + SET SOURCE_DIR = % RETVAL % <nl> + <nl> + echo % SOURCE_DIR % <nl> + <nl> + SET SOURCE_DIR = F : \ frameworks \ tensorflow \ <nl> + <nl> + CALL : NORMALIZEPATH " . . / . . / . . / tools / git / gen_git_source . py " <nl> + SET SOURCE_PYTHON_SCRIPT = % RETVAL % <nl> + <nl> + CALL : NORMALIZEPATH " . . / . . / . . / core / util / version_info . cc " <nl> + SET SOURCE_VERSION_CC = % RETVAL % <nl> + <nl> + python % SOURCE_PYTHON_SCRIPT % - - raw_generate % SOURCE_VERSION_CC % - - source_dir % SOURCE_DIR % - - git_tag_override = <nl> + <nl> + cmake . . / - G " Visual Studio 15 Win64 " - DCMAKE_GENERATOR_TOOLSET = v141 , host = x64 - DCMAKE_INSTALL_PREFIX : PATH = . \ install <nl> + <nl> + EXIT / B <nl> + <nl> + : NORMALIZEPATH <nl> + SET RETVAL = % ~ dpfn1 <nl> + EXIT / B <nl> + <nl> + <nl> + <nl> + <nl> \ No newline at end of file <nl> mmm a / tensorflow / contrib / cmake / tf_core_framework . cmake <nl> ppp b / tensorflow / contrib / cmake / tf_core_framework . cmake <nl> add_dependencies ( tf_core_lib $ { tensorflow_EXTERNAL_DEPENDENCIES } tf_protos_cc ) <nl> # force_rebuild always runs forcing $ { VERSION_INFO_CC } target to run <nl> # $ { VERSION_INFO_CC } would cache , but it depends on a phony never produced <nl> # target . <nl> - set ( VERSION_INFO_CC $ { tensorflow_source_dir } / tensorflow / core / util / version_info . cc ) <nl> - add_custom_target ( force_rebuild_target ALL DEPENDS $ { VERSION_INFO_CC } ) <nl> - add_custom_command ( OUTPUT __force_rebuild COMMAND $ { CMAKE_COMMAND } - E echo ) <nl> - add_custom_command ( OUTPUT <nl> - $ { VERSION_INFO_CC } <nl> - COMMAND $ { PYTHON_EXECUTABLE } $ { tensorflow_source_dir } / tensorflow / tools / git / gen_git_source . py <nl> - ARGS - - raw_generate $ { VERSION_INFO_CC } - - source_dir $ { tensorflow_source_dir } - - git_tag_override = $ { GIT_TAG_OVERRIDE } <nl> - DEPENDS __force_rebuild ) <nl> + # This code forces rebuild every time , not needed as version from git is fetched only once <nl> + # move to make . bat which mimicks make . sh <nl> + <nl> + if ( NOT WIN32 ) <nl> + <nl> + set ( VERSION_INFO_CC $ { tensorflow_source_dir } / tensorflow / core / util / version_info . cc ) <nl> + add_custom_target ( force_rebuild_target ALL DEPENDS $ { VERSION_INFO_CC } ) <nl> + add_custom_command ( OUTPUT __force_rebuild COMMAND $ { CMAKE_COMMAND } - E echo ) <nl> + add_custom_command ( OUTPUT <nl> + $ { VERSION_INFO_CC } <nl> + COMMAND $ { PYTHON_EXECUTABLE } $ { tensorflow_source_dir } / tensorflow / tools / git / gen_git_source . py <nl> + ARGS - - raw_generate $ { VERSION_INFO_CC } - - source_dir $ { tensorflow_source_dir } - - git_tag_override = $ { GIT_TAG_OVERRIDE } <nl> + DEPENDS __force_rebuild ) <nl> + endif ( ) <nl> + <nl> set ( tf_version_srcs $ { tensorflow_source_dir } / tensorflow / core / util / version_info . cc ) <nl> <nl> # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # <nl>
Merge pull request from kingofthebongo2008 : version_info_cc_generated_only_once
tensorflow/tensorflow
eb3e7423661c30b9239d3a29eb789ca6e9ef4793
2018-10-02T21:55:38Z
mmm a / lib / SIL / IR / SILDeclRef . cpp <nl> ppp b / lib / SIL / IR / SILDeclRef . cpp <nl> <nl> / / = = = mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - = = = / / <nl> <nl> # include " swift / SIL / SILDeclRef . h " <nl> - # include " swift / SIL / SILLocation . h " <nl> - # include " swift / AST / AnyFunctionRef . h " <nl> # include " swift / AST / ASTContext . h " <nl> # include " swift / AST / ASTMangler . h " <nl> + # include " swift / AST / AnyFunctionRef . h " <nl> # include " swift / AST / Initializer . h " <nl> # include " swift / AST / ParameterList . h " <nl> # include " swift / ClangImporter / ClangImporter . h " <nl> # include " swift / ClangImporter / ClangModule . h " <nl> # include " swift / SIL / SILLinkage . h " <nl> - # include " llvm / Support / Compiler . h " <nl> - # include " llvm / Support / raw_ostream . h " <nl> + # include " swift / SIL / SILLocation . h " <nl> # include " clang / AST / Attr . h " <nl> # include " clang / AST / Decl . h " <nl> + # include " clang / AST / DeclCXX . h " <nl> # include " clang / AST / DeclObjC . h " <nl> + # include " clang / AST / Mangle . h " <nl> + # include " llvm / Support / Compiler . h " <nl> + # include " llvm / Support / raw_ostream . h " <nl> using namespace swift ; <nl> <nl> / / / Get the method dispatch mechanism for a method . <nl>
Merge remote - tracking branch ' origin / master ' into master - rebranch
apple/swift
b0b8ad703d7935e2f03898f15e1a753ecd9a708b
2020-07-21T21:24:06Z
mmm a / lib / Sema / CSDiagnostics . cpp <nl> ppp b / lib / Sema / CSDiagnostics . cpp <nl> bool InaccessibleMemberFailure : : diagnoseAsError ( ) { <nl> auto & cs = getConstraintSystem ( ) ; <nl> auto * locator = <nl> cs . getConstraintLocator ( baseExpr , ConstraintLocator : : Member ) ; <nl> - if ( llvm : : any_of ( cs . getFixes ( ) , [ & ] ( const ConstraintFix * fix ) { <nl> - return fix - > getLocator ( ) = = locator ; <nl> - } ) ) <nl> + if ( cs . hasFixFor ( locator ) ) <nl> return false ; <nl> } <nl> <nl> mmm a / lib / Sema / CSDiagnostics . h <nl> ppp b / lib / Sema / CSDiagnostics . h <nl> class ContextualFailure : public FailureDiagnostic { <nl> / / / Diagnose failed conversion in a ` CoerceExpr ` . <nl> bool diagnoseCoercionToUnrelatedType ( ) const ; <nl> <nl> - / / If we ' re trying to convert something of type " ( ) - > T " to T , <nl> - / / then we probably meant to call the value . <nl> + / / / If we ' re trying to convert something of type " ( ) - > T " to T , <nl> + / / / then we probably meant to call the value . <nl> bool diagnoseMissingFunctionCall ( ) const ; <nl> <nl> / / / Produce a specialized diagnostic if this is an invalid conversion to Bool . <nl> class MutatingMemberRefOnImmutableBase final : public FailureDiagnostic { <nl> bool diagnoseAsError ( ) override ; <nl> } ; <nl> <nl> - / / Diagnose an attempt to use AnyObject as the root type of a KeyPath <nl> - / / <nl> - / / ` ` ` swift <nl> - / / let keyPath = \ AnyObject . bar <nl> - / / ` ` ` <nl> + / / / Diagnose an attempt to use AnyObject as the root type of a KeyPath <nl> + / / / <nl> + / / / ` ` ` swift <nl> + / / / let keyPath = \ AnyObject . bar <nl> + / / / ` ` ` <nl> class AnyObjectKeyPathRootFailure final : public FailureDiagnostic { <nl> <nl> public : <nl>
[ NFC ] Fixing minor comments that should be docs and minor call
apple/swift
fb12c09188b1f511786f955405852e5ad778f260
2020-01-21T00:35:22Z
mmm a / tensorflow / core / grappler / optimizers / BUILD <nl> ppp b / tensorflow / core / grappler / optimizers / BUILD <nl> cc_library ( <nl> " / / tensorflow / core : lib " , <nl> " / / tensorflow / core : protos_all_cc " , <nl> " / / tensorflow / core / grappler : grappler_item " , <nl> + " / / tensorflow / core / grappler : op_types " , <nl> " / / tensorflow / core / grappler : utils " , <nl> " / / tensorflow / core / grappler / clusters : cluster " , <nl> + " / / tensorflow / core / grappler / costs : graph_properties " , <nl> ] , <nl> ) <nl> <nl> mmm a / tensorflow / core / grappler / optimizers / constant_folding . cc <nl> ppp b / tensorflow / core / grappler / optimizers / constant_folding . cc <nl> limitations under the License . <nl> # include " tensorflow / core / framework / tensor_shape . pb . h " <nl> # include " tensorflow / core / framework / types . h " <nl> # include " tensorflow / core / grappler / clusters / cluster . h " <nl> + # include " tensorflow / core / grappler / costs / graph_properties . h " <nl> # include " tensorflow / core / grappler / grappler_item . h " <nl> + # include " tensorflow / core / grappler / op_types . h " <nl> # include " tensorflow / core / lib / gtl / inlined_vector . h " <nl> # include " tensorflow / core / lib / strings / numbers . h " <nl> # include " tensorflow / core / lib / strings / strcat . h " <nl> Status NumOutputs ( const NodeDef & node , int * num_outputs ) { <nl> } <nl> } / / namespace <nl> <nl> - bool ConstantFolding : : IsConst ( const NodeDef & node ) const { <nl> - return node . op ( ) = = " Const " ; <nl> + Status ConstantFolding : : MaterializeShapes ( const GrapplerItem & item ) { <nl> + GraphProperties properties ( item ) ; <nl> + TF_RETURN_IF_ERROR ( properties . InferStatically ( ) ) ; <nl> + for ( NodeDef & node : * graph_ . mutable_node ( ) ) { <nl> + const string op = node . op ( ) ; <nl> + if ( op ! = " Shape " & & op ! = " Size " & & op ! = " Rank " ) { <nl> + continue ; <nl> + } <nl> + std : : vector < OpInfo : : TensorProperties > output = <nl> + properties . GetOutputProperties ( node . name ( ) ) ; <nl> + CHECK_EQ ( 1 , output . size ( ) ) ; <nl> + const DataType type = output [ 0 ] . dtype ( ) ; <nl> + CHECK ( type = = DT_INT32 | | type = = DT_INT64 ) ; <nl> + <nl> + std : : vector < OpInfo : : TensorProperties > input = <nl> + properties . GetInputProperties ( node . name ( ) ) ; <nl> + CHECK_EQ ( 1 , input . size ( ) ) ; <nl> + const TensorShapeProto shape = input [ 0 ] . shape ( ) ; <nl> + <nl> + / / Materialize the shapes using constants whenever possible . <nl> + TensorShape shp ( shape ) ; <nl> + if ( shp . IsFullyDefined ( ) | | ( ! shp . unknown_rank ( ) & & op = = " Rank " ) ) { <nl> + bool valid = true ; <nl> + Tensor value ( type ) ; <nl> + if ( op = = " Shape " ) { <nl> + value = Tensor ( type , TensorShape ( { shp . dims ( ) } ) ) ; <nl> + for ( int i = 0 ; i < shp . dims ( ) ; + + i ) { <nl> + if ( type = = DT_INT32 ) { <nl> + if ( shp . dim_size ( i ) > = INT_MAX ) { <nl> + valid = false ; <nl> + break ; <nl> + } <nl> + value . flat < int32 > ( ) ( i ) = shp . dim_size ( i ) ; <nl> + } else { <nl> + value . flat < int64 > ( ) ( i ) = shp . dim_size ( i ) ; <nl> + } <nl> + } <nl> + } else if ( op = = " Size " ) { <nl> + int64 size = 1 ; <nl> + for ( int i = 0 ; i < shp . dims ( ) ; + + i ) { <nl> + size * = shp . dim_size ( i ) ; <nl> + } <nl> + value = Tensor ( type , TensorShape ( { } ) ) ; <nl> + if ( type = = DT_INT32 ) { <nl> + if ( size > = INT_MAX ) { <nl> + valid = false ; <nl> + } else { <nl> + value . flat < int32 > ( ) ( 0 ) = size ; <nl> + } <nl> + } else { <nl> + value . flat < int64 > ( ) ( 0 ) = size ; <nl> + } <nl> + } else { <nl> + value = Tensor ( type , TensorShape ( { } ) ) ; <nl> + if ( type = = DT_INT32 ) { <nl> + if ( shp . dims ( ) > = INT_MAX ) { <nl> + valid = false ; <nl> + } else { <nl> + value . flat < int32 > ( ) ( 0 ) = shp . dims ( ) ; <nl> + } <nl> + } else { <nl> + value . flat < int64 > ( ) ( 0 ) = shp . dims ( ) ; <nl> + } <nl> + } <nl> + <nl> + if ( valid ) { <nl> + / / Replace the node with the corresponding constant . <nl> + node . set_op ( " Const " ) ; <nl> + node . clear_attr ( ) ; <nl> + ( * node . mutable_attr ( ) ) [ " dtype " ] . set_type ( type ) ; <nl> + value . AsProtoTensorContent ( <nl> + ( * node . mutable_attr ( ) ) [ " value " ] . mutable_tensor ( ) ) ; <nl> + <nl> + / / Turn the inputs into control dependencies . <nl> + CHECK_EQ ( 1 , node . input_size ( ) ) ; <nl> + node . set_input ( 0 , strings : : StrCat ( " ^ " , node . input ( 0 ) ) ) ; <nl> + } <nl> + } <nl> + } <nl> + return Status : : OK ( ) ; <nl> } <nl> <nl> bool ConstantFolding : : IsFoldable ( const NodeDef & node ) const { <nl> bool ConstantFolding : : IsFoldable ( const NodeDef & node ) const { <nl> if ( input [ 0 ] = = ' ^ ' ) { <nl> continue ; <nl> } <nl> - bool is_const = IsConst ( * node_map_ - > GetNode ( input ) ) ; <nl> + bool is_const = IsConstant ( * node_map_ - > GetNode ( input ) ) ; <nl> if ( ! is_const ) { <nl> return false ; <nl> } <nl> Status ConstantFolding : : Optimize ( Cluster * cluster , const GrapplerItem & item , <nl> } <nl> device_ . reset ( new DeviceSimple ( ) ) ; <nl> * output = GraphDef ( ) ; <nl> + TF_RETURN_IF_ERROR ( MaterializeShapes ( item ) ) ; <nl> TF_RETURN_IF_ERROR ( FoldGraph ( output ) ) ; <nl> LOG ( INFO ) < < " Optimized graph size : " < < output - > node_size ( ) ; <nl> return Status : : OK ( ) ; <nl> mmm a / tensorflow / core / grappler / optimizers / constant_folding . h <nl> ppp b / tensorflow / core / grappler / optimizers / constant_folding . h <nl> class ConstantFolding : public GraphOptimizer { <nl> const GraphDef & optimize_output , double result ) override ; <nl> <nl> private : <nl> - bool IsConst ( const NodeDef & node ) const ; <nl> + Status MaterializeShapes ( const GrapplerItem & item ) ; <nl> <nl> bool IsFoldable ( const NodeDef & node ) const ; <nl> <nl> mmm a / tensorflow / core / grappler / optimizers / constant_folding_test . cc <nl> ppp b / tensorflow / core / grappler / optimizers / constant_folding_test . cc <nl> TEST_F ( ConstantFoldingTest , ControlDependencies ) { <nl> EXPECT_EQ ( 2 , found ) ; <nl> } <nl> <nl> + TEST_F ( ConstantFoldingTest , ShapeMaterialization ) { <nl> + tensorflow : : Scope scope = tensorflow : : Scope : : NewRootScope ( ) ; <nl> + Output v1 = ops : : Variable ( scope . WithOpName ( " v1 " ) , { 3 } , DT_FLOAT ) ; <nl> + Output v2 = ops : : Variable ( scope . WithOpName ( " v2 " ) , { 5 , 7 } , DT_FLOAT ) ; <nl> + Output v3 = ops : : Variable ( scope . WithOpName ( " v3 " ) , { 11 , 13 } , DT_FLOAT ) ; <nl> + Output rank = ops : : Rank ( scope . WithOpName ( " rank " ) , v1 ) ; <nl> + Output shape = ops : : Shape ( scope . WithOpName ( " shape " ) , v2 ) ; <nl> + Output size = ops : : Size ( scope . WithOpName ( " size " ) , v3 ) ; <nl> + Output p1 = ops : : Multiply ( scope . WithOpName ( " p1 " ) , size , rank ) ; <nl> + Output p2 = ops : : Multiply ( scope . WithOpName ( " p2 " ) , p1 , shape ) ; <nl> + <nl> + GrapplerItem item ; <nl> + item . fetch . push_back ( " p2 " ) ; <nl> + TF_CHECK_OK ( scope . ToGraphDef ( & item . graph ) ) ; <nl> + <nl> + ConstantFolding fold ; <nl> + GraphDef output ; <nl> + Status status = fold . Optimize ( nullptr , item , & output ) ; <nl> + TF_EXPECT_OK ( status ) ; <nl> + <nl> + int found = 0 ; <nl> + for ( const auto & node : output . node ( ) ) { <nl> + if ( node . name ( ) = = " size " ) { <nl> + + + found ; <nl> + EXPECT_EQ ( " Const " , node . op ( ) ) ; <nl> + EXPECT_EQ ( 1 , node . input_size ( ) ) ; <nl> + EXPECT_EQ ( " ^ v3 " , node . input ( 0 ) ) ; <nl> + Tensor value ; <nl> + CHECK ( value . FromProto ( node . attr ( ) . at ( " value " ) . tensor ( ) ) ) ; <nl> + EXPECT_EQ ( 11 * 13 , value . flat < int > ( ) ( 0 ) ) ; <nl> + } else if ( node . name ( ) = = " rank " ) { <nl> + + + found ; <nl> + EXPECT_EQ ( " Const " , node . op ( ) ) ; <nl> + EXPECT_EQ ( 1 , node . input_size ( ) ) ; <nl> + EXPECT_EQ ( " ^ v1 " , node . input ( 0 ) ) ; <nl> + Tensor value ; <nl> + CHECK ( value . FromProto ( node . attr ( ) . at ( " value " ) . tensor ( ) ) ) ; <nl> + EXPECT_EQ ( 1 , value . flat < int > ( ) ( 0 ) ) ; <nl> + } else if ( node . name ( ) = = " shape " ) { <nl> + + + found ; <nl> + EXPECT_EQ ( " Const " , node . op ( ) ) ; <nl> + EXPECT_EQ ( 1 , node . input_size ( ) ) ; <nl> + EXPECT_EQ ( " ^ v2 " , node . input ( 0 ) ) ; <nl> + Tensor value ; <nl> + CHECK ( value . FromProto ( node . attr ( ) . at ( " value " ) . tensor ( ) ) ) ; <nl> + EXPECT_EQ ( 5 , value . flat < int > ( ) ( 0 ) ) ; <nl> + EXPECT_EQ ( 7 , value . flat < int > ( ) ( 1 ) ) ; <nl> + } <nl> + } <nl> + EXPECT_EQ ( 3 , found ) ; <nl> + } <nl> + <nl> } / / namespace <nl> } / / namespace grappler <nl> } / / namespace tensorflow <nl>
Materialize shapes that are known at graph construction time into constants
tensorflow/tensorflow
e8d17ea8c187e5a7a4d525fe0db5899875d9559d
2017-05-31T19:44:43Z
mmm a / src / yuzu / configuration / config . cpp <nl> ppp b / src / yuzu / configuration / config . cpp <nl> const std : : array < int , Settings : : NativeKeyboard : : NumKeyboardMods > Config : : default <nl> <nl> void Config : : ReadPlayerValues ( ) { <nl> for ( std : : size_t p = 0 ; p < Settings : : values . players . size ( ) ; + + p ) { <nl> - Settings : : values . players [ p ] . connected = <nl> - qt_config - > value ( QString ( " player_ % 1_connected " ) . arg ( p ) , false ) . toBool ( ) ; <nl> + auto & player = Settings : : values . players [ p ] ; <nl> <nl> - Settings : : values . players [ p ] . type = static_cast < Settings : : ControllerType > ( <nl> + player . connected = qt_config - > value ( QString ( " player_ % 1_connected " ) . arg ( p ) , false ) . toBool ( ) ; <nl> + <nl> + player . type = static_cast < Settings : : ControllerType > ( <nl> qt_config <nl> - > value ( QString ( " player_ % 1_type " ) . arg ( p ) , <nl> static_cast < u8 > ( Settings : : ControllerType : : DualJoycon ) ) <nl> . toUInt ( ) ) ; <nl> <nl> - Settings : : values . players [ p ] . body_color_left = <nl> - qt_config <nl> - - > value ( QString ( " player_ % 1_body_color_left " ) . arg ( p ) , <nl> - Settings : : JOYCON_BODY_NEON_BLUE ) <nl> - . toUInt ( ) ; <nl> - Settings : : values . players [ p ] . body_color_right = <nl> - qt_config <nl> - - > value ( QString ( " player_ % 1_body_color_right " ) . arg ( p ) , <nl> - Settings : : JOYCON_BODY_NEON_RED ) <nl> - . toUInt ( ) ; <nl> - Settings : : values . players [ p ] . button_color_left = <nl> - qt_config <nl> - - > value ( QString ( " player_ % 1_button_color_left " ) . arg ( p ) , <nl> - Settings : : JOYCON_BUTTONS_NEON_BLUE ) <nl> - . toUInt ( ) ; <nl> - Settings : : values . players [ p ] . button_color_right = <nl> - qt_config <nl> - - > value ( QString ( " player_ % 1_button_color_right " ) . arg ( p ) , <nl> - Settings : : JOYCON_BUTTONS_NEON_RED ) <nl> - . toUInt ( ) ; <nl> + player . body_color_left = qt_config <nl> + - > value ( QString ( " player_ % 1_body_color_left " ) . arg ( p ) , <nl> + Settings : : JOYCON_BODY_NEON_BLUE ) <nl> + . toUInt ( ) ; <nl> + player . body_color_right = qt_config <nl> + - > value ( QString ( " player_ % 1_body_color_right " ) . arg ( p ) , <nl> + Settings : : JOYCON_BODY_NEON_RED ) <nl> + . toUInt ( ) ; <nl> + player . button_color_left = qt_config <nl> + - > value ( QString ( " player_ % 1_button_color_left " ) . arg ( p ) , <nl> + Settings : : JOYCON_BUTTONS_NEON_BLUE ) <nl> + . toUInt ( ) ; <nl> + player . button_color_right = qt_config <nl> + - > value ( QString ( " player_ % 1_button_color_right " ) . arg ( p ) , <nl> + Settings : : JOYCON_BUTTONS_NEON_RED ) <nl> + . toUInt ( ) ; <nl> <nl> for ( int i = 0 ; i < Settings : : NativeButton : : NumButtons ; + + i ) { <nl> std : : string default_param = InputCommon : : GenerateKeyboardParam ( default_buttons [ i ] ) ; <nl> - Settings : : values . players [ p ] . buttons [ i ] = <nl> + player . buttons [ i ] = <nl> qt_config <nl> - > value ( QString ( " player_ % 1_ " ) . arg ( p ) + Settings : : NativeButton : : mapping [ i ] , <nl> QString : : fromStdString ( default_param ) ) <nl> . toString ( ) <nl> . toStdString ( ) ; <nl> - if ( Settings : : values . players [ p ] . buttons [ i ] . empty ( ) ) <nl> - Settings : : values . players [ p ] . buttons [ i ] = default_param ; <nl> + if ( player . buttons [ i ] . empty ( ) ) <nl> + player . buttons [ i ] = default_param ; <nl> } <nl> <nl> for ( int i = 0 ; i < Settings : : NativeAnalog : : NumAnalogs ; + + i ) { <nl> std : : string default_param = InputCommon : : GenerateAnalogParamFromKeys ( <nl> default_analogs [ i ] [ 0 ] , default_analogs [ i ] [ 1 ] , default_analogs [ i ] [ 2 ] , <nl> default_analogs [ i ] [ 3 ] , default_analogs [ i ] [ 4 ] , 0 . 5f ) ; <nl> - Settings : : values . players [ p ] . analogs [ i ] = <nl> + player . analogs [ i ] = <nl> qt_config <nl> - > value ( QString ( " player_ % 1_ " ) . arg ( p ) + Settings : : NativeAnalog : : mapping [ i ] , <nl> QString : : fromStdString ( default_param ) ) <nl> . toString ( ) <nl> . toStdString ( ) ; <nl> - if ( Settings : : values . players [ p ] . analogs [ i ] . empty ( ) ) <nl> - Settings : : values . players [ p ] . analogs [ i ] = default_param ; <nl> + if ( player . analogs [ i ] . empty ( ) ) <nl> + player . analogs [ i ] = default_param ; <nl> } <nl> } <nl> <nl> void Config : : ReadValues ( ) { <nl> } <nl> <nl> void Config : : SavePlayerValues ( ) { <nl> - for ( int p = 0 ; p < Settings : : values . players . size ( ) ; + + p ) { <nl> - qt_config - > setValue ( QString ( " player_ % 1_connected " ) . arg ( p ) , <nl> - Settings : : values . players [ p ] . connected ) ; <nl> - qt_config - > setValue ( QString ( " player_ % 1_type " ) . arg ( p ) , <nl> - static_cast < u8 > ( Settings : : values . players [ p ] . type ) ) ; <nl> - <nl> - qt_config - > setValue ( QString ( " player_ % 1_body_color_left " ) . arg ( p ) , <nl> - Settings : : values . players [ p ] . body_color_left ) ; <nl> - qt_config - > setValue ( QString ( " player_ % 1_body_color_right " ) . arg ( p ) , <nl> - Settings : : values . players [ p ] . body_color_right ) ; <nl> + for ( std : : size_t p = 0 ; p < Settings : : values . players . size ( ) ; + + p ) { <nl> + const auto & player = Settings : : values . players [ p ] ; <nl> + <nl> + qt_config - > setValue ( QString ( " player_ % 1_connected " ) . arg ( p ) , player . connected ) ; <nl> + qt_config - > setValue ( QString ( " player_ % 1_type " ) . arg ( p ) , static_cast < u8 > ( player . type ) ) ; <nl> + <nl> + qt_config - > setValue ( QString ( " player_ % 1_body_color_left " ) . arg ( p ) , player . body_color_left ) ; <nl> + qt_config - > setValue ( QString ( " player_ % 1_body_color_right " ) . arg ( p ) , player . body_color_right ) ; <nl> qt_config - > setValue ( QString ( " player_ % 1_button_color_left " ) . arg ( p ) , <nl> - Settings : : values . players [ p ] . button_color_left ) ; <nl> + player . button_color_left ) ; <nl> qt_config - > setValue ( QString ( " player_ % 1_button_color_right " ) . arg ( p ) , <nl> - Settings : : values . players [ p ] . button_color_right ) ; <nl> + player . button_color_right ) ; <nl> <nl> for ( int i = 0 ; i < Settings : : NativeButton : : NumButtons ; + + i ) { <nl> qt_config - > setValue ( QString ( " player_ % 1_ " ) . arg ( p ) + <nl> QString : : fromStdString ( Settings : : NativeButton : : mapping [ i ] ) , <nl> - QString : : fromStdString ( Settings : : values . players [ p ] . buttons [ i ] ) ) ; <nl> + QString : : fromStdString ( player . buttons [ i ] ) ) ; <nl> } <nl> for ( int i = 0 ; i < Settings : : NativeAnalog : : NumAnalogs ; + + i ) { <nl> qt_config - > setValue ( QString ( " player_ % 1_ " ) . arg ( p ) + <nl> QString : : fromStdString ( Settings : : NativeAnalog : : mapping [ i ] ) , <nl> - QString : : fromStdString ( Settings : : values . players [ p ] . analogs [ i ] ) ) ; <nl> + QString : : fromStdString ( player . analogs [ i ] ) ) ; <nl> } <nl> } <nl> } <nl>
configuration / config : Use an intermediary variable for accessing players
yuzu-emu/yuzu
e90fa1ac54cd7ffdec78a16b2ccaa5a078f3cfc4
2018-12-05T08:41:33Z
mmm a / . circleci / config . yml <nl> ppp b / . circleci / config . yml <nl> <nl> # IMPORTANT : To update Docker image version , please search and update " : { previous_version } " <nl> # in this file to the new version number , and * * ALSO * * update the version number below : <nl> - # PyTorchDockerVersion : 278 <nl> + # PyTorchDockerVersion : 282 <nl> # Caffe2DockerVersion : 238 <nl> <nl> docker_config_defaults : & docker_config_defaults <nl> jobs : <nl> pytorch_linux_trusty_py2_7_9_build : <nl> environment : <nl> JOB_BASE_NAME : pytorch - linux - trusty - py2 . 7 . 9 - build <nl> - DOCKER_IMAGE : " 308535385114 . dkr . ecr . us - east - 1 . amazonaws . com / pytorch / pytorch - linux - trusty - py2 . 7 . 9 : 278 " <nl> + DOCKER_IMAGE : " 308535385114 . dkr . ecr . us - east - 1 . amazonaws . com / pytorch / pytorch - linux - trusty - py2 . 7 . 9 : 282 " <nl> < < : * pytorch_linux_build_defaults <nl> <nl> pytorch_linux_trusty_py2_7_9_test : <nl> environment : <nl> JOB_BASE_NAME : pytorch - linux - trusty - py2 . 7 . 9 - test <nl> - DOCKER_IMAGE : " 308535385114 . dkr . ecr . us - east - 1 . amazonaws . com / pytorch / pytorch - linux - trusty - py2 . 7 . 9 : 278 " <nl> + DOCKER_IMAGE : " 308535385114 . dkr . ecr . us - east - 1 . amazonaws . com / pytorch / pytorch - linux - trusty - py2 . 7 . 9 : 282 " <nl> resource_class : large <nl> < < : * pytorch_linux_test_defaults <nl> <nl> pytorch_linux_trusty_py2_7_build : <nl> environment : <nl> JOB_BASE_NAME : pytorch - linux - trusty - py2 . 7 - build <nl> - DOCKER_IMAGE : " 308535385114 . dkr . ecr . us - east - 1 . amazonaws . com / pytorch / pytorch - linux - trusty - py2 . 7 : 278 " <nl> + DOCKER_IMAGE : " 308535385114 . dkr . ecr . us - east - 1 . amazonaws . com / pytorch / pytorch - linux - trusty - py2 . 7 : 282 " <nl> < < : * pytorch_linux_build_defaults <nl> <nl> pytorch_linux_trusty_py2_7_test : <nl> environment : <nl> JOB_BASE_NAME : pytorch - linux - trusty - py2 . 7 - test <nl> - DOCKER_IMAGE : " 308535385114 . dkr . ecr . us - east - 1 . amazonaws . com / pytorch / pytorch - linux - trusty - py2 . 7 : 278 " <nl> + DOCKER_IMAGE : " 308535385114 . dkr . ecr . us - east - 1 . amazonaws . com / pytorch / pytorch - linux - trusty - py2 . 7 : 282 " <nl> resource_class : large <nl> < < : * pytorch_linux_test_defaults <nl> <nl> pytorch_linux_trusty_py3_5_build : <nl> environment : <nl> JOB_BASE_NAME : pytorch - linux - trusty - py3 . 5 - build <nl> - DOCKER_IMAGE : " 308535385114 . dkr . ecr . us - east - 1 . amazonaws . com / pytorch / pytorch - linux - trusty - py3 . 5 : 278 " <nl> + DOCKER_IMAGE : " 308535385114 . dkr . ecr . us - east - 1 . amazonaws . com / pytorch / pytorch - linux - trusty - py3 . 5 : 282 " <nl> < < : * pytorch_linux_build_defaults <nl> <nl> pytorch_linux_trusty_py3_5_test : <nl> environment : <nl> JOB_BASE_NAME : pytorch - linux - trusty - py3 . 5 - test <nl> - DOCKER_IMAGE : " 308535385114 . dkr . ecr . us - east - 1 . amazonaws . com / pytorch / pytorch - linux - trusty - py3 . 5 : 278 " <nl> + DOCKER_IMAGE : " 308535385114 . dkr . ecr . us - east - 1 . amazonaws . com / pytorch / pytorch - linux - trusty - py3 . 5 : 282 " <nl> resource_class : large <nl> < < : * pytorch_linux_test_defaults <nl> <nl> pytorch_linux_trusty_py3_6_gcc4_8_build : <nl> environment : <nl> JOB_BASE_NAME : pytorch - linux - trusty - py3 . 6 - gcc4 . 8 - build <nl> - DOCKER_IMAGE : " 308535385114 . dkr . ecr . us - east - 1 . amazonaws . com / pytorch / pytorch - linux - trusty - py3 . 6 - gcc4 . 8 : 278 " <nl> + DOCKER_IMAGE : " 308535385114 . dkr . ecr . us - east - 1 . amazonaws . com / pytorch / pytorch - linux - trusty - py3 . 6 - gcc4 . 8 : 282 " <nl> < < : * pytorch_linux_build_defaults <nl> <nl> pytorch_linux_trusty_py3_6_gcc4_8_test : <nl> environment : <nl> JOB_BASE_NAME : pytorch - linux - trusty - py3 . 6 - gcc4 . 8 - test <nl> - DOCKER_IMAGE : " 308535385114 . dkr . ecr . us - east - 1 . amazonaws . com / pytorch / pytorch - linux - trusty - py3 . 6 - gcc4 . 8 : 278 " <nl> + DOCKER_IMAGE : " 308535385114 . dkr . ecr . us - east - 1 . amazonaws . com / pytorch / pytorch - linux - trusty - py3 . 6 - gcc4 . 8 : 282 " <nl> resource_class : large <nl> < < : * pytorch_linux_test_defaults <nl> <nl> pytorch_linux_trusty_py3_6_gcc5_4_build : <nl> environment : <nl> JOB_BASE_NAME : pytorch - linux - trusty - py3 . 6 - gcc5 . 4 - build <nl> - DOCKER_IMAGE : " 308535385114 . dkr . ecr . us - east - 1 . amazonaws . com / pytorch / pytorch - linux - trusty - py3 . 6 - gcc5 . 4 : 278 " <nl> + DOCKER_IMAGE : " 308535385114 . dkr . ecr . us - east - 1 . amazonaws . com / pytorch / pytorch - linux - trusty - py3 . 6 - gcc5 . 4 : 282 " <nl> < < : * pytorch_linux_build_defaults <nl> <nl> pytorch_linux_trusty_py3_6_gcc5_4_test : <nl> environment : <nl> JOB_BASE_NAME : pytorch - linux - trusty - py3 . 6 - gcc5 . 4 - test <nl> - DOCKER_IMAGE : " 308535385114 . dkr . ecr . us - east - 1 . amazonaws . com / pytorch / pytorch - linux - trusty - py3 . 6 - gcc5 . 4 : 278 " <nl> + DOCKER_IMAGE : " 308535385114 . dkr . ecr . us - east - 1 . amazonaws . com / pytorch / pytorch - linux - trusty - py3 . 6 - gcc5 . 4 : 282 " <nl> resource_class : large <nl> < < : * pytorch_linux_test_defaults <nl> <nl> pytorch_linux_trusty_py3_6_gcc7_build : <nl> environment : <nl> JOB_BASE_NAME : pytorch - linux - trusty - py3 . 6 - gcc7 - build <nl> - DOCKER_IMAGE : " 308535385114 . dkr . ecr . us - east - 1 . amazonaws . com / pytorch / pytorch - linux - trusty - py3 . 6 - gcc7 : 278 " <nl> + DOCKER_IMAGE : " 308535385114 . dkr . ecr . us - east - 1 . amazonaws . com / pytorch / pytorch - linux - trusty - py3 . 6 - gcc7 : 282 " <nl> < < : * pytorch_linux_build_defaults <nl> <nl> pytorch_linux_trusty_py3_6_gcc7_test : <nl> environment : <nl> JOB_BASE_NAME : pytorch - linux - trusty - py3 . 6 - gcc7 - test <nl> - DOCKER_IMAGE : " 308535385114 . dkr . ecr . us - east - 1 . amazonaws . com / pytorch / pytorch - linux - trusty - py3 . 6 - gcc7 : 278 " <nl> + DOCKER_IMAGE : " 308535385114 . dkr . ecr . us - east - 1 . amazonaws . com / pytorch / pytorch - linux - trusty - py3 . 6 - gcc7 : 282 " <nl> resource_class : large <nl> < < : * pytorch_linux_test_defaults <nl> <nl> pytorch_linux_trusty_pynightly_build : <nl> environment : <nl> JOB_BASE_NAME : pytorch - linux - trusty - pynightly - build <nl> - DOCKER_IMAGE : " 308535385114 . dkr . ecr . us - east - 1 . amazonaws . com / pytorch / pytorch - linux - trusty - pynightly : 278 " <nl> + DOCKER_IMAGE : " 308535385114 . dkr . ecr . us - east - 1 . amazonaws . com / pytorch / pytorch - linux - trusty - pynightly : 282 " <nl> < < : * pytorch_linux_build_defaults <nl> <nl> pytorch_linux_trusty_pynightly_test : <nl> environment : <nl> JOB_BASE_NAME : pytorch - linux - trusty - pynightly - test <nl> - DOCKER_IMAGE : " 308535385114 . dkr . ecr . us - east - 1 . amazonaws . com / pytorch / pytorch - linux - trusty - pynightly : 278 " <nl> + DOCKER_IMAGE : " 308535385114 . dkr . ecr . us - east - 1 . amazonaws . com / pytorch / pytorch - linux - trusty - pynightly : 282 " <nl> resource_class : large <nl> < < : * pytorch_linux_test_defaults <nl> <nl> pytorch_linux_xenial_py3_clang5_asan_build : <nl> environment : <nl> JOB_BASE_NAME : pytorch - linux - xenial - py3 - clang5 - asan - build <nl> - DOCKER_IMAGE : " 308535385114 . dkr . ecr . us - east - 1 . amazonaws . com / pytorch / pytorch - linux - xenial - py3 - clang5 - asan : 278 " <nl> + DOCKER_IMAGE : " 308535385114 . dkr . ecr . us - east - 1 . amazonaws . com / pytorch / pytorch - linux - xenial - py3 - clang5 - asan : 282 " <nl> PYTHON_VERSION : " 3 . 6 " <nl> < < : * pytorch_linux_build_defaults <nl> <nl> pytorch_linux_xenial_py3_clang5_asan_test : <nl> environment : <nl> JOB_BASE_NAME : pytorch - linux - xenial - py3 - clang5 - asan - test <nl> - DOCKER_IMAGE : " 308535385114 . dkr . ecr . us - east - 1 . amazonaws . com / pytorch / pytorch - linux - xenial - py3 - clang5 - asan : 278 " <nl> + DOCKER_IMAGE : " 308535385114 . dkr . ecr . us - east - 1 . amazonaws . com / pytorch / pytorch - linux - xenial - py3 - clang5 - asan : 282 " <nl> PYTHON_VERSION : " 3 . 6 " <nl> resource_class : large <nl> < < : * pytorch_linux_test_defaults <nl> <nl> - pytorch_linux_xenial_cuda8_cudnn6_py3_build : <nl> + pytorch_linux_xenial_cuda8_cudnn7_py3_build : <nl> environment : <nl> - JOB_BASE_NAME : pytorch - linux - xenial - cuda8 - cudnn6 - py3 - build <nl> - DOCKER_IMAGE : " 308535385114 . dkr . ecr . us - east - 1 . amazonaws . com / pytorch / pytorch - linux - xenial - cuda8 - cudnn6 - py3 : 278 " <nl> + JOB_BASE_NAME : pytorch - linux - xenial - cuda8 - cudnn7 - py3 - build <nl> + DOCKER_IMAGE : " 308535385114 . dkr . ecr . us - east - 1 . amazonaws . com / pytorch / pytorch - linux - xenial - cuda8 - cudnn7 - py3 : 282 " <nl> PYTHON_VERSION : " 3 . 6 " <nl> CUDA_VERSION : " 8 " <nl> + BUILD_ENVIRONMENT : " pytorch - linux - xenial - cuda8 - cudnn7 - py3 " <nl> < < : * pytorch_linux_build_defaults <nl> <nl> - pytorch_linux_xenial_cuda8_cudnn6_py3_test : <nl> + pytorch_linux_xenial_cuda8_cudnn7_py3_test : <nl> environment : <nl> - JOB_BASE_NAME : pytorch - linux - xenial - cuda8 - cudnn6 - py3 - test <nl> - DOCKER_IMAGE : " 308535385114 . dkr . ecr . us - east - 1 . amazonaws . com / pytorch / pytorch - linux - xenial - cuda8 - cudnn6 - py3 : 278 " <nl> + JOB_BASE_NAME : pytorch - linux - xenial - cuda8 - cudnn7 - py3 - test <nl> + DOCKER_IMAGE : " 308535385114 . dkr . ecr . us - east - 1 . amazonaws . com / pytorch / pytorch - linux - xenial - cuda8 - cudnn7 - py3 : 282 " <nl> PYTHON_VERSION : " 3 . 6 " <nl> CUDA_VERSION : " 8 " <nl> resource_class : gpu . medium <nl> < < : * pytorch_linux_test_defaults <nl> <nl> - pytorch_linux_xenial_cuda8_cudnn6_py3_multigpu_test : <nl> + pytorch_linux_xenial_cuda8_cudnn7_py3_multigpu_test : <nl> environment : <nl> - JOB_BASE_NAME : pytorch - linux - xenial - cuda8 - cudnn6 - py3 - multigpu - test <nl> - DOCKER_IMAGE : " 308535385114 . dkr . ecr . us - east - 1 . amazonaws . com / pytorch / pytorch - linux - xenial - cuda8 - cudnn6 - py3 : 278 " <nl> + JOB_BASE_NAME : pytorch - linux - xenial - cuda8 - cudnn7 - py3 - multigpu - test <nl> + DOCKER_IMAGE : " 308535385114 . dkr . ecr . us - east - 1 . amazonaws . com / pytorch / pytorch - linux - xenial - cuda8 - cudnn7 - py3 : 282 " <nl> PYTHON_VERSION : " 3 . 6 " <nl> CUDA_VERSION : " 8 " <nl> MULTI_GPU : " 1 " <nl> resource_class : gpu . large <nl> < < : * pytorch_linux_test_defaults <nl> <nl> - pytorch_linux_xenial_cuda8_cudnn6_py3_NO_AVX2_test : <nl> + pytorch_linux_xenial_cuda8_cudnn7_py3_NO_AVX2_test : <nl> environment : <nl> - JOB_BASE_NAME : pytorch - linux - xenial - cuda8 - cudnn6 - py3 - NO_AVX2 - test <nl> - DOCKER_IMAGE : " 308535385114 . dkr . ecr . us - east - 1 . amazonaws . com / pytorch / pytorch - linux - xenial - cuda8 - cudnn6 - py3 : 278 " <nl> + JOB_BASE_NAME : pytorch - linux - xenial - cuda8 - cudnn7 - py3 - NO_AVX2 - test <nl> + DOCKER_IMAGE : " 308535385114 . dkr . ecr . us - east - 1 . amazonaws . com / pytorch / pytorch - linux - xenial - cuda8 - cudnn7 - py3 : 282 " <nl> PYTHON_VERSION : " 3 . 6 " <nl> CUDA_VERSION : " 8 " <nl> resource_class : gpu . medium <nl> < < : * pytorch_linux_test_defaults <nl> <nl> - pytorch_linux_xenial_cuda8_cudnn6_py3_NO_AVX_NO_AVX2_test : <nl> + pytorch_linux_xenial_cuda8_cudnn7_py3_NO_AVX_NO_AVX2_test : <nl> environment : <nl> - JOB_BASE_NAME : pytorch - linux - xenial - cuda8 - cudnn6 - py3 - NO_AVX - NO_AVX2 - test <nl> - DOCKER_IMAGE : " 308535385114 . dkr . ecr . us - east - 1 . amazonaws . com / pytorch / pytorch - linux - xenial - cuda8 - cudnn6 - py3 : 278 " <nl> + JOB_BASE_NAME : pytorch - linux - xenial - cuda8 - cudnn7 - py3 - NO_AVX - NO_AVX2 - test <nl> + DOCKER_IMAGE : " 308535385114 . dkr . ecr . us - east - 1 . amazonaws . com / pytorch / pytorch - linux - xenial - cuda8 - cudnn7 - py3 : 282 " <nl> PYTHON_VERSION : " 3 . 6 " <nl> CUDA_VERSION : " 8 " <nl> resource_class : gpu . medium <nl> jobs : <nl> pytorch_linux_xenial_cuda9_cudnn7_py2_build : <nl> environment : <nl> JOB_BASE_NAME : pytorch - linux - xenial - cuda9 - cudnn7 - py2 - build <nl> - DOCKER_IMAGE : " 308535385114 . dkr . ecr . us - east - 1 . amazonaws . com / pytorch / pytorch - linux - xenial - cuda9 - cudnn7 - py2 : 278 " <nl> + DOCKER_IMAGE : " 308535385114 . dkr . ecr . us - east - 1 . amazonaws . com / pytorch / pytorch - linux - xenial - cuda9 - cudnn7 - py2 : 282 " <nl> PYTHON_VERSION : " 2 . 7 " <nl> CUDA_VERSION : " 9 " <nl> < < : * pytorch_linux_build_defaults <nl> jobs : <nl> pytorch_linux_xenial_cuda9_cudnn7_py2_test : <nl> environment : <nl> JOB_BASE_NAME : pytorch - linux - xenial - cuda9 - cudnn7 - py2 - test <nl> - DOCKER_IMAGE : " 308535385114 . dkr . ecr . us - east - 1 . amazonaws . com / pytorch / pytorch - linux - xenial - cuda9 - cudnn7 - py2 : 278 " <nl> + DOCKER_IMAGE : " 308535385114 . dkr . ecr . us - east - 1 . amazonaws . com / pytorch / pytorch - linux - xenial - cuda9 - cudnn7 - py2 : 282 " <nl> PYTHON_VERSION : " 2 . 7 " <nl> CUDA_VERSION : " 9 " <nl> resource_class : gpu . medium <nl> jobs : <nl> pytorch_linux_xenial_cuda9_cudnn7_py3_build : <nl> environment : <nl> JOB_BASE_NAME : pytorch - linux - xenial - cuda9 - cudnn7 - py3 - build <nl> - DOCKER_IMAGE : " 308535385114 . dkr . ecr . us - east - 1 . amazonaws . com / pytorch / pytorch - linux - xenial - cuda9 - cudnn7 - py3 : 278 " <nl> + DOCKER_IMAGE : " 308535385114 . dkr . ecr . us - east - 1 . amazonaws . com / pytorch / pytorch - linux - xenial - cuda9 - cudnn7 - py3 : 282 " <nl> PYTHON_VERSION : " 3 . 6 " <nl> CUDA_VERSION : " 9 " <nl> < < : * pytorch_linux_build_defaults <nl> jobs : <nl> pytorch_linux_xenial_cuda9_cudnn7_py3_test : <nl> environment : <nl> JOB_BASE_NAME : pytorch - linux - xenial - cuda9 - cudnn7 - py3 - test <nl> - DOCKER_IMAGE : " 308535385114 . dkr . ecr . us - east - 1 . amazonaws . com / pytorch / pytorch - linux - xenial - cuda9 - cudnn7 - py3 : 278 " <nl> + DOCKER_IMAGE : " 308535385114 . dkr . ecr . us - east - 1 . amazonaws . com / pytorch / pytorch - linux - xenial - cuda9 - cudnn7 - py3 : 282 " <nl> PYTHON_VERSION : " 3 . 6 " <nl> CUDA_VERSION : " 9 " <nl> resource_class : gpu . medium <nl> jobs : <nl> pytorch_linux_xenial_cuda9_2_cudnn7_py3_gcc7_build : <nl> environment : <nl> JOB_BASE_NAME : pytorch - linux - xenial - cuda9 . 2 - cudnn7 - py3 - gcc7 - build <nl> - DOCKER_IMAGE : " 308535385114 . dkr . ecr . us - east - 1 . amazonaws . com / pytorch / pytorch - linux - xenial - cuda9 . 2 - cudnn7 - py3 - gcc7 : 278 " <nl> + DOCKER_IMAGE : " 308535385114 . dkr . ecr . us - east - 1 . amazonaws . com / pytorch / pytorch - linux - xenial - cuda9 . 2 - cudnn7 - py3 - gcc7 : 282 " <nl> PYTHON_VERSION : " 3 . 6 " <nl> CUDA_VERSION : " 9 . 2 " <nl> < < : * pytorch_linux_build_defaults <nl> jobs : <nl> pytorch_linux_xenial_cuda9_2_cudnn7_py3_gcc7_test : <nl> environment : <nl> JOB_BASE_NAME : pytorch - linux - xenial - cuda9 . 2 - cudnn7 - py3 - gcc7 - test <nl> - DOCKER_IMAGE : " 308535385114 . dkr . ecr . us - east - 1 . amazonaws . com / pytorch / pytorch - linux - xenial - cuda9 . 2 - cudnn7 - py3 - gcc7 : 278 " <nl> + DOCKER_IMAGE : " 308535385114 . dkr . ecr . us - east - 1 . amazonaws . com / pytorch / pytorch - linux - xenial - cuda9 . 2 - cudnn7 - py3 - gcc7 : 282 " <nl> PYTHON_VERSION : " 3 . 6 " <nl> CUDA_VERSION : " 9 . 2 " <nl> resource_class : gpu . medium <nl> jobs : <nl> pytorch_linux_xenial_cuda10_cudnn7_py3_gcc7_build : <nl> environment : <nl> JOB_BASE_NAME : pytorch - linux - xenial - cuda10 - cudnn7 - py3 - gcc7 - build <nl> - DOCKER_IMAGE : " 308535385114 . dkr . ecr . us - east - 1 . amazonaws . com / pytorch / pytorch - linux - xenial - cuda10 - cudnn7 - py3 - gcc7 : 278 " <nl> + DOCKER_IMAGE : " 308535385114 . dkr . ecr . us - east - 1 . amazonaws . com / pytorch / pytorch - linux - xenial - cuda10 - cudnn7 - py3 - gcc7 : 282 " <nl> PYTHON_VERSION : " 3 . 6 " <nl> CUDA_VERSION : " 10 " <nl> < < : * pytorch_linux_build_defaults <nl> jobs : <nl> pytorch_short_perf_test_gpu : <nl> environment : <nl> JOB_BASE_NAME : pytorch - short - perf - test - gpu <nl> - DOCKER_IMAGE : " 308535385114 . dkr . ecr . us - east - 1 . amazonaws . com / pytorch / pytorch - linux - xenial - cuda8 - cudnn6 - py3 : 278 " <nl> + DOCKER_IMAGE : " 308535385114 . dkr . ecr . us - east - 1 . amazonaws . com / pytorch / pytorch - linux - xenial - cuda8 - cudnn7 - py3 : 282 " <nl> PYTHON_VERSION : " 3 . 6 " <nl> CUDA_VERSION : " 8 " <nl> resource_class : gpu . medium <nl> jobs : <nl> pytorch_doc_push : <nl> environment : <nl> JOB_BASE_NAME : pytorch - doc - push <nl> - DOCKER_IMAGE : " 308535385114 . dkr . ecr . us - east - 1 . amazonaws . com / pytorch / pytorch - linux - xenial - cuda8 - cudnn6 - py3 : 278 " <nl> + DOCKER_IMAGE : " 308535385114 . dkr . ecr . us - east - 1 . amazonaws . com / pytorch / pytorch - linux - xenial - cuda8 - cudnn7 - py3 : 282 " <nl> resource_class : large <nl> machine : <nl> image : default <nl> jobs : <nl> chmod a + x . jenkins / pytorch / macos - build . sh <nl> unbuffer . jenkins / pytorch / macos - build . sh 2 > & 1 | ts <nl> <nl> - caffe2_py2_cuda8_0_cudnn6_ubuntu16_04_build : <nl> - environment : <nl> - JOB_BASE_NAME : caffe2 - py2 - cuda8 . 0 - cudnn6 - ubuntu16 . 04 - build <nl> - DOCKER_IMAGE : " 308535385114 . dkr . ecr . us - east - 1 . amazonaws . com / caffe2 / py2 - cuda8 . 0 - cudnn6 - ubuntu16 . 04 : 238 " <nl> - CUDA_VERSION : " 8 " <nl> - BUILD_ENVIRONMENT : " py2 - cuda8 . 0 - cudnn6 - ubuntu16 . 04 " <nl> - < < : * caffe2_linux_build_defaults <nl> - <nl> - caffe2_py2_cuda8_0_cudnn6_ubuntu16_04_test : <nl> - environment : <nl> - JOB_BASE_NAME : caffe2 - py2 - cuda8 . 0 - cudnn6 - ubuntu16 . 04 - test <nl> - DOCKER_IMAGE : " 308535385114 . dkr . ecr . us - east - 1 . amazonaws . com / caffe2 / py2 - cuda8 . 0 - cudnn6 - ubuntu16 . 04 : 238 " <nl> - CUDA_VERSION : " 8 " <nl> - BUILD_ENVIRONMENT : " py2 - cuda8 . 0 - cudnn6 - ubuntu16 . 04 " <nl> - resource_class : gpu . medium <nl> - < < : * caffe2_linux_test_defaults <nl> - <nl> caffe2_py2_cuda9_0_cudnn7_ubuntu16_04_build : <nl> environment : <nl> JOB_BASE_NAME : caffe2 - py2 - cuda9 . 0 - cudnn7 - ubuntu16 . 04 - build <nl> jobs : <nl> environment : <nl> JOB_BASE_NAME : caffe2 - py2 - cuda8 . 0 - cudnn7 - ubuntu16 . 04 - build <nl> DOCKER_IMAGE : " 308535385114 . dkr . ecr . us - east - 1 . amazonaws . com / caffe2 / py2 - cuda8 . 0 - cudnn7 - ubuntu16 . 04 : 238 " <nl> + CUDA_VERSION : " 8 " <nl> BUILD_ENVIRONMENT : " py2 - cuda8 . 0 - cudnn7 - ubuntu16 . 04 " <nl> - BUILD_ONLY : " 1 " <nl> < < : * caffe2_linux_build_defaults <nl> <nl> + caffe2_py2_cuda8_0_cudnn7_ubuntu16_04_test : <nl> + environment : <nl> + JOB_BASE_NAME : caffe2 - py2 - cuda8 . 0 - cudnn7 - ubuntu16 . 04 - test <nl> + DOCKER_IMAGE : " 308535385114 . dkr . ecr . us - east - 1 . amazonaws . com / caffe2 / py2 - cuda8 . 0 - cudnn7 - ubuntu16 . 04 : 238 " <nl> + CUDA_VERSION : " 8 " <nl> + BUILD_ENVIRONMENT : " py2 - cuda8 . 0 - cudnn7 - ubuntu16 . 04 " <nl> + resource_class : gpu . medium <nl> + < < : * caffe2_linux_test_defaults <nl> + <nl> caffe2_py2_gcc4_9_ubuntu14_04_build : <nl> environment : <nl> JOB_BASE_NAME : caffe2 - py2 - gcc4 . 9 - ubuntu14 . 04 - build <nl> workflows : <nl> - pytorch_linux_xenial_py3_clang5_asan_test : <nl> requires : <nl> - pytorch_linux_xenial_py3_clang5_asan_build <nl> - - pytorch_linux_xenial_cuda8_cudnn6_py3_build <nl> - - pytorch_linux_xenial_cuda8_cudnn6_py3_test : <nl> + - pytorch_linux_xenial_cuda8_cudnn7_py3_build <nl> + - pytorch_linux_xenial_cuda8_cudnn7_py3_test : <nl> requires : <nl> - - pytorch_linux_xenial_cuda8_cudnn6_py3_build <nl> - - pytorch_linux_xenial_cuda8_cudnn6_py3_multigpu_test : <nl> + - pytorch_linux_xenial_cuda8_cudnn7_py3_build <nl> + - pytorch_linux_xenial_cuda8_cudnn7_py3_multigpu_test : <nl> requires : <nl> - - pytorch_linux_xenial_cuda8_cudnn6_py3_build <nl> - - pytorch_linux_xenial_cuda8_cudnn6_py3_NO_AVX2_test : <nl> + - pytorch_linux_xenial_cuda8_cudnn7_py3_build <nl> + - pytorch_linux_xenial_cuda8_cudnn7_py3_NO_AVX2_test : <nl> requires : <nl> - - pytorch_linux_xenial_cuda8_cudnn6_py3_build <nl> - - pytorch_linux_xenial_cuda8_cudnn6_py3_NO_AVX_NO_AVX2_test : <nl> + - pytorch_linux_xenial_cuda8_cudnn7_py3_build <nl> + - pytorch_linux_xenial_cuda8_cudnn7_py3_NO_AVX_NO_AVX2_test : <nl> requires : <nl> - - pytorch_linux_xenial_cuda8_cudnn6_py3_build <nl> + - pytorch_linux_xenial_cuda8_cudnn7_py3_build <nl> - pytorch_short_perf_test_gpu : <nl> requires : <nl> - - pytorch_linux_xenial_cuda8_cudnn6_py3_build <nl> + - pytorch_linux_xenial_cuda8_cudnn7_py3_build <nl> - pytorch_doc_push : <nl> requires : <nl> - - pytorch_linux_xenial_cuda8_cudnn6_py3_build <nl> + - pytorch_linux_xenial_cuda8_cudnn7_py3_build <nl> - pytorch_linux_xenial_cuda9_cudnn7_py2_build <nl> - pytorch_linux_xenial_cuda9_cudnn7_py2_test : <nl> requires : <nl> workflows : <nl> - caffe2_onnx_py2_gcc5_ubuntu16_04_build <nl> <nl> - caffe2_py2_cuda8_0_cudnn7_ubuntu16_04_build <nl> + - caffe2_py2_cuda8_0_cudnn7_ubuntu16_04_test : <nl> + requires : <nl> + - caffe2_py2_cuda8_0_cudnn7_ubuntu16_04_build <nl> - caffe2_py2_clang3_8_ubuntu16_04_build <nl> - caffe2_py2_clang3_9_ubuntu16_04_build <nl> - caffe2_py2_clang7_ubuntu16_04_build <nl> mmm a / . jenkins / pytorch / build . sh <nl> ppp b / . jenkins / pytorch / build . sh <nl> fi <nl> git add - f build / bin <nl> <nl> # Test documentation build <nl> - if [ [ " $ BUILD_ENVIRONMENT " = = * xenial - cuda8 - cudnn6 - py3 * ] ] ; then <nl> + if [ [ " $ BUILD_ENVIRONMENT " = = * xenial - cuda8 - cudnn7 - py3 * ] ] ; then <nl> pushd docs <nl> # TODO : Don ' t run this here <nl> pip install - q - r requirements . txt | | true <nl> if [ [ " $ BUILD_ENVIRONMENT " = = * xenial - cuda8 - cudnn6 - py3 * ] ] ; then <nl> fi <nl> <nl> # Test standalone c10 build <nl> - if [ [ " $ BUILD_ENVIRONMENT " = = * xenial - cuda8 - cudnn6 - py3 * ] ] ; then <nl> + if [ [ " $ BUILD_ENVIRONMENT " = = * xenial - cuda8 - cudnn7 - py3 * ] ] ; then <nl> mkdir - p c10 / build <nl> pushd c10 / build <nl> cmake . . <nl> mmm a / . jenkins / pytorch / common . sh <nl> ppp b / . jenkins / pytorch / common . sh <nl> fi <nl> # Use conda cmake in some CI build . Conda cmake will be newer than our supported <nl> # min version 3 . 5 , so we only do it in two builds that we know should use conda . <nl> if [ [ " $ BUILD_ENVIRONMENT " = = * pytorch - linux - xenial - cuda * ] ] ; then <nl> - if [ [ " $ BUILD_ENVIRONMENT " = = * cuda8 - cudnn6 - py2 * ] ] | | \ <nl> + if [ [ " $ BUILD_ENVIRONMENT " = = * cuda8 - cudnn7 - py2 * ] ] | | \ <nl> [ [ " $ BUILD_ENVIRONMENT " = = * cuda9 - cudnn7 - py3 * ] ] ; then <nl> if ! which conda ; then <nl> echo " Expected $ { BUILD_ENVIRONMENT } to use conda , but ' which conda ' returns empty " <nl> mmm a / . jenkins / pytorch / enabled - configs . txt <nl> ppp b / . jenkins / pytorch / enabled - configs . txt <nl> <nl> # in this file will report a failure ( so you don ' t forget to <nl> # reenable the tests on merge ; ) <nl> <nl> - pytorch - linux - xenial - cuda8 - cudnn6 - py3 - build <nl> - pytorch - linux - xenial - cuda8 - cudnn6 - py3 - test <nl> - pytorch - linux - xenial - cuda8 - cudnn6 - py3 - multigpu - test <nl> + pytorch - linux - xenial - cuda8 - cudnn7 - py3 - build <nl> + pytorch - linux - xenial - cuda8 - cudnn7 - py3 - test <nl> + pytorch - linux - xenial - cuda8 - cudnn7 - py3 - multigpu - test <nl> pytorch - linux - xenial - cuda9 - cudnn7 - py2 - build <nl> pytorch - linux - xenial - cuda9 - cudnn7 - py2 - test <nl> pytorch - linux - xenial - cuda9 - cudnn7 - py3 - build <nl> mmm a / aten / src / ATen / cuda / detail / CUDAHooks . cpp <nl> ppp b / aten / src / ATen / cuda / detail / CUDAHooks . cpp <nl> bool CUDAHooks : : supportsDilatedConvolutionWithCuDNN ( ) const { <nl> cudaDeviceProp * prop = at : : cuda : : getCurrentDeviceProperties ( ) ; <nl> / / NOTE : extra parenthesis around numbers disable clang warnings about <nl> / / dead code <nl> - return ( <nl> - ( CUDNN_VERSION > = ( 6021 ) ) | | <nl> - ( CUDNN_VERSION > = ( 6000 ) & & prop - > major > = 5 ) ) ; <nl> + return true ; <nl> # else <nl> return false ; <nl> # endif <nl> mmm a / aten / src / ATen / cudnn / Descriptors . h <nl> ppp b / aten / src / ATen / cudnn / Descriptors . h <nl> <nl> # include < ATen / cuda / ATenCUDAGeneral . h > <nl> # include < cuda . h > <nl> <nl> - # if CUDNN_VERSION < 7000 <nl> - <nl> - # include < curand_kernel . h > <nl> - <nl> - / * <nl> - Note [ cuDNN dropout descriptor initialization ] <nl> - ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ <nl> - <nl> - In most cases , setting descriptors in cuDNN is cheap ( e . g . , <nl> - cudnnSetTensorNdDescriptor ) . However , this is not the case for <nl> - cudnnSetDropoutDescriptor : in cuDNN 6 / 7 ( and possibly others ) it does an <nl> - expensive precomputation to initialize the random number generator states . In <nl> - cuDNN 6 , this is the ONLY official mechanism to initialize a dropout descriptor , <nl> - which means that law - abiding clients were expected to generate a dropout <nl> - descriptor once and cache it . However , our ATen interface is ( 1 ) stateless ( so <nl> - we can ' t cache the descriptors ) and ( 2 ) does not accept arbitrary user types in <nl> - its interface ( so we can ' t pass the descriptor in ) . This puts us in a pickle . <nl> - <nl> - In cuDNN 7 , a new function , cudnnRestoreDropoutDescriptor was added , which <nl> - forgoes the expensive initialization process , and can initialize the <nl> - descriptor with a pre - initialized state CUDA tensor . This is great , because <nl> - it means we can simply pass in the state tensor and then initialize the <nl> - descriptor internally . Unfortunately , this function is not available in <nl> - cuDNN 6 . <nl> - <nl> - To work around this , we break the cuDNN abstraction barrier , and have <nl> - the struct layout of the underlaying dropout descriptor . With this struct , <nl> - we can reimplement cudnnRestoreDropoutDescriptor from scratch . Great ! <nl> - * / <nl> - <nl> - / / Reverse engineered from cuDNN 6 , see Note [ cuDNN dropout descriptor initialization ] <nl> - struct cudnnDropoutStruct { <nl> - float dropout ; <nl> - int nstates ; <nl> - void * states ; <nl> - } ; <nl> - <nl> - # endif <nl> - <nl> namespace at { namespace native { <nl> <nl> / / TODO : Add constructors for all of the descriptors <nl> struct AT_CUDA_API ConvolutionDescriptor <nl> if ( dataType = = CUDNN_DATA_HALF ) mathType = CUDNN_DATA_FLOAT ; <nl> AT_CUDNN_CHECK ( cudnnSetConvolutionNdDescriptor ( mut_desc ( ) , dim , pad , stride , upscale , <nl> CUDNN_CROSS_CORRELATION , mathType ) ) ; <nl> - # if CUDNN_VERSION > = 7000 <nl> AT_CUDNN_CHECK ( cudnnSetConvolutionGroupCount ( mut_desc ( ) , groups ) ) ; <nl> AT_CUDNN_CHECK ( cudnnSetConvolutionMathType ( mut_desc ( ) , CUDNN_DEFAULT_MATH ) ) ; <nl> if ( dataType = = CUDNN_DATA_HALF ) <nl> AT_CUDNN_CHECK ( cudnnSetConvolutionMathType ( mut_desc ( ) , CUDNN_TENSOR_OP_MATH ) ) ; <nl> - # endif <nl> } <nl> } ; <nl> <nl> struct AT_CUDA_API SpatialTransformerDescriptor <nl> } <nl> } ; <nl> <nl> - # if CUDNN_VERSION < 7000 <nl> - <nl> - / / See Note [ cuDNN dropout descriptor initialization ] <nl> - inline cudnnStatus_t cudnnRestoreDropoutDescriptor ( <nl> - cudnnDropoutDescriptor_t dropoutDesc , <nl> - cudnnHandle_t handle , <nl> - float dropout , <nl> - void * states , <nl> - size_t stateSizeInBytes , <nl> - unsigned long long seed ) { <nl> - / / Try to accurately simulate cuDNN ' s behavior , for our cuDNN 6 friends . <nl> - / / This is not entirely accurate but is good enough to catch some API <nl> - / / uses which would not be compatible in cuDNN 7 . Feel free to fix <nl> - / / this if you notice something is wrong . <nl> - if ( states = = nullptr ) return CUDNN_STATUS_INVALID_VALUE ; <nl> - if ( stateSizeInBytes = = 0 ) return CUDNN_STATUS_INVALID_VALUE ; <nl> - size_t expectedStateSizeInBytes ; <nl> - / / State size will differ depending on size of GPU <nl> - auto ret = cudnnDropoutGetStatesSize ( handle , & expectedStateSizeInBytes ) ; <nl> - if ( ret ! = CUDNN_STATUS_SUCCESS ) return ret ; <nl> - if ( expectedStateSizeInBytes ! = stateSizeInBytes ) return CUDNN_STATUS_INVALID_VALUE ; <nl> - dropoutDesc - > dropout = dropout ; <nl> - dropoutDesc - > nstates = ( int ) stateSizeInBytes / sizeof ( curandState_t ) ; <nl> - dropoutDesc - > states = states ; <nl> - return CUDNN_STATUS_SUCCESS ; <nl> - } <nl> - <nl> - # endif / / CUDNN_VERSION <nl> - <nl> struct AT_CUDA_API DropoutDescriptor <nl> : public Descriptor < cudnnDropoutStruct , <nl> & cudnnCreateDropoutDescriptor , <nl> struct AT_CUDA_API RNNDescriptor <nl> mode , <nl> algo , <nl> datatype ) ) ; <nl> - # if CUDNN_VERSION > = 7000 & & CUDA_VERSION > = 9000 <nl> + # if CUDA_VERSION > = 9000 <nl> cudaDeviceProp * prop = at : : cuda : : getCurrentDeviceProperties ( ) ; <nl> if ( prop - > major > = 7 ) { <nl> if ( datatype = = CUDNN_DATA_HALF ) { <nl> struct AT_CUDA_API RNNDescriptor <nl> } <nl> } ; <nl> <nl> - # if CUDNN_VERSION > = 7000 <nl> - <nl> struct AT_CUDA_API CTCLossDescriptor <nl> : public Descriptor < cudnnCTCLossStruct , <nl> & cudnnCreateCTCLossDescriptor , <nl> struct AT_CUDA_API CTCLossDescriptor <nl> } <nl> } ; <nl> <nl> - # endif <nl> - <nl> union Constant <nl> { <nl> float f ; <nl> mmm a / aten / src / ATen / native / cudnn / Conv . cpp <nl> ppp b / aten / src / ATen / native / cudnn / Conv . cpp <nl> struct algorithm_search < cudnnConvolutionBwdFilterAlgo_t > { <nl> CUDNN_CONVOLUTION_BWD_FILTER_ALGO_FFT , <nl> CUDNN_CONVOLUTION_BWD_FILTER_ALGO_3 , <nl> CUDNN_CONVOLUTION_BWD_FILTER_ALGO_WINOGRAD_NONFUSED , <nl> - # if CUDNN_VERSION > = 6000 <nl> CUDNN_CONVOLUTION_BWD_FILTER_ALGO_FFT_TILING , <nl> - # endif <nl> } ; <nl> / / NOTE : - 1 because ALGO_WINOGRAD is not implemented <nl> static constexpr int num_algos = CUDNN_CONVOLUTION_BWD_FILTER_ALGO_COUNT - 1 ; <nl> Tensor cudnn_convolution_forward ( <nl> / / See # 4500 <nl> Tensor weight_contig = weight - > contiguous ( ) ; <nl> <nl> - # if CUDNN_VERSION < 7000 <nl> - for ( int i = 0 ; i < groups ; i + + ) { <nl> - raw_cudnn_convolution_forward_out ( <nl> - narrowGroup ( * output , output_channels_dim , i , groups ) , <nl> - narrowGroup ( * input , input_channels_dim , i , groups ) , <nl> - narrowGroup ( weight_contig , weight_output_channels_dim , i , groups ) , <nl> - padding , stride , dilation , 1 , benchmark , deterministic ) ; <nl> - } <nl> - # else <nl> raw_cudnn_convolution_forward_out ( <nl> * output , * input , weight_contig , <nl> padding , stride , dilation , groups , benchmark , deterministic ) ; <nl> - # endif <nl> <nl> return * output ; <nl> } <nl> Tensor cudnn_convolution_backward_input ( <nl> / / See # 4500 <nl> Tensor weight_contig = weight - > contiguous ( ) ; <nl> <nl> - # if CUDNN_VERSION < 7000 <nl> - for ( int i = 0 ; i < groups ; i + + ) { <nl> - raw_cudnn_convolution_backward_input_out ( <nl> - narrowGroup ( * grad_input , input_channels_dim , i , groups ) , <nl> - narrowGroup ( * grad_output , output_channels_dim , i , groups ) , <nl> - narrowGroup ( weight_contig , weight_output_channels_dim , i , groups ) , <nl> - padding , stride , dilation , 1 , benchmark , deterministic ) ; <nl> - } <nl> - # else <nl> raw_cudnn_convolution_backward_input_out ( <nl> * grad_input , * grad_output , weight_contig , <nl> padding , stride , dilation , groups , benchmark , deterministic ) ; <nl> - # endif <nl> <nl> return * grad_input ; <nl> } <nl> Tensor cudnn_convolution_backward_weight ( <nl> TensorArg grad_weight { grad_weight_t , " result " , 0 } ; <nl> convolution_shape_check ( c , input , grad_weight , grad_output , padding , stride , dilation , groups ) ; <nl> <nl> - # if CUDNN_VERSION < 7000 <nl> - for ( int i = 0 ; i < groups ; i + + ) { <nl> - raw_cudnn_convolution_backward_weight_out ( <nl> - narrowGroup ( * grad_weight , weight_output_channels_dim , i , groups ) , <nl> - narrowGroup ( * grad_output , output_channels_dim , i , groups ) , <nl> - narrowGroup ( * input , input_channels_dim , i , groups ) , <nl> - padding , stride , dilation , groups , benchmark , deterministic ) ; <nl> - } <nl> - # else <nl> raw_cudnn_convolution_backward_weight_out ( <nl> * grad_weight , * grad_output , * input , <nl> padding , stride , dilation , groups , benchmark , deterministic ) ; <nl> - # endif <nl> <nl> return grad_weight_t ; <nl> } <nl> mmm a / aten / src / ATen / native / cudnn / LossCTC . cpp <nl> ppp b / aten / src / ATen / native / cudnn / LossCTC . cpp <nl> <nl> # endif <nl> <nl> <nl> - # if ! AT_CUDNN_ENABLED ( ) | | ( CUDNN_VERSION < 7000 ) <nl> + # if ! AT_CUDNN_ENABLED ( ) <nl> <nl> namespace at { namespace native { <nl> <nl> mmm a / aten / src / ATen / test / cuda_cudnn_test . cpp <nl> ppp b / aten / src / ATen / test / cuda_cudnn_test . cpp <nl> using namespace at : : native ; <nl> TEST ( CUDNNTest , CUDNNTestCUDA ) { <nl> if ( ! at : : cuda : : is_available ( ) ) return ; <nl> manual_seed ( 123 ) ; <nl> - <nl> - # if CUDNN_VERSION < 7000 <nl> - auto handle = getCudnnHandle ( ) ; <nl> - DropoutDescriptor desc1 , desc2 ; <nl> - desc1 . initialize_rng ( handle , 0 . 5 , 42 , TensorOptions ( ) . device ( DeviceType : : CUDA ) . dtype ( kByte ) ) ; <nl> - desc2 . set ( handle , 0 . 5 , desc1 . state ) ; <nl> - bool isEQ ; <nl> - isEQ = ( desc1 . desc ( ) - > dropout = = desc2 . desc ( ) - > dropout ) ; <nl> - ASSERT_TRUE ( isEQ ) ; <nl> - isEQ = ( desc1 . desc ( ) - > nstates = = desc2 . desc ( ) - > nstates ) ; <nl> - ASSERT_TRUE ( isEQ ) ; <nl> - isEQ = ( desc1 . desc ( ) - > states = = desc2 . desc ( ) - > states ) ; <nl> - ASSERT_TRUE ( isEQ ) ; <nl> - # endif <nl> } <nl> mmm a / cmake / public / cuda . cmake <nl> ppp b / cmake / public / cuda . cmake <nl> if ( CAFFE2_USE_CUDNN ) <nl> " $ { CUDNN_VERSION_MAJOR } . $ { CUDNN_VERSION_MINOR } . $ { CUDNN_VERSION_PATCH } " ) <nl> endif ( ) <nl> message ( STATUS " Found cuDNN : v $ { CUDNN_VERSION } ( include : $ { CUDNN_INCLUDE_DIR } , library : $ { CUDNN_LIBRARY } ) " ) <nl> + if ( CUDNN_VERSION VERSION_LESS " 7 . 0 . 0 " ) <nl> + message ( FATAL_ERROR " PyTorch requires cuDNN 7 and above . " ) <nl> + endif ( ) <nl> endif ( ) <nl> <nl> # mmm [ CUDA libraries wrapper <nl>
Remove support for CUDNN 6 ( )
pytorch/pytorch
0e80df515d0e9f157e2e0518a41806fb90e0faae
2019-01-17T17:57:26Z
mmm a / include / swift / AST / DiagnosticEngine . h <nl> ppp b / include / swift / AST / DiagnosticEngine . h <nl> <nl> # include " swift / AST / TypeLoc . h " <nl> # include " llvm / ADT / StringSet . h " <nl> # include " llvm / Support / Allocator . h " <nl> + # include " llvm / Support / FileSystem . h " <nl> # include " llvm / Support / Path . h " <nl> # include " llvm / Support / VersionTuple . h " <nl> <nl> mmm a / include / swift / AST / DiagnosticsSema . def <nl> ppp b / include / swift / AST / DiagnosticsSema . def <nl> ERROR ( availability_decl_unavailable , none , <nl> " % select { in % 3 | } 2 % select { | : % 4 } 4 " , <nl> ( unsigned , DeclName , bool , StringRef , StringRef ) ) <nl> <nl> + WARNING ( availability_decl_unavailable_warn , none , <nl> + " % select { getter for | setter for | } 0 % 1 is unavailable " <nl> + " % select { in % 3 | } 2 % select { | : % 4 } 4 " , <nl> + ( unsigned , DeclName , bool , StringRef , StringRef ) ) <nl> + <nl> # define REPLACEMENT_DECL_KIND_SELECT " select { | instance method | property } " <nl> ERROR ( availability_decl_unavailable_rename , none , <nl> " % select { getter for | setter for | } 0 % 1 has been " <nl> ERROR ( availability_decl_unavailable_rename , none , <nl> " ' % 4 ' % select { | : % 5 } 5 " , <nl> ( unsigned , DeclName , bool , unsigned , StringRef , StringRef ) ) <nl> <nl> + WARNING ( availability_decl_unavailable_rename_warn , none , <nl> + " % select { getter for | setter for | } 0 % 1 has been " <nl> + " % select { renamed to | replaced by } 2 % " REPLACEMENT_DECL_KIND_SELECT " 3 " <nl> + " ' % 4 ' % select { | : % 5 } 5 " , <nl> + ( unsigned , DeclName , bool , unsigned , StringRef , StringRef ) ) <nl> + <nl> NOTE ( availability_marked_unavailable , none , <nl> " % select { getter for | setter for | } 0 % 1 has been explicitly marked " <nl> " unavailable here " , ( unsigned , DeclName ) ) <nl> mmm a / include / swift / AST / Expr . h <nl> ppp b / include / swift / AST / Expr . h <nl> class KeyPathExpr : public Expr { <nl> OptionalWrap , <nl> Identity , <nl> TupleElement , <nl> + DictionaryKey , <nl> } ; <nl> <nl> private : <nl> class KeyPathExpr : public Expr { <nl> propertyType , <nl> loc ) ; <nl> } <nl> + <nl> + / / / Create a component for a dictionary key ( # keyPath only ) . <nl> + static Component forDictionaryKey ( DeclNameRef UnresolvedName , <nl> + Type valueType , <nl> + SourceLoc loc ) { <nl> + return Component ( nullptr , UnresolvedName , nullptr , { } , { } , <nl> + Kind : : DictionaryKey , <nl> + valueType , <nl> + loc ) ; <nl> + } <nl> <nl> / / / Create a component for a subscript . <nl> static Component forSubscript ( ASTContext & ctx , <nl> class KeyPathExpr : public Expr { <nl> case Kind : : Property : <nl> case Kind : : Identity : <nl> case Kind : : TupleElement : <nl> + case Kind : : DictionaryKey : <nl> return true ; <nl> <nl> case Kind : : UnresolvedSubscript : <nl> class KeyPathExpr : public Expr { <nl> case Kind : : Property : <nl> case Kind : : Identity : <nl> case Kind : : TupleElement : <nl> + case Kind : : DictionaryKey : <nl> return nullptr ; <nl> } <nl> llvm_unreachable ( " unhandled kind " ) ; <nl> class KeyPathExpr : public Expr { <nl> case Kind : : Property : <nl> case Kind : : Identity : <nl> case Kind : : TupleElement : <nl> + case Kind : : DictionaryKey : <nl> llvm_unreachable ( " no subscript labels for this kind " ) ; <nl> } <nl> llvm_unreachable ( " unhandled kind " ) ; <nl> class KeyPathExpr : public Expr { <nl> case Kind : : Property : <nl> case Kind : : Identity : <nl> case Kind : : TupleElement : <nl> + case Kind : : DictionaryKey : <nl> return { } ; <nl> } <nl> llvm_unreachable ( " unhandled kind " ) ; <nl> class KeyPathExpr : public Expr { <nl> DeclNameRef getUnresolvedDeclName ( ) const { <nl> switch ( getKind ( ) ) { <nl> case Kind : : UnresolvedProperty : <nl> + case Kind : : DictionaryKey : <nl> return Decl . UnresolvedName ; <nl> <nl> case Kind : : Invalid : <nl> class KeyPathExpr : public Expr { <nl> case Kind : : OptionalForce : <nl> case Kind : : Identity : <nl> case Kind : : TupleElement : <nl> + case Kind : : DictionaryKey : <nl> llvm_unreachable ( " no decl ref for this kind " ) ; <nl> } <nl> llvm_unreachable ( " unhandled kind " ) ; <nl> class KeyPathExpr : public Expr { <nl> case Kind : : Identity : <nl> case Kind : : Property : <nl> case Kind : : Subscript : <nl> + case Kind : : DictionaryKey : <nl> llvm_unreachable ( " no field number for this kind " ) ; <nl> } <nl> llvm_unreachable ( " unhandled kind " ) ; <nl> mmm a / lib / AST / ASTDumper . cpp <nl> ppp b / lib / AST / ASTDumper . cpp <nl> class PrintExpr : public ExprVisitor < PrintExpr > { <nl> PrintWithColorRAII ( OS , DiscriminatorColor ) <nl> < < " # " < < component . getTupleIndex ( ) ; <nl> break ; <nl> + case KeyPathExpr : : Component : : Kind : : DictionaryKey : <nl> + PrintWithColorRAII ( OS , ASTNodeColor ) < < " dict_key " ; <nl> + PrintWithColorRAII ( OS , IdentifierColor ) <nl> + < < " key = ' " < < component . getUnresolvedDeclName ( ) < < " ' " ; <nl> + break ; <nl> } <nl> PrintWithColorRAII ( OS , TypeColor ) <nl> < < " type = ' " < < GetTypeOfKeyPathComponent ( E , i ) < < " ' " ; <nl> mmm a / lib / AST / ASTWalker . cpp <nl> ppp b / lib / AST / ASTWalker . cpp <nl> class Traversal : public ASTVisitor < Traversal , Expr * , Stmt * , <nl> case KeyPathExpr : : Component : : Kind : : Invalid : <nl> case KeyPathExpr : : Component : : Kind : : Identity : <nl> case KeyPathExpr : : Component : : Kind : : TupleElement : <nl> + case KeyPathExpr : : Component : : Kind : : DictionaryKey : <nl> / / No subexpr to visit . <nl> break ; <nl> } <nl> mmm a / lib / AST / Expr . cpp <nl> ppp b / lib / AST / Expr . cpp <nl> void KeyPathExpr : : Component : : setSubscriptIndexHashableConformances ( <nl> case Kind : : Property : <nl> case Kind : : Identity : <nl> case Kind : : TupleElement : <nl> + case Kind : : DictionaryKey : <nl> llvm_unreachable ( " no hashable conformances for this kind " ) ; <nl> } <nl> } <nl> mmm a / lib / IDE / SourceEntityWalker . cpp <nl> ppp b / lib / IDE / SourceEntityWalker . cpp <nl> std : : pair < bool , Expr * > SemaAnnotator : : walkToExprPre ( Expr * E ) { <nl> case KeyPathExpr : : Component : : Kind : : OptionalWrap : <nl> case KeyPathExpr : : Component : : Kind : : OptionalForce : <nl> case KeyPathExpr : : Component : : Kind : : Identity : <nl> + case KeyPathExpr : : Component : : Kind : : DictionaryKey : <nl> break ; <nl> } <nl> } <nl> mmm a / lib / SILGen / SILGenExpr . cpp <nl> ppp b / lib / SILGen / SILGenExpr . cpp <nl> RValue RValueEmitter : : visitKeyPathExpr ( KeyPathExpr * E , SGFContext C ) { <nl> case KeyPathExpr : : Component : : Kind : : UnresolvedProperty : <nl> case KeyPathExpr : : Component : : Kind : : UnresolvedSubscript : <nl> llvm_unreachable ( " not resolved " ) ; <nl> + break ; <nl> + <nl> + case KeyPathExpr : : Component : : Kind : : DictionaryKey : <nl> + llvm_unreachable ( " DictionaryKey only valid in # keyPath " ) ; <nl> + break ; <nl> } <nl> } <nl> <nl> mmm a / lib / Sema / CSApply . cpp <nl> ppp b / lib / Sema / CSApply . cpp <nl> static bool buildObjCKeyPathString ( KeyPathExpr * E , <nl> / / Don ' t bother building the key path string if the key path didn ' t even <nl> / / resolve . <nl> return false ; <nl> + case KeyPathExpr : : Component : : Kind : : DictionaryKey : <nl> + llvm_unreachable ( " DictionaryKey only valid in # keyPath expressions . " ) ; <nl> + return false ; <nl> } <nl> } <nl> <nl> namespace { <nl> case KeyPathExpr : : Component : : Kind : : OptionalWrap : <nl> case KeyPathExpr : : Component : : Kind : : TupleElement : <nl> llvm_unreachable ( " already resolved " ) ; <nl> + break ; <nl> + case KeyPathExpr : : Component : : Kind : : DictionaryKey : <nl> + llvm_unreachable ( " DictionaryKey only valid in # keyPath " ) ; <nl> + break ; <nl> } <nl> <nl> / / Update " componentTy " with the result type of the last component . <nl> namespace { <nl> componentType = solution . simplifyType ( cs . getType ( kp , i ) ) ; <nl> assert ( ! componentType - > hasTypeVariable ( ) & & <nl> " Should not write type variable into key - path component " ) ; <nl> + kp - > getMutableComponents ( ) [ i ] . setComponentType ( componentType ) ; <nl> } <nl> - <nl> - kp - > getMutableComponents ( ) [ i ] . setComponentType ( componentType ) ; <nl> } <nl> } <nl> <nl> mmm a / lib / Sema / CSGen . cpp <nl> ppp b / lib / Sema / CSGen . cpp <nl> namespace { <nl> } <nl> case KeyPathExpr : : Component : : Kind : : Identity : <nl> continue ; <nl> + case KeyPathExpr : : Component : : Kind : : DictionaryKey : <nl> + llvm_unreachable ( " DictionaryKey only valid in # keyPath " ) ; <nl> + break ; <nl> } <nl> <nl> / / By now , ` base ` is the result type of this component . Set it in the <nl> mmm a / lib / Sema / CSSimplify . cpp <nl> ppp b / lib / Sema / CSSimplify . cpp <nl> ConstraintSystem : : simplifyKeyPathConstraint ( <nl> case KeyPathExpr : : Component : : Kind : : TupleElement : <nl> llvm_unreachable ( " not implemented " ) ; <nl> break ; <nl> + case KeyPathExpr : : Component : : Kind : : DictionaryKey : <nl> + llvm_unreachable ( " DictionaryKey only valid in # keyPath " ) ; <nl> + break ; <nl> } <nl> } <nl> <nl> mmm a / lib / Sema / ConstraintSystem . cpp <nl> ppp b / lib / Sema / ConstraintSystem . cpp <nl> ConstraintLocator * ConstraintSystem : : getCalleeLocator ( <nl> case ComponentKind : : OptionalChain : <nl> case ComponentKind : : OptionalWrap : <nl> case ComponentKind : : Identity : <nl> + case ComponentKind : : DictionaryKey : <nl> / / These components don ' t have any callee associated , so just continue . <nl> break ; <nl> } <nl> mmm a / lib / Sema / TypeCheckAvailability . cpp <nl> ppp b / lib / Sema / TypeCheckAvailability . cpp <nl> void swift : : diagnoseUnavailableOverride ( ValueDecl * override , <nl> <nl> diagnoseExplicitUnavailability ( base , override - > getLoc ( ) , <nl> override - > getDeclContext ( ) , <nl> + / * Flags * / None , <nl> [ & ] ( InFlightDiagnostic & diag ) { <nl> ParsedDeclName parsedName = parseDeclName ( attr - > Rename ) ; <nl> if ( ! parsedName | | parsedName . isPropertyAccessor ( ) | | <nl> void swift : : diagnoseUnavailableOverride ( ValueDecl * override , <nl> / / / Emit a diagnostic for references to declarations that have been <nl> / / / marked as unavailable , either through " unavailable " or " obsoleted : " . <nl> bool swift : : diagnoseExplicitUnavailability ( const ValueDecl * D , <nl> - SourceRange R , <nl> - const DeclContext * DC , <nl> - const ApplyExpr * call ) { <nl> - return diagnoseExplicitUnavailability ( D , R , DC , <nl> + SourceRange R , <nl> + const DeclContext * DC , <nl> + const ApplyExpr * call , <nl> + DeclAvailabilityFlags Flags ) { <nl> + return diagnoseExplicitUnavailability ( D , R , DC , Flags , <nl> [ = ] ( InFlightDiagnostic & diag ) { <nl> fixItAvailableAttrRename ( diag , R , D , AvailableAttr : : isUnavailable ( D ) , <nl> call ) ; <nl> bool swift : : diagnoseExplicitUnavailability ( <nl> const ValueDecl * D , <nl> SourceRange R , <nl> const DeclContext * DC , <nl> + DeclAvailabilityFlags Flags , <nl> llvm : : function_ref < void ( InFlightDiagnostic & ) > attachRenameFixIts ) { <nl> auto * Attr = AvailableAttr : : isUnavailable ( D ) ; <nl> if ( ! Attr ) <nl> bool swift : : diagnoseExplicitUnavailability ( <nl> break ; <nl> } <nl> <nl> + / / TODO : Consider removing this . <nl> + / / ObjC keypaths components weren ' t checked previously , so errors are demoted <nl> + / / to warnings to avoid source breakage . In some cases unavailable or <nl> + / / obsolete decls still map to valid ObjC runtime names , so behave correctly <nl> + / / at runtime , even though their use would produce an error outside of a <nl> + / / # keyPath expression . <nl> + bool warnInObjCKeyPath = Flags . contains ( DeclAvailabilityFlag : : ForObjCKeyPath ) ; <nl> + <nl> if ( ! Attr - > Rename . empty ( ) ) { <nl> SmallString < 32 > newNameBuf ; <nl> Optional < ReplacementDeclKind > replaceKind = <nl> bool swift : : diagnoseExplicitUnavailability ( <nl> StringRef newName = replaceKind ? newNameBuf . str ( ) : Attr - > Rename ; <nl> EncodedDiagnosticMessage EncodedMessage ( Attr - > Message ) ; <nl> auto diag = <nl> - diags . diagnose ( Loc , diag : : availability_decl_unavailable_rename , <nl> + diags . diagnose ( Loc , warnInObjCKeyPath <nl> + ? diag : : availability_decl_unavailable_rename_warn <nl> + : diag : : availability_decl_unavailable_rename , <nl> RawAccessorKind , Name , replaceKind . hasValue ( ) , <nl> rawReplaceKind , newName , EncodedMessage . Message ) ; <nl> attachRenameFixIts ( diag ) ; <nl> bool swift : : diagnoseExplicitUnavailability ( <nl> } else { <nl> EncodedDiagnosticMessage EncodedMessage ( Attr - > Message ) ; <nl> diags <nl> - . diagnose ( Loc , diag : : availability_decl_unavailable , RawAccessorKind , <nl> + . diagnose ( Loc , warnInObjCKeyPath <nl> + ? diag : : availability_decl_unavailable_warn <nl> + : diag : : availability_decl_unavailable , RawAccessorKind , <nl> Name , platform . empty ( ) , platform , EncodedMessage . Message ) <nl> . highlight ( R ) ; <nl> } <nl> class AvailabilityWalker : public ASTWalker { <nl> / / / Walk a keypath expression , checking all of its components for <nl> / / / availability . <nl> void maybeDiagKeyPath ( KeyPathExpr * KP ) { <nl> + auto flags = DeclAvailabilityFlags ( ) ; <nl> + if ( KP - > isObjC ( ) ) <nl> + flags = DeclAvailabilityFlag : : ForObjCKeyPath ; <nl> + <nl> for ( auto & component : KP - > getComponents ( ) ) { <nl> switch ( component . getKind ( ) ) { <nl> case KeyPathExpr : : Component : : Kind : : Property : <nl> class AvailabilityWalker : public ASTWalker { <nl> auto * decl = component . getDeclRef ( ) . getDecl ( ) ; <nl> auto loc = component . getLoc ( ) ; <nl> SourceRange range ( loc , loc ) ; <nl> - diagAvailability ( decl , range , nullptr ) ; <nl> + diagAvailability ( decl , range , nullptr , flags ) ; <nl> break ; <nl> } <nl> <nl> class AvailabilityWalker : public ASTWalker { <nl> case KeyPathExpr : : Component : : Kind : : OptionalWrap : <nl> case KeyPathExpr : : Component : : Kind : : OptionalForce : <nl> case KeyPathExpr : : Component : : Kind : : Identity : <nl> + case KeyPathExpr : : Component : : Kind : : DictionaryKey : <nl> break ; <nl> } <nl> } <nl> AvailabilityWalker : : diagAvailability ( ConcreteDeclRef declRef , SourceRange R , <nl> if ( TypeChecker : : diagnoseInlinableDeclRef ( R . Start , declRef , DC , FragileKind ) ) <nl> return true ; <nl> <nl> - if ( diagnoseExplicitUnavailability ( D , R , DC , call ) ) <nl> + if ( diagnoseExplicitUnavailability ( D , R , DC , call , Flags ) ) <nl> return true ; <nl> <nl> / / Make sure not to diagnose an accessor ' s deprecation if we already <nl> mmm a / lib / Sema / TypeCheckAvailability . h <nl> ppp b / lib / Sema / TypeCheckAvailability . h <nl> enum class DeclAvailabilityFlag : uint8_t { <nl> / / / Do not diagnose uses of declarations in versions before they were <nl> / / / introduced . Used to work around availability - checker bugs . <nl> AllowPotentiallyUnavailable = 1 < < 3 , <nl> + <nl> + / / / If an error diagnostic would normally be emitted , demote the error to a <nl> + / / / warning . Used for ObjC key path components . <nl> + ForObjCKeyPath = 1 < < 4 <nl> } ; <nl> using DeclAvailabilityFlags = OptionSet < DeclAvailabilityFlag > ; <nl> <nl> void diagnoseUnavailableOverride ( ValueDecl * override , <nl> bool diagnoseExplicitUnavailability ( const ValueDecl * D , <nl> SourceRange R , <nl> const DeclContext * DC , <nl> - const ApplyExpr * call ) ; <nl> + const ApplyExpr * call , <nl> + DeclAvailabilityFlags Flags = None ) ; <nl> <nl> / / / Emit a diagnostic for references to declarations that have been <nl> / / / marked as unavailable , either through " unavailable " or " obsoleted : " . <nl> bool diagnoseExplicitUnavailability ( <nl> const ValueDecl * D , <nl> SourceRange R , <nl> const DeclContext * DC , <nl> + DeclAvailabilityFlags Flags , <nl> llvm : : function_ref < void ( InFlightDiagnostic & ) > attachRenameFixIts ) ; <nl> <nl> / / / Check if \ p decl has a introduction version required by - require - explicit - availability <nl> mmm a / lib / Sema / TypeCheckCodeCompletion . cpp <nl> ppp b / lib / Sema / TypeCheckCodeCompletion . cpp <nl> static Optional < Type > getTypeOfCompletionContextExpr ( <nl> <nl> case CompletionTypeCheckKind : : KeyPath : <nl> referencedDecl = nullptr ; <nl> - if ( auto keyPath = dyn_cast < KeyPathExpr > ( parsedExpr ) ) <nl> - return TypeChecker : : checkObjCKeyPathExpr ( DC , keyPath , <nl> - / * requireResultType = * / true ) ; <nl> + if ( auto keyPath = dyn_cast < KeyPathExpr > ( parsedExpr ) ) { <nl> + auto components = keyPath - > getComponents ( ) ; <nl> + if ( ! components . empty ( ) ) { <nl> + auto & last = components . back ( ) ; <nl> + if ( last . isResolved ( ) ) { <nl> + if ( last . getKind ( ) = = KeyPathExpr : : Component : : Kind : : Property ) <nl> + referencedDecl = last . getDeclRef ( ) ; <nl> + Type lookupTy = last . getComponentType ( ) ; <nl> + ASTContext & Ctx = DC - > getASTContext ( ) ; <nl> + if ( auto bridgedClass = Ctx . getBridgedToObjC ( DC , lookupTy ) ) <nl> + return bridgedClass ; <nl> + return lookupTy ; <nl> + } <nl> + } <nl> + } <nl> <nl> return None ; <nl> } <nl> mmm a / lib / Sema / TypeCheckExprObjC . cpp <nl> ppp b / lib / Sema / TypeCheckExprObjC . cpp <nl> Optional < Type > TypeChecker : : checkObjCKeyPathExpr ( DeclContext * dc , <nl> case KeyPathExpr : : Component : : Kind : : OptionalWrap : <nl> case KeyPathExpr : : Component : : Kind : : Property : <nl> case KeyPathExpr : : Component : : Kind : : Subscript : <nl> + case KeyPathExpr : : Component : : Kind : : DictionaryKey : <nl> llvm_unreachable ( " already resolved ! " ) ; <nl> } <nl> <nl> Optional < Type > TypeChecker : : checkObjCKeyPathExpr ( DeclContext * dc , <nl> / / From here , we ' re resolving a property . Use the current type . <nl> updateState ( / * isProperty = * / true , currentType ) ; <nl> <nl> + auto resolved = KeyPathExpr : : Component : : <nl> + forDictionaryKey ( componentName , currentType , componentNameLoc ) ; <nl> + resolvedComponents . push_back ( resolved ) ; <nl> continue ; <nl> } <nl> <nl> Optional < Type > TypeChecker : : checkObjCKeyPathExpr ( DeclContext * dc , <nl> if ( auto var = dyn_cast < VarDecl > ( found ) ) { <nl> / / Resolve this component to the variable we found . <nl> auto varRef = ConcreteDeclRef ( var ) ; <nl> - auto resolved = <nl> - KeyPathExpr : : Component : : forProperty ( varRef , Type ( ) , componentNameLoc ) ; <nl> + Type varTy = var - > getInterfaceType ( ) ; <nl> + <nl> + / / Updates currentType <nl> + updateState ( / * isProperty = * / true , varTy ) ; <nl> + <nl> + auto resolved = KeyPathExpr : : Component : : forProperty ( varRef , currentType , <nl> + componentNameLoc ) ; <nl> resolvedComponents . push_back ( resolved ) ; <nl> - updateState ( / * isProperty = * / true , var - > getInterfaceType ( ) ) ; <nl> <nl> / / Check that the property is @ objc . <nl> if ( ! var - > isObjC ( ) ) { <nl> Optional < Type > TypeChecker : : checkObjCKeyPathExpr ( DeclContext * dc , <nl> break ; <nl> } <nl> <nl> + / / Updates currentType based on newType . <nl> updateState ( / * isProperty = * / false , newType ) ; <nl> + <nl> + / / Resolve this component to the type we found . <nl> + auto typeRef = ConcreteDeclRef ( type ) ; <nl> + auto resolved = KeyPathExpr : : Component : : forProperty ( typeRef , currentType , <nl> + componentNameLoc ) ; <nl> + resolvedComponents . push_back ( resolved ) ; <nl> + <nl> continue ; <nl> } <nl> <nl> mmm a / localization / diagnostics / en . yaml <nl> ppp b / localization / diagnostics / en . yaml <nl> <nl> % select { getter for | setter for | } 0 % 1 is unavailable % select { in <nl> % 3 | } 2 % select { | : % 4 } 4 <nl> <nl> + - id : availability_decl_unavailable_warn <nl> + msg : > - <nl> + % select { getter for | setter for | } 0 % 1 is unavailable % select { in <nl> + % 3 | } 2 % select { | : % 4 } 4 <nl> + <nl> - id : availability_decl_unavailable_rename <nl> msg : > - <nl> % select { getter for | setter for | } 0 % 1 has been % select { renamed to | replaced <nl> by } 2 % select { | instance method | property } 3 ' % 4 ' % select { | : % 5 } 5 <nl> <nl> + - id : availability_decl_unavailable_rename_warn <nl> + msg : > - <nl> + % select { getter for | setter for | } 0 % 1 has been % select { renamed to | replaced <nl> + by } 2 % select { | instance method | property } 3 ' % 4 ' % select { | : % 5 } 5 <nl> + <nl> - id : availability_marked_unavailable <nl> msg : > - <nl> % select { getter for | setter for | } 0 % 1 has been explicitly marked <nl> mmm a / test / IDE / complete_pound_keypath . swift <nl> ppp b / test / IDE / complete_pound_keypath . swift <nl> <nl> <nl> / / RUN : % target - swift - ide - test ( mock - sdk : % clang - importer - sdk ) - code - completion - source - filename % s - code - completion - token = IN_KEYPATH_2 | % FileCheck - check - prefix = CHECK - IN_KEYPATH % s <nl> <nl> + / / RUN : % target - swift - ide - test ( mock - sdk : % clang - importer - sdk ) - code - completion - source - filename % s - code - completion - token = IN_KEYPATH_3 | % FileCheck - check - prefix = CHECK - IN_KEYPATH_BRIDGED_STRING % s <nl> + <nl> + / / RUN : % target - swift - ide - test ( mock - sdk : % clang - importer - sdk ) - code - completion - source - filename % s - code - completion - token = IN_KEYPATH_4 | % FileCheck - check - prefix = CHECK - IN_KEYPATH_BRIDGED_STRING % s <nl> + <nl> + / / RUN : % target - swift - ide - test ( mock - sdk : % clang - importer - sdk ) - code - completion - source - filename % s - code - completion - token = IN_KEYPATH_5 | % FileCheck - check - prefixes = CHECK - IN_KEYPATH , CHECK - IN_KEYPATH_OPT % s <nl> + <nl> + / / RUN : % target - swift - ide - test ( mock - sdk : % clang - importer - sdk ) - code - completion - source - filename % s - code - completion - token = IN_KEYPATH_6 | % FileCheck - check - prefixes = CHECK - IN_KEYPATH , CHECK - IN_KEYPATH_OPT % s <nl> + <nl> + / / RUN : % target - swift - ide - test ( mock - sdk : % clang - importer - sdk ) - code - completion - source - filename % s - code - completion - token = IN_KEYPATH_7 | % FileCheck - check - prefixes = CHECK - IN_KEYPATH_BRIDGED_STRING % s <nl> + <nl> <nl> / / REQUIRES : objc_interop <nl> <nl> func selectorArg1 ( obj : NSObject ) { <nl> acceptKeyPath ( # ^ KEYPATH_ARG ^ # <nl> } <nl> <nl> - class ObjCClass : NSObject { <nl> + @ objcMembers class ObjCClass : NSObject { <nl> var prop1 : String = " " <nl> var prop2 : ObjCClass ? <nl> + var prop3 : [ ObjCClass ] ? = [ ] <nl> + var prop4 : [ String : String ] = [ : ] <nl> <nl> func completeInKeyPath1 ( ) { <nl> _ = # keyPath ( # ^ IN_KEYPATH_1 ^ # <nl> func completeInKeyPath2 ( ) { <nl> _ = # keyPath ( ObjCClass . # ^ IN_KEYPATH_2 ^ # <nl> } <nl> <nl> + func completeInKeyPath3 ( ) { <nl> + _ = # keyPath ( ObjCClass . prop1 . # ^ IN_KEYPATH_3 ^ # <nl> + } <nl> + func completeInKeyPath3 ( ) { <nl> + _ = # keyPath ( String . # ^ IN_KEYPATH_4 ^ # <nl> + } <nl> + <nl> + func completeInKeyPath4 ( ) { <nl> + _ = # keyPath ( ObjCClass . prop2 . # ^ IN_KEYPATH_5 ^ # <nl> + } <nl> + <nl> + func completeInKeyPath5 ( ) { <nl> + _ = # keyPath ( ObjCClass . prop3 . # ^ IN_KEYPATH_6 ^ # <nl> + } <nl> + <nl> + func completeInKeyPath6 ( ) { <nl> + _ = # keyPath ( ObjCClass . prop4 . anythingHere . # ^ IN_KEYPATH_7 ^ # <nl> + } <nl> + <nl> / / CHECK - AFTER_POUND - NOT : keyPath <nl> <nl> / / CHECK - KEYPATH_ARG : Keyword / None / TypeRelation [ Identical ] : # keyPath ( { # @ objc property sequence # } ) [ # String # ] ; name = # keyPath ( @ objc property sequence ) <nl> <nl> / / CHECK - IN_KEYPATH : Decl [ InstanceVar ] / CurrNominal : prop1 [ # String # ] ; name = prop1 <nl> / / CHECK - IN_KEYPATH : Decl [ InstanceVar ] / CurrNominal : prop2 [ # ObjCClass ? # ] ; name = prop2 <nl> + / / CHECK - IN_KEYPATH : Decl [ InstanceVar ] / CurrNominal : prop3 [ # [ ObjCClass ] ? # ] ; name = prop3 <nl> / / CHECK - IN_KEYPATH : Decl [ InstanceVar ] / Super : hashValue [ # Int # ] ; name = hashValue <nl> <nl> + / / Make sure we unwrap optionals ( members of Optional itself are invalid in this context ) <nl> + / / <nl> + / / CHECK - IN_KEYPATH_OPT - NOT : name = map <nl> + <nl> + / / Make sure we handle bridged types ( i . e . show NSString members rather than String members ) <nl> + / / <nl> + / / CHECK - IN_KEYPATH_BRIDGED_STRING : Decl [ InstanceVar ] / CurrNominal / IsSystem : urlsInText [ # [ URL ] # ] ; name = urlsInText <nl> + / / CHECK - IN_KEYPATH_BRIDGED_STRING : Decl [ InstanceVar ] / CurrNominal / IsSystem : uppercased [ # String ! # ] ; name = uppercased <nl> + / / CHECK - IN_KEYPATH_BRIDGED_STRING - NOT : name = count <nl> + <nl> <nl> mmm a / test / Index / index_keypaths . swift <nl> ppp b / test / Index / index_keypaths . swift <nl> <nl> - / / RUN : % target - swift - ide - test - print - indexed - symbols - source - filename % s | % FileCheck % s <nl> + / / RUN : % target - swift - ide - test ( mock - sdk : % clang - importer - sdk ) - print - indexed - symbols - source - filename % s | % FileCheck % s <nl> / / REQUIRES : objc_interop <nl> <nl> + import Foundation <nl> + <nl> struct MyStruct { <nl> struct Inner { <nl> let myProp = 1 <nl> } <nl> } <nl> <nl> - class MyClass { <nl> - class Inner { <nl> - @ objc var myProp = 1 <nl> - } <nl> - } <nl> - <nl> let a = \ MyStruct . Inner . myProp <nl> / / CHECK : [ [ @ LINE - 1 ] ] : 25 | { { . * } } | myProp <nl> / / CHECK : [ [ @ LINE - 2 ] ] : 10 | { { . * } } | MyStruct <nl> / / CHECK : [ [ @ LINE - 3 ] ] : 19 | { { . * } } | Inner <nl> let b : KeyPath < MyStruct . Inner , Int > = \ . myProp <nl> / / CHECK : [ [ @ LINE - 1 ] ] : 41 | { { . * } } | myProp <nl> - let c = \ MyClass . Inner . myProp <nl> + <nl> + @ objc class MyClass : NSObject { <nl> + @ objc class Inner : NSObject { <nl> + @ objc var myProp = 1 <nl> + @ objc var otherProp : [ String : MyClass . Inner ] = [ : ] <nl> + func method ( ) { <nl> + let c : String = # keyPath ( myProp ) <nl> + / / CHECK : [ [ @ LINE - 1 ] ] : 32 | { { . * } } | myProp <nl> + } <nl> + } <nl> + } <nl> + <nl> + let d : String = # keyPath ( MyClass . Inner . myProp ) <nl> + / / CHECK : [ [ @ LINE - 1 ] ] : 26 | { { . * } } | MyClass <nl> + / / CHECK : [ [ @ LINE - 2 ] ] : 34 | { { . * } } | Inner <nl> + / / CHECK : [ [ @ LINE - 3 ] ] : 40 | { { . * } } | myProp <nl> + <nl> + let e = \ MyClass . Inner . myProp <nl> / / CHECK : [ [ @ LINE - 1 ] ] : 24 | { { . * } } | myProp <nl> / / CHECK : [ [ @ LINE - 2 ] ] : 10 | { { . * } } | MyClass <nl> / / CHECK : [ [ @ LINE - 3 ] ] : 18 | { { . * } } | Inner <nl> - let d : KeyPath < MyClass . Inner , Int > = \ . myProp <nl> + <nl> + let f : KeyPath < MyClass . Inner , Int > = \ . myProp <nl> / / CHECK : [ [ @ LINE - 1 ] ] : 40 | { { . * } } | myProp <nl> + <nl> + let g : String = # keyPath ( MyClass . Inner . otherProp . someDictKey . myProp ) <nl> + / / CHECK : [ [ @ LINE - 1 ] ] : 26 | { { . * } } | MyClass <nl> + / / CHECK : [ [ @ LINE - 2 ] ] : 34 | { { . * } } | Inner <nl> + / / CHECK : [ [ @ LINE - 3 ] ] : 40 | { { . * } } | otherProp <nl> + / / CHECK : [ [ @ LINE - 4 ] ] : 62 | { { . * } } | myProp <nl> mmm a / test / expr / primary / keypath / keypath - objc . swift <nl> ppp b / test / expr / primary / keypath / keypath - objc . swift <nl> func testKeyPath ( a : A , b : B ) { <nl> let _ : String = # keyPath ( A . propString ) <nl> <nl> / / Property of String property ( which looks on NSString ) <nl> - let _ : String = # keyPath ( A . propString . URLsInText ) <nl> + let _ : String = # keyPath ( A . propString . URLsInText ) / / expected - warning { { ' URLsInText ' has been renamed to ' urlsInText ' } } <nl> <nl> / / String property with a suffix <nl> let _ : String = # keyPath ( A . propString ) . description <nl> func testKeyPath ( a : A , b : B ) { <nl> <nl> / / Array property ( make sure we look at the array element ) . <nl> let _ : String = # keyPath ( A . propArray ) <nl> - let _ : String = # keyPath ( A . propArray . URLsInText ) <nl> + let _ : String = # keyPath ( A . propArray . URLsInText ) / / expected - warning { { ' URLsInText ' has been renamed to ' urlsInText ' } } <nl> <nl> / / Dictionary property ( make sure we look at the value type ) . <nl> let _ : String = # keyPath ( A . propDict . anyKeyName ) <nl> func testKeyPath ( a : A , b : B ) { <nl> <nl> / / Set property ( make sure we look at the set element ) . <nl> let _ : String = # keyPath ( A . propSet ) <nl> - let _ : String = # keyPath ( A . propSet . URLsInText ) <nl> + let _ : String = # keyPath ( A . propSet . URLsInText ) / / expected - warning { { ' URLsInText ' has been renamed to ' urlsInText ' } } <nl> <nl> / / AnyObject property <nl> - let _ : String = # keyPath ( A . propAnyObject . URLsInText ) <nl> + let _ : String = # keyPath ( A . propAnyObject . URLsInText ) / / expected - warning { { ' URLsInText ' has been renamed to ' urlsInText ' } } <nl> let _ : String = # keyPath ( A . propAnyObject . propA ) <nl> let _ : String = # keyPath ( A . propAnyObject . propB ) <nl> let _ : String = # keyPath ( A . propAnyObject . description ) <nl> <nl> / / NSString property <nl> - let _ : String = # keyPath ( A . propNSString . URLsInText ) <nl> + let _ : String = # keyPath ( A . propNSString . URLsInText ) / / expected - warning { { ' URLsInText ' has been renamed to ' urlsInText ' } } <nl> <nl> / / NSArray property ( AnyObject array element ) . <nl> let _ : String = # keyPath ( A . propNSArray ) <nl> - let _ : String = # keyPath ( A . propNSArray . URLsInText ) <nl> + let _ : String = # keyPath ( A . propNSArray . URLsInText ) / / expected - warning { { ' URLsInText ' has been renamed to ' urlsInText ' } } <nl> <nl> / / NSDictionary property ( AnyObject value type ) . <nl> let _ : String = # keyPath ( A . propNSDict . anyKeyName ) <nl> func testKeyPath ( a : A , b : B ) { <nl> <nl> / / NSSet property ( AnyObject set element ) . <nl> let _ : String = # keyPath ( A . propNSSet ) <nl> - let _ : String = # keyPath ( A . propNSSet . URLsInText ) <nl> + let _ : String = # keyPath ( A . propNSSet . URLsInText ) / / expected - warning { { ' URLsInText ' has been renamed to ' urlsInText ' } } <nl> <nl> / / Property with keyword name . <nl> let _ : String = # keyPath ( A . repeat ) <nl>
Merge remote - tracking branch ' origin / master ' into master - rebranch
apple/swift
0dcbd763bec097997943f0404cdf1aacedbf3263
2020-08-06T22:43:58Z
mmm a / Rakefile <nl> ppp b / Rakefile <nl> task ' gem : native ' do <nl> " invoked on macos with ruby # { RUBY_VERSION } . The ruby macos artifact " \ <nl> " build should be running on ruby 2 . 5 . " <nl> end <nl> - system " rake cross native gem RUBY_CC_VERSION = 2 . 6 . 0 : 2 . 5 . 0 : 2 . 4 . 0 : 2 . 3 . 0 V = # { verbose } GRPC_CONFIG = # { grpc_config } " <nl> + system " rake cross native gem RUBY_CC_VERSION = 2 . 7 . 0 : 2 . 6 . 0 : 2 . 5 . 0 : 2 . 4 . 0 : 2 . 3 . 0 V = # { verbose } GRPC_CONFIG = # { grpc_config } " <nl> else <nl> require ' rake_compiler_dock ' <nl> <nl> mmm a / tools / distrib / build_ruby_environment_macos . sh <nl> ppp b / tools / distrib / build_ruby_environment_macos . sh <nl> rm - rf ~ / . rake - compiler <nl> <nl> CROSS_RUBY = $ ( mktemp tmpfile . XXXXXXXX ) <nl> <nl> - curl https : / / raw . githubusercontent . com / rake - compiler / rake - compiler / v1 . 0 . 3 / tasks / bin / cross - ruby . rake > " $ CROSS_RUBY " <nl> + curl https : / / raw . githubusercontent . com / rake - compiler / rake - compiler / v1 . 1 . 0 / tasks / bin / cross - ruby . rake > " $ CROSS_RUBY " <nl> <nl> # See https : / / github . com / grpc / grpc / issues / 12161 for verconf . h patch details <nl> patch " $ CROSS_RUBY " < < EOF <nl> EOF <nl> <nl> MAKE = " make - j8 " <nl> <nl> + set + x # rvm commands are very verbose <nl> + source ~ / . rvm / scripts / rvm <nl> + rvm use 2 . 7 . 0 <nl> + set - x <nl> + ruby - - version | grep ' ruby 2 . 7 . 0 ' <nl> + for v in 2 . 7 . 0 ; do <nl> + ccache - c <nl> + rake - f " $ CROSS_RUBY " cross - ruby VERSION = " $ v " HOST = x86_64 - darwin11 MAKE = " $ MAKE " <nl> + done <nl> + set + x <nl> + rvm use 2 . 5 . 0 <nl> + set - x <nl> + ruby - - version | grep ' ruby 2 . 5 . 0 ' <nl> for v in 2 . 6 . 0 2 . 5 . 0 2 . 4 . 0 2 . 3 . 0 2 . 2 . 2 ; do <nl> ccache - c <nl> rake - f " $ CROSS_RUBY " cross - ruby VERSION = " $ v " HOST = x86_64 - darwin11 MAKE = " $ MAKE " <nl> done <nl> <nl> sed ' s / x86_64 - darwin - 11 / universal - darwin / ' ~ / . rake - compiler / config . yml > " $ CROSS_RUBY " <nl> mv " $ CROSS_RUBY " ~ / . rake - compiler / config . yml <nl> - <nl> mmm a / tools / internal_ci / helper_scripts / prepare_build_macos_rc <nl> ppp b / tools / internal_ci / helper_scripts / prepare_build_macos_rc <nl> then <nl> set + ex # rvm script is very verbose and exits with errorcode <nl> # Advice from https : / / github . com / Homebrew / homebrew - cask / issues / 8629 # issuecomment - 68641176 <nl> brew update & & brew upgrade brew - cask & & brew cleanup & & brew cask cleanup <nl> - rvm - - debug requirements ruby - 2 . 5 . 0 <nl> - source $ HOME / . rvm / scripts / rvm <nl> set - e # rvm commands are very verbose <nl> - time rvm install 2 . 5 . 0 <nl> + source $ HOME / . rvm / scripts / rvm <nl> + for RUBY_VERSION in 2 . 5 . 0 2 . 7 . 0 ; do <nl> + rvm - - debug requirements " ruby - $ { RUBY_VERSION } " <nl> + time rvm install " $ RUBY_VERSION " <nl> + time gem install bundler - v 1 . 17 . 3 - - no - document <nl> + time gem install rake - compiler - - no - document <nl> + done ; <nl> rvm use 2 . 5 . 0 - - default <nl> - time gem install bundler - v 1 . 17 . 3 - - no - ri - - no - doc <nl> - time gem install cocoapods - - version 1 . 3 . 1 - - no - ri - - no - doc <nl> - time gem install rake - compiler - - no - ri - - no - doc <nl> + time gem install cocoapods - - version 1 . 3 . 1 - - no - document <nl> rvm osx - ssl - certs status all <nl> rvm osx - ssl - certs update all <nl> set - ex <nl>
Add ruby 2 . 7 to mac binary packages
grpc/grpc
09bc1eebe491f8e74c263ffe13257369c467c533
2020-03-02T09:06:21Z
mmm a / CMakeModules / installer . cmake <nl> ppp b / CMakeModules / installer . cmake <nl> <nl> include ( InstallRequiredSystemLibraries ) <nl> <nl> + set ( CPACK_PACKAGE_CONTACT " someone @ eos . org " <nl> set ( CPACK_OUTPUT_FILE_PREFIX $ { CMAKE_BINARY_DIR } / packages ) <nl> set ( CMAKE_INSTALL_PREFIX $ { CMAKE_BINARY_DIR } / install ) <nl> <nl>
[ cpack ] added mantainer of the packages
EOSIO/eos
219170d34c774a03daf0a2809a20c88e7977ac5e
2018-01-12T15:58:13Z
mmm a / Installation / Jenkins / build . sh <nl> ppp b / Installation / Jenkins / build . sh <nl> <nl> # ! / bin / bash - x <nl> set - e <nl> <nl> + if test - f / scripts / prepare_buildenv . sh ; then <nl> + echo " Sourcing docker container environment settings " <nl> + . / scripts / prepare_buildenv . sh <nl> + fi <nl> if test - z " $ { PARALLEL_BUILDS } " ; then <nl> PARALLEL_BUILDS = 1 <nl> fi <nl>
next try
arangodb/arangodb
65f78714850d81f71db5d8d6bad488d6ebc753bc
2016-07-22T15:34:23Z
mmm a / lib / Serialization / DeserializeSIL . cpp <nl> ppp b / lib / Serialization / DeserializeSIL . cpp <nl> bool SILDeserializer : : readSILInstruction ( SILBasicBlock * BB , <nl> getSILType ( ModuleType : : get ( Mod ) , SILValueCategory : : Object ) ) ; <nl> break ; <nl> } <nl> + case ValueKind : : ProjectExistentialInst : { <nl> + auto Ty = MF - > getType ( TyID ) ; <nl> + auto Ty2 = MF - > getType ( TyID2 ) ; <nl> + ResultVal = Builder . createProjectExistential ( Loc , <nl> + getLocalValue ( ValID , ValResNum , <nl> + getSILType ( Ty2 , ( SILValueCategory ) TyCategory2 ) ) , <nl> + getSILType ( Ty , ( SILValueCategory ) TyCategory ) ) ; <nl> + break ; <nl> + } <nl> + case ValueKind : : ProjectExistentialRefInst : { <nl> + auto Ty = MF - > getType ( TyID ) ; <nl> + ResultVal = Builder . createProjectExistentialRef ( Loc , <nl> + getLocalValue ( ValID , ValResNum , <nl> + getSILType ( Ty , ( SILValueCategory ) TyCategory ) ) ) ; <nl> + break ; <nl> + } <nl> / / Conversion instructions . <nl> case ValueKind : : RefToObjectPointerInst : <nl> case ValueKind : : UpcastInst : <nl> bool SILDeserializer : : readSILInstruction ( SILBasicBlock * BB , <nl> getSILType ( Ty , ( SILValueCategory ) TyCategory ) ) ) ; <nl> break ; <nl> } <nl> + case ValueKind : : StrongRetainAutoreleasedInst : { <nl> + auto Ty = MF - > getType ( TyID ) ; <nl> + ResultVal = Builder . createStrongRetainAutoreleased ( Loc , <nl> + getLocalValue ( ValID , ValResNum , <nl> + getSILType ( Ty , ( SILValueCategory ) TyCategory ) ) ) ; <nl> + break ; <nl> + } <nl> + case ValueKind : : AutoreleaseReturnInst : { <nl> + auto Ty = MF - > getType ( TyID ) ; <nl> + ResultVal = Builder . createAutoreleaseReturn ( Loc , <nl> + getLocalValue ( ValID , ValResNum , <nl> + getSILType ( Ty , ( SILValueCategory ) TyCategory ) ) ) ; <nl> + break ; <nl> + } <nl> + case ValueKind : : StrongRetainUnownedInst : { <nl> + auto Ty = MF - > getType ( TyID ) ; <nl> + ResultVal = Builder . createStrongRetainUnowned ( Loc , <nl> + getLocalValue ( ValID , ValResNum , <nl> + getSILType ( Ty , ( SILValueCategory ) TyCategory ) ) ) ; <nl> + break ; <nl> + } <nl> + case ValueKind : : UnownedRetainInst : { <nl> + auto Ty = MF - > getType ( TyID ) ; <nl> + ResultVal = Builder . createUnownedRetain ( Loc , <nl> + getLocalValue ( ValID , ValResNum , <nl> + getSILType ( Ty , ( SILValueCategory ) TyCategory ) ) ) ; <nl> + break ; <nl> + } <nl> + case ValueKind : : UnownedReleaseInst : { <nl> + auto Ty = MF - > getType ( TyID ) ; <nl> + ResultVal = Builder . createUnownedRelease ( Loc , <nl> + getLocalValue ( ValID , ValResNum , <nl> + getSILType ( Ty , ( SILValueCategory ) TyCategory ) ) ) ; <nl> + break ; <nl> + } <nl> case ValueKind : : StructExtractInst : { <nl> / / Use SILOneValueOneOperandLayout . <nl> VarDecl * Field = cast < VarDecl > ( MF - > getDecl ( ValID ) ) ; <nl> mmm a / lib / Serialization / SerializeSIL . cpp <nl> ppp b / lib / Serialization / SerializeSIL . cpp <nl> void SILSerializer : : writeSILInstruction ( const SILInstruction & SI ) { <nl> case ValueKind : : LoadInst : <nl> case ValueKind : : StrongReleaseInst : <nl> case ValueKind : : StrongRetainInst : <nl> + case ValueKind : : StrongRetainAutoreleasedInst : <nl> + case ValueKind : : AutoreleaseReturnInst : <nl> + case ValueKind : : StrongRetainUnownedInst : <nl> + case ValueKind : : UnownedRetainInst : <nl> + case ValueKind : : UnownedReleaseInst : <nl> case ValueKind : : ReturnInst : { <nl> unsigned abbrCode = SILAbbrCodes [ SILOneOperandLayout : : Code ] ; <nl> SILOneOperandLayout : : emitRecord ( Out , ScratchRecord , abbrCode , <nl> void SILSerializer : : writeSILInstruction ( const SILInstruction & SI ) { <nl> S . addModuleRef ( MT - > getModule ( ) ) , 0 ) ; <nl> break ; <nl> } <nl> + case ValueKind : : ProjectExistentialInst : { <nl> + const ProjectExistentialInst * PEI = cast < ProjectExistentialInst > ( & SI ) ; <nl> + SILOneTypeOneOperandLayout : : emitRecord ( Out , ScratchRecord , <nl> + SILAbbrCodes [ SILOneTypeOneOperandLayout : : Code ] , <nl> + ( unsigned ) SI . getKind ( ) , <nl> + S . addTypeRef ( PEI - > getType ( ) . getSwiftRValueType ( ) ) , <nl> + ( unsigned ) PEI - > getType ( ) . getCategory ( ) , <nl> + S . addTypeRef ( PEI - > getOperand ( ) . getType ( ) . getSwiftRValueType ( ) ) , <nl> + ( unsigned ) PEI - > getOperand ( ) . getType ( ) . getCategory ( ) , <nl> + addValueRef ( PEI - > getOperand ( ) ) , <nl> + PEI - > getOperand ( ) . getResultNumber ( ) ) ; <nl> + break ; <nl> + } <nl> + case ValueKind : : ProjectExistentialRefInst : { <nl> + const ProjectExistentialRefInst * PEI = cast < ProjectExistentialRefInst > ( & SI ) ; <nl> + SILOneOperandLayout : : emitRecord ( Out , ScratchRecord , <nl> + SILAbbrCodes [ SILOneOperandLayout : : Code ] , <nl> + ( unsigned ) SI . getKind ( ) , <nl> + S . addTypeRef ( PEI - > getOperand ( ) . getType ( ) . getSwiftRValueType ( ) ) , <nl> + ( unsigned ) PEI - > getOperand ( ) . getType ( ) . getCategory ( ) , <nl> + addValueRef ( PEI - > getOperand ( ) ) , <nl> + PEI - > getOperand ( ) . getResultNumber ( ) ) ; <nl> + break ; <nl> + } <nl> / / Conversion instructions . <nl> case ValueKind : : RefToObjectPointerInst : <nl> case ValueKind : : UpcastInst : <nl>
SIL Serialization : handle more SILInstructins .
apple/swift
86a0721c48478875d759626db51ae6f090c487f1
2013-09-18T19:51:35Z
mmm a / RestServer / ArangoServer . cpp <nl> ppp b / RestServer / ArangoServer . cpp <nl> void ArangoServer : : buildApplicationServer ( ) { <nl> ( " ruby - console " , " do not start as server , start a Ruby emergency console instead " ) <nl> # endif <nl> ( " unit - tests " , & _unitTests , " do not start as server , run unit tests instead " ) <nl> + ( " jslint " , & _jslint , " do not start as server , run js lint instead " ) <nl> ; <nl> <nl> additional [ ApplicationServer : : OPTIONS_CMDLINE + " : help - extended " ] <nl> void ArangoServer : : buildApplicationServer ( ) { <nl> / / . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . <nl> <nl> if ( _applicationServer - > programOptions ( ) . has ( " console " ) ) { <nl> - int res = executeShell ( false ) ; <nl> + int res = executeShell ( MODE_CONSOLE ) ; <nl> + exit ( res ) ; <nl> + } <nl> + else if ( ! _unitTests . empty ( ) ) { <nl> + int res = executeShell ( MODE_UNITTESTS ) ; <nl> + exit ( res ) ; <nl> + } <nl> + else if ( _applicationServer - > programOptions ( ) . has ( " jslint " ) ) { <nl> + int res = executeShell ( MODE_JSLINT ) ; <nl> exit ( res ) ; <nl> } <nl> <nl> + <nl> # ifdef TRI_ENABLE_MRUBY <nl> if ( _applicationServer - > programOptions ( ) . has ( " ruby - console " ) ) { <nl> int res = executeRubyShell ( ) ; <nl> void ArangoServer : : buildApplicationServer ( ) { <nl> } <nl> # endif <nl> <nl> - if ( ! _unitTests . empty ( ) ) { <nl> - int res = executeShell ( true ) ; <nl> - exit ( res ) ; <nl> - } <nl> - <nl> / / . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . <nl> / / sanity checks <nl> / / . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . <nl> int ArangoServer : : startupServer ( ) { <nl> / / / @ brief executes the JavaScript emergency console <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> <nl> - int ArangoServer : : executeShell ( bool tests ) { <nl> + int ArangoServer : : executeShell ( operation_mode_e mode ) { <nl> v8 : : Isolate * isolate ; <nl> v8 : : Persistent < v8 : : Context > context ; <nl> bool ok ; <nl> int ArangoServer : : executeShell ( bool tests ) { <nl> ok = StartupLoader . loadScript ( context , files [ i ] ) ; <nl> <nl> if ( ok ) { <nl> - LOGGER_TRACE < < " loaded json file ' " < < files [ i ] < < " ' " ; <nl> + LOGGER_TRACE < < " loaded js file ' " < < files [ i ] < < " ' " ; <nl> } <nl> else { <nl> - LOGGER_FATAL < < " cannot load json file ' " < < files [ i ] < < " ' " ; <nl> + LOGGER_FATAL < < " cannot load js file ' " < < files [ i ] < < " ' " ; <nl> TRI_FlushLogging ( ) ; <nl> return EXIT_FAILURE ; <nl> } <nl> int ArangoServer : : executeShell ( bool tests ) { <nl> <nl> ok = true ; <nl> <nl> - / / run all unit tests <nl> - if ( tests ) { <nl> - v8 : : HandleScope scope ; <nl> - v8 : : TryCatch tryCatch ; <nl> + switch ( mode ) { <nl> + case MODE_UNITTESTS : { <nl> + / / run all unit tests <nl> + v8 : : HandleScope scope ; <nl> + v8 : : TryCatch tryCatch ; <nl> <nl> - / / set - up unit tests array <nl> - v8 : : Handle < v8 : : Array > sysTestFiles = v8 : : Array : : New ( ) ; <nl> + / / set - up unit tests array <nl> + v8 : : Handle < v8 : : Array > sysTestFiles = v8 : : Array : : New ( ) ; <nl> <nl> - for ( size_t i = 0 ; i < _unitTests . size ( ) ; + + i ) { <nl> - sysTestFiles - > Set ( ( uint32_t ) i , v8 : : String : : New ( _unitTests [ i ] . c_str ( ) ) ) ; <nl> - } <nl> + for ( size_t i = 0 ; i < _unitTests . size ( ) ; + + i ) { <nl> + sysTestFiles - > Set ( ( uint32_t ) i , v8 : : String : : New ( _unitTests [ i ] . c_str ( ) ) ) ; <nl> + } <nl> <nl> - context - > Global ( ) - > Set ( v8 : : String : : New ( " SYS_UNIT_TESTS " ) , sysTestFiles ) ; <nl> - context - > Global ( ) - > Set ( v8 : : String : : New ( " SYS_UNIT_TESTS_RESULT " ) , v8 : : True ( ) ) ; <nl> + context - > Global ( ) - > Set ( v8 : : String : : New ( " SYS_UNIT_TESTS " ) , sysTestFiles ) ; <nl> + context - > Global ( ) - > Set ( v8 : : String : : New ( " SYS_UNIT_TESTS_RESULT " ) , v8 : : True ( ) ) ; <nl> <nl> - / / run tests <nl> - char const * input = " require ( \ " jsunity \ " ) . runCommandLineTests ( ) ; " ; <nl> - TRI_ExecuteJavaScriptString ( context , v8 : : String : : New ( input ) , name , true ) ; <nl> + / / run tests <nl> + char const * input = " require ( \ " jsunity \ " ) . runCommandLineTests ( ) ; " ; <nl> + TRI_ExecuteJavaScriptString ( context , v8 : : String : : New ( input ) , name , true ) ; <nl> <nl> - if ( tryCatch . HasCaught ( ) ) { <nl> - cout < < TRI_StringifyV8Exception ( & tryCatch ) ; <nl> - ok = false ; <nl> - } <nl> - else { <nl> - ok = TRI_ObjectToBoolean ( context - > Global ( ) - > Get ( v8 : : String : : New ( " SYS_UNIT_TESTS_RESULT " ) ) ) ; <nl> - } <nl> - } <nl> - <nl> - / / run a shell <nl> - else { <nl> - V8LineEditor * console = new V8LineEditor ( context , " . arango " ) ; <nl> - <nl> - console - > open ( true ) ; <nl> - <nl> - while ( true ) { <nl> - while ( ! v8 : : V8 : : IdleNotification ( ) ) { <nl> + if ( tryCatch . HasCaught ( ) ) { <nl> + cout < < TRI_StringifyV8Exception ( & tryCatch ) ; <nl> + ok = false ; <nl> } <nl> - <nl> - char * input = console - > prompt ( " arangod > " ) ; <nl> - <nl> - if ( input = = 0 ) { <nl> - printf ( " < ctrl - D > \ nBye Bye ! Auf Wiedersehen ! До свидания ! さようなら \ n " ) ; <nl> - break ; <nl> + else { <nl> + ok = TRI_ObjectToBoolean ( context - > Global ( ) - > Get ( v8 : : String : : New ( " SYS_UNIT_TESTS_RESULT " ) ) ) ; <nl> } <nl> <nl> - if ( * input = = ' \ 0 ' ) { <nl> - TRI_FreeString ( TRI_CORE_MEM_ZONE , input ) ; <nl> - continue ; <nl> - } <nl> - <nl> - console - > addHistory ( input ) ; <nl> + break ; <nl> + } <nl> <nl> + case MODE_JSLINT : { <nl> + / / run jslint <nl> v8 : : HandleScope scope ; <nl> v8 : : TryCatch tryCatch ; <nl> + <nl> + / / set - up tests files array <nl> + v8 : : Handle < v8 : : Array > sysTestFiles = v8 : : Array : : New ( ) ; <nl> + for ( size_t i = 0 ; i < _jslint . size ( ) ; + + i ) { <nl> + sysTestFiles - > Set ( ( uint32_t ) i , v8 : : String : : New ( _jslint [ i ] . c_str ( ) ) ) ; <nl> + } <nl> + <nl> + context - > Global ( ) - > Set ( v8 : : String : : New ( " SYS_UNIT_TESTS " ) , sysTestFiles ) ; <nl> + context - > Global ( ) - > Set ( v8 : : String : : New ( " SYS_UNIT_TESTS_RESULT " ) , v8 : : True ( ) ) ; <nl> <nl> + char const * input = " require ( \ " jslint \ " ) . runCommandLineTests ( { } ) ; " ; <nl> TRI_ExecuteJavaScriptString ( context , v8 : : String : : New ( input ) , name , true ) ; <nl> - TRI_FreeString ( TRI_UNKNOWN_MEM_ZONE , input ) ; <nl> - <nl> if ( tryCatch . HasCaught ( ) ) { <nl> cout < < TRI_StringifyV8Exception ( & tryCatch ) ; <nl> + ok = false ; <nl> + } <nl> + else { <nl> + ok = TRI_ObjectToBoolean ( context - > Global ( ) - > Get ( v8 : : String : : New ( " SYS_UNIT_TESTS_RESULT " ) ) ) ; <nl> } <nl> + <nl> + break ; <nl> } <nl> <nl> - console - > close ( ) ; <nl> + case MODE_CONSOLE : { <nl> + / / run a shell <nl> + V8LineEditor * console = new V8LineEditor ( context , " . arango " ) ; <nl> + <nl> + console - > open ( true ) ; <nl> + <nl> + while ( true ) { <nl> + while ( ! v8 : : V8 : : IdleNotification ( ) ) { <nl> + } <nl> + <nl> + char * input = console - > prompt ( " arangod > " ) ; <nl> + <nl> + if ( input = = 0 ) { <nl> + printf ( " < ctrl - D > \ nBye Bye ! Auf Wiedersehen ! До свидания ! さようなら \ n " ) ; <nl> + break ; <nl> + } <nl> + <nl> + if ( * input = = ' \ 0 ' ) { <nl> + TRI_FreeString ( TRI_CORE_MEM_ZONE , input ) ; <nl> + continue ; <nl> + } <nl> + <nl> + console - > addHistory ( input ) ; <nl> + <nl> + v8 : : HandleScope scope ; <nl> + v8 : : TryCatch tryCatch ; <nl> + <nl> + TRI_ExecuteJavaScriptString ( context , v8 : : String : : New ( input ) , name , true ) ; <nl> + TRI_FreeString ( TRI_UNKNOWN_MEM_ZONE , input ) ; <nl> + <nl> + if ( tryCatch . HasCaught ( ) ) { <nl> + cout < < TRI_StringifyV8Exception ( & tryCatch ) ; <nl> + } <nl> + } <nl> + <nl> + console - > close ( ) ; <nl> + <nl> + delete console ; <nl> + <nl> + break ; <nl> + } <nl> <nl> - delete console ; <nl> } <nl> + <nl> <nl> / / and return from the context and isolate <nl> context - > Exit ( ) ; <nl> mmm a / RestServer / ArangoServer . h <nl> ppp b / RestServer / ArangoServer . h <nl> namespace triagens { <nl> namespace triagens { <nl> namespace arango { <nl> <nl> + typedef enum { <nl> + MODE_CONSOLE = 1 , <nl> + MODE_UNITTESTS , <nl> + MODE_JSLINT , <nl> + } <nl> + operation_mode_e ; <nl> + <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> / / / @ brief ArangoDB server <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> namespace triagens { <nl> / / / @ brief executes the JavaScript emergency console <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> <nl> - int executeShell ( bool tests ) ; <nl> + int executeShell ( operation_mode_e ) ; <nl> <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> / / / @ brief executes the ruby emergency console <nl> namespace triagens { <nl> <nl> vector < string > _unitTests ; <nl> <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + / / / @ brief js lint <nl> + / / / <nl> + / / / @ CMDOPT { - - jslint @ CA { test - file } } <nl> + / / / <nl> + / / / Runs jslint on one or more files . <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + <nl> + vector < string > _jslint ; <nl> + <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> / / / @ brief vocbase <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> new file mode 100644 <nl> index 00000000000 . . faf97b4292b <nl> mmm / dev / null <nl> ppp b / js / common / modules / jslint . js <nl> <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + / / / @ brief JSUnity wrapper <nl> + / / / <nl> + / / / @ file <nl> + / / / <nl> + / / / DISCLAIMER <nl> + / / / <nl> + / / / Copyright 2010 - 2012 triagens GmbH , Cologne , Germany <nl> + / / / <nl> + / / / Licensed under the Apache License , Version 2 . 0 ( the " License " ) ; <nl> + / / / you may not use this file except in compliance with the License . <nl> + / / / You may obtain a copy of the License at <nl> + / / / <nl> + / / / http : / / www . apache . org / licenses / LICENSE - 2 . 0 <nl> + / / / <nl> + / / / Unless required by applicable law or agreed to in writing , software <nl> + / / / distributed under the License is distributed on an " AS IS " BASIS , <nl> + / / / WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND , either express or implied . <nl> + / / / See the License for the specific language governing permissions and <nl> + / / / limitations under the License . <nl> + / / / <nl> + / / / Copyright holder is triAGENS GmbH , Cologne , Germany <nl> + / / / <nl> + / / / @ author Dr . Frank Celler <nl> + / / / @ author Copyright 2012 , triAGENS GmbH , Cologne , Germany <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + <nl> + var internal = require ( " internal " ) ; <nl> + var console = require ( " console " ) ; <nl> + <nl> + internal . loadFile ( " jslint / jslint " ) ; <nl> + <nl> + / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> + / / - - SECTION - - public functions <nl> + / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> + <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + / / / @ addtogroup JSLint <nl> + / / / @ { <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + / / / @ brief runs a JSLint test on a file <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + <nl> + function RunTest ( path , options ) { <nl> + var content ; <nl> + <nl> + try { <nl> + content = SYS_READ ( path ) ; <nl> + } <nl> + catch ( err ) { <nl> + console . error ( " cannot load test file ' % s ' " , path ) ; <nl> + return ; <nl> + } <nl> + <nl> + var result = { } ; <nl> + result [ " passed " ] = JSLINT ( content , options ) ; <nl> + <nl> + if ( JSLINT . errors ) { <nl> + result [ " errors " ] = JSLINT . errors ; <nl> + } <nl> + <nl> + return result ; <nl> + } <nl> + <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + / / / @ brief runs tests from command - line <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + <nl> + function RunCommandLineTests ( options ) { <nl> + var result = true ; <nl> + <nl> + for ( var i = 0 ; i < SYS_UNIT_TESTS . length ; + + i ) { <nl> + var file = SYS_UNIT_TESTS [ i ] ; <nl> + <nl> + try { <nl> + var testResult = RunTest ( file , options ) ; <nl> + result = result & & testResult [ " passed " ] ; <nl> + if ( ! testResult [ " passed " ] & & testResult [ " errors " ] ) { <nl> + for ( var i = 0 ; i < testResult [ " errors " ] . length ; + + i ) { <nl> + var err = testResult [ " errors " ] [ i ] ; <nl> + if ( ! err ) { <nl> + continue ; <nl> + } <nl> + <nl> + var position = file + " : " + err [ " line " ] + " , " + err [ " character " ] ; <nl> + var reason = err [ " reason " ] ; <nl> + console . error ( " jslint : % s : % s " , position , reason ) ; <nl> + } <nl> + } <nl> + else { <nl> + console . info ( " jslint : % s passed " , file ) ; <nl> + } <nl> + } <nl> + catch ( err ) { <nl> + print ( " cannot run test file ' " + file + " ' : " + err ) ; <nl> + print ( err . stack ) ; <nl> + result = false ; <nl> + } <nl> + } <nl> + <nl> + <nl> + SYS_UNIT_TESTS_RESULT = result ; <nl> + } <nl> + <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + / / / @ } <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + <nl> + / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> + / / - - SECTION - - MODULE EXPORTS <nl> + / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> + <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + / / / @ addtogroup JSLint <nl> + / / / @ { <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + <nl> + exports . runTest = RunTest ; <nl> + exports . runCommandLineTests = RunCommandLineTests ; <nl> + <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + / / / @ } <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + <nl> + / / Local Variables : <nl> + / / mode : outline - minor <nl> + / / outline - regexp : " ^ \ \ ( / / / @ brief \ \ | / / / @ addtogroup \ \ | / / - - SECTION - - \ \ | / / / @ page \ \ | / / / @ } \ \ ) " <nl> + / / End : <nl> new file mode 100644 <nl> index 00000000000 . . db95cfc73bf <nl> mmm / dev / null <nl> ppp b / js / common / modules / jslint / jslint . js <nl> <nl> + / / jslint . js <nl> + / / 2012 - 05 - 09 <nl> + <nl> + / / Copyright ( c ) 2002 Douglas Crockford ( www . JSLint . com ) <nl> + <nl> + / / Permission is hereby granted , free of charge , to any person obtaining a copy <nl> + / / of this software and associated documentation files ( the " Software " ) , to deal <nl> + / / in the Software without restriction , including without limitation the rights <nl> + / / to use , copy , modify , merge , publish , distribute , sublicense , and / or sell <nl> + / / copies of the Software , and to permit persons to whom the Software is <nl> + / / furnished to do so , subject to the following conditions : <nl> + <nl> + / / The above copyright notice and this permission notice shall be included in <nl> + / / all copies or substantial portions of the Software . <nl> + <nl> + / / The Software shall be used for Good , not Evil . <nl> + <nl> + / / THE SOFTWARE IS PROVIDED " AS IS " , WITHOUT WARRANTY OF ANY KIND , EXPRESS OR <nl> + / / IMPLIED , INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY , <nl> + / / FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT . IN NO EVENT SHALL THE <nl> + / / AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM , DAMAGES OR OTHER <nl> + / / LIABILITY , WHETHER IN AN ACTION OF CONTRACT , TORT OR OTHERWISE , ARISING FROM , <nl> + / / OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE <nl> + / / SOFTWARE . <nl> + <nl> + / / WARNING : JSLint will hurt your feelings . <nl> + <nl> + / / JSLINT is a global function . It takes two parameters . <nl> + <nl> + / / var myResult = JSLINT ( source , option ) ; <nl> + <nl> + / / The first parameter is either a string or an array of strings . If it is a <nl> + / / string , it will be split on ' \ n ' or ' \ r ' . If it is an array of strings , it <nl> + / / is assumed that each string represents one line . The source can be a <nl> + / / JavaScript text , or HTML text , or a JSON text , or a CSS text . <nl> + <nl> + / / The second parameter is an optional object of options that control the <nl> + / / operation of JSLINT . Most of the options are booleans : They are all <nl> + / / optional and have a default value of false . One of the options , predef , <nl> + / / can be an array of names , which will be used to declare global variables , <nl> + / / or an object whose keys are used as global names , with a boolean value <nl> + / / that determines if they are assignable . <nl> + <nl> + / / If it checks out , JSLINT returns true . Otherwise , it returns false . <nl> + <nl> + / / If false , you can inspect JSLINT . errors to find out the problems . <nl> + / / JSLINT . errors is an array of objects containing these properties : <nl> + <nl> + / / { <nl> + / / line : The line ( relative to 0 ) at which the lint was found <nl> + / / character : The character ( relative to 0 ) at which the lint was found <nl> + / / reason : The problem <nl> + / / evidence : The text line in which the problem occurred <nl> + / / raw : The raw message before the details were inserted <nl> + / / a : The first detail <nl> + / / b : The second detail <nl> + / / c : The third detail <nl> + / / d : The fourth detail <nl> + / / } <nl> + <nl> + / / If a stopping error was found , a null will be the last element of the <nl> + / / JSLINT . errors array . A stopping error means that JSLint was not confident <nl> + / / enough to continue . It does not necessarily mean that the error was <nl> + / / especially heinous . <nl> + <nl> + / / You can request a data structure that contains JSLint ' s results . <nl> + <nl> + / / var myData = JSLINT . data ( ) ; <nl> + <nl> + / / It returns a structure with this form : <nl> + <nl> + / / { <nl> + / / errors : [ <nl> + / / { <nl> + / / line : NUMBER , <nl> + / / character : NUMBER , <nl> + / / reason : STRING , <nl> + / / evidence : STRING <nl> + / / } <nl> + / / ] , <nl> + / / functions : [ <nl> + / / { <nl> + / / name : STRING , <nl> + / / line : NUMBER , <nl> + / / last : NUMBER , <nl> + / / params : [ <nl> + / / { <nl> + / / string : STRING <nl> + / / } <nl> + / / ] , <nl> + / / closure : [ <nl> + / / STRING <nl> + / / ] , <nl> + / / var : [ <nl> + / / STRING <nl> + / / ] , <nl> + / / exception : [ <nl> + / / STRING <nl> + / / ] , <nl> + / / outer : [ <nl> + / / STRING <nl> + / / ] , <nl> + / / unused : [ <nl> + / / STRING <nl> + / / ] , <nl> + / / undef : [ <nl> + / / STRING <nl> + / / ] , <nl> + / / global : [ <nl> + / / STRING <nl> + / / ] , <nl> + / / label : [ <nl> + / / STRING <nl> + / / ] <nl> + / / } <nl> + / / ] , <nl> + / / globals : [ <nl> + / / STRING <nl> + / / ] , <nl> + / / member : { <nl> + / / STRING : NUMBER <nl> + / / } , <nl> + / / urls : [ <nl> + / / STRING <nl> + / / ] , <nl> + / / json : BOOLEAN <nl> + / / } <nl> + <nl> + / / Empty arrays will not be included . <nl> + <nl> + / / You can request a Function Report , which shows all of the functions <nl> + / / and the parameters and vars that they use . This can be used to find <nl> + / / implied global variables and other problems . The report is in HTML and <nl> + / / can be inserted in an HTML < body > . It should be given the result of the <nl> + / / JSLINT . data function . <nl> + <nl> + / / var myReport = JSLINT . report ( data ) ; <nl> + <nl> + / / You can request an HTML error report . <nl> + <nl> + / / var myErrorReport = JSLINT . error_report ( data ) ; <nl> + <nl> + / / You can request a properties report , which produces a list of the program ' s <nl> + / / properties in the form of a / * properties * / declaration . <nl> + <nl> + / / var myPropertyReport = properties_report ( JSLINT . property ) ; <nl> + <nl> + / / You can obtain the parse tree that JSLint constructed while parsing . The <nl> + / / latest tree is kept in JSLINT . tree . A nice stringication can be produced <nl> + / / with <nl> + <nl> + / / JSON . stringify ( JSLINT . tree , [ <nl> + / / ' string ' , ' arity ' , ' name ' , ' first ' , <nl> + / / ' second ' , ' third ' , ' block ' , ' else ' <nl> + / / ] , 4 ) ) ; <nl> + <nl> + / / JSLint provides three directives . They look like slashstar comments , and <nl> + / / allow for setting options , declaring global variables , and establishing a <nl> + / / set of allowed property names . <nl> + <nl> + / / These directives respect function scope . <nl> + <nl> + / / The jslint directive is a special comment that can set one or more options . <nl> + / / The current option set is <nl> + <nl> + / / anon true , if the space may be omitted in anonymous function declarations <nl> + / / bitwise true , if bitwise operators should be allowed <nl> + / / browser true , if the standard browser globals should be predefined <nl> + / / cap true , if upper case HTML should be allowed <nl> + / / ' continue ' true , if the continuation statement should be tolerated <nl> + / / css true , if CSS workarounds should be tolerated <nl> + / / debug true , if debugger statements should be allowed <nl> + / / devel true , if logging should be allowed ( console , alert , etc . ) <nl> + / / eqeq true , if = = should be allowed <nl> + / / es5 true , if ES5 syntax should be allowed <nl> + / / evil true , if eval should be allowed <nl> + / / forin true , if for in statements need not filter <nl> + / / fragment true , if HTML fragments should be allowed <nl> + / / indent the indentation factor <nl> + / / maxerr the maximum number of errors to allow <nl> + / / maxlen the maximum length of a source line <nl> + / / newcap true , if constructor names capitalization is ignored <nl> + / / node true , if Node . js globals should be predefined <nl> + / / nomen true , if names may have dangling _ <nl> + / / on true , if HTML event handlers should be allowed <nl> + / / passfail true , if the scan should stop on first error <nl> + / / plusplus true , if increment / decrement should be allowed <nl> + / / properties true , if all property names must be declared with / * properties * / <nl> + / / regexp true , if the . should be allowed in regexp literals <nl> + / / rhino true , if the Rhino environment globals should be predefined <nl> + / / undef true , if variables can be declared out of order <nl> + / / unparam true , if unused parameters should be tolerated <nl> + / / sloppy true , if the ' use strict ' ; pragma is optional <nl> + / / stupid true , if really stupid practices are tolerated <nl> + / / sub true , if all forms of subscript notation are tolerated <nl> + / / vars true , if multiple var statements per function should be allowed <nl> + / / white true , if sloppy whitespace is tolerated <nl> + / / windows true , if MS Windows - specific globals should be predefined <nl> + <nl> + / / For example : <nl> + <nl> + / * jslint <nl> + evil : true , nomen : true , regexp : true <nl> + * / <nl> + <nl> + / / The properties directive declares an exclusive list of property names . <nl> + / / Any properties named in the program that are not in the list will <nl> + / / produce a warning . <nl> + <nl> + / / For example : <nl> + <nl> + / * properties <nl> + ' \ b ' , ' \ t ' , ' \ n ' , ' \ f ' , ' \ r ' , ' ! ' , ' ! = ' , ' ! = = ' , ' " ' , ' % ' , ' \ ' ' , <nl> + ' ( arguments ) ' , ' ( begin ) ' , ' ( breakage ) ' , ' ( context ) ' , ' ( error ) ' , <nl> + ' ( identifier ) ' , ' ( line ) ' , ' ( loopage ) ' , ' ( name ) ' , ' ( params ) ' , ' ( scope ) ' , <nl> + ' ( token ) ' , ' ( vars ) ' , ' ( verb ) ' , ' * ' , ' + ' , ' - ' , ' / ' , ' < ' , ' < = ' , ' = = ' , ' = = = ' , <nl> + ' > ' , ' > = ' , ADSAFE , Array , Date , Function , Object , ' \ \ ' , a , a_label , <nl> + a_not_allowed , a_not_defined , a_scope , abbr , acronym , address , adsafe , <nl> + adsafe_a , adsafe_autocomplete , adsafe_bad_id , adsafe_div , adsafe_fragment , <nl> + adsafe_go , adsafe_html , adsafe_id , adsafe_id_go , adsafe_lib , <nl> + adsafe_lib_second , adsafe_missing_id , adsafe_name_a , adsafe_placement , <nl> + adsafe_prefix_a , adsafe_script , adsafe_source , adsafe_subscript_a , <nl> + adsafe_tag , all , already_defined , and , anon , applet , apply , approved , area , <nl> + arity , article , aside , assign , assign_exception , <nl> + assignment_function_expression , at , attribute_case_a , audio , autocomplete , <nl> + avoid_a , b , background , ' background - attachment ' , ' background - color ' , <nl> + ' background - image ' , ' background - position ' , ' background - repeat ' , <nl> + bad_assignment , bad_color_a , bad_constructor , bad_entity , bad_html , bad_id_a , <nl> + bad_in_a , bad_invocation , bad_name_a , bad_new , bad_number , bad_operand , <nl> + bad_style , bad_type , bad_url_a , bad_wrap , base , bdo , big , bitwise , block , <nl> + blockquote , body , border , ' border - bottom ' , ' border - bottom - color ' , <nl> + ' border - bottom - left - radius ' , ' border - bottom - right - radius ' , <nl> + ' border - bottom - style ' , ' border - bottom - width ' , ' border - collapse ' , <nl> + ' border - color ' , ' border - left ' , ' border - left - color ' , ' border - left - style ' , <nl> + ' border - left - width ' , ' border - radius ' , ' border - right ' , ' border - right - color ' , <nl> + ' border - right - style ' , ' border - right - width ' , ' border - spacing ' , ' border - style ' , <nl> + ' border - top ' , ' border - top - color ' , ' border - top - left - radius ' , <nl> + ' border - top - right - radius ' , ' border - top - style ' , ' border - top - width ' , <nl> + ' border - width ' , bottom , ' box - shadow ' , br , braille , browser , button , c , call , <nl> + canvas , cap , caption , ' caption - side ' , center , charAt , charCodeAt , character , <nl> + cite , clear , clip , closure , cm , code , col , colgroup , color , combine_var , <nl> + command , conditional_assignment , confusing_a , confusing_regexp , <nl> + constructor_name_a , content , continue , control_a , ' counter - increment ' , <nl> + ' counter - reset ' , create , css , cursor , d , dangerous_comment , dangling_a , data , <nl> + datalist , dd , debug , del , deleted , details , devel , dfn , dialog , dir , <nl> + direction , display , disrupt , div , dl , dt , duplicate_a , edge , edition , else , <nl> + em , embed , embossed , empty , ' empty - cells ' , empty_block , empty_case , <nl> + empty_class , entityify , eqeq , error_report , errors , es5 , eval , evidence , <nl> + evil , ex , exception , exec , expected_a , expected_a_at_b_c , expected_a_b , <nl> + expected_a_b_from_c_d , expected_at_a , expected_attribute_a , <nl> + expected_attribute_value_a , expected_class_a , expected_fraction_a , <nl> + expected_id_a , expected_identifier_a , expected_identifier_a_reserved , <nl> + expected_lang_a , expected_linear_a , expected_media_a , expected_name_a , <nl> + expected_nonstandard_style_attribute , expected_number_a , expected_operator_a , <nl> + expected_percent_a , expected_positive_a , expected_pseudo_a , <nl> + expected_selector_a , expected_small_a , expected_space_a_b , expected_string_a , <nl> + expected_style_attribute , expected_style_pattern , expected_tagname_a , <nl> + expected_type_a , f , fieldset , figure , filter , first , flag , float , floor , <nl> + font , ' font - family ' , ' font - size ' , ' font - size - adjust ' , ' font - stretch ' , <nl> + ' font - style ' , ' font - variant ' , ' font - weight ' , footer , forEach , for_if , forin , <nl> + form , fragment , frame , frameset , from , fromCharCode , fud , funct , function , <nl> + function_block , function_eval , function_loop , function_statement , <nl> + function_strict , functions , global , globals , h1 , h2 , h3 , h4 , h5 , h6 , <nl> + handheld , hasOwnProperty , head , header , height , hgroup , hr , <nl> + ' hta : application ' , html , html_confusion_a , html_handlers , i , id , identifier , <nl> + identifier_function , iframe , img , immed , implied_evil , in , indent , indexOf , <nl> + infix_in , init , input , ins , insecure_a , isAlpha , isArray , isDigit , isNaN , <nl> + join , jslint , json , kbd , keygen , keys , label , labeled , lang , lbp , <nl> + leading_decimal_a , led , left , legend , length , ' letter - spacing ' , li , lib , <nl> + line , ' line - height ' , link , ' list - style ' , ' list - style - image ' , <nl> + ' list - style - position ' , ' list - style - type ' , map , margin , ' margin - bottom ' , <nl> + ' margin - left ' , ' margin - right ' , ' margin - top ' , mark , ' marker - offset ' , match , <nl> + ' max - height ' , ' max - width ' , maxerr , maxlen , menu , message , meta , meter , <nl> + ' min - height ' , ' min - width ' , missing_a , missing_a_after_b , missing_option , <nl> + missing_property , missing_space_a_b , missing_url , missing_use_strict , mixed , <nl> + mm , mode , move_invocation , move_var , n , name , name_function , nav , <nl> + nested_comment , newcap , node , noframes , nomen , noscript , not , <nl> + not_a_constructor , not_a_defined , not_a_function , not_a_label , not_a_scope , <nl> + not_greater , nud , number , object , octal_a , ol , on , opacity , open , optgroup , <nl> + option , outer , outline , ' outline - color ' , ' outline - style ' , ' outline - width ' , <nl> + output , overflow , ' overflow - x ' , ' overflow - y ' , p , padding , ' padding - bottom ' , <nl> + ' padding - left ' , ' padding - right ' , ' padding - top ' , ' page - break - after ' , <nl> + ' page - break - before ' , param , parameter_a_get_b , parameter_arguments_a , <nl> + parameter_set_a , params , paren , parent , passfail , pc , plusplus , pop , <nl> + position , postscript , pre , predef , print , progress , projection , properties , <nl> + properties_report , property , prototype , pt , push , px , q , quote , quotes , r , <nl> + radix , range , raw , read_only , reason , redefinition_a , regexp , replace , <nl> + report , reserved , reserved_a , rhino , right , rp , rt , ruby , safe , samp , <nl> + scanned_a_b , screen , script , search , second , section , select , shift , <nl> + slash_equal , slice , sloppy , small , sort , source , span , speech , split , src , <nl> + statement_block , stopping , strange_loop , strict , string , strong , stupid , <nl> + style , styleproperty , sub , subscript , substr , sup , supplant , sync_a , t , <nl> + table , ' table - layout ' , tag_a_in_b , tbody , td , test , ' text - align ' , <nl> + ' text - decoration ' , ' text - indent ' , ' text - shadow ' , ' text - transform ' , textarea , <nl> + tfoot , th , thead , third , thru , time , title , toLowerCase , toString , <nl> + toUpperCase , token , too_long , too_many , top , tr , trailing_decimal_a , tree , <nl> + tt , tty , tv , type , u , ul , unclosed , unclosed_comment , unclosed_regexp , undef , <nl> + undefined , unescaped_a , unexpected_a , unexpected_char_a_b , <nl> + unexpected_comment , unexpected_else , unexpected_label_a , <nl> + unexpected_property_a , unexpected_space_a_b , ' unicode - bidi ' , <nl> + unnecessary_initialize , unnecessary_use , unparam , unreachable_a_b , <nl> + unrecognized_style_attribute_a , unrecognized_tag_a , unsafe , unused , url , <nl> + urls , use_array , use_braces , use_charAt , use_object , use_or , use_param , <nl> + used_before_a , var , var_a_not , vars , ' vertical - align ' , video , visibility , <nl> + was , weird_assignment , weird_condition , weird_new , weird_program , <nl> + weird_relation , weird_ternary , white , ' white - space ' , width , windows , <nl> + ' word - spacing ' , ' word - wrap ' , wrap , wrap_immediate , wrap_regexp , <nl> + write_is_wrong , writeable , ' z - index ' <nl> + * / <nl> + <nl> + / / The global directive is used to declare global variables that can <nl> + / / be accessed by the program . If a declaration is true , then the variable <nl> + / / is writeable . Otherwise , it is read - only . <nl> + <nl> + / / We build the application inside a function so that we produce only a single <nl> + / / global variable . That function will be invoked immediately , and its return <nl> + / / value is the JSLINT function itself . That function is also an object that <nl> + / / can contain data and other functions . <nl> + <nl> + var JSLINT = ( function ( ) { <nl> + ' use strict ' ; <nl> + <nl> + function array_to_object ( array , value ) { <nl> + <nl> + / / Make an object from an array of keys and a common value . <nl> + <nl> + var i , length = array . length , object = { } ; <nl> + for ( i = 0 ; i < length ; i + = 1 ) { <nl> + object [ array [ i ] ] = value ; <nl> + } <nl> + return object ; <nl> + } <nl> + <nl> + <nl> + var adsafe_id , / / The widget ' s ADsafe id . <nl> + adsafe_may , / / The widget may load approved scripts . <nl> + adsafe_top , / / At the top of the widget script . <nl> + adsafe_went , / / ADSAFE . go has been called . <nl> + allowed_option = { <nl> + anon : true , <nl> + bitwise : true , <nl> + browser : true , <nl> + cap : true , <nl> + ' continue ' : true , <nl> + css : true , <nl> + debug : true , <nl> + devel : true , <nl> + eqeq : true , <nl> + es5 : true , <nl> + evil : true , <nl> + forin : true , <nl> + fragment : true , <nl> + indent : 10 , <nl> + maxerr : 1000 , <nl> + maxlen : 256 , <nl> + newcap : true , <nl> + node : true , <nl> + nomen : true , <nl> + on : true , <nl> + passfail : true , <nl> + plusplus : true , <nl> + properties : true , <nl> + regexp : true , <nl> + rhino : true , <nl> + undef : true , <nl> + unparam : true , <nl> + sloppy : true , <nl> + stupid : true , <nl> + sub : true , <nl> + vars : true , <nl> + white : true , <nl> + windows : true <nl> + } , <nl> + anonname , / / The guessed name for anonymous functions . <nl> + approved , / / ADsafe approved urls . <nl> + <nl> + / / These are operators that should not be used with the ! operator . <nl> + <nl> + bang = { <nl> + ' < ' : true , <nl> + ' < = ' : true , <nl> + ' = = ' : true , <nl> + ' = = = ' : true , <nl> + ' ! = = ' : true , <nl> + ' ! = ' : true , <nl> + ' > ' : true , <nl> + ' > = ' : true , <nl> + ' + ' : true , <nl> + ' - ' : true , <nl> + ' * ' : true , <nl> + ' / ' : true , <nl> + ' % ' : true <nl> + } , <nl> + <nl> + / / These are property names that should not be permitted in the safe subset . <nl> + <nl> + banned = array_to_object ( [ <nl> + ' arguments ' , ' callee ' , ' caller ' , ' constructor ' , ' eval ' , ' prototype ' , <nl> + ' stack ' , ' unwatch ' , ' valueOf ' , ' watch ' <nl> + ] , true ) , <nl> + begin , / / The root token <nl> + <nl> + / / browser contains a set of global names that are commonly provided by a <nl> + / / web browser environment . <nl> + <nl> + browser = array_to_object ( [ <nl> + ' clearInterval ' , ' clearTimeout ' , ' document ' , ' event ' , ' FormData ' , <nl> + ' frames ' , ' history ' , ' Image ' , ' localStorage ' , ' location ' , ' name ' , <nl> + ' navigator ' , ' Option ' , ' parent ' , ' screen ' , ' sessionStorage ' , <nl> + ' setInterval ' , ' setTimeout ' , ' Storage ' , ' window ' , ' XMLHttpRequest ' <nl> + ] , false ) , <nl> + <nl> + / / bundle contains the text messages . <nl> + <nl> + bundle = { <nl> + a_label : " ' { a } ' is a statement label . " , <nl> + a_not_allowed : " ' { a } ' is not allowed . " , <nl> + a_not_defined : " ' { a } ' is not defined . " , <nl> + a_scope : " ' { a } ' used out of scope . " , <nl> + adsafe_a : " ADsafe violation : ' { a } ' . " , <nl> + adsafe_autocomplete : " ADsafe autocomplete violation . " , <nl> + adsafe_bad_id : " ADSAFE violation : bad id . " , <nl> + adsafe_div : " ADsafe violation : Wrap the widget in a div . " , <nl> + adsafe_fragment : " ADSAFE : Use the fragment option . " , <nl> + adsafe_go : " ADsafe violation : Misformed ADSAFE . go . " , <nl> + adsafe_html : " Currently , ADsafe does not operate on whole HTML " + <nl> + " documents . It operates on < div > fragments and . js files . " , <nl> + adsafe_id : " ADsafe violation : id does not match . " , <nl> + adsafe_id_go : " ADsafe violation : Missing ADSAFE . id or ADSAFE . go . " , <nl> + adsafe_lib : " ADsafe lib violation . " , <nl> + adsafe_lib_second : " ADsafe : The second argument to lib must be a function . " , <nl> + adsafe_missing_id : " ADSAFE violation : missing ID_ . " , <nl> + adsafe_name_a : " ADsafe name violation : ' { a } ' . " , <nl> + adsafe_placement : " ADsafe script placement violation . " , <nl> + adsafe_prefix_a : " ADsafe violation : An id must have a ' { a } ' prefix " , <nl> + adsafe_script : " ADsafe script violation . " , <nl> + adsafe_source : " ADsafe unapproved script source . " , <nl> + adsafe_subscript_a : " ADsafe subscript ' { a } ' . " , <nl> + adsafe_tag : " ADsafe violation : Disallowed tag ' { a } ' . " , <nl> + already_defined : " ' { a } ' is already defined . " , <nl> + and : " The ' & & ' subexpression should be wrapped in parens . " , <nl> + assign_exception : " Do not assign to the exception parameter . " , <nl> + assignment_function_expression : " Expected an assignment or " + <nl> + " function call and instead saw an expression . " , <nl> + attribute_case_a : " Attribute ' { a } ' not all lower case . " , <nl> + avoid_a : " Avoid ' { a } ' . " , <nl> + bad_assignment : " Bad assignment . " , <nl> + bad_color_a : " Bad hex color ' { a } ' . " , <nl> + bad_constructor : " Bad constructor . " , <nl> + bad_entity : " Bad entity . " , <nl> + bad_html : " Bad HTML string " , <nl> + bad_id_a : " Bad id : ' { a } ' . " , <nl> + bad_in_a : " Bad for in variable ' { a } ' . " , <nl> + bad_invocation : " Bad invocation . " , <nl> + bad_name_a : " Bad name : ' { a } ' . " , <nl> + bad_new : " Do not use ' new ' for side effects . " , <nl> + bad_number : " Bad number ' { a } ' . " , <nl> + bad_operand : " Bad operand . " , <nl> + bad_style : " Bad style . " , <nl> + bad_type : " Bad type . " , <nl> + bad_url_a : " Bad url ' { a } ' . " , <nl> + bad_wrap : " Do not wrap function literals in parens unless they " + <nl> + " are to be immediately invoked . " , <nl> + combine_var : " Combine this with the previous ' var ' statement . " , <nl> + conditional_assignment : " Expected a conditional expression and " + <nl> + " instead saw an assignment . " , <nl> + confusing_a : " Confusing use of ' { a } ' . " , <nl> + confusing_regexp : " Confusing regular expression . " , <nl> + constructor_name_a : " A constructor name ' { a } ' should start with " + <nl> + " an uppercase letter . " , <nl> + control_a : " Unexpected control character ' { a } ' . " , <nl> + css : " A css file should begin with @ charset ' UTF - 8 ' ; " , <nl> + dangling_a : " Unexpected dangling ' _ ' in ' { a } ' . " , <nl> + dangerous_comment : " Dangerous comment . " , <nl> + deleted : " Only properties should be deleted . " , <nl> + duplicate_a : " Duplicate ' { a } ' . " , <nl> + empty_block : " Empty block . " , <nl> + empty_case : " Empty case . " , <nl> + empty_class : " Empty class . " , <nl> + es5 : " This is an ES5 feature . " , <nl> + evil : " eval is evil . " , <nl> + expected_a : " Expected ' { a } ' . " , <nl> + expected_a_b : " Expected ' { a } ' and instead saw ' { b } ' . " , <nl> + expected_a_b_from_c_d : " Expected ' { a } ' to match ' { b } ' from line " + <nl> + " { c } and instead saw ' { d } ' . " , <nl> + expected_at_a : " Expected an at - rule , and instead saw @ { a } . " , <nl> + expected_a_at_b_c : " Expected ' { a } ' at column { b } , not column { c } . " , <nl> + expected_attribute_a : " Expected an attribute , and instead saw [ { a } ] . " , <nl> + expected_attribute_value_a : " Expected an attribute value and " + <nl> + " instead saw ' { a } ' . " , <nl> + expected_class_a : " Expected a class , and instead saw . { a } . " , <nl> + expected_fraction_a : " Expected a number between 0 and 1 and " + <nl> + " instead saw ' { a } ' " , <nl> + expected_id_a : " Expected an id , and instead saw # { a } . " , <nl> + expected_identifier_a : " Expected an identifier and instead saw ' { a } ' . " , <nl> + expected_identifier_a_reserved : " Expected an identifier and " + <nl> + " instead saw ' { a } ' ( a reserved word ) . " , <nl> + expected_linear_a : " Expected a linear unit and instead saw ' { a } ' . " , <nl> + expected_lang_a : " Expected a lang code , and instead saw : { a } . " , <nl> + expected_media_a : " Expected a CSS media type , and instead saw ' { a } ' . " , <nl> + expected_name_a : " Expected a name and instead saw ' { a } ' . " , <nl> + expected_nonstandard_style_attribute : " Expected a non - standard " + <nl> + " style attribute and instead saw ' { a } ' . " , <nl> + expected_number_a : " Expected a number and instead saw ' { a } ' . " , <nl> + expected_operator_a : " Expected an operator and instead saw ' { a } ' . " , <nl> + expected_percent_a : " Expected a percentage and instead saw ' { a } ' " , <nl> + expected_positive_a : " Expected a positive number and instead saw ' { a } ' " , <nl> + expected_pseudo_a : " Expected a pseudo , and instead saw : { a } . " , <nl> + expected_selector_a : " Expected a CSS selector , and instead saw { a } . " , <nl> + expected_small_a : " Expected a small positive integer and instead saw ' { a } ' " , <nl> + expected_space_a_b : " Expected exactly one space between ' { a } ' and ' { b } ' . " , <nl> + expected_string_a : " Expected a string and instead saw { a } . " , <nl> + expected_style_attribute : " Excepted a style attribute , and instead saw ' { a } ' . " , <nl> + expected_style_pattern : " Expected a style pattern , and instead saw ' { a } ' . " , <nl> + expected_tagname_a : " Expected a tagName , and instead saw { a } . " , <nl> + expected_type_a : " Expected a type , and instead saw { a } . " , <nl> + for_if : " The body of a for in should be wrapped in an if " + <nl> + " statement to filter unwanted properties from the prototype . " , <nl> + function_block : " Function statements should not be placed in blocks . " + <nl> + " Use a function expression or move the statement to the top of " + <nl> + " the outer function . " , <nl> + function_eval : " The Function constructor is eval . " , <nl> + function_loop : " Don ' t make functions within a loop . " , <nl> + function_statement : " Function statements are not invocable . " + <nl> + " Wrap the whole function invocation in parens . " , <nl> + function_strict : " Use the function form of ' use strict ' . " , <nl> + html_confusion_a : " HTML confusion in regular expression ' < { a } ' . " , <nl> + html_handlers : " Avoid HTML event handlers . " , <nl> + identifier_function : " Expected an identifier in an assignment " + <nl> + " and instead saw a function invocation . " , <nl> + implied_evil : " Implied eval is evil . Pass a function instead of a string . " , <nl> + infix_in : " Unexpected ' in ' . Compare with undefined , or use the " + <nl> + " hasOwnProperty method instead . " , <nl> + insecure_a : " Insecure ' { a } ' . " , <nl> + isNaN : " Use the isNaN function to compare with NaN . " , <nl> + lang : " lang is deprecated . " , <nl> + leading_decimal_a : " A leading decimal point can be confused with a dot : ' . { a } ' . " , <nl> + missing_a : " Missing ' { a } ' . " , <nl> + missing_a_after_b : " Missing ' { a } ' after ' { b } ' . " , <nl> + missing_option : " Missing option value . " , <nl> + missing_property : " Missing property name . " , <nl> + missing_space_a_b : " Missing space between ' { a } ' and ' { b } ' . " , <nl> + missing_url : " Missing url . " , <nl> + missing_use_strict : " Missing ' use strict ' statement . " , <nl> + mixed : " Mixed spaces and tabs . " , <nl> + move_invocation : " Move the invocation into the parens that " + <nl> + " contain the function . " , <nl> + move_var : " Move ' var ' declarations to the top of the function . " , <nl> + name_function : " Missing name in function statement . " , <nl> + nested_comment : " Nested comment . " , <nl> + not : " Nested not . " , <nl> + not_a_constructor : " Do not use { a } as a constructor . " , <nl> + not_a_defined : " ' { a } ' has not been fully defined yet . " , <nl> + not_a_function : " ' { a } ' is not a function . " , <nl> + not_a_label : " ' { a } ' is not a label . " , <nl> + not_a_scope : " ' { a } ' is out of scope . " , <nl> + not_greater : " ' { a } ' should not be greater than ' { b } ' . " , <nl> + octal_a : " Don ' t use octal : ' { a } ' . Use ' \ \ u . . . . ' instead . " , <nl> + parameter_arguments_a : " Do not mutate parameter ' { a } ' when using ' arguments ' . " , <nl> + parameter_a_get_b : " Unexpected parameter ' { a } ' in get { b } function . " , <nl> + parameter_set_a : " Expected parameter ( value ) in set { a } function . " , <nl> + radix : " Missing radix parameter . " , <nl> + read_only : " Read only . " , <nl> + redefinition_a : " Redefinition of ' { a } ' . " , <nl> + reserved_a : " Reserved name ' { a } ' . " , <nl> + scanned_a_b : " { a } ( { b } % scanned ) . " , <nl> + slash_equal : " A regular expression literal can be confused with ' / = ' . " , <nl> + statement_block : " Expected to see a statement and instead saw a block . " , <nl> + stopping : " Stopping . " , <nl> + strange_loop : " Strange loop . " , <nl> + strict : " Strict violation . " , <nl> + subscript : " [ ' { a } ' ] is better written in dot notation . " , <nl> + sync_a : " Unexpected sync method : ' { a } ' . " , <nl> + tag_a_in_b : " A ' < { a } > ' must be within ' < { b } > ' . " , <nl> + too_long : " Line too long . " , <nl> + too_many : " Too many errors . " , <nl> + trailing_decimal_a : " A trailing decimal point can be confused " + <nl> + " with a dot : ' . { a } ' . " , <nl> + type : " type is unnecessary . " , <nl> + unclosed : " Unclosed string . " , <nl> + unclosed_comment : " Unclosed comment . " , <nl> + unclosed_regexp : " Unclosed regular expression . " , <nl> + unescaped_a : " Unescaped ' { a } ' . " , <nl> + unexpected_a : " Unexpected ' { a } ' . " , <nl> + unexpected_char_a_b : " Unexpected character ' { a } ' in { b } . " , <nl> + unexpected_comment : " Unexpected comment . " , <nl> + unexpected_else : " Unexpected ' else ' after ' return ' . " , <nl> + unexpected_label_a : " Unexpected label ' { a } ' . " , <nl> + unexpected_property_a : " Unexpected / * property * / ' { a } ' . " , <nl> + unexpected_space_a_b : " Unexpected space between ' { a } ' and ' { b } ' . " , <nl> + unnecessary_initialize : " It is not necessary to initialize ' { a } ' " + <nl> + " to ' undefined ' . " , <nl> + unnecessary_use : " Unnecessary ' use strict ' . " , <nl> + unreachable_a_b : " Unreachable ' { a } ' after ' { b } ' . " , <nl> + unrecognized_style_attribute_a : " Unrecognized style attribute ' { a } ' . " , <nl> + unrecognized_tag_a : " Unrecognized tag ' < { a } > ' . " , <nl> + unsafe : " Unsafe character . " , <nl> + url : " JavaScript URL . " , <nl> + use_array : " Use the array literal notation [ ] . " , <nl> + use_braces : " Spaces are hard to count . Use { { a } } . " , <nl> + use_charAt : " Use the charAt method . " , <nl> + use_object : " Use the object literal notation { } . " , <nl> + use_or : " Use the | | operator . " , <nl> + use_param : " Use a named parameter . " , <nl> + used_before_a : " ' { a } ' was used before it was defined . " , <nl> + var_a_not : " Variable { a } was not declared correctly . " , <nl> + weird_assignment : " Weird assignment . " , <nl> + weird_condition : " Weird condition . " , <nl> + weird_new : " Weird construction . Delete ' new ' . " , <nl> + weird_program : " Weird program . " , <nl> + weird_relation : " Weird relation . " , <nl> + weird_ternary : " Weird ternary . " , <nl> + wrap_immediate : " Wrap an immediate function invocation in parentheses " + <nl> + " to assist the reader in understanding that the expression " + <nl> + " is the result of a function , and not the function itself . " , <nl> + wrap_regexp : " Wrap the / regexp / literal in parens to " + <nl> + " disambiguate the slash operator . " , <nl> + write_is_wrong : " document . write can be a form of eval . " <nl> + } , <nl> + comments_off , <nl> + css_attribute_data , <nl> + css_any , <nl> + <nl> + css_colorData = array_to_object ( [ <nl> + " aliceblue " , " antiquewhite " , " aqua " , " aquamarine " , " azure " , " beige " , <nl> + " bisque " , " black " , " blanchedalmond " , " blue " , " blueviolet " , " brown " , <nl> + " burlywood " , " cadetblue " , " chartreuse " , " chocolate " , " coral " , <nl> + " cornflowerblue " , " cornsilk " , " crimson " , " cyan " , " darkblue " , <nl> + " darkcyan " , " darkgoldenrod " , " darkgray " , " darkgreen " , " darkkhaki " , <nl> + " darkmagenta " , " darkolivegreen " , " darkorange " , " darkorchid " , <nl> + " darkred " , " darksalmon " , " darkseagreen " , " darkslateblue " , <nl> + " darkslategray " , " darkturquoise " , " darkviolet " , " deeppink " , <nl> + " deepskyblue " , " dimgray " , " dodgerblue " , " firebrick " , " floralwhite " , <nl> + " forestgreen " , " fuchsia " , " gainsboro " , " ghostwhite " , " gold " , <nl> + " goldenrod " , " gray " , " green " , " greenyellow " , " honeydew " , " hotpink " , <nl> + " indianred " , " indigo " , " ivory " , " khaki " , " lavender " , <nl> + " lavenderblush " , " lawngreen " , " lemonchiffon " , " lightblue " , <nl> + " lightcoral " , " lightcyan " , " lightgoldenrodyellow " , " lightgreen " , <nl> + " lightpink " , " lightsalmon " , " lightseagreen " , " lightskyblue " , <nl> + " lightslategray " , " lightsteelblue " , " lightyellow " , " lime " , <nl> + " limegreen " , " linen " , " magenta " , " maroon " , " mediumaquamarine " , <nl> + " mediumblue " , " mediumorchid " , " mediumpurple " , " mediumseagreen " , <nl> + " mediumslateblue " , " mediumspringgreen " , " mediumturquoise " , <nl> + " mediumvioletred " , " midnightblue " , " mintcream " , " mistyrose " , <nl> + " moccasin " , " navajowhite " , " navy " , " oldlace " , " olive " , " olivedrab " , <nl> + " orange " , " orangered " , " orchid " , " palegoldenrod " , " palegreen " , <nl> + " paleturquoise " , " palevioletred " , " papayawhip " , " peachpuff " , <nl> + " peru " , " pink " , " plum " , " powderblue " , " purple " , " red " , " rosybrown " , <nl> + " royalblue " , " saddlebrown " , " salmon " , " sandybrown " , " seagreen " , <nl> + " seashell " , " sienna " , " silver " , " skyblue " , " slateblue " , " slategray " , <nl> + " snow " , " springgreen " , " steelblue " , " tan " , " teal " , " thistle " , <nl> + " tomato " , " turquoise " , " violet " , " wheat " , " white " , " whitesmoke " , <nl> + " yellow " , " yellowgreen " , <nl> + <nl> + " activeborder " , " activecaption " , " appworkspace " , " background " , <nl> + " buttonface " , " buttonhighlight " , " buttonshadow " , " buttontext " , <nl> + " captiontext " , " graytext " , " highlight " , " highlighttext " , <nl> + " inactiveborder " , " inactivecaption " , " inactivecaptiontext " , <nl> + " infobackground " , " infotext " , " menu " , " menutext " , " scrollbar " , <nl> + " threeddarkshadow " , " threedface " , " threedhighlight " , <nl> + " threedlightshadow " , " threedshadow " , " window " , " windowframe " , <nl> + " windowtext " <nl> + ] , true ) , <nl> + <nl> + css_border_style , <nl> + css_break , <nl> + <nl> + css_lengthData = { <nl> + ' % ' : true , <nl> + ' cm ' : true , <nl> + ' em ' : true , <nl> + ' ex ' : true , <nl> + ' in ' : true , <nl> + ' mm ' : true , <nl> + ' pc ' : true , <nl> + ' pt ' : true , <nl> + ' px ' : true <nl> + } , <nl> + <nl> + css_media , <nl> + css_overflow , <nl> + <nl> + descapes = { <nl> + ' b ' : ' \ b ' , <nl> + ' t ' : ' \ t ' , <nl> + ' n ' : ' \ n ' , <nl> + ' f ' : ' \ f ' , <nl> + ' r ' : ' \ r ' , <nl> + ' " ' : ' " ' , <nl> + ' / ' : ' / ' , <nl> + ' \ \ ' : ' \ \ ' , <nl> + ' ! ' : ' ! ' <nl> + } , <nl> + <nl> + devel = array_to_object ( [ <nl> + ' alert ' , ' confirm ' , ' console ' , ' Debug ' , ' opera ' , ' prompt ' , ' WSH ' <nl> + ] , false ) , <nl> + directive , <nl> + escapes = { <nl> + ' \ b ' : ' \ \ b ' , <nl> + ' \ t ' : ' \ \ t ' , <nl> + ' \ n ' : ' \ \ n ' , <nl> + ' \ f ' : ' \ \ f ' , <nl> + ' \ r ' : ' \ \ r ' , <nl> + ' \ ' ' : ' \ \ \ ' ' , <nl> + ' " ' : ' \ \ " ' , <nl> + ' / ' : ' \ \ / ' , <nl> + ' \ \ ' : ' \ \ \ \ ' <nl> + } , <nl> + <nl> + funct , / / The current function , including the labels used in <nl> + / / the function , as well as ( breakage ) , <nl> + / / ( context ) , ( loopage ) , ( name ) , ( params ) , ( token ) , <nl> + / / ( vars ) , ( verb ) <nl> + <nl> + functionicity = [ <nl> + ' closure ' , ' exception ' , ' global ' , ' label ' , ' outer ' , ' undef ' , <nl> + ' unused ' , ' var ' <nl> + ] , <nl> + <nl> + functions , / / All of the functions <nl> + global_funct , / / The global body <nl> + global_scope , / / The global scope <nl> + html_tag = { <nl> + a : { } , <nl> + abbr : { } , <nl> + acronym : { } , <nl> + address : { } , <nl> + applet : { } , <nl> + area : { empty : true , parent : ' map ' } , <nl> + article : { } , <nl> + aside : { } , <nl> + audio : { } , <nl> + b : { } , <nl> + base : { empty : true , parent : ' head ' } , <nl> + bdo : { } , <nl> + big : { } , <nl> + blockquote : { } , <nl> + body : { parent : ' html noframes ' } , <nl> + br : { empty : true } , <nl> + button : { } , <nl> + canvas : { parent : ' body p div th td ' } , <nl> + caption : { parent : ' table ' } , <nl> + center : { } , <nl> + cite : { } , <nl> + code : { } , <nl> + col : { empty : true , parent : ' table colgroup ' } , <nl> + colgroup : { parent : ' table ' } , <nl> + command : { parent : ' menu ' } , <nl> + datalist : { } , <nl> + dd : { parent : ' dl ' } , <nl> + del : { } , <nl> + details : { } , <nl> + dialog : { } , <nl> + dfn : { } , <nl> + dir : { } , <nl> + div : { } , <nl> + dl : { } , <nl> + dt : { parent : ' dl ' } , <nl> + em : { } , <nl> + embed : { } , <nl> + fieldset : { } , <nl> + figure : { } , <nl> + font : { } , <nl> + footer : { } , <nl> + form : { } , <nl> + frame : { empty : true , parent : ' frameset ' } , <nl> + frameset : { parent : ' html frameset ' } , <nl> + h1 : { } , <nl> + h2 : { } , <nl> + h3 : { } , <nl> + h4 : { } , <nl> + h5 : { } , <nl> + h6 : { } , <nl> + head : { parent : ' html ' } , <nl> + header : { } , <nl> + hgroup : { } , <nl> + hr : { empty : true } , <nl> + ' hta : application ' : <nl> + { empty : true , parent : ' head ' } , <nl> + html : { parent : ' * ' } , <nl> + i : { } , <nl> + iframe : { } , <nl> + img : { empty : true } , <nl> + input : { empty : true } , <nl> + ins : { } , <nl> + kbd : { } , <nl> + keygen : { } , <nl> + label : { } , <nl> + legend : { parent : ' details fieldset figure ' } , <nl> + li : { parent : ' dir menu ol ul ' } , <nl> + link : { empty : true , parent : ' head ' } , <nl> + map : { } , <nl> + mark : { } , <nl> + menu : { } , <nl> + meta : { empty : true , parent : ' head noframes noscript ' } , <nl> + meter : { } , <nl> + nav : { } , <nl> + noframes : { parent : ' html body ' } , <nl> + noscript : { parent : ' body head noframes ' } , <nl> + object : { } , <nl> + ol : { } , <nl> + optgroup : { parent : ' select ' } , <nl> + option : { parent : ' optgroup select ' } , <nl> + output : { } , <nl> + p : { } , <nl> + param : { empty : true , parent : ' applet object ' } , <nl> + pre : { } , <nl> + progress : { } , <nl> + q : { } , <nl> + rp : { } , <nl> + rt : { } , <nl> + ruby : { } , <nl> + samp : { } , <nl> + script : { empty : true , parent : ' body div frame head iframe p pre span ' } , <nl> + section : { } , <nl> + select : { } , <nl> + small : { } , <nl> + span : { } , <nl> + source : { } , <nl> + strong : { } , <nl> + style : { parent : ' head ' , empty : true } , <nl> + sub : { } , <nl> + sup : { } , <nl> + table : { } , <nl> + tbody : { parent : ' table ' } , <nl> + td : { parent : ' tr ' } , <nl> + textarea : { } , <nl> + tfoot : { parent : ' table ' } , <nl> + th : { parent : ' tr ' } , <nl> + thead : { parent : ' table ' } , <nl> + time : { } , <nl> + title : { parent : ' head ' } , <nl> + tr : { parent : ' table tbody thead tfoot ' } , <nl> + tt : { } , <nl> + u : { } , <nl> + ul : { } , <nl> + ' var ' : { } , <nl> + video : { } <nl> + } , <nl> + <nl> + ids , / / HTML ids <nl> + in_block , <nl> + indent , <nl> + itself , / / JSLint itself <nl> + json_mode , <nl> + lex , / / the tokenizer <nl> + lines , <nl> + lookahead , <nl> + node = array_to_object ( [ <nl> + ' Buffer ' , ' clearInterval ' , ' clearTimeout ' , ' console ' , ' exports ' , <nl> + ' global ' , ' module ' , ' process ' , ' querystring ' , ' require ' , <nl> + ' setInterval ' , ' setTimeout ' , ' __dirname ' , ' __filename ' <nl> + ] , false ) , <nl> + node_js , <nl> + numbery = array_to_object ( [ ' indexOf ' , ' lastIndexOf ' , ' search ' ] , true ) , <nl> + next_token , <nl> + option , <nl> + predefined , / / Global variables defined by option <nl> + prereg , <nl> + prev_token , <nl> + property , <nl> + regexp_flag = array_to_object ( [ ' g ' , ' i ' , ' m ' ] , true ) , <nl> + return_this = function return_this ( ) { <nl> + return this ; <nl> + } , <nl> + rhino = array_to_object ( [ <nl> + ' defineClass ' , ' deserialize ' , ' gc ' , ' help ' , ' load ' , ' loadClass ' , <nl> + ' print ' , ' quit ' , ' readFile ' , ' readUrl ' , ' runCommand ' , ' seal ' , <nl> + ' serialize ' , ' spawn ' , ' sync ' , ' toint32 ' , ' version ' <nl> + ] , false ) , <nl> + <nl> + scope , / / An object containing an object for each variable in scope <nl> + semicolon_coda = array_to_object ( [ ' ; ' , ' " ' , ' \ ' ' , ' ) ' ] , true ) , <nl> + src , <nl> + stack , <nl> + <nl> + / / standard contains the global names that are provided by the <nl> + / / ECMAScript standard . <nl> + <nl> + standard = array_to_object ( [ <nl> + ' Array ' , ' Boolean ' , ' Date ' , ' decodeURI ' , ' decodeURIComponent ' , <nl> + ' encodeURI ' , ' encodeURIComponent ' , ' Error ' , ' eval ' , ' EvalError ' , <nl> + ' Function ' , ' isFinite ' , ' isNaN ' , ' JSON ' , ' Math ' , ' Number ' , <nl> + ' Object ' , ' parseInt ' , ' parseFloat ' , ' RangeError ' , ' ReferenceError ' , <nl> + ' RegExp ' , ' String ' , ' SyntaxError ' , ' TypeError ' , ' URIError ' <nl> + ] , false ) , <nl> + <nl> + strict_mode , <nl> + syntax = { } , <nl> + tab , <nl> + token , <nl> + urls , <nl> + var_mode , <nl> + warnings , <nl> + <nl> + windows = array_to_object ( [ <nl> + ' ActiveXObject ' , ' CScript ' , ' Debug ' , ' Enumerator ' , ' System ' , <nl> + ' VBArray ' , ' WScript ' , ' WSH ' <nl> + ] , false ) , <nl> + <nl> + / / xmode is used to adapt to the exceptions in html parsing . <nl> + / / It can have these states : <nl> + / / ' ' . js script file <nl> + / / ' html ' <nl> + / / ' outer ' <nl> + / / ' script ' <nl> + / / ' style ' <nl> + / / ' scriptstring ' <nl> + / / ' styleproperty ' <nl> + <nl> + xmode , <nl> + xquote , <nl> + <nl> + / / Regular expressions . Some of these are stupidly long . <nl> + <nl> + / / unsafe comment or string <nl> + ax = / @ cc | < \ / ? | script | \ ] \ s * \ ] | < \ s * ! | & lt / i , <nl> + / / carriage return , carriage return linefeed , or linefeed <nl> + crlfx = / \ r \ n ? | \ n / , <nl> + / / unsafe characters that are silently deleted by one or more browsers <nl> + cx = / [ \ u0000 - \ u001f \ u007f - \ u009f \ u00ad \ u0600 - \ u0604 \ u070f \ u17b4 \ u17b5 \ u200c - \ u200f \ u2028 - \ u202f \ u2060 - \ u206f \ ufeff \ ufff0 - \ uffff ] / , <nl> + / / query characters for ids <nl> + dx = / [ \ [ \ ] \ / \ \ " ' * < > . & : ( ) { } + = # ] / , <nl> + / / html token <nl> + hx = / ^ \ s * ( [ ' " = > \ / & # ] | < ( ? : \ / | \ ! ( ? : - - ) ? ) ? | [ a - zA - Z ] [ a - zA - Z0 - 9_ \ - : ] * | [ 0 - 9 ] + | - - ) / , <nl> + / / identifier <nl> + ix = / ^ ( [ a - zA - Z_ $ ] [ a - zA - Z0 - 9_ $ ] * ) $ / , <nl> + / / javascript url <nl> + jx = / ^ ( ? : javascript | jscript | ecmascript | vbscript | mocha | livescript ) \ s * : / i , <nl> + / / star slash <nl> + lx = / \ * \ / | \ / \ * / , <nl> + / / characters in strings that need escapement <nl> + nx = / [ \ u0000 - \ u001f ' \ \ \ u007f - \ u009f \ u00ad \ u0600 - \ u0604 \ u070f \ u17b4 \ u17b5 \ u200c - \ u200f \ u2028 - \ u202f \ u2060 - \ u206f \ ufeff \ ufff0 - \ uffff ] / g , <nl> + / / outer html token <nl> + ox = / [ > & ] | < [ \ / ! ] ? | - - / , <nl> + / / attributes characters <nl> + qx = / [ ^ a - zA - Z0 - 9 + \ - _ \ / . ] / , <nl> + / / style <nl> + sx = / ^ \ s * ( [ { } : # % . = , > + \ [ \ ] @ ( ) " ' ; ] | [ * $ \ ^ ~ ] = | [ a - zA - Z_ ] [ a - zA - Z0 - 9_ \ - ] * | [ 0 - 9 ] + | < \ / | \ / \ * ) / , <nl> + ssx = / ^ \ s * ( [ @ # ! " ' } ; : \ - % . = , + \ [ \ ] ( ) * _ ] | [ a - zA - Z ] [ a - zA - Z0 - 9 . _ \ - ] * | \ / \ * ? | \ d + ( ? : \ . \ d + ) ? | < \ / ) / , <nl> + / / token <nl> + tx = / ^ \ s * ( [ ( ) { } \ [ \ ] \ ? . , : ; ' " ~ # @ ` ] | = { 1 , 3 } | \ / ( \ * ( jslint | properties | property | members ? | globals ? ) ? | = | \ / ) ? | \ * [ \ / = ] ? | \ + ( ? : = | \ + + ) ? | - ( ? : = | - + ) ? | [ \ ^ % ] = ? | & [ & = ] ? | \ | [ | = ] ? | > { 1 , 3 } = ? | < ( ? : [ \ / = ! ] | \ ! ( \ [ | - - ) ? | < = ? ) ? | \ ! = { 0 , 2 } | [ a - zA - Z_ $ ] [ a - zA - Z0 - 9_ $ ] * | [ 0 - 9 ] + ( ? : [ xX ] [ 0 - 9a - fA - F ] + | \ . [ 0 - 9 ] * ) ? ( ? : [ eE ] [ + \ - ] ? [ 0 - 9 ] + ) ? ) / , <nl> + / / url badness <nl> + ux = / & | \ + | \ u00AD | \ . \ . | \ / \ * | % [ ^ ; ] | base64 | url | expression | data | mailto | script / i , <nl> + <nl> + rx = { <nl> + outer : hx , <nl> + html : hx , <nl> + style : sx , <nl> + styleproperty : ssx <nl> + } ; <nl> + <nl> + <nl> + function F ( ) { } / / Used by Object . create <nl> + <nl> + / / Provide critical ES5 functions to ES3 . <nl> + <nl> + if ( typeof Array . prototype . filter ! = = ' function ' ) { <nl> + Array . prototype . filter = function ( f ) { <nl> + var i , length = this . length , result = [ ] , value ; <nl> + for ( i = 0 ; i < length ; i + = 1 ) { <nl> + try { <nl> + value = this [ i ] ; <nl> + if ( f ( value ) ) { <nl> + result . push ( value ) ; <nl> + } <nl> + } catch ( ignore ) { <nl> + } <nl> + } <nl> + return result ; <nl> + } ; <nl> + } <nl> + <nl> + if ( typeof Array . prototype . forEach ! = = ' function ' ) { <nl> + Array . prototype . forEach = function ( f ) { <nl> + var i , length = this . length ; <nl> + for ( i = 0 ; i < length ; i + = 1 ) { <nl> + try { <nl> + f ( this [ i ] ) ; <nl> + } catch ( ignore ) { <nl> + } <nl> + } <nl> + } ; <nl> + } <nl> + <nl> + if ( typeof Array . isArray ! = = ' function ' ) { <nl> + Array . isArray = function ( o ) { <nl> + return Object . prototype . toString . apply ( o ) = = = ' [ object Array ] ' ; <nl> + } ; <nl> + } <nl> + <nl> + if ( ! Object . prototype . hasOwnProperty . call ( Object , ' create ' ) ) { <nl> + Object . create = function ( o ) { <nl> + F . prototype = o ; <nl> + return new F ( ) ; <nl> + } ; <nl> + } <nl> + <nl> + if ( typeof Object . keys ! = = ' function ' ) { <nl> + Object . keys = function ( o ) { <nl> + var array = [ ] , key ; <nl> + for ( key in o ) { <nl> + if ( Object . prototype . hasOwnProperty . call ( o , key ) ) { <nl> + array . push ( key ) ; <nl> + } <nl> + } <nl> + return array ; <nl> + } ; <nl> + } <nl> + <nl> + if ( typeof String . prototype . entityify ! = = ' function ' ) { <nl> + String . prototype . entityify = function ( ) { <nl> + return this <nl> + . replace ( / & / g , ' & amp ; ' ) <nl> + . replace ( / < / g , ' & lt ; ' ) <nl> + . replace ( / > / g , ' & gt ; ' ) ; <nl> + } ; <nl> + } <nl> + <nl> + if ( typeof String . prototype . isAlpha ! = = ' function ' ) { <nl> + String . prototype . isAlpha = function ( ) { <nl> + return ( this > = ' a ' & & this < = ' z \ uffff ' ) | | <nl> + ( this > = ' A ' & & this < = ' Z \ uffff ' ) ; <nl> + } ; <nl> + } <nl> + <nl> + if ( typeof String . prototype . isDigit ! = = ' function ' ) { <nl> + String . prototype . isDigit = function ( ) { <nl> + return ( this > = ' 0 ' & & this < = ' 9 ' ) ; <nl> + } ; <nl> + } <nl> + <nl> + if ( typeof String . prototype . supplant ! = = ' function ' ) { <nl> + String . prototype . supplant = function ( o ) { <nl> + return this . replace ( / \ { ( [ ^ { } ] * ) \ } / g , function ( a , b ) { <nl> + var replacement = o [ b ] ; <nl> + return typeof replacement = = = ' string ' | | <nl> + typeof replacement = = = ' number ' ? replacement : a ; <nl> + } ) ; <nl> + } ; <nl> + } <nl> + <nl> + <nl> + function sanitize ( a ) { <nl> + <nl> + / / Escapify a troublesome character . <nl> + <nl> + return escapes [ a ] | | <nl> + ' \ \ u ' + ( ' 0000 ' + a . charCodeAt ( ) . toString ( 16 ) ) . slice ( - 4 ) ; <nl> + } <nl> + <nl> + <nl> + function add_to_predefined ( group ) { <nl> + Object . keys ( group ) . forEach ( function ( name ) { <nl> + predefined [ name ] = group [ name ] ; <nl> + } ) ; <nl> + } <nl> + <nl> + <nl> + function assume ( ) { <nl> + if ( ! option . safe ) { <nl> + if ( option . rhino ) { <nl> + add_to_predefined ( rhino ) ; <nl> + option . rhino = false ; <nl> + } <nl> + if ( option . devel ) { <nl> + add_to_predefined ( devel ) ; <nl> + option . devel = false ; <nl> + } <nl> + if ( option . browser ) { <nl> + add_to_predefined ( browser ) ; <nl> + option . browser = false ; <nl> + } <nl> + if ( option . windows ) { <nl> + add_to_predefined ( windows ) ; <nl> + option . windows = false ; <nl> + } <nl> + if ( option . node ) { <nl> + add_to_predefined ( node ) ; <nl> + option . node = false ; <nl> + node_js = true ; <nl> + } <nl> + } <nl> + } <nl> + <nl> + <nl> + / / Produce an error warning . <nl> + <nl> + function artifact ( tok ) { <nl> + if ( ! tok ) { <nl> + tok = next_token ; <nl> + } <nl> + return tok . number | | tok . string ; <nl> + } <nl> + <nl> + function quit ( message , line , character ) { <nl> + throw { <nl> + name : ' JSLintError ' , <nl> + line : line , <nl> + character : character , <nl> + message : bundle . scanned_a_b . supplant ( { <nl> + a : message , <nl> + b : Math . floor ( ( line / lines . length ) * 100 ) <nl> + } ) <nl> + } ; <nl> + } <nl> + <nl> + function warn ( message , offender , a , b , c , d ) { <nl> + var character , line , warning ; <nl> + offender = offender | | next_token ; / / ~ ~ <nl> + line = offender . line | | 0 ; <nl> + character = offender . from | | 0 ; <nl> + warning = { <nl> + id : ' ( error ) ' , <nl> + raw : bundle [ message ] | | message , <nl> + evidence : lines [ line - 1 ] | | ' ' , <nl> + line : line , <nl> + character : character , <nl> + a : a | | ( offender . id = = = ' ( number ) ' <nl> + ? String ( offender . number ) <nl> + : offender . string ) , <nl> + b : b , <nl> + c : c , <nl> + d : d <nl> + } ; <nl> + warning . reason = warning . raw . supplant ( warning ) ; <nl> + JSLINT . errors . push ( warning ) ; <nl> + if ( option . passfail ) { <nl> + quit ( bundle . stopping , line , character ) ; <nl> + } <nl> + warnings + = 1 ; <nl> + if ( warnings > = option . maxerr ) { <nl> + quit ( bundle . too_many , line , character ) ; <nl> + } <nl> + return warning ; <nl> + } <nl> + <nl> + function warn_at ( message , line , character , a , b , c , d ) { <nl> + return warn ( message , { <nl> + line : line , <nl> + from : character <nl> + } , a , b , c , d ) ; <nl> + } <nl> + <nl> + function stop ( message , offender , a , b , c , d ) { <nl> + var warning = warn ( message , offender , a , b , c , d ) ; <nl> + quit ( bundle . stopping , warning . line , warning . character ) ; <nl> + } <nl> + <nl> + function stop_at ( message , line , character , a , b , c , d ) { <nl> + return stop ( message , { <nl> + line : line , <nl> + from : character <nl> + } , a , b , c , d ) ; <nl> + } <nl> + <nl> + function expected_at ( at ) { <nl> + if ( ! option . white & & next_token . from ! = = at ) { <nl> + warn ( ' expected_a_at_b_c ' , next_token , ' ' , at , <nl> + next_token . from ) ; <nl> + } <nl> + } <nl> + <nl> + function aint ( it , name , expected ) { <nl> + if ( it [ name ] ! = = expected ) { <nl> + warn ( ' expected_a_b ' , it , expected , it [ name ] ) ; <nl> + return true ; <nl> + } <nl> + return false ; <nl> + } <nl> + <nl> + <nl> + / / lexical analysis and token construction <nl> + <nl> + lex = ( function lex ( ) { <nl> + var character , c , from , length , line , pos , source_row ; <nl> + <nl> + / / Private lex methods <nl> + <nl> + function next_line ( ) { <nl> + var at ; <nl> + if ( line > = lines . length ) { <nl> + return false ; <nl> + } <nl> + character = 1 ; <nl> + source_row = lines [ line ] ; <nl> + line + = 1 ; <nl> + at = source_row . search ( / \ t / ) ; <nl> + if ( at > = 0 ) { <nl> + warn_at ( ' mixed ' , line , at + 1 ) ; <nl> + } <nl> + source_row = source_row . replace ( / \ t / g , tab ) ; <nl> + at = source_row . search ( cx ) ; <nl> + if ( at > = 0 ) { <nl> + warn_at ( ' unsafe ' , line , at ) ; <nl> + } <nl> + if ( option . maxlen & & option . maxlen < source_row . length ) { <nl> + warn_at ( ' too_long ' , line , source_row . length ) ; <nl> + } <nl> + return true ; <nl> + } <nl> + <nl> + / / Produce a token object . The token inherits from a syntax symbol . <nl> + <nl> + function it ( type , value ) { <nl> + var id , the_token ; <nl> + if ( type = = = ' ( string ) ' | | type = = = ' ( range ) ' ) { <nl> + if ( jx . test ( value ) ) { <nl> + warn_at ( ' url ' , line , from ) ; <nl> + } <nl> + } <nl> + the_token = Object . create ( syntax [ ( <nl> + type = = = ' ( punctuator ) ' | | ( type = = = ' ( identifier ) ' & & <nl> + Object . prototype . hasOwnProperty . call ( syntax , value ) ) <nl> + ? value <nl> + : type <nl> + ) ] | | syntax [ ' ( error ) ' ] ) ; <nl> + if ( type = = = ' ( identifier ) ' ) { <nl> + the_token . identifier = true ; <nl> + if ( value = = = ' __iterator__ ' | | value = = = ' __proto__ ' ) { <nl> + stop_at ( ' reserved_a ' , line , from , value ) ; <nl> + } else if ( ! option . nomen & & <nl> + ( value . charAt ( 0 ) = = = ' _ ' | | <nl> + value . charAt ( value . length - 1 ) = = = ' _ ' ) ) { <nl> + warn_at ( ' dangling_a ' , line , from , value ) ; <nl> + } <nl> + } <nl> + if ( type = = = ' ( number ) ' ) { <nl> + the_token . number = + value ; <nl> + } else if ( value ! = = undefined ) { <nl> + the_token . string = String ( value ) ; <nl> + } <nl> + the_token . line = line ; <nl> + the_token . from = from ; <nl> + the_token . thru = character ; <nl> + id = the_token . id ; <nl> + prereg = id & & ( <nl> + ( ' ( , = : [ ! & | ? { } ; ' . indexOf ( id . charAt ( id . length - 1 ) ) > = 0 ) | | <nl> + id = = = ' return ' | | id = = = ' case ' <nl> + ) ; <nl> + return the_token ; <nl> + } <nl> + <nl> + function match ( x ) { <nl> + var exec = x . exec ( source_row ) , first ; <nl> + if ( exec ) { <nl> + length = exec [ 0 ] . length ; <nl> + first = exec [ 1 ] ; <nl> + c = first . charAt ( 0 ) ; <nl> + source_row = source_row . slice ( length ) ; <nl> + from = character + length - first . length ; <nl> + character + = length ; <nl> + return first ; <nl> + } <nl> + } <nl> + <nl> + function string ( x ) { <nl> + var c , pos = 0 , r = ' ' , result ; <nl> + <nl> + function hex ( n ) { <nl> + var i = parseInt ( source_row . substr ( pos + 1 , n ) , 16 ) ; <nl> + pos + = n ; <nl> + if ( i > = 32 & & i < = 126 & & <nl> + i ! = = 34 & & i ! = = 92 & & i ! = = 39 ) { <nl> + warn_at ( ' unexpected_a ' , line , character , ' \ \ ' ) ; <nl> + } <nl> + character + = n ; <nl> + c = String . fromCharCode ( i ) ; <nl> + } <nl> + <nl> + if ( json_mode & & x ! = = ' " ' ) { <nl> + warn_at ( ' expected_a ' , line , character , ' " ' ) ; <nl> + } <nl> + <nl> + if ( xquote = = = x | | ( xmode = = = ' scriptstring ' & & ! xquote ) ) { <nl> + return it ( ' ( punctuator ) ' , x ) ; <nl> + } <nl> + <nl> + for ( ; ; ) { <nl> + while ( pos > = source_row . length ) { <nl> + pos = 0 ; <nl> + if ( xmode ! = = ' html ' | | ! next_line ( ) ) { <nl> + stop_at ( ' unclosed ' , line , from ) ; <nl> + } <nl> + } <nl> + c = source_row . charAt ( pos ) ; <nl> + if ( c = = = x ) { <nl> + character + = 1 ; <nl> + source_row = source_row . slice ( pos + 1 ) ; <nl> + result = it ( ' ( string ) ' , r ) ; <nl> + result . quote = x ; <nl> + return result ; <nl> + } <nl> + if ( c < ' ' ) { <nl> + if ( c = = = ' \ n ' | | c = = = ' \ r ' ) { <nl> + break ; <nl> + } <nl> + warn_at ( ' control_a ' , line , character + pos , <nl> + source_row . slice ( 0 , pos ) ) ; <nl> + } else if ( c = = = xquote ) { <nl> + warn_at ( ' bad_html ' , line , character + pos ) ; <nl> + } else if ( c = = = ' < ' ) { <nl> + if ( option . safe & & xmode = = = ' html ' ) { <nl> + warn_at ( ' adsafe_a ' , line , character + pos , c ) ; <nl> + } else if ( source_row . charAt ( pos + 1 ) = = = ' / ' & & ( xmode | | option . safe ) ) { <nl> + warn_at ( ' expected_a_b ' , line , character , <nl> + ' < \ \ / ' , ' < / ' ) ; <nl> + } else if ( source_row . charAt ( pos + 1 ) = = = ' ! ' & & ( xmode | | option . safe ) ) { <nl> + warn_at ( ' unexpected_a ' , line , character , ' < ! ' ) ; <nl> + } <nl> + } else if ( c = = = ' \ \ ' ) { <nl> + if ( xmode = = = ' html ' ) { <nl> + if ( option . safe ) { <nl> + warn_at ( ' adsafe_a ' , line , character + pos , c ) ; <nl> + } <nl> + } else if ( xmode = = = ' styleproperty ' ) { <nl> + pos + = 1 ; <nl> + character + = 1 ; <nl> + c = source_row . charAt ( pos ) ; <nl> + if ( c ! = = x ) { <nl> + warn_at ( ' unexpected_a ' , line , character , ' \ \ ' ) ; <nl> + } <nl> + } else { <nl> + pos + = 1 ; <nl> + character + = 1 ; <nl> + c = source_row . charAt ( pos ) ; <nl> + switch ( c ) { <nl> + case ' ' : <nl> + if ( ! option . es5 ) { <nl> + warn_at ( ' es5 ' , line , character ) ; <nl> + } <nl> + next_line ( ) ; <nl> + pos = - 1 ; <nl> + break ; <nl> + case xquote : <nl> + warn_at ( ' bad_html ' , line , character + pos ) ; <nl> + break ; <nl> + case ' \ ' ' : <nl> + if ( json_mode ) { <nl> + warn_at ( ' unexpected_a ' , line , character , ' \ \ \ ' ' ) ; <nl> + } <nl> + break ; <nl> + case ' u ' : <nl> + hex ( 4 ) ; <nl> + break ; <nl> + case ' v ' : <nl> + if ( json_mode ) { <nl> + warn_at ( ' unexpected_a ' , line , character , ' \ \ v ' ) ; <nl> + } <nl> + c = ' \ v ' ; <nl> + break ; <nl> + case ' x ' : <nl> + if ( json_mode ) { <nl> + warn_at ( ' unexpected_a ' , line , character , ' \ \ x ' ) ; <nl> + } <nl> + hex ( 2 ) ; <nl> + break ; <nl> + default : <nl> + if ( typeof descapes [ c ] ! = = ' string ' ) { <nl> + warn_at ( c > = ' 0 ' & & c < = ' 7 ' ? ' octal_a ' : ' unexpected_a ' , <nl> + line , character , ' \ \ ' + c ) ; <nl> + } else { <nl> + c = descapes [ c ] ; <nl> + } <nl> + } <nl> + } <nl> + } <nl> + r + = c ; <nl> + character + = 1 ; <nl> + pos + = 1 ; <nl> + } <nl> + } <nl> + <nl> + function number ( snippet ) { <nl> + var digit ; <nl> + if ( xmode ! = = ' style ' & & xmode ! = = ' styleproperty ' & & <nl> + source_row . charAt ( 0 ) . isAlpha ( ) ) { <nl> + warn_at ( ' expected_space_a_b ' , <nl> + line , character , c , source_row . charAt ( 0 ) ) ; <nl> + } <nl> + if ( c = = = ' 0 ' ) { <nl> + digit = snippet . charAt ( 1 ) ; <nl> + if ( digit . isDigit ( ) ) { <nl> + if ( token . id ! = = ' . ' & & xmode ! = = ' styleproperty ' ) { <nl> + warn_at ( ' unexpected_a ' , line , character , snippet ) ; <nl> + } <nl> + } else if ( json_mode & & ( digit = = = ' x ' | | digit = = = ' X ' ) ) { <nl> + warn_at ( ' unexpected_a ' , line , character , ' 0x ' ) ; <nl> + } <nl> + } <nl> + if ( snippet . slice ( snippet . length - 1 ) = = = ' . ' ) { <nl> + warn_at ( ' trailing_decimal_a ' , line , character , snippet ) ; <nl> + } <nl> + if ( xmode ! = = ' style ' ) { <nl> + digit = + snippet ; <nl> + if ( ! isFinite ( digit ) ) { <nl> + warn_at ( ' bad_number ' , line , character , snippet ) ; <nl> + } <nl> + snippet = digit ; <nl> + } <nl> + return it ( ' ( number ) ' , snippet ) ; <nl> + } <nl> + <nl> + function comment ( snippet ) { <nl> + if ( comments_off | | src | | ( xmode & & xmode ! = = ' script ' & & <nl> + xmode ! = = ' style ' & & xmode ! = = ' styleproperty ' ) ) { <nl> + warn_at ( ' unexpected_comment ' , line , character ) ; <nl> + } else if ( xmode = = = ' script ' & & / < \ / / i . test ( source_row ) ) { <nl> + warn_at ( ' unexpected_a ' , line , character , ' < \ / ' ) ; <nl> + } else if ( option . safe & & ax . test ( snippet ) ) { <nl> + warn_at ( ' dangerous_comment ' , line , character ) ; <nl> + } <nl> + } <nl> + <nl> + function regexp ( ) { <nl> + var b , <nl> + bit , <nl> + captures = 0 , <nl> + depth = 0 , <nl> + flag = ' ' , <nl> + high , <nl> + letter , <nl> + length = 0 , <nl> + low , <nl> + potential , <nl> + quote , <nl> + result ; <nl> + for ( ; ; ) { <nl> + b = true ; <nl> + c = source_row . charAt ( length ) ; <nl> + length + = 1 ; <nl> + switch ( c ) { <nl> + case ' ' : <nl> + stop_at ( ' unclosed_regexp ' , line , from ) ; <nl> + return ; <nl> + case ' / ' : <nl> + if ( depth > 0 ) { <nl> + warn_at ( ' unescaped_a ' , line , from + length , ' / ' ) ; <nl> + } <nl> + c = source_row . slice ( 0 , length - 1 ) ; <nl> + potential = Object . create ( regexp_flag ) ; <nl> + for ( ; ; ) { <nl> + letter = source_row . charAt ( length ) ; <nl> + if ( potential [ letter ] ! = = true ) { <nl> + break ; <nl> + } <nl> + potential [ letter ] = false ; <nl> + length + = 1 ; <nl> + flag + = letter ; <nl> + } <nl> + if ( source_row . charAt ( length ) . isAlpha ( ) ) { <nl> + stop_at ( ' unexpected_a ' , line , from , source_row . charAt ( length ) ) ; <nl> + } <nl> + character + = length ; <nl> + source_row = source_row . slice ( length ) ; <nl> + quote = source_row . charAt ( 0 ) ; <nl> + if ( quote = = = ' / ' | | quote = = = ' * ' ) { <nl> + stop_at ( ' confusing_regexp ' , line , from ) ; <nl> + } <nl> + result = it ( ' ( regexp ) ' , c ) ; <nl> + result . flag = flag ; <nl> + return result ; <nl> + case ' \ \ ' : <nl> + c = source_row . charAt ( length ) ; <nl> + if ( c < ' ' ) { <nl> + warn_at ( ' control_a ' , line , from + length , String ( c ) ) ; <nl> + } else if ( c = = = ' < ' ) { <nl> + warn_at ( bundle . unexpected_a , line , from + length , ' \ \ ' ) ; <nl> + } <nl> + length + = 1 ; <nl> + break ; <nl> + case ' ( ' : <nl> + depth + = 1 ; <nl> + b = false ; <nl> + if ( source_row . charAt ( length ) = = = ' ? ' ) { <nl> + length + = 1 ; <nl> + switch ( source_row . charAt ( length ) ) { <nl> + case ' : ' : <nl> + case ' = ' : <nl> + case ' ! ' : <nl> + length + = 1 ; <nl> + break ; <nl> + default : <nl> + warn_at ( bundle . expected_a_b , line , from + length , <nl> + ' : ' , source_row . charAt ( length ) ) ; <nl> + } <nl> + } else { <nl> + captures + = 1 ; <nl> + } <nl> + break ; <nl> + case ' | ' : <nl> + b = false ; <nl> + break ; <nl> + case ' ) ' : <nl> + if ( depth = = = 0 ) { <nl> + warn_at ( ' unescaped_a ' , line , from + length , ' ) ' ) ; <nl> + } else { <nl> + depth - = 1 ; <nl> + } <nl> + break ; <nl> + case ' ' : <nl> + pos = 1 ; <nl> + while ( source_row . charAt ( length ) = = = ' ' ) { <nl> + length + = 1 ; <nl> + pos + = 1 ; <nl> + } <nl> + if ( pos > 1 ) { <nl> + warn_at ( ' use_braces ' , line , from + length , pos ) ; <nl> + } <nl> + break ; <nl> + case ' [ ' : <nl> + c = source_row . charAt ( length ) ; <nl> + if ( c = = = ' ^ ' ) { <nl> + length + = 1 ; <nl> + if ( ! option . regexp ) { <nl> + warn_at ( ' insecure_a ' , line , from + length , c ) ; <nl> + } else if ( source_row . charAt ( length ) = = = ' ] ' ) { <nl> + stop_at ( ' unescaped_a ' , line , from + length , ' ^ ' ) ; <nl> + } <nl> + } <nl> + bit = false ; <nl> + if ( c = = = ' ] ' ) { <nl> + warn_at ( ' empty_class ' , line , from + length - 1 ) ; <nl> + bit = true ; <nl> + } <nl> + klass : do { <nl> + c = source_row . charAt ( length ) ; <nl> + length + = 1 ; <nl> + switch ( c ) { <nl> + case ' [ ' : <nl> + case ' ^ ' : <nl> + warn_at ( ' unescaped_a ' , line , from + length , c ) ; <nl> + bit = true ; <nl> + break ; <nl> + case ' - ' : <nl> + if ( bit ) { <nl> + bit = false ; <nl> + } else { <nl> + warn_at ( ' unescaped_a ' , line , from + length , ' - ' ) ; <nl> + bit = true ; <nl> + } <nl> + break ; <nl> + case ' ] ' : <nl> + if ( ! bit ) { <nl> + warn_at ( ' unescaped_a ' , line , from + length - 1 , ' - ' ) ; <nl> + } <nl> + break klass ; <nl> + case ' \ \ ' : <nl> + c = source_row . charAt ( length ) ; <nl> + if ( c < ' ' ) { <nl> + warn_at ( bundle . control_a , line , from + length , String ( c ) ) ; <nl> + } else if ( c = = = ' < ' ) { <nl> + warn_at ( bundle . unexpected_a , line , from + length , ' \ \ ' ) ; <nl> + } <nl> + length + = 1 ; <nl> + bit = true ; <nl> + break ; <nl> + case ' / ' : <nl> + warn_at ( ' unescaped_a ' , line , from + length - 1 , ' / ' ) ; <nl> + bit = true ; <nl> + break ; <nl> + case ' < ' : <nl> + if ( xmode = = = ' script ' ) { <nl> + c = source_row . charAt ( length ) ; <nl> + if ( c = = = ' ! ' | | c = = = ' / ' ) { <nl> + warn_at ( bundle . html_confusion_a , line , <nl> + from + length , c ) ; <nl> + } <nl> + } <nl> + bit = true ; <nl> + break ; <nl> + default : <nl> + bit = true ; <nl> + } <nl> + } while ( c ) ; <nl> + break ; <nl> + case ' . ' : <nl> + if ( ! option . regexp ) { <nl> + warn_at ( ' insecure_a ' , line , from + length , c ) ; <nl> + } <nl> + break ; <nl> + case ' ] ' : <nl> + case ' ? ' : <nl> + case ' { ' : <nl> + case ' } ' : <nl> + case ' + ' : <nl> + case ' * ' : <nl> + warn_at ( ' unescaped_a ' , line , from + length , c ) ; <nl> + break ; <nl> + case ' < ' : <nl> + if ( xmode = = = ' script ' ) { <nl> + c = source_row . charAt ( length ) ; <nl> + if ( c = = = ' ! ' | | c = = = ' / ' ) { <nl> + warn_at ( bundle . html_confusion_a , line , from + length , c ) ; <nl> + } <nl> + } <nl> + break ; <nl> + } <nl> + if ( b ) { <nl> + switch ( source_row . charAt ( length ) ) { <nl> + case ' ? ' : <nl> + case ' + ' : <nl> + case ' * ' : <nl> + length + = 1 ; <nl> + if ( source_row . charAt ( length ) = = = ' ? ' ) { <nl> + length + = 1 ; <nl> + } <nl> + break ; <nl> + case ' { ' : <nl> + length + = 1 ; <nl> + c = source_row . charAt ( length ) ; <nl> + if ( c < ' 0 ' | | c > ' 9 ' ) { <nl> + warn_at ( bundle . expected_number_a , line , <nl> + from + length , c ) ; <nl> + } <nl> + length + = 1 ; <nl> + low = + c ; <nl> + for ( ; ; ) { <nl> + c = source_row . charAt ( length ) ; <nl> + if ( c < ' 0 ' | | c > ' 9 ' ) { <nl> + break ; <nl> + } <nl> + length + = 1 ; <nl> + low = + c + ( low * 10 ) ; <nl> + } <nl> + high = low ; <nl> + if ( c = = = ' , ' ) { <nl> + length + = 1 ; <nl> + high = Infinity ; <nl> + c = source_row . charAt ( length ) ; <nl> + if ( c > = ' 0 ' & & c < = ' 9 ' ) { <nl> + length + = 1 ; <nl> + high = + c ; <nl> + for ( ; ; ) { <nl> + c = source_row . charAt ( length ) ; <nl> + if ( c < ' 0 ' | | c > ' 9 ' ) { <nl> + break ; <nl> + } <nl> + length + = 1 ; <nl> + high = + c + ( high * 10 ) ; <nl> + } <nl> + } <nl> + } <nl> + if ( source_row . charAt ( length ) ! = = ' } ' ) { <nl> + warn_at ( bundle . expected_a_b , line , from + length , <nl> + ' } ' , c ) ; <nl> + } else { <nl> + length + = 1 ; <nl> + } <nl> + if ( source_row . charAt ( length ) = = = ' ? ' ) { <nl> + length + = 1 ; <nl> + } <nl> + if ( low > high ) { <nl> + warn_at ( bundle . not_greater , line , from + length , <nl> + low , high ) ; <nl> + } <nl> + break ; <nl> + } <nl> + } <nl> + } <nl> + c = source_row . slice ( 0 , length - 1 ) ; <nl> + character + = length ; <nl> + source_row = source_row . slice ( length ) ; <nl> + return it ( ' ( regexp ) ' , c ) ; <nl> + } <nl> + <nl> + / / Public lex methods <nl> + <nl> + return { <nl> + init : function ( source ) { <nl> + if ( typeof source = = = ' string ' ) { <nl> + lines = source . split ( crlfx ) ; <nl> + } else { <nl> + lines = source ; <nl> + } <nl> + line = 0 ; <nl> + next_line ( ) ; <nl> + from = 1 ; <nl> + } , <nl> + <nl> + range : function ( begin , end ) { <nl> + var c , value = ' ' ; <nl> + from = character ; <nl> + if ( source_row . charAt ( 0 ) ! = = begin ) { <nl> + stop_at ( ' expected_a_b ' , line , character , begin , <nl> + source_row . charAt ( 0 ) ) ; <nl> + } <nl> + for ( ; ; ) { <nl> + source_row = source_row . slice ( 1 ) ; <nl> + character + = 1 ; <nl> + c = source_row . charAt ( 0 ) ; <nl> + switch ( c ) { <nl> + case ' ' : <nl> + stop_at ( ' missing_a ' , line , character , c ) ; <nl> + break ; <nl> + case end : <nl> + source_row = source_row . slice ( 1 ) ; <nl> + character + = 1 ; <nl> + return it ( ' ( range ) ' , value ) ; <nl> + case xquote : <nl> + case ' \ \ ' : <nl> + warn_at ( ' unexpected_a ' , line , character , c ) ; <nl> + break ; <nl> + } <nl> + value + = c ; <nl> + } <nl> + } , <nl> + <nl> + / / token - - this is called by advance to get the next token . <nl> + <nl> + token : function ( ) { <nl> + var c , i , snippet ; <nl> + <nl> + for ( ; ; ) { <nl> + while ( ! source_row ) { <nl> + if ( ! next_line ( ) ) { <nl> + return it ( ' ( end ) ' ) ; <nl> + } <nl> + } <nl> + while ( xmode = = = ' outer ' ) { <nl> + i = source_row . search ( ox ) ; <nl> + if ( i = = = 0 ) { <nl> + break ; <nl> + } else if ( i > 0 ) { <nl> + character + = 1 ; <nl> + source_row = source_row . slice ( i ) ; <nl> + break ; <nl> + } else { <nl> + if ( ! next_line ( ) ) { <nl> + return it ( ' ( end ) ' , ' ' ) ; <nl> + } <nl> + } <nl> + } <nl> + snippet = match ( rx [ xmode ] | | tx ) ; <nl> + if ( ! snippet ) { <nl> + if ( source_row ) { <nl> + if ( source_row . charAt ( 0 ) = = = ' ' ) { <nl> + if ( ! option . white ) { <nl> + warn_at ( ' unexpected_a ' , line , character , <nl> + ' ( space ) ' ) ; <nl> + } <nl> + character + = 1 ; <nl> + source_row = ' ' ; <nl> + } else { <nl> + stop_at ( ' unexpected_a ' , line , character , <nl> + source_row . charAt ( 0 ) ) ; <nl> + } <nl> + } <nl> + } else { <nl> + <nl> + / / identifier <nl> + <nl> + c = snippet . charAt ( 0 ) ; <nl> + if ( c . isAlpha ( ) | | c = = = ' _ ' | | c = = = ' $ ' ) { <nl> + return it ( ' ( identifier ) ' , snippet ) ; <nl> + } <nl> + <nl> + / / number <nl> + <nl> + if ( c . isDigit ( ) ) { <nl> + return number ( snippet ) ; <nl> + } <nl> + switch ( snippet ) { <nl> + <nl> + / / string <nl> + <nl> + case ' " ' : <nl> + case " ' " : <nl> + return string ( snippet ) ; <nl> + <nl> + / / / / comment <nl> + <nl> + case ' / / ' : <nl> + comment ( source_row ) ; <nl> + source_row = ' ' ; <nl> + break ; <nl> + <nl> + / / / * comment <nl> + <nl> + case ' / * ' : <nl> + for ( ; ; ) { <nl> + i = source_row . search ( lx ) ; <nl> + if ( i > = 0 ) { <nl> + break ; <nl> + } <nl> + comment ( source_row ) ; <nl> + if ( ! next_line ( ) ) { <nl> + stop_at ( ' unclosed_comment ' , line , character ) ; <nl> + } <nl> + } <nl> + comment ( source_row . slice ( 0 , i ) ) ; <nl> + character + = i + 2 ; <nl> + if ( source_row . charAt ( i ) = = = ' / ' ) { <nl> + stop_at ( ' nested_comment ' , line , character ) ; <nl> + } <nl> + source_row = source_row . slice ( i + 2 ) ; <nl> + break ; <nl> + <nl> + case ' ' : <nl> + break ; <nl> + / / / <nl> + case ' / ' : <nl> + if ( token . id = = = ' / = ' ) { <nl> + stop_at ( <nl> + bundle . slash_equal , <nl> + line , <nl> + from <nl> + ) ; <nl> + } <nl> + return prereg <nl> + ? regexp ( ) <nl> + : it ( ' ( punctuator ) ' , snippet ) ; <nl> + <nl> + / / punctuator <nl> + <nl> + case ' < ! - - ' : <nl> + length = line ; <nl> + / / c = character ; <nl> + for ( ; ; ) { <nl> + i = source_row . indexOf ( ' - - ' ) ; <nl> + if ( i > = 0 ) { <nl> + break ; <nl> + } <nl> + i = source_row . indexOf ( ' < ! ' ) ; <nl> + if ( i > = 0 ) { <nl> + stop_at ( ' nested_comment ' , <nl> + line , character + i ) ; <nl> + } <nl> + if ( ! next_line ( ) ) { <nl> + stop_at ( ' unclosed_comment ' , length , c ) ; <nl> + } <nl> + } <nl> + length = source_row . indexOf ( ' < ! ' ) ; <nl> + if ( length > = 0 & & length < i ) { <nl> + stop_at ( ' nested_comment ' , <nl> + line , character + length ) ; <nl> + } <nl> + character + = i ; <nl> + if ( source_row . charAt ( i + 2 ) ! = = ' > ' ) { <nl> + stop_at ( ' expected_a ' , line , character , ' - - > ' ) ; <nl> + } <nl> + character + = 3 ; <nl> + source_row = source_row . slice ( i + 3 ) ; <nl> + break ; <nl> + case ' # ' : <nl> + if ( xmode = = = ' html ' | | xmode = = = ' styleproperty ' ) { <nl> + for ( ; ; ) { <nl> + c = source_row . charAt ( 0 ) ; <nl> + if ( ( c < ' 0 ' | | c > ' 9 ' ) & & <nl> + ( c < ' a ' | | c > ' f ' ) & & <nl> + ( c < ' A ' | | c > ' F ' ) ) { <nl> + break ; <nl> + } <nl> + character + = 1 ; <nl> + source_row = source_row . slice ( 1 ) ; <nl> + snippet + = c ; <nl> + } <nl> + if ( snippet . length ! = = 4 & & snippet . length ! = = 7 ) { <nl> + warn_at ( ' bad_color_a ' , line , <nl> + from + length , snippet ) ; <nl> + } <nl> + return it ( ' ( color ) ' , snippet ) ; <nl> + } <nl> + return it ( ' ( punctuator ) ' , snippet ) ; <nl> + <nl> + default : <nl> + if ( xmode = = = ' outer ' & & c = = = ' & ' ) { <nl> + character + = 1 ; <nl> + source_row = source_row . slice ( 1 ) ; <nl> + for ( ; ; ) { <nl> + c = source_row . charAt ( 0 ) ; <nl> + character + = 1 ; <nl> + source_row = source_row . slice ( 1 ) ; <nl> + if ( c = = = ' ; ' ) { <nl> + break ; <nl> + } <nl> + if ( ! ( ( c > = ' 0 ' & & c < = ' 9 ' ) | | <nl> + ( c > = ' a ' & & c < = ' z ' ) | | <nl> + c = = = ' # ' ) ) { <nl> + stop_at ( ' bad_entity ' , line , from + length , <nl> + character ) ; <nl> + } <nl> + } <nl> + break ; <nl> + } <nl> + return it ( ' ( punctuator ) ' , snippet ) ; <nl> + } <nl> + } <nl> + } <nl> + } <nl> + } ; <nl> + } ( ) ) ; <nl> + <nl> + <nl> + function add_label ( token , kind , name ) { <nl> + <nl> + / / Define the symbol in the current function in the current scope . <nl> + <nl> + name = name | | token . string ; <nl> + <nl> + / / Global variables cannot be created in the safe subset . If a global variable <nl> + / / already exists , do nothing . If it is predefined , define it . <nl> + <nl> + if ( funct = = = global_funct ) { <nl> + if ( option . safe ) { <nl> + warn ( ' adsafe_a ' , token , name ) ; <nl> + } <nl> + if ( typeof global_funct [ name ] ! = = ' string ' ) { <nl> + token . writeable = typeof predefined [ name ] = = = ' boolean ' <nl> + ? predefined [ name ] <nl> + : true ; <nl> + token . funct = funct ; <nl> + global_scope [ name ] = token ; <nl> + } <nl> + if ( kind = = = ' becoming ' ) { <nl> + kind = ' var ' ; <nl> + } <nl> + <nl> + / / Ordinary variables . <nl> + <nl> + } else { <nl> + <nl> + / / Warn if the variable already exists . <nl> + <nl> + if ( typeof funct [ name ] = = = ' string ' ) { <nl> + if ( funct [ name ] = = = ' undef ' ) { <nl> + if ( ! option . undef ) { <nl> + warn ( ' used_before_a ' , token , name ) ; <nl> + } <nl> + kind = ' var ' ; <nl> + } else { <nl> + warn ( ' already_defined ' , token , name ) ; <nl> + } <nl> + } else { <nl> + <nl> + / / Add the symbol to the current function . <nl> + <nl> + token . funct = funct ; <nl> + token . writeable = true ; <nl> + scope [ name ] = token ; <nl> + } <nl> + } <nl> + funct [ name ] = kind ; <nl> + } <nl> + <nl> + <nl> + function peek ( distance ) { <nl> + <nl> + / / Peek ahead to a future token . The distance is how far ahead to look . The <nl> + / / default is the next token . <nl> + <nl> + var found , slot = 0 ; <nl> + <nl> + distance = distance | | 0 ; <nl> + while ( slot < = distance ) { <nl> + found = lookahead [ slot ] ; <nl> + if ( ! found ) { <nl> + found = lookahead [ slot ] = lex . token ( ) ; <nl> + } <nl> + slot + = 1 ; <nl> + } <nl> + return found ; <nl> + } <nl> + <nl> + <nl> + function advance ( id , match ) { <nl> + <nl> + / / Produce the next token , also looking for programming errors . <nl> + <nl> + if ( indent ) { <nl> + <nl> + / / If indentation checking was requested , then inspect all of the line breakings . <nl> + / / The var statement is tricky because the names might be aligned or not . We <nl> + / / look at the first line break after the var to determine the programmer ' s <nl> + / / intention . <nl> + <nl> + if ( var_mode & & next_token . line ! = = token . line ) { <nl> + if ( ( var_mode ! = = indent | | ! next_token . edge ) & & <nl> + next_token . from = = = indent . at - <nl> + ( next_token . edge ? option . indent : 0 ) ) { <nl> + var dent = indent ; <nl> + for ( ; ; ) { <nl> + dent . at - = option . indent ; <nl> + if ( dent = = = var_mode ) { <nl> + break ; <nl> + } <nl> + dent = dent . was ; <nl> + } <nl> + dent . open = false ; <nl> + } <nl> + var_mode = null ; <nl> + } <nl> + if ( next_token . id = = = ' ? ' & & indent . mode = = = ' : ' & & <nl> + token . line ! = = next_token . line ) { <nl> + indent . at - = option . indent ; <nl> + } <nl> + if ( indent . open ) { <nl> + <nl> + / / If the token is an edge . <nl> + <nl> + if ( next_token . edge ) { <nl> + if ( next_token . edge = = = ' label ' ) { <nl> + expected_at ( 1 ) ; <nl> + } else if ( next_token . edge = = = ' case ' | | indent . mode = = = ' statement ' ) { <nl> + expected_at ( indent . at - option . indent ) ; <nl> + } else if ( indent . mode ! = = ' array ' | | next_token . line ! = = token . line ) { <nl> + expected_at ( indent . at ) ; <nl> + } <nl> + <nl> + / / If the token is not an edge , but is the first token on the line . <nl> + <nl> + } else if ( next_token . line ! = = token . line ) { <nl> + if ( next_token . from < indent . at + ( indent . mode = = = <nl> + ' expression ' ? 0 : option . indent ) ) { <nl> + expected_at ( indent . at + option . indent ) ; <nl> + } <nl> + indent . wrap = true ; <nl> + } <nl> + } else if ( next_token . line ! = = token . line ) { <nl> + if ( next_token . edge ) { <nl> + expected_at ( indent . at ) ; <nl> + } else { <nl> + indent . wrap = true ; <nl> + if ( indent . mode = = = ' statement ' | | indent . mode = = = ' var ' ) { <nl> + expected_at ( indent . at + option . indent ) ; <nl> + } else if ( next_token . from < indent . at + ( indent . mode = = = <nl> + ' expression ' ? 0 : option . indent ) ) { <nl> + expected_at ( indent . at + option . indent ) ; <nl> + } <nl> + } <nl> + } <nl> + } <nl> + <nl> + switch ( token . id ) { <nl> + case ' ( number ) ' : <nl> + if ( next_token . id = = = ' . ' ) { <nl> + warn ( ' trailing_decimal_a ' ) ; <nl> + } <nl> + break ; <nl> + case ' - ' : <nl> + if ( next_token . id = = = ' - ' | | next_token . id = = = ' - - ' ) { <nl> + warn ( ' confusing_a ' ) ; <nl> + } <nl> + break ; <nl> + case ' + ' : <nl> + if ( next_token . id = = = ' + ' | | next_token . id = = = ' + + ' ) { <nl> + warn ( ' confusing_a ' ) ; <nl> + } <nl> + break ; <nl> + } <nl> + if ( token . id = = = ' ( string ) ' | | token . identifier ) { <nl> + anonname = token . string ; <nl> + } <nl> + <nl> + if ( id & & next_token . id ! = = id ) { <nl> + if ( match ) { <nl> + warn ( ' expected_a_b_from_c_d ' , next_token , id , <nl> + match . id , match . line , artifact ( ) ) ; <nl> + } else if ( ! next_token . identifier | | next_token . string ! = = id ) { <nl> + warn ( ' expected_a_b ' , next_token , id , artifact ( ) ) ; <nl> + } <nl> + } <nl> + prev_token = token ; <nl> + token = next_token ; <nl> + next_token = lookahead . shift ( ) | | lex . token ( ) ; <nl> + } <nl> + <nl> + <nl> + function advance_identifier ( string ) { <nl> + if ( next_token . identifier & & next_token . string = = = string ) { <nl> + advance ( ) ; <nl> + } else { <nl> + warn ( ' expected_a_b ' , next_token , string , artifact ( ) ) ; <nl> + } <nl> + } <nl> + <nl> + <nl> + function do_safe ( ) { <nl> + if ( option . adsafe ) { <nl> + option . safe = true ; <nl> + } <nl> + if ( option . safe ) { <nl> + option . browser = <nl> + option [ ' continue ' ] = <nl> + option . css = <nl> + option . debug = <nl> + option . devel = <nl> + option . evil = <nl> + option . forin = <nl> + option . newcap = <nl> + option . nomen = <nl> + option . on = <nl> + option . rhino = <nl> + option . sloppy = <nl> + option . sub = <nl> + option . undef = <nl> + option . windows = false ; <nl> + <nl> + <nl> + delete predefined . Array ; <nl> + delete predefined . Date ; <nl> + delete predefined . Function ; <nl> + delete predefined . Object ; <nl> + delete predefined [ ' eval ' ] ; <nl> + <nl> + add_to_predefined ( { <nl> + ADSAFE : false , <nl> + lib : false <nl> + } ) ; <nl> + } <nl> + } <nl> + <nl> + <nl> + function do_globals ( ) { <nl> + var name , writeable ; <nl> + for ( ; ; ) { <nl> + if ( next_token . id ! = = ' ( string ) ' & & ! next_token . identifier ) { <nl> + return ; <nl> + } <nl> + name = next_token . string ; <nl> + advance ( ) ; <nl> + writeable = false ; <nl> + if ( next_token . id = = = ' : ' ) { <nl> + advance ( ' : ' ) ; <nl> + switch ( next_token . id ) { <nl> + case ' true ' : <nl> + writeable = predefined [ name ] ! = = false ; <nl> + advance ( ' true ' ) ; <nl> + break ; <nl> + case ' false ' : <nl> + advance ( ' false ' ) ; <nl> + break ; <nl> + default : <nl> + stop ( ' unexpected_a ' ) ; <nl> + } <nl> + } <nl> + predefined [ name ] = writeable ; <nl> + if ( next_token . id ! = = ' , ' ) { <nl> + return ; <nl> + } <nl> + advance ( ' , ' ) ; <nl> + } <nl> + } <nl> + <nl> + <nl> + function do_jslint ( ) { <nl> + var name , value ; <nl> + while ( next_token . id = = = ' ( string ) ' | | next_token . identifier ) { <nl> + name = next_token . string ; <nl> + if ( ! allowed_option [ name ] ) { <nl> + stop ( ' unexpected_a ' ) ; <nl> + } <nl> + advance ( ) ; <nl> + if ( next_token . id ! = = ' : ' ) { <nl> + stop ( ' expected_a_b ' , next_token , ' : ' , artifact ( ) ) ; <nl> + } <nl> + advance ( ' : ' ) ; <nl> + if ( typeof allowed_option [ name ] = = = ' number ' ) { <nl> + value = next_token . number ; <nl> + if ( value > allowed_option [ name ] | | value < = 0 | | <nl> + Math . floor ( value ) ! = = value ) { <nl> + stop ( ' expected_small_a ' ) ; <nl> + } <nl> + option [ name ] = value ; <nl> + } else { <nl> + if ( next_token . id = = = ' true ' ) { <nl> + option [ name ] = true ; <nl> + } else if ( next_token . id = = = ' false ' ) { <nl> + option [ name ] = false ; <nl> + } else { <nl> + stop ( ' unexpected_a ' ) ; <nl> + } <nl> + } <nl> + advance ( ) ; <nl> + if ( next_token . id = = = ' , ' ) { <nl> + advance ( ' , ' ) ; <nl> + } <nl> + } <nl> + assume ( ) ; <nl> + } <nl> + <nl> + <nl> + function do_properties ( ) { <nl> + var name ; <nl> + option . properties = true ; <nl> + for ( ; ; ) { <nl> + if ( next_token . id ! = = ' ( string ) ' & & ! next_token . identifier ) { <nl> + return ; <nl> + } <nl> + name = next_token . string ; <nl> + advance ( ) ; <nl> + if ( next_token . id = = = ' : ' ) { <nl> + for ( ; ; ) { <nl> + advance ( ) ; <nl> + if ( next_token . id ! = = ' ( string ) ' & & ! next_token . identifier ) { <nl> + break ; <nl> + } <nl> + } <nl> + } <nl> + property [ name ] = 0 ; <nl> + if ( next_token . id ! = = ' , ' ) { <nl> + return ; <nl> + } <nl> + advance ( ' , ' ) ; <nl> + } <nl> + } <nl> + <nl> + <nl> + directive = function directive ( ) { <nl> + var command = this . id , <nl> + old_comments_off = comments_off , <nl> + old_indent = indent ; <nl> + comments_off = true ; <nl> + indent = null ; <nl> + if ( next_token . line = = = token . line & & next_token . from = = = token . thru ) { <nl> + warn ( ' missing_space_a_b ' , next_token , artifact ( token ) , artifact ( ) ) ; <nl> + } <nl> + if ( lookahead . length > 0 ) { <nl> + warn ( ' unexpected_a ' , this ) ; <nl> + } <nl> + switch ( command ) { <nl> + case ' / * properties ' : <nl> + case ' / * property ' : <nl> + case ' / * members ' : <nl> + case ' / * member ' : <nl> + do_properties ( ) ; <nl> + break ; <nl> + case ' / * jslint ' : <nl> + if ( option . safe ) { <nl> + warn ( ' adsafe_a ' , this ) ; <nl> + } <nl> + do_jslint ( ) ; <nl> + break ; <nl> + case ' / * globals ' : <nl> + case ' / * global ' : <nl> + if ( option . safe ) { <nl> + warn ( ' adsafe_a ' , this ) ; <nl> + } <nl> + do_globals ( ) ; <nl> + break ; <nl> + default : <nl> + stop ( ' unexpected_a ' , this ) ; <nl> + } <nl> + comments_off = old_comments_off ; <nl> + advance ( ' * / ' ) ; <nl> + indent = old_indent ; <nl> + } ; <nl> + <nl> + <nl> + / / Indentation intention <nl> + <nl> + function edge ( mode ) { <nl> + next_token . edge = indent ? indent . open & & ( mode | | ' edge ' ) : ' ' ; <nl> + } <nl> + <nl> + <nl> + function step_in ( mode ) { <nl> + var open ; <nl> + if ( typeof mode = = = ' number ' ) { <nl> + indent = { <nl> + at : + mode , <nl> + open : true , <nl> + was : indent <nl> + } ; <nl> + } else if ( ! indent ) { <nl> + indent = { <nl> + at : 1 , <nl> + mode : ' statement ' , <nl> + open : true <nl> + } ; <nl> + } else if ( mode = = = ' statement ' ) { <nl> + indent = { <nl> + at : indent . at , <nl> + open : true , <nl> + was : indent <nl> + } ; <nl> + } else { <nl> + open = mode = = = ' var ' | | next_token . line ! = = token . line ; <nl> + indent = { <nl> + at : ( open | | mode = = = ' control ' <nl> + ? indent . at + option . indent <nl> + : indent . at ) + ( indent . wrap ? option . indent : 0 ) , <nl> + mode : mode , <nl> + open : open , <nl> + was : indent <nl> + } ; <nl> + if ( mode = = = ' var ' & & open ) { <nl> + var_mode = indent ; <nl> + } <nl> + } <nl> + } <nl> + <nl> + function step_out ( id , symbol ) { <nl> + if ( id ) { <nl> + if ( indent & & indent . open ) { <nl> + indent . at - = option . indent ; <nl> + edge ( ) ; <nl> + } <nl> + advance ( id , symbol ) ; <nl> + } <nl> + if ( indent ) { <nl> + indent = indent . was ; <nl> + } <nl> + } <nl> + <nl> + / / Functions for conformance of whitespace . <nl> + <nl> + function one_space ( left , right ) { <nl> + left = left | | token ; <nl> + right = right | | next_token ; <nl> + if ( right . id ! = = ' ( end ) ' & & ! option . white & & <nl> + ( token . line ! = = right . line | | <nl> + token . thru + 1 ! = = right . from ) ) { <nl> + warn ( ' expected_space_a_b ' , right , artifact ( token ) , artifact ( right ) ) ; <nl> + } <nl> + } <nl> + <nl> + function one_space_only ( left , right ) { <nl> + left = left | | token ; <nl> + right = right | | next_token ; <nl> + if ( right . id ! = = ' ( end ) ' & & ( left . line ! = = right . line | | <nl> + ( ! option . white & & left . thru + 1 ! = = right . from ) ) ) { <nl> + warn ( ' expected_space_a_b ' , right , artifact ( left ) , artifact ( right ) ) ; <nl> + } <nl> + } <nl> + <nl> + function no_space ( left , right ) { <nl> + left = left | | token ; <nl> + right = right | | next_token ; <nl> + if ( ( ! option . white | | xmode = = = ' styleproperty ' | | xmode = = = ' style ' ) & & <nl> + left . thru ! = = right . from & & left . line = = = right . line ) { <nl> + warn ( ' unexpected_space_a_b ' , right , artifact ( left ) , artifact ( right ) ) ; <nl> + } <nl> + } <nl> + <nl> + function no_space_only ( left , right ) { <nl> + left = left | | token ; <nl> + right = right | | next_token ; <nl> + if ( right . id ! = = ' ( end ) ' & & ( left . line ! = = right . line | | <nl> + ( ! option . white & & left . thru ! = = right . from ) ) ) { <nl> + warn ( ' unexpected_space_a_b ' , right , artifact ( left ) , artifact ( right ) ) ; <nl> + } <nl> + } <nl> + <nl> + function spaces ( left , right ) { <nl> + if ( ! option . white ) { <nl> + left = left | | token ; <nl> + right = right | | next_token ; <nl> + if ( left . thru = = = right . from & & left . line = = = right . line ) { <nl> + warn ( ' missing_space_a_b ' , right , artifact ( left ) , artifact ( right ) ) ; <nl> + } <nl> + } <nl> + } <nl> + <nl> + function comma ( ) { <nl> + if ( next_token . id ! = = ' , ' ) { <nl> + warn_at ( ' expected_a_b ' , token . line , token . thru , ' , ' , artifact ( ) ) ; <nl> + } else { <nl> + if ( ! option . white ) { <nl> + no_space_only ( ) ; <nl> + } <nl> + advance ( ' , ' ) ; <nl> + spaces ( ) ; <nl> + } <nl> + } <nl> + <nl> + <nl> + function semicolon ( ) { <nl> + if ( next_token . id ! = = ' ; ' ) { <nl> + warn_at ( ' expected_a_b ' , token . line , token . thru , ' ; ' , artifact ( ) ) ; <nl> + } else { <nl> + if ( ! option . white ) { <nl> + no_space_only ( ) ; <nl> + } <nl> + advance ( ' ; ' ) ; <nl> + if ( semicolon_coda [ next_token . id ] ! = = true ) { <nl> + spaces ( ) ; <nl> + } <nl> + } <nl> + } <nl> + <nl> + function use_strict ( ) { <nl> + if ( next_token . string = = = ' use strict ' ) { <nl> + if ( strict_mode ) { <nl> + warn ( ' unnecessary_use ' ) ; <nl> + } <nl> + edge ( ) ; <nl> + advance ( ) ; <nl> + semicolon ( ) ; <nl> + strict_mode = true ; <nl> + option . undef = false ; <nl> + return true ; <nl> + } <nl> + return false ; <nl> + } <nl> + <nl> + <nl> + function are_similar ( a , b ) { <nl> + if ( a = = = b ) { <nl> + return true ; <nl> + } <nl> + if ( Array . isArray ( a ) ) { <nl> + if ( Array . isArray ( b ) & & a . length = = = b . length ) { <nl> + var i ; <nl> + for ( i = 0 ; i < a . length ; i + = 1 ) { <nl> + if ( ! are_similar ( a [ i ] , b [ i ] ) ) { <nl> + return false ; <nl> + } <nl> + } <nl> + return true ; <nl> + } <nl> + return false ; <nl> + } <nl> + if ( Array . isArray ( b ) ) { <nl> + return false ; <nl> + } <nl> + if ( a . id = = = ' ( number ) ' & & b . id = = = ' ( number ) ' ) { <nl> + return a . number = = = b . number ; <nl> + } <nl> + if ( a . arity = = = b . arity & & a . string = = = b . string ) { <nl> + switch ( a . arity ) { <nl> + case ' prefix ' : <nl> + case ' suffix ' : <nl> + case undefined : <nl> + return a . id = = = b . id & & are_similar ( a . first , b . first ) ; <nl> + case ' infix ' : <nl> + return are_similar ( a . first , b . first ) & & <nl> + are_similar ( a . second , b . second ) ; <nl> + case ' ternary ' : <nl> + return are_similar ( a . first , b . first ) & & <nl> + are_similar ( a . second , b . second ) & & <nl> + are_similar ( a . third , b . third ) ; <nl> + case ' function ' : <nl> + case ' regexp ' : <nl> + return false ; <nl> + default : <nl> + return true ; <nl> + } <nl> + } else { <nl> + if ( a . id = = = ' . ' & & b . id = = = ' [ ' & & b . arity = = = ' infix ' ) { <nl> + return a . second . string = = = b . second . string & & b . second . id = = = ' ( string ) ' ; <nl> + } <nl> + if ( a . id = = = ' [ ' & & a . arity = = = ' infix ' & & b . id = = = ' . ' ) { <nl> + return a . second . string = = = b . second . string & & a . second . id = = = ' ( string ) ' ; <nl> + } <nl> + } <nl> + return false ; <nl> + } <nl> + <nl> + <nl> + / / This is the heart of JSLINT , the Pratt parser . In addition to parsing , it <nl> + / / is looking for ad hoc lint patterns . We add . fud to Pratt ' s model , which is <nl> + / / like . nud except that it is only used on the first token of a statement . <nl> + / / Having . fud makes it much easier to define statement - oriented languages like <nl> + / / JavaScript . I retained Pratt ' s nomenclature . <nl> + <nl> + / / . nud Null denotation <nl> + / / . fud First null denotation <nl> + / / . led Left denotation <nl> + / / lbp Left binding power <nl> + / / rbp Right binding power <nl> + <nl> + / / They are elements of the parsing method called Top Down Operator Precedence . <nl> + <nl> + function expression ( rbp , initial ) { <nl> + <nl> + / / rbp is the right binding power . <nl> + / / initial indicates that this is the first expression of a statement . <nl> + <nl> + var left ; <nl> + if ( next_token . id = = = ' ( end ) ' ) { <nl> + stop ( ' unexpected_a ' , token , next_token . id ) ; <nl> + } <nl> + advance ( ) ; <nl> + if ( option . safe & & scope [ token . string ] & & <nl> + scope [ token . string ] = = = global_scope [ token . string ] & & <nl> + ( next_token . id ! = = ' ( ' & & next_token . id ! = = ' . ' ) ) { <nl> + warn ( ' adsafe_a ' , token ) ; <nl> + } <nl> + if ( initial ) { <nl> + anonname = ' anonymous ' ; <nl> + funct [ ' ( verb ) ' ] = token . string ; <nl> + } <nl> + if ( initial = = = true & & token . fud ) { <nl> + left = token . fud ( ) ; <nl> + } else { <nl> + if ( token . nud ) { <nl> + left = token . nud ( ) ; <nl> + } else { <nl> + if ( next_token . id = = = ' ( number ) ' & & token . id = = = ' . ' ) { <nl> + warn ( ' leading_decimal_a ' , token , artifact ( ) ) ; <nl> + advance ( ) ; <nl> + return token ; <nl> + } <nl> + stop ( ' expected_identifier_a ' , token , token . id ) ; <nl> + } <nl> + while ( rbp < next_token . lbp ) { <nl> + advance ( ) ; <nl> + if ( token . led ) { <nl> + left = token . led ( left ) ; <nl> + } else { <nl> + stop ( ' expected_operator_a ' , token , token . id ) ; <nl> + } <nl> + } <nl> + } <nl> + return left ; <nl> + } <nl> + <nl> + <nl> + / / Functional constructors for making the symbols that will be inherited by <nl> + / / tokens . <nl> + <nl> + function symbol ( s , p ) { <nl> + var x = syntax [ s ] ; <nl> + if ( ! x | | typeof x ! = = ' object ' ) { <nl> + syntax [ s ] = x = { <nl> + id : s , <nl> + lbp : p | | 0 , <nl> + string : s <nl> + } ; <nl> + } <nl> + return x ; <nl> + } <nl> + <nl> + function postscript ( x ) { <nl> + x . postscript = true ; <nl> + return x ; <nl> + } <nl> + <nl> + function ultimate ( s ) { <nl> + var x = symbol ( s , 0 ) ; <nl> + x . from = 1 ; <nl> + x . thru = 1 ; <nl> + x . line = 0 ; <nl> + x . edge = ' edge ' ; <nl> + s . string = s ; <nl> + return postscript ( x ) ; <nl> + } <nl> + <nl> + <nl> + function stmt ( s , f ) { <nl> + var x = symbol ( s ) ; <nl> + x . identifier = x . reserved = true ; <nl> + x . fud = f ; <nl> + return x ; <nl> + } <nl> + <nl> + function labeled_stmt ( s , f ) { <nl> + var x = stmt ( s , f ) ; <nl> + x . labeled = true ; <nl> + } <nl> + <nl> + function disrupt_stmt ( s , f ) { <nl> + var x = stmt ( s , f ) ; <nl> + x . disrupt = true ; <nl> + } <nl> + <nl> + <nl> + function reserve_name ( x ) { <nl> + var c = x . id . charAt ( 0 ) ; <nl> + if ( ( c > = ' a ' & & c < = ' z ' ) | | ( c > = ' A ' & & c < = ' Z ' ) ) { <nl> + x . identifier = x . reserved = true ; <nl> + } <nl> + return x ; <nl> + } <nl> + <nl> + <nl> + function prefix ( s , f ) { <nl> + var x = symbol ( s , 150 ) ; <nl> + reserve_name ( x ) ; <nl> + x . nud = typeof f = = = ' function ' <nl> + ? f <nl> + : function ( ) { <nl> + if ( s = = = ' typeof ' ) { <nl> + one_space ( ) ; <nl> + } else { <nl> + no_space_only ( ) ; <nl> + } <nl> + this . first = expression ( 150 ) ; <nl> + this . arity = ' prefix ' ; <nl> + if ( this . id = = = ' + + ' | | this . id = = = ' - - ' ) { <nl> + if ( ! option . plusplus ) { <nl> + warn ( ' unexpected_a ' , this ) ; <nl> + } else if ( ( ! this . first . identifier | | this . first . reserved ) & & <nl> + this . first . id ! = = ' . ' & & this . first . id ! = = ' [ ' ) { <nl> + warn ( ' bad_operand ' , this ) ; <nl> + } <nl> + } <nl> + return this ; <nl> + } ; <nl> + return x ; <nl> + } <nl> + <nl> + <nl> + function type ( s , t , nud ) { <nl> + var x = symbol ( s ) ; <nl> + x . arity = t ; <nl> + if ( nud ) { <nl> + x . nud = nud ; <nl> + } <nl> + return x ; <nl> + } <nl> + <nl> + <nl> + function reserve ( s , f ) { <nl> + var x = symbol ( s ) ; <nl> + x . identifier = x . reserved = true ; <nl> + if ( typeof f = = = ' function ' ) { <nl> + x . nud = f ; <nl> + } <nl> + return x ; <nl> + } <nl> + <nl> + <nl> + function constant ( name ) { <nl> + var x = reserve ( name ) ; <nl> + x . string = name ; <nl> + x . nud = return_this ; <nl> + return x ; <nl> + } <nl> + <nl> + <nl> + function reservevar ( s , v ) { <nl> + return reserve ( s , function ( ) { <nl> + if ( typeof v = = = ' function ' ) { <nl> + v ( this ) ; <nl> + } <nl> + return this ; <nl> + } ) ; <nl> + } <nl> + <nl> + <nl> + function infix ( s , p , f , w ) { <nl> + var x = symbol ( s , p ) ; <nl> + reserve_name ( x ) ; <nl> + x . led = function ( left ) { <nl> + this . arity = ' infix ' ; <nl> + if ( ! w ) { <nl> + spaces ( prev_token , token ) ; <nl> + spaces ( ) ; <nl> + } <nl> + if ( ! option . bitwise & & this . bitwise ) { <nl> + warn ( ' unexpected_a ' , this ) ; <nl> + } <nl> + if ( typeof f = = = ' function ' ) { <nl> + return f ( left , this ) ; <nl> + } <nl> + this . first = left ; <nl> + this . second = expression ( p ) ; <nl> + return this ; <nl> + } ; <nl> + return x ; <nl> + } <nl> + <nl> + function expected_relation ( node , message ) { <nl> + if ( node . assign ) { <nl> + warn ( message | | bundle . conditional_assignment , node ) ; <nl> + } <nl> + return node ; <nl> + } <nl> + <nl> + function expected_condition ( node , message ) { <nl> + switch ( node . id ) { <nl> + case ' [ ' : <nl> + case ' - ' : <nl> + if ( node . arity ! = = ' infix ' ) { <nl> + warn ( message | | bundle . weird_condition , node ) ; <nl> + } <nl> + break ; <nl> + case ' false ' : <nl> + case ' function ' : <nl> + case ' Infinity ' : <nl> + case ' NaN ' : <nl> + case ' null ' : <nl> + case ' true ' : <nl> + case ' undefined ' : <nl> + case ' void ' : <nl> + case ' ( number ) ' : <nl> + case ' ( regexp ) ' : <nl> + case ' ( string ) ' : <nl> + case ' { ' : <nl> + warn ( message | | bundle . weird_condition , node ) ; <nl> + break ; <nl> + case ' ( ' : <nl> + if ( node . first . id = = = ' . ' & & numbery [ node . first . second . string ] = = = true ) { <nl> + warn ( message | | bundle . weird_condition , node ) ; <nl> + } <nl> + break ; <nl> + } <nl> + return node ; <nl> + } <nl> + <nl> + function check_relation ( node ) { <nl> + switch ( node . arity ) { <nl> + case ' prefix ' : <nl> + switch ( node . id ) { <nl> + case ' { ' : <nl> + case ' [ ' : <nl> + warn ( ' unexpected_a ' , node ) ; <nl> + break ; <nl> + case ' ! ' : <nl> + warn ( ' confusing_a ' , node ) ; <nl> + break ; <nl> + } <nl> + break ; <nl> + case ' function ' : <nl> + case ' regexp ' : <nl> + warn ( ' unexpected_a ' , node ) ; <nl> + break ; <nl> + default : <nl> + if ( node . id = = = ' NaN ' ) { <nl> + warn ( ' isNaN ' , node ) ; <nl> + } <nl> + } <nl> + return node ; <nl> + } <nl> + <nl> + <nl> + function relation ( s , eqeq ) { <nl> + return infix ( s , 100 , function ( left , that ) { <nl> + check_relation ( left ) ; <nl> + if ( eqeq & & ! option . eqeq ) { <nl> + warn ( ' expected_a_b ' , that , eqeq , that . id ) ; <nl> + } <nl> + var right = expression ( 100 ) ; <nl> + if ( are_similar ( left , right ) | | <nl> + ( ( left . id = = = ' ( string ) ' | | left . id = = = ' ( number ) ' ) & & <nl> + ( right . id = = = ' ( string ) ' | | right . id = = = ' ( number ) ' ) ) ) { <nl> + warn ( ' weird_relation ' , that ) ; <nl> + } <nl> + that . first = left ; <nl> + that . second = check_relation ( right ) ; <nl> + return that ; <nl> + } ) ; <nl> + } <nl> + <nl> + <nl> + function assignop ( s , op ) { <nl> + var x = infix ( s , 20 , function ( left , that ) { <nl> + var l ; <nl> + that . first = left ; <nl> + if ( left . identifier ) { <nl> + if ( scope [ left . string ] ) { <nl> + if ( scope [ left . string ] . writeable = = = false ) { <nl> + warn ( ' read_only ' , left ) ; <nl> + } <nl> + } else { <nl> + stop ( ' read_only ' ) ; <nl> + } <nl> + if ( funct [ ' ( params ) ' ] ) { <nl> + funct [ ' ( params ) ' ] . forEach ( function ( value ) { <nl> + if ( value . string = = = left . string ) { <nl> + value . assign = true ; <nl> + } <nl> + } ) ; <nl> + } <nl> + } else if ( option . safe ) { <nl> + l = left ; <nl> + do { <nl> + if ( typeof predefined [ l . string ] = = = ' boolean ' ) { <nl> + warn ( ' adsafe_a ' , l ) ; <nl> + } <nl> + l = l . first ; <nl> + } while ( l ) ; <nl> + } <nl> + if ( left = = = syntax [ ' function ' ] ) { <nl> + warn ( ' identifier_function ' , token ) ; <nl> + } <nl> + if ( left . id = = = ' . ' | | left . id = = = ' [ ' ) { <nl> + if ( ! left . first | | left . first . string = = = ' arguments ' ) { <nl> + warn ( ' bad_assignment ' , that ) ; <nl> + } <nl> + } else if ( left . identifier ) { <nl> + if ( ! left . reserved & & funct [ left . string ] = = = ' exception ' ) { <nl> + warn ( ' assign_exception ' , left ) ; <nl> + } <nl> + } else { <nl> + warn ( ' bad_assignment ' , that ) ; <nl> + } <nl> + that . second = expression ( 19 ) ; <nl> + if ( that . id = = = ' = ' & & are_similar ( that . first , that . second ) ) { <nl> + warn ( ' weird_assignment ' , that ) ; <nl> + } <nl> + return that ; <nl> + } ) ; <nl> + x . assign = true ; <nl> + if ( op ) { <nl> + if ( syntax [ op ] . bitwise ) { <nl> + x . bitwise = true ; <nl> + } <nl> + } <nl> + return x ; <nl> + } <nl> + <nl> + <nl> + function bitwise ( s , p ) { <nl> + var x = infix ( s , p , ' number ' ) ; <nl> + x . bitwise = true ; <nl> + return x ; <nl> + } <nl> + <nl> + <nl> + function suffix ( s ) { <nl> + var x = symbol ( s , 150 ) ; <nl> + x . led = function ( left ) { <nl> + no_space_only ( prev_token , token ) ; <nl> + if ( ! option . plusplus ) { <nl> + warn ( ' unexpected_a ' , this ) ; <nl> + } else if ( ( ! left . identifier | | left . reserved ) & & <nl> + left . id ! = = ' . ' & & left . id ! = = ' [ ' ) { <nl> + warn ( ' bad_operand ' , this ) ; <nl> + } <nl> + this . first = left ; <nl> + this . arity = ' suffix ' ; <nl> + return this ; <nl> + } ; <nl> + return x ; <nl> + } <nl> + <nl> + <nl> + function optional_identifier ( ) { <nl> + if ( next_token . identifier ) { <nl> + advance ( ) ; <nl> + if ( option . safe & & banned [ token . string ] ) { <nl> + warn ( ' adsafe_a ' , token ) ; <nl> + } else if ( token . reserved & & ! option . es5 ) { <nl> + warn ( ' expected_identifier_a_reserved ' , token ) ; <nl> + } <nl> + return token . string ; <nl> + } <nl> + } <nl> + <nl> + <nl> + function identifier ( ) { <nl> + var i = optional_identifier ( ) ; <nl> + if ( ! i ) { <nl> + stop ( token . id = = = ' function ' & & next_token . id = = = ' ( ' <nl> + ? ' name_function ' <nl> + : ' expected_identifier_a ' ) ; <nl> + } <nl> + return i ; <nl> + } <nl> + <nl> + <nl> + function statement ( ) { <nl> + <nl> + var label , old_scope = scope , the_statement ; <nl> + <nl> + / / We don ' t like the empty statement . <nl> + <nl> + if ( next_token . id = = = ' ; ' ) { <nl> + warn ( ' unexpected_a ' ) ; <nl> + semicolon ( ) ; <nl> + return ; <nl> + } <nl> + <nl> + / / Is this a labeled statement ? <nl> + <nl> + if ( next_token . identifier & & ! next_token . reserved & & peek ( ) . id = = = ' : ' ) { <nl> + edge ( ' label ' ) ; <nl> + label = next_token ; <nl> + advance ( ) ; <nl> + advance ( ' : ' ) ; <nl> + scope = Object . create ( old_scope ) ; <nl> + add_label ( label , ' label ' ) ; <nl> + if ( next_token . labeled ! = = true | | funct = = = global_funct ) { <nl> + stop ( ' unexpected_label_a ' , label ) ; <nl> + } else if ( jx . test ( label . string + ' : ' ) ) { <nl> + warn ( ' url ' , label ) ; <nl> + } <nl> + next_token . label = label ; <nl> + } <nl> + <nl> + / / Parse the statement . <nl> + <nl> + if ( token . id ! = = ' else ' ) { <nl> + edge ( ) ; <nl> + } <nl> + step_in ( ' statement ' ) ; <nl> + the_statement = expression ( 0 , true ) ; <nl> + if ( the_statement ) { <nl> + <nl> + / / Look for the final semicolon . <nl> + <nl> + if ( the_statement . arity = = = ' statement ' ) { <nl> + if ( the_statement . id = = = ' switch ' | | <nl> + ( the_statement . block & & the_statement . id ! = = ' do ' ) ) { <nl> + spaces ( ) ; <nl> + } else { <nl> + semicolon ( ) ; <nl> + } <nl> + } else { <nl> + <nl> + / / If this is an expression statement , determine if it is acceptable . <nl> + / / We do not like <nl> + / / new Blah ( ) ; <nl> + / / statments . If it is to be used at all , new should only be used to make <nl> + / / objects , not side effects . The expression statements we do like do <nl> + / / assignment or invocation or delete . <nl> + <nl> + if ( the_statement . id = = = ' ( ' ) { <nl> + if ( the_statement . first . id = = = ' new ' ) { <nl> + warn ( ' bad_new ' ) ; <nl> + } <nl> + } else if ( ! the_statement . assign & & <nl> + the_statement . id ! = = ' delete ' & & <nl> + the_statement . id ! = = ' + + ' & & <nl> + the_statement . id ! = = ' - - ' ) { <nl> + warn ( ' assignment_function_expression ' , token ) ; <nl> + } <nl> + semicolon ( ) ; <nl> + } <nl> + } <nl> + step_out ( ) ; <nl> + scope = old_scope ; <nl> + return the_statement ; <nl> + } <nl> + <nl> + <nl> + function statements ( ) { <nl> + var array = [ ] , disruptor , the_statement ; <nl> + <nl> + / / A disrupt statement may not be followed by any other statement . <nl> + / / If the last statement is disrupt , then the sequence is disrupt . <nl> + <nl> + while ( next_token . postscript ! = = true ) { <nl> + if ( next_token . id = = = ' ; ' ) { <nl> + warn ( ' unexpected_a ' , next_token ) ; <nl> + semicolon ( ) ; <nl> + } else { <nl> + if ( next_token . string = = = ' use strict ' ) { <nl> + if ( ( ! node_js & & xmode ! = = ' script ' ) | | funct ! = = global_funct | | array . length > 0 ) { <nl> + warn ( ' function_strict ' ) ; <nl> + } <nl> + use_strict ( ) ; <nl> + } <nl> + if ( disruptor ) { <nl> + warn ( ' unreachable_a_b ' , next_token , next_token . string , <nl> + disruptor . string ) ; <nl> + disruptor = null ; <nl> + } <nl> + the_statement = statement ( ) ; <nl> + if ( the_statement ) { <nl> + array . push ( the_statement ) ; <nl> + if ( the_statement . disrupt ) { <nl> + disruptor = the_statement ; <nl> + array . disrupt = true ; <nl> + } <nl> + } <nl> + } <nl> + } <nl> + return array ; <nl> + } <nl> + <nl> + <nl> + function block ( ordinary ) { <nl> + <nl> + / / array block is array sequence of statements wrapped in braces . <nl> + / / ordinary is false for function bodies and try blocks . <nl> + / / ordinary is true for if statements , while , etc . <nl> + <nl> + var array , <nl> + curly = next_token , <nl> + old_in_block = in_block , <nl> + old_scope = scope , <nl> + old_strict_mode = strict_mode ; <nl> + <nl> + in_block = ordinary ; <nl> + scope = Object . create ( scope ) ; <nl> + spaces ( ) ; <nl> + if ( next_token . id = = = ' { ' ) { <nl> + advance ( ' { ' ) ; <nl> + step_in ( ) ; <nl> + if ( ! ordinary & & ! use_strict ( ) & & ! old_strict_mode & & <nl> + ! option . sloppy & & funct [ ' ( context ) ' ] = = = global_funct ) { <nl> + warn ( ' missing_use_strict ' ) ; <nl> + } <nl> + array = statements ( ) ; <nl> + strict_mode = old_strict_mode ; <nl> + step_out ( ' } ' , curly ) ; <nl> + } else if ( ! ordinary ) { <nl> + stop ( ' expected_a_b ' , next_token , ' { ' , artifact ( ) ) ; <nl> + } else { <nl> + warn ( ' expected_a_b ' , next_token , ' { ' , artifact ( ) ) ; <nl> + array = [ statement ( ) ] ; <nl> + array . disrupt = array [ 0 ] . disrupt ; <nl> + } <nl> + funct [ ' ( verb ) ' ] = null ; <nl> + scope = old_scope ; <nl> + in_block = old_in_block ; <nl> + if ( ordinary & & array . length = = = 0 ) { <nl> + warn ( ' empty_block ' ) ; <nl> + } <nl> + return array ; <nl> + } <nl> + <nl> + <nl> + function tally_property ( name ) { <nl> + if ( option . properties & & typeof property [ name ] ! = = ' number ' ) { <nl> + warn ( ' unexpected_property_a ' , token , name ) ; <nl> + } <nl> + if ( typeof property [ name ] = = = ' number ' ) { <nl> + property [ name ] + = 1 ; <nl> + } else { <nl> + property [ name ] = 1 ; <nl> + } <nl> + } <nl> + <nl> + <nl> + / / ECMAScript parser <nl> + <nl> + syntax [ ' ( identifier ) ' ] = { <nl> + id : ' ( identifier ) ' , <nl> + lbp : 0 , <nl> + identifier : true , <nl> + nud : function ( ) { <nl> + var name = this . string , <nl> + variable = scope [ name ] , <nl> + site , <nl> + writeable ; <nl> + <nl> + / / If the variable is not in scope , then we may have an undeclared variable . <nl> + / / Check the predefined list . If it was predefined , create the global <nl> + / / variable . <nl> + <nl> + if ( typeof variable ! = = ' object ' ) { <nl> + writeable = predefined [ name ] ; <nl> + if ( typeof writeable = = = ' boolean ' ) { <nl> + global_scope [ name ] = variable = { <nl> + string : name , <nl> + writeable : writeable , <nl> + funct : global_funct <nl> + } ; <nl> + global_funct [ name ] = ' var ' ; <nl> + <nl> + / / But if the variable is not in scope , and is not predefined , and if we are not <nl> + / / in the global scope , then we have an undefined variable error . <nl> + <nl> + } else { <nl> + if ( ! option . undef ) { <nl> + warn ( ' used_before_a ' , token ) ; <nl> + } <nl> + scope [ name ] = variable = { <nl> + string : name , <nl> + writeable : true , <nl> + funct : funct <nl> + } ; <nl> + funct [ name ] = ' undef ' ; <nl> + } <nl> + <nl> + } <nl> + site = variable . funct ; <nl> + <nl> + / / The name is in scope and defined in the current function . <nl> + <nl> + if ( funct = = = site ) { <nl> + <nl> + / / Change ' unused ' to ' var ' , and reject labels . <nl> + <nl> + switch ( funct [ name ] ) { <nl> + case ' becoming ' : <nl> + warn ( ' unexpected_a ' , token ) ; <nl> + funct [ name ] = ' var ' ; <nl> + break ; <nl> + case ' unused ' : <nl> + funct [ name ] = ' var ' ; <nl> + break ; <nl> + case ' unparam ' : <nl> + funct [ name ] = ' parameter ' ; <nl> + break ; <nl> + case ' unction ' : <nl> + funct [ name ] = ' function ' ; <nl> + break ; <nl> + case ' label ' : <nl> + warn ( ' a_label ' , token , name ) ; <nl> + break ; <nl> + } <nl> + <nl> + / / If the name is already defined in the current <nl> + / / function , but not as outer , then there is a scope error . <nl> + <nl> + } else { <nl> + switch ( funct [ name ] ) { <nl> + case ' closure ' : <nl> + case ' function ' : <nl> + case ' var ' : <nl> + case ' unused ' : <nl> + warn ( ' a_scope ' , token , name ) ; <nl> + break ; <nl> + case ' label ' : <nl> + warn ( ' a_label ' , token , name ) ; <nl> + break ; <nl> + case ' outer ' : <nl> + case ' global ' : <nl> + break ; <nl> + default : <nl> + <nl> + / / If the name is defined in an outer function , make an outer entry , and if <nl> + / / it was unused , make it var . <nl> + <nl> + switch ( site [ name ] ) { <nl> + case ' becoming ' : <nl> + case ' closure ' : <nl> + case ' function ' : <nl> + case ' parameter ' : <nl> + case ' unction ' : <nl> + case ' unused ' : <nl> + case ' var ' : <nl> + site [ name ] = ' closure ' ; <nl> + funct [ name ] = site = = = global_funct <nl> + ? ' global ' <nl> + : ' outer ' ; <nl> + break ; <nl> + case ' unparam ' : <nl> + site [ name ] = ' parameter ' ; <nl> + funct [ name ] = ' outer ' ; <nl> + break ; <nl> + case ' undef ' : <nl> + funct [ name ] = ' undef ' ; <nl> + break ; <nl> + case ' label ' : <nl> + warn ( ' a_label ' , token , name ) ; <nl> + break ; <nl> + } <nl> + } <nl> + } <nl> + return this ; <nl> + } , <nl> + led : function ( ) { <nl> + stop ( ' expected_operator_a ' ) ; <nl> + } <nl> + } ; <nl> + <nl> + / / Build the syntax table by declaring the syntactic elements . <nl> + <nl> + type ( ' ( array ) ' , ' array ' ) ; <nl> + type ( ' ( color ) ' , ' color ' ) ; <nl> + type ( ' ( function ) ' , ' function ' ) ; <nl> + type ( ' ( number ) ' , ' number ' , return_this ) ; <nl> + type ( ' ( object ) ' , ' object ' ) ; <nl> + type ( ' ( string ) ' , ' string ' , return_this ) ; <nl> + type ( ' ( boolean ) ' , ' boolean ' , return_this ) ; <nl> + type ( ' ( range ) ' , ' range ' ) ; <nl> + type ( ' ( regexp ) ' , ' regexp ' , return_this ) ; <nl> + <nl> + ultimate ( ' ( begin ) ' ) ; <nl> + ultimate ( ' ( end ) ' ) ; <nl> + ultimate ( ' ( error ) ' ) ; <nl> + postscript ( symbol ( ' < / ' ) ) ; <nl> + symbol ( ' < ! ' ) ; <nl> + symbol ( ' < ! - - ' ) ; <nl> + symbol ( ' - - > ' ) ; <nl> + postscript ( symbol ( ' } ' ) ) ; <nl> + symbol ( ' ) ' ) ; <nl> + symbol ( ' ] ' ) ; <nl> + postscript ( symbol ( ' " ' ) ) ; <nl> + postscript ( symbol ( ' \ ' ' ) ) ; <nl> + symbol ( ' ; ' ) ; <nl> + symbol ( ' : ' ) ; <nl> + symbol ( ' , ' ) ; <nl> + symbol ( ' # ' ) ; <nl> + symbol ( ' @ ' ) ; <nl> + symbol ( ' * / ' ) ; <nl> + postscript ( reserve ( ' case ' ) ) ; <nl> + reserve ( ' catch ' ) ; <nl> + postscript ( reserve ( ' default ' ) ) ; <nl> + reserve ( ' else ' ) ; <nl> + reserve ( ' finally ' ) ; <nl> + <nl> + reservevar ( ' arguments ' , function ( x ) { <nl> + if ( strict_mode & & funct = = = global_funct ) { <nl> + warn ( ' strict ' , x ) ; <nl> + } else if ( option . safe ) { <nl> + warn ( ' adsafe_a ' , x ) ; <nl> + } <nl> + funct [ ' ( arguments ) ' ] = true ; <nl> + } ) ; <nl> + reservevar ( ' eval ' , function ( x ) { <nl> + if ( option . safe ) { <nl> + warn ( ' adsafe_a ' , x ) ; <nl> + } <nl> + } ) ; <nl> + constant ( ' false ' , ' boolean ' ) ; <nl> + constant ( ' Infinity ' , ' number ' ) ; <nl> + constant ( ' NaN ' , ' number ' ) ; <nl> + constant ( ' null ' , ' ' ) ; <nl> + reservevar ( ' this ' , function ( x ) { <nl> + if ( option . safe ) { <nl> + warn ( ' adsafe_a ' , x ) ; <nl> + } else if ( strict_mode & & funct [ ' ( token ) ' ] & & <nl> + ( funct [ ' ( token ) ' ] . arity = = = ' statement ' & & <nl> + funct [ ' ( name ) ' ] . charAt ( 0 ) > ' Z ' ) ) { <nl> + warn ( ' strict ' , x ) ; <nl> + } <nl> + } ) ; <nl> + constant ( ' true ' , ' boolean ' ) ; <nl> + constant ( ' undefined ' , ' ' ) ; <nl> + <nl> + infix ( ' ? ' , 30 , function ( left , that ) { <nl> + step_in ( ' ? ' ) ; <nl> + that . first = expected_condition ( expected_relation ( left ) ) ; <nl> + that . second = expression ( 0 ) ; <nl> + spaces ( ) ; <nl> + step_out ( ) ; <nl> + var colon = next_token ; <nl> + advance ( ' : ' ) ; <nl> + step_in ( ' : ' ) ; <nl> + spaces ( ) ; <nl> + that . third = expression ( 10 ) ; <nl> + that . arity = ' ternary ' ; <nl> + if ( are_similar ( that . second , that . third ) ) { <nl> + warn ( ' weird_ternary ' , colon ) ; <nl> + } else if ( are_similar ( that . first , that . second ) ) { <nl> + warn ( ' use_or ' , that ) ; <nl> + } <nl> + step_out ( ) ; <nl> + return that ; <nl> + } ) ; <nl> + <nl> + infix ( ' | | ' , 40 , function ( left , that ) { <nl> + function paren_check ( that ) { <nl> + if ( that . id = = = ' & & ' & & ! that . paren ) { <nl> + warn ( ' and ' , that ) ; <nl> + } <nl> + return that ; <nl> + } <nl> + <nl> + that . first = paren_check ( expected_condition ( expected_relation ( left ) ) ) ; <nl> + that . second = paren_check ( expected_relation ( expression ( 40 ) ) ) ; <nl> + if ( are_similar ( that . first , that . second ) ) { <nl> + warn ( ' weird_condition ' , that ) ; <nl> + } <nl> + return that ; <nl> + } ) ; <nl> + <nl> + infix ( ' & & ' , 50 , function ( left , that ) { <nl> + that . first = expected_condition ( expected_relation ( left ) ) ; <nl> + that . second = expected_relation ( expression ( 50 ) ) ; <nl> + if ( are_similar ( that . first , that . second ) ) { <nl> + warn ( ' weird_condition ' , that ) ; <nl> + } <nl> + return that ; <nl> + } ) ; <nl> + <nl> + prefix ( ' void ' , function ( ) { <nl> + this . first = expression ( 0 ) ; <nl> + this . arity = ' prefix ' ; <nl> + if ( option . es5 ) { <nl> + warn ( ' expected_a_b ' , this , ' undefined ' , ' void ' ) ; <nl> + } else if ( this . first . number ! = = 0 ) { <nl> + warn ( ' expected_a_b ' , this . first , ' 0 ' , artifact ( this . first ) ) ; <nl> + } <nl> + return this ; <nl> + } ) ; <nl> + <nl> + bitwise ( ' | ' , 70 ) ; <nl> + bitwise ( ' ^ ' , 80 ) ; <nl> + bitwise ( ' & ' , 90 ) ; <nl> + <nl> + relation ( ' = = ' , ' = = = ' ) ; <nl> + relation ( ' = = = ' ) ; <nl> + relation ( ' ! = ' , ' ! = = ' ) ; <nl> + relation ( ' ! = = ' ) ; <nl> + relation ( ' < ' ) ; <nl> + relation ( ' > ' ) ; <nl> + relation ( ' < = ' ) ; <nl> + relation ( ' > = ' ) ; <nl> + <nl> + bitwise ( ' < < ' , 120 ) ; <nl> + bitwise ( ' > > ' , 120 ) ; <nl> + bitwise ( ' > > > ' , 120 ) ; <nl> + <nl> + infix ( ' in ' , 120 , function ( left , that ) { <nl> + warn ( ' infix_in ' , that ) ; <nl> + that . left = left ; <nl> + that . right = expression ( 130 ) ; <nl> + return that ; <nl> + } ) ; <nl> + infix ( ' instanceof ' , 120 ) ; <nl> + infix ( ' + ' , 130 , function ( left , that ) { <nl> + if ( left . id = = = ' ( number ) ' ) { <nl> + if ( left . number = = = 0 ) { <nl> + warn ( ' unexpected_a ' , left , ' 0 ' ) ; <nl> + } <nl> + } else if ( left . id = = = ' ( string ) ' ) { <nl> + if ( left . string = = = ' ' ) { <nl> + warn ( ' expected_a_b ' , left , ' String ' , ' \ ' \ ' ' ) ; <nl> + } <nl> + } <nl> + var right = expression ( 130 ) ; <nl> + if ( right . id = = = ' ( number ) ' ) { <nl> + if ( right . number = = = 0 ) { <nl> + warn ( ' unexpected_a ' , right , ' 0 ' ) ; <nl> + } <nl> + } else if ( right . id = = = ' ( string ) ' ) { <nl> + if ( right . string = = = ' ' ) { <nl> + warn ( ' expected_a_b ' , right , ' String ' , ' \ ' \ ' ' ) ; <nl> + } <nl> + } <nl> + if ( left . id = = = right . id ) { <nl> + if ( left . id = = = ' ( string ) ' | | left . id = = = ' ( number ) ' ) { <nl> + if ( left . id = = = ' ( string ) ' ) { <nl> + left . string + = right . string ; <nl> + if ( jx . test ( left . string ) ) { <nl> + warn ( ' url ' , left ) ; <nl> + } <nl> + } else { <nl> + left . number + = right . number ; <nl> + } <nl> + left . thru = right . thru ; <nl> + return left ; <nl> + } <nl> + } <nl> + that . first = left ; <nl> + that . second = right ; <nl> + return that ; <nl> + } ) ; <nl> + prefix ( ' + ' , ' num ' ) ; <nl> + prefix ( ' ppp ' , function ( ) { <nl> + warn ( ' confusing_a ' , token ) ; <nl> + this . first = expression ( 150 ) ; <nl> + this . arity = ' prefix ' ; <nl> + return this ; <nl> + } ) ; <nl> + infix ( ' ppp ' , 130 , function ( left ) { <nl> + warn ( ' confusing_a ' , token ) ; <nl> + this . first = left ; <nl> + this . second = expression ( 130 ) ; <nl> + return this ; <nl> + } ) ; <nl> + infix ( ' - ' , 130 , function ( left , that ) { <nl> + if ( ( left . id = = = ' ( number ) ' & & left . number = = = 0 ) | | left . id = = = ' ( string ) ' ) { <nl> + warn ( ' unexpected_a ' , left ) ; <nl> + } <nl> + var right = expression ( 130 ) ; <nl> + if ( ( right . id = = = ' ( number ) ' & & right . number = = = 0 ) | | right . id = = = ' ( string ) ' ) { <nl> + warn ( ' unexpected_a ' , right ) ; <nl> + } <nl> + if ( left . id = = = right . id & & left . id = = = ' ( number ) ' ) { <nl> + left . number - = right . number ; <nl> + left . thru = right . thru ; <nl> + return left ; <nl> + } <nl> + that . first = left ; <nl> + that . second = right ; <nl> + return that ; <nl> + } ) ; <nl> + prefix ( ' - ' ) ; <nl> + prefix ( ' mmm ' , function ( ) { <nl> + warn ( ' confusing_a ' , token ) ; <nl> + this . first = expression ( 150 ) ; <nl> + this . arity = ' prefix ' ; <nl> + return this ; <nl> + } ) ; <nl> + infix ( ' mmm ' , 130 , function ( left ) { <nl> + warn ( ' confusing_a ' , token ) ; <nl> + this . first = left ; <nl> + this . second = expression ( 130 ) ; <nl> + return this ; <nl> + } ) ; <nl> + infix ( ' * ' , 140 , function ( left , that ) { <nl> + if ( ( left . id = = = ' ( number ) ' & & ( left . number = = = 0 | | left . number = = = 1 ) ) | | left . id = = = ' ( string ) ' ) { <nl> + warn ( ' unexpected_a ' , left ) ; <nl> + } <nl> + var right = expression ( 140 ) ; <nl> + if ( ( right . id = = = ' ( number ) ' & & ( right . number = = = 0 | | right . number = = = 1 ) ) | | right . id = = = ' ( string ) ' ) { <nl> + warn ( ' unexpected_a ' , right ) ; <nl> + } <nl> + if ( left . id = = = right . id & & left . id = = = ' ( number ) ' ) { <nl> + left . number * = right . number ; <nl> + left . thru = right . thru ; <nl> + return left ; <nl> + } <nl> + that . first = left ; <nl> + that . second = right ; <nl> + return that ; <nl> + } ) ; <nl> + infix ( ' / ' , 140 , function ( left , that ) { <nl> + if ( ( left . id = = = ' ( number ) ' & & left . number = = = 0 ) | | left . id = = = ' ( string ) ' ) { <nl> + warn ( ' unexpected_a ' , left ) ; <nl> + } <nl> + var right = expression ( 140 ) ; <nl> + if ( ( right . id = = = ' ( number ) ' & & ( right . number = = = 0 | | right . number = = = 1 ) ) | | right . id = = = ' ( string ) ' ) { <nl> + warn ( ' unexpected_a ' , right ) ; <nl> + } <nl> + if ( left . id = = = right . id & & left . id = = = ' ( number ) ' ) { <nl> + left . number / = right . number ; <nl> + left . thru = right . thru ; <nl> + return left ; <nl> + } <nl> + that . first = left ; <nl> + that . second = right ; <nl> + return that ; <nl> + } ) ; <nl> + infix ( ' % ' , 140 , function ( left , that ) { <nl> + if ( ( left . id = = = ' ( number ) ' & & ( left . number = = = 0 | | left . number = = = 1 ) ) | | left . id = = = ' ( string ) ' ) { <nl> + warn ( ' unexpected_a ' , left ) ; <nl> + } <nl> + var right = expression ( 140 ) ; <nl> + if ( ( right . id = = = ' ( number ) ' & & right . number = = = 0 ) | | right . id = = = ' ( string ) ' ) { <nl> + warn ( ' unexpected_a ' , right ) ; <nl> + } <nl> + if ( left . id = = = right . id & & left . id = = = ' ( number ) ' ) { <nl> + left . number % = right . number ; <nl> + left . thru = right . thru ; <nl> + return left ; <nl> + } <nl> + that . first = left ; <nl> + that . second = right ; <nl> + return that ; <nl> + } ) ; <nl> + <nl> + suffix ( ' + + ' ) ; <nl> + prefix ( ' + + ' ) ; <nl> + <nl> + suffix ( ' - - ' ) ; <nl> + prefix ( ' - - ' ) ; <nl> + prefix ( ' delete ' , function ( ) { <nl> + one_space ( ) ; <nl> + var p = expression ( 0 ) ; <nl> + if ( ! p | | ( p . id ! = = ' . ' & & p . id ! = = ' [ ' ) ) { <nl> + warn ( ' deleted ' ) ; <nl> + } <nl> + this . first = p ; <nl> + return this ; <nl> + } ) ; <nl> + <nl> + <nl> + prefix ( ' ~ ' , function ( ) { <nl> + no_space_only ( ) ; <nl> + if ( ! option . bitwise ) { <nl> + warn ( ' unexpected_a ' , this ) ; <nl> + } <nl> + expression ( 150 ) ; <nl> + return this ; <nl> + } ) ; <nl> + prefix ( ' ! ' , function ( ) { <nl> + no_space_only ( ) ; <nl> + this . first = expected_condition ( expression ( 150 ) ) ; <nl> + this . arity = ' prefix ' ; <nl> + if ( bang [ this . first . id ] = = = true | | this . first . assign ) { <nl> + warn ( ' confusing_a ' , this ) ; <nl> + } <nl> + return this ; <nl> + } ) ; <nl> + prefix ( ' typeof ' , null ) ; <nl> + prefix ( ' new ' , function ( ) { <nl> + one_space ( ) ; <nl> + var c = expression ( 160 ) , n , p , v ; <nl> + this . first = c ; <nl> + if ( c . id ! = = ' function ' ) { <nl> + if ( c . identifier ) { <nl> + switch ( c . string ) { <nl> + case ' Object ' : <nl> + warn ( ' use_object ' , token ) ; <nl> + break ; <nl> + case ' Array ' : <nl> + if ( next_token . id = = = ' ( ' ) { <nl> + p = next_token ; <nl> + p . first = this ; <nl> + advance ( ' ( ' ) ; <nl> + if ( next_token . id ! = = ' ) ' ) { <nl> + n = expression ( 0 ) ; <nl> + p . second = [ n ] ; <nl> + if ( n . id ! = = ' ( number ) ' | | next_token . id = = = ' , ' ) { <nl> + warn ( ' use_array ' , p ) ; <nl> + } <nl> + while ( next_token . id = = = ' , ' ) { <nl> + advance ( ' , ' ) ; <nl> + p . second . push ( expression ( 0 ) ) ; <nl> + } <nl> + } else { <nl> + warn ( ' use_array ' , token ) ; <nl> + } <nl> + advance ( ' ) ' , p ) ; <nl> + return p ; <nl> + } <nl> + warn ( ' use_array ' , token ) ; <nl> + break ; <nl> + case ' Number ' : <nl> + case ' String ' : <nl> + case ' Boolean ' : <nl> + case ' Math ' : <nl> + case ' JSON ' : <nl> + warn ( ' not_a_constructor ' , c ) ; <nl> + break ; <nl> + case ' Function ' : <nl> + if ( ! option . evil ) { <nl> + warn ( ' function_eval ' ) ; <nl> + } <nl> + break ; <nl> + case ' Date ' : <nl> + case ' RegExp ' : <nl> + case ' this ' : <nl> + break ; <nl> + default : <nl> + if ( c . id ! = = ' function ' ) { <nl> + v = c . string . charAt ( 0 ) ; <nl> + if ( ! option . newcap & & ( v < ' A ' | | v > ' Z ' ) ) { <nl> + warn ( ' constructor_name_a ' , token ) ; <nl> + } <nl> + } <nl> + } <nl> + } else { <nl> + if ( c . id ! = = ' . ' & & c . id ! = = ' [ ' & & c . id ! = = ' ( ' ) { <nl> + warn ( ' bad_constructor ' , token ) ; <nl> + } <nl> + } <nl> + } else { <nl> + warn ( ' weird_new ' , this ) ; <nl> + } <nl> + if ( next_token . id ! = = ' ( ' ) { <nl> + warn ( ' missing_a ' , next_token , ' ( ) ' ) ; <nl> + } <nl> + return this ; <nl> + } ) ; <nl> + <nl> + infix ( ' ( ' , 160 , function ( left , that ) { <nl> + var p ; <nl> + if ( indent & & indent . mode = = = ' expression ' ) { <nl> + no_space ( prev_token , token ) ; <nl> + } else { <nl> + no_space_only ( prev_token , token ) ; <nl> + } <nl> + if ( ! left . immed & & left . id = = = ' function ' ) { <nl> + warn ( ' wrap_immediate ' ) ; <nl> + } <nl> + p = [ ] ; <nl> + if ( left . identifier ) { <nl> + if ( left . string . match ( / ^ [ A - Z ] ( [ A - Z0 - 9_ $ ] * [ a - z ] [ A - Za - z0 - 9_ $ ] * ) ? $ / ) ) { <nl> + if ( left . string ! = = ' Number ' & & left . string ! = = ' String ' & & <nl> + left . string ! = = ' Boolean ' & & left . string ! = = ' Date ' ) { <nl> + if ( left . string = = = ' Math ' | | left . string = = = ' JSON ' ) { <nl> + warn ( ' not_a_function ' , left ) ; <nl> + } else if ( left . string = = = ' Object ' ) { <nl> + warn ( ' use_object ' , token ) ; <nl> + } else if ( left . string = = = ' Array ' | | ! option . newcap ) { <nl> + warn ( ' missing_a ' , left , ' new ' ) ; <nl> + } <nl> + } <nl> + } <nl> + } else if ( left . id = = = ' . ' ) { <nl> + if ( option . safe & & left . first . string = = = ' Math ' & & <nl> + left . second = = = ' random ' ) { <nl> + warn ( ' adsafe_a ' , left ) ; <nl> + } else if ( left . second . string = = = ' split ' & & <nl> + left . first . id = = = ' ( string ) ' ) { <nl> + warn ( ' use_array ' , left . second ) ; <nl> + } <nl> + } <nl> + step_in ( ) ; <nl> + if ( next_token . id ! = = ' ) ' ) { <nl> + no_space ( ) ; <nl> + for ( ; ; ) { <nl> + edge ( ) ; <nl> + p . push ( expression ( 10 ) ) ; <nl> + if ( next_token . id ! = = ' , ' ) { <nl> + break ; <nl> + } <nl> + comma ( ) ; <nl> + } <nl> + } <nl> + no_space ( ) ; <nl> + step_out ( ' ) ' , that ) ; <nl> + if ( typeof left = = = ' object ' ) { <nl> + if ( left . string = = = ' parseInt ' & & p . length = = = 1 ) { <nl> + warn ( ' radix ' , left ) ; <nl> + } <nl> + if ( ! option . evil ) { <nl> + if ( left . string = = = ' eval ' | | left . string = = = ' Function ' | | <nl> + left . string = = = ' execScript ' ) { <nl> + warn ( ' evil ' , left ) ; <nl> + } else if ( p [ 0 ] & & p [ 0 ] . id = = = ' ( string ) ' & & <nl> + ( left . string = = = ' setTimeout ' | | <nl> + left . string = = = ' setInterval ' ) ) { <nl> + warn ( ' implied_evil ' , left ) ; <nl> + } <nl> + } <nl> + if ( ! left . identifier & & left . id ! = = ' . ' & & left . id ! = = ' [ ' & & <nl> + left . id ! = = ' ( ' & & left . id ! = = ' & & ' & & left . id ! = = ' | | ' & & <nl> + left . id ! = = ' ? ' ) { <nl> + warn ( ' bad_invocation ' , left ) ; <nl> + } <nl> + } <nl> + that . first = left ; <nl> + that . second = p ; <nl> + return that ; <nl> + } , true ) ; <nl> + <nl> + prefix ( ' ( ' , function ( ) { <nl> + step_in ( ' expression ' ) ; <nl> + no_space ( ) ; <nl> + edge ( ) ; <nl> + if ( next_token . id = = = ' function ' ) { <nl> + next_token . immed = true ; <nl> + } <nl> + var value = expression ( 0 ) ; <nl> + value . paren = true ; <nl> + no_space ( ) ; <nl> + step_out ( ' ) ' , this ) ; <nl> + if ( value . id = = = ' function ' ) { <nl> + switch ( next_token . id ) { <nl> + case ' ( ' : <nl> + warn ( ' move_invocation ' ) ; <nl> + break ; <nl> + case ' . ' : <nl> + case ' [ ' : <nl> + warn ( ' unexpected_a ' ) ; <nl> + break ; <nl> + default : <nl> + warn ( ' bad_wrap ' , this ) ; <nl> + } <nl> + } <nl> + return value ; <nl> + } ) ; <nl> + <nl> + infix ( ' . ' , 170 , function ( left , that ) { <nl> + no_space ( prev_token , token ) ; <nl> + no_space ( ) ; <nl> + var name = identifier ( ) ; <nl> + if ( typeof name = = = ' string ' ) { <nl> + tally_property ( name ) ; <nl> + } <nl> + that . first = left ; <nl> + that . second = token ; <nl> + if ( left & & left . string = = = ' arguments ' & & <nl> + ( name = = = ' callee ' | | name = = = ' caller ' ) ) { <nl> + warn ( ' avoid_a ' , left , ' arguments . ' + name ) ; <nl> + } else if ( ! option . evil & & left & & left . string = = = ' document ' & & <nl> + ( name = = = ' write ' | | name = = = ' writeln ' ) ) { <nl> + warn ( ' write_is_wrong ' , left ) ; <nl> + } else if ( ! option . stupid & & name . indexOf ( ' Sync ' ) > 0 ) { <nl> + warn ( ' sync_a ' , token ) ; <nl> + } else if ( option . adsafe ) { <nl> + if ( ! adsafe_top & & left . string = = = ' ADSAFE ' ) { <nl> + if ( name = = = ' id ' | | name = = = ' lib ' ) { <nl> + warn ( ' adsafe_a ' , that ) ; <nl> + } else if ( name = = = ' go ' ) { <nl> + if ( xmode ! = = ' script ' ) { <nl> + warn ( ' adsafe_a ' , that ) ; <nl> + } else if ( adsafe_went | | next_token . id ! = = ' ( ' | | <nl> + peek ( 0 ) . id ! = = ' ( string ) ' | | <nl> + peek ( 0 ) . string ! = = adsafe_id | | <nl> + peek ( 1 ) . id ! = = ' , ' ) { <nl> + stop ( ' adsafe_a ' , that , ' go ' ) ; <nl> + } <nl> + adsafe_went = true ; <nl> + adsafe_may = false ; <nl> + } <nl> + } <nl> + adsafe_top = false ; <nl> + } <nl> + if ( ! option . evil & & ( name = = = ' eval ' | | name = = = ' execScript ' ) ) { <nl> + warn ( ' evil ' ) ; <nl> + } else if ( option . safe ) { <nl> + for ( ; ; ) { <nl> + if ( banned [ name ] = = = true ) { <nl> + warn ( ' adsafe_a ' , token , name ) ; <nl> + } <nl> + if ( typeof predefined [ left . string ] ! = = ' boolean ' | | / / / / check for writeable <nl> + next_token . id = = = ' ( ' ) { <nl> + break ; <nl> + } <nl> + if ( next_token . id ! = = ' . ' ) { <nl> + warn ( ' adsafe_a ' , that ) ; <nl> + break ; <nl> + } <nl> + advance ( ' . ' ) ; <nl> + token . first = that ; <nl> + token . second = name ; <nl> + that = token ; <nl> + name = identifier ( ) ; <nl> + if ( typeof name = = = ' string ' ) { <nl> + tally_property ( name ) ; <nl> + } <nl> + } <nl> + } <nl> + return that ; <nl> + } , true ) ; <nl> + <nl> + infix ( ' [ ' , 170 , function ( left , that ) { <nl> + var e , s ; <nl> + no_space_only ( prev_token , token ) ; <nl> + no_space ( ) ; <nl> + step_in ( ) ; <nl> + edge ( ) ; <nl> + e = expression ( 0 ) ; <nl> + switch ( e . id ) { <nl> + case ' ( number ) ' : <nl> + if ( e . id = = = ' ( number ) ' & & left . id = = = ' arguments ' ) { <nl> + warn ( ' use_param ' , left ) ; <nl> + } <nl> + break ; <nl> + case ' ( string ) ' : <nl> + if ( option . safe & & ( banned [ e . string ] | | <nl> + e . string . charAt ( 0 ) = = = ' _ ' | | e . string . slice ( - 1 ) = = = ' _ ' ) ) { <nl> + warn ( ' adsafe_subscript_a ' , e ) ; <nl> + } else if ( ! option . evil & & <nl> + ( e . string = = = ' eval ' | | e . string = = = ' execScript ' ) ) { <nl> + warn ( ' evil ' , e ) ; <nl> + } else if ( ! option . sub & & ix . test ( e . string ) ) { <nl> + s = syntax [ e . string ] ; <nl> + if ( ! s | | ! s . reserved ) { <nl> + warn ( ' subscript ' , e ) ; <nl> + } <nl> + } <nl> + tally_property ( e . string ) ; <nl> + break ; <nl> + default : <nl> + if ( option . safe ) { <nl> + if ( ( e . id ! = = ' + ' | | e . arity ! = = ' prefix ' ) & & <nl> + e . id ! = = ' - ' & & e . id ! = = ' * ' ) { <nl> + warn ( ' adsafe_subscript_a ' , e ) ; <nl> + } <nl> + } <nl> + } <nl> + step_out ( ' ] ' , that ) ; <nl> + no_space ( prev_token , token ) ; <nl> + that . first = left ; <nl> + that . second = e ; <nl> + return that ; <nl> + } , true ) ; <nl> + <nl> + prefix ( ' [ ' , function ( ) { <nl> + this . arity = ' prefix ' ; <nl> + this . first = [ ] ; <nl> + step_in ( ' array ' ) ; <nl> + while ( next_token . id ! = = ' ( end ) ' ) { <nl> + while ( next_token . id = = = ' , ' ) { <nl> + warn ( ' unexpected_a ' , next_token ) ; <nl> + advance ( ' , ' ) ; <nl> + } <nl> + if ( next_token . id = = = ' ] ' ) { <nl> + break ; <nl> + } <nl> + indent . wrap = false ; <nl> + edge ( ) ; <nl> + this . first . push ( expression ( 10 ) ) ; <nl> + if ( next_token . id = = = ' , ' ) { <nl> + comma ( ) ; <nl> + if ( next_token . id = = = ' ] ' & & ! option . es5 ) { <nl> + warn ( ' unexpected_a ' , token ) ; <nl> + break ; <nl> + } <nl> + } else { <nl> + break ; <nl> + } <nl> + } <nl> + step_out ( ' ] ' , this ) ; <nl> + return this ; <nl> + } , 170 ) ; <nl> + <nl> + <nl> + function property_name ( ) { <nl> + var id = optional_identifier ( true ) ; <nl> + if ( ! id ) { <nl> + if ( next_token . id = = = ' ( string ) ' ) { <nl> + id = next_token . string ; <nl> + if ( option . safe ) { <nl> + if ( banned [ id ] ) { <nl> + warn ( ' adsafe_a ' ) ; <nl> + } else if ( id . charAt ( 0 ) = = = ' _ ' | | <nl> + id . charAt ( id . length - 1 ) = = = ' _ ' ) { <nl> + warn ( ' dangling_a ' ) ; <nl> + } <nl> + } <nl> + advance ( ) ; <nl> + } else if ( next_token . id = = = ' ( number ) ' ) { <nl> + id = next_token . number . toString ( ) ; <nl> + advance ( ) ; <nl> + } <nl> + } <nl> + return id ; <nl> + } <nl> + <nl> + <nl> + function function_params ( ) { <nl> + var id , paren = next_token , params = [ ] ; <nl> + advance ( ' ( ' ) ; <nl> + step_in ( ) ; <nl> + no_space ( ) ; <nl> + if ( next_token . id = = = ' ) ' ) { <nl> + no_space ( ) ; <nl> + step_out ( ' ) ' , paren ) ; <nl> + return params ; <nl> + } <nl> + for ( ; ; ) { <nl> + edge ( ) ; <nl> + id = identifier ( ) ; <nl> + params . push ( token ) ; <nl> + add_label ( token , option . unparam ? ' parameter ' : ' unparam ' ) ; <nl> + if ( next_token . id = = = ' , ' ) { <nl> + comma ( ) ; <nl> + } else { <nl> + no_space ( ) ; <nl> + step_out ( ' ) ' , paren ) ; <nl> + return params ; <nl> + } <nl> + } <nl> + } <nl> + <nl> + <nl> + <nl> + function do_function ( func , name ) { <nl> + var old_funct = funct , <nl> + old_option = option , <nl> + old_scope = scope ; <nl> + funct = { <nl> + ' ( name ) ' : name | | ' \ ' ' + ( anonname | | ' ' ) . replace ( nx , sanitize ) + ' \ ' ' , <nl> + ' ( line ) ' : next_token . line , <nl> + ' ( context ) ' : old_funct , <nl> + ' ( breakage ) ' : 0 , <nl> + ' ( loopage ) ' : 0 , <nl> + ' ( scope ) ' : scope , <nl> + ' ( token ) ' : func <nl> + } ; <nl> + option = Object . create ( old_option ) ; <nl> + scope = Object . create ( old_scope ) ; <nl> + functions . push ( funct ) ; <nl> + func . name = name ; <nl> + if ( name ) { <nl> + add_label ( func , ' function ' , name ) ; <nl> + } <nl> + func . writeable = false ; <nl> + func . first = funct [ ' ( params ) ' ] = function_params ( ) ; <nl> + one_space ( ) ; <nl> + func . block = block ( false ) ; <nl> + if ( funct [ ' ( arguments ) ' ] ) { <nl> + func . first . forEach ( function ( value ) { <nl> + if ( value . assign ) { <nl> + warn ( ' parameter_arguments_a ' , value , value . string ) ; <nl> + } <nl> + } ) ; <nl> + } <nl> + funct = old_funct ; <nl> + option = old_option ; <nl> + scope = old_scope ; <nl> + } <nl> + <nl> + <nl> + assignop ( ' = ' ) ; <nl> + assignop ( ' + = ' , ' + ' ) ; <nl> + assignop ( ' - = ' , ' - ' ) ; <nl> + assignop ( ' * = ' , ' * ' ) ; <nl> + assignop ( ' / = ' , ' / ' ) . nud = function ( ) { <nl> + stop ( ' slash_equal ' ) ; <nl> + } ; <nl> + assignop ( ' % = ' , ' % ' ) ; <nl> + assignop ( ' & = ' , ' & ' ) ; <nl> + assignop ( ' | = ' , ' | ' ) ; <nl> + assignop ( ' ^ = ' , ' ^ ' ) ; <nl> + assignop ( ' < < = ' , ' < < ' ) ; <nl> + assignop ( ' > > = ' , ' > > ' ) ; <nl> + assignop ( ' > > > = ' , ' > > > ' ) ; <nl> + <nl> + <nl> + prefix ( ' { ' , function ( ) { <nl> + var get , i , j , name , p , set , seen = { } ; <nl> + this . arity = ' prefix ' ; <nl> + this . first = [ ] ; <nl> + step_in ( ) ; <nl> + while ( next_token . id ! = = ' } ' ) { <nl> + indent . wrap = false ; <nl> + <nl> + / / JSLint recognizes the ES5 extension for get / set in object literals , <nl> + / / but requires that they be used in pairs . <nl> + <nl> + edge ( ) ; <nl> + if ( next_token . string = = = ' get ' & & peek ( ) . id ! = = ' : ' ) { <nl> + if ( ! option . es5 ) { <nl> + warn ( ' es5 ' ) ; <nl> + } <nl> + get = next_token ; <nl> + advance ( ' get ' ) ; <nl> + one_space_only ( ) ; <nl> + name = next_token ; <nl> + i = property_name ( ) ; <nl> + if ( ! i ) { <nl> + stop ( ' missing_property ' ) ; <nl> + } <nl> + get . string = ' ' ; <nl> + do_function ( get ) ; <nl> + if ( funct [ ' ( loopage ) ' ] ) { <nl> + warn ( ' function_loop ' , get ) ; <nl> + } <nl> + p = get . first ; <nl> + if ( p & & p . length ) { <nl> + warn ( ' parameter_a_get_b ' , p [ 0 ] , p [ 0 ] . string , i ) ; <nl> + } <nl> + comma ( ) ; <nl> + set = next_token ; <nl> + spaces ( ) ; <nl> + edge ( ) ; <nl> + advance ( ' set ' ) ; <nl> + set . string = ' ' ; <nl> + one_space_only ( ) ; <nl> + j = property_name ( ) ; <nl> + if ( i ! = = j ) { <nl> + stop ( ' expected_a_b ' , token , i , j | | next_token . string ) ; <nl> + } <nl> + do_function ( set ) ; <nl> + if ( set . block . length = = = 0 ) { <nl> + warn ( ' missing_a ' , token , ' throw ' ) ; <nl> + } <nl> + p = set . first ; <nl> + if ( ! p | | p . length ! = = 1 ) { <nl> + stop ( ' parameter_set_a ' , set , ' value ' ) ; <nl> + } else if ( p [ 0 ] . string ! = = ' value ' ) { <nl> + stop ( ' expected_a_b ' , p [ 0 ] , ' value ' , p [ 0 ] . string ) ; <nl> + } <nl> + name . first = [ get , set ] ; <nl> + } else { <nl> + name = next_token ; <nl> + i = property_name ( ) ; <nl> + if ( typeof i ! = = ' string ' ) { <nl> + stop ( ' missing_property ' ) ; <nl> + } <nl> + advance ( ' : ' ) ; <nl> + spaces ( ) ; <nl> + name . first = expression ( 10 ) ; <nl> + } <nl> + this . first . push ( name ) ; <nl> + if ( seen [ i ] = = = true ) { <nl> + warn ( ' duplicate_a ' , next_token , i ) ; <nl> + } <nl> + seen [ i ] = true ; <nl> + tally_property ( i ) ; <nl> + if ( next_token . id ! = = ' , ' ) { <nl> + break ; <nl> + } <nl> + for ( ; ; ) { <nl> + comma ( ) ; <nl> + if ( next_token . id ! = = ' , ' ) { <nl> + break ; <nl> + } <nl> + warn ( ' unexpected_a ' , next_token ) ; <nl> + } <nl> + if ( next_token . id = = = ' } ' & & ! option . es5 ) { <nl> + warn ( ' unexpected_a ' , token ) ; <nl> + } <nl> + } <nl> + step_out ( ' } ' , this ) ; <nl> + return this ; <nl> + } ) ; <nl> + <nl> + stmt ( ' { ' , function ( ) { <nl> + warn ( ' statement_block ' ) ; <nl> + this . arity = ' statement ' ; <nl> + this . block = statements ( ) ; <nl> + this . disrupt = this . block . disrupt ; <nl> + advance ( ' } ' , this ) ; <nl> + return this ; <nl> + } ) ; <nl> + <nl> + stmt ( ' / * global ' , directive ) ; <nl> + stmt ( ' / * globals ' , directive ) ; <nl> + stmt ( ' / * jslint ' , directive ) ; <nl> + stmt ( ' / * member ' , directive ) ; <nl> + stmt ( ' / * members ' , directive ) ; <nl> + stmt ( ' / * property ' , directive ) ; <nl> + stmt ( ' / * properties ' , directive ) ; <nl> + <nl> + stmt ( ' var ' , function ( ) { <nl> + <nl> + / / JavaScript does not have block scope . It only has function scope . So , <nl> + / / declaring a variable in a block can have unexpected consequences . <nl> + <nl> + / / var . first will contain an array , the array containing name tokens <nl> + / / and assignment tokens . <nl> + <nl> + var assign , id , name ; <nl> + <nl> + if ( funct [ ' ( vars ) ' ] & & ! option . vars ) { <nl> + warn ( ' combine_var ' ) ; <nl> + } else if ( funct ! = = global_funct ) { <nl> + funct [ ' ( vars ) ' ] = true ; <nl> + } <nl> + this . arity = ' statement ' ; <nl> + this . first = [ ] ; <nl> + step_in ( ' var ' ) ; <nl> + for ( ; ; ) { <nl> + name = next_token ; <nl> + id = identifier ( ) ; <nl> + add_label ( name , ' becoming ' ) ; <nl> + <nl> + if ( next_token . id = = = ' = ' ) { <nl> + assign = next_token ; <nl> + assign . first = name ; <nl> + spaces ( ) ; <nl> + advance ( ' = ' ) ; <nl> + spaces ( ) ; <nl> + if ( next_token . id = = = ' undefined ' ) { <nl> + warn ( ' unnecessary_initialize ' , token , id ) ; <nl> + } <nl> + if ( peek ( 0 ) . id = = = ' = ' & & next_token . identifier ) { <nl> + stop ( ' var_a_not ' ) ; <nl> + } <nl> + assign . second = expression ( 0 ) ; <nl> + assign . arity = ' infix ' ; <nl> + this . first . push ( assign ) ; <nl> + } else { <nl> + this . first . push ( name ) ; <nl> + } <nl> + if ( funct [ id ] = = = ' becoming ' ) { <nl> + funct [ id ] = ' unused ' ; <nl> + } <nl> + if ( next_token . id ! = = ' , ' ) { <nl> + break ; <nl> + } <nl> + comma ( ) ; <nl> + indent . wrap = false ; <nl> + if ( var_mode & & next_token . line = = = token . line & & <nl> + this . first . length = = = 1 ) { <nl> + var_mode = null ; <nl> + indent . open = false ; <nl> + indent . at - = option . indent ; <nl> + } <nl> + spaces ( ) ; <nl> + edge ( ) ; <nl> + } <nl> + var_mode = null ; <nl> + step_out ( ) ; <nl> + return this ; <nl> + } ) ; <nl> + <nl> + stmt ( ' function ' , function ( ) { <nl> + one_space ( ) ; <nl> + if ( in_block ) { <nl> + warn ( ' function_block ' , token ) ; <nl> + } <nl> + var name = next_token , id = identifier ( ) ; <nl> + add_label ( name , ' unction ' ) ; <nl> + no_space ( ) ; <nl> + this . arity = ' statement ' ; <nl> + do_function ( this , id ) ; <nl> + if ( next_token . id = = = ' ( ' & & next_token . line = = = token . line ) { <nl> + stop ( ' function_statement ' ) ; <nl> + } <nl> + return this ; <nl> + } ) ; <nl> + <nl> + prefix ( ' function ' , function ( ) { <nl> + if ( ! option . anon ) { <nl> + one_space ( ) ; <nl> + } <nl> + var id = optional_identifier ( ) ; <nl> + if ( id ) { <nl> + no_space ( ) ; <nl> + } else { <nl> + id = ' ' ; <nl> + } <nl> + do_function ( this , id ) ; <nl> + if ( funct [ ' ( loopage ) ' ] ) { <nl> + warn ( ' function_loop ' ) ; <nl> + } <nl> + switch ( next_token . id ) { <nl> + case ' ; ' : <nl> + case ' ( ' : <nl> + case ' ) ' : <nl> + case ' , ' : <nl> + case ' ] ' : <nl> + case ' } ' : <nl> + case ' : ' : <nl> + break ; <nl> + case ' . ' : <nl> + if ( peek ( ) . string ! = = ' bind ' | | peek ( 1 ) . id ! = = ' ( ' ) { <nl> + warn ( ' unexpected_a ' ) ; <nl> + } <nl> + break ; <nl> + default : <nl> + stop ( ' unexpected_a ' ) ; <nl> + } <nl> + this . arity = ' function ' ; <nl> + return this ; <nl> + } ) ; <nl> + <nl> + stmt ( ' if ' , function ( ) { <nl> + var paren = next_token ; <nl> + one_space ( ) ; <nl> + advance ( ' ( ' ) ; <nl> + step_in ( ' control ' ) ; <nl> + no_space ( ) ; <nl> + edge ( ) ; <nl> + this . arity = ' statement ' ; <nl> + this . first = expected_condition ( expected_relation ( expression ( 0 ) ) ) ; <nl> + no_space ( ) ; <nl> + step_out ( ' ) ' , paren ) ; <nl> + one_space ( ) ; <nl> + this . block = block ( true ) ; <nl> + if ( next_token . id = = = ' else ' ) { <nl> + one_space ( ) ; <nl> + advance ( ' else ' ) ; <nl> + one_space ( ) ; <nl> + this [ ' else ' ] = next_token . id = = = ' if ' | | next_token . id = = = ' switch ' <nl> + ? statement ( true ) <nl> + : block ( true ) ; <nl> + if ( this [ ' else ' ] . disrupt & & this . block . disrupt ) { <nl> + this . disrupt = true ; <nl> + } <nl> + } <nl> + return this ; <nl> + } ) ; <nl> + <nl> + stmt ( ' try ' , function ( ) { <nl> + <nl> + / / try . first The catch variable <nl> + / / try . second The catch clause <nl> + / / try . third The finally clause <nl> + / / try . block The try block <nl> + <nl> + var exception_variable , old_scope , paren ; <nl> + if ( option . adsafe ) { <nl> + warn ( ' adsafe_a ' , this ) ; <nl> + } <nl> + one_space ( ) ; <nl> + this . arity = ' statement ' ; <nl> + this . block = block ( false ) ; <nl> + if ( next_token . id = = = ' catch ' ) { <nl> + one_space ( ) ; <nl> + advance ( ' catch ' ) ; <nl> + one_space ( ) ; <nl> + paren = next_token ; <nl> + advance ( ' ( ' ) ; <nl> + step_in ( ' control ' ) ; <nl> + no_space ( ) ; <nl> + edge ( ) ; <nl> + old_scope = scope ; <nl> + scope = Object . create ( old_scope ) ; <nl> + exception_variable = next_token . string ; <nl> + this . first = exception_variable ; <nl> + if ( ! next_token . identifier ) { <nl> + warn ( ' expected_identifier_a ' , next_token ) ; <nl> + } else { <nl> + add_label ( next_token , ' exception ' ) ; <nl> + } <nl> + advance ( ) ; <nl> + no_space ( ) ; <nl> + step_out ( ' ) ' , paren ) ; <nl> + one_space ( ) ; <nl> + this . second = block ( false ) ; <nl> + scope = old_scope ; <nl> + } <nl> + if ( next_token . id = = = ' finally ' ) { <nl> + one_space ( ) ; <nl> + advance ( ' finally ' ) ; <nl> + one_space ( ) ; <nl> + this . third = block ( false ) ; <nl> + } else if ( ! this . second ) { <nl> + stop ( ' expected_a_b ' , next_token , ' catch ' , artifact ( ) ) ; <nl> + } <nl> + return this ; <nl> + } ) ; <nl> + <nl> + labeled_stmt ( ' while ' , function ( ) { <nl> + one_space ( ) ; <nl> + var paren = next_token ; <nl> + funct [ ' ( breakage ) ' ] + = 1 ; <nl> + funct [ ' ( loopage ) ' ] + = 1 ; <nl> + advance ( ' ( ' ) ; <nl> + step_in ( ' control ' ) ; <nl> + no_space ( ) ; <nl> + edge ( ) ; <nl> + this . arity = ' statement ' ; <nl> + this . first = expected_relation ( expression ( 0 ) ) ; <nl> + if ( this . first . id ! = = ' true ' ) { <nl> + expected_condition ( this . first , bundle . unexpected_a ) ; <nl> + } <nl> + no_space ( ) ; <nl> + step_out ( ' ) ' , paren ) ; <nl> + one_space ( ) ; <nl> + this . block = block ( true ) ; <nl> + if ( this . block . disrupt ) { <nl> + warn ( ' strange_loop ' , prev_token ) ; <nl> + } <nl> + funct [ ' ( breakage ) ' ] - = 1 ; <nl> + funct [ ' ( loopage ) ' ] - = 1 ; <nl> + return this ; <nl> + } ) ; <nl> + <nl> + reserve ( ' with ' ) ; <nl> + <nl> + labeled_stmt ( ' switch ' , function ( ) { <nl> + <nl> + / / switch . first the switch expression <nl> + / / switch . second the array of cases . A case is ' case ' or ' default ' token : <nl> + / / case . first the array of case expressions <nl> + / / case . second the array of statements <nl> + / / If all of the arrays of statements are disrupt , then the switch is disrupt . <nl> + <nl> + var cases = [ ] , <nl> + old_in_block = in_block , <nl> + particular , <nl> + the_case = next_token , <nl> + unbroken = true ; <nl> + <nl> + function find_duplicate_case ( value ) { <nl> + if ( are_similar ( particular , value ) ) { <nl> + warn ( ' duplicate_a ' , value ) ; <nl> + } <nl> + } <nl> + <nl> + funct [ ' ( breakage ) ' ] + = 1 ; <nl> + one_space ( ) ; <nl> + advance ( ' ( ' ) ; <nl> + no_space ( ) ; <nl> + step_in ( ) ; <nl> + this . arity = ' statement ' ; <nl> + this . first = expected_condition ( expected_relation ( expression ( 0 ) ) ) ; <nl> + no_space ( ) ; <nl> + step_out ( ' ) ' , the_case ) ; <nl> + one_space ( ) ; <nl> + advance ( ' { ' ) ; <nl> + step_in ( ) ; <nl> + in_block = true ; <nl> + this . second = [ ] ; <nl> + while ( next_token . id = = = ' case ' ) { <nl> + the_case = next_token ; <nl> + cases . forEach ( find_duplicate_case ) ; <nl> + the_case . first = [ ] ; <nl> + the_case . arity = ' case ' ; <nl> + spaces ( ) ; <nl> + edge ( ' case ' ) ; <nl> + advance ( ' case ' ) ; <nl> + for ( ; ; ) { <nl> + one_space ( ) ; <nl> + particular = expression ( 0 ) ; <nl> + cases . forEach ( find_duplicate_case ) ; <nl> + cases . push ( particular ) ; <nl> + the_case . first . push ( particular ) ; <nl> + if ( particular . id = = = ' NaN ' ) { <nl> + warn ( ' unexpected_a ' , particular ) ; <nl> + } <nl> + no_space_only ( ) ; <nl> + advance ( ' : ' ) ; <nl> + if ( next_token . id ! = = ' case ' ) { <nl> + break ; <nl> + } <nl> + spaces ( ) ; <nl> + edge ( ' case ' ) ; <nl> + advance ( ' case ' ) ; <nl> + } <nl> + spaces ( ) ; <nl> + the_case . second = statements ( ) ; <nl> + if ( the_case . second & & the_case . second . length > 0 ) { <nl> + particular = the_case . second [ the_case . second . length - 1 ] ; <nl> + if ( particular . disrupt ) { <nl> + if ( particular . id = = = ' break ' ) { <nl> + unbroken = false ; <nl> + } <nl> + } else { <nl> + warn ( ' missing_a_after_b ' , next_token , ' break ' , ' case ' ) ; <nl> + } <nl> + } else { <nl> + warn ( ' empty_case ' ) ; <nl> + } <nl> + this . second . push ( the_case ) ; <nl> + } <nl> + if ( this . second . length = = = 0 ) { <nl> + warn ( ' missing_a ' , next_token , ' case ' ) ; <nl> + } <nl> + if ( next_token . id = = = ' default ' ) { <nl> + spaces ( ) ; <nl> + the_case = next_token ; <nl> + the_case . arity = ' case ' ; <nl> + edge ( ' case ' ) ; <nl> + advance ( ' default ' ) ; <nl> + no_space_only ( ) ; <nl> + advance ( ' : ' ) ; <nl> + spaces ( ) ; <nl> + the_case . second = statements ( ) ; <nl> + if ( the_case . second & & the_case . second . length > 0 ) { <nl> + particular = the_case . second [ the_case . second . length - 1 ] ; <nl> + if ( unbroken & & particular . disrupt & & particular . id ! = = ' break ' ) { <nl> + this . disrupt = true ; <nl> + } <nl> + } <nl> + this . second . push ( the_case ) ; <nl> + } <nl> + funct [ ' ( breakage ) ' ] - = 1 ; <nl> + spaces ( ) ; <nl> + step_out ( ' } ' , this ) ; <nl> + in_block = old_in_block ; <nl> + return this ; <nl> + } ) ; <nl> + <nl> + stmt ( ' debugger ' , function ( ) { <nl> + if ( ! option . debug ) { <nl> + warn ( ' unexpected_a ' , this ) ; <nl> + } <nl> + this . arity = ' statement ' ; <nl> + return this ; <nl> + } ) ; <nl> + <nl> + labeled_stmt ( ' do ' , function ( ) { <nl> + funct [ ' ( breakage ) ' ] + = 1 ; <nl> + funct [ ' ( loopage ) ' ] + = 1 ; <nl> + one_space ( ) ; <nl> + this . arity = ' statement ' ; <nl> + this . block = block ( true ) ; <nl> + if ( this . block . disrupt ) { <nl> + warn ( ' strange_loop ' , prev_token ) ; <nl> + } <nl> + one_space ( ) ; <nl> + advance ( ' while ' ) ; <nl> + var paren = next_token ; <nl> + one_space ( ) ; <nl> + advance ( ' ( ' ) ; <nl> + step_in ( ) ; <nl> + no_space ( ) ; <nl> + edge ( ) ; <nl> + this . first = expected_condition ( expected_relation ( expression ( 0 ) ) , bundle . unexpected_a ) ; <nl> + no_space ( ) ; <nl> + step_out ( ' ) ' , paren ) ; <nl> + funct [ ' ( breakage ) ' ] - = 1 ; <nl> + funct [ ' ( loopage ) ' ] - = 1 ; <nl> + return this ; <nl> + } ) ; <nl> + <nl> + labeled_stmt ( ' for ' , function ( ) { <nl> + <nl> + var blok , filter , ok = false , paren = next_token , value ; <nl> + this . arity = ' statement ' ; <nl> + funct [ ' ( breakage ) ' ] + = 1 ; <nl> + funct [ ' ( loopage ) ' ] + = 1 ; <nl> + advance ( ' ( ' ) ; <nl> + if ( next_token . id = = = ' ; ' ) { <nl> + no_space ( ) ; <nl> + advance ( ' ; ' ) ; <nl> + no_space ( ) ; <nl> + advance ( ' ; ' ) ; <nl> + no_space ( ) ; <nl> + advance ( ' ) ' ) ; <nl> + blok = block ( true ) ; <nl> + } else { <nl> + step_in ( ' control ' ) ; <nl> + spaces ( this , paren ) ; <nl> + no_space ( ) ; <nl> + if ( next_token . id = = = ' var ' ) { <nl> + stop ( ' move_var ' ) ; <nl> + } <nl> + edge ( ) ; <nl> + if ( peek ( 0 ) . id = = = ' in ' ) { <nl> + this . forin = true ; <nl> + value = next_token ; <nl> + switch ( funct [ value . string ] ) { <nl> + case ' unused ' : <nl> + funct [ value . string ] = ' var ' ; <nl> + break ; <nl> + case ' closure ' : <nl> + case ' var ' : <nl> + break ; <nl> + default : <nl> + warn ( ' bad_in_a ' , value ) ; <nl> + } <nl> + advance ( ) ; <nl> + advance ( ' in ' ) ; <nl> + this . first = value ; <nl> + this . second = expression ( 20 ) ; <nl> + step_out ( ' ) ' , paren ) ; <nl> + blok = block ( true ) ; <nl> + if ( ! option . forin ) { <nl> + if ( blok . length = = = 1 & & typeof blok [ 0 ] = = = ' object ' & & <nl> + blok [ 0 ] . string = = = ' if ' & & ! blok [ 0 ] [ ' else ' ] ) { <nl> + filter = blok [ 0 ] . first ; <nl> + while ( filter . id = = = ' & & ' ) { <nl> + filter = filter . first ; <nl> + } <nl> + switch ( filter . id ) { <nl> + case ' = = = ' : <nl> + case ' ! = = ' : <nl> + ok = filter . first . id = = = ' [ ' <nl> + ? filter . first . first . string = = = this . second . string & & <nl> + filter . first . second . string = = = this . first . string <nl> + : filter . first . id = = = ' typeof ' & & <nl> + filter . first . first . id = = = ' [ ' & & <nl> + filter . first . first . first . string = = = this . second . string & & <nl> + filter . first . first . second . string = = = this . first . string ; <nl> + break ; <nl> + case ' ( ' : <nl> + ok = filter . first . id = = = ' . ' & & ( ( <nl> + filter . first . first . string = = = this . second . string & & <nl> + filter . first . second . string = = = ' hasOwnProperty ' & & <nl> + filter . second [ 0 ] . string = = = this . first . string <nl> + ) | | ( <nl> + filter . first . first . string = = = ' ADSAFE ' & & <nl> + filter . first . second . string = = = ' has ' & & <nl> + filter . second [ 0 ] . string = = = this . second . string & & <nl> + filter . second [ 1 ] . string = = = this . first . string <nl> + ) | | ( <nl> + filter . first . first . id = = = ' . ' & & <nl> + filter . first . first . first . id = = = ' . ' & & <nl> + filter . first . first . first . first . string = = = ' Object ' & & <nl> + filter . first . first . first . second . string = = = ' prototype ' & & <nl> + filter . first . first . second . string = = = ' hasOwnProperty ' & & <nl> + filter . first . second . string = = = ' call ' & & <nl> + filter . second [ 0 ] . string = = = this . second . string & & <nl> + filter . second [ 1 ] . string = = = this . first . string <nl> + ) ) ; <nl> + break ; <nl> + } <nl> + } <nl> + if ( ! ok ) { <nl> + warn ( ' for_if ' , this ) ; <nl> + } <nl> + } <nl> + } else { <nl> + edge ( ) ; <nl> + this . first = [ ] ; <nl> + for ( ; ; ) { <nl> + this . first . push ( expression ( 0 , ' for ' ) ) ; <nl> + if ( next_token . id ! = = ' , ' ) { <nl> + break ; <nl> + } <nl> + comma ( ) ; <nl> + } <nl> + semicolon ( ) ; <nl> + edge ( ) ; <nl> + this . second = expected_relation ( expression ( 0 ) ) ; <nl> + if ( this . second . id ! = = ' true ' ) { <nl> + expected_condition ( this . second , bundle . unexpected_a ) ; <nl> + } <nl> + semicolon ( token ) ; <nl> + if ( next_token . id = = = ' ; ' ) { <nl> + stop ( ' expected_a_b ' , next_token , ' ) ' , ' ; ' ) ; <nl> + } <nl> + this . third = [ ] ; <nl> + edge ( ) ; <nl> + for ( ; ; ) { <nl> + this . third . push ( expression ( 0 , ' for ' ) ) ; <nl> + if ( next_token . id ! = = ' , ' ) { <nl> + break ; <nl> + } <nl> + comma ( ) ; <nl> + } <nl> + no_space ( ) ; <nl> + step_out ( ' ) ' , paren ) ; <nl> + one_space ( ) ; <nl> + blok = block ( true ) ; <nl> + } <nl> + } <nl> + if ( blok . disrupt ) { <nl> + warn ( ' strange_loop ' , prev_token ) ; <nl> + } <nl> + this . block = blok ; <nl> + funct [ ' ( breakage ) ' ] - = 1 ; <nl> + funct [ ' ( loopage ) ' ] - = 1 ; <nl> + return this ; <nl> + } ) ; <nl> + <nl> + disrupt_stmt ( ' break ' , function ( ) { <nl> + var label = next_token . string ; <nl> + this . arity = ' statement ' ; <nl> + if ( funct [ ' ( breakage ) ' ] = = = 0 ) { <nl> + warn ( ' unexpected_a ' , this ) ; <nl> + } <nl> + if ( next_token . identifier & & token . line = = = next_token . line ) { <nl> + one_space_only ( ) ; <nl> + if ( funct [ label ] ! = = ' label ' ) { <nl> + warn ( ' not_a_label ' , next_token ) ; <nl> + } else if ( scope [ label ] . funct ! = = funct ) { <nl> + warn ( ' not_a_scope ' , next_token ) ; <nl> + } <nl> + this . first = next_token ; <nl> + advance ( ) ; <nl> + } <nl> + return this ; <nl> + } ) ; <nl> + <nl> + disrupt_stmt ( ' continue ' , function ( ) { <nl> + if ( ! option [ ' continue ' ] ) { <nl> + warn ( ' unexpected_a ' , this ) ; <nl> + } <nl> + var label = next_token . string ; <nl> + this . arity = ' statement ' ; <nl> + if ( funct [ ' ( breakage ) ' ] = = = 0 ) { <nl> + warn ( ' unexpected_a ' , this ) ; <nl> + } <nl> + if ( next_token . identifier & & token . line = = = next_token . line ) { <nl> + one_space_only ( ) ; <nl> + if ( funct [ label ] ! = = ' label ' ) { <nl> + warn ( ' not_a_label ' , next_token ) ; <nl> + } else if ( scope [ label ] . funct ! = = funct ) { <nl> + warn ( ' not_a_scope ' , next_token ) ; <nl> + } <nl> + this . first = next_token ; <nl> + advance ( ) ; <nl> + } <nl> + return this ; <nl> + } ) ; <nl> + <nl> + disrupt_stmt ( ' return ' , function ( ) { <nl> + if ( funct = = = global_funct & & xmode ! = = ' scriptstring ' ) { <nl> + warn ( ' unexpected_a ' , this ) ; <nl> + } <nl> + this . arity = ' statement ' ; <nl> + if ( next_token . id ! = = ' ; ' & & next_token . line = = = token . line ) { <nl> + one_space_only ( ) ; <nl> + if ( next_token . id = = = ' / ' | | next_token . id = = = ' ( regexp ) ' ) { <nl> + warn ( ' wrap_regexp ' ) ; <nl> + } <nl> + this . first = expression ( 20 ) ; <nl> + } <nl> + if ( peek ( 0 ) . id = = = ' } ' & & peek ( 1 ) . id = = = ' else ' ) { <nl> + warn ( ' unexpected_else ' , this ) ; <nl> + } <nl> + return this ; <nl> + } ) ; <nl> + <nl> + disrupt_stmt ( ' throw ' , function ( ) { <nl> + this . arity = ' statement ' ; <nl> + one_space_only ( ) ; <nl> + this . first = expression ( 20 ) ; <nl> + return this ; <nl> + } ) ; <nl> + <nl> + <nl> + / / Superfluous reserved words <nl> + <nl> + reserve ( ' class ' ) ; <nl> + reserve ( ' const ' ) ; <nl> + reserve ( ' enum ' ) ; <nl> + reserve ( ' export ' ) ; <nl> + reserve ( ' extends ' ) ; <nl> + reserve ( ' import ' ) ; <nl> + reserve ( ' super ' ) ; <nl> + <nl> + / / Harmony reserved words <nl> + <nl> + reserve ( ' implements ' ) ; <nl> + reserve ( ' interface ' ) ; <nl> + reserve ( ' let ' ) ; <nl> + reserve ( ' package ' ) ; <nl> + reserve ( ' private ' ) ; <nl> + reserve ( ' protected ' ) ; <nl> + reserve ( ' public ' ) ; <nl> + reserve ( ' static ' ) ; <nl> + reserve ( ' yield ' ) ; <nl> + <nl> + <nl> + / / Parse JSON <nl> + <nl> + function json_value ( ) { <nl> + <nl> + function json_object ( ) { <nl> + var brace = next_token , object = { } ; <nl> + advance ( ' { ' ) ; <nl> + if ( next_token . id ! = = ' } ' ) { <nl> + while ( next_token . id ! = = ' ( end ) ' ) { <nl> + while ( next_token . id = = = ' , ' ) { <nl> + warn ( ' unexpected_a ' , next_token ) ; <nl> + advance ( ' , ' ) ; <nl> + } <nl> + if ( next_token . id ! = = ' ( string ) ' ) { <nl> + warn ( ' expected_string_a ' ) ; <nl> + } <nl> + if ( object [ next_token . string ] = = = true ) { <nl> + warn ( ' duplicate_a ' ) ; <nl> + } else if ( next_token . string = = = ' __proto__ ' ) { <nl> + warn ( ' dangling_a ' ) ; <nl> + } else { <nl> + object [ next_token . string ] = true ; <nl> + } <nl> + advance ( ) ; <nl> + advance ( ' : ' ) ; <nl> + json_value ( ) ; <nl> + if ( next_token . id ! = = ' , ' ) { <nl> + break ; <nl> + } <nl> + advance ( ' , ' ) ; <nl> + if ( next_token . id = = = ' } ' ) { <nl> + warn ( ' unexpected_a ' , token ) ; <nl> + break ; <nl> + } <nl> + } <nl> + } <nl> + advance ( ' } ' , brace ) ; <nl> + } <nl> + <nl> + function json_array ( ) { <nl> + var bracket = next_token ; <nl> + advance ( ' [ ' ) ; <nl> + if ( next_token . id ! = = ' ] ' ) { <nl> + while ( next_token . id ! = = ' ( end ) ' ) { <nl> + while ( next_token . id = = = ' , ' ) { <nl> + warn ( ' unexpected_a ' , next_token ) ; <nl> + advance ( ' , ' ) ; <nl> + } <nl> + json_value ( ) ; <nl> + if ( next_token . id ! = = ' , ' ) { <nl> + break ; <nl> + } <nl> + advance ( ' , ' ) ; <nl> + if ( next_token . id = = = ' ] ' ) { <nl> + warn ( ' unexpected_a ' , token ) ; <nl> + break ; <nl> + } <nl> + } <nl> + } <nl> + advance ( ' ] ' , bracket ) ; <nl> + } <nl> + <nl> + switch ( next_token . id ) { <nl> + case ' { ' : <nl> + json_object ( ) ; <nl> + break ; <nl> + case ' [ ' : <nl> + json_array ( ) ; <nl> + break ; <nl> + case ' true ' : <nl> + case ' false ' : <nl> + case ' null ' : <nl> + case ' ( number ) ' : <nl> + case ' ( string ) ' : <nl> + advance ( ) ; <nl> + break ; <nl> + case ' - ' : <nl> + advance ( ' - ' ) ; <nl> + no_space_only ( ) ; <nl> + advance ( ' ( number ) ' ) ; <nl> + break ; <nl> + default : <nl> + stop ( ' unexpected_a ' ) ; <nl> + } <nl> + } <nl> + <nl> + <nl> + / / CSS parsing . <nl> + <nl> + function css_name ( ) { <nl> + if ( next_token . identifier ) { <nl> + advance ( ) ; <nl> + return true ; <nl> + } <nl> + } <nl> + <nl> + <nl> + function css_number ( ) { <nl> + if ( next_token . id = = = ' - ' ) { <nl> + advance ( ' - ' ) ; <nl> + no_space_only ( ) ; <nl> + } <nl> + if ( next_token . id = = = ' ( number ) ' ) { <nl> + advance ( ' ( number ) ' ) ; <nl> + return true ; <nl> + } <nl> + } <nl> + <nl> + <nl> + function css_string ( ) { <nl> + if ( next_token . id = = = ' ( string ) ' ) { <nl> + advance ( ) ; <nl> + return true ; <nl> + } <nl> + } <nl> + <nl> + function css_color ( ) { <nl> + var i , number , paren , value ; <nl> + if ( next_token . identifier ) { <nl> + value = next_token . string ; <nl> + if ( value = = = ' rgb ' | | value = = = ' rgba ' ) { <nl> + advance ( ) ; <nl> + paren = next_token ; <nl> + advance ( ' ( ' ) ; <nl> + for ( i = 0 ; i < 3 ; i + = 1 ) { <nl> + if ( i ) { <nl> + comma ( ) ; <nl> + } <nl> + number = next_token . number ; <nl> + if ( next_token . id ! = = ' ( number ) ' | | number < 0 ) { <nl> + warn ( ' expected_positive_a ' , next_token ) ; <nl> + advance ( ) ; <nl> + } else { <nl> + advance ( ) ; <nl> + if ( next_token . id = = = ' % ' ) { <nl> + advance ( ' % ' ) ; <nl> + if ( number > 100 ) { <nl> + warn ( ' expected_percent_a ' , token , number ) ; <nl> + } <nl> + } else { <nl> + if ( number > 255 ) { <nl> + warn ( ' expected_small_a ' , token , number ) ; <nl> + } <nl> + } <nl> + } <nl> + } <nl> + if ( value = = = ' rgba ' ) { <nl> + comma ( ) ; <nl> + number = next_token . number ; <nl> + if ( next_token . id ! = = ' ( number ) ' | | number < 0 | | number > 1 ) { <nl> + warn ( ' expected_fraction_a ' , next_token ) ; <nl> + } <nl> + advance ( ) ; <nl> + if ( next_token . id = = = ' % ' ) { <nl> + warn ( ' unexpected_a ' ) ; <nl> + advance ( ' % ' ) ; <nl> + } <nl> + } <nl> + advance ( ' ) ' , paren ) ; <nl> + return true ; <nl> + } <nl> + if ( css_colorData [ next_token . string ] = = = true ) { <nl> + advance ( ) ; <nl> + return true ; <nl> + } <nl> + } else if ( next_token . id = = = ' ( color ) ' ) { <nl> + advance ( ) ; <nl> + return true ; <nl> + } <nl> + return false ; <nl> + } <nl> + <nl> + <nl> + function css_length ( ) { <nl> + if ( next_token . id = = = ' - ' ) { <nl> + advance ( ' - ' ) ; <nl> + no_space_only ( ) ; <nl> + } <nl> + if ( next_token . id = = = ' ( number ) ' ) { <nl> + advance ( ) ; <nl> + if ( next_token . id ! = = ' ( string ) ' & & <nl> + css_lengthData [ next_token . string ] = = = true ) { <nl> + no_space_only ( ) ; <nl> + advance ( ) ; <nl> + } else if ( + token . number ! = = 0 ) { <nl> + warn ( ' expected_linear_a ' ) ; <nl> + } <nl> + return true ; <nl> + } <nl> + return false ; <nl> + } <nl> + <nl> + <nl> + function css_line_height ( ) { <nl> + if ( next_token . id = = = ' - ' ) { <nl> + advance ( ' - ' ) ; <nl> + no_space_only ( ) ; <nl> + } <nl> + if ( next_token . id = = = ' ( number ) ' ) { <nl> + advance ( ) ; <nl> + if ( next_token . id ! = = ' ( string ) ' & & <nl> + css_lengthData [ next_token . string ] = = = true ) { <nl> + no_space_only ( ) ; <nl> + advance ( ) ; <nl> + } <nl> + return true ; <nl> + } <nl> + return false ; <nl> + } <nl> + <nl> + <nl> + function css_width ( ) { <nl> + if ( next_token . identifier ) { <nl> + switch ( next_token . string ) { <nl> + case ' thin ' : <nl> + case ' medium ' : <nl> + case ' thick ' : <nl> + advance ( ) ; <nl> + return true ; <nl> + } <nl> + } else { <nl> + return css_length ( ) ; <nl> + } <nl> + } <nl> + <nl> + <nl> + function css_margin ( ) { <nl> + if ( next_token . identifier ) { <nl> + if ( next_token . string = = = ' auto ' ) { <nl> + advance ( ) ; <nl> + return true ; <nl> + } <nl> + } else { <nl> + return css_length ( ) ; <nl> + } <nl> + } <nl> + <nl> + function css_attr ( ) { <nl> + if ( next_token . identifier & & next_token . string = = = ' attr ' ) { <nl> + advance ( ) ; <nl> + advance ( ' ( ' ) ; <nl> + if ( ! next_token . identifier ) { <nl> + warn ( ' expected_name_a ' ) ; <nl> + } <nl> + advance ( ) ; <nl> + advance ( ' ) ' ) ; <nl> + return true ; <nl> + } <nl> + return false ; <nl> + } <nl> + <nl> + <nl> + function css_comma_list ( ) { <nl> + while ( next_token . id ! = = ' ; ' ) { <nl> + if ( ! css_name ( ) & & ! css_string ( ) ) { <nl> + warn ( ' expected_name_a ' ) ; <nl> + } <nl> + if ( next_token . id ! = = ' , ' ) { <nl> + return true ; <nl> + } <nl> + comma ( ) ; <nl> + } <nl> + } <nl> + <nl> + <nl> + function css_counter ( ) { <nl> + if ( next_token . identifier & & next_token . string = = = ' counter ' ) { <nl> + advance ( ) ; <nl> + advance ( ' ( ' ) ; <nl> + advance ( ) ; <nl> + if ( next_token . id = = = ' , ' ) { <nl> + comma ( ) ; <nl> + if ( next_token . id ! = = ' ( string ) ' ) { <nl> + warn ( ' expected_string_a ' ) ; <nl> + } <nl> + advance ( ) ; <nl> + } <nl> + advance ( ' ) ' ) ; <nl> + return true ; <nl> + } <nl> + if ( next_token . identifier & & next_token . string = = = ' counters ' ) { <nl> + advance ( ) ; <nl> + advance ( ' ( ' ) ; <nl> + if ( ! next_token . identifier ) { <nl> + warn ( ' expected_name_a ' ) ; <nl> + } <nl> + advance ( ) ; <nl> + if ( next_token . id = = = ' , ' ) { <nl> + comma ( ) ; <nl> + if ( next_token . id ! = = ' ( string ) ' ) { <nl> + warn ( ' expected_string_a ' ) ; <nl> + } <nl> + advance ( ) ; <nl> + } <nl> + if ( next_token . id = = = ' , ' ) { <nl> + comma ( ) ; <nl> + if ( next_token . id ! = = ' ( string ) ' ) { <nl> + warn ( ' expected_string_a ' ) ; <nl> + } <nl> + advance ( ) ; <nl> + } <nl> + advance ( ' ) ' ) ; <nl> + return true ; <nl> + } <nl> + return false ; <nl> + } <nl> + <nl> + <nl> + function css_radius ( ) { <nl> + return css_length ( ) & & ( next_token . id ! = = ' ( number ) ' | | css_length ( ) ) ; <nl> + } <nl> + <nl> + <nl> + function css_shadow ( ) { <nl> + for ( ; ; ) { <nl> + if ( next_token . string = = = ' inset ' ) { <nl> + advance ( ) ; <nl> + } <nl> + for ( ; ; ) { <nl> + if ( ! css_length ( ) ) { <nl> + break ; <nl> + } <nl> + } <nl> + css_color ( ) ; <nl> + if ( next_token . id ! = = ' , ' ) { <nl> + break ; <nl> + } <nl> + advance ( ' , ' ) ; <nl> + } <nl> + return true ; <nl> + } <nl> + <nl> + <nl> + function css_shape ( ) { <nl> + var i ; <nl> + if ( next_token . identifier & & next_token . string = = = ' rect ' ) { <nl> + advance ( ) ; <nl> + advance ( ' ( ' ) ; <nl> + for ( i = 0 ; i < 4 ; i + = 1 ) { <nl> + if ( ! css_length ( ) ) { <nl> + warn ( ' expected_number_a ' ) ; <nl> + break ; <nl> + } <nl> + } <nl> + advance ( ' ) ' ) ; <nl> + return true ; <nl> + } <nl> + return false ; <nl> + } <nl> + <nl> + <nl> + function css_url ( ) { <nl> + var c , url ; <nl> + if ( next_token . identifier & & next_token . string = = = ' url ' ) { <nl> + next_token = lex . range ( ' ( ' , ' ) ' ) ; <nl> + url = next_token . string ; <nl> + c = url . charAt ( 0 ) ; <nl> + if ( c = = = ' " ' | | c = = = ' \ ' ' ) { <nl> + if ( url . slice ( - 1 ) ! = = c ) { <nl> + warn ( ' bad_url_a ' ) ; <nl> + } else { <nl> + url = url . slice ( 1 , - 1 ) ; <nl> + if ( url . indexOf ( c ) > = 0 ) { <nl> + warn ( ' bad_url_a ' ) ; <nl> + } <nl> + } <nl> + } <nl> + if ( ! url ) { <nl> + warn ( ' missing_url ' ) ; <nl> + } <nl> + if ( ux . test ( url ) ) { <nl> + stop ( ' bad_url_a ' ) ; <nl> + } <nl> + urls . push ( url ) ; <nl> + advance ( ) ; <nl> + return true ; <nl> + } <nl> + return false ; <nl> + } <nl> + <nl> + <nl> + css_any = [ css_url , function ( ) { <nl> + for ( ; ; ) { <nl> + if ( next_token . identifier ) { <nl> + switch ( next_token . string . toLowerCase ( ) ) { <nl> + case ' url ' : <nl> + css_url ( ) ; <nl> + break ; <nl> + case ' expression ' : <nl> + warn ( ' unexpected_a ' ) ; <nl> + advance ( ) ; <nl> + break ; <nl> + default : <nl> + advance ( ) ; <nl> + } <nl> + } else { <nl> + if ( next_token . id = = = ' ; ' | | next_token . id = = = ' ! ' | | <nl> + next_token . id = = = ' ( end ) ' | | next_token . id = = = ' } ' ) { <nl> + return true ; <nl> + } <nl> + advance ( ) ; <nl> + } <nl> + } <nl> + } ] ; <nl> + <nl> + <nl> + function font_face ( ) { <nl> + advance_identifier ( ' font - family ' ) ; <nl> + advance ( ' : ' ) ; <nl> + if ( ! css_name ( ) & & ! css_string ( ) ) { <nl> + stop ( ' expected_name_a ' ) ; <nl> + } <nl> + semicolon ( ) ; <nl> + advance_identifier ( ' src ' ) ; <nl> + advance ( ' : ' ) ; <nl> + while ( true ) { <nl> + if ( next_token . string = = = ' local ' ) { <nl> + advance_identifier ( ' local ' ) ; <nl> + advance ( ' ( ' ) ; <nl> + if ( ux . test ( next_token . string ) ) { <nl> + stop ( ' bad_url_a ' ) ; <nl> + } <nl> + <nl> + if ( ! css_name ( ) & & ! css_string ( ) ) { <nl> + stop ( ' expected_name_a ' ) ; <nl> + } <nl> + advance ( ' ) ' ) ; <nl> + } else if ( ! css_url ( ) ) { <nl> + stop ( ' expected_a_b ' , next_token , ' url ' , artifact ( ) ) ; <nl> + } <nl> + if ( next_token . id ! = = ' , ' ) { <nl> + break ; <nl> + } <nl> + comma ( ) ; <nl> + } <nl> + semicolon ( ) ; <nl> + } <nl> + <nl> + <nl> + css_border_style = [ <nl> + ' none ' , ' dashed ' , ' dotted ' , ' double ' , ' groove ' , <nl> + ' hidden ' , ' inset ' , ' outset ' , ' ridge ' , ' solid ' <nl> + ] ; <nl> + <nl> + css_break = [ <nl> + ' auto ' , ' always ' , ' avoid ' , ' left ' , ' right ' <nl> + ] ; <nl> + <nl> + css_media = { <nl> + ' all ' : true , <nl> + ' braille ' : true , <nl> + ' embossed ' : true , <nl> + ' handheld ' : true , <nl> + ' print ' : true , <nl> + ' projection ' : true , <nl> + ' screen ' : true , <nl> + ' speech ' : true , <nl> + ' tty ' : true , <nl> + ' tv ' : true <nl> + } ; <nl> + <nl> + css_overflow = [ <nl> + ' auto ' , ' hidden ' , ' scroll ' , ' visible ' <nl> + ] ; <nl> + <nl> + css_attribute_data = { <nl> + background : [ <nl> + true , ' background - attachment ' , ' background - color ' , <nl> + ' background - image ' , ' background - position ' , ' background - repeat ' <nl> + ] , <nl> + ' background - attachment ' : [ ' scroll ' , ' fixed ' ] , <nl> + ' background - color ' : [ ' transparent ' , css_color ] , <nl> + ' background - image ' : [ ' none ' , css_url ] , <nl> + ' background - position ' : [ <nl> + 2 , [ css_length , ' top ' , ' bottom ' , ' left ' , ' right ' , ' center ' ] <nl> + ] , <nl> + ' background - repeat ' : [ <nl> + ' repeat ' , ' repeat - x ' , ' repeat - y ' , ' no - repeat ' <nl> + ] , <nl> + ' border ' : [ true , ' border - color ' , ' border - style ' , ' border - width ' ] , <nl> + ' border - bottom ' : [ <nl> + true , ' border - bottom - color ' , ' border - bottom - style ' , <nl> + ' border - bottom - width ' <nl> + ] , <nl> + ' border - bottom - color ' : css_color , <nl> + ' border - bottom - left - radius ' : css_radius , <nl> + ' border - bottom - right - radius ' : css_radius , <nl> + ' border - bottom - style ' : css_border_style , <nl> + ' border - bottom - width ' : css_width , <nl> + ' border - collapse ' : [ ' collapse ' , ' separate ' ] , <nl> + ' border - color ' : [ ' transparent ' , 4 , css_color ] , <nl> + ' border - left ' : [ <nl> + true , ' border - left - color ' , ' border - left - style ' , ' border - left - width ' <nl> + ] , <nl> + ' border - left - color ' : css_color , <nl> + ' border - left - style ' : css_border_style , <nl> + ' border - left - width ' : css_width , <nl> + ' border - radius ' : function ( ) { <nl> + function count ( separator ) { <nl> + var n = 1 ; <nl> + if ( separator ) { <nl> + advance ( separator ) ; <nl> + } <nl> + if ( ! css_length ( ) ) { <nl> + return false ; <nl> + } <nl> + while ( next_token . id = = = ' ( number ) ' ) { <nl> + if ( ! css_length ( ) ) { <nl> + return false ; <nl> + } <nl> + n + = 1 ; <nl> + } <nl> + if ( n > 4 ) { <nl> + warn ( ' bad_style ' ) ; <nl> + } <nl> + return true ; <nl> + } <nl> + <nl> + return count ( ) & & ( next_token . id ! = = ' / ' | | count ( ' / ' ) ) ; <nl> + } , <nl> + ' border - right ' : [ <nl> + true , ' border - right - color ' , ' border - right - style ' , <nl> + ' border - right - width ' <nl> + ] , <nl> + ' border - right - color ' : css_color , <nl> + ' border - right - style ' : css_border_style , <nl> + ' border - right - width ' : css_width , <nl> + ' border - spacing ' : [ 2 , css_length ] , <nl> + ' border - style ' : [ 4 , css_border_style ] , <nl> + ' border - top ' : [ <nl> + true , ' border - top - color ' , ' border - top - style ' , ' border - top - width ' <nl> + ] , <nl> + ' border - top - color ' : css_color , <nl> + ' border - top - left - radius ' : css_radius , <nl> + ' border - top - right - radius ' : css_radius , <nl> + ' border - top - style ' : css_border_style , <nl> + ' border - top - width ' : css_width , <nl> + ' border - width ' : [ 4 , css_width ] , <nl> + bottom : [ css_length , ' auto ' ] , <nl> + ' box - shadow ' : [ ' none ' , css_shadow ] , <nl> + ' caption - side ' : [ ' bottom ' , ' left ' , ' right ' , ' top ' ] , <nl> + clear : [ ' both ' , ' left ' , ' none ' , ' right ' ] , <nl> + clip : [ css_shape , ' auto ' ] , <nl> + color : css_color , <nl> + content : [ <nl> + ' open - quote ' , ' close - quote ' , ' no - open - quote ' , ' no - close - quote ' , <nl> + css_string , css_url , css_counter , css_attr <nl> + ] , <nl> + ' counter - increment ' : [ <nl> + css_name , ' none ' <nl> + ] , <nl> + ' counter - reset ' : [ <nl> + css_name , ' none ' <nl> + ] , <nl> + cursor : [ <nl> + css_url , ' auto ' , ' crosshair ' , ' default ' , ' e - resize ' , ' help ' , ' move ' , <nl> + ' n - resize ' , ' ne - resize ' , ' nw - resize ' , ' pointer ' , ' s - resize ' , <nl> + ' se - resize ' , ' sw - resize ' , ' w - resize ' , ' text ' , ' wait ' <nl> + ] , <nl> + direction : [ ' ltr ' , ' rtl ' ] , <nl> + display : [ <nl> + ' block ' , ' compact ' , ' inline ' , ' inline - block ' , ' inline - table ' , <nl> + ' list - item ' , ' marker ' , ' none ' , ' run - in ' , ' table ' , ' table - caption ' , <nl> + ' table - cell ' , ' table - column ' , ' table - column - group ' , <nl> + ' table - footer - group ' , ' table - header - group ' , ' table - row ' , <nl> + ' table - row - group ' <nl> + ] , <nl> + ' empty - cells ' : [ ' show ' , ' hide ' ] , <nl> + ' float ' : [ ' left ' , ' none ' , ' right ' ] , <nl> + font : [ <nl> + ' caption ' , ' icon ' , ' menu ' , ' message - box ' , ' small - caption ' , <nl> + ' status - bar ' , true , ' font - size ' , ' font - style ' , ' font - weight ' , <nl> + ' font - family ' <nl> + ] , <nl> + ' font - family ' : css_comma_list , <nl> + ' font - size ' : [ <nl> + ' xx - small ' , ' x - small ' , ' small ' , ' medium ' , ' large ' , ' x - large ' , <nl> + ' xx - large ' , ' larger ' , ' smaller ' , css_length <nl> + ] , <nl> + ' font - size - adjust ' : [ ' none ' , css_number ] , <nl> + ' font - stretch ' : [ <nl> + ' normal ' , ' wider ' , ' narrower ' , ' ultra - condensed ' , <nl> + ' extra - condensed ' , ' condensed ' , ' semi - condensed ' , <nl> + ' semi - expanded ' , ' expanded ' , ' extra - expanded ' <nl> + ] , <nl> + ' font - style ' : [ <nl> + ' normal ' , ' italic ' , ' oblique ' <nl> + ] , <nl> + ' font - variant ' : [ <nl> + ' normal ' , ' small - caps ' <nl> + ] , <nl> + ' font - weight ' : [ <nl> + ' normal ' , ' bold ' , ' bolder ' , ' lighter ' , css_number <nl> + ] , <nl> + height : [ css_length , ' auto ' ] , <nl> + left : [ css_length , ' auto ' ] , <nl> + ' letter - spacing ' : [ ' normal ' , css_length ] , <nl> + ' line - height ' : [ ' normal ' , css_line_height ] , <nl> + ' list - style ' : [ <nl> + true , ' list - style - image ' , ' list - style - position ' , ' list - style - type ' <nl> + ] , <nl> + ' list - style - image ' : [ ' none ' , css_url ] , <nl> + ' list - style - position ' : [ ' inside ' , ' outside ' ] , <nl> + ' list - style - type ' : [ <nl> + ' circle ' , ' disc ' , ' square ' , ' decimal ' , ' decimal - leading - zero ' , <nl> + ' lower - roman ' , ' upper - roman ' , ' lower - greek ' , ' lower - alpha ' , <nl> + ' lower - latin ' , ' upper - alpha ' , ' upper - latin ' , ' hebrew ' , ' katakana ' , <nl> + ' hiragana - iroha ' , ' katakana - oroha ' , ' none ' <nl> + ] , <nl> + margin : [ 4 , css_margin ] , <nl> + ' margin - bottom ' : css_margin , <nl> + ' margin - left ' : css_margin , <nl> + ' margin - right ' : css_margin , <nl> + ' margin - top ' : css_margin , <nl> + ' marker - offset ' : [ css_length , ' auto ' ] , <nl> + ' max - height ' : [ css_length , ' none ' ] , <nl> + ' max - width ' : [ css_length , ' none ' ] , <nl> + ' min - height ' : css_length , <nl> + ' min - width ' : css_length , <nl> + opacity : css_number , <nl> + outline : [ true , ' outline - color ' , ' outline - style ' , ' outline - width ' ] , <nl> + ' outline - color ' : [ ' invert ' , css_color ] , <nl> + ' outline - style ' : [ <nl> + ' dashed ' , ' dotted ' , ' double ' , ' groove ' , ' inset ' , ' none ' , <nl> + ' outset ' , ' ridge ' , ' solid ' <nl> + ] , <nl> + ' outline - width ' : css_width , <nl> + overflow : css_overflow , <nl> + ' overflow - x ' : css_overflow , <nl> + ' overflow - y ' : css_overflow , <nl> + padding : [ 4 , css_length ] , <nl> + ' padding - bottom ' : css_length , <nl> + ' padding - left ' : css_length , <nl> + ' padding - right ' : css_length , <nl> + ' padding - top ' : css_length , <nl> + ' page - break - after ' : css_break , <nl> + ' page - break - before ' : css_break , <nl> + position : [ ' absolute ' , ' fixed ' , ' relative ' , ' static ' ] , <nl> + quotes : [ 8 , css_string ] , <nl> + right : [ css_length , ' auto ' ] , <nl> + ' table - layout ' : [ ' auto ' , ' fixed ' ] , <nl> + ' text - align ' : [ ' center ' , ' justify ' , ' left ' , ' right ' ] , <nl> + ' text - decoration ' : [ <nl> + ' none ' , ' underline ' , ' overline ' , ' line - through ' , ' blink ' <nl> + ] , <nl> + ' text - indent ' : css_length , <nl> + ' text - shadow ' : [ ' none ' , 4 , [ css_color , css_length ] ] , <nl> + ' text - transform ' : [ ' capitalize ' , ' uppercase ' , ' lowercase ' , ' none ' ] , <nl> + top : [ css_length , ' auto ' ] , <nl> + ' unicode - bidi ' : [ ' normal ' , ' embed ' , ' bidi - override ' ] , <nl> + ' vertical - align ' : [ <nl> + ' baseline ' , ' bottom ' , ' sub ' , ' super ' , ' top ' , ' text - top ' , ' middle ' , <nl> + ' text - bottom ' , css_length <nl> + ] , <nl> + visibility : [ ' visible ' , ' hidden ' , ' collapse ' ] , <nl> + ' white - space ' : [ <nl> + ' normal ' , ' nowrap ' , ' pre ' , ' pre - line ' , ' pre - wrap ' , ' inherit ' <nl> + ] , <nl> + width : [ css_length , ' auto ' ] , <nl> + ' word - spacing ' : [ ' normal ' , css_length ] , <nl> + ' word - wrap ' : [ ' break - word ' , ' normal ' ] , <nl> + ' z - index ' : [ ' auto ' , css_number ] <nl> + } ; <nl> + <nl> + function style_attribute ( ) { <nl> + var v ; <nl> + while ( next_token . id = = = ' * ' | | next_token . id = = = ' # ' | | <nl> + next_token . string = = = ' _ ' ) { <nl> + if ( ! option . css ) { <nl> + warn ( ' unexpected_a ' ) ; <nl> + } <nl> + advance ( ) ; <nl> + } <nl> + if ( next_token . id = = = ' - ' ) { <nl> + if ( ! option . css ) { <nl> + warn ( ' unexpected_a ' ) ; <nl> + } <nl> + advance ( ' - ' ) ; <nl> + if ( ! next_token . identifier ) { <nl> + warn ( ' expected_nonstandard_style_attribute ' ) ; <nl> + } <nl> + advance ( ) ; <nl> + return css_any ; <nl> + } <nl> + if ( ! next_token . identifier ) { <nl> + warn ( ' expected_style_attribute ' ) ; <nl> + } else { <nl> + if ( Object . prototype . hasOwnProperty . call ( css_attribute_data , <nl> + next_token . string ) ) { <nl> + v = css_attribute_data [ next_token . string ] ; <nl> + } else { <nl> + v = css_any ; <nl> + if ( ! option . css ) { <nl> + warn ( ' unrecognized_style_attribute_a ' ) ; <nl> + } <nl> + } <nl> + } <nl> + advance ( ) ; <nl> + return v ; <nl> + } <nl> + <nl> + <nl> + function style_value ( v ) { <nl> + var i = 0 , <nl> + n , <nl> + once , <nl> + match , <nl> + round , <nl> + start = 0 , <nl> + vi ; <nl> + switch ( typeof v ) { <nl> + case ' function ' : <nl> + return v ( ) ; <nl> + case ' string ' : <nl> + if ( next_token . identifier & & next_token . string = = = v ) { <nl> + advance ( ) ; <nl> + return true ; <nl> + } <nl> + return false ; <nl> + } <nl> + for ( ; ; ) { <nl> + if ( i > = v . length ) { <nl> + return false ; <nl> + } <nl> + vi = v [ i ] ; <nl> + i + = 1 ; <nl> + if ( typeof vi = = = ' boolean ' ) { <nl> + break ; <nl> + } else if ( typeof vi = = = ' number ' ) { <nl> + n = vi ; <nl> + vi = v [ i ] ; <nl> + i + = 1 ; <nl> + } else { <nl> + n = 1 ; <nl> + } <nl> + match = false ; <nl> + while ( n > 0 ) { <nl> + if ( style_value ( vi ) ) { <nl> + match = true ; <nl> + n - = 1 ; <nl> + } else { <nl> + break ; <nl> + } <nl> + } <nl> + if ( match ) { <nl> + return true ; <nl> + } <nl> + } <nl> + start = i ; <nl> + once = [ ] ; <nl> + for ( ; ; ) { <nl> + round = false ; <nl> + for ( i = start ; i < v . length ; i + = 1 ) { <nl> + if ( ! once [ i ] ) { <nl> + if ( style_value ( css_attribute_data [ v [ i ] ] ) ) { <nl> + match = true ; <nl> + round = true ; <nl> + once [ i ] = true ; <nl> + break ; <nl> + } <nl> + } <nl> + } <nl> + if ( ! round ) { <nl> + return match ; <nl> + } <nl> + } <nl> + } <nl> + <nl> + function style_child ( ) { <nl> + if ( next_token . id = = = ' ( number ) ' ) { <nl> + advance ( ) ; <nl> + if ( next_token . string = = = ' n ' & & next_token . identifier ) { <nl> + no_space_only ( ) ; <nl> + advance ( ) ; <nl> + if ( next_token . id = = = ' + ' ) { <nl> + no_space_only ( ) ; <nl> + advance ( ' + ' ) ; <nl> + no_space_only ( ) ; <nl> + advance ( ' ( number ) ' ) ; <nl> + } <nl> + } <nl> + return ; <nl> + } <nl> + if ( next_token . identifier & & <nl> + ( next_token . string = = = ' odd ' | | next_token . string = = = ' even ' ) ) { <nl> + advance ( ) ; <nl> + return ; <nl> + } <nl> + warn ( ' unexpected_a ' ) ; <nl> + } <nl> + <nl> + function substyle ( ) { <nl> + var v ; <nl> + for ( ; ; ) { <nl> + if ( next_token . id = = = ' } ' | | next_token . id = = = ' ( end ) ' | | <nl> + ( xquote & & next_token . id = = = xquote ) ) { <nl> + return ; <nl> + } <nl> + v = style_attribute ( ) ; <nl> + advance ( ' : ' ) ; <nl> + if ( next_token . identifier & & next_token . string = = = ' inherit ' ) { <nl> + advance ( ) ; <nl> + } else { <nl> + if ( ! style_value ( v ) ) { <nl> + warn ( ' unexpected_a ' ) ; <nl> + advance ( ) ; <nl> + } <nl> + } <nl> + if ( next_token . id = = = ' ! ' ) { <nl> + advance ( ' ! ' ) ; <nl> + no_space_only ( ) ; <nl> + if ( next_token . identifier & & next_token . string = = = ' important ' ) { <nl> + advance ( ) ; <nl> + } else { <nl> + warn ( ' expected_a_b ' , <nl> + next_token , ' important ' , artifact ( ) ) ; <nl> + } <nl> + } <nl> + if ( next_token . id = = = ' } ' | | next_token . id = = = xquote ) { <nl> + warn ( ' expected_a_b ' , next_token , ' ; ' , artifact ( ) ) ; <nl> + } else { <nl> + semicolon ( ) ; <nl> + } <nl> + } <nl> + } <nl> + <nl> + function style_selector ( ) { <nl> + if ( next_token . identifier ) { <nl> + if ( ! Object . prototype . hasOwnProperty . call ( html_tag , option . cap <nl> + ? next_token . string . toLowerCase ( ) <nl> + : next_token . string ) ) { <nl> + warn ( ' expected_tagname_a ' ) ; <nl> + } <nl> + advance ( ) ; <nl> + } else { <nl> + switch ( next_token . id ) { <nl> + case ' > ' : <nl> + case ' + ' : <nl> + advance ( ) ; <nl> + style_selector ( ) ; <nl> + break ; <nl> + case ' : ' : <nl> + advance ( ' : ' ) ; <nl> + switch ( next_token . string ) { <nl> + case ' active ' : <nl> + case ' after ' : <nl> + case ' before ' : <nl> + case ' checked ' : <nl> + case ' disabled ' : <nl> + case ' empty ' : <nl> + case ' enabled ' : <nl> + case ' first - child ' : <nl> + case ' first - letter ' : <nl> + case ' first - line ' : <nl> + case ' first - of - type ' : <nl> + case ' focus ' : <nl> + case ' hover ' : <nl> + case ' last - child ' : <nl> + case ' last - of - type ' : <nl> + case ' link ' : <nl> + case ' only - of - type ' : <nl> + case ' root ' : <nl> + case ' target ' : <nl> + case ' visited ' : <nl> + advance_identifier ( next_token . string ) ; <nl> + break ; <nl> + case ' lang ' : <nl> + advance_identifier ( ' lang ' ) ; <nl> + advance ( ' ( ' ) ; <nl> + if ( ! next_token . identifier ) { <nl> + warn ( ' expected_lang_a ' ) ; <nl> + } <nl> + advance ( ' ) ' ) ; <nl> + break ; <nl> + case ' nth - child ' : <nl> + case ' nth - last - child ' : <nl> + case ' nth - last - of - type ' : <nl> + case ' nth - of - type ' : <nl> + advance_identifier ( next_token . string ) ; <nl> + advance ( ' ( ' ) ; <nl> + style_child ( ) ; <nl> + advance ( ' ) ' ) ; <nl> + break ; <nl> + case ' not ' : <nl> + advance_identifier ( ' not ' ) ; <nl> + advance ( ' ( ' ) ; <nl> + if ( next_token . id = = = ' : ' & & peek ( 0 ) . string = = = ' not ' ) { <nl> + warn ( ' not ' ) ; <nl> + } <nl> + style_selector ( ) ; <nl> + advance ( ' ) ' ) ; <nl> + break ; <nl> + default : <nl> + warn ( ' expected_pseudo_a ' ) ; <nl> + } <nl> + break ; <nl> + case ' # ' : <nl> + advance ( ' # ' ) ; <nl> + if ( ! next_token . identifier ) { <nl> + warn ( ' expected_id_a ' ) ; <nl> + } <nl> + advance ( ) ; <nl> + break ; <nl> + case ' * ' : <nl> + advance ( ' * ' ) ; <nl> + break ; <nl> + case ' . ' : <nl> + advance ( ' . ' ) ; <nl> + if ( ! next_token . identifier ) { <nl> + warn ( ' expected_class_a ' ) ; <nl> + } <nl> + advance ( ) ; <nl> + break ; <nl> + case ' [ ' : <nl> + advance ( ' [ ' ) ; <nl> + if ( ! next_token . identifier ) { <nl> + warn ( ' expected_attribute_a ' ) ; <nl> + } <nl> + advance ( ) ; <nl> + if ( next_token . id = = = ' = ' | | next_token . string = = = ' ~ = ' | | <nl> + next_token . string = = = ' $ = ' | | <nl> + next_token . string = = = ' | = ' | | <nl> + next_token . id = = = ' * = ' | | <nl> + next_token . id = = = ' ^ = ' ) { <nl> + advance ( ) ; <nl> + if ( next_token . id ! = = ' ( string ) ' ) { <nl> + warn ( ' expected_string_a ' ) ; <nl> + } <nl> + advance ( ) ; <nl> + } <nl> + advance ( ' ] ' ) ; <nl> + break ; <nl> + default : <nl> + stop ( ' expected_selector_a ' ) ; <nl> + } <nl> + } <nl> + } <nl> + <nl> + function style_pattern ( ) { <nl> + if ( next_token . id = = = ' { ' ) { <nl> + warn ( ' expected_style_pattern ' ) ; <nl> + } <nl> + for ( ; ; ) { <nl> + style_selector ( ) ; <nl> + if ( next_token . id = = = ' < / ' | | next_token . id = = = ' { ' | | <nl> + next_token . id = = = ' } ' | | next_token . id = = = ' ( end ) ' ) { <nl> + return ' ' ; <nl> + } <nl> + if ( next_token . id = = = ' , ' ) { <nl> + comma ( ) ; <nl> + } <nl> + } <nl> + } <nl> + <nl> + function style_list ( ) { <nl> + while ( next_token . id ! = = ' } ' & & next_token . id ! = = ' < / ' & & <nl> + next_token . id ! = = ' ( end ) ' ) { <nl> + style_pattern ( ) ; <nl> + xmode = ' styleproperty ' ; <nl> + if ( next_token . id = = = ' ; ' ) { <nl> + semicolon ( ) ; <nl> + } else { <nl> + advance ( ' { ' ) ; <nl> + substyle ( ) ; <nl> + xmode = ' style ' ; <nl> + advance ( ' } ' ) ; <nl> + } <nl> + } <nl> + } <nl> + <nl> + function styles ( ) { <nl> + var i ; <nl> + while ( next_token . id = = = ' @ ' ) { <nl> + i = peek ( ) ; <nl> + advance ( ' @ ' ) ; <nl> + switch ( next_token . string ) { <nl> + case ' import ' : <nl> + advance_identifier ( ' import ' ) ; <nl> + if ( ! css_url ( ) ) { <nl> + warn ( ' expected_a_b ' , <nl> + next_token , ' url ' , artifact ( ) ) ; <nl> + advance ( ) ; <nl> + } <nl> + semicolon ( ) ; <nl> + break ; <nl> + case ' media ' : <nl> + advance_identifier ( ' media ' ) ; <nl> + for ( ; ; ) { <nl> + if ( ! next_token . identifier | | css_media [ next_token . string ] ! = = true ) { <nl> + stop ( ' expected_media_a ' ) ; <nl> + } <nl> + advance ( ) ; <nl> + if ( next_token . id ! = = ' , ' ) { <nl> + break ; <nl> + } <nl> + comma ( ) ; <nl> + } <nl> + advance ( ' { ' ) ; <nl> + style_list ( ) ; <nl> + advance ( ' } ' ) ; <nl> + break ; <nl> + case ' font - face ' : <nl> + advance_identifier ( ' font - face ' ) ; <nl> + advance ( ' { ' ) ; <nl> + font_face ( ) ; <nl> + advance ( ' } ' ) ; <nl> + break ; <nl> + default : <nl> + stop ( ' expected_at_a ' ) ; <nl> + } <nl> + } <nl> + style_list ( ) ; <nl> + } <nl> + <nl> + <nl> + / / Parse HTML <nl> + <nl> + function do_begin ( n ) { <nl> + if ( n ! = = ' html ' & & ! option . fragment ) { <nl> + if ( n = = = ' div ' & & option . adsafe ) { <nl> + stop ( ' adsafe_fragment ' ) ; <nl> + } else { <nl> + stop ( ' expected_a_b ' , token , ' html ' , n ) ; <nl> + } <nl> + } <nl> + if ( option . adsafe ) { <nl> + if ( n = = = ' html ' ) { <nl> + stop ( ' adsafe_html ' , token ) ; <nl> + } <nl> + if ( option . fragment ) { <nl> + if ( n ! = = ' div ' ) { <nl> + stop ( ' adsafe_div ' , token ) ; <nl> + } <nl> + } else { <nl> + stop ( ' adsafe_fragment ' , token ) ; <nl> + } <nl> + } <nl> + option . browser = true ; <nl> + } <nl> + <nl> + function do_attribute ( a , v ) { <nl> + var u , x ; <nl> + if ( a = = = ' id ' ) { <nl> + u = typeof v = = = ' string ' ? v . toUpperCase ( ) : ' ' ; <nl> + if ( ids [ u ] = = = true ) { <nl> + warn ( ' duplicate_a ' , next_token , v ) ; <nl> + } <nl> + if ( ! / ^ [ A - Za - z ] [ A - Za - z0 - 9 . _ : \ - ] * $ / . test ( v ) ) { <nl> + warn ( ' bad_id_a ' , next_token , v ) ; <nl> + } else if ( option . adsafe ) { <nl> + if ( adsafe_id ) { <nl> + if ( v . slice ( 0 , adsafe_id . length ) ! = = adsafe_id ) { <nl> + warn ( ' adsafe_prefix_a ' , next_token , adsafe_id ) ; <nl> + } else if ( ! / ^ [ A - Z ] + _ [ A - Z ] + $ / . test ( v ) ) { <nl> + warn ( ' adsafe_bad_id ' ) ; <nl> + } <nl> + } else { <nl> + adsafe_id = v ; <nl> + if ( ! / ^ [ A - Z ] + _ $ / . test ( v ) ) { <nl> + warn ( ' adsafe_bad_id ' ) ; <nl> + } <nl> + } <nl> + } <nl> + x = v . search ( dx ) ; <nl> + if ( x > = 0 ) { <nl> + warn ( ' unexpected_char_a_b ' , token , v . charAt ( x ) , a ) ; <nl> + } <nl> + ids [ u ] = true ; <nl> + } else if ( a = = = ' class ' | | a = = = ' type ' | | a = = = ' name ' ) { <nl> + x = v . search ( qx ) ; <nl> + if ( x > = 0 ) { <nl> + warn ( ' unexpected_char_a_b ' , token , v . charAt ( x ) , a ) ; <nl> + } <nl> + ids [ u ] = true ; <nl> + } else if ( a = = = ' href ' | | a = = = ' background ' | | <nl> + a = = = ' content ' | | a = = = ' data ' | | <nl> + a . indexOf ( ' src ' ) > = 0 | | a . indexOf ( ' url ' ) > = 0 ) { <nl> + if ( option . safe & & ux . test ( v ) ) { <nl> + stop ( ' bad_url_a ' , next_token , v ) ; <nl> + } <nl> + urls . push ( v ) ; <nl> + } else if ( a = = = ' for ' ) { <nl> + if ( option . adsafe ) { <nl> + if ( adsafe_id ) { <nl> + if ( v . slice ( 0 , adsafe_id . length ) ! = = adsafe_id ) { <nl> + warn ( ' adsafe_prefix_a ' , next_token , adsafe_id ) ; <nl> + } else if ( ! / ^ [ A - Z ] + _ [ A - Z ] + $ / . test ( v ) ) { <nl> + warn ( ' adsafe_bad_id ' ) ; <nl> + } <nl> + } else { <nl> + warn ( ' adsafe_bad_id ' ) ; <nl> + } <nl> + } <nl> + } else if ( a = = = ' name ' ) { <nl> + if ( option . adsafe & & v . indexOf ( ' _ ' ) > = 0 ) { <nl> + warn ( ' adsafe_name_a ' , next_token , v ) ; <nl> + } <nl> + } <nl> + } <nl> + <nl> + function do_tag ( name , attribute ) { <nl> + var i , tag = html_tag [ name ] , script , x ; <nl> + src = false ; <nl> + if ( ! tag ) { <nl> + stop ( <nl> + bundle . unrecognized_tag_a , <nl> + next_token , <nl> + name = = = name . toLowerCase ( ) <nl> + ? name <nl> + : name + ' ( capitalization error ) ' <nl> + ) ; <nl> + } <nl> + if ( stack . length > 0 ) { <nl> + if ( name = = = ' html ' ) { <nl> + stop ( ' unexpected_a ' , token , name ) ; <nl> + } <nl> + x = tag . parent ; <nl> + if ( x ) { <nl> + if ( x . indexOf ( ' ' + stack [ stack . length - 1 ] . name + ' ' ) < 0 ) { <nl> + stop ( ' tag_a_in_b ' , token , name , x ) ; <nl> + } <nl> + } else if ( ! option . adsafe & & ! option . fragment ) { <nl> + i = stack . length ; <nl> + do { <nl> + if ( i < = 0 ) { <nl> + stop ( ' tag_a_in_b ' , token , name , ' body ' ) ; <nl> + } <nl> + i - = 1 ; <nl> + } while ( stack [ i ] . name ! = = ' body ' ) ; <nl> + } <nl> + } <nl> + switch ( name ) { <nl> + case ' div ' : <nl> + if ( option . adsafe & & stack . length = = = 1 & & ! adsafe_id ) { <nl> + warn ( ' adsafe_missing_id ' ) ; <nl> + } <nl> + break ; <nl> + case ' script ' : <nl> + xmode = ' script ' ; <nl> + advance ( ' > ' ) ; <nl> + if ( attribute . lang ) { <nl> + warn ( ' lang ' , token ) ; <nl> + } <nl> + if ( option . adsafe & & stack . length ! = = 1 ) { <nl> + warn ( ' adsafe_placement ' , token ) ; <nl> + } <nl> + if ( attribute . src ) { <nl> + if ( option . adsafe & & ( ! adsafe_may | | ! approved [ attribute . src ] ) ) { <nl> + warn ( ' adsafe_source ' , token ) ; <nl> + } <nl> + } else { <nl> + step_in ( next_token . from ) ; <nl> + edge ( ) ; <nl> + use_strict ( ) ; <nl> + adsafe_top = true ; <nl> + script = statements ( ) ; <nl> + <nl> + / / JSLint is also the static analyzer for ADsafe . See www . ADsafe . org . <nl> + <nl> + if ( option . adsafe ) { <nl> + if ( adsafe_went ) { <nl> + stop ( ' adsafe_script ' , token ) ; <nl> + } <nl> + if ( script . length ! = = 1 | | <nl> + aint ( script [ 0 ] , ' id ' , ' ( ' ) | | <nl> + aint ( script [ 0 ] . first , ' id ' , ' . ' ) | | <nl> + aint ( script [ 0 ] . first . first , ' string ' , ' ADSAFE ' ) | | <nl> + aint ( script [ 0 ] . second [ 0 ] , ' string ' , adsafe_id ) ) { <nl> + stop ( ' adsafe_id_go ' ) ; <nl> + } <nl> + switch ( script [ 0 ] . first . second . string ) { <nl> + case ' id ' : <nl> + if ( adsafe_may | | adsafe_went | | <nl> + script [ 0 ] . second . length ! = = 1 ) { <nl> + stop ( ' adsafe_id ' , next_token ) ; <nl> + } <nl> + adsafe_may = true ; <nl> + break ; <nl> + case ' go ' : <nl> + if ( adsafe_went ) { <nl> + stop ( ' adsafe_go ' ) ; <nl> + } <nl> + if ( script [ 0 ] . second . length ! = = 2 | | <nl> + aint ( script [ 0 ] . second [ 1 ] , ' id ' , ' function ' ) | | <nl> + ! script [ 0 ] . second [ 1 ] . first | | <nl> + aint ( script [ 0 ] . second [ 1 ] . first [ 0 ] , ' string ' , ' dom ' ) | | <nl> + script [ 0 ] . second [ 1 ] . first . length > 2 | | <nl> + ( script [ 0 ] . second [ 1 ] . first . length = = = 2 & & <nl> + aint ( script [ 0 ] . second [ 1 ] . first [ 1 ] , ' string ' , ' lib ' ) ) ) { <nl> + stop ( ' adsafe_go ' , next_token ) ; <nl> + } <nl> + adsafe_went = true ; <nl> + break ; <nl> + default : <nl> + stop ( ' adsafe_id_go ' ) ; <nl> + } <nl> + } <nl> + indent = null ; <nl> + } <nl> + xmode = ' html ' ; <nl> + advance ( ' < / ' ) ; <nl> + advance_identifier ( ' script ' ) ; <nl> + xmode = ' outer ' ; <nl> + break ; <nl> + case ' style ' : <nl> + xmode = ' style ' ; <nl> + advance ( ' > ' ) ; <nl> + styles ( ) ; <nl> + xmode = ' html ' ; <nl> + advance ( ' < / ' ) ; <nl> + advance_identifier ( ' style ' ) ; <nl> + break ; <nl> + case ' input ' : <nl> + switch ( attribute . type ) { <nl> + case ' button ' : <nl> + case ' checkbox ' : <nl> + case ' radio ' : <nl> + case ' reset ' : <nl> + case ' submit ' : <nl> + break ; <nl> + case ' file ' : <nl> + case ' hidden ' : <nl> + case ' image ' : <nl> + case ' password ' : <nl> + case ' text ' : <nl> + if ( option . adsafe & & attribute . autocomplete ! = = ' off ' ) { <nl> + warn ( ' adsafe_autocomplete ' ) ; <nl> + } <nl> + break ; <nl> + default : <nl> + warn ( ' bad_type ' ) ; <nl> + } <nl> + break ; <nl> + case ' applet ' : <nl> + case ' body ' : <nl> + case ' embed ' : <nl> + case ' frame ' : <nl> + case ' frameset ' : <nl> + case ' head ' : <nl> + case ' iframe ' : <nl> + case ' noembed ' : <nl> + case ' noframes ' : <nl> + case ' object ' : <nl> + case ' param ' : <nl> + if ( option . adsafe ) { <nl> + warn ( ' adsafe_tag ' , next_token , name ) ; <nl> + } <nl> + break ; <nl> + } <nl> + } <nl> + <nl> + <nl> + function closetag ( name ) { <nl> + return ' < / ' + name + ' > ' ; <nl> + } <nl> + <nl> + function html ( ) { <nl> + var attribute , attributes , is_empty , name , old_white = option . white , <nl> + quote , tag_name , tag , wmode ; <nl> + xmode = ' html ' ; <nl> + xquote = ' ' ; <nl> + stack = null ; <nl> + for ( ; ; ) { <nl> + switch ( next_token . string ) { <nl> + case ' < ' : <nl> + xmode = ' html ' ; <nl> + advance ( ' < ' ) ; <nl> + attributes = { } ; <nl> + tag_name = next_token ; <nl> + name = tag_name . string ; <nl> + advance_identifier ( name ) ; <nl> + if ( option . cap ) { <nl> + name = name . toLowerCase ( ) ; <nl> + } <nl> + tag_name . name = name ; <nl> + if ( ! stack ) { <nl> + stack = [ ] ; <nl> + do_begin ( name ) ; <nl> + } <nl> + tag = html_tag [ name ] ; <nl> + if ( typeof tag ! = = ' object ' ) { <nl> + stop ( ' unrecognized_tag_a ' , tag_name , name ) ; <nl> + } <nl> + is_empty = tag . empty ; <nl> + tag_name . type = name ; <nl> + for ( ; ; ) { <nl> + if ( next_token . id = = = ' / ' ) { <nl> + advance ( ' / ' ) ; <nl> + if ( next_token . id ! = = ' > ' ) { <nl> + warn ( ' expected_a_b ' , next_token , ' > ' , artifact ( ) ) ; <nl> + } <nl> + break ; <nl> + } <nl> + if ( next_token . id & & next_token . id . charAt ( 0 ) = = = ' > ' ) { <nl> + break ; <nl> + } <nl> + if ( ! next_token . identifier ) { <nl> + if ( next_token . id = = = ' ( end ) ' | | next_token . id = = = ' ( error ) ' ) { <nl> + warn ( ' expected_a_b ' , next_token , ' > ' , artifact ( ) ) ; <nl> + } <nl> + warn ( ' bad_name_a ' ) ; <nl> + } <nl> + option . white = false ; <nl> + spaces ( ) ; <nl> + attribute = next_token . string ; <nl> + option . white = old_white ; <nl> + advance ( ) ; <nl> + if ( ! option . cap & & attribute ! = = attribute . toLowerCase ( ) ) { <nl> + warn ( ' attribute_case_a ' , token ) ; <nl> + } <nl> + attribute = attribute . toLowerCase ( ) ; <nl> + xquote = ' ' ; <nl> + if ( Object . prototype . hasOwnProperty . call ( attributes , attribute ) ) { <nl> + warn ( ' duplicate_a ' , token , attribute ) ; <nl> + } <nl> + if ( attribute . slice ( 0 , 2 ) = = = ' on ' ) { <nl> + if ( ! option . on ) { <nl> + warn ( ' html_handlers ' ) ; <nl> + } <nl> + xmode = ' scriptstring ' ; <nl> + advance ( ' = ' ) ; <nl> + quote = next_token . id ; <nl> + if ( quote ! = = ' " ' & & quote ! = = ' \ ' ' ) { <nl> + stop ( ' expected_a_b ' , next_token , ' " ' , artifact ( ) ) ; <nl> + } <nl> + xquote = quote ; <nl> + wmode = option . white ; <nl> + option . white = true ; <nl> + advance ( quote ) ; <nl> + use_strict ( ) ; <nl> + statements ( ) ; <nl> + option . white = wmode ; <nl> + if ( next_token . id ! = = quote ) { <nl> + stop ( ' expected_a_b ' , next_token , quote , artifact ( ) ) ; <nl> + } <nl> + xmode = ' html ' ; <nl> + xquote = ' ' ; <nl> + advance ( quote ) ; <nl> + tag = false ; <nl> + } else if ( attribute = = = ' style ' ) { <nl> + xmode = ' scriptstring ' ; <nl> + advance ( ' = ' ) ; <nl> + quote = next_token . id ; <nl> + if ( quote ! = = ' " ' & & quote ! = = ' \ ' ' ) { <nl> + stop ( ' expected_a_b ' , next_token , ' " ' , artifact ( ) ) ; <nl> + } <nl> + xmode = ' styleproperty ' ; <nl> + xquote = quote ; <nl> + advance ( quote ) ; <nl> + substyle ( ) ; <nl> + xmode = ' html ' ; <nl> + xquote = ' ' ; <nl> + advance ( quote ) ; <nl> + tag = false ; <nl> + } else { <nl> + if ( next_token . id = = = ' = ' ) { <nl> + advance ( ' = ' ) ; <nl> + tag = next_token . string ; <nl> + if ( ! next_token . identifier & & <nl> + next_token . id ! = = ' " ' & & <nl> + next_token . id ! = = ' \ ' ' & & <nl> + next_token . id ! = = ' ( string ) ' & & <nl> + next_token . id ! = = ' ( number ) ' & & <nl> + next_token . id ! = = ' ( color ) ' ) { <nl> + warn ( ' expected_attribute_value_a ' , token , attribute ) ; <nl> + } <nl> + advance ( ) ; <nl> + } else { <nl> + tag = true ; <nl> + } <nl> + } <nl> + attributes [ attribute ] = tag ; <nl> + do_attribute ( attribute , tag ) ; <nl> + } <nl> + do_tag ( name , attributes ) ; <nl> + if ( ! is_empty ) { <nl> + stack . push ( tag_name ) ; <nl> + } <nl> + xmode = ' outer ' ; <nl> + advance ( ' > ' ) ; <nl> + break ; <nl> + case ' < / ' : <nl> + xmode = ' html ' ; <nl> + advance ( ' < / ' ) ; <nl> + if ( ! next_token . identifier ) { <nl> + warn ( ' bad_name_a ' ) ; <nl> + } <nl> + name = next_token . string ; <nl> + if ( option . cap ) { <nl> + name = name . toLowerCase ( ) ; <nl> + } <nl> + advance ( ) ; <nl> + if ( ! stack ) { <nl> + stop ( ' unexpected_a ' , next_token , closetag ( name ) ) ; <nl> + } <nl> + tag_name = stack . pop ( ) ; <nl> + if ( ! tag_name ) { <nl> + stop ( ' unexpected_a ' , next_token , closetag ( name ) ) ; <nl> + } <nl> + if ( tag_name . name ! = = name ) { <nl> + stop ( ' expected_a_b ' , <nl> + next_token , closetag ( tag_name . name ) , closetag ( name ) ) ; <nl> + } <nl> + if ( next_token . id ! = = ' > ' ) { <nl> + stop ( ' expected_a_b ' , next_token , ' > ' , artifact ( ) ) ; <nl> + } <nl> + xmode = ' outer ' ; <nl> + advance ( ' > ' ) ; <nl> + break ; <nl> + case ' < ! ' : <nl> + if ( option . safe ) { <nl> + warn ( ' adsafe_a ' ) ; <nl> + } <nl> + xmode = ' html ' ; <nl> + for ( ; ; ) { <nl> + advance ( ) ; <nl> + if ( next_token . id = = = ' > ' | | next_token . id = = = ' ( end ) ' ) { <nl> + break ; <nl> + } <nl> + if ( next_token . string . indexOf ( ' - - ' ) > = 0 ) { <nl> + stop ( ' unexpected_a ' , next_token , ' - - ' ) ; <nl> + } <nl> + if ( next_token . string . indexOf ( ' < ' ) > = 0 ) { <nl> + stop ( ' unexpected_a ' , next_token , ' < ' ) ; <nl> + } <nl> + if ( next_token . string . indexOf ( ' > ' ) > = 0 ) { <nl> + stop ( ' unexpected_a ' , next_token , ' > ' ) ; <nl> + } <nl> + } <nl> + xmode = ' outer ' ; <nl> + advance ( ' > ' ) ; <nl> + break ; <nl> + case ' ( end ) ' : <nl> + if ( stack . length ! = = 0 ) { <nl> + warn ( ' missing_a ' , next_token , ' < / ' + stack . pop ( ) . string + ' > ' ) ; <nl> + } <nl> + return ; <nl> + default : <nl> + if ( next_token . id = = = ' ( end ) ' ) { <nl> + stop ( ' missing_a ' , next_token , <nl> + ' < / ' + stack [ stack . length - 1 ] . string + ' > ' ) ; <nl> + } else { <nl> + advance ( ) ; <nl> + } <nl> + } <nl> + if ( stack & & stack . length = = = 0 & & ( option . adsafe | | <nl> + ! option . fragment | | next_token . id = = = ' ( end ) ' ) ) { <nl> + break ; <nl> + } <nl> + } <nl> + if ( next_token . id ! = = ' ( end ) ' ) { <nl> + stop ( ' unexpected_a ' ) ; <nl> + } <nl> + } <nl> + <nl> + <nl> + / / The actual JSLINT function itself . <nl> + <nl> + itself = function JSLint ( the_source , the_option ) { <nl> + <nl> + var i , predef , tree ; <nl> + JSLINT . errors = [ ] ; <nl> + JSLINT . tree = ' ' ; <nl> + JSLINT . properties = ' ' ; <nl> + begin = prev_token = token = next_token = <nl> + Object . create ( syntax [ ' ( begin ) ' ] ) ; <nl> + predefined = { } ; <nl> + add_to_predefined ( standard ) ; <nl> + property = { } ; <nl> + if ( the_option ) { <nl> + option = Object . create ( the_option ) ; <nl> + predef = option . predef ; <nl> + if ( predef ) { <nl> + if ( Array . isArray ( predef ) ) { <nl> + for ( i = 0 ; i < predef . length ; i + = 1 ) { <nl> + predefined [ predef [ i ] ] = true ; <nl> + } <nl> + } else if ( typeof predef = = = ' object ' ) { <nl> + add_to_predefined ( predef ) ; <nl> + } <nl> + } <nl> + do_safe ( ) ; <nl> + } else { <nl> + option = { } ; <nl> + } <nl> + option . indent = + option . indent | | 4 ; <nl> + option . maxerr = + option . maxerr | | 50 ; <nl> + adsafe_id = ' ' ; <nl> + adsafe_may = adsafe_top = adsafe_went = false ; <nl> + approved = { } ; <nl> + if ( option . approved ) { <nl> + for ( i = 0 ; i < option . approved . length ; i + = 1 ) { <nl> + approved [ option . approved [ i ] ] = option . approved [ i ] ; <nl> + } <nl> + } else { <nl> + approved . test = ' test ' ; <nl> + } <nl> + tab = ' ' ; <nl> + for ( i = 0 ; i < option . indent ; i + = 1 ) { <nl> + tab + = ' ' ; <nl> + } <nl> + global_scope = scope = { } ; <nl> + global_funct = funct = { <nl> + ' ( scope ) ' : scope , <nl> + ' ( breakage ) ' : 0 , <nl> + ' ( loopage ) ' : 0 <nl> + } ; <nl> + functions = [ funct ] ; <nl> + <nl> + comments_off = false ; <nl> + ids = { } ; <nl> + in_block = false ; <nl> + indent = null ; <nl> + json_mode = false ; <nl> + lookahead = [ ] ; <nl> + node_js = false ; <nl> + prereg = true ; <nl> + src = false ; <nl> + stack = null ; <nl> + strict_mode = false ; <nl> + urls = [ ] ; <nl> + var_mode = null ; <nl> + warnings = 0 ; <nl> + xmode = ' ' ; <nl> + lex . init ( the_source ) ; <nl> + <nl> + assume ( ) ; <nl> + <nl> + try { <nl> + advance ( ) ; <nl> + if ( next_token . id = = = ' ( number ) ' ) { <nl> + stop ( ' unexpected_a ' ) ; <nl> + } else if ( next_token . string . charAt ( 0 ) = = = ' < ' ) { <nl> + html ( ) ; <nl> + if ( option . adsafe & & ! adsafe_went ) { <nl> + warn ( ' adsafe_go ' , this ) ; <nl> + } <nl> + } else { <nl> + switch ( next_token . id ) { <nl> + case ' { ' : <nl> + case ' [ ' : <nl> + json_mode = true ; <nl> + json_value ( ) ; <nl> + break ; <nl> + case ' @ ' : <nl> + case ' * ' : <nl> + case ' # ' : <nl> + case ' . ' : <nl> + case ' : ' : <nl> + xmode = ' style ' ; <nl> + advance ( ) ; <nl> + if ( token . id ! = = ' @ ' | | ! next_token . identifier | | <nl> + next_token . string ! = = ' charset ' | | token . line ! = = 1 | | <nl> + token . from ! = = 1 ) { <nl> + stop ( ' css ' ) ; <nl> + } <nl> + advance ( ) ; <nl> + if ( next_token . id ! = = ' ( string ) ' & & <nl> + next_token . string ! = = ' UTF - 8 ' ) { <nl> + stop ( ' css ' ) ; <nl> + } <nl> + advance ( ) ; <nl> + semicolon ( ) ; <nl> + styles ( ) ; <nl> + break ; <nl> + <nl> + default : <nl> + if ( option . adsafe & & option . fragment ) { <nl> + stop ( ' expected_a_b ' , <nl> + next_token , ' < div > ' , artifact ( ) ) ; <nl> + } <nl> + <nl> + / / If the first token is a semicolon , ignore it . This is sometimes used when <nl> + / / files are intended to be appended to files that may be sloppy . A sloppy <nl> + / / file may be depending on semicolon insertion on its last line . <nl> + <nl> + step_in ( 1 ) ; <nl> + if ( next_token . id = = = ' ; ' & & ! node_js ) { <nl> + semicolon ( ) ; <nl> + } <nl> + adsafe_top = true ; <nl> + tree = statements ( ) ; <nl> + begin . first = tree ; <nl> + itself . tree = begin ; <nl> + if ( option . adsafe & & ( tree . length ! = = 1 | | <nl> + aint ( tree [ 0 ] , ' id ' , ' ( ' ) | | <nl> + aint ( tree [ 0 ] . first , ' id ' , ' . ' ) | | <nl> + aint ( tree [ 0 ] . first . first , ' string ' , ' ADSAFE ' ) | | <nl> + aint ( tree [ 0 ] . first . second , ' string ' , ' lib ' ) | | <nl> + tree [ 0 ] . second . length ! = = 2 | | <nl> + tree [ 0 ] . second [ 0 ] . id ! = = ' ( string ) ' | | <nl> + aint ( tree [ 0 ] . second [ 1 ] , ' id ' , ' function ' ) ) ) { <nl> + stop ( ' adsafe_lib ' ) ; <nl> + } <nl> + if ( tree . disrupt ) { <nl> + warn ( ' weird_program ' , prev_token ) ; <nl> + } <nl> + } <nl> + } <nl> + indent = null ; <nl> + advance ( ' ( end ) ' ) ; <nl> + itself . property = property ; <nl> + } catch ( e ) { <nl> + if ( e ) { / / ~ ~ <nl> + JSLINT . errors . push ( { <nl> + reason : e . message , <nl> + line : e . line | | next_token . line , <nl> + character : e . character | | next_token . from <nl> + } , null ) ; <nl> + } <nl> + } <nl> + return JSLINT . errors . length = = = 0 ; <nl> + } ; <nl> + <nl> + <nl> + / / Data summary . <nl> + <nl> + itself . data = function ( ) { <nl> + var data = { functions : [ ] } , <nl> + function_data , <nl> + globals , <nl> + i , <nl> + j , <nl> + kind , <nl> + name , <nl> + the_function , <nl> + undef = [ ] , <nl> + unused = [ ] ; <nl> + if ( itself . errors . length ) { <nl> + data . errors = itself . errors ; <nl> + } <nl> + <nl> + if ( json_mode ) { <nl> + data . json = true ; <nl> + } <nl> + <nl> + if ( urls . length > 0 ) { <nl> + data . urls = urls ; <nl> + } <nl> + <nl> + globals = Object . keys ( global_scope ) . filter ( function ( value ) { <nl> + return value . charAt ( 0 ) ! = = ' ( ' & & typeof standard [ value ] ! = = ' boolean ' ; <nl> + } ) ; <nl> + if ( globals . length > 0 ) { <nl> + data . globals = globals ; <nl> + } <nl> + <nl> + for ( i = 1 ; i < functions . length ; i + = 1 ) { <nl> + the_function = functions [ i ] ; <nl> + function_data = { } ; <nl> + for ( j = 0 ; j < functionicity . length ; j + = 1 ) { <nl> + function_data [ functionicity [ j ] ] = [ ] ; <nl> + } <nl> + for ( name in the_function ) { <nl> + if ( Object . prototype . hasOwnProperty . call ( the_function , name ) ) { <nl> + if ( name . charAt ( 0 ) ! = = ' ( ' ) { <nl> + kind = the_function [ name ] ; <nl> + if ( kind = = = ' unction ' | | kind = = = ' unparam ' ) { <nl> + kind = ' unused ' ; <nl> + } <nl> + if ( Array . isArray ( function_data [ kind ] ) ) { <nl> + function_data [ kind ] . push ( name ) ; <nl> + if ( kind = = = ' unused ' ) { <nl> + unused . push ( { <nl> + name : name , <nl> + line : the_function [ ' ( line ) ' ] , <nl> + ' function ' : the_function [ ' ( name ) ' ] <nl> + } ) ; <nl> + } else if ( kind = = = ' undef ' ) { <nl> + undef . push ( { <nl> + name : name , <nl> + line : the_function [ ' ( line ) ' ] , <nl> + ' function ' : the_function [ ' ( name ) ' ] <nl> + } ) ; <nl> + } <nl> + } <nl> + } <nl> + } <nl> + } <nl> + for ( j = 0 ; j < functionicity . length ; j + = 1 ) { <nl> + if ( function_data [ functionicity [ j ] ] . length = = = 0 ) { <nl> + delete function_data [ functionicity [ j ] ] ; <nl> + } <nl> + } <nl> + function_data . name = the_function [ ' ( name ) ' ] ; <nl> + function_data . params = the_function [ ' ( params ) ' ] ; <nl> + function_data . line = the_function [ ' ( line ) ' ] ; <nl> + data . functions . push ( function_data ) ; <nl> + } <nl> + <nl> + if ( unused . length > 0 ) { <nl> + data . unused = unused ; <nl> + } <nl> + if ( undef . length > 0 ) { <nl> + data [ ' undefined ' ] = undef ; <nl> + } <nl> + return data ; <nl> + } ; <nl> + <nl> + itself . error_report = function ( data ) { <nl> + var evidence , i , output = [ ] , snippets , warning ; <nl> + if ( data . errors ) { <nl> + for ( i = 0 ; i < data . errors . length ; i + = 1 ) { <nl> + warning = data . errors [ i ] ; <nl> + if ( warning ) { <nl> + evidence = warning . evidence | | ' ' ; <nl> + output . push ( ' < cite > ' ) ; <nl> + if ( isFinite ( warning . line ) ) { <nl> + output . push ( ' < address > line ' + <nl> + String ( warning . line ) + <nl> + ' character ' + String ( warning . character ) + <nl> + ' < / address > ' ) ; <nl> + } <nl> + output . push ( warning . reason . entityify ( ) + ' < / cite > ' ) ; <nl> + if ( evidence ) { <nl> + output . push ( ' < pre > ' + evidence . entityify ( ) + ' < / pre > ' ) ; <nl> + } <nl> + } <nl> + } <nl> + } <nl> + if ( data . unused | | data [ ' undefined ' ] ) { <nl> + output . push ( ' < dl > ' ) ; <nl> + if ( data [ ' undefined ' ] ) { <nl> + output . push ( ' < dt > undefined < / dt > < dd > ' ) ; <nl> + snippets = [ ] ; <nl> + for ( i = 0 ; i < data [ ' undefined ' ] . length ; i + = 1 ) { <nl> + snippets [ i ] = ' < code > ' + data [ ' undefined ' ] [ i ] . name + <nl> + ' < / code > & nbsp ; < address > ' + <nl> + data [ ' undefined ' ] [ i ] [ ' function ' ] + ' ' + <nl> + String ( data [ ' undefined ' ] [ i ] . line ) + ' < / address > ' ; <nl> + } <nl> + output . push ( snippets . join ( ' , ' ) ) ; <nl> + output . push ( ' < / dd > ' ) ; <nl> + } <nl> + if ( data . unused ) { <nl> + output . push ( ' < dt > unused < / dt > < dd > ' ) ; <nl> + snippets = [ ] ; <nl> + for ( i = 0 ; i < data . unused . length ; i + = 1 ) { <nl> + snippets [ i ] = ' < code > ' + data . unused [ i ] . name + ' < / code > & nbsp ; < address > ' + <nl> + data . unused [ i ] [ ' function ' ] + ' ' + <nl> + String ( data . unused [ i ] . line ) + ' < / address > ' ; <nl> + } <nl> + output . push ( snippets . join ( ' , ' ) ) ; <nl> + output . push ( ' < / dd > ' ) ; <nl> + } <nl> + output . push ( ' < / dl > ' ) ; <nl> + } <nl> + if ( data . json ) { <nl> + output . push ( ' < p > JSON : bad . < / p > ' ) ; <nl> + } <nl> + return output . join ( ' ' ) ; <nl> + } ; <nl> + <nl> + <nl> + itself . report = function ( data ) { <nl> + var dl , err , i , j , names , output = [ ] , the_function ; <nl> + <nl> + function detail ( h , value ) { <nl> + var comma_needed , singularity ; <nl> + if ( Array . isArray ( value ) ) { <nl> + output . push ( ' < dt > ' + h + ' < / dt > < dd > ' ) ; <nl> + value . sort ( ) . forEach ( function ( item ) { <nl> + if ( item ! = = singularity ) { <nl> + singularity = item ; <nl> + output . push ( ( comma_needed ? ' , ' : ' ' ) + singularity ) ; <nl> + comma_needed = true ; <nl> + } <nl> + } ) ; <nl> + output . push ( ' < / dd > ' ) ; <nl> + } else if ( value ) { <nl> + output . push ( ' < dt > ' + h + ' < / dt > < dd > ' , value , ' < / dd > ' ) ; <nl> + } <nl> + } <nl> + <nl> + output . push ( ' < dl > ' ) ; <nl> + if ( data . urls ) { <nl> + detail ( " url " , data . urls ) ; <nl> + dl = true ; <nl> + } <nl> + if ( data . globals ) { <nl> + detail ( ' global ' , data . globals ) ; <nl> + dl = true ; <nl> + } else if ( xmode = = = ' style ' ) { <nl> + output . push ( ' < p > CSS . < / p > ' ) ; <nl> + } else if ( data . json & & ! err ) { <nl> + output . push ( ' < p > JSON : good . < / p > ' ) ; <nl> + } else { <nl> + output . push ( ' < div > < i > No new global variables introduced . < / i > < / div > ' ) ; <nl> + } <nl> + if ( dl ) { <nl> + output . push ( ' < / dl > ' ) ; <nl> + } else { <nl> + output [ 0 ] = ' ' ; <nl> + } <nl> + <nl> + for ( i = 0 ; i < data . functions . length ; i + = 1 ) { <nl> + the_function = data . functions [ i ] ; <nl> + names = [ ] ; <nl> + if ( the_function . params ) { <nl> + for ( j = 0 ; j < the_function . params . length ; j + = 1 ) { <nl> + names [ j ] = the_function . params [ j ] . string ; <nl> + } <nl> + } <nl> + output . push ( ' < dl > < address > line ' + <nl> + String ( the_function . line ) + ' < / address > ' + <nl> + the_function . name . entityify ( ) + <nl> + ' ( ' + names . join ( ' , ' ) + ' ) ' ) ; <nl> + detail ( ' undefined ' , the_function [ ' undefined ' ] ) ; <nl> + detail ( ' unused ' , the_function . unused ) ; <nl> + detail ( ' closure ' , the_function . closure ) ; <nl> + detail ( ' variable ' , the_function [ ' var ' ] ) ; <nl> + detail ( ' exception ' , the_function . exception ) ; <nl> + detail ( ' outer ' , the_function . outer ) ; <nl> + detail ( ' global ' , the_function . global ) ; <nl> + detail ( ' label ' , the_function . label ) ; <nl> + output . push ( ' < / dl > ' ) ; <nl> + } <nl> + return output . join ( ' ' ) ; <nl> + } ; <nl> + <nl> + itself . properties_report = function ( property ) { <nl> + if ( ! property ) { <nl> + return ' ' ; <nl> + } <nl> + var i , <nl> + key , <nl> + keys = Object . keys ( property ) . sort ( ) , <nl> + length , <nl> + output = [ ' / * properties ' ] , <nl> + mem = ' ' , <nl> + name , <nl> + not_first = false ; <nl> + for ( i = 0 ; i < keys . length ; i + = 1 ) { <nl> + key = keys [ i ] ; <nl> + if ( property [ key ] > 0 ) { <nl> + if ( not_first ) { <nl> + mem + = ' , ' ; <nl> + } <nl> + name = ix . test ( key ) <nl> + ? key <nl> + : ' \ ' ' + key . replace ( nx , sanitize ) + ' \ ' ' ; <nl> + length + = name . length + 2 ; <nl> + if ( mem . length + name . length > 80 ) { <nl> + output . push ( mem ) ; <nl> + mem = ' ' ; <nl> + } <nl> + mem + = name ; <nl> + not_first = true ; <nl> + } <nl> + } <nl> + output . push ( mem , ' * / \ n ' ) ; <nl> + return output . join ( ' \ n ' ) ; <nl> + } ; <nl> + <nl> + itself . jslint = itself ; <nl> + <nl> + itself . edition = ' 2012 - 05 - 09 ' ; <nl> + <nl> + return itself ; <nl> + } ( ) ) ; <nl>
potential solution for issue
arangodb/arangodb
6f7e11e46caf0b3d73cb7af088e00cf39c666840
2012-05-28T20:01:32Z
mmm a / tensorflow / go / op / wrappers . go <nl> ppp b / tensorflow / go / op / wrappers . go <nl> func DepthwiseConv2dNativeBackpropFilterDataFormat ( value string ) DepthwiseConv2d <nl> / / element on that dimension . The dimension order is determined by the value of <nl> / / ` data_format ` , see above for details . Dilations in the batch and depth <nl> / / dimensions must be 1 . <nl> - / / If not specified , defaults to { i : 1 i : 1 i : 1 i : 1 } <nl> + / / If not specified , defaults to { i : 1 i : 1 i : 1 i : 1 } <nl> func DepthwiseConv2dNativeBackpropFilterDilations ( value [ ] int64 ) DepthwiseConv2dNativeBackpropFilterAttr { <nl> return func ( m optionalAttr ) { <nl> m [ " dilations " ] = value <nl> func SampleDistortedBoundingBoxV2Seed2 ( value int64 ) SampleDistortedBoundingBoxV2 <nl> / / <nl> / / value : The cropped area of the image must have an aspect ratio = <nl> / / width / height within this range . <nl> - / / If not specified , defaults to { f : 0 . 75 f : 1 . 33 } <nl> + / / If not specified , defaults to { f : 0 . 75 f : 1 . 33 } <nl> func SampleDistortedBoundingBoxV2AspectRatioRange ( value [ ] float32 ) SampleDistortedBoundingBoxV2Attr { <nl> return func ( m optionalAttr ) { <nl> m [ " aspect_ratio_range " ] = value <nl> func SampleDistortedBoundingBoxV2AspectRatioRange ( value [ ] float32 ) SampleDistort <nl> / / <nl> / / value : The cropped area of the image must contain a fraction of the <nl> / / supplied image within this range . <nl> - / / If not specified , defaults to { f : 0 . 05 f : 1 } <nl> + / / If not specified , defaults to { f : 0 . 05 f : 1 } <nl> func SampleDistortedBoundingBoxV2AreaRange ( value [ ] float32 ) SampleDistortedBoundingBoxV2Attr { <nl> return func ( m optionalAttr ) { <nl> m [ " area_range " ] = value <nl> func SampleDistortedBoundingBoxMinObjectCovered ( value float32 ) SampleDistortedBo <nl> / / <nl> / / value : The cropped area of the image must have an aspect ratio = <nl> / / width / height within this range . <nl> - / / If not specified , defaults to { f : 0 . 75 f : 1 . 33 } <nl> + / / If not specified , defaults to { f : 0 . 75 f : 1 . 33 } <nl> func SampleDistortedBoundingBoxAspectRatioRange ( value [ ] float32 ) SampleDistortedBoundingBoxAttr { <nl> return func ( m optionalAttr ) { <nl> m [ " aspect_ratio_range " ] = value <nl> func SampleDistortedBoundingBoxAspectRatioRange ( value [ ] float32 ) SampleDistorted <nl> / / <nl> / / value : The cropped area of the image must contain a fraction of the <nl> / / supplied image within this range . <nl> - / / If not specified , defaults to { f : 0 . 05 f : 1 } <nl> + / / If not specified , defaults to { f : 0 . 05 f : 1 } <nl> func SampleDistortedBoundingBoxAreaRange ( value [ ] float32 ) SampleDistortedBoundingBoxAttr { <nl> return func ( m optionalAttr ) { <nl> m [ " area_range " ] = value <nl> func ImageSummaryMaxImages ( value int64 ) ImageSummaryAttr { <nl> / / ImageSummaryBadColor sets the optional bad_color attribute to value . <nl> / / <nl> / / value : Color to use for pixels with non - finite values . <nl> - / / If not specified , defaults to { dtype : DT_UINT8 tensor_shape : { dim : { size : 4 } } int_val : 255 int_val : 0 int_val : 0 int_val : 255 } <nl> + / / If not specified , defaults to { dtype : DT_UINT8 tensor_shape : { dim : { size : 4 } } int_val : 255 int_val : 0 int_val : 0 int_val : 255 } <nl> func ImageSummaryBadColor ( value tf . Tensor ) ImageSummaryAttr { <nl> return func ( m optionalAttr ) { <nl> m [ " bad_color " ] = value <nl> func Conv3DBackpropFilterV2DataFormat ( value string ) Conv3DBackpropFilterV2Attr { <nl> / / filter element on that dimension . The dimension order is determined by the <nl> / / value of ` data_format ` , see above for details . Dilations in the batch and <nl> / / depth dimensions must be 1 . <nl> - / / If not specified , defaults to { i : 1 i : 1 i : 1 i : 1 i : 1 } <nl> + / / If not specified , defaults to { i : 1 i : 1 i : 1 i : 1 i : 1 } <nl> func Conv3DBackpropFilterV2Dilations ( value [ ] int64 ) Conv3DBackpropFilterV2Attr { <nl> return func ( m optionalAttr ) { <nl> m [ " dilations " ] = value <nl> func Conv2DBackpropInputDataFormat ( value string ) Conv2DBackpropInputAttr { <nl> / / element on that dimension . The dimension order is determined by the value of <nl> / / ` data_format ` , see above for details . Dilations in the batch and depth <nl> / / dimensions must be 1 . <nl> - / / If not specified , defaults to { i : 1 i : 1 i : 1 i : 1 } <nl> + / / If not specified , defaults to { i : 1 i : 1 i : 1 i : 1 } <nl> func Conv2DBackpropInputDilations ( value [ ] int64 ) Conv2DBackpropInputAttr { <nl> return func ( m optionalAttr ) { <nl> m [ " dilations " ] = value <nl> func Conv2DDataFormat ( value string ) Conv2DAttr { <nl> / / filter element on that dimension . The dimension order is determined by the <nl> / / value of ` data_format ` , see above for details . Dilations in the batch and <nl> / / depth dimensions must be 1 . <nl> - / / If not specified , defaults to { i : 1 i : 1 i : 1 i : 1 } <nl> + / / If not specified , defaults to { i : 1 i : 1 i : 1 i : 1 } <nl> func Conv2DDilations ( value [ ] int64 ) Conv2DAttr { <nl> return func ( m optionalAttr ) { <nl> m [ " dilations " ] = value <nl> func QuantizedDepthwiseConv2DWithBiasAndReluAndRequantizeOutType ( value tf . DataTy <nl> / / QuantizedDepthwiseConv2DWithBiasAndReluAndRequantizeDilations sets the optional dilations attribute to value . <nl> / / <nl> / / value : List of dilation values . <nl> - / / If not specified , defaults to { i : 1 i : 1 i : 1 i : 1 } <nl> + / / If not specified , defaults to { i : 1 i : 1 i : 1 i : 1 } <nl> func QuantizedDepthwiseConv2DWithBiasAndReluAndRequantizeDilations ( value [ ] int64 ) QuantizedDepthwiseConv2DWithBiasAndReluAndRequantizeAttr { <nl> return func ( m optionalAttr ) { <nl> m [ " dilations " ] = value <nl> func QuantizedDepthwiseConv2DWithBiasAndReluOutType ( value tf . DataType ) Quantized <nl> / / QuantizedDepthwiseConv2DWithBiasAndReluDilations sets the optional dilations attribute to value . <nl> / / <nl> / / value : List of dilation values . <nl> - / / If not specified , defaults to { i : 1 i : 1 i : 1 i : 1 } <nl> + / / If not specified , defaults to { i : 1 i : 1 i : 1 i : 1 } <nl> func QuantizedDepthwiseConv2DWithBiasAndReluDilations ( value [ ] int64 ) QuantizedDepthwiseConv2DWithBiasAndReluAttr { <nl> return func ( m optionalAttr ) { <nl> m [ " dilations " ] = value <nl> func QuantizedDepthwiseConv2DWithBiasOutType ( value tf . DataType ) QuantizedDepthwi <nl> / / QuantizedDepthwiseConv2DWithBiasDilations sets the optional dilations attribute to value . <nl> / / <nl> / / value : List of dilation values . <nl> - / / If not specified , defaults to { i : 1 i : 1 i : 1 i : 1 } <nl> + / / If not specified , defaults to { i : 1 i : 1 i : 1 i : 1 } <nl> func QuantizedDepthwiseConv2DWithBiasDilations ( value [ ] int64 ) QuantizedDepthwiseConv2DWithBiasAttr { <nl> return func ( m optionalAttr ) { <nl> m [ " dilations " ] = value <nl> func QuantizedDepthwiseConv2DOutType ( value tf . DataType ) QuantizedDepthwiseConv2D <nl> / / QuantizedDepthwiseConv2DDilations sets the optional dilations attribute to value . <nl> / / <nl> / / value : List of dilation values . <nl> - / / If not specified , defaults to { i : 1 i : 1 i : 1 i : 1 } <nl> + / / If not specified , defaults to { i : 1 i : 1 i : 1 i : 1 } <nl> func QuantizedDepthwiseConv2DDilations ( value [ ] int64 ) QuantizedDepthwiseConv2DAttr { <nl> return func ( m optionalAttr ) { <nl> m [ " dilations " ] = value <nl> func QuantizedConv2DPerChannelOutType ( value tf . DataType ) QuantizedConv2DPerChann <nl> / / QuantizedConv2DPerChannelDilations sets the optional dilations attribute to value . <nl> / / <nl> / / value : list of dilation values . <nl> - / / If not specified , defaults to { i : 1 i : 1 i : 1 i : 1 } <nl> + / / If not specified , defaults to { i : 1 i : 1 i : 1 i : 1 } <nl> func QuantizedConv2DPerChannelDilations ( value [ ] int64 ) QuantizedConv2DPerChannelAttr { <nl> return func ( m optionalAttr ) { <nl> m [ " dilations " ] = value <nl> func Conv3DBackpropInputV2DataFormat ( value string ) Conv3DBackpropInputV2Attr { <nl> / / filter element on that dimension . The dimension order is determined by the <nl> / / value of ` data_format ` , see above for details . Dilations in the batch and <nl> / / depth dimensions must be 1 . <nl> - / / If not specified , defaults to { i : 1 i : 1 i : 1 i : 1 i : 1 } <nl> + / / If not specified , defaults to { i : 1 i : 1 i : 1 i : 1 i : 1 } <nl> func Conv3DBackpropInputV2Dilations ( value [ ] int64 ) Conv3DBackpropInputV2Attr { <nl> return func ( m optionalAttr ) { <nl> m [ " dilations " ] = value <nl> func AvgPool3DGrad ( scope * Scope , orig_input_shape tf . Output , grad tf . Output , ksi <nl> type Conv3DBackpropFilterAttr func ( optionalAttr ) <nl> <nl> / / Conv3DBackpropFilterDilations sets the optional dilations attribute to value . <nl> - / / If not specified , defaults to { i : 1 i : 1 i : 1 i : 1 i : 1 } <nl> + / / If not specified , defaults to { i : 1 i : 1 i : 1 i : 1 i : 1 } <nl> func Conv3DBackpropFilterDilations ( value [ ] int64 ) Conv3DBackpropFilterAttr { <nl> return func ( m optionalAttr ) { <nl> m [ " dilations " ] = value <nl> func DepthwiseConv2dNativeBackpropInputDataFormat ( value string ) DepthwiseConv2dN <nl> / / element on that dimension . The dimension order is determined by the value of <nl> / / ` data_format ` , see above for details . Dilations in the batch and depth <nl> / / dimensions must be 1 . <nl> - / / If not specified , defaults to { i : 1 i : 1 i : 1 i : 1 } <nl> + / / If not specified , defaults to { i : 1 i : 1 i : 1 i : 1 } <nl> func DepthwiseConv2dNativeBackpropInputDilations ( value [ ] int64 ) DepthwiseConv2dNativeBackpropInputAttr { <nl> return func ( m optionalAttr ) { <nl> m [ " dilations " ] = value <nl> func DepthwiseConv2dNativeBackpropInput ( scope * Scope , input_sizes tf . Output , fil <nl> type Conv3DBackpropInputAttr func ( optionalAttr ) <nl> <nl> / / Conv3DBackpropInputDilations sets the optional dilations attribute to value . <nl> - / / If not specified , defaults to { i : 1 i : 1 i : 1 i : 1 i : 1 } <nl> + / / If not specified , defaults to { i : 1 i : 1 i : 1 i : 1 i : 1 } <nl> func Conv3DBackpropInputDilations ( value [ ] int64 ) Conv3DBackpropInputAttr { <nl> return func ( m optionalAttr ) { <nl> m [ " dilations " ] = value <nl> func DepthwiseConv2dNativeDataFormat ( value string ) DepthwiseConv2dNativeAttr { <nl> / / element on that dimension . The dimension order is determined by the value of <nl> / / ` data_format ` , see above for details . Dilations in the batch and depth <nl> / / dimensions must be 1 . <nl> - / / If not specified , defaults to { i : 1 i : 1 i : 1 i : 1 } <nl> + / / If not specified , defaults to { i : 1 i : 1 i : 1 i : 1 } <nl> func DepthwiseConv2dNativeDilations ( value [ ] int64 ) DepthwiseConv2dNativeAttr { <nl> return func ( m optionalAttr ) { <nl> m [ " dilations " ] = value <nl> func QuantizedConv2DOutType ( value tf . DataType ) QuantizedConv2DAttr { <nl> / / filter element on that dimension . The dimension order is determined by the <nl> / / value of ` data_format ` , see above for details . Dilations in the batch and <nl> / / depth dimensions must be 1 . <nl> - / / If not specified , defaults to { i : 1 i : 1 i : 1 i : 1 } <nl> + / / If not specified , defaults to { i : 1 i : 1 i : 1 i : 1 } <nl> func QuantizedConv2DDilations ( value [ ] int64 ) QuantizedConv2DAttr { <nl> return func ( m optionalAttr ) { <nl> m [ " dilations " ] = value <nl> func Conv3DDataFormat ( value string ) Conv3DAttr { <nl> / / filter element on that dimension . The dimension order is determined by the <nl> / / value of ` data_format ` , see above for details . Dilations in the batch and <nl> / / depth dimensions must be 1 . <nl> - / / If not specified , defaults to { i : 1 i : 1 i : 1 i : 1 i : 1 } <nl> + / / If not specified , defaults to { i : 1 i : 1 i : 1 i : 1 i : 1 } <nl> func Conv3DDilations ( value [ ] int64 ) Conv3DAttr { <nl> return func ( m optionalAttr ) { <nl> m [ " dilations " ] = value <nl> func Conv2DBackpropFilterDataFormat ( value string ) Conv2DBackpropFilterAttr { <nl> / / element on that dimension . The dimension order is determined by the value of <nl> / / ` data_format ` , see above for details . Dilations in the batch and depth <nl> / / dimensions must be 1 . <nl> - / / If not specified , defaults to { i : 1 i : 1 i : 1 i : 1 } <nl> + / / If not specified , defaults to { i : 1 i : 1 i : 1 i : 1 } <nl> func Conv2DBackpropFilterDilations ( value [ ] int64 ) Conv2DBackpropFilterAttr { <nl> return func ( m optionalAttr ) { <nl> m [ " dilations " ] = value <nl>
Go : Update generated wrapper functions for TensorFlow ops .
tensorflow/tensorflow
d480c1497e54218761daa897c13674099f96b6d5
2020-03-02T04:49:38Z
mmm a / src / mongo / db / query / plan_enumerator . h <nl> ppp b / src / mongo / db / query / plan_enumerator . h <nl> class PlanEnumerator { <nl> * / <nl> bool alreadyCompounded ( const std : : set < MatchExpression * > & ixisectAssigned , <nl> const AndAssignment * andAssignment ) ; <nl> + <nl> + struct CmpByIndexID { <nl> + bool operator ( ) ( IndexID a , IndexID b ) const { <nl> + return a < b ; <nl> + } <nl> + } ; <nl> / * * <nl> - * Output index intersection assignments inside of an AND node . <nl> + * Maps from index id to the list of predicates assigned to that index . <nl> * / <nl> - typedef stdx : : unordered_map < IndexID , std : : vector < MatchExpression * > > IndexToPredMap ; <nl> + typedef std : : map < IndexID , std : : vector < MatchExpression * > , CmpByIndexID > IndexToPredMap ; <nl> <nl> / * * <nl> * Generate index intersection assignments given the predicate / index structure in idxToFirst <nl> mmm a / src / mongo / db / query / query_planner_tree_test . cpp <nl> ppp b / src / mongo / db / query / query_planner_tree_test . cpp <nl> TEST_F ( QueryPlannerTest , ContainedOrPushdownIndexedExpr ) { <nl> assertSolutionExists ( " { cscan : { dir : 1 } } } } " ) ; <nl> } <nl> <nl> + / / SERVER - 41872 fixed a case where variable " choice " ordering in the PlanEnumerator memo could lead <nl> + / / to different sets of solutions generated for the same input . This would occur in the case where <nl> + / / we only enumerate a subset of possible plans due to reaching internal limits and enumerate plans <nl> + / / in a non - stable order . With the fix for SERVER - 41872 , PlanEnumerator ordering is stable and <nl> + / / expected to always return the same set of solutions for a given input . <nl> + TEST_F ( QueryPlannerTest , SolutionSetStableWhenOrEnumerationLimitIsReached ) { <nl> + params . options = QueryPlannerParams : : NO_TABLE_SCAN ; <nl> + addIndex ( BSON ( " d " < < 1 ) ) ; <nl> + addIndex ( BSON ( " e " < < 1 ) ) ; <nl> + addIndex ( BSON ( " f " < < 1 ) ) ; <nl> + addIndex ( BSON ( " f " < < 1 < < " y " < < 1 ) ) ; <nl> + addIndex ( BSON ( " a " < < 1 ) ) ; <nl> + addIndex ( BSON ( " b " < < 1 ) ) ; <nl> + addIndex ( BSON ( " c " < < 1 ) ) ; <nl> + addIndex ( BSON ( " c " < < 1 < < " x " < < 1 ) ) ; <nl> + <nl> + runQueryAsCommand ( <nl> + fromjson ( " { find : ' testns ' , filter : { $ or : [ { a : 1 , b : 1 , c : 1 } , { d : 1 , e : 1 , f : 1 } ] } } " ) ) ; <nl> + <nl> + assertNumSolutions ( 10U ) ; <nl> + <nl> + assertSolutionExists ( <nl> + " { or : { nodes : [ { fetch : { filter : { b : { $ eq : 1 } , c : { $ eq : 1 } } , node : { ixscan : { pattern : { a : " <nl> + " 1 } } } } } , { fetch : { filter : { e : { $ eq : 1 } , f : { $ eq : 1 } } , node : { ixscan : { pattern : { d : " <nl> + " 1 } } } } } ] } } " ) ; <nl> + assertSolutionExists ( <nl> + " { or : { nodes : [ { fetch : { filter : { a : { $ eq : 1 } , c : { $ eq : 1 } } , node : { ixscan : { pattern : { b : " <nl> + " 1 } } } } } , { fetch : { filter : { e : { $ eq : 1 } , f : { $ eq : 1 } } , node : { ixscan : { pattern : { d : " <nl> + " 1 } } } } } ] } } " ) ; <nl> + assertSolutionExists ( <nl> + " { or : { nodes : [ { fetch : { filter : { a : { $ eq : 1 } , b : { $ eq : 1 } } , node : { ixscan : { pattern : { c : " <nl> + " 1 } } } } } , { fetch : { filter : { e : { $ eq : 1 } , f : { $ eq : 1 } } , node : { ixscan : { pattern : { d : " <nl> + " 1 } } } } } ] } } " ) ; <nl> + assertSolutionExists ( <nl> + " { or : { nodes : [ { fetch : { filter : { a : { $ eq : 1 } , b : { $ eq : 1 } } , node : { ixscan : { pattern : { c : " <nl> + " 1 , x : 1 } } } } } , { fetch : { filter : { e : { $ eq : 1 } , f : { $ eq : 1 } } , node : { ixscan : { pattern : { d : " <nl> + " 1 } } } } } ] } } " ) ; <nl> + assertSolutionExists ( <nl> + " { or : { nodes : [ { fetch : { filter : { b : { $ eq : 1 } , c : { $ eq : 1 } } , node : { ixscan : { pattern : { a : " <nl> + " 1 } } } } } , { fetch : { filter : { d : { $ eq : 1 } , f : { $ eq : 1 } } , node : { ixscan : { pattern : { e : " <nl> + " 1 } } } } } ] } } " ) ; <nl> + assertSolutionExists ( <nl> + " { or : { nodes : [ { fetch : { filter : { a : { $ eq : 1 } , c : { $ eq : 1 } } , node : { ixscan : { pattern : { b : " <nl> + " 1 } } } } } , { fetch : { filter : { d : { $ eq : 1 } , f : { $ eq : 1 } } , node : { ixscan : { pattern : { e : " <nl> + " 1 } } } } } ] } } " ) ; <nl> + assertSolutionExists ( <nl> + " { or : { nodes : [ { fetch : { filter : { a : { $ eq : 1 } , b : { $ eq : 1 } } , node : { ixscan : { pattern : { c : " <nl> + " 1 } } } } } , { fetch : { filter : { d : { $ eq : 1 } , f : { $ eq : 1 } } , node : { ixscan : { pattern : { e : " <nl> + " 1 } } } } } ] } } " ) ; <nl> + assertSolutionExists ( <nl> + " { or : { nodes : [ { fetch : { filter : { a : { $ eq : 1 } , b : { $ eq : 1 } } , node : { ixscan : { pattern : { c : " <nl> + " 1 , x : 1 } } } } } , { fetch : { filter : { d : { $ eq : 1 } , f : { $ eq : 1 } } , node : { ixscan : { pattern : { e : " <nl> + " 1 } } } } } ] } } " ) ; <nl> + assertSolutionExists ( <nl> + " { or : { nodes : [ { fetch : { filter : { b : { $ eq : 1 } , c : { $ eq : 1 } } , node : { ixscan : { pattern : { a : " <nl> + " 1 } } } } } , { fetch : { filter : { d : { $ eq : 1 } , e : { $ eq : 1 } } , node : { ixscan : { pattern : { f : " <nl> + " 1 } } } } } ] } } " ) ; <nl> + assertSolutionExists ( <nl> + " { or : { nodes : [ { fetch : { filter : { a : { $ eq : 1 } , c : { $ eq : 1 } } , node : { ixscan : { pattern : { b : " <nl> + " 1 } } } } } , { fetch : { filter : { d : { $ eq : 1 } , e : { $ eq : 1 } } , node : { ixscan : { pattern : { f : " <nl> + " 1 } } } } } ] } } " ) ; <nl> + } <nl> <nl> } / / namespace <nl> } / / namespace mongo <nl>
SERVER - 41872 PlanEnumerator AndAssignment : : choices ordering not stable and is relevant to set of plans generated
mongodb/mongo
6ca9be706ce03a2c79d29feac3cfd294cc09445d
2019-10-18T13:13:38Z
mmm a / addons / skin . confluence / 720p / VideoOSD . xml <nl> ppp b / addons / skin . confluence / 720p / VideoOSD . xml <nl> <nl> < depth > DepthOSD + < / depth > <nl> < visible > videoplayer . isstereoscopic + ! [ Window . IsVisible ( SliderDialog ) | Window . IsVisible ( OSDVideoSettings ) | Window . IsVisible ( OSDAudioSettings ) | Window . IsVisible ( OSDAudioDSPSettings ) | Window . IsVisible ( VideoBookmarks ) | Window . IsVisible ( PVROSDChannels ) | Window . IsVisible ( PVROSDGuide ) ] + [ Control . HasFocus ( 255 ) | ControlGroup ( 500 ) . HasFocus | Control . HasFocus ( 520 ) ] < / visible > <nl> < animation effect = " fade " time = " 150 " > VisibleChange < / animation > <nl> + < animation effect = " slide " start = " 0 , 0 " end = " 55 , 0 " time = " 0 " condition = " ! [ VideoPlayer . HasMenu | VideoPlayer . Content ( LiveTV ) ] " > Conditional < / animation > <nl> < animation effect = " slide " start = " 0 , 0 " end = " 55 , 0 " time = " 0 " condition = " VideoPlayer . Content ( LiveTV ) " > Conditional < / animation > <nl> < right > 200 < / right > <nl> < bottom > 45 < / bottom > <nl>
[ confluence ] fix 3D menu alignment when VideoPlayer . HasMenu is not visible
xbmc/xbmc
cdb370209747f2cacca5e0b5ce87cf0c2db5cb1b
2015-10-29T12:34:52Z
mmm a / hphp / hack / scripts / gen_build_id . ml <nl> ppp b / hphp / hack / scripts / gen_build_id . ml <nl> let ( ) = <nl> | Not_found - > " 0 " <nl> in <nl> let content = Printf . sprintf <nl> - " const char * const BuildInfo_kRevision = % S ; \ nconst unsigned long BuildInfo_kRevisionCommitTimeUnix = % sul ; \ n " <nl> - rev time in <nl> + " const char * const BuildInfo_kRevision = % S ; \ nconst unsigned long BuildInfo_kRevisionCommitTimeUnix = % sul ; \ nconst char * const BuildInfo_kBuildMode = % S ; \ n " <nl> + rev time " " ( * not implemented * ) in <nl> let do_dump = <nl> not ( Sys . file_exists out_file ) | | string_of_file out_file < > content in <nl> if do_dump then <nl> mmm a / hphp / hack / src / client / clientArgs . ml <nl> ppp b / hphp / hack / src / client / clientArgs . ml <nl> module Common_argspecs = struct <nl> ( " - - watchman - debug - logging " , <nl> Arg . Set value_ref , <nl> " Enable debug logging on Watchman client . This is very noisy " ) <nl> + <nl> + let allow_non_opt_build value_ref = <nl> + ( " - - allow - non_opt - build " , <nl> + Arg . Set value_ref , <nl> + " Override build mode check triggered by warn_on_non_opt_build . hhconfig option " ) <nl> end <nl> <nl> <nl> let parse_check_args cmd = <nl> let timeout = ref None in <nl> let version = ref false in <nl> let watchman_debug_logging = ref false in <nl> + let allow_non_opt_build = ref false in <nl> <nl> ( * custom behaviors * ) <nl> let set_from x ( ) = from : = x in <nl> let parse_check_args cmd = <nl> Arg . Set version , <nl> " ( mode ) show version and exit \ n " ; <nl> Common_argspecs . watchman_debug_logging watchman_debug_logging ; <nl> + Common_argspecs . allow_non_opt_build allow_non_opt_build ; <nl> ] in <nl> let args = parse_without_command options usage " check " in <nl> <nl> let parse_check_args cmd = <nl> sort_results = ! sort_results ; <nl> timeout = ! timeout ; <nl> watchman_debug_logging = ! watchman_debug_logging ; <nl> + allow_non_opt_build = ! allow_non_opt_build ; <nl> } <nl> <nl> let parse_start_env command = <nl> let parse_start_env command = <nl> let prechecked = ref None in <nl> let from = ref " " in <nl> let config = ref [ ] in <nl> + let allow_non_opt_build = ref false in <nl> let wait_deprecation_msg ( ) = Printf . eprintf <nl> " WARNING : - - wait is deprecated , does nothing , and will be going away \ <nl> soon ! \ n % ! " in <nl> let parse_start_env command = <nl> Common_argspecs . prechecked prechecked ; <nl> Common_argspecs . no_prechecked prechecked ; <nl> Common_argspecs . config config ; <nl> + Common_argspecs . allow_non_opt_build allow_non_opt_build ; <nl> ] in <nl> let args = parse_without_command options usage command in <nl> let root = <nl> let parse_start_env command = <nl> root = root ; <nl> silent = false ; <nl> watchman_debug_logging = ! watchman_debug_logging ; <nl> + allow_non_opt_build = ! allow_non_opt_build ; <nl> } <nl> <nl> let parse_start_args ( ) = <nl> mmm a / hphp / hack / src / client / clientCheck . ml <nl> ppp b / hphp / hack / src / client / clientCheck . ml <nl> let connect ? ( use_priority_pipe = false ) args = <nl> use_priority_pipe ; <nl> prechecked = args . prechecked ; <nl> config = args . config ; <nl> + allow_non_opt_build = args . allow_non_opt_build ; <nl> } <nl> <nl> ( * This is a function , because server closes the connection after each command , <nl> mmm a / hphp / hack / src / client / clientConnect . ml <nl> ppp b / hphp / hack / src / client / clientConnect . ml <nl> type env = { <nl> use_priority_pipe : bool ; <nl> prechecked : bool option ; <nl> config : ( string * string ) list ; <nl> + allow_non_opt_build : bool ; <nl> } <nl> <nl> type conn = { <nl> let rec connect <nl> dynamic_view = false ; <nl> prechecked = env . prechecked ; <nl> config = env . config ; <nl> + allow_non_opt_build = env . allow_non_opt_build ; <nl> } ; <nl> connect env retries start_time <nl> end else begin <nl> mmm a / hphp / hack / src / client / clientDebug . ml <nl> ppp b / hphp / hack / src / client / clientDebug . ml <nl> let main ( env : env ) : Exit_status . t Lwt . t = <nl> use_priority_pipe = false ; <nl> prechecked = None ; <nl> config = [ ] ; <nl> + allow_non_opt_build = false ; <nl> } in <nl> ServerCommandLwt . connect_debug oc ; <nl> ( * Exit this via ctrl - C * ) <nl> mmm a / hphp / hack / src / client / clientEnv . ml <nl> ppp b / hphp / hack / src / client / clientEnv . ml <nl> type client_check_env = { <nl> sort_results : bool ; <nl> timeout : float option ; <nl> watchman_debug_logging : bool ; <nl> + allow_non_opt_build : bool ; <nl> } <nl> <nl> let mode_to_string = function <nl> mmm a / hphp / hack / src / client / clientLsp . ml <nl> ppp b / hphp / hack / src / client / clientLsp . ml <nl> let rec connect_client <nl> use_priority_pipe = true ; <nl> prechecked = None ; <nl> config = [ ] ; <nl> + allow_non_opt_build = false ; <nl> } in <nl> try % lwt <nl> let % lwt ClientConnect . { channels = ic , oc ; server_finale_file ; _ } = <nl> let start_server ( root : Path . t ) : unit = <nl> dynamic_view = ! cached_toggle_state ; <nl> prechecked = None ; <nl> config = [ ] ; <nl> + allow_non_opt_build = false ; <nl> } in <nl> let _exit_status = ClientStart . main env_start in <nl> ( ) <nl> mmm a / hphp / hack / src / client / clientStart . ml <nl> ppp b / hphp / hack / src / client / clientStart . ml <nl> type env = { <nl> dynamic_view : bool ; <nl> prechecked : bool option ; <nl> config : ( string * string ) list ; <nl> + allow_non_opt_build : bool ; <nl> } <nl> <nl> let start_server env = <nl> let start_server env = <nl> if env . prechecked = Some true then [ | " - - prechecked " | ] else [ | | ] ; <nl> if env . prechecked = Some false then [ | " - - no - prechecked " | ] else [ | | ] ; <nl> if env . config < > [ ] then serialize_config_overrides env . config else [ | | ] ; <nl> + if env . allow_non_opt_build then [ | " - - allow - non - opt - build " | ] else [ | | ] ; <nl> match env . debug_port with <nl> | None - > [ | | ] <nl> | Some fd - > <nl> mmm a / hphp / hack / src / client / clientStart . mli <nl> ppp b / hphp / hack / src / client / clientStart . mli <nl> type env = { <nl> dynamic_view : bool ; <nl> prechecked : bool option ; <nl> config : ( string * string ) list ; <nl> + allow_non_opt_build : bool ; <nl> } <nl> <nl> val main : env - > Exit_status . t Lwt . t <nl> mmm a / hphp / hack / src / server / serverArgs . ml <nl> ppp b / hphp / hack / src / server / serverArgs . ml <nl> type options = { <nl> waiting_client : Unix . file_descr option ; <nl> watchman_debug_logging : bool ; <nl> with_saved_state : saved_state_target option ; <nl> + allow_non_opt_build : bool ; <nl> } <nl> <nl> ( * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ) <nl> let parse_options ( ) = <nl> let waiting_client = ref None in <nl> let watchman_debug_logging = ref false in <nl> let with_saved_state = ref None in <nl> + let allow_non_opt_build = ref false in <nl> <nl> let set_ai = fun s - > ai_mode : = Some ( Ai_options . prepare ~ server : true s ) in <nl> let set_max_procs = fun n - > max_procs : = Some n in <nl> let parse_options ( ) = <nl> " - - with - mini - state " , Arg . String set_with_saved_state , Messages . with_saved_state ; <nl> " - d " , Arg . Set should_detach , Messages . daemon ; <nl> " - s " , Arg . String set_save_state , Messages . save_state ; <nl> + " - - allow - non - opt - build " , Arg . Set allow_non_opt_build , " " ; <nl> ] in <nl> let options = Arg . align options in <nl> Arg . parse options ( fun s - > root : = s ) usage ; <nl> let parse_options ( ) = <nl> waiting_client = ! waiting_client ; <nl> watchman_debug_logging = ! watchman_debug_logging ; <nl> with_saved_state ; <nl> + allow_non_opt_build = ! allow_non_opt_build ; <nl> } <nl> <nl> ( * useful in testing code * ) <nl> let default_options ~ root = { <nl> waiting_client = None ; <nl> watchman_debug_logging = false ; <nl> with_saved_state = None ; <nl> + allow_non_opt_build = false ; <nl> } <nl> <nl> ( * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ) <nl> let should_detach options = options . should_detach <nl> let waiting_client options = options . waiting_client <nl> let watchman_debug_logging options = options . watchman_debug_logging <nl> let with_saved_state options = options . with_saved_state <nl> + let allow_non_opt_build options = options . allow_non_opt_build <nl> <nl> ( * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ) <nl> ( * Setters * ) <nl> let to_string <nl> waiting_client ; <nl> watchman_debug_logging ; <nl> with_saved_state ; <nl> + allow_non_opt_build ; <nl> } = <nl> let ai_mode_str = match ai_mode with <nl> | None - > " < > " <nl> let to_string <nl> " waiting_client : " ; waiting_client_str ; " , " ; <nl> " watchman_debug_logging : " ; string_of_bool watchman_debug_logging ; " , " ; <nl> " with_saved_state : " ; saved_state_str ; " , " ; <nl> + " allow_non_opt_build : " ; string_of_bool allow_non_opt_build ; " , " ; <nl> " } ) " <nl> ] | > String . concat ~ sep : " " ) <nl> mmm a / hphp / hack / src / server / serverArgs_sig . ml <nl> ppp b / hphp / hack / src / server / serverArgs_sig . ml <nl> module type S = sig <nl> val waiting_client : options - > Unix . file_descr option <nl> val watchman_debug_logging : options - > bool <nl> val with_saved_state : options - > saved_state_target option <nl> + val allow_non_opt_build : options - > bool <nl> <nl> ( * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ) <nl> ( * Setters * ) <nl> mmm a / hphp / hack / src / server / serverConfig . ml <nl> ppp b / hphp / hack / src / server / serverConfig . ml <nl> type t = { <nl> extra_paths : Path . t list ; <nl> ( * A list of regexps for paths to ignore for typechecking coroutines * ) <nl> coroutine_whitelist_paths : string list ; <nl> + warn_on_non_opt_build : bool <nl> } <nl> <nl> let filename = Relative_path . from_root Config_file . file_path_relative_to_repo_root <nl> let load config_filename options = <nl> ( * Since we use the unix alarm ( ) for our timeouts , a timeout value of 0 means <nl> * to wait indefinitely * ) <nl> let load_script_timeout = int_ " load_script_timeout " ~ default : 0 config in <nl> + let warn_on_non_opt_build = bool_ " warn_on_non_opt_build " ~ default : false config in <nl> let formatter_override = <nl> Option . map ( SMap . get config " formatter_override " ) maybe_relative_path in <nl> let global_opts = GlobalOptions . make <nl> let load config_filename options = <nl> ignored_paths = ignored_paths ; <nl> extra_paths = extra_paths ; <nl> coroutine_whitelist_paths = coroutine_whitelist_paths ; <nl> + warn_on_non_opt_build ; <nl> } , local_config <nl> <nl> ( * useful in testing code * ) <nl> let default_config = { <nl> ignored_paths = [ ] ; <nl> extra_paths = [ ] ; <nl> coroutine_whitelist_paths = [ ] ; <nl> + warn_on_non_opt_build = false ; <nl> } <nl> <nl> let set_parser_options config popt = { config with parser_options = popt } <nl> let ignored_paths config = config . ignored_paths <nl> let extra_paths config = config . extra_paths <nl> let coroutine_whitelist_paths config = config . coroutine_whitelist_paths <nl> let version config = config . version <nl> + let warn_on_non_opt_build config = config . warn_on_non_opt_build <nl> mmm a / hphp / hack / src / server / serverConfig . mli <nl> ppp b / hphp / hack / src / server / serverConfig . mli <nl> val parser_options : t - > ParserOptions . t <nl> val formatter_override : t - > Path . t option <nl> val config_hash : t - > string option <nl> val version : t - > string option <nl> + val warn_on_non_opt_build : t - > bool <nl> <nl> val convert_auto_namespace_to_map : string - > ( string * string ) list <nl> mmm a / hphp / hack / src / server / serverMain . ml <nl> ppp b / hphp / hack / src / server / serverMain . ml <nl> let setup_server ~ informant_managed ~ monitor_pid options config local_config = <nl> interrupt_on_client ; <nl> predeclare_ide ; <nl> max_typechecker_worker_memory_mb ; <nl> + rust ; <nl> _ <nl> } = local_config in <nl> List . iter ( ServerConfig . ignored_paths config ) ~ f : FilesToIgnore . ignore_path ; <nl> let setup_server ~ informant_managed ~ monitor_pid options config local_config = <nl> Exit_status . ( exit Nfs_root ) ; <nl> end ; <nl> <nl> + if rust & & ServerConfig . warn_on_non_opt_build config & & ( not Build_id . is_build_optimized ) then begin <nl> + let msg = ( Printf . sprintf <nl> + " hh_server binary was built in \ " % s \ " mode , " Build_id . build_mode ) ^ <nl> + " is running with Rust version of parser enabled , " ^ <nl> + " and this repository ' s . hhconfig specifies warn_on_non_opt_build option . " ^ <nl> + " Parsing with non - opt build will take significantly longer " <nl> + in <nl> + if ServerArgs . allow_non_opt_build options then begin <nl> + Hh_logger . log " Warning : % s . Initializing anyway due to - - allow - non - opt - build option . " msg <nl> + end else begin <nl> + Hh_logger . log " Error : % s . Recompile the server in opt or dbgo mode , or pass \ <nl> + - - allow - non - opt - build to continue anyway . " msg ; <nl> + Exit_status . ( exit Build_error ) ; <nl> + end <nl> + end ; <nl> + <nl> Program . preinit ( ) ; <nl> Sys_utils . set_priorities ~ cpu_priority ~ io_priority ; <nl> ( * this is to transform SIGPIPE in an exception . A SIGPIPE can happen when <nl> mmm a / hphp / hack / src / utils / build_id . ml <nl> ppp b / hphp / hack / src / utils / build_id . ml <nl> external get_build_commit_time_string : unit - > string = <nl> " hh_get_build_commit_time_string " <nl> external get_build_major : unit - > int = " hh_get_build_major " <nl> external get_build_minor : unit - > int = " hh_get_build_minor " <nl> + external get_build_mode : unit - > string = " hh_get_build_mode " <nl> <nl> let build_revision = get_build_revision ( ) <nl> <nl> let build_commit_time = get_build_commit_time ( ) <nl> let build_major_version = get_build_major ( ) <nl> let build_minor_version = get_build_minor ( ) <nl> <nl> + let build_mode = get_build_mode ( ) <nl> + <nl> + let is_build_optimized = <nl> + String_utils . string_starts_with build_mode " dbgo " | | <nl> + String_utils . string_starts_with build_mode " opt " | | <nl> + build_mode = " " ( * fail open if we don ' t know build mode * ) <nl> + <nl> ( * Monotonically increasing identifier that can be used when we introduce <nl> * backward incompatible changes in hh_client commands , and to signal <nl> * new capabilities to clients . <nl> mmm a / hphp / hack / src / utils / build_id . mli <nl> ppp b / hphp / hack / src / utils / build_id . mli <nl> val build_commit_time : int <nl> val build_major_version : int <nl> val build_minor_version : int <nl> val build_api_version : int <nl> + val build_mode : string <nl> + val is_build_optimized : bool <nl> mmm a / hphp / hack / src / utils / get_build_id . c <nl> ppp b / hphp / hack / src / utils / get_build_id . c <nl> <nl> <nl> extern const char * const BuildInfo_kRevision ; <nl> extern const uint64_t BuildInfo_kRevisionCommitTimeUnix ; <nl> + extern const char * const BuildInfo_kBuildMode ; <nl> <nl> # define STRINGIFY_HELPER ( x ) # x <nl> # define STRINGIFY_VALUE ( x ) STRINGIFY_HELPER ( x ) <nl> value hh_get_build_minor ( void ) { <nl> value hh_get_build_commit_time ( void ) { <nl> return Val_long ( BuildInfo_kRevisionCommitTimeUnix ) ; <nl> } <nl> + <nl> + value hh_get_build_mode ( void ) { <nl> + CAMLparam0 ( ) ; <nl> + CAMLlocal1 ( result ) ; <nl> + <nl> + const size_t len = strlen ( BuildInfo_kBuildMode ) ; <nl> + result = caml_alloc_string ( len ) ; <nl> + <nl> + memcpy ( String_val ( result ) , BuildInfo_kBuildMode , len ) ; <nl> + <nl> + CAMLreturn ( result ) ; <nl> + } <nl>
Ban hh_server not built with - O2 from running on www
facebook/hhvm
60163386d8b62851919df7b7b70449aea48ec663
2019-05-10T03:22:54Z
mmm a / scripts / VirtuaBuild / vm_access . py <nl> ppp b / scripts / VirtuaBuild / vm_access . py <nl> def help ( ) : <nl> <nl> # Make a temporary directory on VM <nl> print " * * * Making a temporary directory on the virtual machine . . . " <nl> - proc = target . command ( " cd / tmp & & rm - rf test . * & & mktemp - d test . XXXXXXXXXX " ) <nl> + proc = target . command ( " cd / tmp & & mktemp - d test . XXXXXXXXXX " ) <nl> dir_name = " / tmp / " + proc . stdout . readline ( ) . strip ( ) <nl> print " * * * Will be working in directory " + dir_name <nl> <nl>
Removed the part where vm_access deletes the tmp directories .
rethinkdb/rethinkdb
d54c416c2355f7a66959d7ce421f0ff96b7337b8
2012-07-17T01:02:44Z
mmm a / fdbserver / VFSAsync . cpp <nl> ppp b / fdbserver / VFSAsync . cpp <nl> <nl> # include < string . h > <nl> <nl> # ifdef WIN32 <nl> - # include " fdbserver / Windows . h " <nl> + # include < Windows . h > <nl> # endif <nl> <nl> # ifdef __unixish__ <nl>
Revert one line from that accidentally changed the include path for Windows . h
apple/foundationdb
a074dc2a601e484c0586ad1c1d54ee47d29229b2
2018-10-24T01:58:00Z
mmm a / doc / tutorials / core / basic_linear_transform / basic_linear_transform . markdown <nl> ppp b / doc / tutorials / core / basic_linear_transform / basic_linear_transform . markdown <nl> <nl> Changing the contrast and brightness of an image ! { # tutorial_basic_linear_transform } <nl> = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = <nl> <nl> + @ prev_tutorial { tutorial_adding_images } <nl> + @ next_tutorial { tutorial_discrete_fourier_transform } <nl> + <nl> Goal <nl> mmm - <nl> <nl> mmm a / doc / tutorials / core / discrete_fourier_transform / discrete_fourier_transform . markdown <nl> ppp b / doc / tutorials / core / discrete_fourier_transform / discrete_fourier_transform . markdown <nl> <nl> Discrete Fourier Transform { # tutorial_discrete_fourier_transform } <nl> = = = = = = = = = = = = = = = = = = = = = = = = = = <nl> <nl> - @ prev_tutorial { tutorial_random_generator_and_text } <nl> + @ prev_tutorial { tutorial_basic_linear_transform } <nl> @ next_tutorial { tutorial_file_input_output_with_xml_yml } <nl> <nl> Goal <nl> mmm a / doc / tutorials / core / file_input_output_with_xml_yml / file_input_output_with_xml_yml . markdown <nl> ppp b / doc / tutorials / core / file_input_output_with_xml_yml / file_input_output_with_xml_yml . markdown <nl> <nl> File Input and Output using XML and YAML files { # tutorial_file_input_output_with_xml_yml } <nl> = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = <nl> <nl> + @ prev_tutorial { tutorial_discrete_fourier_transform } <nl> + @ next_tutorial { tutorial_interoperability_with_OpenCV_1 } <nl> + <nl> Goal <nl> mmm - <nl> <nl> mmm a / doc / tutorials / core / how_to_scan_images / how_to_scan_images . markdown <nl> ppp b / doc / tutorials / core / how_to_scan_images / how_to_scan_images . markdown <nl> <nl> How to scan images , lookup tables and time measurement with OpenCV { # tutorial_how_to_scan_images } <nl> = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = <nl> <nl> + @ prev_tutorial { tutorial_mat_the_basic_image_container } <nl> + @ next_tutorial { tutorial_mat_mask_operations } <nl> + <nl> Goal <nl> mmm - <nl> <nl> mmm a / doc / tutorials / core / how_to_use_OpenCV_parallel_for_ / how_to_use_OpenCV_parallel_for_ . markdown <nl> ppp b / doc / tutorials / core / how_to_use_OpenCV_parallel_for_ / how_to_use_OpenCV_parallel_for_ . markdown <nl> <nl> How to use the OpenCV parallel_for_ to parallelize your code { # tutorial_how_to_use_OpenCV_parallel_for_ } <nl> = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = <nl> <nl> + @ prev_tutorial { tutorial_how_to_use_ippa_conversion } <nl> + <nl> Goal <nl> mmm - <nl> <nl> mmm a / doc / tutorials / core / how_to_use_ippa_conversion / how_to_use_ippa_conversion . markdown <nl> ppp b / doc / tutorials / core / how_to_use_ippa_conversion / how_to_use_ippa_conversion . markdown <nl> <nl> Intel ® IPP Asynchronous C / C + + library in OpenCV { # tutorial_how_to_use_ippa_conversion } <nl> = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = <nl> <nl> + @ prev_tutorial { tutorial_interoperability_with_OpenCV_1 } <nl> + @ next_tutorial { tutorial_how_to_use_OpenCV_parallel_for_ } <nl> + <nl> Goal <nl> mmm - <nl> <nl> mmm a / doc / tutorials / core / interoperability_with_OpenCV_1 / interoperability_with_OpenCV_1 . markdown <nl> ppp b / doc / tutorials / core / interoperability_with_OpenCV_1 / interoperability_with_OpenCV_1 . markdown <nl> <nl> Interoperability with OpenCV 1 { # tutorial_interoperability_with_OpenCV_1 } <nl> = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = <nl> <nl> + @ prev_tutorial { tutorial_file_input_output_with_xml_yml } <nl> + @ next_tutorial { tutorial_how_to_use_ippa_conversion } <nl> + <nl> Goal <nl> mmm - <nl> <nl> mmm a / doc / tutorials / core / mat_operations . markdown <nl> ppp b / doc / tutorials / core / mat_operations . markdown <nl> <nl> Operations with images { # tutorial_mat_operations } <nl> = = = = = = = = = = = = = = = = = = = = = = <nl> <nl> + @ prev_tutorial { tutorial_mat_mask_operations } <nl> + @ next_tutorial { tutorial_adding_images } <nl> + <nl> Input / Output <nl> mmmmmmmmmmmm <nl> <nl> mmm a / doc / tutorials / core / mat_the_basic_image_container / mat_the_basic_image_container . markdown <nl> ppp b / doc / tutorials / core / mat_the_basic_image_container / mat_the_basic_image_container . markdown <nl> <nl> Mat - The Basic Image Container { # tutorial_mat_the_basic_image_container } <nl> = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = <nl> <nl> + @ next_tutorial { tutorial_how_to_scan_images } <nl> + <nl> Goal <nl> mmm - <nl> <nl> mmm a / doc / tutorials / core / table_of_content_core . markdown <nl> ppp b / doc / tutorials / core / table_of_content_core . markdown <nl> understanding how to manipulate the images on a pixel level . <nl> <nl> We will learn how to change our image appearance ! <nl> <nl> - - @ subpage tutorial_basic_geometric_drawing <nl> - <nl> - * Languages : * C + + , Java , Python <nl> - <nl> - * Compatibility : * \ > OpenCV 2 . 0 <nl> - <nl> - * Author : * Ana Huamán <nl> - <nl> - We will learn how to draw simple geometry with OpenCV ! <nl> - <nl> - - @ subpage tutorial_random_generator_and_text <nl> - <nl> - * Compatibility : * \ > OpenCV 2 . 0 <nl> - <nl> - * Author : * Ana Huamán <nl> - <nl> - We will draw some * fancy - looking * stuff using OpenCV ! <nl> - <nl> - @ subpage tutorial_discrete_fourier_transform <nl> <nl> * Languages : * C + + , Java , Python <nl> similarity index 70 % <nl> rename from doc / tutorials / core / basic_geometric_drawing / basic_geometric_drawing . markdown <nl> rename to doc / tutorials / imgproc / basic_geometric_drawing / basic_geometric_drawing . markdown <nl> mmm a / doc / tutorials / core / basic_geometric_drawing / basic_geometric_drawing . markdown <nl> ppp b / doc / tutorials / imgproc / basic_geometric_drawing / basic_geometric_drawing . markdown <nl> <nl> Basic Drawing { # tutorial_basic_geometric_drawing } <nl> = = = = = = = = = = = = = <nl> <nl> - @ prev_tutorial { tutorial_basic_linear_transform } <nl> @ next_tutorial { tutorial_random_generator_and_text } <nl> <nl> Goals <nl> Code <nl> <nl> @ add_toggle_cpp <nl> - This code is in your OpenCV sample folder . Otherwise you can grab it from <nl> - [ here ] ( https : / / raw . githubusercontent . com / opencv / opencv / 3 . 4 / samples / cpp / tutorial_code / core / Matrix / Drawing_1 . cpp ) <nl> - @ include samples / cpp / tutorial_code / core / Matrix / Drawing_1 . cpp <nl> + [ here ] ( https : / / raw . githubusercontent . com / opencv / opencv / 3 . 4 / samples / cpp / tutorial_code / ImgProc / basic_drawing / Drawing_1 . cpp ) <nl> + @ include samples / cpp / tutorial_code / ImgProc / basic_drawing / Drawing_1 . cpp <nl> @ end_toggle <nl> <nl> @ add_toggle_java <nl> - This code is in your OpenCV sample folder . Otherwise you can grab it from <nl> - [ here ] ( https : / / raw . githubusercontent . com / opencv / opencv / 3 . 4 / samples / java / tutorial_code / core / BasicGeometricDrawing / BasicGeometricDrawing . java ) <nl> - @ include samples / java / tutorial_code / core / BasicGeometricDrawing / BasicGeometricDrawing . java <nl> + [ here ] ( https : / / raw . githubusercontent . com / opencv / opencv / 3 . 4 / samples / java / tutorial_code / ImgProc / BasicGeometricDrawing / BasicGeometricDrawing . java ) <nl> + @ include samples / java / tutorial_code / ImgProc / BasicGeometricDrawing / BasicGeometricDrawing . java <nl> @ end_toggle <nl> <nl> @ add_toggle_python <nl> - This code is in your OpenCV sample folder . Otherwise you can grab it from <nl> - [ here ] ( https : / / raw . githubusercontent . com / opencv / opencv / 3 . 4 / samples / python / tutorial_code / core / BasicGeometricDrawing / basic_geometric_drawing . py ) <nl> - @ include samples / python / tutorial_code / core / BasicGeometricDrawing / basic_geometric_drawing . py <nl> + [ here ] ( https : / / raw . githubusercontent . com / opencv / opencv / 3 . 4 / samples / python / tutorial_code / imgProc / BasicGeometricDrawing / basic_geometric_drawing . py ) <nl> + @ include samples / python / tutorial_code / imgProc / BasicGeometricDrawing / basic_geometric_drawing . py <nl> @ end_toggle <nl> <nl> Explanation <nl> Explanation <nl> Since we plan to draw two examples ( an atom and a rook ) , we have to create two images and two <nl> windows to display them . <nl> @ add_toggle_cpp <nl> - @ snippet cpp / tutorial_code / core / Matrix / Drawing_1 . cpp create_images <nl> + @ snippet cpp / tutorial_code / ImgProc / basic_drawing / Drawing_1 . cpp create_images <nl> @ end_toggle <nl> <nl> @ add_toggle_java <nl> - @ snippet java / tutorial_code / core / BasicGeometricDrawing / BasicGeometricDrawing . java create_images <nl> + @ snippet java / tutorial_code / ImgProc / BasicGeometricDrawing / BasicGeometricDrawing . java create_images <nl> @ end_toggle <nl> <nl> @ add_toggle_python <nl> - @ snippet python / tutorial_code / core / BasicGeometricDrawing / basic_geometric_drawing . py create_images <nl> + @ snippet python / tutorial_code / imgProc / BasicGeometricDrawing / basic_geometric_drawing . py create_images <nl> @ end_toggle <nl> <nl> We created functions to draw different geometric shapes . For instance , to draw the atom we used <nl> * * MyEllipse * * and * * MyFilledCircle * * : <nl> @ add_toggle_cpp <nl> - @ snippet cpp / tutorial_code / core / Matrix / Drawing_1 . cpp draw_atom <nl> + @ snippet cpp / tutorial_code / ImgProc / basic_drawing / Drawing_1 . cpp draw_atom <nl> @ end_toggle <nl> <nl> @ add_toggle_java <nl> - @ snippet java / tutorial_code / core / BasicGeometricDrawing / BasicGeometricDrawing . java draw_atom <nl> + @ snippet java / tutorial_code / ImgProc / BasicGeometricDrawing / BasicGeometricDrawing . java draw_atom <nl> @ end_toggle <nl> <nl> @ add_toggle_python <nl> - @ snippet python / tutorial_code / core / BasicGeometricDrawing / basic_geometric_drawing . py draw_atom <nl> + @ snippet python / tutorial_code / imgProc / BasicGeometricDrawing / basic_geometric_drawing . py draw_atom <nl> @ end_toggle <nl> <nl> And to draw the rook we employed * * MyLine * * , * * rectangle * * and a * * MyPolygon * * : <nl> @ add_toggle_cpp <nl> - @ snippet cpp / tutorial_code / core / Matrix / Drawing_1 . cpp draw_rook <nl> + @ snippet cpp / tutorial_code / ImgProc / basic_drawing / Drawing_1 . cpp draw_rook <nl> @ end_toggle <nl> <nl> @ add_toggle_java <nl> - @ snippet java / tutorial_code / core / BasicGeometricDrawing / BasicGeometricDrawing . java draw_rook <nl> + @ snippet java / tutorial_code / ImgProc / BasicGeometricDrawing / BasicGeometricDrawing . java draw_rook <nl> @ end_toggle <nl> <nl> @ add_toggle_python <nl> - @ snippet python / tutorial_code / core / BasicGeometricDrawing / basic_geometric_drawing . py draw_rook <nl> + @ snippet python / tutorial_code / imgProc / BasicGeometricDrawing / basic_geometric_drawing . py draw_rook <nl> @ end_toggle <nl> <nl> <nl> Let ' s check what is inside each of these functions : <nl> <nl> < H4 > MyLine < / H4 > <nl> @ add_toggle_cpp <nl> - @ snippet cpp / tutorial_code / core / Matrix / Drawing_1 . cpp my_line <nl> + @ snippet cpp / tutorial_code / ImgProc / basic_drawing / Drawing_1 . cpp my_line <nl> @ end_toggle <nl> <nl> @ add_toggle_java <nl> - @ snippet java / tutorial_code / core / BasicGeometricDrawing / BasicGeometricDrawing . java my_line <nl> + @ snippet java / tutorial_code / ImgProc / BasicGeometricDrawing / BasicGeometricDrawing . java my_line <nl> @ end_toggle <nl> <nl> @ add_toggle_python <nl> - @ snippet python / tutorial_code / core / BasicGeometricDrawing / basic_geometric_drawing . py my_line <nl> + @ snippet python / tutorial_code / imgProc / BasicGeometricDrawing / basic_geometric_drawing . py my_line <nl> @ end_toggle <nl> <nl> - As we can see , * * MyLine * * just call the function * * line ( ) * * , which does the following : <nl> Let ' s check what is inside each of these functions : <nl> <nl> < H4 > MyEllipse < / H4 > <nl> @ add_toggle_cpp <nl> - @ snippet cpp / tutorial_code / core / Matrix / Drawing_1 . cpp my_ellipse <nl> + @ snippet cpp / tutorial_code / ImgProc / basic_drawing / Drawing_1 . cpp my_ellipse <nl> @ end_toggle <nl> <nl> @ add_toggle_java <nl> - @ snippet java / tutorial_code / core / BasicGeometricDrawing / BasicGeometricDrawing . java my_ellipse <nl> + @ snippet java / tutorial_code / ImgProc / BasicGeometricDrawing / BasicGeometricDrawing . java my_ellipse <nl> @ end_toggle <nl> <nl> @ add_toggle_python <nl> - @ snippet python / tutorial_code / core / BasicGeometricDrawing / basic_geometric_drawing . py my_ellipse <nl> + @ snippet python / tutorial_code / imgProc / BasicGeometricDrawing / basic_geometric_drawing . py my_ellipse <nl> @ end_toggle <nl> <nl> - From the code above , we can observe that the function * * ellipse ( ) * * draws an ellipse such <nl> Let ' s check what is inside each of these functions : <nl> <nl> < H4 > MyFilledCircle < / H4 > <nl> @ add_toggle_cpp <nl> - @ snippet cpp / tutorial_code / core / Matrix / Drawing_1 . cpp my_filled_circle <nl> + @ snippet cpp / tutorial_code / ImgProc / basic_drawing / Drawing_1 . cpp my_filled_circle <nl> @ end_toggle <nl> <nl> @ add_toggle_java <nl> - @ snippet java / tutorial_code / core / BasicGeometricDrawing / BasicGeometricDrawing . java my_filled_circle <nl> + @ snippet java / tutorial_code / ImgProc / BasicGeometricDrawing / BasicGeometricDrawing . java my_filled_circle <nl> @ end_toggle <nl> <nl> @ add_toggle_python <nl> - @ snippet python / tutorial_code / core / BasicGeometricDrawing / basic_geometric_drawing . py my_filled_circle <nl> + @ snippet python / tutorial_code / imgProc / BasicGeometricDrawing / basic_geometric_drawing . py my_filled_circle <nl> @ end_toggle <nl> <nl> - Similar to the ellipse function , we can observe that * circle * receives as arguments : <nl> Let ' s check what is inside each of these functions : <nl> <nl> < H4 > MyPolygon < / H4 > <nl> @ add_toggle_cpp <nl> - @ snippet cpp / tutorial_code / core / Matrix / Drawing_1 . cpp my_polygon <nl> + @ snippet cpp / tutorial_code / ImgProc / basic_drawing / Drawing_1 . cpp my_polygon <nl> @ end_toggle <nl> <nl> @ add_toggle_java <nl> - @ snippet java / tutorial_code / core / BasicGeometricDrawing / BasicGeometricDrawing . java my_polygon <nl> + @ snippet java / tutorial_code / ImgProc / BasicGeometricDrawing / BasicGeometricDrawing . java my_polygon <nl> @ end_toggle <nl> <nl> @ add_toggle_python <nl> - @ snippet python / tutorial_code / core / BasicGeometricDrawing / basic_geometric_drawing . py my_polygon <nl> + @ snippet python / tutorial_code / imgProc / BasicGeometricDrawing / basic_geometric_drawing . py my_polygon <nl> @ end_toggle <nl> <nl> - To draw a filled polygon we use the function * * fillPoly ( ) * * . We note that : <nl> Let ' s check what is inside each of these functions : <nl> <nl> < H4 > rectangle < / H4 > <nl> @ add_toggle_cpp <nl> - @ snippet cpp / tutorial_code / core / Matrix / Drawing_1 . cpp rectangle <nl> + @ snippet cpp / tutorial_code / ImgProc / basic_drawing / Drawing_1 . cpp rectangle <nl> @ end_toggle <nl> <nl> @ add_toggle_java <nl> - @ snippet java / tutorial_code / core / BasicGeometricDrawing / BasicGeometricDrawing . java rectangle <nl> + @ snippet java / tutorial_code / ImgProc / BasicGeometricDrawing / BasicGeometricDrawing . java rectangle <nl> @ end_toggle <nl> <nl> @ add_toggle_python <nl> - @ snippet python / tutorial_code / core / BasicGeometricDrawing / basic_geometric_drawing . py rectangle <nl> + @ snippet python / tutorial_code / imgProc / BasicGeometricDrawing / basic_geometric_drawing . py rectangle <nl> @ end_toggle <nl> <nl> - Finally we have the @ ref cv : : rectangle function ( we did not create a special function for <nl> similarity index 100 % <nl> rename from doc / tutorials / core / basic_geometric_drawing / images / Drawing_1_Tutorial_Result_0 . png <nl> rename to doc / tutorials / imgproc / basic_geometric_drawing / images / Drawing_1_Tutorial_Result_0 . png <nl> mmm a / doc / tutorials / imgproc / erosion_dilatation / erosion_dilatation . markdown <nl> ppp b / doc / tutorials / imgproc / erosion_dilatation / erosion_dilatation . markdown <nl> <nl> Eroding and Dilating { # tutorial_erosion_dilatation } <nl> = = = = = = = = = = = = = = = = = = = = <nl> <nl> + @ prev_tutorial { tutorial_gausian_median_blur_bilateral_filter } <nl> + @ next_tutorial { tutorial_opening_closing_hats } <nl> + <nl> Goal <nl> mmm - <nl> <nl> mmm a / doc / tutorials / imgproc / gausian_median_blur_bilateral_filter / gausian_median_blur_bilateral_filter . markdown <nl> ppp b / doc / tutorials / imgproc / gausian_median_blur_bilateral_filter / gausian_median_blur_bilateral_filter . markdown <nl> <nl> Smoothing Images { # tutorial_gausian_median_blur_bilateral_filter } <nl> = = = = = = = = = = = = = = = = <nl> <nl> + @ prev_tutorial { tutorial_random_generator_and_text } <nl> @ next_tutorial { tutorial_erosion_dilatation } <nl> <nl> Goal <nl> mmm a / doc / tutorials / imgproc / histograms / back_projection / back_projection . markdown <nl> ppp b / doc / tutorials / imgproc / histograms / back_projection / back_projection . markdown <nl> <nl> Back Projection { # tutorial_back_projection } <nl> = = = = = = = = = = = = = = = <nl> <nl> + @ prev_tutorial { tutorial_histogram_comparison } <nl> + @ next_tutorial { tutorial_template_matching } <nl> + <nl> Goal <nl> mmm - <nl> <nl> mmm a / doc / tutorials / imgproc / histograms / histogram_calculation / histogram_calculation . markdown <nl> ppp b / doc / tutorials / imgproc / histograms / histogram_calculation / histogram_calculation . markdown <nl> <nl> Histogram Calculation { # tutorial_histogram_calculation } <nl> = = = = = = = = = = = = = = = = = = = = = <nl> <nl> + @ prev_tutorial { tutorial_histogram_equalization } <nl> + @ next_tutorial { tutorial_histogram_comparison } <nl> + <nl> Goal <nl> mmm - <nl> <nl> mmm a / doc / tutorials / imgproc / histograms / histogram_comparison / histogram_comparison . markdown <nl> ppp b / doc / tutorials / imgproc / histograms / histogram_comparison / histogram_comparison . markdown <nl> <nl> Histogram Comparison { # tutorial_histogram_comparison } <nl> = = = = = = = = = = = = = = = = = = = = <nl> <nl> + @ prev_tutorial { tutorial_histogram_calculation } <nl> + @ next_tutorial { tutorial_back_projection } <nl> + <nl> Goal <nl> mmm - <nl> <nl> mmm a / doc / tutorials / imgproc / histograms / histogram_equalization / histogram_equalization . markdown <nl> ppp b / doc / tutorials / imgproc / histograms / histogram_equalization / histogram_equalization . markdown <nl> <nl> Histogram Equalization { # tutorial_histogram_equalization } <nl> = = = = = = = = = = = = = = = = = = = = = = <nl> <nl> + @ prev_tutorial { tutorial_warp_affine } <nl> + @ next_tutorial { tutorial_histogram_calculation } <nl> + <nl> Goal <nl> mmm - <nl> <nl> mmm a / doc / tutorials / imgproc / imgtrans / canny_detector / canny_detector . markdown <nl> ppp b / doc / tutorials / imgproc / imgtrans / canny_detector / canny_detector . markdown <nl> <nl> Canny Edge Detector { # tutorial_canny_detector } <nl> = = = = = = = = = = = = = = = = = = = <nl> <nl> + @ prev_tutorial { tutorial_laplace_operator } <nl> + @ next_tutorial { tutorial_hough_lines } <nl> + <nl> Goal <nl> mmm - <nl> <nl> mmm a / doc / tutorials / imgproc / imgtrans / distance_transformation / distance_transform . markdown <nl> ppp b / doc / tutorials / imgproc / imgtrans / distance_transformation / distance_transform . markdown <nl> <nl> Image Segmentation with Distance Transform and Watershed Algorithm { # tutorial_distance_transform } <nl> = = = = = = = = = = = = = <nl> <nl> + @ prev_tutorial { tutorial_point_polygon_test } <nl> + @ next_tutorial { tutorial_out_of_focus_deblur_filter } <nl> + <nl> Goal <nl> mmm - <nl> <nl> mmm a / doc / tutorials / imgproc / imgtrans / remap / remap . markdown <nl> ppp b / doc / tutorials / imgproc / imgtrans / remap / remap . markdown <nl> <nl> Remapping { # tutorial_remap } <nl> = = = = = = = = = <nl> <nl> + @ prev_tutorial { tutorial_hough_circle } <nl> + @ next_tutorial { tutorial_warp_affine } <nl> + <nl> Goal <nl> mmm - <nl> <nl> mmm a / doc / tutorials / imgproc / imgtrans / warp_affine / warp_affine . markdown <nl> ppp b / doc / tutorials / imgproc / imgtrans / warp_affine / warp_affine . markdown <nl> <nl> Affine Transformations { # tutorial_warp_affine } <nl> = = = = = = = = = = = = = = = = = = = = = = <nl> <nl> + @ prev_tutorial { tutorial_remap } <nl> + @ next_tutorial { tutorial_histogram_equalization } <nl> + <nl> Goal <nl> mmm - <nl> <nl> mmm a / doc / tutorials / imgproc / opening_closing_hats / opening_closing_hats . markdown <nl> ppp b / doc / tutorials / imgproc / opening_closing_hats / opening_closing_hats . markdown <nl> <nl> More Morphology Transformations { # tutorial_opening_closing_hats } <nl> = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = <nl> <nl> + @ prev_tutorial { tutorial_erosion_dilatation } <nl> + @ next_tutorial { tutorial_hitOrMiss } <nl> + <nl> Goal <nl> mmm - <nl> <nl> mmm a / doc / tutorials / imgproc / out_of_focus_deblur_filter / out_of_focus_deblur_filter . markdown <nl> ppp b / doc / tutorials / imgproc / out_of_focus_deblur_filter / out_of_focus_deblur_filter . markdown <nl> <nl> Out - of - focus Deblur Filter { # tutorial_out_of_focus_deblur_filter } <nl> = = = = = = = = = = = = = = = = = = = = = = = = = = <nl> <nl> + @ prev_tutorial { tutorial_distance_transform } <nl> + <nl> Goal <nl> mmm - <nl> <nl> similarity index 100 % <nl> rename from doc / tutorials / core / random_generator_and_text / images / Drawing_2_Tutorial_Result_0 . jpg <nl> rename to doc / tutorials / imgproc / random_generator_and_text / images / Drawing_2_Tutorial_Result_0 . jpg <nl> similarity index 100 % <nl> rename from doc / tutorials / core / random_generator_and_text / images / Drawing_2_Tutorial_Result_2 . jpg <nl> rename to doc / tutorials / imgproc / random_generator_and_text / images / Drawing_2_Tutorial_Result_2 . jpg <nl> similarity index 100 % <nl> rename from doc / tutorials / core / random_generator_and_text / images / Drawing_2_Tutorial_Result_3 . jpg <nl> rename to doc / tutorials / imgproc / random_generator_and_text / images / Drawing_2_Tutorial_Result_3 . jpg <nl> similarity index 100 % <nl> rename from doc / tutorials / core / random_generator_and_text / images / Drawing_2_Tutorial_Result_5 . jpg <nl> rename to doc / tutorials / imgproc / random_generator_and_text / images / Drawing_2_Tutorial_Result_5 . jpg <nl> similarity index 100 % <nl> rename from doc / tutorials / core / random_generator_and_text / images / Drawing_2_Tutorial_Result_big . jpg <nl> rename to doc / tutorials / imgproc / random_generator_and_text / images / Drawing_2_Tutorial_Result_big . jpg <nl> similarity index 98 % <nl> rename from doc / tutorials / core / random_generator_and_text / random_generator_and_text . markdown <nl> rename to doc / tutorials / imgproc / random_generator_and_text / random_generator_and_text . markdown <nl> mmm a / doc / tutorials / core / random_generator_and_text / random_generator_and_text . markdown <nl> ppp b / doc / tutorials / imgproc / random_generator_and_text / random_generator_and_text . markdown <nl> <nl> Random generator and text with OpenCV { # tutorial_random_generator_and_text } <nl> = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = <nl> <nl> + @ prev_tutorial { tutorial_basic_geometric_drawing } <nl> + @ next_tutorial { tutorial_gausian_median_blur_bilateral_filter } <nl> + <nl> Goals <nl> mmm - - <nl> <nl> mmm a / doc / tutorials / imgproc / shapedescriptors / bounding_rects_circles / bounding_rects_circles . markdown <nl> ppp b / doc / tutorials / imgproc / shapedescriptors / bounding_rects_circles / bounding_rects_circles . markdown <nl> <nl> Creating Bounding boxes and circles for contours { # tutorial_bounding_rects_circles } <nl> = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = <nl> <nl> + @ prev_tutorial { tutorial_hull } <nl> + @ next_tutorial { tutorial_bounding_rotated_ellipses } <nl> + <nl> Goal <nl> mmm - <nl> <nl> mmm a / doc / tutorials / imgproc / shapedescriptors / bounding_rotated_ellipses / bounding_rotated_ellipses . markdown <nl> ppp b / doc / tutorials / imgproc / shapedescriptors / bounding_rotated_ellipses / bounding_rotated_ellipses . markdown <nl> <nl> Creating Bounding rotated boxes and ellipses for contours { # tutorial_bounding_rotated_ellipses } <nl> = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = <nl> <nl> + @ prev_tutorial { tutorial_bounding_rects_circles } <nl> + @ next_tutorial { tutorial_moments } <nl> + <nl> Goal <nl> mmm - <nl> <nl> mmm a / doc / tutorials / imgproc / shapedescriptors / find_contours / find_contours . markdown <nl> ppp b / doc / tutorials / imgproc / shapedescriptors / find_contours / find_contours . markdown <nl> <nl> Finding contours in your image { # tutorial_find_contours } <nl> = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = <nl> <nl> + @ prev_tutorial { tutorial_template_matching } <nl> + @ next_tutorial { tutorial_hull } <nl> + <nl> Goal <nl> mmm - <nl> <nl> mmm a / doc / tutorials / imgproc / shapedescriptors / hull / hull . markdown <nl> ppp b / doc / tutorials / imgproc / shapedescriptors / hull / hull . markdown <nl> <nl> Convex Hull { # tutorial_hull } <nl> = = = = = = = = = = = <nl> <nl> + @ prev_tutorial { tutorial_find_contours } <nl> + @ next_tutorial { tutorial_bounding_rects_circles } <nl> + <nl> Goal <nl> mmm - <nl> <nl> mmm a / doc / tutorials / imgproc / shapedescriptors / moments / moments . markdown <nl> ppp b / doc / tutorials / imgproc / shapedescriptors / moments / moments . markdown <nl> <nl> Image Moments { # tutorial_moments } <nl> = = = = = = = = = = = = = <nl> <nl> + @ prev_tutorial { tutorial_bounding_rotated_ellipses } <nl> + @ next_tutorial { tutorial_point_polygon_test } <nl> + <nl> Goal <nl> mmm - <nl> <nl> mmm a / doc / tutorials / imgproc / shapedescriptors / point_polygon_test / point_polygon_test . markdown <nl> ppp b / doc / tutorials / imgproc / shapedescriptors / point_polygon_test / point_polygon_test . markdown <nl> <nl> Point Polygon Test { # tutorial_point_polygon_test } <nl> = = = = = = = = = = = = = = = = = = <nl> <nl> + @ prev_tutorial { tutorial_moments } <nl> + @ next_tutorial { tutorial_distance_transform } <nl> + <nl> Goal <nl> mmm - <nl> <nl> mmm a / doc / tutorials / imgproc / table_of_content_imgproc . markdown <nl> ppp b / doc / tutorials / imgproc / table_of_content_imgproc . markdown <nl> Image Processing ( imgproc module ) { # tutorial_table_of_content_imgproc } <nl> <nl> In this section you will learn about the image processing ( manipulation ) functions inside OpenCV . <nl> <nl> + - @ subpage tutorial_basic_geometric_drawing <nl> + <nl> + * Languages : * C + + , Java , Python <nl> + <nl> + * Compatibility : * \ > OpenCV 2 . 0 <nl> + <nl> + * Author : * Ana Huamán <nl> + <nl> + We will learn how to draw simple geometry with OpenCV ! <nl> + <nl> + - @ subpage tutorial_random_generator_and_text <nl> + <nl> + * Compatibility : * \ > OpenCV 2 . 0 <nl> + <nl> + * Author : * Ana Huamán <nl> + <nl> + We will draw some * fancy - looking * stuff using OpenCV ! <nl> + <nl> - @ subpage tutorial_gausian_median_blur_bilateral_filter <nl> <nl> * Languages : * C + + , Java , Python <nl> mmm a / doc / tutorials / imgproc / threshold / threshold . markdown <nl> ppp b / doc / tutorials / imgproc / threshold / threshold . markdown <nl> <nl> Basic Thresholding Operations { # tutorial_threshold } <nl> = = = = = = = = = = = = = = = = = = = = = = = = = = = = = <nl> <nl> + @ prev_tutorial { tutorial_pyramids } <nl> + @ next_tutorial { tutorial_threshold_inRange } <nl> + <nl> Goal <nl> mmm - <nl> <nl> mmm a / doc / tutorials / imgproc / threshold_inRange / threshold_inRange . markdown <nl> ppp b / doc / tutorials / imgproc / threshold_inRange / threshold_inRange . markdown <nl> <nl> Thresholding Operations using inRange { # tutorial_threshold_inRange } <nl> = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = <nl> <nl> + @ prev_tutorial { tutorial_threshold } <nl> + @ next_tutorial { tutorial_filter_2d } <nl> + <nl> Goal <nl> mmm - <nl> <nl> mmm a / doc / tutorials / stitching / stitcher / stitcher . markdown <nl> ppp b / doc / tutorials / stitching / stitcher / stitcher . markdown <nl> Explanation <nl> <nl> The most important code part is : <nl> <nl> - @ code { . cpp } <nl> - Mat pano ; <nl> - Ptr < Stitcher > stitcher = Stitcher : : create ( mode , try_use_gpu ) ; <nl> - Stitcher : : Status status = stitcher - > stitch ( imgs , pano ) ; <nl> - <nl> - if ( status ! = Stitcher : : OK ) <nl> - { <nl> - cout < < " Can ' t stitch images , error code = " < < int ( status ) < < endl ; <nl> - return - 1 ; <nl> - } <nl> - @ endcode <nl> + @ snippet cpp / stitching . cpp stitching <nl> <nl> A new instance of stitcher is created and the @ ref cv : : Stitcher : : stitch will <nl> do all the hard work . <nl> mmm a / modules / calib3d / include / opencv2 / calib3d . hpp <nl> ppp b / modules / calib3d / include / opencv2 / calib3d . hpp <nl> optimization procedures like calibrateCamera , stereoCalibrate , or solvePnP . <nl> * / <nl> CV_EXPORTS_W void Rodrigues ( InputArray src , OutputArray dst , OutputArray jacobian = noArray ( ) ) ; <nl> <nl> - / * * @ example pose_from_homography . cpp <nl> - An example program about pose estimation from coplanar points <nl> + / * * @ example samples / cpp / tutorial_code / features2D / Homography / pose_from_homography . cpp <nl> + An example program about pose estimation from coplanar points <nl> <nl> - Check @ ref tutorial_homography " the corresponding tutorial " for more details <nl> - * / <nl> + Check @ ref tutorial_homography " the corresponding tutorial " for more details <nl> + * / <nl> <nl> / * * @ brief Finds a perspective transformation between two planes . <nl> <nl> CV_EXPORTS_W void projectPoints ( InputArray objectPoints , <nl> OutputArray jacobian = noArray ( ) , <nl> double aspectRatio = 0 ) ; <nl> <nl> - / * * @ example homography_from_camera_displacement . cpp <nl> - An example program about homography from the camera displacement <nl> + / * * @ example samples / cpp / tutorial_code / features2D / Homography / homography_from_camera_displacement . cpp <nl> + An example program about homography from the camera displacement <nl> <nl> - Check @ ref tutorial_homography " the corresponding tutorial " for more details <nl> - * / <nl> + Check @ ref tutorial_homography " the corresponding tutorial " for more details <nl> + * / <nl> <nl> / * * @ brief Finds an object pose from 3D - 2D point correspondences . <nl> <nl> CV_EXPORTS_W cv : : Mat estimateAffinePartial2D ( InputArray from , InputArray to , Out <nl> size_t maxIters = 2000 , double confidence = 0 . 99 , <nl> size_t refineIters = 10 ) ; <nl> <nl> - / * * @ example decompose_homography . cpp <nl> - An example program with homography decomposition . <nl> + / * * @ example samples / cpp / tutorial_code / features2D / Homography / decompose_homography . cpp <nl> + An example program with homography decomposition . <nl> <nl> - Check @ ref tutorial_homography " the corresponding tutorial " for more details . <nl> - * / <nl> + Check @ ref tutorial_homography " the corresponding tutorial " for more details . <nl> + * / <nl> <nl> / * * @ brief Decompose a homography matrix to rotation ( s ) , translation ( s ) and plane normal ( s ) . <nl> <nl> mmm a / modules / core / include / opencv2 / core . hpp <nl> ppp b / modules / core / include / opencv2 / core . hpp <nl> of p and len . <nl> * / <nl> CV_EXPORTS_W int borderInterpolate ( int p , int len , int borderType ) ; <nl> <nl> - / * * @ example copyMakeBorder_demo . cpp <nl> - An example using copyMakeBorder function <nl> - * / <nl> + / * * @ example samples / cpp / tutorial_code / ImgTrans / copyMakeBorder_demo . cpp <nl> + An example using copyMakeBorder function . <nl> + Check @ ref tutorial_copyMakeBorder " the corresponding tutorial " for more details <nl> + * / <nl> + <nl> / * * @ brief Forms a border around an image . <nl> <nl> The function copies the source image into the middle of the destination image . The areas to the <nl> The function can also be emulated with a matrix expression , for example : <nl> * / <nl> CV_EXPORTS_W void scaleAdd ( InputArray src1 , double alpha , InputArray src2 , OutputArray dst ) ; <nl> <nl> - / * * @ example AddingImagesTrackbar . cpp <nl> + / * * @ example samples / cpp / tutorial_code / HighGUI / AddingImagesTrackbar . cpp <nl> + Check @ ref tutorial_trackbar " the corresponding tutorial " for more details <nl> + * / <nl> <nl> - * / <nl> / * * @ brief Calculates the weighted sum of two arrays . <nl> <nl> The function addWeighted calculates the weighted sum of two arrays as follows : <nl> class CV_EXPORTS PCA <nl> Mat mean ; / / ! < mean value subtracted before the projection and added after the back projection <nl> } ; <nl> <nl> - / * * @ example pca . cpp <nl> - An example using % PCA for dimensionality reduction while maintaining an amount of variance <nl> - * / <nl> + / * * @ example samples / cpp / pca . cpp <nl> + An example using % PCA for dimensionality reduction while maintaining an amount of variance <nl> + * / <nl> + <nl> + / * * @ example samples / cpp / tutorial_code / ml / introduction_to_pca / introduction_to_pca . cpp <nl> + Check @ ref tutorial_introduction_to_pca " the corresponding tutorial " for more details <nl> + * / <nl> <nl> / * * <nl> - @ brief Linear Discriminant Analysis <nl> - @ todo document this class <nl> - * / <nl> + @ brief Linear Discriminant Analysis <nl> + @ todo document this class <nl> + * / <nl> class CV_EXPORTS LDA <nl> { <nl> public : <nl> class CV_EXPORTS RNG <nl> use explicit type cast operators , as in the a1 initialization above . <nl> @ param a lower inclusive boundary of the returned random number . <nl> @ param b upper non - inclusive boundary of the returned random number . <nl> - * / <nl> + * / <nl> int uniform ( int a , int b ) ; <nl> / * * @ overload * / <nl> float uniform ( float a , float b ) ; <nl> class CV_EXPORTS RNG <nl> <nl> Inspired by http : / / www . math . sci . hiroshima - u . ac . jp / ~ m - mat / MT / MT2002 / CODES / mt19937ar . c <nl> @ todo document <nl> - * / <nl> + * / <nl> class CV_EXPORTS RNG_MT19937 <nl> { <nl> public : <nl> class CV_EXPORTS RNG_MT19937 <nl> unsigned operator ( ) ( unsigned N ) ; <nl> unsigned operator ( ) ( ) ; <nl> <nl> - / * * @ brief returns uniformly distributed integer random number from [ a , b ) range <nl> - <nl> - * / <nl> + / * * @ brief returns uniformly distributed integer random number from [ a , b ) range * / <nl> int uniform ( int a , int b ) ; <nl> - / * * @ brief returns uniformly distributed floating - point random number from [ a , b ) range <nl> - <nl> - * / <nl> + / * * @ brief returns uniformly distributed floating - point random number from [ a , b ) range * / <nl> float uniform ( float a , float b ) ; <nl> - / * * @ brief returns uniformly distributed double - precision floating - point random number from [ a , b ) range <nl> - <nl> - * / <nl> + / * * @ brief returns uniformly distributed double - precision floating - point random number from [ a , b ) range * / <nl> double uniform ( double a , double b ) ; <nl> <nl> private : <nl> class CV_EXPORTS RNG_MT19937 <nl> / / ! @ addtogroup core_cluster <nl> / / ! @ { <nl> <nl> - / * * @ example kmeans . cpp <nl> - An example on K - means clustering <nl> + / * * @ example samples / cpp / kmeans . cpp <nl> + An example on K - means clustering <nl> * / <nl> <nl> / * * @ brief Finds centers of clusters and groups input samples around the clusters . <nl> etc . ) . <nl> <nl> Here is example of SimpleBlobDetector use in your application via Algorithm interface : <nl> @ snippet snippets / core_various . cpp Algorithm <nl> - * / <nl> + * / <nl> class CV_EXPORTS_W Algorithm <nl> { <nl> public : <nl> class CV_EXPORTS_W Algorithm <nl> virtual void write ( FileStorage & fs ) const { ( void ) fs ; } <nl> <nl> / * * @ brief simplified API for language bindings <nl> - * @ overload <nl> - * / <nl> + * @ overload <nl> + * / <nl> CV_WRAP void write ( const Ptr < FileStorage > & fs , const String & name = String ( ) ) const ; <nl> <nl> / * * @ brief Reads algorithm parameters from a file storage <nl> class CV_EXPORTS_W Algorithm <nl> CV_WRAP virtual void read ( const FileNode & fn ) { ( void ) fn ; } <nl> <nl> / * * @ brief Returns true if the Algorithm is empty ( e . g . in the very beginning or after unsuccessful read <nl> - * / <nl> + * / <nl> CV_WRAP virtual bool empty ( ) const { return false ; } <nl> <nl> / * * @ brief Reads algorithm from the file node <nl> <nl> - This is static template method of Algorithm . It ' s usage is following ( in the case of SVM ) : <nl> - @ code <nl> - cv : : FileStorage fsRead ( " example . xml " , FileStorage : : READ ) ; <nl> - Ptr < SVM > svm = Algorithm : : read < SVM > ( fsRead . root ( ) ) ; <nl> - @ endcode <nl> - In order to make this method work , the derived class must overwrite Algorithm : : read ( const <nl> - FileNode & fn ) and also have static create ( ) method without parameters <nl> - ( or with all the optional parameters ) <nl> - * / <nl> + This is static template method of Algorithm . It ' s usage is following ( in the case of SVM ) : <nl> + @ code <nl> + cv : : FileStorage fsRead ( " example . xml " , FileStorage : : READ ) ; <nl> + Ptr < SVM > svm = Algorithm : : read < SVM > ( fsRead . root ( ) ) ; <nl> + @ endcode <nl> + In order to make this method work , the derived class must overwrite Algorithm : : read ( const <nl> + FileNode & fn ) and also have static create ( ) method without parameters <nl> + ( or with all the optional parameters ) <nl> + * / <nl> template < typename _Tp > static Ptr < _Tp > read ( const FileNode & fn ) <nl> { <nl> Ptr < _Tp > obj = _Tp : : create ( ) ; <nl> class CV_EXPORTS_W Algorithm <nl> <nl> / * * @ brief Loads algorithm from the file <nl> <nl> - @ param filename Name of the file to read . <nl> - @ param objname The optional name of the node to read ( if empty , the first top - level node will be used ) <nl> + @ param filename Name of the file to read . <nl> + @ param objname The optional name of the node to read ( if empty , the first top - level node will be used ) <nl> <nl> - This is static template method of Algorithm . It ' s usage is following ( in the case of SVM ) : <nl> - @ code <nl> - Ptr < SVM > svm = Algorithm : : load < SVM > ( " my_svm_model . xml " ) ; <nl> - @ endcode <nl> - In order to make this method work , the derived class must overwrite Algorithm : : read ( const <nl> - FileNode & fn ) . <nl> - * / <nl> + This is static template method of Algorithm . It ' s usage is following ( in the case of SVM ) : <nl> + @ code <nl> + Ptr < SVM > svm = Algorithm : : load < SVM > ( " my_svm_model . xml " ) ; <nl> + @ endcode <nl> + In order to make this method work , the derived class must overwrite Algorithm : : read ( const <nl> + FileNode & fn ) . <nl> + * / <nl> template < typename _Tp > static Ptr < _Tp > load ( const String & filename , const String & objname = String ( ) ) <nl> { <nl> FileStorage fs ( filename , FileStorage : : READ ) ; <nl> class CV_EXPORTS_W Algorithm <nl> <nl> / * * @ brief Loads algorithm from a String <nl> <nl> - @ param strModel The string variable containing the model you want to load . <nl> - @ param objname The optional name of the node to read ( if empty , the first top - level node will be used ) <nl> + @ param strModel The string variable containing the model you want to load . <nl> + @ param objname The optional name of the node to read ( if empty , the first top - level node will be used ) <nl> <nl> - This is static template method of Algorithm . It ' s usage is following ( in the case of SVM ) : <nl> - @ code <nl> - Ptr < SVM > svm = Algorithm : : loadFromString < SVM > ( myStringModel ) ; <nl> - @ endcode <nl> - * / <nl> + This is static template method of Algorithm . It ' s usage is following ( in the case of SVM ) : <nl> + @ code <nl> + Ptr < SVM > svm = Algorithm : : loadFromString < SVM > ( myStringModel ) ; <nl> + @ endcode <nl> + * / <nl> template < typename _Tp > static Ptr < _Tp > loadFromString ( const String & strModel , const String & objname = String ( ) ) <nl> { <nl> FileStorage fs ( strModel , FileStorage : : READ + FileStorage : : MEMORY ) ; <nl> class CV_EXPORTS_W Algorithm <nl> } <nl> <nl> / * * Saves the algorithm to a file . <nl> - In order to make this method work , the derived class must implement Algorithm : : write ( FileStorage & fs ) . * / <nl> + In order to make this method work , the derived class must implement Algorithm : : write ( FileStorage & fs ) . * / <nl> CV_WRAP virtual void save ( const String & filename ) const ; <nl> <nl> / * * Returns the algorithm string identifier . <nl> - This string is used as top level xml / yml node tag when the object is saved to a file or string . * / <nl> + This string is used as top level xml / yml node tag when the object is saved to a file or string . * / <nl> CV_WRAP virtual String getDefaultName ( ) const ; <nl> <nl> protected : <nl> mmm a / modules / core / include / opencv2 / core / mat . hpp <nl> ppp b / modules / core / include / opencv2 / core / mat . hpp <nl> struct CV_EXPORTS MatStep <nl> MatStep & operator = ( const MatStep & ) ; <nl> } ; <nl> <nl> - / * * @ example cout_mat . cpp <nl> + / * * @ example samples / cpp / cout_mat . cpp <nl> An example demonstrating the serial out capabilities of cv : : Mat <nl> * / <nl> <nl> mmm a / modules / core / include / opencv2 / core / persistence . hpp <nl> ppp b / modules / core / include / opencv2 / core / persistence . hpp <nl> element is a structure of 2 integers , followed by a single - precision floating - po <nl> equivalent notations of the above specification are ` iif ` , ` 2i1f ` and so forth . Other examples : ` u ` <nl> means that the array consists of bytes , and ` 2d ` means the array consists of pairs of doubles . <nl> <nl> - @ see @ ref filestorage . cpp <nl> + @ see @ ref samples / cpp / filestorage . cpp <nl> * / <nl> <nl> / / ! @ { <nl> <nl> - / * * @ example filestorage . cpp <nl> + / * * @ example samples / cpp / filestorage . cpp <nl> A complete example using the FileStorage interface <nl> * / <nl> <nl> mmm a / modules / dnn / include / opencv2 / dnn . hpp <nl> ppp b / modules / dnn / include / opencv2 / dnn . hpp <nl> <nl> A network training is in principle not supported . <nl> @ } <nl> * / <nl> + / * * @ example samples / dnn / classification . cpp <nl> + Check @ ref tutorial_dnn_googlenet " the corresponding tutorial " for more details <nl> + * / <nl> + / * * @ example samples / dnn / colorization . cpp <nl> + * / <nl> + / * * @ example samples / dnn / object_detection . cpp <nl> + Check @ ref tutorial_dnn_yolo " the corresponding tutorial " for more details <nl> + * / <nl> + / * * @ example samples / dnn / openpose . cpp <nl> + * / <nl> + / * * @ example samples / dnn / segmentation . cpp <nl> + * / <nl> + / * * @ example samples / dnn / text_detection . cpp <nl> + * / <nl> # include < opencv2 / dnn / dnn . hpp > <nl> <nl> # endif / * OPENCV_DNN_HPP * / <nl> mmm a / modules / highgui / include / opencv2 / highgui . hpp <nl> ppp b / modules / highgui / include / opencv2 / highgui . hpp <nl> The function getWindowImageRect returns the client screen coordinates , width and <nl> * / <nl> CV_EXPORTS_W Rect getWindowImageRect ( const String & winname ) ; <nl> <nl> + / * * @ example samples / cpp / create_mask . cpp <nl> + This program demonstrates using mouse events and how to make and use a mask image ( black and white ) . <nl> + * / <nl> / * * @ brief Sets mouse handler for the specified window <nl> <nl> @ param winname Name of the window . <nl> - @ param onMouse Mouse callback . See OpenCV samples , such as <nl> - < https : / / github . com / opencv / opencv / tree / 3 . 4 / samples / cpp / ffilldemo . cpp > , on how to specify and <nl> - use the callback . <nl> + @ param onMouse Callback function for mouse events . See OpenCV samples on how to specify and use the callback . <nl> @ param userdata The optional parameter passed to the callback . <nl> * / <nl> CV_EXPORTS void setMouseCallback ( const String & winname , MouseCallback onMouse , void * userdata = 0 ) ; <nl> mmm a / modules / imgproc / include / opencv2 / imgproc . hpp <nl> ppp b / modules / imgproc / include / opencv2 / imgproc . hpp <nl> class CV_EXPORTS_W Subdiv2D <nl> / / ! @ addtogroup imgproc_feature <nl> / / ! @ { <nl> <nl> - / * * @ example lsd_lines . cpp <nl> + / * * @ example samples / cpp / lsd_lines . cpp <nl> An example using the LineSegmentDetector <nl> \ image html building_lsd . png " Sample output image " width = 434 height = 300 <nl> * / <nl> operation is shifted . <nl> * / <nl> CV_EXPORTS_W Mat getStructuringElement ( int shape , Size ksize , Point anchor = Point ( - 1 , - 1 ) ) ; <nl> <nl> - / * * @ example Smoothing . cpp <nl> + / * * @ example samples / cpp / tutorial_code / ImgProc / Smoothing / Smoothing . cpp <nl> Sample code for simple filters <nl> ! [ Sample screenshot ] ( Smoothing_Tutorial_Result_Median_Filter . jpg ) <nl> Check @ ref tutorial_gausian_median_blur_bilateral_filter " the corresponding tutorial " for more details <nl> * / <nl> + <nl> / * * @ brief Blurs an image using the median filter . <nl> <nl> The function smoothes an image using the median filter with the \ f $ \ texttt { ksize } \ times <nl> CV_EXPORTS_W void sepFilter2D ( InputArray src , OutputArray dst , int ddepth , <nl> Point anchor = Point ( - 1 , - 1 ) , <nl> double delta = 0 , int borderType = BORDER_DEFAULT ) ; <nl> <nl> - / * * @ example Sobel_Demo . cpp <nl> + / * * @ example samples / cpp / tutorial_code / ImgTrans / Sobel_Demo . cpp <nl> Sample code using Sobel and / or Scharr OpenCV functions to make a simple Edge Detector <nl> ! [ Sample screenshot ] ( Sobel_Derivatives_Tutorial_Result . jpg ) <nl> Check @ ref tutorial_sobel_derivatives " the corresponding tutorial " for more details <nl> - * / <nl> + * / <nl> + <nl> / * * @ brief Calculates the first , second , third , or mixed image derivatives using an extended Sobel operator . <nl> <nl> In all cases except one , the \ f $ \ texttt { ksize } \ times \ texttt { ksize } \ f $ separable kernel is used to <nl> CV_EXPORTS_W void Scharr ( InputArray src , OutputArray dst , int ddepth , <nl> int dx , int dy , double scale = 1 , double delta = 0 , <nl> int borderType = BORDER_DEFAULT ) ; <nl> <nl> - / * * @ example laplace . cpp <nl> - An example using Laplace transformations for edge detection <nl> + / * * @ example samples / cpp / laplace . cpp <nl> + An example using Laplace transformations for edge detection <nl> * / <nl> <nl> / * * @ brief Calculates the Laplacian of an image . <nl> CV_EXPORTS_W void Laplacian ( InputArray src , OutputArray dst , int ddepth , <nl> / / ! @ addtogroup imgproc_feature <nl> / / ! @ { <nl> <nl> - / * * @ example edge . cpp <nl> - This program demonstrates usage of the Canny edge detector <nl> + / * * @ example samples / cpp / edge . cpp <nl> + This program demonstrates usage of the Canny edge detector <nl> <nl> - Check @ ref tutorial_canny_detector " the corresponding tutorial " for more details <nl> + Check @ ref tutorial_canny_detector " the corresponding tutorial " for more details <nl> * / <nl> <nl> / * * @ brief Finds edges in an image using the Canny algorithm @ cite Canny86 . <nl> CV_EXPORTS_W void goodFeaturesToTrack ( InputArray image , OutputArray corners , <nl> InputArray mask , int blockSize , <nl> int gradientSize , bool useHarrisDetector = false , <nl> double k = 0 . 04 ) ; <nl> - / * * @ example houghlines . cpp <nl> + / * * @ example samples / cpp / tutorial_code / ImgTrans / houghlines . cpp <nl> An example using the Hough line detector <nl> ! [ Sample input image ] ( Hough_Lines_Tutorial_Original_Image . jpg ) ! [ Output image ] ( Hough_Lines_Tutorial_Result . jpg ) <nl> * / <nl> CV_EXPORTS_W void HoughLinesPointSet ( InputArray _point , OutputArray _lines , int <nl> double min_rho , double max_rho , double rho_step , <nl> double min_theta , double max_theta , double theta_step ) ; <nl> <nl> - / * * @ example houghcircles . cpp <nl> + / * * @ example samples / cpp / tutorial_code / ImgTrans / houghcircles . cpp <nl> An example using the Hough circle detector <nl> * / <nl> <nl> CV_EXPORTS_W void HoughCircles ( InputArray image , OutputArray circles , <nl> / / ! @ addtogroup imgproc_filter <nl> / / ! @ { <nl> <nl> - / * * @ example morphology2 . cpp <nl> + / * * @ example samples / cpp / tutorial_code / ImgProc / Morphology_2 . cpp <nl> Advanced morphology Transformations sample code <nl> ! [ Sample screenshot ] ( Morphology_2_Tutorial_Result . jpg ) <nl> Check @ ref tutorial_opening_closing_hats " the corresponding tutorial " for more details <nl> CV_EXPORTS_W void erode ( InputArray src , OutputArray dst , InputArray kernel , <nl> int borderType = BORDER_CONSTANT , <nl> const Scalar & borderValue = morphologyDefaultBorderValue ( ) ) ; <nl> <nl> - / * * @ example Morphology_1 . cpp <nl> + / * * @ example samples / cpp / tutorial_code / ImgProc / Morphology_1 . cpp <nl> Erosion and Dilation sample code <nl> ! [ Sample Screenshot - Erosion ] ( Morphology_1_Tutorial_Erosion_Result . jpg ) ! [ Sample Screenshot - Dilation ] ( Morphology_1_Tutorial_Dilation_Result . jpg ) <nl> Check @ ref tutorial_erosion_dilatation " the corresponding tutorial " for more details <nl> - * / <nl> + * / <nl> + <nl> / * * @ brief Dilates an image by using a specific structuring element . <nl> <nl> The function dilates the source image using the specified structuring element that determines the <nl> CV_EXPORTS_W void warpAffine ( InputArray src , OutputArray dst , <nl> int borderMode = BORDER_CONSTANT , <nl> const Scalar & borderValue = Scalar ( ) ) ; <nl> <nl> - / * * @ example warpPerspective_demo . cpp <nl> + / * * @ example samples / cpp / warpPerspective_demo . cpp <nl> An example program shows using cv : : findHomography and cv : : warpPerspective for image warping <nl> - * / <nl> + * / <nl> + <nl> / * * @ brief Applies a perspective transformation to an image . <nl> <nl> The function warpPerspective transforms the source image using the specified matrix : <nl> source image . The center must be inside the image . <nl> CV_EXPORTS_W void getRectSubPix ( InputArray image , Size patchSize , <nl> Point2f center , OutputArray patch , int patchType = - 1 ) ; <nl> <nl> - / * * @ example polar_transforms . cpp <nl> + / * * @ example samples / cpp / polar_transforms . cpp <nl> An example using the cv : : linearPolar and cv : : logPolar operations <nl> * / <nl> <nl> CV_EXPORTS_W void adaptiveThreshold ( InputArray src , OutputArray dst , <nl> / / ! @ addtogroup imgproc_filter <nl> / / ! @ { <nl> <nl> - / * * @ example Pyramids . cpp <nl> + / * * @ example samples / cpp / tutorial_code / ImgProc / Pyramids / Pyramids . cpp <nl> An example using pyrDown and pyrUp functions <nl> - * / <nl> + * / <nl> + <nl> / * * @ brief Blurs an image and downsamples it . <nl> <nl> By default , size of the output image is computed as ` Size ( ( src . cols + 1 ) / 2 , ( src . rows + 1 ) / 2 ) ` , but in <nl> CV_EXPORTS_AS ( undistortPointsIter ) void undistortPoints ( InputArray src , OutputA <nl> / / ! @ addtogroup imgproc_hist <nl> / / ! @ { <nl> <nl> - / * * @ example demhist . cpp <nl> + / * * @ example samples / cpp / demhist . cpp <nl> An example for creating histograms of an image <nl> * / <nl> <nl> CV_EXPORTS_AS ( EMD ) float wrapperEMD ( InputArray signature1 , InputArray signature <nl> <nl> / / ! @ } imgproc_hist <nl> <nl> - / * * @ example watershed . cpp <nl> + / * * @ example samples / cpp / watershed . cpp <nl> An example using the watershed algorithm <nl> - * / <nl> + * / <nl> <nl> / * * @ brief Performs a marker - based image segmentation using the watershed algorithm . <nl> <nl> CV_EXPORTS_W void pyrMeanShiftFiltering ( InputArray src , OutputArray dst , <nl> / / ! @ addtogroup imgproc_misc <nl> / / ! @ { <nl> <nl> - / * * @ example grabcut . cpp <nl> + / * * @ example samples / cpp / grabcut . cpp <nl> An example using the GrabCut algorithm <nl> ! [ Sample Screenshot ] ( grabcut_output1 . jpg ) <nl> - * / <nl> + * / <nl> <nl> / * * @ brief Runs the GrabCut algorithm . <nl> <nl> CV_EXPORTS_W void grabCut ( InputArray img , InputOutputArray mask , Rect rect , <nl> InputOutputArray bgdModel , InputOutputArray fgdModel , <nl> int iterCount , int mode = GC_EVAL ) ; <nl> <nl> - / * * @ example distrans . cpp <nl> - An example on using the distance transform \ <nl> + / * * @ example samples / cpp / distrans . cpp <nl> + An example on using the distance transform <nl> * / <nl> <nl> - <nl> / * * @ brief Calculates the distance to the closest zero pixel for each pixel of the source image . <nl> <nl> The function cv : : distanceTransform calculates the approximate or precise distance from every binary <nl> the first variant of the function and distanceType = = # DIST_L1 . <nl> CV_EXPORTS_W void distanceTransform ( InputArray src , OutputArray dst , <nl> int distanceType , int maskSize , int dstType = CV_32F ) ; <nl> <nl> - / * * @ example ffilldemo . cpp <nl> - An example using the FloodFill technique <nl> + / * * @ example samples / cpp / ffilldemo . cpp <nl> + An example using the FloodFill technique <nl> * / <nl> <nl> / * * @ overload <nl> enum TemplateMatchModes { <nl> TM_CCOEFF_NORMED = 5 / / ! < \ f [ R ( x , y ) = \ frac { \ sum_ { x ' , y ' } ( T ' ( x ' , y ' ) \ cdot I ' ( x + x ' , y + y ' ) ) } { \ sqrt { \ sum_ { x ' , y ' } T ' ( x ' , y ' ) ^ 2 \ cdot \ sum_ { x ' , y ' } I ' ( x + x ' , y + y ' ) ^ 2 } } \ f ] <nl> } ; <nl> <nl> - / * * @ example MatchTemplate_Demo . cpp <nl> + / * * @ example samples / cpp / tutorial_code / Histograms_Matching / MatchTemplate_Demo . cpp <nl> An example using Template Matching algorithm <nl> - * / <nl> + * / <nl> + <nl> / * * @ brief Compares a template against overlapped image regions . <nl> <nl> The function slides through image , compares the overlapped patches of size \ f $ w \ times h \ f $ against <nl> CV_EXPORTS_W void matchTemplate ( InputArray image , InputArray templ , <nl> / / ! @ addtogroup imgproc_shape <nl> / / ! @ { <nl> <nl> + / * * @ example samples / cpp / connected_components . cpp <nl> + This program demonstrates connected components and use of the trackbar <nl> + * / <nl> + <nl> / * * @ brief computes the connected components labeled image of boolean image <nl> <nl> image with 4 or 8 way connectivity - returns N , the total number of labels [ 0 , N - 1 ] where 0 <nl> CV_EXPORTS_W void findContours ( InputOutputArray image , OutputArrayOfArrays cont <nl> CV_EXPORTS void findContours ( InputOutputArray image , OutputArrayOfArrays contours , <nl> int mode , int method , Point offset = Point ( ) ) ; <nl> <nl> + / * * @ example samples / cpp / squares . cpp <nl> + A program using pyramid scaling , Canny , contours and contour simplification to find <nl> + squares in a list of images ( pic1 - 6 . png ) . Returns sequence of squares detected on the image . <nl> + * / <nl> + <nl> + / * * @ example samples / tapi / squares . cpp <nl> + A program using pyramid scaling , Canny , contours and contour simplification to find <nl> + squares in the input image . <nl> + * / <nl> + <nl> / * * @ brief Approximates a polygonal curve ( s ) with the specified precision . <nl> <nl> The function cv : : approxPolyDP approximates a curve or a polygon with another curve / polygon with less <nl> The function finds the minimal enclosing circle of a 2D point set using an itera <nl> CV_EXPORTS_W void minEnclosingCircle ( InputArray points , <nl> CV_OUT Point2f & center , CV_OUT float & radius ) ; <nl> <nl> - / * * @ example minarea . cpp <nl> - * / <nl> + / * * @ example samples / cpp / minarea . cpp <nl> + * / <nl> <nl> / * * @ brief Finds a triangle of minimum area enclosing a 2D point set and returns its area . <nl> <nl> The function compares two shapes . All three implemented methods use the Hu invar <nl> CV_EXPORTS_W double matchShapes ( InputArray contour1 , InputArray contour2 , <nl> int method , double parameter ) ; <nl> <nl> - / * * @ example convexhull . cpp <nl> + / * * @ example samples / cpp / convexhull . cpp <nl> An example using the convexHull functionality <nl> * / <nl> <nl> CV_EXPORTS_W bool isContourConvex ( InputArray contour ) ; <nl> CV_EXPORTS_W float intersectConvexConvex ( InputArray _p1 , InputArray _p2 , <nl> OutputArray _p12 , bool handleNested = true ) ; <nl> <nl> - / * * @ example fitellipse . cpp <nl> - An example using the fitEllipse technique <nl> + / * * @ example samples / cpp / fitellipse . cpp <nl> + An example using the fitEllipse technique <nl> * / <nl> <nl> / * * @ brief Fits an ellipse around a set of 2D points . <nl> enum ColormapTypes <nl> COLORMAP_PARULA = 12 / / ! < ! [ parula ] ( pics / colormaps / colorscale_parula . jpg ) <nl> } ; <nl> <nl> - / * * @ example falsecolor . cpp <nl> + / * * @ example samples / cpp / falsecolor . cpp <nl> An example using applyColorMap function <nl> * / <nl> + <nl> / * * @ brief Applies a GNU Octave / MATLAB equivalent colormap on a given image . <nl> <nl> @ param src The source image , grayscale or colored of type CV_8UC1 or CV_8UC3 . <nl> CV_EXPORTS void rectangle ( CV_IN_OUT Mat & img , Rect rec , <nl> const Scalar & color , int thickness = 1 , <nl> int lineType = LINE_8 , int shift = 0 ) ; <nl> <nl> - / * * @ example Drawing_2 . cpp <nl> + / * * @ example samples / cpp / tutorial_code / ImgProc / basic_drawing / Drawing_2 . cpp <nl> An example using drawing functions <nl> - * / <nl> + * / <nl> + <nl> / * * @ brief Draws a circle . <nl> <nl> The function cv : : circle draws a simple or filled circle with a given center and radius . <nl> CV_EXPORTS void fillPoly ( Mat & img , const Point * * pts , <nl> const Scalar & color , int lineType = LINE_8 , int shift = 0 , <nl> Point offset = Point ( ) ) ; <nl> <nl> - / * * @ example Drawing_1 . cpp <nl> + / * * @ example samples / cpp / tutorial_code / ImgProc / basic_drawing / Drawing_1 . cpp <nl> An example using drawing functions <nl> - * / <nl> + Check @ ref tutorial_random_generator_and_text " the corresponding tutorial " for more details <nl> + * / <nl> + <nl> / * * @ brief Fills the area bounded by one or more polygons . <nl> <nl> The function cv : : fillPoly fills an area bounded by several polygonal contours . The function can fill <nl> CV_EXPORTS_W void polylines ( InputOutputArray img , InputArrayOfArrays pts , <nl> bool isClosed , const Scalar & color , <nl> int thickness = 1 , int lineType = LINE_8 , int shift = 0 ) ; <nl> <nl> - / * * @ example contours2 . cpp <nl> - An example program illustrates the use of cv : : findContours and cv : : drawContours <nl> - \ image html WindowsQtContoursOutput . png " Screenshot of the program " <nl> + / * * @ example samples / cpp / contours2 . cpp <nl> + An example program illustrates the use of cv : : findContours and cv : : drawContours <nl> + \ image html WindowsQtContoursOutput . png " Screenshot of the program " <nl> * / <nl> <nl> - / * * @ example segment_objects . cpp <nl> + / * * @ example samples / cpp / segment_objects . cpp <nl> An example using drawContours to clean up a background segmentation result <nl> - * / <nl> + * / <nl> <nl> / * * @ brief Draws contours outlines or filled contours . <nl> <nl> mmm a / modules / objdetect / include / opencv2 / objdetect . hpp <nl> ppp b / modules / objdetect / include / opencv2 / objdetect . hpp <nl> class CV_EXPORTS_W BaseCascadeClassifier : public Algorithm <nl> virtual Ptr < MaskGenerator > getMaskGenerator ( ) = 0 ; <nl> } ; <nl> <nl> - / * * @ example facedetect . cpp <nl> + / * * @ example samples / cpp / facedetect . cpp <nl> This program demonstrates usage of the Cascade classifier class <nl> \ image html Cascade_Classifier_Tutorial_Result_Haar . jpg " Sample screenshot " width = 321 height = 254 <nl> * / <nl> struct CV_EXPORTS_W HOGDescriptor <nl> * / <nl> CV_WRAP double getWinSigma ( ) const ; <nl> <nl> - / * * @ example peopledetect . cpp <nl> + / * * @ example samples / cpp / peopledetect . cpp <nl> * / <nl> / * * @ brief Sets coefficients for the linear SVM classifier . <nl> @ param _svmdetector coefficients for the linear SVM classifier . <nl> struct CV_EXPORTS_W HOGDescriptor <nl> * / <nl> virtual void copyTo ( HOGDescriptor & c ) const ; <nl> <nl> - / * * @ example train_HOG . cpp <nl> + / * * @ example samples / cpp / train_HOG . cpp <nl> * / <nl> / * * @ brief Computes HOG descriptors of given image . <nl> @ param img Matrix of the type CV_8U containing an image where HOG features will be calculated . <nl> struct CV_EXPORTS_W HOGDescriptor <nl> * / <nl> CV_WRAP static std : : vector < float > getDefaultPeopleDetector ( ) ; <nl> <nl> - / * * @ example hog . cpp <nl> + / * * @ example samples / tapi / hog . cpp <nl> * / <nl> / * * @ brief Returns coefficients of the classifier trained for people detection ( for 48x96 windows ) . <nl> * / <nl> mmm a / modules / photo / include / opencv2 / photo . hpp <nl> ppp b / modules / photo / include / opencv2 / photo . hpp <nl> CV_EXPORTS_W void decolor ( InputArray src , OutputArray grayscale , OutputArray co <nl> / / ! @ addtogroup photo_clone <nl> / / ! @ { <nl> <nl> - / * * @ example cloning_demo . cpp <nl> + / * * @ example samples / cpp / tutorial_code / photo / seamless_cloning / cloning_demo . cpp <nl> An example using seamlessClone function <nl> * / <nl> / * * @ brief Image editing tasks concern either global changes ( color / intensity corrections , filters , <nl> CV_EXPORTS_W void edgePreservingFilter ( InputArray src , OutputArray dst , int flag <nl> CV_EXPORTS_W void detailEnhance ( InputArray src , OutputArray dst , float sigma_s = 10 , <nl> float sigma_r = 0 . 15f ) ; <nl> <nl> - / * * @ example npr_demo . cpp <nl> + / * * @ example samples / cpp / tutorial_code / photo / non_photorealistic_rendering / npr_demo . cpp <nl> An example using non - photorealistic line drawing functions <nl> * / <nl> / * * @ brief Pencil - like non - photorealistic line drawing <nl> mmm a / modules / shape / include / opencv2 / shape / shape_distance . hpp <nl> ppp b / modules / shape / include / opencv2 / shape / shape_distance . hpp <nl> namespace cv <nl> / / ! @ addtogroup shape <nl> / / ! @ { <nl> <nl> - / * * @ example shape_example . cpp <nl> + / * * @ example samples / cpp / shape_example . cpp <nl> An example using shape distance algorithm <nl> * / <nl> / * * @ brief Abstract base class for shape distance algorithms . <nl> mmm a / modules / stitching / include / opencv2 / stitching . hpp <nl> ppp b / modules / stitching / include / opencv2 / stitching . hpp <nl> namespace cv { <nl> / / ! @ addtogroup stitching <nl> / / ! @ { <nl> <nl> + / * * @ example samples / cpp / stitching . cpp <nl> + A basic example on image stitching <nl> + * / <nl> + <nl> + / * * @ example samples / cpp / stitching_detailed . cpp <nl> + A detailed example on image stitching <nl> + * / <nl> + <nl> / * * @ brief High level image stitcher . <nl> <nl> It ' s possible to use this class without being aware of the entire stitching pipeline . However , to <nl> mmm a / modules / video / include / opencv2 / video / tracking . hpp <nl> ppp b / modules / video / include / opencv2 / video / tracking . hpp <nl> See the OpenCV sample camshiftdemo . c that tracks colored objects . <nl> * / <nl> CV_EXPORTS_W RotatedRect CamShift ( InputArray probImage , CV_IN_OUT Rect & window , <nl> TermCriteria criteria ) ; <nl> - / * * @ example camshiftdemo . cpp <nl> + / * * @ example samples / cpp / camshiftdemo . cpp <nl> An example using the mean - shift tracking algorithm <nl> * / <nl> + <nl> / * * @ brief Finds an object on a back projection image . <nl> <nl> @ param probImage Back projection of the object histogram . See calcBackProject for details . <nl> CV_EXPORTS_W int buildOpticalFlowPyramid ( InputArray img , OutputArrayOfArrays py <nl> int derivBorder = BORDER_CONSTANT , <nl> bool tryReuseInputImage = true ) ; <nl> <nl> - / * * @ example lkdemo . cpp <nl> + / * * @ example samples / cpp / lkdemo . cpp <nl> An example using the Lucas - Kanade optical flow algorithm <nl> - * / <nl> + * / <nl> + <nl> / * * @ brief Calculates an optical flow for a sparse feature set using the iterative Lucas - Kanade method with <nl> pyramids . <nl> <nl> enum <nl> MOTION_HOMOGRAPHY = 3 <nl> } ; <nl> <nl> - / * * @ example image_alignment . cpp <nl> + / * * @ example samples / cpp / image_alignment . cpp <nl> An example using the image alignment ECC algorithm <nl> - * / <nl> + * / <nl> <nl> / * * @ brief Finds the geometric transform ( warp ) between two images in terms of the ECC criterion @ cite EP08 . <nl> <nl> CV_EXPORTS_W double findTransformECC ( InputArray templateImage , InputArray input <nl> TermCriteria criteria = TermCriteria ( TermCriteria : : COUNT + TermCriteria : : EPS , 50 , 0 . 001 ) , <nl> InputArray inputMask = noArray ( ) ) ; <nl> <nl> - / * * @ example kalman . cpp <nl> + / * * @ example samples / cpp / kalman . cpp <nl> An example using the standard Kalman filter <nl> * / <nl> + <nl> / * * @ brief Kalman filter class . <nl> <nl> The class implements a standard Kalman filter < http : / / en . wikipedia . org / wiki / Kalman_filter > , <nl> mmm a / modules / videoio / include / opencv2 / videoio . hpp <nl> ppp b / modules / videoio / include / opencv2 / videoio . hpp <nl> class CV_EXPORTS_W VideoCapture <nl> <nl> class IVideoWriter ; <nl> <nl> - / * * @ example videowriter_basic . cpp <nl> + / * * @ example samples / cpp / tutorial_code / videoio / video - write / video - write . cpp <nl> + Check @ ref tutorial_video_write " the corresponding tutorial " for more details <nl> + * / <nl> + <nl> + / * * @ example samples / cpp / videowriter_basic . cpp <nl> An example using VideoCapture and VideoWriter class <nl> - * / <nl> + * / <nl> + <nl> / * * @ brief Video writer class . <nl> <nl> The class provides C + + API for writing video files or image sequences . <nl> - * / <nl> + * / <nl> class CV_EXPORTS_W VideoWriter <nl> { <nl> public : <nl> mmm a / samples / cpp / connected_components . cpp <nl> ppp b / samples / cpp / connected_components . cpp <nl> <nl> + <nl> # include < opencv2 / core / utility . hpp > <nl> # include " opencv2 / imgproc . hpp " <nl> # include " opencv2 / imgcodecs . hpp " <nl> static void on_trackbar ( int , void * ) <nl> imshow ( " Connected Components " , dst ) ; <nl> } <nl> <nl> - static void help ( ) <nl> - { <nl> - cout < < " \ n This program demonstrates connected components and use of the trackbar \ n " <nl> - " Usage : \ n " <nl> - " . / connected_components < image ( . . / data / stuff . jpg as default ) > \ n " <nl> - " The image is converted to grayscale and displayed , another image has a trackbar \ n " <nl> - " that controls thresholding and thereby the extracted contours which are drawn in color \ n " ; <nl> - } <nl> - <nl> - const char * keys = <nl> - { <nl> - " { help h | | } { @ image | . . / data / stuff . jpg | image for converting to a grayscale } " <nl> - } ; <nl> - <nl> int main ( int argc , const char * * argv ) <nl> { <nl> - CommandLineParser parser ( argc , argv , keys ) ; <nl> - if ( parser . has ( " help " ) ) <nl> - { <nl> - help ( ) ; <nl> - return 0 ; <nl> - } <nl> - string inputImage = parser . get < string > ( 0 ) ; <nl> - img = imread ( inputImage . c_str ( ) , 0 ) ; <nl> + CommandLineParser parser ( argc , argv , " { @ image | . . / data / stuff . jpg | image for converting to a grayscale } " ) ; <nl> + parser . about ( " \ nThis program demonstrates connected components and use of the trackbar \ n " ) ; <nl> + parser . printMessage ( ) ; <nl> + cout < < " \ nThe image is converted to grayscale and displayed , another image has a trackbar \ n " <nl> + " that controls thresholding and thereby the extracted contours which are drawn in color \ n " ; <nl> + <nl> + String inputImage = parser . get < string > ( 0 ) ; <nl> + img = imread ( inputImage , IMREAD_GRAYSCALE ) ; <nl> <nl> if ( img . empty ( ) ) <nl> { <nl> cout < < " Could not read input image file : " < < inputImage < < endl ; <nl> - return - 1 ; <nl> + return EXIT_FAILURE ; <nl> } <nl> <nl> - namedWindow ( " Image " , 1 ) ; <nl> imshow ( " Image " , img ) ; <nl> <nl> - namedWindow ( " Connected Components " , 1 ) ; <nl> + namedWindow ( " Connected Components " , WINDOW_AUTOSIZE ) ; <nl> createTrackbar ( " Threshold " , " Connected Components " , & threshval , 255 , on_trackbar ) ; <nl> on_trackbar ( threshval , 0 ) ; <nl> <nl> waitKey ( 0 ) ; <nl> - return 0 ; <nl> + return EXIT_SUCCESS ; <nl> } <nl> mmm a / samples / cpp / squares . cpp <nl> ppp b / samples / cpp / squares . cpp <nl> <nl> + <nl> / / The " Square Detector " program . <nl> / / It loads several images sequentially and tries to find squares in <nl> / / each image <nl> <nl> # include " opencv2 / highgui . hpp " <nl> <nl> # include < iostream > <nl> - # include < math . h > <nl> - # include < string . h > <nl> <nl> using namespace cv ; <nl> using namespace std ; <nl> <nl> - static void help ( ) <nl> + static void help ( const char * programName ) <nl> { <nl> cout < < <nl> - " \ nA program using pyramid scaling , Canny , contours , contour simpification and \ n " <nl> - " memory storage ( it ' s got it all folks ) to find \ n " <nl> - " squares in a list of images pic1 - 6 . png \ n " <nl> + " \ nA program using pyramid scaling , Canny , contours and contour simplification \ n " <nl> + " to find squares in a list of images ( pic1 - 6 . png ) \ n " <nl> " Returns sequence of squares detected on the image . \ n " <nl> - " the sequence is stored in the specified memory storage \ n " <nl> " Call : \ n " <nl> - " . / squares [ file_name ( optional ) ] \ n " <nl> + " . / " < < programName < < " [ file_name ( optional ) ] \ n " <nl> " Using OpenCV version " < < CV_VERSION < < " \ n " < < endl ; <nl> } <nl> <nl> static double angle ( Point pt1 , Point pt2 , Point pt0 ) <nl> } <nl> <nl> / / returns sequence of squares detected on the image . <nl> - / / the sequence is stored in the specified memory storage <nl> static void findSquares ( const Mat & image , vector < vector < Point > > & squares ) <nl> { <nl> squares . clear ( ) ; <nl> static void findSquares ( const Mat & image , vector < vector < Point > > & squares ) <nl> { <nl> / / approximate contour with accuracy proportional <nl> / / to the contour perimeter <nl> - approxPolyDP ( Mat ( contours [ i ] ) , approx , arcLength ( Mat ( contours [ i ] ) , true ) * 0 . 02 , true ) ; <nl> + approxPolyDP ( contours [ i ] , approx , arcLength ( contours [ i ] , true ) * 0 . 02 , true ) ; <nl> <nl> / / square contours should have 4 vertices after approximation <nl> / / relatively large area ( to filter out noisy contours ) <nl> static void findSquares ( const Mat & image , vector < vector < Point > > & squares ) <nl> / / area may be positive or negative - in accordance with the <nl> / / contour orientation <nl> if ( approx . size ( ) = = 4 & & <nl> - fabs ( contourArea ( Mat ( approx ) ) ) > 1000 & & <nl> - isContourConvex ( Mat ( approx ) ) ) <nl> + fabs ( contourArea ( approx ) ) > 1000 & & <nl> + isContourConvex ( approx ) ) <nl> { <nl> double maxCosine = 0 ; <nl> <nl> int main ( int argc , char * * argv ) <nl> { <nl> static const char * names [ ] = { " . . / data / pic1 . png " , " . . / data / pic2 . png " , " . . / data / pic3 . png " , <nl> " . . / data / pic4 . png " , " . . / data / pic5 . png " , " . . / data / pic6 . png " , 0 } ; <nl> - help ( ) ; <nl> + help ( argv [ 0 ] ) ; <nl> <nl> if ( argc > 1 ) <nl> { <nl> int main ( int argc , char * * argv ) <nl> names [ 1 ] = " 0 " ; <nl> } <nl> <nl> - namedWindow ( wndname , 1 ) ; <nl> vector < vector < Point > > squares ; <nl> <nl> for ( int i = 0 ; names [ i ] ! = 0 ; i + + ) <nl> { <nl> - Mat image = imread ( names [ i ] , 1 ) ; <nl> + Mat image = imread ( names [ i ] , IMREAD_COLOR ) ; <nl> if ( image . empty ( ) ) <nl> { <nl> cout < < " Couldn ' t load " < < names [ i ] < < endl ; <nl> int main ( int argc , char * * argv ) <nl> findSquares ( image , squares ) ; <nl> drawSquares ( image , squares ) ; <nl> <nl> - char c = ( char ) waitKey ( ) ; <nl> + int c = waitKey ( ) ; <nl> if ( c = = 27 ) <nl> break ; <nl> } <nl> mmm a / samples / cpp / stitching . cpp <nl> ppp b / samples / cpp / stitching . cpp <nl> int parseCmdArgs ( int argc , char * * argv ) ; <nl> int main ( int argc , char * argv [ ] ) <nl> { <nl> int retval = parseCmdArgs ( argc , argv ) ; <nl> - if ( retval ) return - 1 ; <nl> + if ( retval ) return EXIT_FAILURE ; <nl> <nl> + / / ! [ stitching ] <nl> Mat pano ; <nl> Ptr < Stitcher > stitcher = Stitcher : : create ( mode , try_use_gpu ) ; <nl> Stitcher : : Status status = stitcher - > stitch ( imgs , pano ) ; <nl> int main ( int argc , char * argv [ ] ) <nl> if ( status ! = Stitcher : : OK ) <nl> { <nl> cout < < " Can ' t stitch images , error code = " < < int ( status ) < < endl ; <nl> - return - 1 ; <nl> + return EXIT_FAILURE ; <nl> } <nl> + / / ! [ stitching ] <nl> <nl> imwrite ( result_name , pano ) ; <nl> cout < < " stitching completed successfully \ n " < < result_name < < " saved ! " ; <nl> - return 0 ; <nl> + return EXIT_SUCCESS ; <nl> } <nl> <nl> <nl> int parseCmdArgs ( int argc , char * * argv ) <nl> if ( argc = = 1 ) <nl> { <nl> printUsage ( argv ) ; <nl> - return - 1 ; <nl> + return EXIT_FAILURE ; <nl> } <nl> <nl> for ( int i = 1 ; i < argc ; + + i ) <nl> int parseCmdArgs ( int argc , char * * argv ) <nl> if ( string ( argv [ i ] ) = = " - - help " | | string ( argv [ i ] ) = = " / ? " ) <nl> { <nl> printUsage ( argv ) ; <nl> - return - 1 ; <nl> + return EXIT_FAILURE ; <nl> } <nl> else if ( string ( argv [ i ] ) = = " - - try_use_gpu " ) <nl> { <nl> int parseCmdArgs ( int argc , char * * argv ) <nl> else <nl> { <nl> cout < < " Bad - - try_use_gpu flag value \ n " ; <nl> - return - 1 ; <nl> + return EXIT_FAILURE ; <nl> } <nl> i + + ; <nl> } <nl> int parseCmdArgs ( int argc , char * * argv ) <nl> else <nl> { <nl> cout < < " Bad - - mode flag value \ n " ; <nl> - return - 1 ; <nl> + return EXIT_FAILURE ; <nl> } <nl> i + + ; <nl> } <nl> int parseCmdArgs ( int argc , char * * argv ) <nl> if ( img . empty ( ) ) <nl> { <nl> cout < < " Can ' t read image ' " < < argv [ i ] < < " ' \ n " ; <nl> - return - 1 ; <nl> + return EXIT_FAILURE ; <nl> } <nl> <nl> if ( divide_images ) <nl> int parseCmdArgs ( int argc , char * * argv ) <nl> imgs . push_back ( img ) ; <nl> } <nl> } <nl> - return 0 ; <nl> + return EXIT_SUCCESS ; <nl> } <nl> mmm a / samples / cpp / stitching_detailed . cpp <nl> ppp b / samples / cpp / stitching_detailed . cpp <nl> <nl> - / * M / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / <nl> - / / IMPORTANT : READ BEFORE DOWNLOADING , COPYING , INSTALLING OR USING . <nl> - / / <nl> - / / By downloading , copying , installing or using the software you agree to this license . <nl> - / / If you do not agree to this license , do not download , install , <nl> - / / copy or use the software . <nl> - / / <nl> - / / <nl> - / / License Agreement <nl> - / / For Open Source Computer Vision Library <nl> - / / <nl> - / / Copyright ( C ) 2000 - 2008 , Intel Corporation , all rights reserved . <nl> - / / Copyright ( C ) 2009 , Willow Garage Inc . , all rights reserved . <nl> - / / Third party copyrights are property of their respective owners . <nl> - / / <nl> - / / Redistribution and use in source and binary forms , with or without modification , <nl> - / / are permitted provided that the following conditions are met : <nl> - / / <nl> - / / * Redistribution ' s of source code must retain the above copyright notice , <nl> - / / this list of conditions and the following disclaimer . <nl> - / / <nl> - / / * Redistribution ' s in binary form must reproduce the above copyright notice , <nl> - / / this list of conditions and the following disclaimer in the documentation <nl> - / / and / or other materials provided with the distribution . <nl> - / / <nl> - / / * The name of the copyright holders may not be used to endorse or promote products <nl> - / / derived from this software without specific prior written permission . <nl> - / / <nl> - / / This software is provided by the copyright holders and contributors " as is " and <nl> - / / any express or implied warranties , including , but not limited to , the implied <nl> - / / warranties of merchantability and fitness for a particular purpose are disclaimed . <nl> - / / In no event shall the Intel Corporation or contributors be liable for any direct , <nl> - / / indirect , incidental , special , exemplary , or consequential damages <nl> - / / ( including , but not limited to , procurement of substitute goods or services ; <nl> - / / loss of use , data , or profits ; or business interruption ) however caused <nl> - / / and on any theory of liability , whether in contract , strict liability , <nl> - / / or tort ( including negligence or otherwise ) arising in any way out of <nl> - / / the use of this software , even if advised of the possibility of such damage . <nl> - / / <nl> - / / <nl> - / / M * / <nl> <nl> # include < iostream > <nl> # include < fstream > <nl> mmm a / samples / cpp / tutorial_code / ImgProc / Morphology_2 . cpp <nl> ppp b / samples / cpp / tutorial_code / ImgProc / Morphology_2 . cpp <nl> void Morphology_Operations ( int , void * ) ; <nl> int main ( int argc , char * * argv ) <nl> { <nl> / / ! [ load ] <nl> - CommandLineParser parser ( argc , argv , " { @ input | . . / data / LinuxLogo . jpg | input image } " ) ; <nl> + CommandLineParser parser ( argc , argv , " { @ input | . . / data / baboon . jpg | input image } " ) ; <nl> src = imread ( parser . get < String > ( " @ input " ) , IMREAD_COLOR ) ; <nl> if ( src . empty ( ) ) <nl> { <nl> similarity index 100 % <nl> rename from samples / cpp / tutorial_code / core / Matrix / Drawing_1 . cpp <nl> rename to samples / cpp / tutorial_code / ImgProc / basic_drawing / Drawing_1 . cpp <nl> similarity index 100 % <nl> rename from samples / cpp / tutorial_code / core / Matrix / Drawing_2 . cpp <nl> rename to samples / cpp / tutorial_code / ImgProc / basic_drawing / Drawing_2 . cpp <nl> similarity index 100 % <nl> rename from samples / java / tutorial_code / core / BasicGeometricDrawing / BasicGeometricDrawing . java <nl> rename to samples / java / tutorial_code / ImgProc / BasicGeometricDrawing / BasicGeometricDrawing . java <nl> similarity index 100 % <nl> rename from samples / python / tutorial_code / core / BasicGeometricDrawing / basic_geometric_drawing . py <nl> rename to samples / python / tutorial_code / imgProc / BasicGeometricDrawing / basic_geometric_drawing . py <nl> mmm a / samples / tapi / squares . cpp <nl> ppp b / samples / tapi / squares . cpp <nl> <nl> - / / The " Square Detector " program . <nl> - / / It loads several images sequentially and tries to find squares in <nl> - / / each image <nl> <nl> # include " opencv2 / core . hpp " <nl> # include " opencv2 / core / ocl . hpp " <nl> <nl> # include " opencv2 / imgcodecs . hpp " <nl> # include " opencv2 / highgui . hpp " <nl> # include < iostream > <nl> - # include < string . h > <nl> <nl> using namespace cv ; <nl> using namespace std ; <nl> static double angle ( Point pt1 , Point pt2 , Point pt0 ) <nl> <nl> <nl> / / returns sequence of squares detected on the image . <nl> - / / the sequence is stored in the specified memory storage <nl> static void findSquares ( const UMat & image , vector < vector < Point > > & squares ) <nl> { <nl> squares . clear ( ) ; <nl> static void findSquares ( const UMat & image , vector < vector < Point > > & squares ) <nl> { <nl> / / apply threshold if l ! = 0 : <nl> / / tgray ( x , y ) = gray ( x , y ) < ( l + 1 ) * 255 / N ? 255 : 0 <nl> - cv : : threshold ( gray0 , gray , ( l + 1 ) * 255 / N , 255 , THRESH_BINARY ) ; <nl> + threshold ( gray0 , gray , ( l + 1 ) * 255 / N , 255 , THRESH_BINARY ) ; <nl> } <nl> <nl> / / find contours and store them all as a list <nl> static void findSquares ( const UMat & image , vector < vector < Point > > & squares ) <nl> / / approximate contour with accuracy proportional <nl> / / to the contour perimeter <nl> <nl> - approxPolyDP ( Mat ( contours [ i ] ) , approx , arcLength ( Mat ( contours [ i ] ) , true ) * 0 . 02 , true ) ; <nl> + approxPolyDP ( contours [ i ] , approx , arcLength ( contours [ i ] , true ) * 0 . 02 , true ) ; <nl> <nl> / / square contours should have 4 vertices after approximation <nl> / / relatively large area ( to filter out noisy contours ) <nl> static void findSquares ( const UMat & image , vector < vector < Point > > & squares ) <nl> / / area may be positive or negative - in accordance with the <nl> / / contour orientation <nl> if ( approx . size ( ) = = 4 & & <nl> - fabs ( contourArea ( Mat ( approx ) ) ) > 1000 & & <nl> - isContourConvex ( Mat ( approx ) ) ) <nl> + fabs ( contourArea ( approx ) ) > 1000 & & <nl> + isContourConvex ( approx ) ) <nl> { <nl> double maxCosine = 0 ; <nl> <nl> int main ( int argc , char * * argv ) <nl> <nl> if ( cmd . has ( " help " ) ) <nl> { <nl> - cout < < " Usage : squares [ options ] " < < endl ; <nl> + cout < < " Usage : " < < argv [ 0 ] < < " [ options ] " < < endl ; <nl> cout < < " Available options : " < < endl ; <nl> cmd . printMessage ( ) ; <nl> return EXIT_SUCCESS ; <nl> int main ( int argc , char * * argv ) <nl> if ( cmd . has ( " cpu_mode " ) ) <nl> { <nl> ocl : : setUseOpenCL ( false ) ; <nl> - std : : cout < < " OpenCL was disabled " < < std : : endl ; <nl> + cout < < " OpenCL was disabled " < < endl ; <nl> } <nl> <nl> string inputName = cmd . get < string > ( " i " ) ; <nl> int main ( int argc , char * * argv ) <nl> <nl> do <nl> { <nl> - int64 t_start = cv : : getTickCount ( ) ; <nl> + int64 t_start = getTickCount ( ) ; <nl> findSquares ( image , squares ) ; <nl> t_cpp + = cv : : getTickCount ( ) - t_start ; <nl> <nl> - t_start = cv : : getTickCount ( ) ; <nl> + t_start = getTickCount ( ) ; <nl> <nl> cout < < " run loop : " < < j < < endl ; <nl> } <nl>
Merge pull request from sturkmen72 : update_documentation
opencv/opencv
31fef14d76884b82007d0d1efc14d6948bad16f1
2018-08-17T14:02:20Z
mmm a / src / debug . cc <nl> ppp b / src / debug . cc <nl> void Debug : : FloodBoundFunctionWithOneShot ( Handle < JSFunction > function ) { <nl> if ( ! bindee . is_null ( ) & & bindee - > IsJSFunction ( ) & & <nl> ! JSFunction : : cast ( * bindee ) - > IsFromNativeScript ( ) ) { <nl> Handle < JSFunction > bindee_function ( JSFunction : : cast ( * bindee ) ) ; <nl> - FloodWithOneShot ( bindee_function ) ; <nl> + FloodWithOneShotGeneric ( bindee_function ) ; <nl> + } <nl> + } <nl> + <nl> + <nl> + void Debug : : FloodDefaultConstructorWithOneShot ( Handle < JSFunction > function ) { <nl> + DCHECK ( function - > shared ( ) - > is_default_constructor ( ) ) ; <nl> + / / Instead of stepping into the function we directly step into the super class <nl> + / / constructor . <nl> + Isolate * isolate = function - > GetIsolate ( ) ; <nl> + PrototypeIterator iter ( isolate , function ) ; <nl> + Handle < Object > proto = PrototypeIterator : : GetCurrent ( iter ) ; <nl> + if ( ! proto - > IsJSFunction ( ) ) return ; / / Object . prototype <nl> + Handle < JSFunction > function_proto = Handle < JSFunction > : : cast ( proto ) ; <nl> + FloodWithOneShotGeneric ( function_proto ) ; <nl> + } <nl> + <nl> + <nl> + void Debug : : FloodWithOneShotGeneric ( Handle < JSFunction > function , <nl> + Handle < Object > holder ) { <nl> + if ( function - > shared ( ) - > bound ( ) ) { <nl> + FloodBoundFunctionWithOneShot ( function ) ; <nl> + } else if ( function - > shared ( ) - > is_default_constructor ( ) ) { <nl> + FloodDefaultConstructorWithOneShot ( function ) ; <nl> + } else if ( ! function - > IsFromNativeScript ( ) ) { <nl> + Isolate * isolate = function - > GetIsolate ( ) ; <nl> + / / Don ' t allow step into functions in the native context . <nl> + if ( function - > shared ( ) - > code ( ) = = <nl> + isolate - > builtins ( ) - > builtin ( Builtins : : kFunctionApply ) | | <nl> + function - > shared ( ) - > code ( ) = = <nl> + isolate - > builtins ( ) - > builtin ( Builtins : : kFunctionCall ) ) { <nl> + / / Handle function . apply and function . call separately to flood the <nl> + / / function to be called and not the code for Builtins : : FunctionApply or <nl> + / / Builtins : : FunctionCall . The receiver of call / apply is the target <nl> + / / function . <nl> + if ( ! holder . is_null ( ) & & holder - > IsJSFunction ( ) ) { <nl> + Handle < JSFunction > js_function = Handle < JSFunction > : : cast ( holder ) ; <nl> + FloodWithOneShotGeneric ( js_function ) ; <nl> + } <nl> + } else { <nl> + FloodWithOneShot ( function ) ; <nl> + } <nl> } <nl> } <nl> <nl> void Debug : : PrepareStep ( StepAction step_action , <nl> <nl> if ( fun - > IsJSFunction ( ) ) { <nl> Handle < JSFunction > js_function ( JSFunction : : cast ( fun ) ) ; <nl> - if ( js_function - > shared ( ) - > bound ( ) ) { <nl> - FloodBoundFunctionWithOneShot ( js_function ) ; <nl> - } else if ( ! js_function - > IsFromNativeScript ( ) ) { <nl> - / / Don ' t step into builtins . <nl> - / / It will also compile target function if it ' s not compiled yet . <nl> - FloodWithOneShot ( js_function ) ; <nl> - } <nl> + FloodWithOneShotGeneric ( js_function ) ; <nl> } <nl> } <nl> <nl> void Debug : : HandleStepIn ( Handle < Object > function_obj , Handle < Object > holder , <nl> / / Flood the function with one - shot break points if it is called from where <nl> / / step into was requested , or when stepping into a new frame . <nl> if ( fp = = thread_local_ . step_into_fp_ | | step_frame ) { <nl> - if ( function - > shared ( ) - > bound ( ) ) { <nl> - / / Handle Function . prototype . bind <nl> - FloodBoundFunctionWithOneShot ( function ) ; <nl> - } else if ( ! function - > IsFromNativeScript ( ) ) { <nl> - / / Don ' t allow step into functions in the native context . <nl> - if ( function - > shared ( ) - > code ( ) = = <nl> - isolate - > builtins ( ) - > builtin ( Builtins : : kFunctionApply ) | | <nl> - function - > shared ( ) - > code ( ) = = <nl> - isolate - > builtins ( ) - > builtin ( Builtins : : kFunctionCall ) ) { <nl> - / / Handle function . apply and function . call separately to flood the <nl> - / / function to be called and not the code for Builtins : : FunctionApply or <nl> - / / Builtins : : FunctionCall . The receiver of call / apply is the target <nl> - / / function . <nl> - if ( ! holder . is_null ( ) & & holder - > IsJSFunction ( ) ) { <nl> - Handle < JSFunction > js_function = Handle < JSFunction > : : cast ( holder ) ; <nl> - if ( ! js_function - > IsFromNativeScript ( ) ) { <nl> - FloodWithOneShot ( js_function ) ; <nl> - } else if ( js_function - > shared ( ) - > bound ( ) ) { <nl> - / / Handle Function . prototype . bind <nl> - FloodBoundFunctionWithOneShot ( js_function ) ; <nl> - } <nl> - } <nl> - } else { <nl> - FloodWithOneShot ( function ) ; <nl> - } <nl> - } <nl> + FloodWithOneShotGeneric ( function , holder ) ; <nl> } <nl> } <nl> <nl> mmm a / src / debug . h <nl> ppp b / src / debug . h <nl> class Debug { <nl> void FloodWithOneShot ( Handle < JSFunction > function , <nl> BreakLocatorType type = ALL_BREAK_LOCATIONS ) ; <nl> void FloodBoundFunctionWithOneShot ( Handle < JSFunction > function ) ; <nl> + void FloodDefaultConstructorWithOneShot ( Handle < JSFunction > function ) ; <nl> + void FloodWithOneShotGeneric ( Handle < JSFunction > function , <nl> + Handle < Object > holder = Handle < Object > ( ) ) ; <nl> void FloodHandlerWithOneShot ( ) ; <nl> void ChangeBreakOnException ( ExceptionBreakType type , bool enable ) ; <nl> bool IsBreakOnException ( ExceptionBreakType type ) ; <nl> new file mode 100644 <nl> index 00000000000 . . ffc6fda63fb <nl> mmm / dev / null <nl> ppp b / test / mjsunit / harmony / debug - step - into - class - extends . js <nl> <nl> + / / Copyright 2014 the V8 project authors . All rights reserved . <nl> + / / Use of this source code is governed by a BSD - style license that can be <nl> + / / found in the LICENSE file . <nl> + <nl> + / / Flags : - - expose - debug - as debug - - harmony - classes <nl> + <nl> + ' use strict ' ; <nl> + <nl> + var Debug = debug . Debug <nl> + <nl> + var done = false ; <nl> + var stepCount = 0 ; <nl> + <nl> + function listener ( event , execState , eventData , data ) { <nl> + if ( event = = Debug . DebugEvent . Break ) { <nl> + if ( ! done ) { <nl> + execState . prepareStep ( Debug . StepAction . StepInto ) ; <nl> + var s = execState . frame ( ) . sourceLineText ( ) ; <nl> + assertTrue ( s . indexOf ( ' / / ' + stepCount + ' . ' ) ! = = - 1 ) ; <nl> + stepCount + + ; <nl> + } <nl> + } <nl> + } ; <nl> + <nl> + Debug . setListener ( listener ) ; <nl> + <nl> + function GetBase ( ) { <nl> + var x = 1 ; / / 1 . <nl> + var y = 2 ; / / 2 . <nl> + done = true ; / / 3 . <nl> + return null ; <nl> + } <nl> + <nl> + function f ( ) { <nl> + class Derived extends GetBase ( ) { } / / 0 . <nl> + } <nl> + <nl> + var bp = Debug . setBreakPoint ( f , 0 ) ; <nl> + f ( ) ; <nl> + assertEquals ( 4 , stepCount ) ; <nl> + <nl> + Debug . setListener ( null ) ; <nl> new file mode 100644 <nl> index 00000000000 . . dbef60f8465 <nl> mmm / dev / null <nl> ppp b / test / mjsunit / harmony / debug - step - into - constructor . js <nl> <nl> + / / Copyright 2014 the V8 project authors . All rights reserved . <nl> + / / Use of this source code is governed by a BSD - style license that can be <nl> + / / found in the LICENSE file . <nl> + <nl> + / / Flags : - - expose - debug - as debug - - harmony - classes <nl> + <nl> + ' use strict ' ; <nl> + <nl> + var Debug = debug . Debug <nl> + var done , stepCount ; <nl> + <nl> + function listener ( event , execState , eventData , data ) { <nl> + if ( event = = Debug . DebugEvent . Break ) { <nl> + if ( ! done ) { <nl> + execState . prepareStep ( Debug . StepAction . StepInto ) ; <nl> + var s = execState . frame ( ) . sourceLineText ( ) ; <nl> + assertTrue ( s . indexOf ( ' / / ' + stepCount + ' . ' ) ! = = - 1 ) ; <nl> + stepCount + + ; <nl> + } <nl> + } <nl> + } ; <nl> + <nl> + Debug . setListener ( listener ) ; <nl> + <nl> + <nl> + class Base { <nl> + constructor ( ) { <nl> + var x = 1 ; / / 1 . <nl> + var y = 2 ; / / 2 . <nl> + done = true ; / / 3 . <nl> + } <nl> + } <nl> + <nl> + class Derived extends Base { } <nl> + <nl> + <nl> + ( function TestBreakPointInConstructor ( ) { <nl> + done = false ; <nl> + stepCount = 1 ; <nl> + var bp = Debug . setBreakPoint ( Base , 0 ) ; <nl> + <nl> + new Base ( ) ; <nl> + assertEquals ( 4 , stepCount ) ; <nl> + <nl> + Debug . clearBreakPoint ( bp ) ; <nl> + } ) ( ) ; <nl> + <nl> + <nl> + ( function TestDefaultConstructor ( ) { <nl> + done = false ; <nl> + stepCount = 1 ; <nl> + <nl> + var bp = Debug . setBreakPoint ( Base , 0 ) ; <nl> + new Derived ( ) ; <nl> + assertEquals ( 4 , stepCount ) ; <nl> + <nl> + Debug . clearBreakPoint ( bp ) ; <nl> + } ) ( ) ; <nl> + <nl> + <nl> + ( function TestStepInto ( ) { <nl> + done = false ; <nl> + stepCount = 0 ; <nl> + <nl> + function f ( ) { <nl> + new Derived ( ) ; / / 0 . <nl> + } <nl> + <nl> + var bp = Debug . setBreakPoint ( f , 0 ) ; <nl> + f ( ) ; <nl> + assertEquals ( 4 , stepCount ) ; <nl> + <nl> + Debug . clearBreakPoint ( bp ) ; <nl> + } ) ( ) ; <nl> + <nl> + <nl> + ( function TestExtraIndirection ( ) { <nl> + done = false ; <nl> + stepCount = 0 ; <nl> + <nl> + class Derived2 extends Derived { } <nl> + <nl> + function f ( ) { <nl> + new Derived2 ( ) ; / / 0 . <nl> + } <nl> + <nl> + var bp = Debug . setBreakPoint ( f , 0 ) ; <nl> + f ( ) ; <nl> + assertEquals ( 4 , stepCount ) ; <nl> + <nl> + Debug . clearBreakPoint ( bp ) ; <nl> + } ) ( ) ; <nl> + <nl> + <nl> + ( function TestBoundClass ( ) { <nl> + done = false ; <nl> + stepCount = 0 ; <nl> + <nl> + var bound = Derived . bind ( null ) ; <nl> + <nl> + function f ( ) { <nl> + new bound ( ) ; / / 0 . <nl> + } <nl> + <nl> + var bp = Debug . setBreakPoint ( f , 0 ) ; <nl> + f ( ) ; <nl> + assertEquals ( 4 , stepCount ) ; <nl> + <nl> + Debug . clearBreakPoint ( bp ) ; <nl> + } ) ( ) ; <nl> + <nl> + <nl> + Debug . setListener ( null ) ; <nl>
Classes : Add support for stepping through default constructors
v8/v8
ef41de10db404a5be0957a2546b60ce7126ecff3
2014-11-15T19:48:39Z
mmm a / modules / planning / common / planning_gflags . cc <nl> ppp b / modules / planning / common / planning_gflags . cc <nl> DEFINE_bool ( enable_record_debug , true , <nl> DEFINE_double ( <nl> default_front_clear_distance , 300 . 0 , <nl> " default front clear distance value in case there is no obstacle around . " ) ; <nl> + <nl> + DEFINE_double ( max_trajectory_len , 1000 . 0 , <nl> + " ( unit : meter ) max possible trajectory length . " ) ; <nl> mmm a / modules / planning / common / planning_gflags . h <nl> ppp b / modules / planning / common / planning_gflags . h <nl> DECLARE_bool ( export_chart ) ; <nl> DECLARE_bool ( enable_record_debug ) ; <nl> <nl> DECLARE_double ( default_front_clear_distance ) ; <nl> + <nl> + DECLARE_double ( max_trajectory_len ) ; <nl> mmm a / modules / planning / toolkits / optimizers / st_graph / st_boundary_mapper . cc <nl> ppp b / modules / planning / toolkits / optimizers / st_graph / st_boundary_mapper . cc <nl> bool StBoundaryMapper : : GetOverlapBoundaryPoints ( <nl> } <nl> <nl> const double step_length = vehicle_param_ . front_edge_to_center ( ) ; <nl> - for ( double path_s = 0 . 0 ; path_s < discretized_path . Length ( ) ; <nl> - path_s + = step_length ) { <nl> + auto path_len = <nl> + std : : min ( FLAGS_max_trajectory_len , discretized_path . Length ( ) ) ; <nl> + for ( double path_s = 0 . 0 ; path_s < path_len ; path_s + = step_length ) { <nl> const auto curr_adc_path_point = discretized_path . Evaluate ( <nl> path_s + discretized_path . StartPoint ( ) . s ( ) ) ; <nl> if ( CheckOverlap ( curr_adc_path_point , obs_box , <nl>
planning : add length upper boundary protection to avoid infinite loop .
ApolloAuto/apollo
7dd3051963892522da07dd0e1827b2d2493beb46
2018-12-13T23:19:43Z
mmm a / hphp / doc / ir . specification <nl> ppp b / hphp / doc / ir . specification <nl> Instruction set <nl> <nl> 1 . Checks and Asserts <nl> <nl> + Note : Instructions that guard or check boxed types only check that the <nl> + operand is boxed , and they ignore the type of the value inside the box <nl> + ( the inner type ) . The inner type is normally checked when the value <nl> + within the box is loaded by a LdRef instruction ( which takes box / ref <nl> + values , and only checks the inner type ) . The reasoning for this <nl> + approach is that boxed values may alias . Therefore , in lack of memory <nl> + alias analysis , the inner types generally need to be rechecked before <nl> + each use . <nl> <nl> D : T = CheckType < T > S0 : { Gen | Nullptr } - > L <nl> <nl> mmm a / hphp / runtime / vm / jit / codegen . cpp <nl> ppp b / hphp / runtime / vm / jit / codegen . cpp <nl> void CodeGenerator : : cgCheckType ( IRInstruction * inst ) { <nl> m_as . testq ( rData , rData ) ; <nl> doJcc ( CC_E ) ; <nl> } else { <nl> - emitTypeTest ( inst - > typeParam ( ) , rType , rData , doJcc ) ; <nl> + Type typeParam = inst - > typeParam ( ) ; <nl> + if ( rType ! = InvalidReg ) { <nl> + emitTypeTest ( typeParam , rType , rData , doJcc ) ; <nl> + } else { <nl> + Type srcType = src - > type ( ) ; <nl> + if ( srcType . isBoxed ( ) & & typeParam . isBoxed ( ) ) { <nl> + / / Nothing to do here , since we check the inner type at the uses <nl> + } else { <nl> + CG_PUNT ( CheckType - known - srcType ) ; <nl> + } <nl> + } <nl> } <nl> <nl> auto const dstReg = m_regs [ inst - > dst ( ) ] . reg ( ) ; <nl>
Allow JIT - time known boxed types for source operand in cgCheckType
facebook/hhvm
a4c445dbfb9009ec1e2a41b5e89f8bcbe2554f9a
2013-07-10T18:16:53Z
mmm a / xbmc / pvr / PVRGUIInfo . cpp <nl> ppp b / xbmc / pvr / PVRGUIInfo . cpp <nl> void CPVRGUIInfo : : UpdateBackendCache ( void ) <nl> PVR_CLIENTMAP activeClients ; <nl> iActiveClients = clients - > GetConnectedClients ( activeClients ) ; <nl> <nl> + if ( iActiveClients > 1 & & ! AddonInfoToggle ( ) ) <nl> + return ; <nl> + <nl> { <nl> CSingleLock lock ( m_critSection ) ; <nl> if ( m_iAddonInfoToggleCurrent > = iActiveClients ) <nl> void CPVRGUIInfo : : UpdateBackendCache ( void ) <nl> } <nl> } <nl> <nl> - if ( iActiveClients > 1 & & ! AddonInfoToggle ( ) ) <nl> - return ; <nl> - <nl> if ( iActiveClients > 0 ) <nl> { <nl> PVR_CLIENTMAP_CITR activeClient = activeClients . begin ( ) ; <nl>
Merge pull request from ksooo / trac15942_v2
xbmc/xbmc
12ac1045ec5d0c3b2757eefba16a9080876fa8f2
2015-06-07T14:28:02Z
mmm a / src / builtins / builtins - function - gen . cc <nl> ppp b / src / builtins / builtins - function - gen . cc <nl> TF_BUILTIN ( FastFunctionPrototypeBind , CodeStubAssembler ) { <nl> Node * receiver = args . GetReceiver ( ) ; <nl> GotoIf ( TaggedIsSmi ( receiver ) , & slow ) ; <nl> <nl> - Node * receiver_map = LoadMap ( receiver ) ; <nl> + TNode < Map > receiver_map = LoadMap ( receiver ) ; <nl> { <nl> Node * instance_type = LoadMapInstanceType ( receiver_map ) ; <nl> GotoIfNot ( <nl> TF_BUILTIN ( FastFunctionPrototypeBind , CodeStubAssembler ) { <nl> / / AccessorInfo objects . In that case , their value can be recomputed even if <nl> / / the actual value on the object changes . <nl> Comment ( " Check descriptor array length " ) ; <nl> - TNode < DescriptorArray > descriptors = LoadMapDescriptors ( receiver_map ) ; <nl> / / Minimum descriptor array length required for fast path . <nl> const int min_nof_descriptors = i : : Max ( JSFunction : : kLengthDescriptorIndex , <nl> - JSFunction : : kNameDescriptorIndex ) ; <nl> - TNode < Int32T > nof_descriptors = LoadNumberOfDescriptors ( descriptors ) ; <nl> - GotoIf ( <nl> - Int32LessThanOrEqual ( nof_descriptors , Int32Constant ( min_nof_descriptors ) ) , <nl> - & slow ) ; <nl> + JSFunction : : kNameDescriptorIndex ) + <nl> + 1 ; <nl> + TNode < Int32T > nof_descriptors = LoadNumberOfOwnDescriptors ( receiver_map ) ; <nl> + GotoIf ( Int32LessThan ( nof_descriptors , Int32Constant ( min_nof_descriptors ) ) , <nl> + & slow ) ; <nl> <nl> / / Check whether the length and name properties are still present as <nl> / / AccessorInfo objects . In that case , their value can be recomputed even if <nl> / / the actual value on the object changes . <nl> Comment ( " Check name and length properties " ) ; <nl> { <nl> + TNode < DescriptorArray > descriptors = LoadMapDescriptors ( receiver_map ) ; <nl> const int length_index = JSFunction : : kLengthDescriptorIndex ; <nl> TNode < Name > maybe_length = <nl> LoadKeyByDescriptorEntry ( descriptors , length_index ) ; <nl> mmm a / src / codegen / code - stub - assembler . cc <nl> ppp b / src / codegen / code - stub - assembler . cc <nl> TNode < Int32T > CodeStubAssembler : : LoadNumberOfDescriptors ( <nl> MachineType : : Int16 ( ) ) ) ; <nl> } <nl> <nl> + TNode < Int32T > CodeStubAssembler : : LoadNumberOfOwnDescriptors ( TNode < Map > map ) { <nl> + Node * bit_field3 = LoadMapBitField3 ( map ) ; <nl> + return UncheckedCast < Int32T > ( <nl> + DecodeWord32 < Map : : NumberOfOwnDescriptorsBits > ( bit_field3 ) ) ; <nl> + } <nl> + <nl> TNode < Int32T > CodeStubAssembler : : LoadMapBitField ( SloppyTNode < Map > map ) { <nl> CSA_SLOW_ASSERT ( this , IsMap ( map ) ) ; <nl> return UncheckedCast < Int32T > ( <nl> mmm a / src / codegen / code - stub - assembler . h <nl> ppp b / src / codegen / code - stub - assembler . h <nl> class V8_EXPORT_PRIVATE CodeStubAssembler <nl> SloppyTNode < WeakFixedArray > array ) ; <nl> / / Load the number of descriptors in DescriptorArray . <nl> TNode < Int32T > LoadNumberOfDescriptors ( TNode < DescriptorArray > array ) ; <nl> + / / Load the number of own descriptors of a map . <nl> + TNode < Int32T > LoadNumberOfOwnDescriptors ( TNode < Map > map ) ; <nl> / / Load the bit field of a Map . <nl> TNode < Int32T > LoadMapBitField ( SloppyTNode < Map > map ) ; <nl> / / Load bit field 2 of a map . <nl> mmm a / src / compiler / js - call - reducer . cc <nl> ppp b / src / compiler / js - call - reducer . cc <nl> Reduction JSCallReducer : : ReduceFunctionPrototypeBind ( Node * node ) { <nl> / / runtime otherwise . <nl> Handle < DescriptorArray > descriptors ( <nl> receiver_map . object ( ) - > instance_descriptors ( ) , isolate ( ) ) ; <nl> - if ( descriptors - > number_of_descriptors ( ) < 2 ) return inference . NoChange ( ) ; <nl> + int minimum_nof_descriptors = i : : Max ( JSFunction : : kLengthDescriptorIndex , <nl> + JSFunction : : kNameDescriptorIndex ) + <nl> + 1 ; <nl> + if ( receiver_map . object ( ) - > NumberOfOwnDescriptors ( ) < <nl> + minimum_nof_descriptors ) { <nl> + return inference . NoChange ( ) ; <nl> + } <nl> if ( descriptors - > GetKey ( JSFunction : : kLengthDescriptorIndex ) ! = <nl> ReadOnlyRoots ( isolate ( ) ) . length_string ( ) ) { <nl> return inference . NoChange ( ) ; <nl>
Reland " [ turbofan ] Make code and comment match in FastFunctionPrototypeBind "
v8/v8
629d3c8521b6cf7d030e49ab15719021299c9953
2019-07-24T12:36:43Z
diff - - git a / project / Win32BuildSetup / XBMC for Windows . nsi b / project / Win32BuildSetup / XBMC for Windows . nsi <nl> mmm a / project / Win32BuildSetup / XBMC for Windows . nsi <nl> ppp b / project / Win32BuildSetup / XBMC for Windows . nsi <nl> SectionEnd <nl> ; mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> ; vs redist installer Section <nl> <nl> - Section " Microsoft Visual C + + 2008 Redistributable Package ( x86 ) " SEC_VCREDIST <nl> + Section " Microsoft Visual C + + 2010 Redistributable Package ( x86 ) " SEC_VCREDIST <nl> <nl> SectionIn 1 2 <nl> <nl>
[ WIN32 ] fixed : vs 2010 redist name in Setup program . Thx EclipseGT
xbmc/xbmc
eaf52ec2a8c68ff56dca54c6547bdb7804a27004
2011-02-09T02:25:56Z
mmm a / tensorflow / python / compat / compat . py <nl> ppp b / tensorflow / python / compat / compat . py <nl> <nl> from tensorflow . python . util import tf_contextlib <nl> from tensorflow . python . util . tf_export import tf_export <nl> <nl> - _FORWARD_COMPATIBILITY_HORIZON = datetime . date ( 2019 , 3 , 24 ) <nl> + _FORWARD_COMPATIBILITY_HORIZON = datetime . date ( 2019 , 3 , 25 ) <nl> <nl> <nl> @ tf_export ( " compat . forward_compatible " ) <nl>
compat : Update forward compatibility horizon to 2019 - 03 - 25
tensorflow/tensorflow
05e9a17ca0da0b2f00d4be16b09bd082d54f232f
2019-03-25T09:07:33Z
mmm a / xbmc / guilib / imagefactory . cpp <nl> ppp b / xbmc / guilib / imagefactory . cpp <nl> IImage * ImageFactory : : CreateFallbackLoader ( const std : : string & strMimeType ) <nl> { <nl> return new CXImage ( strMimeType ) ; <nl> } <nl> - <nl> - IImage * ImageFactory : : CreateFallbackLoader ( const CURL & url ) <nl> - { <nl> - return new CXImage ( " image / " + url . GetFileType ( ) ) ; <nl> - } <nl> \ No newline at end of file <nl> mmm a / xbmc / guilib / imagefactory . h <nl> ppp b / xbmc / guilib / imagefactory . h <nl> class ImageFactory <nl> static IImage * CreateLoader ( const CURL & url ) ; <nl> static IImage * CreateLoaderFromMimeType ( const std : : string & strMimeType ) ; <nl> static IImage * CreateFallbackLoader ( const std : : string & strMimeType ) ; <nl> - static IImage * CreateFallbackLoader ( const CURL & url ) ; <nl> } ; <nl> \ No newline at end of file <nl>
imagefactory : removed unused method .
xbmc/xbmc
f2e6abff9a3d4bd4656b340f0547c79d3b7e646b
2014-01-04T12:37:07Z
mmm a / src / diagnostics / arm / disasm - arm . cc <nl> ppp b / src / diagnostics / arm / disasm - arm . cc <nl> class Decoder { <nl> <nl> void DecodeSpecialCondition ( Instruction * instr ) ; <nl> <nl> + / / F4 . 1 . 14 Floating - point data - processing . <nl> + void DecodeFloatingPointDataProcessing ( Instruction * instr ) ; <nl> + / / F4 . 1 . 18 Unconditional instructions . <nl> + void DecodeUnconditional ( Instruction * instr ) ; <nl> + / / F4 . 1 . 20 Advanced SIMD data - processing . <nl> + void DecodeAdvancedSIMDDataProcessing ( Instruction * instr ) ; <nl> + / / F4 . 1 . 21 Advanced SIMD two registers , or three registers of different <nl> + / / lengths . <nl> + void DecodeAdvancedSIMDTwoOrThreeRegisters ( Instruction * instr ) ; <nl> + / / F4 . 1 . 23 Memory hints and barriers . <nl> + void DecodeMemoryHintsAndBarriers ( Instruction * instr ) ; <nl> + / / F4 . 1 . 24 Advanced SIMD element or structure load / store . <nl> + void DecodeAdvancedSIMDElementOrStructureLoadStore ( Instruction * instr ) ; <nl> + <nl> void DecodeVMOVBetweenCoreAndSinglePrecisionRegisters ( Instruction * instr ) ; <nl> void DecodeVCMP ( Instruction * instr ) ; <nl> void DecodeVCVTBetweenDoubleAndSingle ( Instruction * instr ) ; <nl> static const char * const barrier_option_names [ ] = { <nl> } ; <nl> <nl> void Decoder : : DecodeSpecialCondition ( Instruction * instr ) { <nl> - switch ( instr - > SpecialValue ( ) ) { <nl> - case 4 : { <nl> - int Vd , Vm , Vn ; <nl> - if ( instr - > Bit ( 6 ) = = 0 ) { <nl> - Vd = instr - > VFPDRegValue ( kDoublePrecision ) ; <nl> - Vm = instr - > VFPMRegValue ( kDoublePrecision ) ; <nl> - Vn = instr - > VFPNRegValue ( kDoublePrecision ) ; <nl> - } else { <nl> - Vd = instr - > VFPDRegValue ( kSimd128Precision ) ; <nl> - Vm = instr - > VFPMRegValue ( kSimd128Precision ) ; <nl> - Vn = instr - > VFPNRegValue ( kSimd128Precision ) ; <nl> - } <nl> - int size = kBitsPerByte * ( 1 < < instr - > Bits ( 21 , 20 ) ) ; <nl> - switch ( instr - > Bits ( 11 , 8 ) ) { <nl> - case 0x0 : { <nl> - if ( instr - > Bit ( 4 ) = = 1 ) { <nl> - / / vqadd . s < size > Qd , Qm , Qn . <nl> - out_buffer_pos_ + = <nl> - SNPrintF ( out_buffer_ + out_buffer_pos_ , <nl> - " vqadd . s % d q % d , q % d , q % d " , size , Vd , Vn , Vm ) ; <nl> - } else { <nl> - Unknown ( instr ) ; <nl> - } <nl> - break ; <nl> - } <nl> - case 0x1 : { <nl> - if ( instr - > Bits ( 21 , 20 ) = = 2 & & instr - > Bit ( 6 ) = = 1 & & <nl> - instr - > Bit ( 4 ) = = 1 ) { <nl> - if ( Vm = = Vn ) { <nl> - / / vmov Qd , Qm <nl> - out_buffer_pos_ + = SNPrintF ( out_buffer_ + out_buffer_pos_ , <nl> - " vmov q % d , q % d " , Vd , Vm ) ; <nl> - } else { <nl> - / / vorr Qd , Qm , Qn . <nl> - out_buffer_pos_ + = SNPrintF ( out_buffer_ + out_buffer_pos_ , <nl> - " vorr q % d , q % d , q % d " , Vd , Vn , Vm ) ; <nl> - } <nl> - } else if ( instr - > Bits ( 21 , 20 ) = = 1 & & instr - > Bit ( 6 ) = = 1 & & <nl> - instr - > Bit ( 4 ) = = 1 ) { <nl> - / / vbic Qd , Qn , Qm <nl> - out_buffer_pos_ + = SNPrintF ( out_buffer_ + out_buffer_pos_ , <nl> - " vbic q % d , q % d , q % d " , Vd , Vn , Vm ) ; <nl> - } else if ( instr - > Bits ( 21 , 20 ) = = 0 & & instr - > Bit ( 6 ) = = 1 & & <nl> - instr - > Bit ( 4 ) = = 1 ) { <nl> - / / vand Qd , Qm , Qn . <nl> - out_buffer_pos_ + = SNPrintF ( out_buffer_ + out_buffer_pos_ , <nl> - " vand q % d , q % d , q % d " , Vd , Vn , Vm ) ; <nl> - } else { <nl> - Unknown ( instr ) ; <nl> - } <nl> - break ; <nl> - } <nl> - case 0x2 : { <nl> - if ( instr - > Bit ( 4 ) = = 1 ) { <nl> - / / vqsub . s < size > Qd , Qm , Qn . <nl> - out_buffer_pos_ + = <nl> - SNPrintF ( out_buffer_ + out_buffer_pos_ , <nl> - " vqsub . s % d q % d , q % d , q % d " , size , Vd , Vn , Vm ) ; <nl> - } else { <nl> - Unknown ( instr ) ; <nl> - } <nl> - break ; <nl> - } <nl> - case 0x3 : { <nl> - const char * op = ( instr - > Bit ( 4 ) = = 1 ) ? " vcge " : " vcgt " ; <nl> - / / vcge / vcgt . s < size > Qd , Qm , Qn . <nl> - out_buffer_pos_ + = <nl> - SNPrintF ( out_buffer_ + out_buffer_pos_ , " % s . s % d q % d , q % d , q % d " , <nl> - op , size , Vd , Vn , Vm ) ; <nl> - break ; <nl> - } <nl> - case 0x4 : { <nl> - if ( instr - > Bit ( 4 ) = = 0 ) { <nl> - / / vshl . s < size > Qd , Qm , Qn . <nl> - out_buffer_pos_ + = <nl> - SNPrintF ( out_buffer_ + out_buffer_pos_ , <nl> - " vshl . s % d q % d , q % d , q % d " , size , Vd , Vm , Vn ) ; <nl> - } else { <nl> - Unknown ( instr ) ; <nl> - } <nl> - break ; <nl> - } <nl> - case 0x6 : { <nl> - / / vmin / vmax . s < size > Qd , Qm , Qn . <nl> - const char * op = instr - > Bit ( 4 ) = = 1 ? " vmin " : " vmax " ; <nl> - out_buffer_pos_ + = <nl> - SNPrintF ( out_buffer_ + out_buffer_pos_ , " % s . s % d q % d , q % d , q % d " , <nl> - op , size , Vd , Vn , Vm ) ; <nl> - break ; <nl> + int op0 = instr - > Bits ( 25 , 24 ) ; <nl> + int op1 = instr - > Bits ( 11 , 9 ) ; <nl> + int op2 = instr - > Bit ( 4 ) ; <nl> + <nl> + if ( instr - > Bit ( 27 ) = = 0 ) { <nl> + DecodeUnconditional ( instr ) ; <nl> + } else if ( ( instr - > Bits ( 27 , 26 ) = = 0b11 ) & & ( op0 = = 0b10 ) & & <nl> + ( ( op1 > > 1 ) = = 0b10 ) & & ! op2 ) { <nl> + DecodeFloatingPointDataProcessing ( instr ) ; <nl> + } else { <nl> + Unknown ( instr ) ; <nl> + } <nl> + } <nl> + <nl> + void Decoder : : DecodeFloatingPointDataProcessing ( Instruction * instr ) { <nl> + / / Floating - point data processing , F4 . 1 . 14 . <nl> + int op0 = instr - > Bits ( 23 , 20 ) ; <nl> + int op1 = instr - > Bits ( 19 , 16 ) ; <nl> + int op2 = instr - > Bits ( 9 , 8 ) ; <nl> + int op3 = instr - > Bit ( 6 ) ; <nl> + if ( ( ( op0 & 0b1000 ) = = 0 ) & & op2 & & ! op3 ) { <nl> + / / Floating - point conditional select . <nl> + / / VSEL * ( floating - point ) <nl> + bool dp_operation = ( instr - > SzValue ( ) = = 1 ) ; <nl> + switch ( instr - > Bits ( 21 , 20 ) ) { <nl> + case 0x0 : <nl> + if ( dp_operation ) { <nl> + Format ( instr , " vseleq . f64 ' Dd , ' Dn , ' Dm " ) ; <nl> + } else { <nl> + Format ( instr , " vseleq . f32 ' Sd , ' Sn , ' Sm " ) ; <nl> } <nl> - case 0x8 : { <nl> - const char * op = ( instr - > Bit ( 4 ) = = 0 ) ? " vadd " : " vtst " ; <nl> - / / vadd / vtst . i < size > Qd , Qm , Qn . <nl> - out_buffer_pos_ + = <nl> - SNPrintF ( out_buffer_ + out_buffer_pos_ , " % s . i % d q % d , q % d , q % d " , <nl> - op , size , Vd , Vn , Vm ) ; <nl> - break ; <nl> + break ; <nl> + case 0x1 : <nl> + if ( dp_operation ) { <nl> + Format ( instr , " vselvs . f64 ' Dd , ' Dn , ' Dm " ) ; <nl> + } else { <nl> + Format ( instr , " vselvs . f32 ' Sd , ' Sn , ' Sm " ) ; <nl> } <nl> - case 0x9 : { <nl> - if ( instr - > Bit ( 6 ) = = 1 & & instr - > Bit ( 4 ) = = 1 ) { <nl> - / / vmul . i < size > Qd , Qm , Qn . <nl> - out_buffer_pos_ + = <nl> - SNPrintF ( out_buffer_ + out_buffer_pos_ , <nl> - " vmul . i % d q % d , q % d , q % d " , size , Vd , Vn , Vm ) ; <nl> - } else { <nl> - Unknown ( instr ) ; <nl> - } <nl> - break ; <nl> + break ; <nl> + case 0x2 : <nl> + if ( dp_operation ) { <nl> + Format ( instr , " vselge . f64 ' Dd , ' Dn , ' Dm " ) ; <nl> + } else { <nl> + Format ( instr , " vselge . f32 ' Sd , ' Sn , ' Sm " ) ; <nl> } <nl> - case 0xA : { <nl> - / / vpmin / vpmax . s < size > Dd , Dm , Dn . <nl> - const char * op = instr - > Bit ( 4 ) = = 1 ? " vpmin " : " vpmax " ; <nl> - out_buffer_pos_ + = <nl> - SNPrintF ( out_buffer_ + out_buffer_pos_ , " % s . s % d d % d , d % d , d % d " , <nl> - op , size , Vd , Vn , Vm ) ; <nl> - break ; <nl> + break ; <nl> + case 0x3 : <nl> + if ( dp_operation ) { <nl> + Format ( instr , " vselgt . f64 ' Dd , ' Dn , ' Dm " ) ; <nl> + } else { <nl> + Format ( instr , " vselgt . f32 ' Sd , ' Sn , ' Sm " ) ; <nl> } <nl> - case 0xB : { <nl> - / / vpadd . i < size > Dd , Dm , Dn . <nl> - out_buffer_pos_ + = <nl> - SNPrintF ( out_buffer_ + out_buffer_pos_ , " vpadd . i % d d % d , d % d , d % d " , <nl> - size , Vd , Vn , Vm ) ; <nl> - break ; <nl> + break ; <nl> + default : <nl> + UNREACHABLE ( ) ; / / Case analysis is exhaustive . <nl> + break ; <nl> + } <nl> + } else if ( instr - > Opc1Value ( ) = = 0x4 & & op2 ) { <nl> + / / Floating - point minNum / maxNum . <nl> + / / VMAXNM , VMINNM ( floating - point ) <nl> + if ( instr - > SzValue ( ) = = 0x1 ) { <nl> + if ( instr - > Bit ( 6 ) = = 0x1 ) { <nl> + Format ( instr , " vminnm . f64 ' Dd , ' Dn , ' Dm " ) ; <nl> + } else { <nl> + Format ( instr , " vmaxnm . f64 ' Dd , ' Dn , ' Dm " ) ; <nl> + } <nl> + } else { <nl> + if ( instr - > Bit ( 6 ) = = 0x1 ) { <nl> + Format ( instr , " vminnm . f32 ' Sd , ' Sn , ' Sm " ) ; <nl> + } else { <nl> + Format ( instr , " vmaxnm . f32 ' Sd , ' Sn , ' Sm " ) ; <nl> + } <nl> + } <nl> + } else if ( instr - > Opc1Value ( ) = = 0x7 & & ( op1 > > 3 ) & & op2 & & op3 ) { <nl> + / / Floating - point directed convert to integer . <nl> + / / VRINTA , VRINTN , VRINTP , VRINTM ( floating - point ) <nl> + bool dp_operation = ( instr - > SzValue ( ) = = 1 ) ; <nl> + int rounding_mode = instr - > Bits ( 17 , 16 ) ; <nl> + switch ( rounding_mode ) { <nl> + case 0x0 : <nl> + if ( dp_operation ) { <nl> + Format ( instr , " vrinta . f64 . f64 ' Dd , ' Dm " ) ; <nl> + } else { <nl> + Format ( instr , " vrinta . f32 . f32 ' Sd , ' Sm " ) ; <nl> } <nl> - case 0xD : { <nl> - if ( instr - > Bit ( 4 ) = = 0 ) { <nl> - const char * op = ( instr - > Bits ( 21 , 20 ) = = 0 ) ? " vadd " : " vsub " ; <nl> - / / vadd / vsub . f32 Qd , Qm , Qn . <nl> - out_buffer_pos_ + = SNPrintF ( out_buffer_ + out_buffer_pos_ , <nl> - " % s . f32 q % d , q % d , q % d " , op , Vd , Vn , Vm ) ; <nl> - } else { <nl> - Unknown ( instr ) ; <nl> - } <nl> - break ; <nl> + break ; <nl> + case 0x1 : <nl> + if ( dp_operation ) { <nl> + Format ( instr , " vrintn . f64 . f64 ' Dd , ' Dm " ) ; <nl> + } else { <nl> + Format ( instr , " vrintn . f32 . f32 ' Sd , ' Sm " ) ; <nl> } <nl> - case 0xE : { <nl> - if ( instr - > Bits ( 21 , 20 ) = = 0 & & instr - > Bit ( 4 ) = = 0 ) { <nl> - / / vceq . f32 Qd , Qm , Qn . <nl> - out_buffer_pos_ + = SNPrintF ( out_buffer_ + out_buffer_pos_ , <nl> - " vceq . f32 q % d , q % d , q % d " , Vd , Vn , Vm ) ; <nl> - } else { <nl> - Unknown ( instr ) ; <nl> - } <nl> - break ; <nl> + break ; <nl> + case 0x2 : <nl> + if ( dp_operation ) { <nl> + Format ( instr , " vrintp . f64 . f64 ' Dd , ' Dm " ) ; <nl> + } else { <nl> + Format ( instr , " vrintp . f32 . f32 ' Sd , ' Sm " ) ; <nl> } <nl> - case 0xF : { <nl> - if ( instr - > Bit ( 20 ) = = 0 & & instr - > Bit ( 6 ) = = 1 ) { <nl> - if ( instr - > Bit ( 4 ) = = 1 ) { <nl> - / / vrecps / vrsqrts . f32 Qd , Qm , Qn . <nl> - const char * op = instr - > Bit ( 21 ) = = 0 ? " vrecps " : " vrsqrts " ; <nl> - out_buffer_pos_ + = <nl> - SNPrintF ( out_buffer_ + out_buffer_pos_ , <nl> - " % s . f32 q % d , q % d , q % d " , op , Vd , Vn , Vm ) ; <nl> - } else { <nl> - / / vmin / max . f32 Qd , Qm , Qn . <nl> - const char * op = instr - > Bit ( 21 ) = = 1 ? " vmin " : " vmax " ; <nl> - out_buffer_pos_ + = <nl> - SNPrintF ( out_buffer_ + out_buffer_pos_ , <nl> - " % s . f32 q % d , q % d , q % d " , op , Vd , Vn , Vm ) ; <nl> - } <nl> - } else { <nl> - Unknown ( instr ) ; <nl> - } <nl> - break ; <nl> + break ; <nl> + case 0x3 : <nl> + if ( dp_operation ) { <nl> + Format ( instr , " vrintm . f64 . f64 ' Dd , ' Dm " ) ; <nl> + } else { <nl> + Format ( instr , " vrintm . f32 . f32 ' Sd , ' Sm " ) ; <nl> } <nl> - default : <nl> - Unknown ( instr ) ; <nl> - break ; <nl> - } <nl> - break ; <nl> + break ; <nl> + default : <nl> + UNREACHABLE ( ) ; / / Case analysis is exhaustive . <nl> + break ; <nl> } <nl> - case 5 : <nl> - if ( instr - > Bit ( 23 ) = = 1 & & instr - > Bits ( 21 , 19 ) = = 0 & & <nl> - instr - > Bit ( 7 ) = = 0 & & instr - > Bit ( 4 ) = = 1 ) { <nl> - / / One register and a modified immediate value , see ARM DDI 0406C . d <nl> - / / A7 . 4 . 6 . <nl> - DecodeVmovImmediate ( instr ) ; <nl> - } else if ( ( instr - > Bits ( 18 , 16 ) = = 0 ) & & ( instr - > Bits ( 11 , 6 ) = = 0x28 ) & & <nl> - ( instr - > Bit ( 4 ) = = 1 ) ) { <nl> - / / vmovl signed <nl> - if ( ( instr - > VdValue ( ) & 1 ) ! = 0 ) Unknown ( instr ) ; <nl> - int Vd = ( instr - > Bit ( 22 ) < < 3 ) | ( instr - > VdValue ( ) > > 1 ) ; <nl> - int Vm = ( instr - > Bit ( 5 ) < < 4 ) | instr - > VmValue ( ) ; <nl> - int imm3 = instr - > Bits ( 21 , 19 ) ; <nl> - out_buffer_pos_ + = SNPrintF ( out_buffer_ + out_buffer_pos_ , <nl> - " vmovl . s % d q % d , d % d " , imm3 * 8 , Vd , Vm ) ; <nl> - } else if ( instr - > Bits ( 21 , 20 ) = = 3 & & instr - > Bit ( 4 ) = = 0 ) { <nl> - / / vext . 8 Qd , Qm , Qn , imm4 <nl> - int imm4 = instr - > Bits ( 11 , 8 ) ; <nl> - int Vd = instr - > VFPDRegValue ( kSimd128Precision ) ; <nl> - int Vm = instr - > VFPMRegValue ( kSimd128Precision ) ; <nl> - int Vn = instr - > VFPNRegValue ( kSimd128Precision ) ; <nl> - out_buffer_pos_ + = <nl> - SNPrintF ( out_buffer_ + out_buffer_pos_ , " vext . 8 q % d , q % d , q % d , # % d " , <nl> - Vd , Vn , Vm , imm4 ) ; <nl> - } else if ( instr - > Bits ( 11 , 8 ) = = 5 & & instr - > Bit ( 4 ) = = 1 ) { <nl> - / / vshl . i < size > Qd , Qm , shift <nl> - int imm7 = instr - > Bits ( 21 , 16 ) ; <nl> - if ( instr - > Bit ( 7 ) ! = 0 ) imm7 + = 64 ; <nl> - int size = base : : bits : : RoundDownToPowerOfTwo32 ( imm7 ) ; <nl> - int shift = imm7 - size ; <nl> - int Vd = instr - > VFPDRegValue ( kSimd128Precision ) ; <nl> - int Vm = instr - > VFPMRegValue ( kSimd128Precision ) ; <nl> + } else { <nl> + Unknown ( instr ) ; <nl> + } <nl> + / / One class of decoding is missing here : Floating - point extraction and <nl> + / / insertion , but it is not used in V8 now , and thus omitted . <nl> + } <nl> + <nl> + void Decoder : : DecodeUnconditional ( Instruction * instr ) { <nl> + / / This follows the decoding in F4 . 1 . 18 Unconditional instructions . <nl> + int op0 = instr - > Bits ( 26 , 25 ) ; <nl> + int op1 = instr - > Bit ( 20 ) ; <nl> + <nl> + / / Four classes of decoding : <nl> + / / - Miscellaneous ( omitted , no instructions used in V8 ) . <nl> + / / - Advanced SIMD data - processing . <nl> + / / - Memory hints and barriers . <nl> + / / - Advanced SIMD element or structure load / store . <nl> + if ( op0 = = 0b01 ) { <nl> + DecodeAdvancedSIMDDataProcessing ( instr ) ; <nl> + } else if ( ( op0 & 0b10 ) = = 0b10 & & op1 ) { <nl> + DecodeMemoryHintsAndBarriers ( instr ) ; <nl> + } else if ( op0 = = 0b10 & & ! op1 ) { <nl> + DecodeAdvancedSIMDElementOrStructureLoadStore ( instr ) ; <nl> + } else { <nl> + Unknown ( instr ) ; <nl> + } <nl> + } <nl> + <nl> + void Decoder : : DecodeAdvancedSIMDDataProcessing ( Instruction * instr ) { <nl> + int op0 = instr - > Bit ( 23 ) ; <nl> + int op1 = instr - > Bit ( 4 ) ; <nl> + if ( op0 = = 0 ) { <nl> + / / Advanced SIMD three registers of same length . <nl> + int Vd , Vm , Vn ; <nl> + if ( instr - > Bit ( 6 ) = = 0 ) { <nl> + Vd = instr - > VFPDRegValue ( kDoublePrecision ) ; <nl> + Vm = instr - > VFPMRegValue ( kDoublePrecision ) ; <nl> + Vn = instr - > VFPNRegValue ( kDoublePrecision ) ; <nl> + } else { <nl> + Vd = instr - > VFPDRegValue ( kSimd128Precision ) ; <nl> + Vm = instr - > VFPMRegValue ( kSimd128Precision ) ; <nl> + Vn = instr - > VFPNRegValue ( kSimd128Precision ) ; <nl> + } <nl> + <nl> + int u = instr - > Bit ( 24 ) ; <nl> + int opc = instr - > Bits ( 11 , 8 ) ; <nl> + int q = instr - > Bit ( 6 ) ; <nl> + int sz = instr - > Bits ( 21 , 20 ) ; <nl> + int size = kBitsPerByte * ( 1 < < sz ) ; <nl> + <nl> + if ( ! u & & opc = = 0 & & op1 ) { <nl> + / / vqadd . s < size > Qd , Qm , Qn . <nl> + out_buffer_pos_ + = SNPrintF ( out_buffer_ + out_buffer_pos_ , <nl> + " vqadd . s % d q % d , q % d , q % d " , size , Vd , Vn , Vm ) ; <nl> + } else if ( ! u & & opc = = 1 & & sz = = 2 & & q & & op1 ) { <nl> + if ( Vm = = Vn ) { <nl> + / / vmov Qd , Qm <nl> out_buffer_pos_ + = <nl> - SNPrintF ( out_buffer_ + out_buffer_pos_ , " vshl . i % d q % d , q % d , # % d " , <nl> - size , Vd , Vm , shift ) ; <nl> - } else if ( instr - > Bits ( 11 , 8 ) = = 0 & & instr - > Bit ( 4 ) = = 1 ) { <nl> + SNPrintF ( out_buffer_ + out_buffer_pos_ , " vmov q % d , q % d " , Vd , Vm ) ; <nl> + } else { <nl> + / / vorr Qd , Qm , Qn . <nl> + out_buffer_pos_ + = SNPrintF ( out_buffer_ + out_buffer_pos_ , <nl> + " vorr q % d , q % d , q % d " , Vd , Vn , Vm ) ; <nl> + } <nl> + } else if ( ! u & & opc = = 1 & & sz = = 1 & & q & & op1 ) { <nl> + / / vbic Qd , Qn , Qm <nl> + out_buffer_pos_ + = SNPrintF ( out_buffer_ + out_buffer_pos_ , <nl> + " vbic q % d , q % d , q % d " , Vd , Vn , Vm ) ; <nl> + } else if ( ! u & & opc = = 1 & & sz = = 0 & & q & & op1 ) { <nl> + / / vand Qd , Qm , Qn . <nl> + out_buffer_pos_ + = SNPrintF ( out_buffer_ + out_buffer_pos_ , <nl> + " vand q % d , q % d , q % d " , Vd , Vn , Vm ) ; <nl> + } else if ( ! u & & opc = = 1 & & sz = = 1 & & q & & op1 ) { <nl> + / / vbic Qd , Qn , Qm <nl> + out_buffer_pos_ + = SNPrintF ( out_buffer_ + out_buffer_pos_ , <nl> + " vbic q % d , q % d , q % d " , Vd , Vn , Vm ) ; <nl> + } else if ( ! u & & opc = = 2 & & op1 ) { <nl> + / / vqsub . s < size > Qd , Qm , Qn . <nl> + out_buffer_pos_ + = SNPrintF ( out_buffer_ + out_buffer_pos_ , <nl> + " vqsub . s % d q % d , q % d , q % d " , size , Vd , Vn , Vm ) ; <nl> + } else if ( ! u & & opc = = 3 ) { <nl> + const char * op = op1 ? " vcge " : " vcgt " ; <nl> + / / vcge / vcgt . s < size > Qd , Qm , Qn . <nl> + out_buffer_pos_ + = SNPrintF ( out_buffer_ + out_buffer_pos_ , <nl> + " % s . s % d q % d , q % d , q % d " , op , size , Vd , Vn , Vm ) ; <nl> + } else if ( ! u & & opc = = 4 & & ! op1 ) { <nl> + / / vshl . s < size > Qd , Qm , Qn . <nl> + out_buffer_pos_ + = SNPrintF ( out_buffer_ + out_buffer_pos_ , <nl> + " vshl . s % d q % d , q % d , q % d " , size , Vd , Vm , Vn ) ; <nl> + } else if ( ! u & & opc = = 6 ) { <nl> + / / vmin / vmax . s < size > Qd , Qm , Qn . <nl> + const char * op = op1 ? " vmin " : " vmax " ; <nl> + out_buffer_pos_ + = SNPrintF ( out_buffer_ + out_buffer_pos_ , <nl> + " % s . s % d q % d , q % d , q % d " , op , size , Vd , Vn , Vm ) ; <nl> + } else if ( ! u & & opc = = 8 ) { <nl> + const char * op = op1 ? " vtst " : " vadd " ; <nl> + / / vadd / vtst . i < size > Qd , Qm , Qn . <nl> + out_buffer_pos_ + = SNPrintF ( out_buffer_ + out_buffer_pos_ , <nl> + " % s . i % d q % d , q % d , q % d " , op , size , Vd , Vn , Vm ) ; <nl> + } else if ( opc = = 9 & & op1 ) { <nl> + / / vmul . i < size > Qd , Qm , Qn . <nl> + out_buffer_pos_ + = SNPrintF ( out_buffer_ + out_buffer_pos_ , <nl> + " vmul . i % d q % d , q % d , q % d " , size , Vd , Vn , Vm ) ; <nl> + } else if ( ! u & & opc = = 0xA ) { <nl> + / / vpmin / vpmax . s < size > Dd , Dm , Dn . <nl> + const char * op = op1 ? " vpmin " : " vpmax " ; <nl> + out_buffer_pos_ + = SNPrintF ( out_buffer_ + out_buffer_pos_ , <nl> + " % s . s % d d % d , d % d , d % d " , op , size , Vd , Vn , Vm ) ; <nl> + } else if ( ! u & & opc = = 0xB ) { <nl> + / / vpadd . i < size > Dd , Dm , Dn . <nl> + out_buffer_pos_ + = SNPrintF ( out_buffer_ + out_buffer_pos_ , <nl> + " vpadd . i % d d % d , d % d , d % d " , size , Vd , Vn , Vm ) ; <nl> + } else if ( ! u & & opc = = 0xD & & ! op1 ) { <nl> + const char * op = ( instr - > Bits ( 21 , 20 ) = = 0 ) ? " vadd " : " vsub " ; <nl> + / / vadd / vsub . f32 Qd , Qm , Qn . <nl> + out_buffer_pos_ + = SNPrintF ( out_buffer_ + out_buffer_pos_ , <nl> + " % s . f32 q % d , q % d , q % d " , op , Vd , Vn , Vm ) ; <nl> + } else if ( ! u & & opc = = 0xE & & ! sz & & ! op1 ) { <nl> + / / vceq . f32 Qd , Qm , Qn . <nl> + out_buffer_pos_ + = SNPrintF ( out_buffer_ + out_buffer_pos_ , <nl> + " vceq . f32 q % d , q % d , q % d " , Vd , Vn , Vm ) ; <nl> + } else if ( ! u & & opc = = 0xF & & op1 ) { <nl> + / / vrecps / vrsqrts . f32 Qd , Qm , Qn . <nl> + const char * op = instr - > Bit ( 21 ) = = 0 ? " vrecps " : " vrsqrts " ; <nl> + out_buffer_pos_ + = SNPrintF ( out_buffer_ + out_buffer_pos_ , <nl> + " % s . f32 q % d , q % d , q % d " , op , Vd , Vn , Vm ) ; <nl> + } else if ( ! u & & opc = = 0xF & & ! op1 ) { <nl> + / / vmin / max . f32 Qd , Qm , Qn . <nl> + const char * op = instr - > Bit ( 21 ) = = 1 ? " vmin " : " vmax " ; <nl> + out_buffer_pos_ + = SNPrintF ( out_buffer_ + out_buffer_pos_ , <nl> + " % s . f32 q % d , q % d , q % d " , op , Vd , Vn , Vm ) ; <nl> + <nl> + } else if ( u & & opc = = 0 & & op1 ) { <nl> + / / vqadd . u < size > Qd , Qm , Qn . <nl> + out_buffer_pos_ + = SNPrintF ( out_buffer_ + out_buffer_pos_ , <nl> + " vqadd . u % d q % d , q % d , q % d " , size , Vd , Vn , Vm ) ; <nl> + } else if ( u & & opc = = 1 & & sz = = 1 & & op1 ) { <nl> + out_buffer_pos_ + = SNPrintF ( out_buffer_ + out_buffer_pos_ , <nl> + " vbsl q % d , q % d , q % d " , Vd , Vn , Vm ) ; <nl> + } else if ( u & & opc = = 1 & & sz = = 0 & & q & & op1 ) { <nl> + / / veor Qd , Qn , Qm <nl> + out_buffer_pos_ + = SNPrintF ( out_buffer_ + out_buffer_pos_ , <nl> + " veor q % d , q % d , q % d " , Vd , Vn , Vm ) ; <nl> + } else if ( u & & opc = = 1 & & sz = = 0 & & ! q & & op1 ) { <nl> + / / veor Dd , Dn , Dm <nl> + out_buffer_pos_ + = SNPrintF ( out_buffer_ + out_buffer_pos_ , <nl> + " veor d % d , d % d , d % d " , Vd , Vn , Vm ) ; <nl> + <nl> + } else if ( u & & opc = = 1 & & ! op1 ) { <nl> + / / vrhadd . u < size > Qd , Qm , Qn . <nl> + out_buffer_pos_ + = SNPrintF ( out_buffer_ + out_buffer_pos_ , <nl> + " vrhadd . u % d q % d , q % d , q % d " , size , Vd , Vn , Vm ) ; <nl> + } else if ( u & & opc = = 2 & & op1 ) { <nl> + / / vqsub . u < size > Qd , Qm , Qn . <nl> + out_buffer_pos_ + = SNPrintF ( out_buffer_ + out_buffer_pos_ , <nl> + " vqsub . u % d q % d , q % d , q % d " , size , Vd , Vn , Vm ) ; <nl> + } else if ( u & & opc = = 3 ) { <nl> + const char * op = op1 ? " vcge " : " vcgt " ; <nl> + / / vcge / vcgt . u < size > Qd , Qm , Qn . <nl> + out_buffer_pos_ + = SNPrintF ( out_buffer_ + out_buffer_pos_ , <nl> + " % s . u % d q % d , q % d , q % d " , op , size , Vd , Vn , Vm ) ; <nl> + } else if ( u & & opc = = 4 & & ! op1 ) { <nl> + / / vshl . u < size > Qd , Qm , Qn . <nl> + out_buffer_pos_ + = SNPrintF ( out_buffer_ + out_buffer_pos_ , <nl> + " vshl . u % d q % d , q % d , q % d " , size , Vd , Vm , Vn ) ; <nl> + } else if ( u & & opc = = 6 ) { <nl> + / / vmin / vmax . u < size > Qd , Qm , Qn . <nl> + const char * op = op1 ? " vmin " : " vmax " ; <nl> + out_buffer_pos_ + = SNPrintF ( out_buffer_ + out_buffer_pos_ , <nl> + " % s . u % d q % d , q % d , q % d " , op , size , Vd , Vn , Vm ) ; <nl> + } else if ( u & & opc = = 8 & & op1 ) { <nl> + out_buffer_pos_ + = SNPrintF ( out_buffer_ + out_buffer_pos_ , <nl> + " vceq . i % d q % d , q % d , q % d " , size , Vd , Vn , Vm ) ; <nl> + } else if ( u & & opc = = 8 & & ! op1 ) { <nl> + out_buffer_pos_ + = SNPrintF ( out_buffer_ + out_buffer_pos_ , <nl> + " vsub . i % d q % d , q % d , q % d " , size , Vd , Vn , Vm ) ; <nl> + } else if ( u & & opc = = 0xA ) { <nl> + / / vpmin / vpmax . u < size > Dd , Dm , Dn . <nl> + const char * op = op1 ? " vpmin " : " vpmax " ; <nl> + out_buffer_pos_ + = SNPrintF ( out_buffer_ + out_buffer_pos_ , <nl> + " % s . u % d d % d , d % d , d % d " , op , size , Vd , Vn , Vm ) ; <nl> + } else if ( u & & opc = = 0xD & & sz = = 0 & & q & & op1 ) { <nl> + / / vmul . f32 Qd , Qm , Qn <nl> + out_buffer_pos_ + = SNPrintF ( out_buffer_ + out_buffer_pos_ , <nl> + " vmul . f32 q % d , q % d , q % d " , Vd , Vn , Vm ) ; <nl> + } else if ( u & & opc = = 0xD & & sz = = 0 & & ! q & & ! op1 ) { <nl> + / / vpadd . f32 Dd , Dm , Dn . <nl> + out_buffer_pos_ + = SNPrintF ( out_buffer_ + out_buffer_pos_ , <nl> + " vpadd . f32 d % d , d % d , d % d " , Vd , Vn , Vm ) ; <nl> + } else if ( u & & opc = = 0xE & & ! op1 ) { <nl> + const char * op = ( instr - > Bit ( 21 ) = = 0 ) ? " vcge " : " vcgt " ; <nl> + / / vcge / vcgt . f32 Qd , Qm , Qn . <nl> + out_buffer_pos_ + = SNPrintF ( out_buffer_ + out_buffer_pos_ , <nl> + " % s . f32 q % d , q % d , q % d " , op , Vd , Vn , Vm ) ; <nl> + } else { <nl> + Unknown ( instr ) ; <nl> + } <nl> + } else if ( op0 = = 1 & & op1 = = 0 ) { <nl> + DecodeAdvancedSIMDTwoOrThreeRegisters ( instr ) ; <nl> + } else if ( op0 = = 1 & & op1 = = 1 ) { <nl> + / / Advanced SIMD shifts and immediate generation . <nl> + if ( instr - > Bits ( 21 , 19 ) = = 0 & & instr - > Bit ( 7 ) = = 0 ) { <nl> + / / Advanced SIMD one register and modified immediate . <nl> + DecodeVmovImmediate ( instr ) ; <nl> + } else { <nl> + / / Advanced SIMD two registers and shift amount . <nl> + int u = instr - > Bit ( 24 ) ; <nl> + int imm3H = instr - > Bits ( 21 , 19 ) ; <nl> + int imm3L = instr - > Bits ( 18 , 16 ) ; <nl> + int opc = instr - > Bits ( 11 , 8 ) ; <nl> + int l = instr - > Bit ( 7 ) ; <nl> + int q = instr - > Bit ( 6 ) ; <nl> + int imm3H_L = imm3H < < 1 | l ; <nl> + <nl> + if ( imm3H_L ! = 0 & & opc = = 0 ) { <nl> / / vshr . s < size > Qd , Qm , shift <nl> - int imm7 = instr - > Bits ( 21 , 16 ) ; <nl> - if ( instr - > Bit ( 7 ) ! = 0 ) imm7 + = 64 ; <nl> + int imm7 = ( l < < 6 ) | instr - > Bits ( 21 , 16 ) ; <nl> int size = base : : bits : : RoundDownToPowerOfTwo32 ( imm7 ) ; <nl> int shift = 2 * size - imm7 ; <nl> int Vd = instr - > VFPDRegValue ( kSimd128Precision ) ; <nl> int Vm = instr - > VFPMRegValue ( kSimd128Precision ) ; <nl> out_buffer_pos_ + = <nl> - SNPrintF ( out_buffer_ + out_buffer_pos_ , " vshr . s % d q % d , q % d , # % d " , <nl> - size , Vd , Vm , shift ) ; <nl> - } else if ( instr - > Bits ( 11 , 8 ) = = 0xC & & instr - > Bit ( 6 ) = = 0 & & <nl> - instr - > Bit ( 4 ) = = 0 ) { <nl> - / / vmull . s < size > Qd , Dn , Dm <nl> + SNPrintF ( out_buffer_ + out_buffer_pos_ , " vshr . % s % d q % d , q % d , # % d " , <nl> + u ? " u " : " s " , size , Vd , Vm , shift ) ; <nl> + } else if ( imm3H_L ! = 0 & & imm3L = = 0 & & opc = = 0b1010 & & ! q ) { <nl> + / / vmovl <nl> + if ( ( instr - > VdValue ( ) & 1 ) ! = 0 ) Unknown ( instr ) ; <nl> int Vd = instr - > VFPDRegValue ( kSimd128Precision ) ; <nl> - int Vn = instr - > VFPNRegValue ( kDoublePrecision ) ; <nl> int Vm = instr - > VFPMRegValue ( kDoublePrecision ) ; <nl> - int size = 8 < < instr - > Bits ( 21 , 20 ) ; <nl> + int imm3H = instr - > Bits ( 21 , 19 ) ; <nl> out_buffer_pos_ + = <nl> - SNPrintF ( out_buffer_ + out_buffer_pos_ , " vmull . s % d q % d , d % d , d % d " , <nl> - size , Vd , Vn , Vm ) ; <nl> - } else { <nl> - Unknown ( instr ) ; <nl> - } <nl> - break ; <nl> - case 6 : { <nl> - int Vd , Vm , Vn ; <nl> - if ( instr - > Bit ( 6 ) = = 0 ) { <nl> - Vd = instr - > VFPDRegValue ( kDoublePrecision ) ; <nl> - Vm = instr - > VFPMRegValue ( kDoublePrecision ) ; <nl> - Vn = instr - > VFPNRegValue ( kDoublePrecision ) ; <nl> - } else { <nl> - Vd = instr - > VFPDRegValue ( kSimd128Precision ) ; <nl> - Vm = instr - > VFPMRegValue ( kSimd128Precision ) ; <nl> - Vn = instr - > VFPNRegValue ( kSimd128Precision ) ; <nl> - } <nl> - int size = kBitsPerByte * ( 1 < < instr - > Bits ( 21 , 20 ) ) ; <nl> - switch ( instr - > Bits ( 11 , 8 ) ) { <nl> - case 0x0 : { <nl> - if ( instr - > Bit ( 4 ) = = 1 ) { <nl> - / / vqadd . u < size > Qd , Qm , Qn . <nl> - out_buffer_pos_ + = <nl> - SNPrintF ( out_buffer_ + out_buffer_pos_ , <nl> - " vqadd . u % d q % d , q % d , q % d " , size , Vd , Vn , Vm ) ; <nl> - } else { <nl> - Unknown ( instr ) ; <nl> - } <nl> - break ; <nl> - } <nl> - case 0x1 : { <nl> - if ( instr - > Bits ( 21 , 20 ) = = 1 & & instr - > Bit ( 4 ) = = 1 ) { <nl> - out_buffer_pos_ + = SNPrintF ( out_buffer_ + out_buffer_pos_ , <nl> - " vbsl q % d , q % d , q % d " , Vd , Vn , Vm ) ; <nl> - } else if ( instr - > Bits ( 21 , 20 ) = = 0 & & instr - > Bit ( 4 ) = = 1 ) { <nl> - if ( instr - > Bit ( 6 ) = = 0 ) { <nl> - / / veor Dd , Dn , Dm <nl> - out_buffer_pos_ + = SNPrintF ( out_buffer_ + out_buffer_pos_ , <nl> - " veor d % d , d % d , d % d " , Vd , Vn , Vm ) ; <nl> - <nl> - } else { <nl> - / / veor Qd , Qn , Qm <nl> - out_buffer_pos_ + = SNPrintF ( out_buffer_ + out_buffer_pos_ , <nl> - " veor q % d , q % d , q % d " , Vd , Vn , Vm ) ; <nl> - } <nl> - } else if ( instr - > Bit ( 4 ) = = 0 ) { <nl> - if ( instr - > Bit ( 6 ) = = 1 ) { <nl> - / / vrhadd . u < size > Qd , Qm , Qn . <nl> - out_buffer_pos_ + = <nl> - SNPrintF ( out_buffer_ + out_buffer_pos_ , <nl> - " vrhadd . u % d q % d , q % d , q % d " , size , Vd , Vn , Vm ) ; <nl> - } else { <nl> - / / vrhadd . u < size > Dd , Dm , Dn . <nl> - Unknown ( instr ) ; <nl> - } <nl> - } else { <nl> - Unknown ( instr ) ; <nl> - } <nl> - break ; <nl> - } <nl> - case 0x2 : { <nl> - if ( instr - > Bit ( 4 ) = = 1 ) { <nl> - / / vqsub . u < size > Qd , Qm , Qn . <nl> - out_buffer_pos_ + = <nl> - SNPrintF ( out_buffer_ + out_buffer_pos_ , <nl> - " vqsub . u % d q % d , q % d , q % d " , size , Vd , Vn , Vm ) ; <nl> - } else { <nl> - Unknown ( instr ) ; <nl> - } <nl> - break ; <nl> - } <nl> - case 0x3 : { <nl> - const char * op = ( instr - > Bit ( 4 ) = = 1 ) ? " vcge " : " vcgt " ; <nl> - / / vcge / vcgt . u < size > Qd , Qm , Qn . <nl> - out_buffer_pos_ + = <nl> - SNPrintF ( out_buffer_ + out_buffer_pos_ , " % s . u % d q % d , q % d , q % d " , <nl> - op , size , Vd , Vn , Vm ) ; <nl> - break ; <nl> - } <nl> - case 0x4 : { <nl> - if ( instr - > Bit ( 4 ) = = 0 ) { <nl> - / / vshl . u < size > Qd , Qm , Qn . <nl> - out_buffer_pos_ + = <nl> - SNPrintF ( out_buffer_ + out_buffer_pos_ , <nl> - " vshl . u % d q % d , q % d , q % d " , size , Vd , Vm , Vn ) ; <nl> - } else { <nl> - Unknown ( instr ) ; <nl> - } <nl> - break ; <nl> - } <nl> - case 0x6 : { <nl> - / / vmin / vmax . u < size > Qd , Qm , Qn . <nl> - const char * op = instr - > Bit ( 4 ) = = 1 ? " vmin " : " vmax " ; <nl> - out_buffer_pos_ + = <nl> - SNPrintF ( out_buffer_ + out_buffer_pos_ , " % s . u % d q % d , q % d , q % d " , <nl> - op , size , Vd , Vn , Vm ) ; <nl> - break ; <nl> - } <nl> - case 0x8 : { <nl> - if ( instr - > Bit ( 4 ) = = 0 ) { <nl> - out_buffer_pos_ + = <nl> - SNPrintF ( out_buffer_ + out_buffer_pos_ , <nl> - " vsub . i % d q % d , q % d , q % d " , size , Vd , Vn , Vm ) ; <nl> - } else { <nl> - out_buffer_pos_ + = <nl> - SNPrintF ( out_buffer_ + out_buffer_pos_ , <nl> - " vceq . i % d q % d , q % d , q % d " , size , Vd , Vn , Vm ) ; <nl> - } <nl> - break ; <nl> - } <nl> - case 0xA : { <nl> - / / vpmin / vpmax . u < size > Dd , Dm , Dn . <nl> - const char * op = instr - > Bit ( 4 ) = = 1 ? " vpmin " : " vpmax " ; <nl> - out_buffer_pos_ + = <nl> - SNPrintF ( out_buffer_ + out_buffer_pos_ , " % s . u % d d % d , d % d , d % d " , <nl> - op , size , Vd , Vn , Vm ) ; <nl> - break ; <nl> - } <nl> - case 0xD : { <nl> - if ( instr - > Bits ( 21 , 20 ) = = 0 & & instr - > Bit ( 6 ) = = 1 & & <nl> - instr - > Bit ( 4 ) = = 1 ) { <nl> - / / vmul . f32 Qd , Qm , Qn <nl> - out_buffer_pos_ + = SNPrintF ( out_buffer_ + out_buffer_pos_ , <nl> - " vmul . f32 q % d , q % d , q % d " , Vd , Vn , Vm ) ; <nl> - } else if ( instr - > Bits ( 21 , 20 ) = = 0 & & instr - > Bit ( 6 ) = = 0 & & <nl> - instr - > Bit ( 4 ) = = 0 ) { <nl> - / / vpadd . f32 Dd , Dm , Dn . <nl> - out_buffer_pos_ + = SNPrintF ( out_buffer_ + out_buffer_pos_ , <nl> - " vpadd . f32 d % d , d % d , d % d " , Vd , Vn , Vm ) ; <nl> - } else { <nl> - Unknown ( instr ) ; <nl> - } <nl> - break ; <nl> - } <nl> - case 0xE : { <nl> - if ( instr - > Bit ( 20 ) = = 0 & & instr - > Bit ( 4 ) = = 0 ) { <nl> - const char * op = ( instr - > Bit ( 21 ) = = 0 ) ? " vcge " : " vcgt " ; <nl> - / / vcge / vcgt . f32 Qd , Qm , Qn . <nl> - out_buffer_pos_ + = SNPrintF ( out_buffer_ + out_buffer_pos_ , <nl> - " % s . f32 q % d , q % d , q % d " , op , Vd , Vn , Vm ) ; <nl> - } else { <nl> - Unknown ( instr ) ; <nl> - } <nl> - break ; <nl> - } <nl> - default : <nl> - Unknown ( instr ) ; <nl> - break ; <nl> - } <nl> - break ; <nl> - } <nl> - case 7 : <nl> - if ( ( instr - > Bits ( 18 , 16 ) = = 0 ) & & ( instr - > Bits ( 11 , 6 ) = = 0x28 ) & & <nl> - ( instr - > Bit ( 4 ) = = 1 ) ) { <nl> - / / vmovl unsigned <nl> - if ( ( instr - > VdValue ( ) & 1 ) ! = 0 ) Unknown ( instr ) ; <nl> - int Vd = ( instr - > Bit ( 22 ) < < 3 ) | ( instr - > VdValue ( ) > > 1 ) ; <nl> - int Vm = ( instr - > Bit ( 5 ) < < 4 ) | instr - > VmValue ( ) ; <nl> - int imm3 = instr - > Bits ( 21 , 19 ) ; <nl> - out_buffer_pos_ + = SNPrintF ( out_buffer_ + out_buffer_pos_ , <nl> - " vmovl . u % d q % d , d % d " , imm3 * 8 , Vd , Vm ) ; <nl> - } else if ( instr - > Opc1Value ( ) = = 7 & & instr - > Bit ( 4 ) = = 0 ) { <nl> - if ( instr - > Bits ( 11 , 7 ) = = 0x18 ) { <nl> - int Vm = instr - > VFPMRegValue ( kDoublePrecision ) ; <nl> - int imm4 = instr - > Bits ( 19 , 16 ) ; <nl> - int size = 0 , index = 0 ; <nl> - if ( ( imm4 & 0x1 ) ! = 0 ) { <nl> - size = 8 ; <nl> - index = imm4 > > 1 ; <nl> - } else if ( ( imm4 & 0x2 ) ! = 0 ) { <nl> - size = 16 ; <nl> - index = imm4 > > 2 ; <nl> - } else { <nl> - size = 32 ; <nl> - index = imm4 > > 3 ; <nl> - } <nl> - if ( instr - > Bit ( 6 ) = = 0 ) { <nl> - int Vd = instr - > VFPDRegValue ( kDoublePrecision ) ; <nl> - out_buffer_pos_ + = <nl> - SNPrintF ( out_buffer_ + out_buffer_pos_ , " vdup . % i d % d , d % d [ % d ] " , <nl> - size , Vd , Vm , index ) ; <nl> - } else { <nl> - int Vd = instr - > VFPDRegValue ( kSimd128Precision ) ; <nl> - out_buffer_pos_ + = <nl> - SNPrintF ( out_buffer_ + out_buffer_pos_ , " vdup . % i q % d , d % d [ % d ] " , <nl> - size , Vd , Vm , index ) ; <nl> - } <nl> - } else if ( instr - > Bits ( 11 , 10 ) = = 0x2 ) { <nl> - int Vd = instr - > VFPDRegValue ( kDoublePrecision ) ; <nl> - int Vn = instr - > VFPNRegValue ( kDoublePrecision ) ; <nl> - int Vm = instr - > VFPMRegValue ( kDoublePrecision ) ; <nl> - int len = instr - > Bits ( 9 , 8 ) ; <nl> - NeonListOperand list ( DwVfpRegister : : from_code ( Vn ) , len + 1 ) ; <nl> - out_buffer_pos_ + = <nl> - SNPrintF ( out_buffer_ + out_buffer_pos_ , " % s d % d , " , <nl> - instr - > Bit ( 6 ) = = 0 ? " vtbl . 8 " : " vtbx . 8 " , Vd ) ; <nl> - FormatNeonList ( Vn , list . type ( ) ) ; <nl> - Print ( " , " ) ; <nl> - PrintDRegister ( Vm ) ; <nl> - } else if ( instr - > Bits ( 17 , 16 ) = = 0x2 & & instr - > Bits ( 11 , 8 ) = = 0x2 & & <nl> - instr - > Bits ( 7 , 6 ) ! = 0 ) { <nl> - / / vqmov { u } n . < type > < size > Dd , Qm . <nl> - int Vd = instr - > VFPDRegValue ( kDoublePrecision ) ; <nl> - int Vm = instr - > VFPMRegValue ( kSimd128Precision ) ; <nl> - int op = instr - > Bits ( 7 , 6 ) ; <nl> - const char * name = op = = 0b01 ? " vqmovun " : " vqmovn " ; <nl> - char type = op = = 0b11 ? ' u ' : ' s ' ; <nl> - int size = 2 * kBitsPerByte * ( 1 < < instr - > Bits ( 19 , 18 ) ) ; <nl> - out_buffer_pos_ + = <nl> - SNPrintF ( out_buffer_ + out_buffer_pos_ , " % s . % c % i d % d , q % d " , name , <nl> - type , size , Vd , Vm ) ; <nl> - } else if ( instr - > Bits ( 17 , 16 ) = = 0x2 & & instr - > Bit ( 10 ) = = 1 ) { <nl> - / / NEON vrintm , vrintn , vrintp , vrintz . <nl> - bool dp_op = instr - > Bit ( 6 ) = = 0 ; <nl> - int rounding_mode = instr - > Bits ( 9 , 7 ) ; <nl> - switch ( rounding_mode ) { <nl> - case 0 : <nl> - if ( dp_op ) { <nl> - Format ( instr , " vrintn . f32 ' Dd , ' Dm " ) ; <nl> - } else { <nl> - Format ( instr , " vrintn . f32 ' Qd , ' Qm " ) ; <nl> - } <nl> - break ; <nl> - case 3 : <nl> - if ( dp_op ) { <nl> - Format ( instr , " vrintz . f32 ' Dd , ' Dm " ) ; <nl> - } else { <nl> - Format ( instr , " vrintz . f32 ' Qd , ' Qm " ) ; <nl> - } <nl> - break ; <nl> - case 5 : <nl> - if ( dp_op ) { <nl> - Format ( instr , " vrintm . f32 ' Dd , ' Dm " ) ; <nl> - } else { <nl> - Format ( instr , " vrintm . f32 ' Qd , ' Qm " ) ; <nl> - } <nl> - break ; <nl> - case 7 : <nl> - if ( dp_op ) { <nl> - Format ( instr , " vrintp . f32 ' Dd , ' Dm " ) ; <nl> - } else { <nl> - Format ( instr , " vrintp . f32 ' Qd , ' Qm " ) ; <nl> - } <nl> - break ; <nl> - default : <nl> - UNIMPLEMENTED ( ) ; <nl> - } <nl> - } else { <nl> - int Vd , Vm ; <nl> - if ( instr - > Bit ( 6 ) = = 0 ) { <nl> - Vd = instr - > VFPDRegValue ( kDoublePrecision ) ; <nl> - Vm = instr - > VFPMRegValue ( kDoublePrecision ) ; <nl> - } else { <nl> - Vd = instr - > VFPDRegValue ( kSimd128Precision ) ; <nl> - Vm = instr - > VFPMRegValue ( kSimd128Precision ) ; <nl> - } <nl> - if ( instr - > Bits ( 17 , 16 ) = = 0x2 & & instr - > Bits ( 11 , 7 ) = = 0 ) { <nl> - if ( instr - > Bit ( 6 ) = = 0 ) { <nl> - out_buffer_pos_ + = SNPrintF ( out_buffer_ + out_buffer_pos_ , <nl> - " vswp d % d , d % d " , Vd , Vm ) ; <nl> - } else { <nl> - out_buffer_pos_ + = SNPrintF ( out_buffer_ + out_buffer_pos_ , <nl> - " vswp q % d , q % d " , Vd , Vm ) ; <nl> - } <nl> - } else if ( instr - > Bits ( 19 , 16 ) = = 0 & & instr - > Bits ( 11 , 6 ) = = 0x17 ) { <nl> - out_buffer_pos_ + = SNPrintF ( out_buffer_ + out_buffer_pos_ , <nl> - " vmvn q % d , q % d " , Vd , Vm ) ; <nl> - } else if ( instr - > Bits ( 19 , 16 ) = = 0xB & & instr - > Bits ( 11 , 9 ) = = 0x3 & & <nl> - instr - > Bit ( 6 ) = = 1 ) { <nl> - const char * suffix = nullptr ; <nl> - int op = instr - > Bits ( 8 , 7 ) ; <nl> - switch ( op ) { <nl> - case 0 : <nl> - suffix = " f32 . s32 " ; <nl> - break ; <nl> - case 1 : <nl> - suffix = " f32 . u32 " ; <nl> - break ; <nl> - case 2 : <nl> - suffix = " s32 . f32 " ; <nl> - break ; <nl> - case 3 : <nl> - suffix = " u32 . f32 " ; <nl> - break ; <nl> - } <nl> - out_buffer_pos_ + = SNPrintF ( out_buffer_ + out_buffer_pos_ , <nl> - " vcvt . % s q % d , q % d " , suffix , Vd , Vm ) ; <nl> - } else if ( instr - > Bits ( 17 , 16 ) = = 0x2 & & instr - > Bits ( 11 , 8 ) = = 0x1 ) { <nl> - int size = kBitsPerByte * ( 1 < < instr - > Bits ( 19 , 18 ) ) ; <nl> - const char * op = instr - > Bit ( 7 ) ! = 0 ? " vzip " : " vuzp " ; <nl> - if ( instr - > Bit ( 6 ) = = 0 ) { <nl> - / / vzip / vuzp . < size > Dd , Dm . <nl> - out_buffer_pos_ + = SNPrintF ( out_buffer_ + out_buffer_pos_ , <nl> - " % s . % d d % d , d % d " , op , size , Vd , Vm ) ; <nl> - } else { <nl> - / / vzip / vuzp . < size > Qd , Qm . <nl> - out_buffer_pos_ + = SNPrintF ( out_buffer_ + out_buffer_pos_ , <nl> - " % s . % d q % d , q % d " , op , size , Vd , Vm ) ; <nl> - } <nl> - } else if ( instr - > Bits ( 17 , 16 ) = = 0 & & instr - > Bits ( 11 , 9 ) = = 0 & & <nl> - instr - > Bit ( 6 ) = = 1 ) { <nl> - int size = kBitsPerByte * ( 1 < < instr - > Bits ( 19 , 18 ) ) ; <nl> - int op = kBitsPerByte <nl> - < < ( static_cast < int > ( Neon64 ) - instr - > Bits ( 8 , 7 ) ) ; <nl> - / / vrev < op > . < size > Qd , Qm . <nl> - out_buffer_pos_ + = SNPrintF ( out_buffer_ + out_buffer_pos_ , <nl> - " vrev % d . % d q % d , q % d " , op , size , Vd , Vm ) ; <nl> - } else if ( instr - > Bits ( 17 , 16 ) = = 0x2 & & instr - > Bits ( 11 , 7 ) = = 0x1 ) { <nl> - int size = kBitsPerByte * ( 1 < < instr - > Bits ( 19 , 18 ) ) ; <nl> - if ( instr - > Bit ( 6 ) = = 0 ) { <nl> - / / vtrn . < size > Dd , Dm . <nl> - out_buffer_pos_ + = SNPrintF ( out_buffer_ + out_buffer_pos_ , <nl> - " vtrn . % d d % d , d % d " , size , Vd , Vm ) ; <nl> - } else { <nl> - / / vtrn . < size > Qd , Qm . <nl> - out_buffer_pos_ + = SNPrintF ( out_buffer_ + out_buffer_pos_ , <nl> - " vtrn . % d q % d , q % d " , size , Vd , Vm ) ; <nl> - } <nl> - } else if ( instr - > Bits ( 17 , 16 ) = = 0x1 & & instr - > Bit ( 11 ) = = 0 & & <nl> - instr - > Bit ( 6 ) = = 1 ) { <nl> - int size = kBitsPerByte * ( 1 < < instr - > Bits ( 19 , 18 ) ) ; <nl> - char type = instr - > Bit ( 10 ) ! = 0 ? ' f ' : ' s ' ; <nl> - if ( instr - > Bits ( 9 , 6 ) = = 0xD ) { <nl> - / / vabs < type > . < size > Qd , Qm . <nl> - out_buffer_pos_ + = <nl> - SNPrintF ( out_buffer_ + out_buffer_pos_ , " vabs . % c % d q % d , q % d " , <nl> - type , size , Vd , Vm ) ; <nl> - } else if ( instr - > Bits ( 9 , 6 ) = = 0xF ) { <nl> - / / vneg < type > . < size > Qd , Qm . <nl> - out_buffer_pos_ + = <nl> - SNPrintF ( out_buffer_ + out_buffer_pos_ , " vneg . % c % d q % d , q % d " , <nl> - type , size , Vd , Vm ) ; <nl> - } else { <nl> - Unknown ( instr ) ; <nl> - } <nl> - } else if ( instr - > Bits ( 19 , 18 ) = = 0x2 & & instr - > Bits ( 11 , 8 ) = = 0x5 & & <nl> - instr - > Bit ( 6 ) = = 1 ) { <nl> - / / vrecpe / vrsqrte . f32 Qd , Qm . <nl> - const char * op = instr - > Bit ( 7 ) = = 0 ? " vrecpe " : " vrsqrte " ; <nl> - out_buffer_pos_ + = SNPrintF ( out_buffer_ + out_buffer_pos_ , <nl> - " % s . f32 q % d , q % d " , op , Vd , Vm ) ; <nl> - } else { <nl> - Unknown ( instr ) ; <nl> - } <nl> - } <nl> - } else if ( instr - > Bits ( 11 , 8 ) = = 0 & & instr - > Bit ( 4 ) = = 1 & & <nl> - instr - > Bit ( 6 ) = = 1 ) { <nl> - / / vshr . u < size > Qd , Qm , shift <nl> - int imm7 = instr - > Bits ( 21 , 16 ) ; <nl> - if ( instr - > Bit ( 7 ) ! = 0 ) imm7 + = 64 ; <nl> + SNPrintF ( out_buffer_ + out_buffer_pos_ , " vmovl . % s % d q % d , d % d " , <nl> + u ? " u " : " s " , imm3H * 8 , Vd , Vm ) ; <nl> + } else if ( ! u & & imm3H_L ! = 0 & & opc = = 0b0101 ) { <nl> + / / vshl . i < size > Qd , Qm , shift <nl> + int imm7 = ( l < < 6 ) | instr - > Bits ( 21 , 16 ) ; <nl> int size = base : : bits : : RoundDownToPowerOfTwo32 ( imm7 ) ; <nl> - int shift = 2 * size - imm7 ; <nl> + int shift = imm7 - size ; <nl> int Vd = instr - > VFPDRegValue ( kSimd128Precision ) ; <nl> int Vm = instr - > VFPMRegValue ( kSimd128Precision ) ; <nl> out_buffer_pos_ + = <nl> - SNPrintF ( out_buffer_ + out_buffer_pos_ , " vshr . u % d q % d , q % d , # % d " , <nl> + SNPrintF ( out_buffer_ + out_buffer_pos_ , " vshl . i % d q % d , q % d , # % d " , <nl> size , Vd , Vm , shift ) ; <nl> - } else if ( instr - > Bit ( 10 ) = = 1 & & instr - > Bit ( 6 ) = = 0 & & <nl> - instr - > Bit ( 4 ) = = 1 ) { <nl> + } else if ( u & & imm3H_L ! = 0 & & ( opc & 0b1110 ) = = 0b0100 ) { <nl> / / vsli . < size > Dd , Dm , shift <nl> / / vsri . < size > Dd , Dm , shift <nl> - int imm7 = instr - > Bits ( 21 , 16 ) ; <nl> - if ( instr - > Bit ( 7 ) ! = 0 ) imm7 + = 64 ; <nl> + int imm7 = ( l < < 6 ) | instr - > Bits ( 21 , 16 ) ; <nl> int size = base : : bits : : RoundDownToPowerOfTwo32 ( imm7 ) ; <nl> int shift ; <nl> char direction ; <nl> void Decoder : : DecodeSpecialCondition ( Instruction * instr ) { <nl> out_buffer_pos_ + = <nl> SNPrintF ( out_buffer_ + out_buffer_pos_ , " vs % ci . % d d % d , d % d , # % d " , <nl> direction , size , Vd , Vm , shift ) ; <nl> - } else if ( instr - > Bits ( 11 , 8 ) = = 0x8 & & instr - > Bit ( 6 ) = = 0 & & <nl> - instr - > Bit ( 4 ) = = 0 ) { <nl> - / / vmlal . u < size > < Qd > , < Dn > , < Dm > <nl> - int Vd = instr - > VFPDRegValue ( kSimd128Precision ) ; <nl> - int Vn = instr - > VFPNRegValue ( kDoublePrecision ) ; <nl> - int Vm = instr - > VFPMRegValue ( kDoublePrecision ) ; <nl> - int size = 8 < < instr - > Bits ( 21 , 20 ) ; <nl> + } <nl> + } <nl> + } else { <nl> + Unknown ( instr ) ; <nl> + } <nl> + } <nl> + <nl> + void Decoder : : DecodeAdvancedSIMDTwoOrThreeRegisters ( Instruction * instr ) { <nl> + / / Advanced SIMD two registers , or three registers of different lengths . <nl> + int op0 = instr - > Bit ( 24 ) ; <nl> + int op1 = instr - > Bits ( 21 , 20 ) ; <nl> + int op2 = instr - > Bits ( 11 , 10 ) ; <nl> + int op3 = instr - > Bit ( 6 ) ; <nl> + if ( ! op0 & & op1 = = 0b11 ) { <nl> + / / vext . 8 Qd , Qm , Qn , imm4 <nl> + int imm4 = instr - > Bits ( 11 , 8 ) ; <nl> + int Vd = instr - > VFPDRegValue ( kSimd128Precision ) ; <nl> + int Vm = instr - > VFPMRegValue ( kSimd128Precision ) ; <nl> + int Vn = instr - > VFPNRegValue ( kSimd128Precision ) ; <nl> + out_buffer_pos_ + = SNPrintF ( out_buffer_ + out_buffer_pos_ , <nl> + " vext . 8 q % d , q % d , q % d , # % d " , Vd , Vn , Vm , imm4 ) ; <nl> + } else if ( op0 & & op1 = = 0b11 & & ( ( op2 > > 1 ) = = 0 ) ) { <nl> + / / Advanced SIMD two registers misc <nl> + int size = instr - > Bits ( 19 , 18 ) ; <nl> + int opc1 = instr - > Bits ( 17 , 16 ) ; <nl> + int opc2 = instr - > Bits ( 10 , 7 ) ; <nl> + int q = instr - > Bit ( 6 ) ; <nl> + <nl> + int Vd , Vm ; <nl> + if ( q ) { <nl> + Vd = instr - > VFPDRegValue ( kSimd128Precision ) ; <nl> + Vm = instr - > VFPMRegValue ( kSimd128Precision ) ; <nl> + } else { <nl> + Vd = instr - > VFPDRegValue ( kDoublePrecision ) ; <nl> + Vm = instr - > VFPMRegValue ( kDoublePrecision ) ; <nl> + } <nl> + <nl> + if ( opc1 = = 0 & & ( opc2 > > 2 ) = = 0 ) { <nl> + int esize = kBitsPerByte * ( 1 < < size ) ; <nl> + int op = kBitsPerByte < < ( static_cast < int > ( Neon64 ) - instr - > Bits ( 8 , 7 ) ) ; <nl> + / / vrev < op > . < esize > Qd , Qm . <nl> + out_buffer_pos_ + = SNPrintF ( out_buffer_ + out_buffer_pos_ , <nl> + " vrev % d . % d q % d , q % d " , op , esize , Vd , Vm ) ; <nl> + } else if ( size = = 0 & & opc1 = = 0b10 & & opc2 = = 0 ) { <nl> + if ( q ) { <nl> out_buffer_pos_ + = <nl> - SNPrintF ( out_buffer_ + out_buffer_pos_ , " vmlal . u % d q % d , d % d , d % d " , <nl> - size , Vd , Vn , Vm ) ; <nl> - } else if ( instr - > Bits ( 11 , 8 ) = = 0xC & & instr - > Bit ( 6 ) = = 0 & & <nl> - instr - > Bit ( 4 ) = = 0 ) { <nl> - / / vmull . u < size > < Qd > , < Dn > , < Dm > <nl> - int Vd = instr - > VFPDRegValue ( kSimd128Precision ) ; <nl> - int Vn = instr - > VFPNRegValue ( kDoublePrecision ) ; <nl> - int Vm = instr - > VFPMRegValue ( kDoublePrecision ) ; <nl> - int size = 8 < < instr - > Bits ( 21 , 20 ) ; <nl> + SNPrintF ( out_buffer_ + out_buffer_pos_ , " vswp q % d , q % d " , Vd , Vm ) ; <nl> + } else { <nl> out_buffer_pos_ + = <nl> - SNPrintF ( out_buffer_ + out_buffer_pos_ , " vmull . u % d q % d , d % d , d % d " , <nl> - size , Vd , Vn , Vm ) ; <nl> - } else if ( instr - > Bits ( 21 , 19 ) = = 0 & & instr - > Bit ( 7 ) = = 0 & & <nl> - instr - > Bit ( 4 ) = = 1 ) { <nl> - / / One register and a modified immediate value , see ARM DDI 0406C . d <nl> - / / A7 . 4 . 6 . <nl> - DecodeVmovImmediate ( instr ) ; <nl> + SNPrintF ( out_buffer_ + out_buffer_pos_ , " vswp d % d , d % d " , Vd , Vm ) ; <nl> + } <nl> + } else if ( opc1 = = 0 & & opc2 = = 0b1011 ) { <nl> + out_buffer_pos_ + = <nl> + SNPrintF ( out_buffer_ + out_buffer_pos_ , " vmvn q % d , q % d " , Vd , Vm ) ; <nl> + } else if ( opc1 = = 0b01 & & ( opc2 & 0b0111 ) = = 0b110 ) { <nl> + / / vabs < type > . < esize > Qd , Qm . <nl> + int esize = kBitsPerByte * ( 1 < < size ) ; <nl> + char type = instr - > Bit ( 10 ) ! = 0 ? ' f ' : ' s ' ; <nl> + out_buffer_pos_ + = SNPrintF ( out_buffer_ + out_buffer_pos_ , <nl> + " vabs . % c % d q % d , q % d " , type , esize , Vd , Vm ) ; <nl> + } else if ( opc1 = = 0b01 & & ( opc2 & 0b0111 ) = = 0b111 ) { <nl> + / / vneg < type > . < esize > Qd , Qm . <nl> + int esize = kBitsPerByte * ( 1 < < size ) ; <nl> + char type = instr - > Bit ( 10 ) ! = 0 ? ' f ' : ' s ' ; <nl> + out_buffer_pos_ + = SNPrintF ( out_buffer_ + out_buffer_pos_ , <nl> + " vneg . % c % d q % d , q % d " , type , esize , Vd , Vm ) ; <nl> + } else if ( opc1 = = 0b10 & & opc2 = = 0b0001 ) { <nl> + int esize = kBitsPerByte * ( 1 < < size ) ; <nl> + if ( q ) { <nl> + / / vtrn . < esize > Qd , Qm . <nl> + out_buffer_pos_ + = SNPrintF ( out_buffer_ + out_buffer_pos_ , <nl> + " vtrn . % d q % d , q % d " , esize , Vd , Vm ) ; <nl> } else { <nl> - Unknown ( instr ) ; <nl> + / / vtrn . < esize > Dd , Dm . <nl> + out_buffer_pos_ + = SNPrintF ( out_buffer_ + out_buffer_pos_ , <nl> + " vtrn . % d d % d , d % d " , esize , Vd , Vm ) ; <nl> } <nl> - break ; <nl> - case 8 : <nl> - if ( instr - > Bits ( 21 , 20 ) = = 0 ) { <nl> - / / vst1 <nl> - int Vd = ( instr - > Bit ( 22 ) < < 4 ) | instr - > VdValue ( ) ; <nl> - int Rn = instr - > VnValue ( ) ; <nl> - int type = instr - > Bits ( 11 , 8 ) ; <nl> - int size = instr - > Bits ( 7 , 6 ) ; <nl> - int align = instr - > Bits ( 5 , 4 ) ; <nl> - int Rm = instr - > VmValue ( ) ; <nl> - out_buffer_pos_ + = SNPrintF ( out_buffer_ + out_buffer_pos_ , " vst1 . % d " , <nl> - ( 1 < < size ) < < 3 ) ; <nl> - FormatNeonList ( Vd , type ) ; <nl> - Print ( " , " ) ; <nl> - FormatNeonMemory ( Rn , align , Rm ) ; <nl> - } else if ( instr - > Bits ( 21 , 20 ) = = 2 ) { <nl> - / / vld1 <nl> - int Vd = ( instr - > Bit ( 22 ) < < 4 ) | instr - > VdValue ( ) ; <nl> - int Rn = instr - > VnValue ( ) ; <nl> - int type = instr - > Bits ( 11 , 8 ) ; <nl> - int size = instr - > Bits ( 7 , 6 ) ; <nl> - int align = instr - > Bits ( 5 , 4 ) ; <nl> - int Rm = instr - > VmValue ( ) ; <nl> - out_buffer_pos_ + = SNPrintF ( out_buffer_ + out_buffer_pos_ , " vld1 . % d " , <nl> - ( 1 < < size ) < < 3 ) ; <nl> - FormatNeonList ( Vd , type ) ; <nl> - Print ( " , " ) ; <nl> - FormatNeonMemory ( Rn , align , Rm ) ; <nl> + } else if ( opc1 = = 0b10 & & ( opc2 & 0b1110 ) = = 0b0010 ) { <nl> + int esize = kBitsPerByte * ( 1 < < size ) ; <nl> + const char * op = instr - > Bit ( 7 ) ! = 0 ? " vzip " : " vuzp " ; <nl> + if ( q ) { <nl> + / / vzip / vuzp . < esize > Qd , Qm . <nl> + out_buffer_pos_ + = SNPrintF ( out_buffer_ + out_buffer_pos_ , <nl> + " % s . % d q % d , q % d " , op , esize , Vd , Vm ) ; <nl> } else { <nl> - Unknown ( instr ) ; <nl> + / / vzip / vuzp . < esize > Dd , Dm . <nl> + out_buffer_pos_ + = SNPrintF ( out_buffer_ + out_buffer_pos_ , <nl> + " % s . % d d % d , d % d " , op , esize , Vd , Vm ) ; <nl> + } <nl> + } else if ( opc1 = = 0b10 & & ( opc2 & 0b1110 ) = = 0b0100 ) { <nl> + / / vqmov { u } n . < type > < esize > Dd , Qm . <nl> + int Vd = instr - > VFPDRegValue ( kDoublePrecision ) ; <nl> + int Vm = instr - > VFPMRegValue ( kSimd128Precision ) ; <nl> + int op = instr - > Bits ( 7 , 6 ) ; <nl> + const char * name = op = = 0b01 ? " vqmovun " : " vqmovn " ; <nl> + char type = op = = 0b11 ? ' u ' : ' s ' ; <nl> + int esize = 2 * kBitsPerByte * ( 1 < < size ) ; <nl> + out_buffer_pos_ + = <nl> + SNPrintF ( out_buffer_ + out_buffer_pos_ , " % s . % c % i d % d , q % d " , name , <nl> + type , esize , Vd , Vm ) ; <nl> + } else if ( opc1 = = 0b10 & & opc2 = = 0b1000 ) { <nl> + if ( q ) { <nl> + Format ( instr , " vrintn . f32 ' Qd , ' Qm " ) ; <nl> + } else { <nl> + Format ( instr , " vrintn . f32 ' Dd , ' Dm " ) ; <nl> } <nl> - break ; <nl> - case 0xA : <nl> - case 0xB : <nl> - if ( ( instr - > Bits ( 22 , 20 ) = = 5 ) & & ( instr - > Bits ( 15 , 12 ) = = 0xF ) ) { <nl> - const char * rn_name = converter_ . NameOfCPURegister ( instr - > Bits ( 19 , 16 ) ) ; <nl> - int offset = instr - > Bits ( 11 , 0 ) ; <nl> - if ( offset = = 0 ) { <nl> - out_buffer_pos_ + = <nl> - SNPrintF ( out_buffer_ + out_buffer_pos_ , " pld [ % s ] " , rn_name ) ; <nl> - } else if ( instr - > Bit ( 23 ) = = 0 ) { <nl> - out_buffer_pos_ + = SNPrintF ( out_buffer_ + out_buffer_pos_ , <nl> - " pld [ % s , # - % d ] " , rn_name , offset ) ; <nl> - } else { <nl> - out_buffer_pos_ + = SNPrintF ( out_buffer_ + out_buffer_pos_ , <nl> - " pld [ % s , # + % d ] " , rn_name , offset ) ; <nl> - } <nl> - } else if ( instr - > SpecialValue ( ) = = 0xA & & instr - > Bits ( 22 , 20 ) = = 7 ) { <nl> - int option = instr - > Bits ( 3 , 0 ) ; <nl> - switch ( instr - > Bits ( 7 , 4 ) ) { <nl> - case 4 : <nl> - out_buffer_pos_ + = SNPrintF ( out_buffer_ + out_buffer_pos_ , " dsb % s " , <nl> - barrier_option_names [ option ] ) ; <nl> - break ; <nl> - case 5 : <nl> - out_buffer_pos_ + = SNPrintF ( out_buffer_ + out_buffer_pos_ , " dmb % s " , <nl> - barrier_option_names [ option ] ) ; <nl> - break ; <nl> - case 6 : <nl> - out_buffer_pos_ + = SNPrintF ( out_buffer_ + out_buffer_pos_ , " isb % s " , <nl> - barrier_option_names [ option ] ) ; <nl> - break ; <nl> - default : <nl> - Unknown ( instr ) ; <nl> - } <nl> + } else if ( opc1 = = 0b10 & & opc2 = = 0b1011 ) { <nl> + if ( q ) { <nl> + Format ( instr , " vrintz . f32 ' Qd , ' Qm " ) ; <nl> } else { <nl> - Unknown ( instr ) ; <nl> + Format ( instr , " vrintz . f32 ' Dd , ' Dm " ) ; <nl> } <nl> - break ; <nl> - case 0x1D : <nl> - if ( instr - > Opc1Value ( ) = = 0x7 & & instr - > Bits ( 19 , 18 ) = = 0x2 & & <nl> - instr - > Bits ( 11 , 9 ) = = 0x5 & & instr - > Bits ( 7 , 6 ) = = 0x1 & & <nl> - instr - > Bit ( 4 ) = = 0x0 ) { <nl> - / / VRINTA , VRINTN , VRINTP , VRINTM ( floating - point ) <nl> - bool dp_operation = ( instr - > SzValue ( ) = = 1 ) ; <nl> - int rounding_mode = instr - > Bits ( 17 , 16 ) ; <nl> - switch ( rounding_mode ) { <nl> - case 0x0 : <nl> - if ( dp_operation ) { <nl> - Format ( instr , " vrinta . f64 . f64 ' Dd , ' Dm " ) ; <nl> - } else { <nl> - Format ( instr , " vrinta . f32 . f32 ' Sd , ' Sm " ) ; <nl> - } <nl> - break ; <nl> - case 0x1 : <nl> - if ( dp_operation ) { <nl> - Format ( instr , " vrintn . f64 . f64 ' Dd , ' Dm " ) ; <nl> - } else { <nl> - Format ( instr , " vrintn . f32 . f32 ' Sd , ' Sm " ) ; <nl> - } <nl> - break ; <nl> - case 0x2 : <nl> - if ( dp_operation ) { <nl> - Format ( instr , " vrintp . f64 . f64 ' Dd , ' Dm " ) ; <nl> - } else { <nl> - Format ( instr , " vrintp . f32 . f32 ' Sd , ' Sm " ) ; <nl> - } <nl> - break ; <nl> - case 0x3 : <nl> - if ( dp_operation ) { <nl> - Format ( instr , " vrintm . f64 . f64 ' Dd , ' Dm " ) ; <nl> - } else { <nl> - Format ( instr , " vrintm . f32 . f32 ' Sd , ' Sm " ) ; <nl> - } <nl> - break ; <nl> - default : <nl> - UNREACHABLE ( ) ; / / Case analysis is exhaustive . <nl> - break ; <nl> - } <nl> - } else if ( ( instr - > Opc1Value ( ) = = 0x4 ) & & ( instr - > Bits ( 11 , 9 ) = = 0x5 ) & & <nl> - ( instr - > Bit ( 4 ) = = 0x0 ) ) { <nl> - / / VMAXNM , VMINNM ( floating - point ) <nl> - if ( instr - > SzValue ( ) = = 0x1 ) { <nl> - if ( instr - > Bit ( 6 ) = = 0x1 ) { <nl> - Format ( instr , " vminnm . f64 ' Dd , ' Dn , ' Dm " ) ; <nl> - } else { <nl> - Format ( instr , " vmaxnm . f64 ' Dd , ' Dn , ' Dm " ) ; <nl> - } <nl> - } else { <nl> - if ( instr - > Bit ( 6 ) = = 0x1 ) { <nl> - Format ( instr , " vminnm . f32 ' Sd , ' Sn , ' Sm " ) ; <nl> - } else { <nl> - Format ( instr , " vmaxnm . f32 ' Sd , ' Sn , ' Sm " ) ; <nl> - } <nl> - } <nl> + } else if ( opc1 = = 0b10 & & opc2 = = 0b1101 ) { <nl> + if ( q ) { <nl> + Format ( instr , " vrintm . f32 ' Qd , ' Qm " ) ; <nl> } else { <nl> - Unknown ( instr ) ; <nl> + Format ( instr , " vrintm . f32 ' Dd , ' Dm " ) ; <nl> } <nl> - break ; <nl> - case 0x1C : <nl> - if ( ( instr - > Bits ( 11 , 9 ) = = 0x5 ) & & ( instr - > Bit ( 6 ) = = 0 ) & & <nl> - ( instr - > Bit ( 4 ) = = 0 ) ) { <nl> - / / VSEL * ( floating - point ) <nl> - bool dp_operation = ( instr - > SzValue ( ) = = 1 ) ; <nl> - switch ( instr - > Bits ( 21 , 20 ) ) { <nl> - case 0x0 : <nl> - if ( dp_operation ) { <nl> - Format ( instr , " vseleq . f64 ' Dd , ' Dn , ' Dm " ) ; <nl> - } else { <nl> - Format ( instr , " vseleq . f32 ' Sd , ' Sn , ' Sm " ) ; <nl> - } <nl> - break ; <nl> - case 0x1 : <nl> - if ( dp_operation ) { <nl> - Format ( instr , " vselvs . f64 ' Dd , ' Dn , ' Dm " ) ; <nl> - } else { <nl> - Format ( instr , " vselvs . f32 ' Sd , ' Sn , ' Sm " ) ; <nl> - } <nl> - break ; <nl> - case 0x2 : <nl> - if ( dp_operation ) { <nl> - Format ( instr , " vselge . f64 ' Dd , ' Dn , ' Dm " ) ; <nl> - } else { <nl> - Format ( instr , " vselge . f32 ' Sd , ' Sn , ' Sm " ) ; <nl> - } <nl> - break ; <nl> - case 0x3 : <nl> - if ( dp_operation ) { <nl> - Format ( instr , " vselgt . f64 ' Dd , ' Dn , ' Dm " ) ; <nl> - } else { <nl> - Format ( instr , " vselgt . f32 ' Sd , ' Sn , ' Sm " ) ; <nl> - } <nl> - break ; <nl> - default : <nl> - UNREACHABLE ( ) ; / / Case analysis is exhaustive . <nl> - break ; <nl> - } <nl> + } else if ( opc1 = = 0b10 & & opc2 = = 0b1111 ) { <nl> + if ( q ) { <nl> + Format ( instr , " vrintp . f32 ' Qd , ' Qm " ) ; <nl> } else { <nl> - Unknown ( instr ) ; <nl> + Format ( instr , " vrintp . f32 ' Dd , ' Dm " ) ; <nl> } <nl> - break ; <nl> - default : <nl> + } else if ( opc1 = = 0b11 & & ( opc2 & 0b1101 ) = = 0b1000 ) { <nl> + / / vrecpe . f32 Qd , Qm . <nl> + out_buffer_pos_ + = SNPrintF ( out_buffer_ + out_buffer_pos_ , <nl> + " vrecpe . f32 q % d , q % d " , Vd , Vm ) ; <nl> + } else if ( opc1 = = 0b11 & & ( opc2 & 0b1101 ) = = 0b1001 ) { <nl> + / / vrsqrte . f32 Qd , Qm . <nl> + out_buffer_pos_ + = SNPrintF ( out_buffer_ + out_buffer_pos_ , <nl> + " vrsqrte . f32 q % d , q % d " , Vd , Vm ) ; <nl> + } else if ( opc1 = = 0b11 & & ( opc2 & 0b1100 ) = = 0b1100 ) { <nl> + const char * suffix = nullptr ; <nl> + int op = instr - > Bits ( 8 , 7 ) ; <nl> + switch ( op ) { <nl> + case 0 : <nl> + suffix = " f32 . s32 " ; <nl> + break ; <nl> + case 1 : <nl> + suffix = " f32 . u32 " ; <nl> + break ; <nl> + case 2 : <nl> + suffix = " s32 . f32 " ; <nl> + break ; <nl> + case 3 : <nl> + suffix = " u32 . f32 " ; <nl> + break ; <nl> + } <nl> + out_buffer_pos_ + = SNPrintF ( out_buffer_ + out_buffer_pos_ , <nl> + " vcvt . % s q % d , q % d " , suffix , Vd , Vm ) ; <nl> + } <nl> + } else if ( op0 & & op1 = = 0b11 & & op2 = = 0b10 ) { <nl> + / / VTBL , VTBX <nl> + int Vd = instr - > VFPDRegValue ( kDoublePrecision ) ; <nl> + int Vn = instr - > VFPNRegValue ( kDoublePrecision ) ; <nl> + int Vm = instr - > VFPMRegValue ( kDoublePrecision ) ; <nl> + int len = instr - > Bits ( 9 , 8 ) ; <nl> + NeonListOperand list ( DwVfpRegister : : from_code ( Vn ) , len + 1 ) ; <nl> + out_buffer_pos_ + = SNPrintF ( out_buffer_ + out_buffer_pos_ , " % s d % d , " , <nl> + instr - > Bit ( 6 ) = = 0 ? " vtbl . 8 " : " vtbx . 8 " , Vd ) ; <nl> + FormatNeonList ( Vn , list . type ( ) ) ; <nl> + Print ( " , " ) ; <nl> + PrintDRegister ( Vm ) ; <nl> + } else if ( op0 & & op1 = = 0b11 & & op2 = = 0b11 ) { <nl> + / / Advanced SIMD duplicate ( scalar ) <nl> + if ( instr - > Bits ( 9 , 7 ) = = 0 ) { <nl> + / / VDUP ( scalar ) <nl> + int Vm = instr - > VFPMRegValue ( kDoublePrecision ) ; <nl> + int imm4 = instr - > Bits ( 19 , 16 ) ; <nl> + int esize = 0 , index = 0 ; <nl> + if ( ( imm4 & 0x1 ) ! = 0 ) { <nl> + esize = 8 ; <nl> + index = imm4 > > 1 ; <nl> + } else if ( ( imm4 & 0x2 ) ! = 0 ) { <nl> + esize = 16 ; <nl> + index = imm4 > > 2 ; <nl> + } else { <nl> + esize = 32 ; <nl> + index = imm4 > > 3 ; <nl> + } <nl> + if ( instr - > Bit ( 6 ) = = 0 ) { <nl> + int Vd = instr - > VFPDRegValue ( kDoublePrecision ) ; <nl> + out_buffer_pos_ + = <nl> + SNPrintF ( out_buffer_ + out_buffer_pos_ , " vdup . % i d % d , d % d [ % d ] " , <nl> + esize , Vd , Vm , index ) ; <nl> + } else { <nl> + int Vd = instr - > VFPDRegValue ( kSimd128Precision ) ; <nl> + out_buffer_pos_ + = <nl> + SNPrintF ( out_buffer_ + out_buffer_pos_ , " vdup . % i q % d , d % d [ % d ] " , <nl> + esize , Vd , Vm , index ) ; <nl> + } <nl> + } else { <nl> Unknown ( instr ) ; <nl> - break ; <nl> + } <nl> + } else if ( op1 ! = 0b11 & & ! op3 ) { <nl> + / / Advanced SIMD three registers of different lengths . <nl> + int u = instr - > Bit ( 24 ) ; <nl> + int opc = instr - > Bits ( 11 , 8 ) ; <nl> + if ( opc = = 0b1000 ) { <nl> + / / vmlal . u < esize > < Qd > , < Dn > , < Dm > <nl> + int Vd = instr - > VFPDRegValue ( kSimd128Precision ) ; <nl> + int Vn = instr - > VFPNRegValue ( kDoublePrecision ) ; <nl> + int Vm = instr - > VFPMRegValue ( kDoublePrecision ) ; <nl> + int esize = 8 < < instr - > Bits ( 21 , 20 ) ; <nl> + out_buffer_pos_ + = SNPrintF ( out_buffer_ + out_buffer_pos_ , <nl> + " vmlal . u % d q % d , d % d , d % d " , esize , Vd , Vn , Vm ) ; <nl> + } else if ( opc = = 0b1100 ) { <nl> + / / vmull . s / u < esize > Qd , Dn , Dm <nl> + int Vd = instr - > VFPDRegValue ( kSimd128Precision ) ; <nl> + int Vn = instr - > VFPNRegValue ( kDoublePrecision ) ; <nl> + int Vm = instr - > VFPMRegValue ( kDoublePrecision ) ; <nl> + int esize = 8 < < instr - > Bits ( 21 , 20 ) ; <nl> + out_buffer_pos_ + = <nl> + SNPrintF ( out_buffer_ + out_buffer_pos_ , " vmull . % s % d q % d , d % d , d % d " , <nl> + u ? " u " : " s " , esize , Vd , Vn , Vm ) ; <nl> + } <nl> + } else if ( op1 ! = 0b11 & & op3 ) { <nl> + / / The instructions specified by this encoding are not used in V8 . <nl> + Unknown ( instr ) ; <nl> + } else { <nl> + Unknown ( instr ) ; <nl> + } <nl> + } <nl> + <nl> + void Decoder : : DecodeMemoryHintsAndBarriers ( Instruction * instr ) { <nl> + int op0 = instr - > Bits ( 25 , 21 ) ; <nl> + if ( op0 = = 0b01011 ) { <nl> + / / Barriers . <nl> + int option = instr - > Bits ( 3 , 0 ) ; <nl> + switch ( instr - > Bits ( 7 , 4 ) ) { <nl> + case 4 : <nl> + out_buffer_pos_ + = SNPrintF ( out_buffer_ + out_buffer_pos_ , " dsb % s " , <nl> + barrier_option_names [ option ] ) ; <nl> + break ; <nl> + case 5 : <nl> + out_buffer_pos_ + = SNPrintF ( out_buffer_ + out_buffer_pos_ , " dmb % s " , <nl> + barrier_option_names [ option ] ) ; <nl> + break ; <nl> + case 6 : <nl> + out_buffer_pos_ + = SNPrintF ( out_buffer_ + out_buffer_pos_ , " isb % s " , <nl> + barrier_option_names [ option ] ) ; <nl> + break ; <nl> + default : <nl> + Unknown ( instr ) ; <nl> + } <nl> + } else if ( ( op0 & 0b10001 ) = = 0b00000 & & ! instr - > Bit ( 4 ) ) { <nl> + / / Preload ( immediate ) . <nl> + const char * rn_name = converter_ . NameOfCPURegister ( instr - > Bits ( 19 , 16 ) ) ; <nl> + int offset = instr - > Bits ( 11 , 0 ) ; <nl> + if ( offset = = 0 ) { <nl> + out_buffer_pos_ + = <nl> + SNPrintF ( out_buffer_ + out_buffer_pos_ , " pld [ % s ] " , rn_name ) ; <nl> + } else if ( instr - > Bit ( 23 ) = = 0 ) { <nl> + out_buffer_pos_ + = SNPrintF ( out_buffer_ + out_buffer_pos_ , <nl> + " pld [ % s , # - % d ] " , rn_name , offset ) ; <nl> + } else { <nl> + out_buffer_pos_ + = SNPrintF ( out_buffer_ + out_buffer_pos_ , <nl> + " pld [ % s , # + % d ] " , rn_name , offset ) ; <nl> + } <nl> + } else { <nl> + Unknown ( instr ) ; <nl> + } <nl> + } <nl> + <nl> + void Decoder : : DecodeAdvancedSIMDElementOrStructureLoadStore ( <nl> + Instruction * instr ) { <nl> + int op0 = instr - > Bit ( 23 ) ; <nl> + if ( op0 = = 0 ) { <nl> + / / Advanced SIMD load / store multiple structures . <nl> + int l = instr - > Bit ( 21 ) ; <nl> + int itype = instr - > Bits ( 11 , 8 ) ; <nl> + if ( itype = = 0b0010 ) { <nl> + / / vld1 / vst1 <nl> + int Vd = ( instr - > Bit ( 22 ) < < 4 ) | instr - > VdValue ( ) ; <nl> + int Rn = instr - > VnValue ( ) ; <nl> + int size = instr - > Bits ( 7 , 6 ) ; <nl> + int align = instr - > Bits ( 5 , 4 ) ; <nl> + int Rm = instr - > VmValue ( ) ; <nl> + const char * op = l ? " vld1 . % d " : " vst1 . % d " ; <nl> + out_buffer_pos_ + = <nl> + SNPrintF ( out_buffer_ + out_buffer_pos_ , op , ( 1 < < size ) < < 3 ) ; <nl> + FormatNeonList ( Vd , itype ) ; <nl> + Print ( " , " ) ; <nl> + FormatNeonMemory ( Rn , align , Rm ) ; <nl> + } else { <nl> + Unknown ( instr ) ; <nl> + } <nl> + } else { <nl> + Unknown ( instr ) ; <nl> } <nl> } <nl> <nl> mmm a / test / cctest / test - disasm - arm . cc <nl> ppp b / test / cctest / test - disasm - arm . cc <nl> TEST ( Neon ) { <nl> " f3b6f100 vuzp . 16 d15 , d0 " ) ; <nl> COMPARE ( vuzp ( Neon16 , q15 , q0 ) , <nl> " f3f6e140 vuzp . 16 q15 , q0 " ) ; <nl> + COMPARE ( vrev16 ( Neon8 , q15 , q0 ) , <nl> + " f3f0e140 vrev16 . 8 q15 , q0 " ) ; <nl> + COMPARE ( vrev32 ( Neon8 , q15 , q0 ) , <nl> + " f3f0e0c0 vrev32 . 8 q15 , q0 " ) ; <nl> COMPARE ( vrev64 ( Neon8 , q15 , q0 ) , <nl> " f3f0e040 vrev64 . 8 q15 , q0 " ) ; <nl> COMPARE ( vtrn ( Neon16 , d15 , d0 ) , <nl>
[ arm ] Refactor arm disassembler for special condition
v8/v8
e363ee3cd87ce6f99773936ee7064188e7f83d64
2020-10-27T02:19:51Z
mmm a / src / gui / properties / speedplotview . cpp <nl> ppp b / src / gui / properties / speedplotview . cpp <nl> void SpeedPlotView : : paintEvent ( QPaintEvent * ) <nl> / / draw graphs <nl> rect . adjust ( 3 , 0 , 0 , 0 ) ; / / Need , else graphs cross left gridline <nl> <nl> - double y_multiplier = rect . height ( ) / max_y ; <nl> + double y_multiplier = ( max_y = = 0 . 0 ) ? 0 . 0 : rect . height ( ) / max_y ; <nl> double x_tick_size = double ( rect . width ( ) ) / m_viewablePointsCount ; <nl> <nl> for ( QMap < GraphID , QQueue < double > > : : const_iterator it = m_yData . begin ( ) ; it ! = m_yData . end ( ) ; + + it ) { <nl>
SpeedPlotView : fix render graphs with zero speed
qbittorrent/qBittorrent
0d74131edd6afe311a6a73cd458956059763a99e
2015-08-29T07:24:51Z
mmm a / src / Interpreters / TreeOptimizer . cpp <nl> ppp b / src / Interpreters / TreeOptimizer . cpp <nl> <nl> # include < Parsers / ASTTablesInSelectQuery . h > <nl> <nl> # include < Functions / FunctionFactory . h > <nl> + # include < Storages / StorageInMemoryMetadata . h > <nl> <nl> <nl> namespace DB <nl> void optimizeDuplicateDistinct ( ASTSelectQuery & select ) <nl> / / / Replace monotonous functions in ORDER BY if they don ' t participate in GROUP BY expression , <nl> / / / has a single argument and not an aggregate functions . <nl> void optimizeMonotonousFunctionsInOrderBy ( ASTSelectQuery * select_query , const Context & context , <nl> - const TablesWithColumns & tables_with_columns ) <nl> + const TablesWithColumns & tables_with_columns , <nl> + const Names & sorting_key_columns ) <nl> { <nl> auto order_by = select_query - > orderBy ( ) ; <nl> if ( ! order_by ) <nl> void optimizeMonotonousFunctionsInOrderBy ( ASTSelectQuery * select_query , const C <nl> } <nl> } <nl> <nl> - for ( auto & child : order_by - > children ) <nl> + bool is_sorting_key_prefix = true ; <nl> + for ( size_t i = 0 ; i < order_by - > children . size ( ) ; + + i ) <nl> { <nl> - auto * order_by_element = child - > as < ASTOrderByElement > ( ) ; <nl> + auto * order_by_element = order_by - > children [ i ] - > as < ASTOrderByElement > ( ) ; <nl> auto & ast_func = order_by_element - > children [ 0 ] ; <nl> if ( ! ast_func - > as < ASTFunction > ( ) ) <nl> continue ; <nl> <nl> + if ( i > = sorting_key_columns . size ( ) | | ast_func - > getColumnName ( ) ! = sorting_key_columns [ i ] ) <nl> + is_sorting_key_prefix = false ; <nl> + <nl> + / / / If order by expression matches the sorting key , do not remove <nl> + / / / functions to allow execute reading in order of key . <nl> + if ( is_sorting_key_prefix ) <nl> + continue ; <nl> + <nl> MonotonicityCheckVisitor : : Data data { tables_with_columns , context , group_by_hashes } ; <nl> MonotonicityCheckVisitor ( data ) . visit ( ast_func ) ; <nl> <nl> void TreeOptimizer : : optimizeIf ( ASTPtr & query , Aliases & aliases , bool if_chain_ <nl> <nl> void TreeOptimizer : : apply ( ASTPtr & query , Aliases & aliases , const NameSet & source_columns_set , <nl> const std : : vector < TableWithColumnNamesAndTypes > & tables_with_columns , <nl> - const Context & context , bool & rewrite_subqueries ) <nl> + const Context & context , const StorageMetadataPtr & metadata_snapshot , <nl> + bool & rewrite_subqueries ) <nl> { <nl> const auto & settings = context . getSettingsRef ( ) ; <nl> <nl> void TreeOptimizer : : apply ( ASTPtr & query , Aliases & aliases , const NameSet & sou <nl> optimizeAggregateFunctionsOfGroupByKeys ( select_query , query ) ; <nl> } <nl> <nl> - / / / Remove duplicate items from ORDER BY . <nl> - optimizeDuplicatesInOrderBy ( select_query ) ; <nl> - <nl> / / / Remove duplicate ORDER BY and DISTINCT from subqueries . <nl> if ( settings . optimize_duplicate_order_by_and_distinct ) <nl> { <nl> void TreeOptimizer : : apply ( ASTPtr & query , Aliases & aliases , const NameSet & sou <nl> <nl> / / / Replace monotonous functions with its argument <nl> if ( settings . optimize_monotonous_functions_in_order_by ) <nl> - optimizeMonotonousFunctionsInOrderBy ( select_query , context , tables_with_columns ) ; <nl> + optimizeMonotonousFunctionsInOrderBy ( select_query , context , tables_with_columns , <nl> + metadata_snapshot ? metadata_snapshot - > getSortingKeyColumns ( ) : Names { } ) ; <nl> + <nl> + / / / Remove duplicate items from ORDER BY . <nl> + / / / Execute it after all order by optimizations , <nl> + / / / because they can produce duplicated columns . <nl> + optimizeDuplicatesInOrderBy ( select_query ) ; <nl> <nl> / / / If function " if " has String - type arguments , transform them into enum <nl> if ( settings . optimize_if_transform_strings_to_enum ) <nl> mmm a / src / Interpreters / TreeOptimizer . h <nl> ppp b / src / Interpreters / TreeOptimizer . h <nl> namespace DB <nl> { <nl> <nl> class Context ; <nl> + struct StorageInMemoryMetadata ; <nl> + using StorageMetadataPtr = std : : shared_ptr < const StorageInMemoryMetadata > ; <nl> <nl> / / / Part of of Tree Rewriter ( SyntaxAnalyzer ) that optimizes AST . <nl> / / / Query should be ready to execute either before either after it . But resulting query could be faster . <nl> class TreeOptimizer <nl> public : <nl> static void apply ( ASTPtr & query , Aliases & aliases , const NameSet & source_columns_set , <nl> const std : : vector < TableWithColumnNamesAndTypes > & tables_with_columns , <nl> - const Context & context , bool & rewrite_subqueries ) ; <nl> + const Context & context , const StorageMetadataPtr & metadata_snapshot , <nl> + bool & rewrite_subqueries ) ; <nl> <nl> static void optimizeIf ( ASTPtr & query , Aliases & aliases , bool if_chain_to_multiif ) ; <nl> } ; <nl> mmm a / src / Interpreters / TreeRewriter . cpp <nl> ppp b / src / Interpreters / TreeRewriter . cpp <nl> TreeRewriterResultPtr TreeRewriter : : analyzeSelect ( <nl> / / / Executing scalar subqueries - replacing them with constant values . <nl> executeScalarSubqueries ( query , context , subquery_depth , result . scalars , select_options . only_analyze ) ; <nl> <nl> - TreeOptimizer : : apply ( query , result . aliases , source_columns_set , tables_with_columns , context , result . rewrite_subqueries ) ; <nl> + TreeOptimizer : : apply ( query , result . aliases , source_columns_set , tables_with_columns , context , result . metadata_snapshot , result . rewrite_subqueries ) ; <nl> <nl> / / / array_join_alias_to_name , array_join_result_to_source . <nl> getArrayJoinedColumns ( query , result , select_query , result . source_columns , source_columns_set ) ; <nl> mmm a / tests / queries / 0_stateless / 01321_monotonous_functions_in_order_by . reference <nl> ppp b / tests / queries / 0_stateless / 01321_monotonous_functions_in_order_by . reference <nl> FROM numbers ( 3 ) <nl> ORDER BY exp ( number ) ASC <nl> SELECT roundToExp2 ( number ) AS x <nl> FROM numbers ( 3 ) <nl> - ORDER BY <nl> - number ASC , <nl> - number ASC <nl> + ORDER BY number ASC <nl> SELECT number AS x <nl> FROM numbers ( 3 ) <nl> - ORDER BY <nl> - number ASC , <nl> - number ASC <nl> + ORDER BY number ASC <nl> SELECT number <nl> FROM numbers ( 3 ) <nl> ORDER BY number DESC <nl> FROM numbers ( 3 ) <nl> ORDER BY exp ( number ) DESC <nl> SELECT roundToExp2 ( number ) AS x <nl> FROM numbers ( 3 ) <nl> - ORDER BY <nl> - number DESC , <nl> - number DESC <nl> + ORDER BY number DESC <nl> 0 <nl> 1 <nl> 2 <nl> new file mode 100644 <nl> index 00000000000 . . 203efdab299 <nl> mmm / dev / null <nl> ppp b / tests / queries / 0_stateless / 01562_optimize_monotonous_functions_in_order_by . reference <nl> <nl> + SELECT <nl> + timestamp , <nl> + key <nl> + FROM test_order_by <nl> + ORDER BY timestamp ASC <nl> + LIMIT 10 <nl> + Expression ( Projection ) <nl> + Limit ( preliminary LIMIT ) <nl> + MergingSorted ( Merge sorted streams for ORDER BY ) <nl> + MergeSorting ( Merge sorted blocks for ORDER BY ) <nl> + PartialSorting ( Sort each block for ORDER BY ) <nl> + Expression ( Before ORDER BY and SELECT ) <nl> + SettingQuotaAndLimits ( Set limits and quota after reading from storage ) <nl> + ReadFromStorage ( MergeTree ) <nl> + SELECT <nl> + timestamp , <nl> + key <nl> + FROM test_order_by <nl> + ORDER BY toDate ( timestamp ) ASC <nl> + LIMIT 10 <nl> + Expression ( Projection ) <nl> + Limit ( preliminary LIMIT ) <nl> + FinishSorting <nl> + Expression ( Before ORDER BY and SELECT ) <nl> + SettingQuotaAndLimits ( Set limits and quota after reading from storage ) <nl> + ReadFromStorage ( MergeTree with order ) <nl> + SELECT <nl> + timestamp , <nl> + key <nl> + FROM test_order_by <nl> + ORDER BY <nl> + toDate ( timestamp ) ASC , <nl> + timestamp ASC <nl> + LIMIT 10 <nl> + Expression ( Projection ) <nl> + Limit ( preliminary LIMIT ) <nl> + FinishSorting <nl> + Expression ( Before ORDER BY and SELECT ) <nl> + SettingQuotaAndLimits ( Set limits and quota after reading from storage ) <nl> + ReadFromStorage ( MergeTree with order ) <nl> + SELECT <nl> + timestamp , <nl> + key <nl> + FROM test_order_by <nl> + ORDER BY timestamp ASC <nl> + LIMIT 10 <nl> new file mode 100644 <nl> index 00000000000 . . b31457d8f68 <nl> mmm / dev / null <nl> ppp b / tests / queries / 0_stateless / 01562_optimize_monotonous_functions_in_order_by . sql <nl> <nl> + SET optimize_monotonous_functions_in_order_by = 1 ; <nl> + <nl> + DROP TABLE IF EXISTS test_order_by ; <nl> + <nl> + CREATE TABLE test_order_by ( timestamp DateTime , key UInt32 ) ENGINE = MergeTree ( ) ORDER BY ( toDate ( timestamp ) , key ) ; <nl> + INSERT INTO test_order_by SELECT now ( ) + toIntervalSecond ( number ) , number % 4 FROM numbers ( 10000 ) ; <nl> + OPTIMIZE TABLE test_order_by FINAL ; <nl> + <nl> + EXPLAIN SYNTAX SELECT * FROM test_order_by ORDER BY timestamp LIMIT 10 ; <nl> + EXPLAIN PLAN SELECT * FROM test_order_by ORDER BY timestamp LIMIT 10 ; <nl> + <nl> + EXPLAIN SYNTAX SELECT * FROM test_order_by ORDER BY toDate ( timestamp ) LIMIT 10 ; <nl> + EXPLAIN PLAN SELECT * FROM test_order_by ORDER BY toDate ( timestamp ) LIMIT 10 ; <nl> + <nl> + EXPLAIN SYNTAX SELECT * FROM test_order_by ORDER BY toDate ( timestamp ) , timestamp LIMIT 10 ; <nl> + EXPLAIN PLAN SELECT * FROM test_order_by ORDER BY toDate ( timestamp ) , timestamp LIMIT 10 ; <nl> + <nl> + DROP TABLE IF EXISTS test_order_by ; <nl> + <nl> + CREATE TABLE test_order_by ( timestamp DateTime , key UInt32 ) ENGINE = MergeTree ( ) ORDER BY tuple ( ) ; <nl> + INSERT INTO test_order_by SELECT now ( ) + toIntervalSecond ( number ) , number % 4 FROM numbers ( 10000 ) ; <nl> + OPTIMIZE TABLE test_order_by FINAL ; <nl> + <nl> + EXPLAIN SYNTAX SELECT * FROM test_order_by ORDER BY toDate ( timestamp ) , timestamp LIMIT 10 ; <nl> + <nl> + DROP TABLE IF EXISTS test_order_by ; <nl>
fix order by optimization with monotonous functions
ClickHouse/ClickHouse
a03b6df897a8506025675e585be3f7e136b0e764
2020-11-12T23:58:33Z
mmm a / Marlin / pins_AZTEEG_X3_PRO . h <nl> ppp b / Marlin / pins_AZTEEG_X3_PRO . h <nl> <nl> / / Note : I had to solder on the additional MAX Endstop pins to attach a Z - Probe <nl> / / endstop switch . <nl> / / <nl> - # undef X_MIN_PIN <nl> - # undef X_MAX_PIN <nl> - # undef Y_MIN_PIN <nl> - # undef Y_MAX_PIN <nl> - # undef Z_MIN_PIN <nl> - # undef Z_MAX_PIN <nl> + / / # undef X_MIN_PIN <nl> + / / # undef X_MAX_PIN <nl> + / / # undef Y_MIN_PIN <nl> + / / # undef Y_MAX_PIN <nl> + / / # undef Z_MIN_PIN <nl> + / / # undef Z_MAX_PIN <nl> <nl> - # define X_MIN_PIN 2 <nl> - # define X_MAX_PIN 3 <nl> - # define Y_MIN_PIN 15 <nl> - # define Y_MAX_PIN 14 <nl> - # define Z_MIN_PIN 19 <nl> - # define Z_MAX_PIN 18 <nl> + / / # define X_MIN_PIN 2 <nl> + / / # define X_MAX_PIN 3 <nl> + / / # define Y_MIN_PIN 15 <nl> + / / # define Y_MAX_PIN 14 <nl> + / / # define Z_MIN_PIN 19 <nl> + / / # define Z_MAX_PIN 18 <nl> / / <nl> <nl> # define E2_STEP_PIN 23 <nl>
Undesired behavior with endstops swapped
MarlinFirmware/Marlin
04fda6b3e9c546e1bb3acec6151ab535fb8dce48
2015-03-29T06:55:47Z
mmm a / src / Functions / CMakeLists . txt <nl> ppp b / src / Functions / CMakeLists . txt <nl> endif ( ) <nl> <nl> option ( ENABLE_MULTITARGET_CODE " " ON ) <nl> if ( ENABLE_MULTITARGET_CODE ) <nl> - add_definitions ( - DUSE_MULTITARGET_CODE = 1 ) <nl> + add_definitions ( - DENABLE_MULTITARGET_CODE = 1 ) <nl> else ( ) <nl> - add_definitions ( - DUSE_MULTITARGET_CODE = 0 ) <nl> + add_definitions ( - DENABLE_MULTITARGET_CODE = 0 ) <nl> endif ( ) <nl> <nl> target_link_libraries ( clickhouse_functions PUBLIC " simdxorshift " ) <nl> mmm a / src / Functions / FunctionBinaryArithmetic . h <nl> ppp b / src / Functions / FunctionBinaryArithmetic . h <nl> struct BinaryOperationImplBase <nl> <nl> static void vectorVector ( const A * __restrict a , const B * __restrict b , ResultType * __restrict c , size_t size ) <nl> { <nl> - if constexpr ( UseMultitargetCode ) <nl> - { <nl> - if ( IsArchSupported ( TargetArch : : AVX512F ) ) <nl> - TargetSpecific : : AVX512F : : BinaryOperationImplBase < A , B , Op , ResultType > : : vectorVector ( a , b , c , size ) ; <nl> - else if ( IsArchSupported ( TargetArch : : AVX2 ) ) <nl> - TargetSpecific : : AVX2 : : BinaryOperationImplBase < A , B , Op , ResultType > : : vectorVector ( a , b , c , size ) ; <nl> - else if ( IsArchSupported ( TargetArch : : AVX ) ) <nl> - TargetSpecific : : AVX : : BinaryOperationImplBase < A , B , Op , ResultType > : : vectorVector ( a , b , c , size ) ; <nl> - else if ( IsArchSupported ( TargetArch : : SSE42 ) ) <nl> - TargetSpecific : : SSE42 : : BinaryOperationImplBase < A , B , Op , ResultType > : : vectorVector ( a , b , c , size ) ; <nl> - else <nl> - TargetSpecific : : Default : : BinaryOperationImplBase < A , B , Op , ResultType > : : vectorVector ( a , b , c , size ) ; <nl> - } <nl> + # if USE_MULTITARGET_CODE <nl> + if ( IsArchSupported ( TargetArch : : AVX512F ) ) <nl> + TargetSpecific : : AVX512F : : BinaryOperationImplBase < A , B , Op , ResultType > : : vectorVector ( a , b , c , size ) ; <nl> + else if ( IsArchSupported ( TargetArch : : AVX2 ) ) <nl> + TargetSpecific : : AVX2 : : BinaryOperationImplBase < A , B , Op , ResultType > : : vectorVector ( a , b , c , size ) ; <nl> + else if ( IsArchSupported ( TargetArch : : AVX ) ) <nl> + TargetSpecific : : AVX : : BinaryOperationImplBase < A , B , Op , ResultType > : : vectorVector ( a , b , c , size ) ; <nl> + else if ( IsArchSupported ( TargetArch : : SSE42 ) ) <nl> + TargetSpecific : : SSE42 : : BinaryOperationImplBase < A , B , Op , ResultType > : : vectorVector ( a , b , c , size ) ; <nl> else <nl> - { <nl> TargetSpecific : : Default : : BinaryOperationImplBase < A , B , Op , ResultType > : : vectorVector ( a , b , c , size ) ; <nl> - } <nl> + # else <nl> + TargetSpecific : : Default : : BinaryOperationImplBase < A , B , Op , ResultType > : : vectorVector ( a , b , c , size ) ; <nl> + # endif <nl> } <nl> <nl> static void vectorConstant ( const A * __restrict a , B b , ResultType * __restrict c , size_t size ) <nl> { <nl> - if constexpr ( UseMultitargetCode ) <nl> - { <nl> - if ( IsArchSupported ( TargetArch : : AVX512F ) ) <nl> - TargetSpecific : : AVX512F : : BinaryOperationImplBase < A , B , Op , ResultType > : : vectorConstant ( a , b , c , size ) ; <nl> - else if ( IsArchSupported ( TargetArch : : AVX2 ) ) <nl> - TargetSpecific : : AVX2 : : BinaryOperationImplBase < A , B , Op , ResultType > : : vectorConstant ( a , b , c , size ) ; <nl> - else if ( IsArchSupported ( TargetArch : : AVX ) ) <nl> - TargetSpecific : : AVX : : BinaryOperationImplBase < A , B , Op , ResultType > : : vectorConstant ( a , b , c , size ) ; <nl> - else if ( IsArchSupported ( TargetArch : : SSE42 ) ) <nl> - TargetSpecific : : SSE42 : : BinaryOperationImplBase < A , B , Op , ResultType > : : vectorConstant ( a , b , c , size ) ; <nl> - else <nl> - TargetSpecific : : Default : : BinaryOperationImplBase < A , B , Op , ResultType > : : vectorConstant ( a , b , c , size ) ; <nl> - } <nl> + # if USE_MULTITARGET_CODE <nl> + if ( IsArchSupported ( TargetArch : : AVX512F ) ) <nl> + TargetSpecific : : AVX512F : : BinaryOperationImplBase < A , B , Op , ResultType > : : vectorConstant ( a , b , c , size ) ; <nl> + else if ( IsArchSupported ( TargetArch : : AVX2 ) ) <nl> + TargetSpecific : : AVX2 : : BinaryOperationImplBase < A , B , Op , ResultType > : : vectorConstant ( a , b , c , size ) ; <nl> + else if ( IsArchSupported ( TargetArch : : AVX ) ) <nl> + TargetSpecific : : AVX : : BinaryOperationImplBase < A , B , Op , ResultType > : : vectorConstant ( a , b , c , size ) ; <nl> + else if ( IsArchSupported ( TargetArch : : SSE42 ) ) <nl> + TargetSpecific : : SSE42 : : BinaryOperationImplBase < A , B , Op , ResultType > : : vectorConstant ( a , b , c , size ) ; <nl> else <nl> - { <nl> TargetSpecific : : Default : : BinaryOperationImplBase < A , B , Op , ResultType > : : vectorConstant ( a , b , c , size ) ; <nl> - } <nl> + # else <nl> + TargetSpecific : : Default : : BinaryOperationImplBase < A , B , Op , ResultType > : : vectorConstant ( a , b , c , size ) ; <nl> + # endif <nl> } <nl> <nl> static void constantVector ( A a , const B * __restrict b , ResultType * __restrict c , size_t size ) <nl> { <nl> - if constexpr ( UseMultitargetCode ) <nl> - { <nl> - if ( IsArchSupported ( TargetArch : : AVX512F ) ) <nl> - TargetSpecific : : AVX512F : : BinaryOperationImplBase < A , B , Op , ResultType > : : constantVector ( a , b , c , size ) ; <nl> - else if ( IsArchSupported ( TargetArch : : AVX2 ) ) <nl> - TargetSpecific : : AVX2 : : BinaryOperationImplBase < A , B , Op , ResultType > : : constantVector ( a , b , c , size ) ; <nl> - else if ( IsArchSupported ( TargetArch : : AVX ) ) <nl> - TargetSpecific : : AVX : : BinaryOperationImplBase < A , B , Op , ResultType > : : constantVector ( a , b , c , size ) ; <nl> - else if ( IsArchSupported ( TargetArch : : SSE42 ) ) <nl> - TargetSpecific : : SSE42 : : BinaryOperationImplBase < A , B , Op , ResultType > : : constantVector ( a , b , c , size ) ; <nl> - else <nl> - TargetSpecific : : Default : : BinaryOperationImplBase < A , B , Op , ResultType > : : constantVector ( a , b , c , size ) ; <nl> - } <nl> + # if USE_MULTITARGET_CODE <nl> + if ( IsArchSupported ( TargetArch : : AVX512F ) ) <nl> + TargetSpecific : : AVX512F : : BinaryOperationImplBase < A , B , Op , ResultType > : : constantVector ( a , b , c , size ) ; <nl> + else if ( IsArchSupported ( TargetArch : : AVX2 ) ) <nl> + TargetSpecific : : AVX2 : : BinaryOperationImplBase < A , B , Op , ResultType > : : constantVector ( a , b , c , size ) ; <nl> + else if ( IsArchSupported ( TargetArch : : AVX ) ) <nl> + TargetSpecific : : AVX : : BinaryOperationImplBase < A , B , Op , ResultType > : : constantVector ( a , b , c , size ) ; <nl> + else if ( IsArchSupported ( TargetArch : : SSE42 ) ) <nl> + TargetSpecific : : SSE42 : : BinaryOperationImplBase < A , B , Op , ResultType > : : constantVector ( a , b , c , size ) ; <nl> else <nl> - { <nl> TargetSpecific : : Default : : BinaryOperationImplBase < A , B , Op , ResultType > : : constantVector ( a , b , c , size ) ; <nl> - } <nl> + # else <nl> + TargetSpecific : : Default : : BinaryOperationImplBase < A , B , Op , ResultType > : : constantVector ( a , b , c , size ) ; <nl> + # endif <nl> } <nl> <nl> static ResultType constantConstant ( A a , B b ) <nl> mmm a / src / Functions / FunctionStartsEndsWith . h <nl> ppp b / src / Functions / FunctionStartsEndsWith . h <nl> class FunctionStartsEndsWith : public TargetSpecific : : Default : : FunctionStartsEnd <nl> selector . registerImplementation < TargetArch : : Default , <nl> TargetSpecific : : Default : : FunctionStartsEndsWith < Name > > ( ) ; <nl> <nl> - if constexpr ( UseMultitargetCode ) <nl> - { <nl> - selector . registerImplementation < TargetArch : : SSE42 , <nl> - TargetSpecific : : SSE42 : : FunctionStartsEndsWith < Name > > ( ) ; <nl> - selector . registerImplementation < TargetArch : : AVX , <nl> - TargetSpecific : : AVX : : FunctionStartsEndsWith < Name > > ( ) ; <nl> - selector . registerImplementation < TargetArch : : AVX2 , <nl> - TargetSpecific : : AVX2 : : FunctionStartsEndsWith < Name > > ( ) ; <nl> - selector . registerImplementation < TargetArch : : AVX512F , <nl> - TargetSpecific : : AVX512F : : FunctionStartsEndsWith < Name > > ( ) ; <nl> - } <nl> + # if USE_MULTITARGET_CODE <nl> + selector . registerImplementation < TargetArch : : SSE42 , <nl> + TargetSpecific : : SSE42 : : FunctionStartsEndsWith < Name > > ( ) ; <nl> + selector . registerImplementation < TargetArch : : AVX , <nl> + TargetSpecific : : AVX : : FunctionStartsEndsWith < Name > > ( ) ; <nl> + selector . registerImplementation < TargetArch : : AVX2 , <nl> + TargetSpecific : : AVX2 : : FunctionStartsEndsWith < Name > > ( ) ; <nl> + selector . registerImplementation < TargetArch : : AVX512F , <nl> + TargetSpecific : : AVX512F : : FunctionStartsEndsWith < Name > > ( ) ; <nl> + # endif <nl> } <nl> <nl> void executeImpl ( Block & block , const ColumnNumbers & arguments , size_t result , size_t input_rows_count ) override <nl> mmm a / src / Functions / FunctionsHashing . h <nl> ppp b / src / Functions / FunctionsHashing . h <nl> class FunctionIntHash : public IFunction <nl> return name ; <nl> } <nl> <nl> - static String getImplementationTag ( ) { return ToString ( BuildArch ) ; } <nl> - <nl> size_t getNumberOfArguments ( ) const override { return 1 ; } <nl> <nl> DataTypePtr getReturnTypeImpl ( const DataTypes & arguments ) const override <nl> class FunctionIntHash : public TargetSpecific : : Default : : FunctionIntHash < Impl , Na <nl> { <nl> selector . registerImplementation < TargetArch : : Default , <nl> TargetSpecific : : Default : : FunctionIntHash < Impl , Name > > ( ) ; <nl> - <nl> + <nl> + # if USE_MULTITARGET_CODE <nl> selector . registerImplementation < TargetArch : : AVX2 , <nl> TargetSpecific : : AVX2 : : FunctionIntHash < Impl , Name > > ( ) ; <nl> selector . registerImplementation < TargetArch : : AVX512F , <nl> TargetSpecific : : AVX512F : : FunctionIntHash < Impl , Name > > ( ) ; <nl> + # endif <nl> } <nl> <nl> void executeImpl ( Block & block , const ColumnNumbers & arguments , size_t result , size_t input_rows_count ) override <nl> class FunctionIntHash : public TargetSpecific : : Default : : FunctionIntHash < Impl , Na <nl> ImplementationSelector < IFunction > selector ; <nl> } ; <nl> <nl> + DECLARE_MULTITARGET_CODE ( <nl> + <nl> template < typename Impl > <nl> class FunctionAnyHash : public IFunction <nl> { <nl> public : <nl> static constexpr auto name = Impl : : name ; <nl> - static FunctionPtr create ( const Context & ) { return std : : make_shared < FunctionAnyHash > ( ) ; } <nl> <nl> private : <nl> using ToType = typename Impl : : ReturnType ; <nl> class FunctionAnyHash : public IFunction <nl> } <nl> } ; <nl> <nl> + ) / / DECLARE_MULTITARGET_CODE <nl> + <nl> + template < typename Impl > <nl> + class FunctionAnyHash : public TargetSpecific : : Default : : FunctionAnyHash < Impl > <nl> + { <nl> + public : <nl> + FunctionAnyHash ( const Context & context ) : selector ( context ) <nl> + { <nl> + selector . registerImplementation < TargetArch : : Default , <nl> + TargetSpecific : : Default : : FunctionAnyHash < Impl > > ( ) ; <nl> + <nl> + # if USE_MULTITARGET_CODE <nl> + selector . registerImplementation < TargetArch : : AVX2 , <nl> + TargetSpecific : : AVX2 : : FunctionAnyHash < Impl > > ( ) ; <nl> + selector . registerImplementation < TargetArch : : AVX512F , <nl> + TargetSpecific : : AVX512F : : FunctionAnyHash < Impl > > ( ) ; <nl> + # endif <nl> + } <nl> + <nl> + void executeImpl ( Block & block , const ColumnNumbers & arguments , size_t result , size_t input_rows_count ) override <nl> + { <nl> + selector . selectAndExecute ( block , arguments , result , input_rows_count ) ; <nl> + } <nl> + <nl> + static FunctionPtr create ( const Context & context ) <nl> + { <nl> + return std : : make_shared < FunctionAnyHash > ( context ) ; <nl> + } <nl> + <nl> + private : <nl> + ImplementationSelector < IFunction > selector ; <nl> + } ; <nl> + <nl> <nl> struct URLHashImpl <nl> { <nl> mmm a / src / Functions / FunctionsRandom . h <nl> ppp b / src / Functions / FunctionsRandom . h <nl> struct RandImpl <nl> { <nl> / / / Fill memory with random data . The memory region must be 15 - bytes padded . <nl> static void execute ( char * output , size_t size ) ; <nl> - static String getImplementationTag ( ) { return ToString ( BuildArch ) ; } <nl> } ; <nl> <nl> ) / / DECLARE_MULTITARGET_CODE <nl> class FunctionRandomImpl : public IFunction <nl> return name ; <nl> } <nl> <nl> - static String getImplementationTag ( ) <nl> - { <nl> - return RandImpl : : getImplementationTag ( ) ; <nl> - } <nl> - <nl> bool isDeterministic ( ) const override { return false ; } <nl> bool isDeterministicInScopeOfQuery ( ) const override { return false ; } <nl> bool useDefaultImplementationForNulls ( ) const override { return false ; } <nl> class FunctionRandom : public FunctionRandomImpl < TargetSpecific : : Default : : RandIm <nl> selector . registerImplementation < TargetArch : : Default , <nl> FunctionRandomImpl < TargetSpecific : : Default : : RandImpl , ToType , Name > > ( ) ; <nl> <nl> - if constexpr ( UseMultitargetCode ) <nl> - { <nl> - selector . registerImplementation < TargetArch : : AVX2 , <nl> - FunctionRandomImpl < TargetSpecific : : AVX2 : : RandImpl , ToType , Name > > ( ) ; <nl> - } <nl> + # if USE_MULTITARGET_CODE <nl> + selector . registerImplementation < TargetArch : : AVX2 , <nl> + FunctionRandomImpl < TargetSpecific : : AVX2 : : RandImpl , ToType , Name > > ( ) ; <nl> + # endif <nl> } <nl> <nl> void executeImpl ( Block & block , const ColumnNumbers & arguments , size_t result , size_t input_rows_count ) override <nl> mmm a / src / Functions / PerformanceAdaptors . h <nl> ppp b / src / Functions / PerformanceAdaptors . h <nl> <nl> # include < mutex > <nl> # include < random > <nl> <nl> - / / / This file contains Adaptors which help to combine several implementations of the function . <nl> - / / / Adaptors check that implementation can be executed on the current platform and choose <nl> - / / / that one which works faster according to previous runs . <nl> + / * This file contains helper class ImplementationSelector . It makes easier to combine <nl> + * several implementations of IFunction / IExecutableFunctionImpl . <nl> + * / <nl> <nl> namespace DB <nl> { <nl> namespace detail <nl> { <nl> / / / If there is a variant with not enough statistics , always choose it . <nl> / / / And in that case prefer variant with less number of invocations . <nl> - if ( adjustedCount ( ) < 2 ) <nl> - return adjustedCount ( ) - 1 + running_count * 2 ; <nl> <nl> + if ( adjustedCount ( ) < 2 ) <nl> + { <nl> + / / TODO ( dakovalkov ) : rewrite it . <nl> + int all_count = adjustedCount ( ) + running_count ; <nl> + if ( all_count < 3 ) <nl> + return all_count - 2 ; <nl> + else <nl> + return adjustedCount ( ) + running_count * 100 ; <nl> + } <nl> return std : : normal_distribution < > ( mean ( ) , sigma ( ) ) ( stat_rng ) ; <nl> } <nl> } ; <nl> namespace detail <nl> template < typename T > <nl> constexpr bool has_implementation_tag = decltype ( hasImplementationTagTest ( std : : declval < T > ( ) ) ) : : value ; <nl> <nl> + / * Implementation tag is used to run specific implementation ( for debug / testing purposes ) . <nl> + * It can be specified via static method : : getImplementationTag ( ) in Function ( optional ) . <nl> + * / <nl> template < typename T > <nl> String getImplementationTag ( TargetArch arch ) <nl> { <nl> namespace detail <nl> * Example of usage : <nl> * <nl> * class MyDefaulImpl : public IFunction { . . . } ; <nl> - * class MySecondImpl : public IFunction { . . . } ; <nl> + * DECLARE_AVX2_SPECIFIC_CODE ( <nl> * class MyAVX2Impl : public IFunction { . . . } ; <nl> + * ) <nl> * <nl> * / / / All methods but execute / executeImpl are usually not bottleneck , so just use them from <nl> * / / / default implementation . <nl> namespace detail <nl> * / / / Register all implementations in constructor . <nl> * / / / There could be as many implementation for every target as you want . <nl> * selector . registerImplementation < TargetArch : : Default , MyDefaultImpl > ( ) ; <nl> - * selector . registerImplementation < TargetArch : : Default , MySecondImpl > ( ) ; <nl> - * selector . registreImplementation < TargetArch : : AVX2 , MyAVX2Impl > ( ) ; <nl> + * # if USE_MULTITARGET_CODE <nl> + * selector . registreImplementation < TargetArch : : AVX2 , TargetSpecific : : AVX2 : : MyAVX2Impl > ( ) ; <nl> + * # endif <nl> * } <nl> * <nl> * void executeImpl ( . . . ) override { <nl> mmm a / src / Functions / RandXorshift . h <nl> ppp b / src / Functions / RandXorshift . h <nl> struct RandXorshiftImpl <nl> struct RandXorshiftImpl2 <nl> { <nl> static void execute ( char * output , size_t size ) ; <nl> - static String getImplementationTag ( ) { return ToString ( BuildArch ) + " _v2 " ; } <nl> + static String getImplementationTag ( ) { return " v2 " ; } <nl> } ; <nl> <nl> ) / / DECLARE_MULTITARGET_CODE <nl> class FunctionRandomXorshift : public FunctionRandomImpl < TargetSpecific : : Default <nl> selector . registerImplementation < TargetArch : : Default , <nl> FunctionRandomImpl < TargetSpecific : : Default : : RandXorshiftImpl , ToType , Name > > ( ) ; <nl> <nl> - if constexpr ( UseMultitargetCode ) <nl> - { <nl> - selector . registerImplementation < TargetArch : : AVX2 , <nl> - FunctionRandomImpl < TargetSpecific : : AVX2 : : RandXorshiftImpl , ToType , Name > > ( ) ; <nl> - selector . registerImplementation < TargetArch : : AVX2 , <nl> - FunctionRandomImpl < TargetSpecific : : AVX2 : : RandXorshiftImpl2 , ToType , Name > > ( ) ; <nl> - } <nl> + # if USE_MULTITARGET_CODE <nl> + selector . registerImplementation < TargetArch : : AVX2 , <nl> + FunctionRandomImpl < TargetSpecific : : AVX2 : : RandXorshiftImpl , ToType , Name > > ( ) ; <nl> + selector . registerImplementation < TargetArch : : AVX2 , <nl> + FunctionRandomImpl < TargetSpecific : : AVX2 : : RandXorshiftImpl2 , ToType , Name > > ( ) ; <nl> + # endif <nl> } <nl> <nl> void executeImpl ( Block & block , const ColumnNumbers & arguments , size_t result , size_t input_rows_count ) override <nl> mmm a / src / Functions / TargetSpecific . h <nl> ppp b / src / Functions / TargetSpecific . h <nl> <nl> <nl> / * This file contains macros and helpers for writing platform - dependent code . <nl> * <nl> - * Macros DECLARE_ < Arch > _SPECIFIC_CODE will wrap code inside them into the <nl> + * Macros DECLARE_ < Arch > _SPECIFIC_CODE will wrap code inside it into the <nl> * namespace TargetSpecific : : < Arch > and enable Arch - specific compile options . <nl> * Thus , it ' s allowed to call functions inside these namespaces only after <nl> * checking platform in runtime ( see IsArchSupported ( ) below ) . <nl> * <nl> + * If compiler is not gcc / clang or target isn ' t x86_64 or ENABLE_MULTITARGET_CODE <nl> + * was set to OFF in cmake , all code inside these macroses will be removed and <nl> + * USE_MUTLITARGE_CODE will be set to 0 . Use # if USE_MUTLITARGE_CODE whenever you <nl> + * use anything from this namespaces . <nl> + * <nl> * For similarities there is a macros DECLARE_DEFAULT_CODE , which wraps code <nl> * into the namespace TargetSpecific : : Default but dosn ' t specify any additional <nl> - * copile options . <nl> + * copile options . Functions and classes inside this macros are available regardless <nl> + * of USE_MUTLITARGE_CODE . <nl> * <nl> - * Example : <nl> + * Example of usage : <nl> * <nl> * DECLARE_DEFAULT_CODE ( <nl> * int funcImpl ( ) { <nl> <nl> * ) / / DECLARE_DEFAULT_CODE <nl> * <nl> * int func ( ) { <nl> + * # if USE_MULTITARGET_CODE <nl> * if ( IsArchSupported ( TargetArch : : AVX2 ) ) <nl> * return TargetSpecifc : : AVX2 : : funcImpl ( ) ; <nl> + * # endif <nl> * return TargetSpecifc : : Default : : funcImpl ( ) ; <nl> * } <nl> * <nl> * Sometimes code may benefit from compiling with different options . <nl> - * For these purposes use DECLARE_MULTITARGET_CODE macros . It will create several <nl> - * copies of the code and compile it with different options . These copies are <nl> - * available via TargetSpecifc namespaces described above . <nl> + * For these purposes use DECLARE_MULTITARGET_CODE macros . It will create a copy <nl> + * of the code for every supported target and compile it with different options . <nl> + * These copies are available via TargetSpecifc namespaces described above . <nl> * <nl> * Inside every TargetSpecific namespace there is a constexpr variable BuildArch , <nl> * which indicates the target platform for current code . <nl> <nl> * iteration_size = 2 <nl> * else if constexpr ( BuildArch = = TargetArch : : AVX | | BuildArch = = TargetArch : : AVX2 ) <nl> * iteration_size = 4 ; <nl> - * else if constexpr ( BuildArch = = TargetArch : : AVX512 ) <nl> - * iteration_size = 8 ; <nl> * for ( int i = 0 ; i < size ; i + = iteration_size ) <nl> * . . . <nl> * } <nl> * ) / / DECLARE_MULTITARGET_CODE <nl> * <nl> - * / / All 5 versions of func are available here . Use runtime detection to choose one . <nl> + * / / All target - specific and default implementations are available here via <nl> + * TargetSpecific : : < Arch > : : funcImpl . Use runtime detection to choose one . <nl> * <nl> - * If you want to write IFunction or IExecutableFuncionImpl with runtime dispatching , see PerformanceAdaptors . h . <nl> + * If you want to write IFunction or IExecutableFuncionImpl with several implementations <nl> + * see PerformanceAdaptors . h . <nl> * / <nl> <nl> namespace DB <nl> enum class TargetArch : UInt32 <nl> AVX512F = ( 1 < < 3 ) , <nl> } ; <nl> <nl> - / / Runtime detection . <nl> + / / / Runtime detection . <nl> bool IsArchSupported ( TargetArch arch ) ; <nl> <nl> String ToString ( TargetArch arch ) ; <nl> <nl> - # if USE_MULTITARGET_CODE & & defined ( __GNUC__ ) & & defined ( __x86_64__ ) <nl> + # if ENABLE_MULTITARGET_CODE & & defined ( __GNUC__ ) & & defined ( __x86_64__ ) <nl> <nl> - constexpr bool UseMultitargetCode = true ; <nl> + # define USE_MULTITARGET_CODE 1 <nl> <nl> # if defined ( __clang__ ) <nl> # define BEGIN_AVX512F_SPECIFIC_CODE \ <nl> - _Pragma ( " clang attribute push ( __attribute__ ( ( target ( \ " sse , sse2 , sse3 , ssse3 , sse4 , popcnt , mmx , avx , avx2 , avx512f \ " ) ) ) , apply_to = function ) " ) <nl> + _Pragma ( " clang attribute push ( __attribute__ ( ( target ( \ " sse , sse2 , sse3 , ssse3 , sse4 , popcnt , avx , avx2 , avx512f \ " ) ) ) , apply_to = function ) " ) <nl> # define BEGIN_AVX2_SPECIFIC_CODE \ <nl> - _Pragma ( " clang attribute push ( __attribute__ ( ( target ( \ " sse , sse2 , sse3 , ssse3 , sse4 , popcnt , mmx , avx , avx2 \ " ) ) ) , apply_to = function ) " ) <nl> + _Pragma ( " clang attribute push ( __attribute__ ( ( target ( \ " sse , sse2 , sse3 , ssse3 , sse4 , popcnt , avx , avx2 \ " ) ) ) , apply_to = function ) " ) <nl> # define BEGIN_AVX_SPECIFIC_CODE \ <nl> - _Pragma ( " clang attribute push ( __attribute__ ( ( target ( \ " sse , sse2 , sse3 , ssse3 , sse4 , popcnt , mmx , avx \ " ) ) ) , apply_to = function ) " ) <nl> + _Pragma ( " clang attribute push ( __attribute__ ( ( target ( \ " sse , sse2 , sse3 , ssse3 , sse4 , popcnt , avx \ " ) ) ) , apply_to = function ) " ) <nl> # define BEGIN_SSE42_SPECIFIC_CODE \ <nl> - _Pragma ( " clang attribute push ( __attribute__ ( ( target ( \ " sse , sse2 , sse3 , ssse3 , sse4 , popcnt , mmx \ " ) ) ) , apply_to = function ) " ) <nl> + _Pragma ( " clang attribute push ( __attribute__ ( ( target ( \ " sse , sse2 , sse3 , ssse3 , sse4 , popcnt \ " ) ) ) , apply_to = function ) " ) <nl> # define END_TARGET_SPECIFIC_CODE \ <nl> _Pragma ( " clang attribute pop " ) <nl> <nl> constexpr bool UseMultitargetCode = true ; <nl> # else <nl> # define BEGIN_AVX512F_SPECIFIC_CODE \ <nl> _Pragma ( " GCC push_options " ) \ <nl> - _Pragma ( " GCC target ( \ " sse , sse2 , sse3 , ssse3 , sse4 , popcnt , abm , mmx , avx , avx2 , avx512f , tune = native \ " ) " ) <nl> + _Pragma ( " GCC target ( \ " sse , sse2 , sse3 , ssse3 , sse4 , popcnt , avx , avx2 , avx512f , tune = native \ " ) " ) <nl> # define BEGIN_AVX2_SPECIFIC_CODE \ <nl> _Pragma ( " GCC push_options " ) \ <nl> - _Pragma ( " GCC target ( \ " sse , sse2 , sse3 , ssse3 , sse4 , popcnt , abm , mmx , avx , avx2 , tune = native \ " ) " ) <nl> + _Pragma ( " GCC target ( \ " sse , sse2 , sse3 , ssse3 , sse4 , popcnt , avx , avx2 , tune = native \ " ) " ) <nl> # define BEGIN_AVX_SPECIFIC_CODE \ <nl> _Pragma ( " GCC push_options " ) \ <nl> - _Pragma ( " GCC target ( \ " sse , sse2 , sse3 , ssse3 , sse4 , popcnt , abm , mmx , avx , tune = native \ " ) " ) <nl> + _Pragma ( " GCC target ( \ " sse , sse2 , sse3 , ssse3 , sse4 , popcnt , avx , tune = native \ " ) " ) <nl> # define BEGIN_SSE42_SPECIFIC_CODE \ <nl> _Pragma ( " GCC push_options " ) \ <nl> - _Pragma ( " GCC target ( \ " sse , sse2 , sse3 , ssse3 , sse4 , popcnt , abm , mmx , tune = native \ " ) " ) <nl> + _Pragma ( " GCC target ( \ " sse , sse2 , sse3 , ssse3 , sse4 , popcnt , tune = native \ " ) " ) <nl> # define END_TARGET_SPECIFIC_CODE \ <nl> _Pragma ( " GCC pop_options " ) <nl> <nl> END_TARGET_SPECIFIC_CODE <nl> <nl> # else <nl> <nl> - constexpr bool UseMultitargetCode = false ; <nl> + # define USE_MULTITARGET_CODE 0 <nl> <nl> + / * Multitarget code is disabled , just delete target - specific code . <nl> + * / <nl> # define DECLARE_SSE42_SPECIFIC_CODE ( . . . ) <nl> # define DECLARE_AVX_SPECIFIC_CODE ( . . . ) <nl> # define DECLARE_AVX2_SPECIFIC_CODE ( . . . ) <nl> mmm a / src / Functions / generateUUIDv4 . cpp <nl> ppp b / src / Functions / generateUUIDv4 . cpp <nl> class FunctionGenerateUUIDv4 : public TargetSpecific : : Default : : FunctionGenerateU <nl> selector . registerImplementation < TargetArch : : Default , <nl> TargetSpecific : : Default : : FunctionGenerateUUIDv4 > ( ) ; <nl> <nl> + # if USE_MULTITARGET_CODE <nl> selector . registerImplementation < TargetArch : : AVX2 , <nl> TargetSpecific : : AVX2 : : FunctionGenerateUUIDv4 > ( ) ; <nl> + # endif <nl> } <nl> <nl> void executeImpl ( Block & block , const ColumnNumbers & arguments , size_t result , size_t input_rows_count ) override <nl> mmm a / src / Functions / randConstant . cpp <nl> ppp b / src / Functions / randConstant . cpp <nl> class RandomConstantOverloadResolver : public IFunctionOverloadResolverImpl <nl> argument_types . emplace_back ( arguments . back ( ) . type ) ; <nl> <nl> typename ColumnVector < ToType > : : Container vec_to ( 1 ) ; <nl> - / / TODO ( dakovalkov ) : Rewrite this workaround <nl> + <nl> TargetSpecific : : Default : : RandImpl : : execute ( reinterpret_cast < char * > ( vec_to . data ( ) ) , sizeof ( ToType ) ) ; <nl> ToType value = vec_to [ 0 ] ; <nl> <nl> mmm a / tests / performance / arithmetic . xml <nl> ppp b / tests / performance / arithmetic . xml <nl> <nl> - < test max_ignored_relative_change = " 0 . 4 " > <nl> + < ! - - < test max_ignored_relative_change = " 0 . 4 " > <nl> + TODO ( dakovalkov ) : uncomment this - - > <nl> < settings > <nl> < max_memory_usage > 30000000000 < / max_memory_usage > <nl> < / settings > <nl> mmm a / tests / performance / synthetic_hardware_benchmark . xml <nl> ppp b / tests / performance / synthetic_hardware_benchmark . xml <nl> <nl> - < test max_ignored_relative_change = " 0 . 2 " > <nl> + < ! - - < test max_ignored_relative_change = " 0 . 2 " > <nl> + TODO ( dakovalkov ) : uncomment this - - > <nl> < settings > <nl> < max_memory_usage > 30000000000 < / max_memory_usage > <nl> < / settings > <nl>
Add hashes to multitarget code , a lot of cosmetics
ClickHouse/ClickHouse
ef030349ff29c7550b9c3b2931cf4db57d9a6e11
2020-05-29T05:35:03Z
mmm a / stdlib / public / Darwin / Foundation / Foundation . swift <nl> ppp b / stdlib / public / Darwin / Foundation / Foundation . swift <nl> public let NSNotFound : Int = . max <nl> / / / Returns the localized version of a string . <nl> / / / <nl> / / / - parameter key : An identifying value used to reference a localized string . <nl> - / / / ` key ` must not be the empty string . Values keyed by the empty string will <nl> + / / / Don ' t use the empty string as a key . Values keyed by the empty string will <nl> / / / not be localized . <nl> / / / - parameter tableName : The name of the table containing the localized string <nl> / / / identified by ` key ` . This is the prefix of the strings file — a file with <nl>
" Must " must not be used outside a precondition
apple/swift
c93b18d8b3107f743321c59f2edbb18b2fe19c63
2019-06-29T04:13:09Z
mmm a / ChangeLog <nl> ppp b / ChangeLog <nl> <nl> + 2010 - 07 - 05 : Version 2 . 2 . 22 <nl> + <nl> + Added ES5 Object . isExtensible and Object . preventExtensions . <nl> + <nl> + Enabled building V8 as a DLL . <nl> + <nl> + Fixed a bug in date code where - 0 was not interpreted as 0 <nl> + ( issue 736 ) . <nl> + <nl> + Performance improvements on all platforms . <nl> + <nl> + <nl> 2010 - 06 - 30 : Version 2 . 2 . 21 <nl> <nl> Fix bug in externalizing some ASCII strings ( Chromium issue 47824 ) . <nl> <nl> Provide actual breakpoints locations in response to setBreakpoint <nl> and listBreakpoints requests . <nl> <nl> + <nl> 2010 - 06 - 28 : Version 2 . 2 . 20 <nl> + <nl> Fix bug with for - in on x64 platform ( issue 748 ) . <nl> <nl> Fix crash bug on x64 platform ( issue 756 ) . <nl> - <nl> + <nl> Fix bug in Object . getOwnPropertyNames . ( chromium issue 41243 ) . <nl> <nl> - Fix a bug on ARM that caused the result of 1 < < x to be <nl> + Fix a bug on ARM that caused the result of 1 < < x to be <nl> miscalculated for some inputs . <nl> <nl> Performance improvements on all platforms . <nl> <nl> + <nl> 2010 - 06 - 23 : Version 2 . 2 . 19 <nl> <nl> Fix bug that causes the build to break when profillingsupport = off <nl> <nl> <nl> 2010 - 06 - 09 : Version 2 . 2 . 16 <nl> <nl> - Removed the SetExternalStringDiposeCallback API . Changed the <nl> + Removed the SetExternalStringDiposeCallback API . Changed the <nl> disposal of external string resources to call a virtual Dispose <nl> method on the resource . <nl> <nl> - Added support for more precise break points when debugging and <nl> + Added support for more precise break points when debugging and <nl> stepping . <nl> <nl> Memory usage improvements on all platforms . <nl> mmm a / src / version . cc <nl> ppp b / src / version . cc <nl> <nl> / / cannot be changed without changing the SCons build script . <nl> # define MAJOR_VERSION 2 <nl> # define MINOR_VERSION 2 <nl> - # define BUILD_NUMBER 22 <nl> + # define BUILD_NUMBER 23 <nl> # define PATCH_LEVEL 0 <nl> # define CANDIDATE_VERSION true <nl> <nl>
Prepare push to trunk . Now working on version 2 . 2 . 23 .
v8/v8
b34151979bb3d088741e9b05b1e7f28dfb1229a2
2010-07-05T10:33:20Z
mmm a / ios / sdk / WeexSDK / Sources / Model / WXSDKInstance . m <nl> ppp b / ios / sdk / WeexSDK / Sources / Model / WXSDKInstance . m <nl> <nl> # import " WXConvert . h " <nl> # import " WXPrerenderManager . h " <nl> # import " WXTracingManager . h " <nl> + # import " WXJSExceptionProtocol . h " <nl> <nl> NSString * const bundleUrlOptionKey = @ " bundleUrl " ; <nl> <nl> - ( void ) _renderWithMainBundleString : ( NSString * ) mainBundleString <nl> WXLog ( @ " Start rendering page : % @ " , self . pageName ) ; <nl> } else { <nl> WXLogWarning ( @ " WXSDKInstance ' s pageName should be specified . " ) ; <nl> - WXAssertCondition ( ! [ WXUtility isBlankString : _pageName ] , WXSDKInstance . pageName ) ; <nl> + id < WXJSExceptionProtocol > jsExceptionHandler = [ WXHandlerFactory handlerForProtocol : @ protocol ( WXJSExceptionProtocol ) ] ; <nl> + if ( [ jsExceptionHandler respondsToSelector : @ selector ( onJSException : ) ] ) { <nl> + WXRuntimeCheckException * runtimeCheckException = [ WXRuntimeCheckException new ] ; <nl> + runtimeCheckException . exception = @ " We highly recommend you to set pageName . \ n call WXSDKInstance * instance = [ WXSDKInstance new ] ; instance . page = @ \ " your page name \ " to fix it " ; <nl> + [ jsExceptionHandler onRuntimeCheckException : runtimeCheckException ] ; <nl> + } <nl> } <nl> <nl> WX_MONITOR_INSTANCE_PERF_START ( WXPTFirstScreenRender , self ) ; <nl> mmm a / ios / sdk / WeexSDK / Sources / Protocol / WXJSExceptionProtocol . h <nl> ppp b / ios / sdk / WeexSDK / Sources / Protocol / WXJSExceptionProtocol . h <nl> <nl> <nl> # import " WXJSExceptionInfo . h " <nl> <nl> + typedef WXJSExceptionInfo WXRuntimeCheckException ; <nl> + <nl> @ protocol WXJSExceptionProtocol < NSObject > <nl> <nl> / * * <nl> <nl> <nl> - ( void ) onJSException : ( WXJSExceptionInfo * ) exception ; <nl> <nl> + <nl> + @ optional <nl> + <nl> + / * * <nl> + * report runtime check exception , this is optional for this protocol <nl> + * / <nl> + - ( void ) onRuntimeCheckException : ( WXRuntimeCheckException * ) exception ; <nl> + <nl> @ end <nl> mmm a / ios / sdk / WeexSDK / Sources / Utility / WXAssert . h <nl> ppp b / ios / sdk / WeexSDK / Sources / Utility / WXAssert . h <nl> do { \ <nl> # define WXAssertParam ( name ) WXAssert ( name , \ <nl> @ " the parameter ' % s ' is required " , # name ) <nl> <nl> - # define WXAssertCondition ( condition , param ) WXAssert ( condition , \ <nl> - @ " the parameter ' % s ' is required " , # param ) <nl> - <nl> / * * <nl> * @ abstract macro for asserting if the handler conforms to the protocol <nl> * / <nl>
* [ ios ] update assert pageName
apache/incubator-weex
72f9dc47249cd9038838bb0cba4413ca6eafb257
2017-08-15T11:21:31Z
mmm a / XBMC . xcodeproj / project . pbxproj <nl> ppp b / XBMC . xcodeproj / project . pbxproj <nl> <nl> xbmc / lib / libsquish , <nl> xbmc / lib / libjsonrpc , <nl> xbmc / lib / libhttpapi , <nl> - xbmc / cores / dvdplayer / Codecs / libbdnav / src / libbdnav / . libs , <nl> " lib / libSDL - OSX " , <nl> lib / jsoncpp / jsoncpp / src / lib_json , <nl> lib / libmicrohttpd / src / daemon / . libs , <nl> <nl> xbmc / lib / libsquish , <nl> xbmc / lib / libjsonrpc , <nl> xbmc / lib / libhttpapi , <nl> - xbmc / cores / dvdplayer / Codecs / libbdnav / src / libbdnav / . libs , <nl> " lib / libSDL - OSX " , <nl> lib / jsoncpp / jsoncpp / src / lib_json , <nl> lib / libmicrohttpd / src / daemon / . libs , <nl> <nl> xbmc / lib / libsquish , <nl> xbmc / lib / libjsonrpc , <nl> xbmc / lib / libhttpapi , <nl> - xbmc / cores / dvdplayer / Codecs / libbdnav / src / libbdnav / . libs , <nl> " lib / libSDL - OSX " , <nl> lib / jsoncpp / jsoncpp / src / lib_json , <nl> lib / libmicrohttpd / src / daemon / . libs , <nl> <nl> xbmc / lib / libsquish , <nl> xbmc / lib / libjsonrpc , <nl> xbmc / lib / libhttpapi , <nl> - xbmc / cores / dvdplayer / Codecs / libbdnav / src / libbdnav / . libs , <nl> " lib / libSDL - OSX " , <nl> lib / jsoncpp / jsoncpp / src / lib_json , <nl> lib / libmicrohttpd / src / daemon / . libs , <nl>
[ osx ] remove libbdnav from xcode project
xbmc/xbmc
ec2c3349cd4091c2b86789053a0a3938bb86b9bc
2010-08-27T15:38:30Z
mmm a / src / mongo / util / heap_profiler . cpp <nl> ppp b / src / mongo / util / heap_profiler . cpp <nl> <nl> # include " mongo / platform / basic . h " <nl> <nl> # include " mongo / base / init . h " <nl> + # include " mongo / config . h " <nl> # include " mongo / db / commands / server_status . h " <nl> # include " mongo / db / server_parameters . h " <nl> # include " mongo / util / log . h " <nl> class HashTable { <nl> struct Entry { <nl> Key key { } ; <nl> Value value { } ; <nl> - std : : atomic < Entry * > next { nullptr } ; <nl> - std : : atomic < bool > valid { false } ; <nl> + std : : atomic < Entry * > next { nullptr } ; / / NOLINT <nl> + std : : atomic < bool > valid { false } ; / / NOLINT <nl> Entry ( ) { } <nl> } ; <nl> <nl> const size_t maxEntries ; / / we allocate storage for this many entries on creation <nl> - std : : atomic_size_t numEntries ; / / number of entries currently in use <nl> + std : : atomic_size_t numEntries ; / / number of entries currently in use NOLINT <nl> size_t numBuckets ; / / number of buckets , computed as numEntries * loadFactor <nl> <nl> / / pre - allocate buckets and entries <nl> - std : : unique_ptr < std : : atomic < Entry * > [ ] > buckets ; <nl> + std : : unique_ptr < std : : atomic < Entry * > [ ] > buckets ; / / NOLINT <nl> std : : unique_ptr < Entry [ ] > entries ; <nl> <nl> - std : : atomic_size_t nextEntry ; / / first entry that ' s never been used <nl> + std : : atomic_size_t nextEntry ; / / first entry that ' s never been used NOLINT <nl> Entry * freeEntry ; / / linked list of entries returned to us by removeEntry <nl> <nl> public : <nl> class HashTable { <nl> : maxEntries ( maxEntries ) , <nl> numEntries ( 0 ) , <nl> numBuckets ( maxEntries * loadFactor ) , <nl> - buckets ( new std : : atomic < Entry * > [ numBuckets ] ( ) ) , <nl> + buckets ( new std : : atomic < Entry * > [ numBuckets ] ( ) ) , / / NOLINT <nl> entries ( new Entry [ maxEntries ] ( ) ) , <nl> nextEntry ( 0 ) , <nl> freeEntry ( nullptr ) { } <nl> class HeapProfiler { <nl> / / 0 : sampling internally disabled <nl> / / 1 : sample every allocation - byte accurate but slow and big <nl> / / > 1 : sample ever sampleIntervalBytes bytes allocated - less accurate but fast and small <nl> - std : : atomic_size_t sampleIntervalBytes ; <nl> + std : : atomic_size_t sampleIntervalBytes ; / / NOLINT <nl> <nl> - std : : mutex hashtable_mutex ; / / guards updates to both object and stack hash tables <nl> - std : : mutex stackinfo_mutex ; / / guards against races updating the StackInfo bson representation <nl> + stdx : : mutex hashtable_mutex ; / / guards updates to both object and stack hash tables <nl> + stdx : : mutex stackinfo_mutex ; / / guards against races updating the StackInfo bson representation <nl> <nl> / / cumulative bytes allocated - determines when samples are taken <nl> - std : : atomic_size_t bytesAllocated { 0 } ; <nl> + std : : atomic_size_t bytesAllocated { 0 } ; / / NOLINT <nl> <nl> / / estimated currently active bytes - sum of activeBytes for all stacks <nl> size_t totalActiveBytes = 0 ; <nl> class HeapProfiler { <nl> Hash stackHash = tempStack . hash ( ) ; <nl> <nl> / / Now acquire lock . <nl> - std : : lock_guard < std : : mutex > lk ( hashtable_mutex ) ; <nl> + stdx : : lock_guard < stdx : : mutex > lk ( hashtable_mutex ) ; <nl> <nl> / / Look up stack in stackHashTable . <nl> StackInfo * stackInfo = stackHashTable . find ( stackHash , tempStack ) ; <nl> class HeapProfiler { <nl> return ; <nl> <nl> / / Now acquire lock . <nl> - std : : lock_guard < std : : mutex > lk ( hashtable_mutex ) ; <nl> + stdx : : lock_guard < stdx : : mutex > lk ( hashtable_mutex ) ; <nl> <nl> / / Remove the object from the hash bucket if present . <nl> ObjInfo * objInfo = objHashTable . find ( objHash , obj ) ; <nl> class HeapProfiler { <nl> statsBuilder . doneFast ( ) ; <nl> <nl> / / Guard against races updating the StackInfo bson representation . <nl> - std : : lock_guard < std : : mutex > lk ( stackinfo_mutex ) ; <nl> + stdx : : lock_guard < stdx : : mutex > lk ( stackinfo_mutex ) ; <nl> <nl> / / Traverse stackHashTable accumulating potential stacks to emit . <nl> / / We do this traversal without locking hashtable_mutex because we need to use the heap . <nl>
fix lint
mongodb/mongo
11ceae3d75af61ec17a1612c11305a733927625b
2016-07-28T19:34:40Z
mmm a / hphp / runtime / base / request - injection - data . cpp <nl> ppp b / hphp / runtime / base / request - injection - data . cpp <nl> void RequestInjectionData : : threadInit ( ) { <nl> " default_socket_timeout " , <nl> std : : to_string ( RuntimeOption : : SocketDefaultTimeout ) . c_str ( ) , <nl> & m_socketDefaultTimeout ) ; <nl> + <nl> + / / Response handling . <nl> + IniSetting : : Bind ( IniSetting : : CORE , IniSetting : : PHP_INI_ALL , <nl> + " zlib . output_compression_level " , & m_gzipCompressionLevel ) ; <nl> } <nl> <nl> <nl> mmm a / hphp / runtime / base / request - injection - data . h <nl> ppp b / hphp / runtime / base / request - injection - data . h <nl> struct RequestInjectionData { <nl> std : : string m_argSeparatorInput ; <nl> std : : string m_defaultCharset ; <nl> std : : string m_defaultMimeType ; <nl> + std : : string m_gzipCompressionLevel ; <nl> std : : vector < std : : string > m_include_paths ; <nl> int64_t m_errorReportingLevel ; <nl> bool m_logErrors ; <nl> mmm a / hphp / runtime / base / runtime - option . cpp <nl> ppp b / hphp / runtime / base / runtime - option . cpp <nl> int RuntimeOption : : ServerShutdownListenWait = 0 ; <nl> int RuntimeOption : : ServerShutdownListenNoWork = - 1 ; <nl> std : : vector < std : : string > RuntimeOption : : ServerNextProtocols ; <nl> int RuntimeOption : : GzipCompressionLevel = 3 ; <nl> + int RuntimeOption : : GzipMaxCompressionLevel = 9 ; <nl> std : : string RuntimeOption : : ForceCompressionURL ; <nl> std : : string RuntimeOption : : ForceCompressionCookie ; <nl> std : : string RuntimeOption : : ForceCompressionParam ; <nl> void RuntimeOption : : Load ( const IniSetting : : Map & ini , <nl> ServerGracefulShutdownWait = ServerDanglingWait ; <nl> } <nl> Config : : Bind ( GzipCompressionLevel , ini , server [ " GzipCompressionLevel " ] , 3 ) ; <nl> + Config : : Bind ( GzipMaxCompressionLevel , ini , <nl> + server [ " GzipMaxCompressionLevel " ] , 9 ) ; <nl> <nl> Config : : Bind ( ForceCompressionURL , ini , server [ " ForceCompression " ] [ " URL " ] ) ; <nl> Config : : Bind ( ForceCompressionCookie , ini , <nl> mmm a / hphp / runtime / base / runtime - option . h <nl> ppp b / hphp / runtime / base / runtime - option . h <nl> class RuntimeOption { <nl> static int ServerShutdownListenNoWork ; <nl> static std : : vector < std : : string > ServerNextProtocols ; <nl> static int GzipCompressionLevel ; <nl> + static int GzipMaxCompressionLevel ; <nl> static std : : string ForceCompressionURL ; <nl> static std : : string ForceCompressionCookie ; <nl> static std : : string ForceCompressionParam ; <nl> mmm a / hphp / runtime / server / transport . cpp <nl> ppp b / hphp / runtime / server / transport . cpp <nl> StringHolder Transport : : prepareResponse ( const void * data , int size , <nl> return std : : move ( response ) ; <nl> } <nl> <nl> + int compressionLevel = RuntimeOption : : GzipCompressionLevel ; <nl> + String compressionLevelStr ; <nl> + IniSetting : : Get ( " zlib . output_compression_level " , compressionLevelStr ) ; <nl> + int level = compressionLevelStr . toInt64 ( ) ; <nl> + if ( level > compressionLevel <nl> + & & level < = RuntimeOption : : GzipMaxCompressionLevel ) { <nl> + compressionLevel = level ; <nl> + } <nl> + <nl> / / There isn ' t that much need to gzip response , when it can fit into one <nl> / / Ethernet packet ( 1500 bytes ) , unless we are doing chunked encoding , <nl> / / where we don ' t really know if next chunk will benefit from compresseion . <nl> if ( m_chunkedEncoding | | size > 1000 | | <nl> m_compressionDecision = = CompressionDecision : : HasTo ) { <nl> if ( m_compressor = = nullptr ) { <nl> - m_compressor = new StreamCompressor ( RuntimeOption : : GzipCompressionLevel , <nl> + m_compressor = new StreamCompressor ( compressionLevel , <nl> CODING_GZIP , true ) ; <nl> } <nl> int len = size ; <nl> StringHolder Transport : : prepareResponse ( const void * data , int size , <nl> } <nl> } else { <nl> Logger : : Error ( " Unable to compress response : level = % d len = % d " , <nl> - RuntimeOption : : GzipCompressionLevel , len ) ; <nl> + compressionLevel , len ) ; <nl> } <nl> } <nl> <nl>
Support zlib . output_compression_level option in set_ini
facebook/hhvm
1f1df5137ab5f25f622443b1ff1bfd572899a45b
2014-09-22T17:30:21Z
mmm a / bench / stress - client / args . hpp <nl> ppp b / bench / stress - client / args . hpp <nl> void usage ( const char * name ) { <nl> printf ( " \ t - f , - - db - file \ n \ t \ tIf present drop kv pairs into sqlite and verify correctness on read . \ n " ) ; <nl> <nl> printf ( " \ nAdditional information : \ n " ) ; <nl> - printf ( " \ t \ tDISTR format describes a range and can be specified in as MIN - MAX . \ n \ n " ) ; <nl> + printf ( " \ t \ tDISTR format describes a range and can be specified in as NUM or MIN - MAX . \ n \ n " ) ; <nl> printf ( " \ t \ tPossible protocols are libmemcached , sockmemcached , and mysql . Protocol \ n " ) ; <nl> printf ( " \ t \ tis optional ; if not specified , will default to [ " ) ; <nl> _d_server . print_protocol ( ) ; <nl> mmm a / bench / stress - client / distr . hpp <nl> ppp b / bench / stress - client / distr . hpp <nl> struct distr_t { <nl> } <nl> <nl> void parse ( char * str ) { <nl> + if ( ! strchr ( str , ' - ' ) ) { <nl> + min = max = atoi ( str ) ; <nl> + return ; <nl> + } <nl> char * tok = strtok ( str , " - " ) ; <nl> int c = 0 ; <nl> while ( tok ! = NULL ) { <nl> struct distr_t { <nl> max = atoi ( tok ) ; <nl> break ; <nl> default : <nl> - fprintf ( stderr , " Invalid distr format ( use MIN - MAX ) \ n " ) ; <nl> + fprintf ( stderr , " Invalid distr format ( use NUM or MIN - MAX ) \ n " ) ; <nl> exit ( - 1 ) ; <nl> break ; <nl> } <nl> struct distr_t { <nl> c + + ; <nl> } <nl> if ( c < 2 ) { <nl> - fprintf ( stderr , " Invalid distr format ( use MIN - MAX ) \ n " ) ; <nl> + fprintf ( stderr , " Invalid distr format ( use NUM or MIN - MAX ) \ n " ) ; <nl> exit ( - 1 ) ; <nl> } <nl> if ( min > max ) { <nl> - fprintf ( stderr , " Invalid distr format ( use MIN - MAX , where MIN < = MAX ) \ n " ) ; <nl> + fprintf ( stderr , " Invalid distr format ( use NUM or MIN - MAX , where MIN < = MAX ) \ n " ) ; <nl> exit ( - 1 ) ; <nl> } <nl> } <nl>
Allow specifying single value for a distr in stress client ( to set both
rethinkdb/rethinkdb
c63f8d7ea49f9622f542a9062ada2112efabbe31
2010-12-14T04:33:50Z
mmm a / src / qt / addresstablemodel . cpp <nl> ppp b / src / qt / addresstablemodel . cpp <nl> QString AddressTableModel : : addRow ( const QString & type , const QString & label , con <nl> return QString ( ) ; <nl> } <nl> } <nl> - strAddress = EncodeDestination ( newKey . GetID ( ) ) ; <nl> + wallet - > LearnRelatedScripts ( newKey , g_address_type ) ; <nl> + strAddress = EncodeDestination ( GetDestinationForKey ( newKey , g_address_type ) ) ; <nl> } <nl> else <nl> { <nl> mmm a / src / qt / paymentserver . cpp <nl> ppp b / src / qt / paymentserver . cpp <nl> void PaymentServer : : fetchPaymentACK ( CWallet * wallet , const SendCoinsRecipient & r <nl> / / Create a new refund address , or re - use : <nl> QString account = tr ( " Refund from % 1 " ) . arg ( recipient . authenticatedMerchant ) ; <nl> std : : string strAccount = account . toStdString ( ) ; <nl> - std : : set < CTxDestination > refundAddresses = wallet - > GetAccountAddresses ( strAccount ) ; <nl> - if ( ! refundAddresses . empty ( ) ) { <nl> - CScript s = GetScriptForDestination ( * refundAddresses . begin ( ) ) ; <nl> + CPubKey newKey ; <nl> + if ( wallet - > GetKeyFromPool ( newKey ) ) { <nl> + / / BIP70 requests encode the scriptPubKey directly , so we are not restricted to address <nl> + / / types supported by the receiver . As a result , we choose the address format we also <nl> + / / use for change . Despite an actual payment and not change , this is a close match : <nl> + / / it ' s the output type we use subject to privacy issues , but not restricted by what <nl> + / / other software supports . <nl> + wallet - > LearnRelatedScripts ( newKey , g_change_type ) ; <nl> + CTxDestination dest = GetDestinationForKey ( newKey , g_change_type ) ; <nl> + wallet - > SetAddressBook ( dest , strAccount , " refund " ) ; <nl> + <nl> + CScript s = GetScriptForDestination ( dest ) ; <nl> payments : : Output * refund_to = payment . add_refund_to ( ) ; <nl> refund_to - > set_script ( & s [ 0 ] , s . size ( ) ) ; <nl> - } <nl> - else { <nl> - CPubKey newKey ; <nl> - if ( wallet - > GetKeyFromPool ( newKey ) ) { <nl> - CKeyID keyID = newKey . GetID ( ) ; <nl> - wallet - > SetAddressBook ( keyID , strAccount , " refund " ) ; <nl> - <nl> - CScript s = GetScriptForDestination ( keyID ) ; <nl> - payments : : Output * refund_to = payment . add_refund_to ( ) ; <nl> - refund_to - > set_script ( & s [ 0 ] , s . size ( ) ) ; <nl> - } <nl> - else { <nl> - / / This should never happen , because sending coins should have <nl> - / / just unlocked the wallet and refilled the keypool . <nl> - qWarning ( ) < < " PaymentServer : : fetchPaymentACK : Error getting refund key , refund_to not set " ; <nl> - } <nl> + } else { <nl> + / / This should never happen , because sending coins should have <nl> + / / just unlocked the wallet and refilled the keypool . <nl> + qWarning ( ) < < " PaymentServer : : fetchPaymentACK : Error getting refund key , refund_to not set " ; <nl> } <nl> <nl> int length = payment . ByteSize ( ) ; <nl> mmm a / src / qt / test / wallettests . cpp <nl> ppp b / src / qt / test / wallettests . cpp <nl> void BumpFee ( TransactionView & view , const uint256 & txid , bool expectDisabled , st <nl> / / src / qt / test / test_bitcoin - qt - platform cocoa # macOS <nl> void TestGUI ( ) <nl> { <nl> + g_address_type = OUTPUT_TYPE_P2SH_SEGWIT ; <nl> + g_change_type = OUTPUT_TYPE_P2SH_SEGWIT ; <nl> + <nl> / / Set up wallet and chain with 105 blocks ( 5 mature blocks for spending ) . <nl> TestChain100Setup test ; <nl> for ( int i = 0 ; i < 5 ; + + i ) { <nl> void TestGUI ( ) <nl> wallet . LoadWallet ( firstRun ) ; <nl> { <nl> LOCK ( wallet . cs_wallet ) ; <nl> - wallet . SetAddressBook ( test . coinbaseKey . GetPubKey ( ) . GetID ( ) , " " , " receive " ) ; <nl> + wallet . SetAddressBook ( GetDestinationForKey ( test . coinbaseKey . GetPubKey ( ) , g_address_type ) , " " , " receive " ) ; <nl> wallet . AddKeyPubKey ( test . coinbaseKey , test . coinbaseKey . GetPubKey ( ) ) ; <nl> } <nl> { <nl> mmm a / src / wallet / init . cpp <nl> ppp b / src / wallet / init . cpp <nl> <nl> std : : string GetWalletHelpString ( bool showDebug ) <nl> { <nl> std : : string strUsage = HelpMessageGroup ( _ ( " Wallet options : " ) ) ; <nl> + strUsage + = HelpMessageOpt ( " - addresstype " , strprintf ( _ ( " What type of addresses to use ( \ " legacy \ " , \ " p2sh - segwit \ " , or \ " bech32 \ " , default : \ " % s \ " ) " ) , FormatOutputType ( OUTPUT_TYPE_DEFAULT ) ) ) ; <nl> + strUsage + = HelpMessageOpt ( " - changetype " , _ ( " What type of change to use ( \ " legacy \ " , \ " p2sh - segwit \ " , or \ " bech32 \ " , default is same as - addresstype ) " ) ) ; <nl> strUsage + = HelpMessageOpt ( " - disablewallet " , _ ( " Do not load the wallet and disable wallet RPC calls " ) ) ; <nl> strUsage + = HelpMessageOpt ( " - keypool = < n > " , strprintf ( _ ( " Set key pool size to < n > ( default : % u ) " ) , DEFAULT_KEYPOOL_SIZE ) ) ; <nl> strUsage + = HelpMessageOpt ( " - fallbackfee = < amt > " , strprintf ( _ ( " A fee rate ( in % s / kB ) that will be used when fee estimation has insufficient data ( default : % s ) " ) , <nl> bool WalletParameterInteraction ( ) <nl> bSpendZeroConfChange = gArgs . GetBoolArg ( " - spendzeroconfchange " , DEFAULT_SPEND_ZEROCONF_CHANGE ) ; <nl> fWalletRbf = gArgs . GetBoolArg ( " - walletrbf " , DEFAULT_WALLET_RBF ) ; <nl> <nl> + g_address_type = ParseOutputType ( gArgs . GetArg ( " - addresstype " , " " ) ) ; <nl> + if ( g_address_type = = OUTPUT_TYPE_NONE ) { <nl> + return InitError ( strprintf ( _ ( " Unknown address type ' % s ' " ) , gArgs . GetArg ( " - addresstype " , " " ) ) ) ; <nl> + } <nl> + <nl> + g_change_type = ParseOutputType ( gArgs . GetArg ( " - changetype " , " " ) , g_address_type ) ; <nl> + if ( g_change_type = = OUTPUT_TYPE_NONE ) { <nl> + return InitError ( strprintf ( _ ( " Unknown change type ' % s ' " ) , gArgs . GetArg ( " - changetype " , " " ) ) ) ; <nl> + } <nl> + <nl> return true ; <nl> } <nl> <nl> mmm a / src / wallet / rpcdump . cpp <nl> ppp b / src / wallet / rpcdump . cpp <nl> UniValue importprivkey ( const JSONRPCRequest & request ) <nl> CKeyID vchAddress = pubkey . GetID ( ) ; <nl> { <nl> pwallet - > MarkDirty ( ) ; <nl> - pwallet - > SetAddressBook ( vchAddress , strLabel , " receive " ) ; <nl> + <nl> + / / We don ' t know which corresponding address will be used ; label them all <nl> + for ( const auto & dest : GetAllDestinationsForKey ( pubkey ) ) { <nl> + pwallet - > SetAddressBook ( dest , strLabel , " receive " ) ; <nl> + } <nl> <nl> / / Don ' t throw error in case a key is already there <nl> if ( pwallet - > HaveKey ( vchAddress ) ) { <nl> UniValue importprivkey ( const JSONRPCRequest & request ) <nl> if ( ! pwallet - > AddKeyPubKey ( key , pubkey ) ) { <nl> throw JSONRPCError ( RPC_WALLET_ERROR , " Error adding key to wallet " ) ; <nl> } <nl> + pwallet - > LearnAllRelatedScripts ( pubkey ) ; <nl> <nl> / / whenever a key is imported , we need to scan the whole chain <nl> pwallet - > UpdateTimeFirstKey ( 1 ) ; <nl> UniValue importpubkey ( const JSONRPCRequest & request ) <nl> <nl> LOCK2 ( cs_main , pwallet - > cs_wallet ) ; <nl> <nl> - ImportAddress ( pwallet , pubKey . GetID ( ) , strLabel ) ; <nl> + for ( const auto & dest : GetAllDestinationsForKey ( pubKey ) ) { <nl> + ImportAddress ( pwallet , dest , strLabel ) ; <nl> + } <nl> ImportScript ( pwallet , GetScriptForRawPubKey ( pubKey ) , strLabel , false ) ; <nl> + pwallet - > LearnAllRelatedScripts ( pubKey ) ; <nl> <nl> if ( fRescan ) <nl> { <nl> mmm a / src / wallet / rpcwallet . cpp <nl> ppp b / src / wallet / rpcwallet . cpp <nl> UniValue getnewaddress ( const JSONRPCRequest & request ) <nl> return NullUniValue ; <nl> } <nl> <nl> - if ( request . fHelp | | request . params . size ( ) > 1 ) <nl> + if ( request . fHelp | | request . params . size ( ) > 2 ) <nl> throw std : : runtime_error ( <nl> - " getnewaddress ( \ " account \ " ) \ n " <nl> + " getnewaddress ( \ " account \ " \ " address_type \ " ) \ n " <nl> " \ nReturns a new Bitcoin address for receiving payments . \ n " <nl> " If ' account ' is specified ( DEPRECATED ) , it is added to the address book \ n " <nl> " so payments received with the address will be credited to ' account ' . \ n " <nl> " \ nArguments : \ n " <nl> " 1 . \ " account \ " ( string , optional ) DEPRECATED . The account name for the address to be linked to . If not provided , the default account \ " \ " is used . It can also be set to the empty string \ " \ " to represent the default account . The account does not need to exist , it will be created if there is no account by the given name . \ n " <nl> + " 2 . \ " address_type \ " ( string , optional ) The address type to use . Options are \ " legacy \ " , \ " p2sh \ " , and \ " bech32 \ " . Default is set by - addresstype . \ n " <nl> " \ nResult : \ n " <nl> " \ " address \ " ( string ) The new bitcoin address \ n " <nl> " \ nExamples : \ n " <nl> UniValue getnewaddress ( const JSONRPCRequest & request ) <nl> if ( ! request . params [ 0 ] . isNull ( ) ) <nl> strAccount = AccountFromValue ( request . params [ 0 ] ) ; <nl> <nl> + OutputType output_type = g_address_type ; <nl> + if ( ! request . params [ 1 ] . isNull ( ) ) { <nl> + output_type = ParseOutputType ( request . params [ 1 ] . get_str ( ) , g_address_type ) ; <nl> + if ( output_type = = OUTPUT_TYPE_NONE ) { <nl> + throw JSONRPCError ( RPC_INVALID_ADDRESS_OR_KEY , strprintf ( " Unknown address type ' % s ' " , request . params [ 1 ] . get_str ( ) ) ) ; <nl> + } <nl> + } <nl> + <nl> if ( ! pwallet - > IsLocked ( ) ) { <nl> pwallet - > TopUpKeyPool ( ) ; <nl> } <nl> UniValue getnewaddress ( const JSONRPCRequest & request ) <nl> if ( ! pwallet - > GetKeyFromPool ( newKey ) ) { <nl> throw JSONRPCError ( RPC_WALLET_KEYPOOL_RAN_OUT , " Error : Keypool ran out , please call keypoolrefill first " ) ; <nl> } <nl> - CKeyID keyID = newKey . GetID ( ) ; <nl> + pwallet - > LearnRelatedScripts ( newKey , output_type ) ; <nl> + CTxDestination dest = GetDestinationForKey ( newKey , output_type ) ; <nl> <nl> - pwallet - > SetAddressBook ( keyID , strAccount , " receive " ) ; <nl> + pwallet - > SetAddressBook ( dest , strAccount , " receive " ) ; <nl> <nl> - return EncodeDestination ( keyID ) ; <nl> + return EncodeDestination ( dest ) ; <nl> } <nl> <nl> <nl> UniValue getrawchangeaddress ( const JSONRPCRequest & request ) <nl> return NullUniValue ; <nl> } <nl> <nl> - if ( request . fHelp | | request . params . size ( ) > 0 ) <nl> + if ( request . fHelp | | request . params . size ( ) > 1 ) <nl> throw std : : runtime_error ( <nl> - " getrawchangeaddress \ n " <nl> + " getrawchangeaddress ( \ " address_type \ " ) \ n " <nl> " \ nReturns a new Bitcoin address , for receiving change . \ n " <nl> " This is for use with raw transactions , NOT normal use . \ n " <nl> + " \ nArguments : \ n " <nl> + " 1 . \ " address_type \ " ( string , optional ) The address type to use . Options are \ " legacy \ " , \ " p2sh \ " , and \ " bech32 \ " . Default is set by - changetype . \ n " <nl> " \ nResult : \ n " <nl> " \ " address \ " ( string ) The address \ n " <nl> " \ nExamples : \ n " <nl> UniValue getrawchangeaddress ( const JSONRPCRequest & request ) <nl> pwallet - > TopUpKeyPool ( ) ; <nl> } <nl> <nl> + OutputType output_type = g_change_type ; <nl> + if ( ! request . params [ 0 ] . isNull ( ) ) { <nl> + output_type = ParseOutputType ( request . params [ 0 ] . get_str ( ) , g_change_type ) ; <nl> + if ( output_type = = OUTPUT_TYPE_NONE ) { <nl> + throw JSONRPCError ( RPC_INVALID_ADDRESS_OR_KEY , strprintf ( " Unknown address type ' % s ' " , request . params [ 0 ] . get_str ( ) ) ) ; <nl> + } <nl> + } <nl> + <nl> CReserveKey reservekey ( pwallet ) ; <nl> CPubKey vchPubKey ; <nl> if ( ! reservekey . GetReservedKey ( vchPubKey , true ) ) <nl> UniValue getrawchangeaddress ( const JSONRPCRequest & request ) <nl> <nl> reservekey . KeepKey ( ) ; <nl> <nl> - CKeyID keyID = vchPubKey . GetID ( ) ; <nl> + pwallet - > LearnRelatedScripts ( vchPubKey , output_type ) ; <nl> + CTxDestination dest = GetDestinationForKey ( vchPubKey , output_type ) ; <nl> <nl> - return EncodeDestination ( keyID ) ; <nl> + return EncodeDestination ( dest ) ; <nl> } <nl> <nl> <nl> UniValue addmultisigaddress ( const JSONRPCRequest & request ) <nl> <nl> / / Construct using pay - to - script - hash : <nl> CScript inner = _createmultisig_redeemScript ( pwallet , request . params ) ; <nl> - CScriptID innerID ( inner ) ; <nl> pwallet - > AddCScript ( inner ) ; <nl> <nl> - pwallet - > SetAddressBook ( innerID , strAccount , " send " ) ; <nl> - return EncodeDestination ( innerID ) ; <nl> + CTxDestination dest = pwallet - > AddAndGetDestinationForScript ( inner , g_address_type ) ; <nl> + <nl> + pwallet - > SetAddressBook ( dest , strAccount , " send " ) ; <nl> + return EncodeDestination ( dest ) ; <nl> } <nl> <nl> class Witnessifier : public boost : : static_visitor < bool > <nl> static const CRPCCommand commands [ ] = <nl> { " wallet " , " getaccount " , & getaccount , { " address " } } , <nl> { " wallet " , " getaddressesbyaccount " , & getaddressesbyaccount , { " account " } } , <nl> { " wallet " , " getbalance " , & getbalance , { " account " , " minconf " , " include_watchonly " } } , <nl> - { " wallet " , " getnewaddress " , & getnewaddress , { " account " } } , <nl> - { " wallet " , " getrawchangeaddress " , & getrawchangeaddress , { } } , <nl> + { " wallet " , " getnewaddress " , & getnewaddress , { " account " , " address_type " } } , <nl> + { " wallet " , " getrawchangeaddress " , & getrawchangeaddress , { " address_type " } } , <nl> { " wallet " , " getreceivedbyaccount " , & getreceivedbyaccount , { " account " , " minconf " } } , <nl> { " wallet " , " getreceivedbyaddress " , & getreceivedbyaddress , { " address " , " minconf " } } , <nl> { " wallet " , " gettransaction " , & gettransaction , { " txid " , " include_watchonly " } } , <nl> mmm a / src / wallet / test / wallet_test_fixture . cpp <nl> ppp b / src / wallet / test / wallet_test_fixture . cpp <nl> WalletTestingSetup : : WalletTestingSetup ( const std : : string & chainName ) : <nl> bitdb . MakeMock ( ) ; <nl> <nl> bool fFirstRun ; <nl> + g_address_type = OUTPUT_TYPE_DEFAULT ; <nl> + g_change_type = OUTPUT_TYPE_DEFAULT ; <nl> std : : unique_ptr < CWalletDBWrapper > dbw ( new CWalletDBWrapper ( & bitdb , " wallet_test . dat " ) ) ; <nl> pwalletMain = MakeUnique < CWallet > ( std : : move ( dbw ) ) ; <nl> pwalletMain - > LoadWallet ( fFirstRun ) ; <nl> mmm a / src / wallet / wallet . cpp <nl> ppp b / src / wallet / wallet . cpp <nl> CFeeRate payTxFee ( DEFAULT_TRANSACTION_FEE ) ; <nl> unsigned int nTxConfirmTarget = DEFAULT_TX_CONFIRM_TARGET ; <nl> bool bSpendZeroConfChange = DEFAULT_SPEND_ZEROCONF_CHANGE ; <nl> bool fWalletRbf = DEFAULT_WALLET_RBF ; <nl> + OutputType g_address_type = OUTPUT_TYPE_NONE ; <nl> + OutputType g_change_type = OUTPUT_TYPE_NONE ; <nl> <nl> const char * DEFAULT_WALLET_DAT = " wallet . dat " ; <nl> const uint32_t BIP32_HARDENED_KEY_LIMIT = 0x80000000 ; <nl> bool CWallet : : GetAccountDestination ( CTxDestination & dest , std : : string strAccount <nl> if ( ! account . vchPubKey . IsValid ( ) ) <nl> bForceNew = true ; <nl> else { <nl> - / / Check if the current key has been used <nl> - CScript scriptPubKey = GetScriptForDestination ( account . vchPubKey . GetID ( ) ) ; <nl> + / / Check if the current key has been used ( TODO : check other addresses with the same key ) <nl> + CScript scriptPubKey = GetScriptForDestination ( GetDestinationForKey ( account . vchPubKey , g_address_type ) ) ; <nl> for ( std : : map < uint256 , CWalletTx > : : iterator it = mapWallet . begin ( ) ; <nl> it ! = mapWallet . end ( ) & & account . vchPubKey . IsValid ( ) ; <nl> + + it ) <nl> bool CWallet : : GetAccountDestination ( CTxDestination & dest , std : : string strAccount <nl> if ( ! GetKeyFromPool ( account . vchPubKey , false ) ) <nl> return false ; <nl> <nl> - dest = account . vchPubKey . GetID ( ) ; <nl> + LearnRelatedScripts ( account . vchPubKey , g_address_type ) ; <nl> + dest = GetDestinationForKey ( account . vchPubKey , g_address_type ) ; <nl> SetAddressBook ( dest , strAccount , " receive " ) ; <nl> walletdb . WriteAccount ( strAccount , account ) ; <nl> } else { <nl> - dest = account . vchPubKey . GetID ( ) ; <nl> + dest = GetDestinationForKey ( account . vchPubKey , g_address_type ) ; <nl> } <nl> <nl> return true ; <nl> bool CWallet : : CreateTransaction ( const std : : vector < CRecipient > & vecSend , CWalletT <nl> return false ; <nl> } <nl> <nl> - scriptChange = GetScriptForDestination ( vchPubKey . GetID ( ) ) ; <nl> + LearnRelatedScripts ( vchPubKey , g_change_type ) ; <nl> + scriptChange = GetScriptForDestination ( GetDestinationForKey ( vchPubKey , g_change_type ) ) ; <nl> } <nl> CTxOut change_prototype_txout ( 0 , scriptChange ) ; <nl> size_t change_prototype_size = GetSerializeSize ( change_prototype_txout , SER_DISK , 0 ) ; <nl> bool CWalletTx : : AcceptToMemoryPool ( const CAmount & nAbsurdFee , CValidationState & <nl> fInMempool = ret ; <nl> return ret ; <nl> } <nl> + <nl> + static const std : : string OUTPUT_TYPE_STRING_LEGACY = " legacy " ; <nl> + static const std : : string OUTPUT_TYPE_STRING_P2SH_SEGWIT = " p2sh - segwit " ; <nl> + static const std : : string OUTPUT_TYPE_STRING_BECH32 = " bech32 " ; <nl> + <nl> + OutputType ParseOutputType ( const std : : string & type , OutputType default_type ) <nl> + { <nl> + if ( type . empty ( ) ) { <nl> + return default_type ; <nl> + } else if ( type = = OUTPUT_TYPE_STRING_LEGACY ) { <nl> + return OUTPUT_TYPE_LEGACY ; <nl> + } else if ( type = = OUTPUT_TYPE_STRING_P2SH_SEGWIT ) { <nl> + return OUTPUT_TYPE_P2SH_SEGWIT ; <nl> + } else if ( type = = OUTPUT_TYPE_STRING_BECH32 ) { <nl> + return OUTPUT_TYPE_BECH32 ; <nl> + } else { <nl> + return OUTPUT_TYPE_NONE ; <nl> + } <nl> + } <nl> + <nl> + const std : : string & FormatOutputType ( OutputType type ) <nl> + { <nl> + switch ( type ) { <nl> + case OUTPUT_TYPE_LEGACY : return OUTPUT_TYPE_STRING_LEGACY ; <nl> + case OUTPUT_TYPE_P2SH_SEGWIT : return OUTPUT_TYPE_STRING_P2SH_SEGWIT ; <nl> + case OUTPUT_TYPE_BECH32 : return OUTPUT_TYPE_STRING_BECH32 ; <nl> + default : assert ( false ) ; <nl> + } <nl> + } <nl> + <nl> + void CWallet : : LearnRelatedScripts ( const CPubKey & key , OutputType type ) <nl> + { <nl> + if ( key . IsCompressed ( ) & & ( type = = OUTPUT_TYPE_P2SH_SEGWIT | | type = = OUTPUT_TYPE_BECH32 ) ) { <nl> + CTxDestination witdest = WitnessV0KeyHash ( key . GetID ( ) ) ; <nl> + CScript witprog = GetScriptForDestination ( witdest ) ; <nl> + / / Make sure the resulting program is solvable . <nl> + assert ( IsSolvable ( * this , witprog ) ) ; <nl> + AddCScript ( witprog ) ; <nl> + } <nl> + } <nl> + <nl> + void CWallet : : LearnAllRelatedScripts ( const CPubKey & key ) <nl> + { <nl> + / / OUTPUT_TYPE_P2SH_SEGWIT always adds all necessary scripts for all types . <nl> + LearnRelatedScripts ( key , OUTPUT_TYPE_P2SH_SEGWIT ) ; <nl> + } <nl> + <nl> + CTxDestination GetDestinationForKey ( const CPubKey & key , OutputType type ) <nl> + { <nl> + switch ( type ) { <nl> + case OUTPUT_TYPE_LEGACY : return key . GetID ( ) ; <nl> + case OUTPUT_TYPE_P2SH_SEGWIT : <nl> + case OUTPUT_TYPE_BECH32 : { <nl> + if ( ! key . IsCompressed ( ) ) return key . GetID ( ) ; <nl> + CTxDestination witdest = WitnessV0KeyHash ( key . GetID ( ) ) ; <nl> + CScript witprog = GetScriptForDestination ( witdest ) ; <nl> + if ( type = = OUTPUT_TYPE_P2SH_SEGWIT ) { <nl> + return CScriptID ( witprog ) ; <nl> + } else { <nl> + return witdest ; <nl> + } <nl> + } <nl> + default : assert ( false ) ; <nl> + } <nl> + } <nl> + <nl> + std : : vector < CTxDestination > GetAllDestinationsForKey ( const CPubKey & key ) <nl> + { <nl> + CKeyID keyid = key . GetID ( ) ; <nl> + if ( key . IsCompressed ( ) ) { <nl> + CTxDestination segwit = WitnessV0KeyHash ( keyid ) ; <nl> + CTxDestination p2sh = CScriptID ( GetScriptForDestination ( segwit ) ) ; <nl> + return std : : vector < CTxDestination > { std : : move ( keyid ) , std : : move ( p2sh ) , std : : move ( segwit ) } ; <nl> + } else { <nl> + return std : : vector < CTxDestination > { std : : move ( keyid ) } ; <nl> + } <nl> + } <nl> + <nl> + CTxDestination CWallet : : AddAndGetDestinationForScript ( const CScript & script , OutputType type ) <nl> + { <nl> + / / Note that scripts over 520 bytes are not yet supported . <nl> + switch ( type ) { <nl> + case OUTPUT_TYPE_LEGACY : <nl> + return CScriptID ( script ) ; <nl> + case OUTPUT_TYPE_P2SH_SEGWIT : <nl> + case OUTPUT_TYPE_BECH32 : { <nl> + WitnessV0ScriptHash hash ; <nl> + CSHA256 ( ) . Write ( script . data ( ) , script . size ( ) ) . Finalize ( hash . begin ( ) ) ; <nl> + CTxDestination witdest = hash ; <nl> + CScript witprog = GetScriptForDestination ( witdest ) ; <nl> + / / Check if the resulting program is solvable ( i . e . doesn ' t use an uncompressed key ) <nl> + if ( ! IsSolvable ( * this , witprog ) ) return CScriptID ( script ) ; <nl> + / / Add the redeemscript , so that P2WSH and P2SH - P2WSH outputs are recognized as ours . <nl> + AddCScript ( witprog ) ; <nl> + if ( type = = OUTPUT_TYPE_BECH32 ) { <nl> + return witdest ; <nl> + } else { <nl> + return CScriptID ( witprog ) ; <nl> + } <nl> + } <nl> + default : assert ( false ) ; <nl> + } <nl> + } <nl> mmm a / src / wallet / wallet . h <nl> ppp b / src / wallet / wallet . h <nl> enum WalletFeature <nl> FEATURE_LATEST = FEATURE_COMPRPUBKEY / / HD is optional , use FEATURE_COMPRPUBKEY as latest version <nl> } ; <nl> <nl> + enum OutputType <nl> + { <nl> + OUTPUT_TYPE_NONE , <nl> + OUTPUT_TYPE_LEGACY , <nl> + OUTPUT_TYPE_P2SH_SEGWIT , <nl> + OUTPUT_TYPE_BECH32 , <nl> + <nl> + OUTPUT_TYPE_DEFAULT = OUTPUT_TYPE_P2SH_SEGWIT <nl> + } ; <nl> + <nl> + extern OutputType g_address_type ; <nl> + extern OutputType g_change_type ; <nl> + <nl> <nl> / * * A key pool entry * / <nl> class CKeyPool <nl> class CWallet final : public CCryptoKeyStore , public CValidationInterface <nl> * deadlock <nl> * / <nl> void BlockUntilSyncedToCurrentChain ( ) ; <nl> + <nl> + / * * <nl> + * Explicitly make the wallet learn the related scripts for outputs to the <nl> + * given key . This is purely to make the wallet file compatible with older <nl> + * software , as CBasicKeyStore automatically does this implicitly for all <nl> + * keys now . <nl> + * / <nl> + void LearnRelatedScripts ( const CPubKey & key , OutputType ) ; <nl> + <nl> + / * * <nl> + * Same as LearnRelatedScripts , but when the OutputType is not known ( and could <nl> + * be anything ) . <nl> + * / <nl> + void LearnAllRelatedScripts ( const CPubKey & key ) ; <nl> + <nl> + / * * <nl> + * Get a destination of the requested type ( if possible ) to the specified script . <nl> + * This function will automatically add the necessary scripts to the wallet . <nl> + * / <nl> + CTxDestination AddAndGetDestinationForScript ( const CScript & script , OutputType ) ; <nl> } ; <nl> <nl> / * * A key allocated from the key pool . * / <nl> bool CWallet : : DummySignTx ( CMutableTransaction & txNew , const ContainerType & coins <nl> return true ; <nl> } <nl> <nl> + OutputType ParseOutputType ( const std : : string & str , OutputType default_type = OUTPUT_TYPE_DEFAULT ) ; <nl> + const std : : string & FormatOutputType ( OutputType type ) ; <nl> + <nl> + / * * <nl> + * Get a destination of the requested type ( if possible ) to the specified key . <nl> + * The caller must make sure LearnRelatedScripts has been called beforehand . <nl> + * / <nl> + CTxDestination GetDestinationForKey ( const CPubKey & key , OutputType ) ; <nl> + <nl> + / * * Get all destinations ( potentially ) supported by the wallet for the given key . * / <nl> + std : : vector < CTxDestination > GetAllDestinationsForKey ( const CPubKey & key ) ; <nl> + <nl> # endif / / BITCOIN_WALLET_WALLET_H <nl> mmm a / test / functional / bip68 - 112 - 113 - p2p . py <nl> ppp b / test / functional / bip68 - 112 - 113 - p2p . py <nl> class BIP68_112_113Test ( ComparisonTestFramework ) : <nl> def set_test_params ( self ) : <nl> self . num_nodes = 1 <nl> self . setup_clean_chain = True <nl> - self . extra_args = [ [ ' - whitelist = 127 . 0 . 0 . 1 ' , ' - blockversion = 4 ' ] ] <nl> + self . extra_args = [ [ ' - whitelist = 127 . 0 . 0 . 1 ' , ' - blockversion = 4 ' , ' - addresstype = legacy ' ] ] <nl> <nl> def run_test ( self ) : <nl> test = TestManager ( self , self . options . tmpdir ) <nl> mmm a / test / functional / bip68 - sequence . py <nl> ppp b / test / functional / bip68 - sequence . py <nl> def test_bip68_not_consensus ( self ) : <nl> block . vtx . extend ( [ tx1 , tx2 , tx3 ] ) <nl> block . hashMerkleRoot = block . calc_merkle_root ( ) <nl> block . rehash ( ) <nl> + add_witness_commitment ( block ) <nl> block . solve ( ) <nl> <nl> - self . nodes [ 0 ] . submitblock ( ToHex ( block ) ) <nl> + self . nodes [ 0 ] . submitblock ( bytes_to_hex_str ( block . serialize ( True ) ) ) <nl> assert_equal ( self . nodes [ 0 ] . getbestblockhash ( ) , block . hash ) <nl> <nl> def activateCSV ( self ) : <nl> mmm a / test / functional / bumpfee . py <nl> ppp b / test / functional / bumpfee . py <nl> def test_settxfee ( rbf_node , dest_address ) : <nl> requested_feerate = Decimal ( " 0 . 00025000 " ) <nl> rbf_node . settxfee ( requested_feerate ) <nl> bumped_tx = rbf_node . bumpfee ( rbfid ) <nl> - actual_feerate = bumped_tx [ " fee " ] * 1000 / rbf_node . getrawtransaction ( bumped_tx [ " txid " ] , True ) [ " size " ] <nl> + actual_feerate = bumped_tx [ " fee " ] * 1000 / rbf_node . getrawtransaction ( bumped_tx [ " txid " ] , True ) [ " vsize " ] <nl> # Assert that the difference between the requested feerate and the actual <nl> # feerate of the bumped transaction is small . <nl> assert_greater_than ( Decimal ( " 0 . 00001000 " ) , abs ( requested_feerate - actual_feerate ) ) <nl> def submit_block_with_tx ( node , tx ) : <nl> block . vtx . append ( ctx ) <nl> block . rehash ( ) <nl> block . hashMerkleRoot = block . calc_merkle_root ( ) <nl> + blocktools . add_witness_commitment ( block ) <nl> block . solve ( ) <nl> node . submitblock ( bytes_to_hex_str ( block . serialize ( True ) ) ) <nl> return block <nl> mmm a / test / functional / import - rescan . py <nl> ppp b / test / functional / import - rescan . py <nl> def set_test_params ( self ) : <nl> self . num_nodes = 2 + len ( IMPORT_NODES ) <nl> <nl> def setup_network ( self ) : <nl> - extra_args = [ [ ] for _ in range ( self . num_nodes ) ] <nl> + extra_args = [ [ " - addresstype = legacy " ] for _ in range ( self . num_nodes ) ] <nl> for i , import_node in enumerate ( IMPORT_NODES , 2 ) : <nl> if import_node . prune : <nl> extra_args [ i ] + = [ " - prune = 1 " ] <nl> mmm a / test / functional / importmulti . py <nl> ppp b / test / functional / importmulti . py <nl> <nl> class ImportMultiTest ( BitcoinTestFramework ) : <nl> def set_test_params ( self ) : <nl> self . num_nodes = 2 <nl> + self . extra_args = [ [ " - addresstype = legacy " ] , [ " - addresstype = legacy " ] ] <nl> self . setup_clean_chain = True <nl> <nl> def setup_network ( self ) : <nl> mmm a / test / functional / nulldummy . py <nl> ppp b / test / functional / nulldummy . py <nl> def set_test_params ( self ) : <nl> self . setup_clean_chain = True <nl> # This script tests NULLDUMMY activation , which is part of the ' segwit ' deployment , so we go through <nl> # normal segwit activation here ( and don ' t use the default always - on behaviour ) . <nl> - self . extra_args = [ [ ' - whitelist = 127 . 0 . 0 . 1 ' , ' - walletprematurewitness ' , ' - vbparams = segwit : 0 : 999999999999 ' ] ] <nl> + self . extra_args = [ [ ' - whitelist = 127 . 0 . 0 . 1 ' , ' - walletprematurewitness ' , ' - vbparams = segwit : 0 : 999999999999 ' , ' - addresstype = legacy ' ] ] <nl> <nl> def run_test ( self ) : <nl> self . address = self . nodes [ 0 ] . getnewaddress ( ) <nl> mmm a / test / functional / rawtransactions . py <nl> ppp b / test / functional / rawtransactions . py <nl> class RawTransactionsTest ( BitcoinTestFramework ) : <nl> def set_test_params ( self ) : <nl> self . setup_clean_chain = True <nl> self . num_nodes = 3 <nl> + self . extra_args = [ [ " - addresstype = legacy " ] , [ " - addresstype = legacy " ] , [ " - addresstype = legacy " ] ] <nl> <nl> def setup_network ( self , split = False ) : <nl> super ( ) . setup_network ( ) <nl> def run_test ( self ) : <nl> break <nl> <nl> bal = self . nodes [ 0 ] . getbalance ( ) <nl> - inputs = [ { " txid " : txId , " vout " : vout [ ' n ' ] , " scriptPubKey " : vout [ ' scriptPubKey ' ] [ ' hex ' ] } ] <nl> + inputs = [ { " txid " : txId , " vout " : vout [ ' n ' ] , " scriptPubKey " : vout [ ' scriptPubKey ' ] [ ' hex ' ] , " amount " : vout [ ' value ' ] } ] <nl> outputs = { self . nodes [ 0 ] . getnewaddress ( ) : 2 . 19 } <nl> rawTx = self . nodes [ 2 ] . createrawtransaction ( inputs , outputs ) <nl> rawTxPartialSigned = self . nodes [ 1 ] . signrawtransaction ( rawTx , inputs ) <nl> def run_test ( self ) : <nl> break <nl> <nl> bal = self . nodes [ 0 ] . getbalance ( ) <nl> - inputs = [ { " txid " : txId , " vout " : vout [ ' n ' ] , " scriptPubKey " : vout [ ' scriptPubKey ' ] [ ' hex ' ] , " redeemScript " : mSigObjValid [ ' hex ' ] } ] <nl> + inputs = [ { " txid " : txId , " vout " : vout [ ' n ' ] , " scriptPubKey " : vout [ ' scriptPubKey ' ] [ ' hex ' ] , " redeemScript " : mSigObjValid [ ' hex ' ] , " amount " : vout [ ' value ' ] } ] <nl> outputs = { self . nodes [ 0 ] . getnewaddress ( ) : 2 . 19 } <nl> rawTx2 = self . nodes [ 2 ] . createrawtransaction ( inputs , outputs ) <nl> rawTxPartialSigned1 = self . nodes [ 1 ] . signrawtransaction ( rawTx2 , inputs ) <nl> mmm a / test / functional / segwit . py <nl> ppp b / test / functional / segwit . py <nl> def set_test_params ( self ) : <nl> self . setup_clean_chain = True <nl> self . num_nodes = 3 <nl> # This test tests SegWit both pre and post - activation , so use the normal BIP9 activation . <nl> - self . extra_args = [ [ " - walletprematurewitness " , " - rpcserialversion = 0 " , " - vbparams = segwit : 0 : 999999999999 " ] , <nl> - [ " - blockversion = 4 " , " - promiscuousmempoolflags = 517 " , " - prematurewitness " , " - walletprematurewitness " , " - rpcserialversion = 1 " , " - vbparams = segwit : 0 : 999999999999 " ] , <nl> - [ " - blockversion = 536870915 " , " - promiscuousmempoolflags = 517 " , " - prematurewitness " , " - walletprematurewitness " , " - vbparams = segwit : 0 : 999999999999 " ] ] <nl> + self . extra_args = [ [ " - walletprematurewitness " , " - rpcserialversion = 0 " , " - vbparams = segwit : 0 : 999999999999 " , " - addresstype = legacy " ] , <nl> + [ " - blockversion = 4 " , " - promiscuousmempoolflags = 517 " , " - prematurewitness " , " - walletprematurewitness " , " - rpcserialversion = 1 " , " - vbparams = segwit : 0 : 999999999999 " , " - addresstype = legacy " ] , <nl> + [ " - blockversion = 536870915 " , " - promiscuousmempoolflags = 517 " , " - prematurewitness " , " - walletprematurewitness " , " - vbparams = segwit : 0 : 999999999999 " , " - addresstype = legacy " ] ] <nl> <nl> def setup_network ( self ) : <nl> super ( ) . setup_network ( ) <nl> def run_test ( self ) : <nl> self . pubkey . append ( self . nodes [ i ] . validateaddress ( newaddress ) [ " pubkey " ] ) <nl> multiaddress = self . nodes [ i ] . addmultisigaddress ( 1 , [ self . pubkey [ - 1 ] ] ) <nl> multiscript = CScript ( [ OP_1 , hex_str_to_bytes ( self . pubkey [ - 1 ] ) , OP_1 , OP_CHECKMULTISIG ] ) <nl> - p2sh_addr = self . nodes [ i ] . addwitnessaddress ( newaddress , True ) <nl> + p2sh_addr = self . nodes [ i ] . addwitnessaddress ( newaddress ) <nl> bip173_addr = self . nodes [ i ] . addwitnessaddress ( newaddress , False ) <nl> - p2sh_ms_addr = self . nodes [ i ] . addwitnessaddress ( multiaddress , True ) <nl> + p2sh_ms_addr = self . nodes [ i ] . addwitnessaddress ( multiaddress ) <nl> bip173_ms_addr = self . nodes [ i ] . addwitnessaddress ( multiaddress , False ) <nl> assert_equal ( p2sh_addr , key_to_p2sh_p2wpkh ( self . pubkey [ - 1 ] ) ) <nl> assert_equal ( bip173_addr , key_to_p2wpkh ( self . pubkey [ - 1 ] ) ) <nl> mmm a / test / functional / signmessages . py <nl> ppp b / test / functional / signmessages . py <nl> class SignMessagesTest ( BitcoinTestFramework ) : <nl> def set_test_params ( self ) : <nl> self . setup_clean_chain = True <nl> self . num_nodes = 1 <nl> + self . extra_args = [ [ " - addresstype = legacy " ] ] <nl> <nl> def run_test ( self ) : <nl> message = ' This is just a test message ' <nl> mmm a / test / functional / test_runner . py <nl> ppp b / test / functional / test_runner . py <nl> <nl> ' mempool_resurrect_test . py ' , <nl> ' txn_doublespend . py - - mineblock ' , <nl> ' txn_clone . py ' , <nl> + ' txn_clone . py - - segwit ' , <nl> ' getchaintips . py ' , <nl> ' rest . py ' , <nl> ' mempool_spendcoinbase . py ' , <nl> mmm a / test / functional / txn_clone . py <nl> ppp b / test / functional / txn_clone . py <nl> def set_test_params ( self ) : <nl> def add_options ( self , parser ) : <nl> parser . add_option ( " - - mineblock " , dest = " mine_block " , default = False , action = " store_true " , <nl> help = " Test double - spend of 1 - confirmed transaction " ) <nl> + parser . add_option ( " - - segwit " , dest = " segwit " , default = False , action = " store_true " , <nl> + help = " Test behaviour with SegWit txn ( which should fail " ) <nl> <nl> def setup_network ( self ) : <nl> # Start with split network : <nl> def setup_network ( self ) : <nl> disconnect_nodes ( self . nodes [ 2 ] , 1 ) <nl> <nl> def run_test ( self ) : <nl> + if self . options . segwit : <nl> + output_type = " p2sh - segwit " <nl> + else : <nl> + output_type = " legacy " <nl> + <nl> # All nodes should start with 1 , 250 BTC : <nl> starting_balance = 1250 <nl> for i in range ( 4 ) : <nl> def run_test ( self ) : <nl> # Assign coins to foo and bar accounts : <nl> self . nodes [ 0 ] . settxfee ( . 001 ) <nl> <nl> - node0_address_foo = self . nodes [ 0 ] . getnewaddress ( " foo " ) <nl> + node0_address_foo = self . nodes [ 0 ] . getnewaddress ( " foo " , output_type ) <nl> fund_foo_txid = self . nodes [ 0 ] . sendfrom ( " " , node0_address_foo , 1219 ) <nl> fund_foo_tx = self . nodes [ 0 ] . gettransaction ( fund_foo_txid ) <nl> <nl> - node0_address_bar = self . nodes [ 0 ] . getnewaddress ( " bar " ) <nl> + node0_address_bar = self . nodes [ 0 ] . getnewaddress ( " bar " , output_type ) <nl> fund_bar_txid = self . nodes [ 0 ] . sendfrom ( " " , node0_address_bar , 29 ) <nl> fund_bar_tx = self . nodes [ 0 ] . gettransaction ( fund_bar_txid ) <nl> <nl> def run_test ( self ) : <nl> # Send clone and its parent to miner <nl> self . nodes [ 2 ] . sendrawtransaction ( fund_foo_tx [ " hex " ] ) <nl> txid1_clone = self . nodes [ 2 ] . sendrawtransaction ( tx1_clone [ " hex " ] ) <nl> + if self . options . segwit : <nl> + assert_equal ( txid1 , txid1_clone ) <nl> + return <nl> + <nl> # . . . mine a block . . . <nl> self . nodes [ 2 ] . generate ( 1 ) <nl> <nl> mmm a / test / functional / wallet - dump . py <nl> ppp b / test / functional / wallet - dump . py <nl> def read_dump ( file_name , addrs , hd_master_addr_old ) : <nl> class WalletDumpTest ( BitcoinTestFramework ) : <nl> def set_test_params ( self ) : <nl> self . num_nodes = 1 <nl> - self . extra_args = [ [ " - keypool = 90 " ] ] <nl> + self . extra_args = [ [ " - keypool = 90 " , " - addresstype = legacy " ] ] <nl> <nl> def setup_network ( self , split = False ) : <nl> # Use 1 minute timeout because the initial getnewaddress RPC can take <nl> mmm a / test / functional / wallet . py <nl> ppp b / test / functional / wallet . py <nl> def check_fee_amount ( self , curr_balance , balance_with_fee , fee_per_byte , tx_size <nl> assert_fee_amount ( fee , tx_size , fee_per_byte * 1000 ) <nl> return curr_balance <nl> <nl> + def get_vsize ( self , txn ) : <nl> + return self . nodes [ 0 ] . decoderawtransaction ( txn ) [ ' vsize ' ] <nl> + <nl> def run_test ( self ) : <nl> # Check that there ' s no UTXO on none of the nodes <nl> assert_equal ( len ( self . nodes [ 0 ] . listunspent ( ) ) , 0 ) <nl> def run_test ( self ) : <nl> txid = self . nodes [ 2 ] . sendtoaddress ( address , 10 , " " , " " , False ) <nl> self . nodes [ 2 ] . generate ( 1 ) <nl> self . sync_all ( [ self . nodes [ 0 : 3 ] ] ) <nl> - node_2_bal = self . check_fee_amount ( self . nodes [ 2 ] . getbalance ( ) , Decimal ( ' 84 ' ) , fee_per_byte , count_bytes ( self . nodes [ 2 ] . getrawtransaction ( txid ) ) ) <nl> + node_2_bal = self . check_fee_amount ( self . nodes [ 2 ] . getbalance ( ) , Decimal ( ' 84 ' ) , fee_per_byte , self . get_vsize ( self . nodes [ 2 ] . getrawtransaction ( txid ) ) ) <nl> assert_equal ( self . nodes [ 0 ] . getbalance ( ) , Decimal ( ' 10 ' ) ) <nl> <nl> # Send 10 BTC with subtract fee from amount <nl> def run_test ( self ) : <nl> self . sync_all ( [ self . nodes [ 0 : 3 ] ] ) <nl> node_2_bal - = Decimal ( ' 10 ' ) <nl> assert_equal ( self . nodes [ 2 ] . getbalance ( ) , node_2_bal ) <nl> - node_0_bal = self . check_fee_amount ( self . nodes [ 0 ] . getbalance ( ) , Decimal ( ' 20 ' ) , fee_per_byte , count_bytes ( self . nodes [ 2 ] . getrawtransaction ( txid ) ) ) <nl> + node_0_bal = self . check_fee_amount ( self . nodes [ 0 ] . getbalance ( ) , Decimal ( ' 20 ' ) , fee_per_byte , self . get_vsize ( self . nodes [ 2 ] . getrawtransaction ( txid ) ) ) <nl> <nl> # Sendmany 10 BTC <nl> txid = self . nodes [ 2 ] . sendmany ( ' from1 ' , { address : 10 } , 0 , " " , [ ] ) <nl> self . nodes [ 2 ] . generate ( 1 ) <nl> self . sync_all ( [ self . nodes [ 0 : 3 ] ] ) <nl> node_0_bal + = Decimal ( ' 10 ' ) <nl> - node_2_bal = self . check_fee_amount ( self . nodes [ 2 ] . getbalance ( ) , node_2_bal - Decimal ( ' 10 ' ) , fee_per_byte , count_bytes ( self . nodes [ 2 ] . getrawtransaction ( txid ) ) ) <nl> + node_2_bal = self . check_fee_amount ( self . nodes [ 2 ] . getbalance ( ) , node_2_bal - Decimal ( ' 10 ' ) , fee_per_byte , self . get_vsize ( self . nodes [ 2 ] . getrawtransaction ( txid ) ) ) <nl> assert_equal ( self . nodes [ 0 ] . getbalance ( ) , node_0_bal ) <nl> <nl> # Sendmany 10 BTC with subtract fee from amount <nl> def run_test ( self ) : <nl> self . sync_all ( [ self . nodes [ 0 : 3 ] ] ) <nl> node_2_bal - = Decimal ( ' 10 ' ) <nl> assert_equal ( self . nodes [ 2 ] . getbalance ( ) , node_2_bal ) <nl> - node_0_bal = self . check_fee_amount ( self . nodes [ 0 ] . getbalance ( ) , node_0_bal + Decimal ( ' 10 ' ) , fee_per_byte , count_bytes ( self . nodes [ 2 ] . getrawtransaction ( txid ) ) ) <nl> + node_0_bal = self . check_fee_amount ( self . nodes [ 0 ] . getbalance ( ) , node_0_bal + Decimal ( ' 10 ' ) , fee_per_byte , self . get_vsize ( self . nodes [ 2 ] . getrawtransaction ( txid ) ) ) <nl> <nl> # Test ResendWalletTransactions : <nl> # Create a couple of transactions , then start up a fourth <nl>
SegWit wallet support
bitcoin/bitcoin
940a21932ba769ba5829cba713579db84f96d2f8
2018-01-09T23:35:31Z
mmm a / src / compiler / backend / register - allocator . cc <nl> ppp b / src / compiler / backend / register - allocator . cc <nl> void LinearScanAllocator : : UpdateDeferredFixedRanges ( SpillMode spill_mode , <nl> RegisterName ( other - > assigned_register ( ) ) ) ; <nl> LiveRange * split_off = <nl> other - > SplitAt ( next_start , data ( ) - > allocation_zone ( ) ) ; <nl> + / / Try to get the same register after the deferred block . <nl> + split_off - > set_controlflow_hint ( other - > assigned_register ( ) ) ; <nl> DCHECK_NE ( split_off , other ) ; <nl> AddToUnhandled ( split_off ) ; <nl> update_caches ( other ) ; <nl>
[ reg - alloc ] Try to use same register after deferred - fixed range
v8/v8
caf3c4b8b9e4cab8016d7fcc7d095ced5c146050
2019-07-01T11:26:21Z
mmm a / tools / cocos2d - console <nl> ppp b / tools / cocos2d - console <nl> @ @ - 1 + 1 @ @ <nl> - Subproject commit 3391c05ab7932eb0f76a2c8feb72c121bde0bbb1 <nl> + Subproject commit 3088584db9d3b360831eecd148e8257d79c44e71 <nl>
Update the reference of submodule cocos2d - console
cocos2d/cocos2d-x
6603d7183a64730d8bc3659f6a6d675988396891
2014-11-28T05:41:52Z
mmm a / build_dxvk . sh <nl> ppp b / build_dxvk . sh <nl> meson - - prefix = " $ TOP " / dxvk / dist . $ TYPE - - cross - file build - $ TYPE . txt build . $ TYPE <nl> <nl> cd build . $ TYPE <nl> <nl> - meson configure - Dprefix = " $ TOP " / dxvk / dist . $ TYPE <nl> - meson configure - Dbuildtype = release <nl> + meson configure - Dprefix = " $ TOP " / dxvk - Dbuildtype = release <nl> <nl> ninja <nl> - ninja install <nl> + <nl> + # build on Arch Linux and deploy into git , see build_proton . sh <nl> + mkdir - p " $ TOP " / dxvk . $ TYPE <nl> + cp src / dxgi / dxgi . dll " $ TOP " / dxvk . $ TYPE / <nl> + strip " $ TOP " / dxvk . $ TYPE / dxgi . dll <nl> + cp src / d3d11 / d3d11 . dll " $ TOP " / dxvk . $ TYPE / <nl> + strip " $ TOP " / dxvk . $ TYPE / d3d11 . dll <nl> + echo " build_dxvk : $ TYPE build done " <nl> <nl> # mark as built <nl> - touch " $ TOP " / dxvk / proton . $ TYPE . built <nl> + # touch " $ TOP " / dxvk / proton . $ TYPE . built <nl> mmm a / build_proton . sh <nl> ppp b / build_proton . sh <nl> cp - a vrclient . dll . fake " $ DST_DIR " / lib / wine / fakedlls / vrclient . dll <nl> <nl> # build dxvk <nl> <nl> + # Debian 9 is too old to build dxvk , so I gave up and I ' m building it on my Arch <nl> + # Linux box and checking the binaries into Git instead . Blech . - - aeikum <nl> + cd " $ TOP " <nl> + cp " dxvk . win64 / dxgi . dll " " $ DST_DIR " / lib64 / wine / dxvk / <nl> + cp " dxvk . win64 / d3d11 . dll " " $ DST_DIR " / lib64 / wine / dxvk / <nl> + cp " dxvk . win32 / dxgi . dll " " $ DST_DIR " / lib / wine / dxvk / <nl> + cp " dxvk . win32 / d3d11 . dll " " $ DST_DIR " / lib / wine / dxvk / <nl> + <nl> # unfortunately the Steam runtime chroot is too old to build dxvk , so <nl> # we have to build it in the host system <nl> <nl> cp - a vrclient . dll . fake " $ DST_DIR " / lib / wine / fakedlls / vrclient . dll <nl> # update - alternatives - - config i686 - w64 - mingw32 - gcc <nl> # update - alternatives - - config x86_64 - w64 - mingw32 - g + + <nl> # update - alternatives - - config x86_64 - w64 - mingw32 - gcc <nl> - cd " $ TOP " <nl> - if [ ! - e dxvk / proton . win64 . built ] ; then <nl> - PATH = " $ TOP " / glslang / bin / : " $ PATH " bash . / build_dxvk . sh win64 <nl> - fi <nl> - if [ ! - e dxvk / proton . win32 . built ] ; then <nl> - PATH = " $ TOP " / glslang / bin / : " $ PATH " bash . / build_dxvk . sh win32 <nl> - fi <nl> - <nl> - mkdir - p " $ DST_DIR " / lib / wine / dxvk <nl> - cp - a dxvk / dist . win32 / bin / dxgi . dll " $ DST_DIR " / lib / wine / dxvk / <nl> - cp - a dxvk / dist . win32 / bin / d3d11 . dll " $ DST_DIR " / lib / wine / dxvk / <nl> - <nl> - mkdir - p " $ DST_DIR " / lib64 / wine / dxvk <nl> - cp - a dxvk / dist . win64 / bin / dxgi . dll " $ DST_DIR " / lib64 / wine / dxvk / <nl> - cp - a dxvk / dist . win64 / bin / d3d11 . dll " $ DST_DIR " / lib64 / wine / dxvk / <nl> + # cd " $ TOP " <nl> + # if [ ! - e dxvk / proton . win64 . built ] ; then <nl> + # PATH = " $ TOP " / glslang / bin / : " $ PATH " bash . / build_dxvk . sh win64 <nl> + # fi <nl> + # if [ ! - e dxvk / proton . win32 . built ] ; then <nl> + # PATH = " $ TOP " / glslang / bin / : " $ PATH " bash . / build_dxvk . sh win32 <nl> + # fi <nl> + # <nl> + # mkdir - p " $ DST_DIR " / lib / wine / dxvk <nl> + # cp - a dxvk / dist . win32 / bin / dxgi . dll " $ DST_DIR " / lib / wine / dxvk / <nl> + # cp - a dxvk / dist . win32 / bin / d3d11 . dll " $ DST_DIR " / lib / wine / dxvk / <nl> + # <nl> + # mkdir - p " $ DST_DIR " / lib64 / wine / dxvk <nl> + # cp - a dxvk / dist . win64 / bin / dxgi . dll " $ DST_DIR " / lib64 / wine / dxvk / <nl> + # cp - a dxvk / dist . win64 / bin / d3d11 . dll " $ DST_DIR " / lib64 / wine / dxvk / <nl> <nl> echo " Packaging . . . " <nl> cd " $ TOP " <nl>
dxvk : Give up building on debian
ValveSoftware/Proton
ecc023db9063f7a66e112b8bd23126a971a026e2
2018-02-23T16:57:38Z
mmm a / build / fbcode_builder / getdeps . py <nl> ppp b / build / fbcode_builder / getdeps . py <nl> def run ( self , args ) : <nl> <nl> <nl> def build_argparser ( ) : <nl> - ap = argparse . ArgumentParser ( description = " Get and build dependencies and projects " ) <nl> + common_args = argparse . ArgumentParser ( add_help = False ) <nl> + common_args . add_argument ( <nl> + " - - scratch - path " , help = " Where to maintain checkouts and build dirs " <nl> + ) <nl> + common_args . add_argument ( <nl> + " - - install - prefix " , <nl> + help = ( <nl> + " Where the final build products will be installed " <nl> + " ( default is [ scratch - path ] / installed ) " <nl> + ) , <nl> + ) <nl> + common_args . add_argument ( <nl> + " - - num - jobs " , <nl> + type = int , <nl> + help = ( <nl> + " Number of concurrent jobs to use while building . " <nl> + " ( default = number of cpu cores ) " <nl> + ) , <nl> + ) <nl> + <nl> + ap = argparse . ArgumentParser ( <nl> + description = " Get and build dependencies and projects " , parents = [ common_args ] <nl> + ) <nl> sub = ap . add_subparsers ( <nl> # metavar suppresses the long and ugly default list of subcommands on a <nl> # single line . We still render the nicer list below where we would <nl> def build_argparser ( ) : <nl> help = " " , <nl> ) <nl> <nl> - add_subcommands ( sub ) <nl> + add_subcommands ( sub , common_args ) <nl> <nl> return ap <nl> <nl> new file mode 100644 <nl> index 00000000000 . . 9fbdbcf7168 <nl> mmm / dev / null <nl> ppp b / build / fbcode_builder / getdeps / buildopts . py <nl> <nl> + # Copyright ( c ) 2019 - present , Facebook , Inc . <nl> + # All rights reserved . <nl> + # <nl> + # This source code is licensed under the BSD - style license found in the <nl> + # LICENSE file in the root directory of this source tree . An additional grant <nl> + # of patent rights can be found in the PATENTS file in the same directory . <nl> + <nl> + from __future__ import absolute_import , division , print_function , unicode_literals <nl> + <nl> + import errno <nl> + import os <nl> + import subprocess <nl> + import tempfile <nl> + <nl> + from . platform import HostType , is_windows <nl> + <nl> + <nl> + def containing_repo_type ( path ) : <nl> + while True : <nl> + if os . path . exists ( os . path . join ( path , " . git " ) ) : <nl> + return ( " git " , path ) <nl> + if os . path . exists ( os . path . join ( path , " . hg " ) ) : <nl> + return ( " hg " , path ) <nl> + <nl> + parent = os . path . dirname ( path ) <nl> + if parent = = path : <nl> + return None <nl> + path = parent <nl> + <nl> + <nl> + class BuildOptions ( object ) : <nl> + def __init__ ( <nl> + self , fbcode_builder_dir , scratch_dir , host_type , install_dir = None , num_jobs = 0 <nl> + ) : <nl> + " " " fbcode_builder_dir - the path to either the in - fbsource fbcode_builder dir , <nl> + or for shipit - transformed repos , the build dir that <nl> + has been mapped into that dir . <nl> + scratch_dir - a place where we can store repos and build bits . <nl> + This path should be stable across runs and ideally <nl> + should not be in the repo of the project being built , <nl> + but that is ultimately where we generally fall back <nl> + for builds outside of FB <nl> + install_dir - where the project will ultimately be installed <nl> + num_jobs - the level of concurrency to use while building <nl> + " " " <nl> + if not num_jobs : <nl> + import multiprocessing <nl> + <nl> + num_jobs = multiprocessing . cpu_count ( ) <nl> + <nl> + if not install_dir : <nl> + install_dir = os . path . join ( scratch_dir , " install " ) <nl> + <nl> + self . project_hashes = None <nl> + for p in [ " . . / deps / github_hashes " , " . . / project_hashes " ] : <nl> + hashes = os . path . join ( fbcode_builder_dir , p ) <nl> + if os . path . exists ( hashes ) : <nl> + self . project_hashes = hashes <nl> + break <nl> + <nl> + # Use a simplistic heuristic to figure out if we ' re in fbsource <nl> + # and where the root of fbsource can be found <nl> + repo_type , repo_root = containing_repo_type ( fbcode_builder_dir ) <nl> + if repo_type = = " hg " : <nl> + self . fbsource_dir = repo_root <nl> + else : <nl> + self . fbsource_dir = None <nl> + <nl> + self . num_jobs = num_jobs <nl> + self . scratch_dir = scratch_dir <nl> + self . install_dir = install_dir <nl> + self . fbcode_builder_dir = fbcode_builder_dir <nl> + self . host_type = host_type <nl> + <nl> + def is_darwin ( self ) : <nl> + return self . host_type . is_darwin ( ) <nl> + <nl> + def is_windows ( self ) : <nl> + return self . host_type . is_windows ( ) <nl> + <nl> + def is_linux ( self ) : <nl> + return self . host_type . is_linux ( ) <nl> + <nl> + <nl> + def list_win32_subst_letters ( ) : <nl> + output = subprocess . check_output ( [ " subst " ] ) . decode ( " utf - 8 " ) <nl> + # The output is a set of lines like : ` F : \ : = > C : \ open \ some \ where ` <nl> + lines = output . strip ( ) . split ( " \ r \ n " ) <nl> + mapping = { } <nl> + for line in lines : <nl> + fields = line . split ( " : = > " ) <nl> + if len ( fields ) ! = 2 : <nl> + continue <nl> + letter = fields [ 0 ] <nl> + path = fields [ 1 ] <nl> + mapping [ letter ] = path <nl> + <nl> + return mapping <nl> + <nl> + <nl> + def find_existing_win32_subst_for_path ( path ) : <nl> + path = os . path . normpath ( path ) <nl> + mapping = list_win32_subst_letters ( ) <nl> + for letter , target in mapping . items ( ) : <nl> + if target = = path : <nl> + return letter <nl> + return None <nl> + <nl> + <nl> + def find_unused_drive_letter ( ) : <nl> + import ctypes <nl> + <nl> + buffer_len = 256 <nl> + blen = ctypes . c_uint ( buffer_len ) <nl> + rv = ctypes . c_uint ( ) <nl> + bufs = ctypes . create_string_buffer ( buffer_len ) <nl> + rv = ctypes . windll . kernel32 . GetLogicalDriveStringsA ( blen , bufs ) <nl> + if rv > buffer_len : <nl> + raise Exception ( " GetLogicalDriveStringsA result too large for buffer " ) <nl> + nul = " \ x00 " . encode ( " ascii " ) <nl> + <nl> + used = [ drive . decode ( " ascii " ) [ 0 ] for drive in bufs . raw . strip ( nul ) . split ( nul ) ] <nl> + possible = [ c for c in " ABCDEFGHIJKLMNOPQRSTUVWXYZ " ] <nl> + available = sorted ( list ( set ( possible ) - set ( used ) ) ) <nl> + if len ( available ) = = 0 : <nl> + return None <nl> + # Prefer to assign later letters rather than earlier letters <nl> + return available [ - 1 ] <nl> + <nl> + <nl> + def create_subst_path ( path ) : <nl> + for _attempt in range ( 0 , 24 ) : <nl> + drive = find_existing_win32_subst_for_path ( path ) <nl> + if drive : <nl> + return drive <nl> + available = find_unused_drive_letter ( ) <nl> + if available is None : <nl> + raise Exception ( <nl> + ( <nl> + " unable to make shorter subst mapping for % s ; " <nl> + " no available drive letters " <nl> + ) <nl> + % path <nl> + ) <nl> + <nl> + # Try to set up a subst mapping ; note that we may be racing with <nl> + # other processes on the same host , so this may not succeed . <nl> + try : <nl> + subprocess . check_call ( [ " subst " , " % s : " % available , path ] ) <nl> + return " % s : \ \ " % available <nl> + except Exception : <nl> + print ( " Failed to map % s - > % s " % ( available , path ) ) <nl> + <nl> + raise Exception ( " failed to set up a subst path for % s " % path ) <nl> + <nl> + <nl> + def _check_host_type ( args , host_type ) : <nl> + if host_type is None : <nl> + host_tuple_string = getattr ( args , " host_type " , None ) <nl> + if host_tuple_string : <nl> + host_type = HostType . from_tuple_string ( host_tuple_string ) <nl> + else : <nl> + host_type = HostType ( ) <nl> + <nl> + assert isinstance ( host_type , HostType ) <nl> + return host_type <nl> + <nl> + <nl> + def setup_build_options ( args , host_type = None ) : <nl> + " " " Create a BuildOptions object based on the arguments " " " <nl> + <nl> + fbcode_builder_dir = os . path . dirname ( os . path . dirname ( os . path . abspath ( __file__ ) ) ) <nl> + scratch_dir = args . scratch_path <nl> + if not scratch_dir : <nl> + # TODO : ` mkscratch ` doesn ' t currently know how best to place things on <nl> + # sandcastle , so whip up something reasonable - ish <nl> + if " SANDCASTLE " in os . environ : <nl> + if " DISK_TEMP " not in os . environ : <nl> + raise Exception ( <nl> + ( <nl> + " I need DISK_TEMP to be set in the sandcastle environment " <nl> + " so that I can store build products somewhere sane " <nl> + ) <nl> + ) <nl> + scratch_dir = os . path . join ( <nl> + os . environ [ " DISK_TEMP " ] , " fbcode_builder_getdeps " <nl> + ) <nl> + if not scratch_dir : <nl> + try : <nl> + scratch_dir = ( <nl> + subprocess . check_output ( <nl> + [ " mkscratch " , " path " , " - - subdir " , " fbcode_builder_getdeps " ] <nl> + ) <nl> + . strip ( ) <nl> + . decode ( " utf - 8 " ) <nl> + ) <nl> + except OSError as exc : <nl> + if exc . errno ! = errno . ENOENT : <nl> + # A legit failure ; don ' t fall back , surface the error <nl> + raise <nl> + # This system doesn ' t have mkscratch so we fall back to <nl> + # something local . <nl> + munged = fbcode_builder_dir . replace ( " Z " , " zZ " ) <nl> + for s in [ " / " , " \ \ " , " : " ] : <nl> + munged = munged . replace ( s , " Z " ) <nl> + scratch_dir = os . path . join ( <nl> + tempfile . gettempdir ( ) , " fbcode_builder_getdeps - % s " % munged <nl> + ) <nl> + <nl> + if not os . path . exists ( scratch_dir ) : <nl> + os . makedirs ( scratch_dir ) <nl> + <nl> + if is_windows ( ) : <nl> + subst = create_subst_path ( scratch_dir ) <nl> + print ( " Mapping scratch dir % s - > % s " % ( scratch_dir , subst ) ) <nl> + scratch_dir = subst <nl> + <nl> + host_type = _check_host_type ( args , host_type ) <nl> + <nl> + return BuildOptions ( <nl> + fbcode_builder_dir , <nl> + scratch_dir , <nl> + host_type , <nl> + install_dir = args . install_prefix , <nl> + num_jobs = args . num_jobs , <nl> + ) <nl> mmm a / build / fbcode_builder / getdeps / subcmd . py <nl> ppp b / build / fbcode_builder / getdeps / subcmd . py <nl> def setup_parser ( self , parser ) : <nl> CmdTable = [ ] <nl> <nl> <nl> - def add_subcommands ( parser , cmd_table = CmdTable ) : <nl> + def add_subcommands ( parser , common_args , cmd_table = CmdTable ) : <nl> " " " Register parsers for the defined commands with the provided parser " " " <nl> for cls in cmd_table : <nl> command = cls ( ) <nl> - command_parser = parser . add_parser ( command . NAME , help = command . HELP ) <nl> + command_parser = parser . add_parser ( <nl> + command . NAME , help = command . HELP , parents = [ common_args ] <nl> + ) <nl> command . setup_parser ( command_parser ) <nl> command_parser . set_defaults ( func = command . run ) <nl> <nl>
fbcode_builder : getdeps : add build options
facebook/folly
e2b8115552ca8bfe516993f6ef43897167171344
2019-05-03T22:58:44Z
mmm a / README . md <nl> ppp b / README . md <nl> Apache MXNet ( incubating ) for Deep Learning <nl> = = = = = <nl> | Master | Docs | License | <nl> | : mmmmmmmmmmmm - : | : mmmmmmmmmmmm - : | : mmmmmm - - : | <nl> - | [ ! [ Build Status ] ( http : / / jenkins . mxnet - ci . amazon - ml . com / job / incubator - mxnet / job / master / badge / icon ) ] ( http : / / jenkins . mxnet - ci . amazon - ml . com / job / incubator - mxnet / job / master / ) | [ ! [ Documentation Status ] ( http : / / jenkins . mxnet - ci . amazon - ml . com / job / restricted - website - build / badge / icon ) ] ( https : / / mxnet . incubator . apache . org / ) | [ ! [ GitHub license ] ( http : / / dmlc . github . io / img / apache2 . svg ) ] ( . / LICENSE ) | <nl> + [ ! [ CentOS CPU Build Status ] ( http : / / jenkins . mxnet - ci . amazon - ml . com / job / mxnet - validation / job / centos - cpu / job / master / badge / icon ? subject = build % 20centos % 20cpu ) ] ( http : / / jenkins . mxnet - ci . amazon - ml . com / job / mxnet - validation / job / centos - cpu / job / master / ) [ ! [ CentOS GPU Build Status ] ( http : / / jenkins . mxnet - ci . amazon - ml . com / job / mxnet - validation / job / centos - gpu / job / master / badge / icon ? subject = build % 20centos % 20gpu ) ] ( http : / / jenkins . mxnet - ci . amazon - ml . com / job / mxnet - validation / job / centos - gpu / job / master / ) [ ! [ Clang Build Status ] ( http : / / jenkins . mxnet - ci . amazon - ml . com / job / mxnet - validation / job / clang / job / master / badge / icon ? subject = build % 20clang ) ] ( http : / / jenkins . mxnet - ci . amazon - ml . com / job / mxnet - validation / job / clang / job / master / ) < br > [ ! [ Edge Build Status ] ( http : / / jenkins . mxnet - ci . amazon - ml . com / job / mxnet - validation / job / edge / job / master / badge / icon ? subject = build % 20edge ) ] ( http : / / jenkins . mxnet - ci . amazon - ml . com / job / mxnet - validation / job / edge / job / master / ) [ ! [ Miscellaneous Build Status ] ( http : / / jenkins . mxnet - ci . amazon - ml . com / job / mxnet - validation / job / miscellaneous / job / master / badge / icon ? subject = build % 20miscellaneous ) ] ( http : / / jenkins . mxnet - ci . amazon - ml . com / job / mxnet - validation / job / miscellaneous / job / master / ) [ ! [ Sanity Build Status ] ( http : / / jenkins . mxnet - ci . amazon - ml . com / job / mxnet - validation / job / sanity / job / master / badge / icon ? subject = build % 20sanity ) ] ( http : / / jenkins . mxnet - ci . amazon - ml . com / job / mxnet - validation / job / sanity / job / master / ) < br > [ ! [ Unix CPU Build Status ] ( http : / / jenkins . mxnet - ci . amazon - ml . com / job / mxnet - validation / job / unix - cpu / job / master / badge / icon ? subject = build % 20unix % 20cpu ) ] ( http : / / jenkins . mxnet - ci . amazon - ml . com / job / mxnet - validation / job / unix - cpu / job / master / ) [ ! [ Unix GPU Build Status ] ( http : / / jenkins . mxnet - ci . amazon - ml . com / job / mxnet - validation / job / unix - gpu / job / master / badge / icon ? subject = build % 20unix % 20gpu ) ] ( http : / / jenkins . mxnet - ci . amazon - ml . com / job / mxnet - validation / job / unix - gpu / job / master / ) [ ! [ Website Build Status ] ( http : / / jenkins . mxnet - ci . amazon - ml . com / job / mxnet - validation / job / website / job / master / badge / icon ? subject = build % 20website ) ] ( http : / / jenkins . mxnet - ci . amazon - ml . com / job / mxnet - validation / job / website / job / master / ) < br > [ ! [ Windows CPU Build Status ] ( http : / / jenkins . mxnet - ci . amazon - ml . com / job / mxnet - validation / job / windows - cpu / job / master / badge / icon ? subject = build % 20windows % 20cpu ) ] ( http : / / jenkins . mxnet - ci . amazon - ml . com / job / mxnet - validation / job / windows - cpu / job / master / ) [ ! [ Windows GPU Build Status ] ( http : / / jenkins . mxnet - ci . amazon - ml . com / job / mxnet - validation / job / windows - gpu / job / master / badge / icon ? subject = build % 20windows % 20gpu ) ] ( http : / / jenkins . mxnet - ci . amazon - ml . com / job / mxnet - validation / job / windows - gpu / job / master / ) | [ ! [ Documentation Status ] ( http : / / jenkins . mxnet - ci . amazon - ml . com / job / restricted - website - build / badge / icon ) ] ( https : / / mxnet . incubator . apache . org / ) | [ ! [ GitHub license ] ( http : / / dmlc . github . io / img / apache2 . svg ) ] ( . / LICENSE ) | <nl> <nl> ! [ banner ] ( https : / / raw . githubusercontent . com / dmlc / web - data / master / mxnet / image / banner . png ) <nl> <nl>
Fix README Build Status ( )
apache/incubator-mxnet
995b477d940bcba9927b34cd7bda8cabc85628a5
2019-09-18T20:33:28Z
mmm a / shell / collection . js <nl> ppp b / shell / collection . js <nl> DBCollection . prototype . ensureIndex = function ( keys , options ) { <nl> } <nl> <nl> this . createIndex ( keys , options ) ; <nl> + var e = this . _db . getLastError ( ) ; <nl> + if ( e ! = null ) <nl> + throw e ; <nl> + <nl> if ( this . getDB ( ) . getLastError ( ) = = " " ) { <nl> this . _indexCache [ name ] = true ; <nl> } <nl> + <nl> return true ; <nl> } <nl> <nl>
fix ensureIndex to return errors
mongodb/mongo
8615f7d1cd2a4443b4ae6d2ce478d638021cfcab
2009-10-20T20:15:27Z
mmm a / tensorflow / core / kernels / conv_ops_test . cc <nl> ppp b / tensorflow / core / kernels / conv_ops_test . cc <nl> TEST_F ( FusedResizePadConvOpTest , ResizeAndPadSymmetricComparativeLarge ) { <nl> " SYMMETRIC " , 1 , " SAME " ) ; <nl> } <nl> <nl> + class ConvOpTest : public OpsTestBase { <nl> + protected : <nl> + void HandwrittenConv ( ) { <nl> + const int stride = 1 ; <nl> + TF_EXPECT_OK ( NodeDefBuilder ( " conv_op " , " Conv2D " ) <nl> + . Input ( FakeInput ( DT_FLOAT ) ) <nl> + . Input ( FakeInput ( DT_FLOAT ) ) <nl> + . Attr ( " T " , DT_FLOAT ) <nl> + . Attr ( " strides " , { 1 , stride , stride , 1 } ) <nl> + . Attr ( " padding " , " SAME " ) <nl> + . Finalize ( node_def ( ) ) ) ; <nl> + TF_EXPECT_OK ( InitOp ( ) ) ; <nl> + const int depth = 1 ; <nl> + const int image_width = 4 ; <nl> + const int image_height = 3 ; <nl> + const int image_batch_count = 1 ; <nl> + / / The image matrix is : <nl> + / / | 1 | 2 | 3 | 4 | <nl> + / / | 5 | 6 | 7 | 8 | <nl> + / / | 9 | 10 | 11 | 12 | <nl> + Tensor image ( DT_FLOAT , <nl> + { image_batch_count , image_height , image_width , depth } ) ; <nl> + test : : FillValues < float > ( & image , { 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 , 11 , 12 } ) ; <nl> + <nl> + / / The filter matrix is : <nl> + / / | 1 | 4 | 7 | <nl> + / / | 2 | 5 | 8 | <nl> + / / | 3 | 6 | 9 | <nl> + const int filter_size = 3 ; <nl> + const int filter_count = 1 ; <nl> + Tensor filter ( DT_FLOAT , { filter_size , filter_size , depth , filter_count } ) ; <nl> + test : : FillValues < float > ( & filter , { 1 , 4 , 7 , 2 , 5 , 8 , 3 , 6 , 9 } ) ; <nl> + <nl> + AddInputFromArray < float > ( image . shape ( ) , image . flat < float > ( ) ) ; <nl> + AddInputFromArray < float > ( filter . shape ( ) , filter . flat < float > ( ) ) ; <nl> + TF_ASSERT_OK ( RunOpKernel ( ) ) ; <nl> + <nl> + / / We ' re sliding the 3x3 filter across the 3x4 image , with accesses outside <nl> + / / the input set to zero because we ' re using the ' SAME ' padding mode . <nl> + / / The calculations behind the expected output are : <nl> + / / ( 1 * 0 ) + ( 4 * 0 ) + ( 7 * 0 ) + ( 2 * 0 ) + ( 5 * 1 ) + ( 8 * 2 ) + ( 3 * 0 ) + ( 6 * 5 ) + ( 9 * 6 ) = 105 <nl> + / / ( 1 * 0 ) + ( 4 * 0 ) + ( 7 * 0 ) + ( 2 * 1 ) + ( 5 * 2 ) + ( 8 * 3 ) + ( 3 * 5 ) + ( 6 * 6 ) + ( 9 * 7 ) = 150 <nl> + / / ( 1 * 0 ) + ( 4 * 0 ) + ( 7 * 0 ) + ( 2 * 2 ) + ( 5 * 3 ) + ( 8 * 4 ) + ( 3 * 6 ) + ( 6 * 7 ) + ( 9 * 8 ) = 183 <nl> + / / ( 1 * 0 ) + ( 4 * 0 ) + ( 7 * 0 ) + ( 2 * 3 ) + ( 5 * 4 ) + ( 8 * 0 ) + ( 3 * 7 ) + ( 6 * 8 ) + ( 9 * 0 ) = 95 <nl> + / / ( 1 * 0 ) + ( 4 * 1 ) + ( 7 * 2 ) + ( 2 * 0 ) + ( 5 * 5 ) + ( 8 * 6 ) + ( 3 * 0 ) + ( 6 * 9 ) + ( 9 * 10 ) = 235 <nl> + / / ( 1 * 1 ) + ( 4 * 2 ) + ( 7 * 3 ) + ( 2 * 5 ) + ( 5 * 6 ) + ( 8 * 7 ) + ( 3 * 9 ) + ( 6 * 10 ) + ( 9 * 11 ) = 312 <nl> + / / ( 1 * 2 ) + ( 4 * 3 ) + ( 7 * 4 ) + ( 2 * 6 ) + ( 5 * 7 ) + ( 8 * 8 ) + ( 3 * 10 ) + ( 6 * 11 ) + ( 9 * 12 ) = 357 <nl> + / / ( 1 * 3 ) + ( 4 * 4 ) + ( 7 * 0 ) + ( 2 * 7 ) + ( 5 * 8 ) + ( 8 * 0 ) + ( 3 * 11 ) + ( 6 * 12 ) + ( 9 * 0 ) = 178 <nl> + / / ( 1 * 0 ) + ( 4 * 5 ) + ( 7 * 6 ) + ( 2 * 0 ) + ( 5 * 9 ) + ( 8 * 10 ) + ( 3 * 0 ) + ( 6 * 0 ) + ( 9 * 0 ) = 187 <nl> + / / ( 1 * 5 ) + ( 4 * 6 ) + ( 7 * 7 ) + ( 2 * 9 ) + ( 5 * 10 ) + ( 8 * 11 ) + ( 3 * 0 ) + ( 6 * 0 ) + ( 9 * 0 ) = 234 <nl> + / / ( 1 * 6 ) + ( 4 * 7 ) + ( 7 * 8 ) + ( 2 * 10 ) + ( 5 * 11 ) + ( 8 * 12 ) + ( 3 * 0 ) + ( 6 * 0 ) + ( 9 * 0 ) = 261 <nl> + / / ( 1 * 7 ) + ( 4 * 11 ) + ( 7 * 0 ) + ( 2 * 8 ) + ( 5 * 12 ) + ( 8 * 0 ) + ( 3 * 0 ) + ( 6 * 0 ) + ( 9 * 0 ) = 121 <nl> + / / This means we should end up with this matrix : <nl> + / / | 105 | 150 | 183 | 95 | <nl> + / / | 235 | 312 | 357 | 178 | <nl> + / / | 187 | 234 | 261 | 121 | <nl> + const int expected_width = image_width ; <nl> + const int expected_height = image_height * filter_count ; <nl> + Tensor expected ( DT_FLOAT , TensorShape ( { image_batch_count , expected_height , <nl> + expected_width , filter_count } ) ) ; <nl> + test : : FillValues < float > ( <nl> + & expected , { 105 , 150 , 183 , 95 , 235 , 312 , 357 , 178 , 187 , 234 , 261 , 121 } ) ; <nl> + const Tensor & output = * GetOutput ( 0 ) ; <nl> + test : : ExpectTensorNear < float > ( expected , output , 1e - 5 ) ; <nl> + } <nl> + <nl> + void AnisotropicStrides ( ) { <nl> + const int stride_width = 3 ; <nl> + const int stride_height = 1 ; <nl> + TF_EXPECT_OK ( NodeDefBuilder ( " conv_op " , " Conv2D " ) <nl> + . Input ( FakeInput ( DT_FLOAT ) ) <nl> + . Input ( FakeInput ( DT_FLOAT ) ) <nl> + . Attr ( " T " , DT_FLOAT ) <nl> + . Attr ( " strides " , { 1 , stride_height , stride_width , 1 } ) <nl> + . Attr ( " padding " , " VALID " ) <nl> + . Finalize ( node_def ( ) ) ) ; <nl> + TF_EXPECT_OK ( InitOp ( ) ) ; <nl> + const int depth = 1 ; <nl> + const int image_width = 6 ; <nl> + const int image_height = 3 ; <nl> + const int image_batch_count = 1 ; <nl> + Tensor image ( DT_FLOAT , <nl> + { image_batch_count , image_height , image_width , depth } ) ; <nl> + test : : FillValues < float > ( & image , { <nl> + 3 , 2 , 1 , - 1 , - 2 , - 3 , / / <nl> + 4 , 3 , 2 , - 2 , - 3 , - 4 , / / <nl> + 5 , 4 , 3 , - 3 , - 4 , - 5 , / / <nl> + } ) ; <nl> + const int filter_size = 2 ; <nl> + const int filter_count = 1 ; <nl> + Tensor filter ( DT_FLOAT , { filter_size , filter_size , depth , filter_count } ) ; <nl> + test : : FillValues < float > ( & filter , { <nl> + 1 , 2 , / / <nl> + 3 , 4 , / / <nl> + } ) ; <nl> + <nl> + AddInputFromArray < float > ( image . shape ( ) , image . flat < float > ( ) ) ; <nl> + AddInputFromArray < float > ( filter . shape ( ) , filter . flat < float > ( ) ) ; <nl> + TF_ASSERT_OK ( RunOpKernel ( ) ) ; <nl> + <nl> + const int expected_width = 2 ; <nl> + const int expected_height = 2 ; <nl> + Tensor expected ( DT_FLOAT , TensorShape ( { image_batch_count , expected_height , <nl> + expected_width , filter_count } ) ) ; <nl> + test : : FillValues < float > ( & expected , { 31 , - 23 , 41 , - 33 } ) ; <nl> + const Tensor & output = * GetOutput ( 0 ) ; <nl> + test : : ExpectTensorNear < float > ( expected , output , 1e - 5 ) ; <nl> + } <nl> + } ; <nl> + <nl> + TEST_F ( ConvOpTest , HandwrittenConv ) { HandwrittenConv ( ) ; } <nl> + <nl> + TEST_F ( ConvOpTest , AnisotropicStride ) { AnisotropicStrides ( ) ; } <nl> + <nl> } / / namespace tensorflow <nl>
Moved float conv2d to use multi - threaded EigenTensor implementation .
tensorflow/tensorflow
9a3af1dbb9749a5a509ddac129de4bb260f1a331
2017-11-02T20:03:06Z
mmm a / samples / cpp / select3dobj . cpp <nl> ppp b / samples / cpp / select3dobj . cpp <nl> static Rect extract3DBox ( const Mat & frame , Mat & shownFrame , Mat & selectedObjFram <nl> fillConvexPoly ( selectedObjMask , & hull [ 0 ] , hull . size ( ) , Scalar : : all ( 255 ) , 8 , 0 ) ; <nl> Rect roi = boundingRect ( Mat ( hull ) ) & Rect ( Point ( ) , frame . size ( ) ) ; <nl> <nl> - / / / / / / / / / / / / / / / / / insert GrabCut here / / / / / / / / / / / / / / / / / / / / <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + if ( runExtraSegmentation ) <nl> + { <nl> + selectedObjMask = Scalar : : all ( GC_BGD ) ; <nl> + fillConvexPoly ( selectedObjMask , & hull [ 0 ] , hull . size ( ) , Scalar : : all ( GC_PR_FGD ) , 8 , 0 ) ; <nl> + Mat bgdModel , fgdModel ; <nl> + grabCut ( frame , selectedObjMask , roi , bgdModel , fgdModel , <nl> + 3 , GC_INIT_WITH_RECT + GC_INIT_WITH_MASK ) ; <nl> + bitwise_and ( selectedObjMask , Scalar : : all ( 1 ) , selectedObjMask ) ; <nl> + } <nl> <nl> frame . copyTo ( selectedObjFrame , selectedObjMask ) ; <nl> return roi ; <nl>
added grabcut ( ) call
opencv/opencv
65f3b09d3161cd8b0f68815c1de4d7250af6a90b
2010-06-19T17:25:42Z
mmm a / third_party / fbgemm <nl> ppp b / third_party / fbgemm <nl> @ @ - 1 + 1 @ @ <nl> - Subproject commit fbf509dcb5b6b816f4651e2e6f53accc963743e4 <nl> + Subproject commit 3ee0b7d56f0e41ab88229b6ac7bffffd32087118 <nl>
Updating submodules
pytorch/pytorch
d45e135d8934e8cc1995fd64b62e7f53c9b7edab
2020-03-21T03:08:14Z
mmm a / site / source / docs / getting_started / downloads . rst <nl> ppp b / site / source / docs / getting_started / downloads . rst <nl> Linux <nl> <nl> # Install Java <nl> sudo apt - get install default - jre <nl> + <nl> + . . note : : Your system may provide Node . js as ` ` node ` ` instead of ` ` nodejs ` ` . In that case , you may need to also update the ` ` NODE_JS ` ` attribute of your ` ` ~ / . emscripten ` ` file . <nl> <nl> - * Git * is not installed automatically . Git is only needed if you want to use tools from one of the development branches * * emscripten - incoming * * or * * emscripten - master * * : <nl> <nl>
comment on node / nodejs
emscripten-core/emscripten
da9c47b8b81ca9231d9d4953ccd7ccd909d5cbd1
2015-06-04T20:32:24Z
mmm a / db / memtable . cc <nl> ppp b / db / memtable . cc <nl> void MemTable : : Update ( SequenceNumber seq , <nl> Slice mem_key = lkey . memtable_key ( ) ; <nl> <nl> std : : unique_ptr < MemTableRep : : Iterator > iter ( <nl> - table_ - > GetIterator ( lkey . user_key ( ) ) ) ; <nl> + table_ - > GetDynamicPrefixIterator ( ) ) ; <nl> iter - > Seek ( lkey . internal_key ( ) , mem_key . data ( ) ) ; <nl> <nl> if ( iter - > Valid ( ) ) { <nl> bool MemTable : : UpdateCallback ( SequenceNumber seq , <nl> Slice memkey = lkey . memtable_key ( ) ; <nl> <nl> std : : unique_ptr < MemTableRep : : Iterator > iter ( <nl> - table_ - > GetIterator ( lkey . user_key ( ) ) ) ; <nl> + table_ - > GetDynamicPrefixIterator ( ) ) ; <nl> iter - > Seek ( lkey . internal_key ( ) , memkey . data ( ) ) ; <nl> <nl> if ( iter - > Valid ( ) ) { <nl> size_t MemTable : : CountSuccessiveMergeEntries ( const LookupKey & key ) { <nl> / / reps ) . By passing in the user key , we allow efficient iterator creation . <nl> / / The iterator only needs to be ordered within the same user key . <nl> std : : unique_ptr < MemTableRep : : Iterator > iter ( <nl> - table_ - > GetIterator ( key . user_key ( ) ) ) ; <nl> + table_ - > GetDynamicPrefixIterator ( ) ) ; <nl> iter - > Seek ( key . internal_key ( ) , memkey . data ( ) ) ; <nl> <nl> size_t num_successive_merges = 0 ; <nl> size_t MemTable : : CountSuccessiveMergeEntries ( const LookupKey & key ) { <nl> <nl> void MemTableRep : : Get ( const LookupKey & k , void * callback_args , <nl> bool ( * callback_func ) ( void * arg , const char * entry ) ) { <nl> - auto iter = GetIterator ( k . user_key ( ) ) ; <nl> + auto iter = GetDynamicPrefixIterator ( ) ; <nl> for ( iter - > Seek ( k . internal_key ( ) , k . memtable_key ( ) . data ( ) ) ; <nl> iter - > Valid ( ) & & callback_func ( callback_args , iter - > key ( ) ) ; <nl> iter - > Next ( ) ) { <nl> mmm a / include / rocksdb / memtablerep . h <nl> ppp b / include / rocksdb / memtablerep . h <nl> class MemTableRep { <nl> / / all the states but those allocated in arena . <nl> virtual Iterator * GetIterator ( Arena * arena = nullptr ) = 0 ; <nl> <nl> - / / Return an iterator over at least the keys with the specified user key . The <nl> - / / iterator may also allow access to other keys , but doesn ' t have to . Default : <nl> - / / GetIterator ( ) . <nl> - virtual Iterator * GetIterator ( const Slice & user_key ) { <nl> - return GetIterator ( nullptr ) ; <nl> - } <nl> - <nl> / / Return an iterator that has a special Seek semantics . The result of <nl> / / a Seek might only include keys with the same prefix as the target key . <nl> / / arena : If not null , the arena needs to be used to allocate the Iterator . <nl> mmm a / util / hash_cuckoo_rep . cc <nl> ppp b / util / hash_cuckoo_rep . cc <nl> class HashCuckooRep : public MemTableRep { <nl> bool QuickInsert ( const char * internal_key , const Slice & user_key , <nl> int bucket_ids [ ] , const int initial_hash_id ) ; <nl> <nl> - / / Unhide default implementations of GetIterator <nl> - using MemTableRep : : GetIterator ; <nl> / / Returns the pointer to the internal iterator to the buckets where buckets <nl> / / are sorted according to the user specified KeyComparator . Note that <nl> / / any insert after this function call may affect the sorted nature of <nl> mmm a / util / hash_linklist_rep . cc <nl> ppp b / util / hash_linklist_rep . cc <nl> class HashLinkListRep : public MemTableRep { <nl> <nl> virtual MemTableRep : : Iterator * GetIterator ( Arena * arena = nullptr ) override ; <nl> <nl> - virtual MemTableRep : : Iterator * GetIterator ( const Slice & slice ) override ; <nl> - <nl> virtual MemTableRep : : Iterator * GetDynamicPrefixIterator ( <nl> Arena * arena = nullptr ) override ; <nl> <nl> MemTableRep : : Iterator * HashLinkListRep : : GetIterator ( Arena * alloc_arena ) { <nl> } <nl> } <nl> <nl> - MemTableRep : : Iterator * HashLinkListRep : : GetIterator ( const Slice & slice ) { <nl> - auto bucket = GetBucket ( transform_ - > Transform ( slice ) ) ; <nl> - if ( bucket = = nullptr ) { <nl> - return new EmptyIterator ( ) ; <nl> - } <nl> - return new Iterator ( this , bucket ) ; <nl> - } <nl> - <nl> MemTableRep : : Iterator * HashLinkListRep : : GetDynamicPrefixIterator ( <nl> Arena * alloc_arena ) { <nl> if ( alloc_arena = = nullptr ) { <nl> mmm a / util / hash_skiplist_rep . cc <nl> ppp b / util / hash_skiplist_rep . cc <nl> class HashSkipListRep : public MemTableRep { <nl> <nl> virtual MemTableRep : : Iterator * GetIterator ( Arena * arena = nullptr ) override ; <nl> <nl> - virtual MemTableRep : : Iterator * GetIterator ( const Slice & slice ) override ; <nl> - <nl> virtual MemTableRep : : Iterator * GetDynamicPrefixIterator ( <nl> Arena * arena = nullptr ) override ; <nl> <nl> MemTableRep : : Iterator * HashSkipListRep : : GetIterator ( Arena * arena ) { <nl> } <nl> } <nl> <nl> - MemTableRep : : Iterator * HashSkipListRep : : GetIterator ( const Slice & slice ) { <nl> - auto bucket = GetBucket ( transform_ - > Transform ( slice ) ) ; <nl> - if ( bucket = = nullptr ) { <nl> - return new EmptyIterator ( ) ; <nl> - } <nl> - return new Iterator ( bucket , false ) ; <nl> - } <nl> - <nl> MemTableRep : : Iterator * HashSkipListRep : : GetDynamicPrefixIterator ( Arena * arena ) { <nl> if ( arena = = nullptr ) { <nl> return new DynamicIterator ( * this ) ; <nl> mmm a / util / skiplistrep . cc <nl> ppp b / util / skiplistrep . cc <nl> class SkipListRep : public MemTableRep { <nl> std : : string tmp_ ; / / For passing to EncodeKey <nl> } ; <nl> <nl> - / / Unhide default implementations of GetIterator <nl> - using MemTableRep : : GetIterator ; <nl> - <nl> virtual MemTableRep : : Iterator * GetIterator ( Arena * arena = nullptr ) override { <nl> if ( arena = = nullptr ) { <nl> return new SkipListRep : : Iterator ( & skip_list_ ) ; <nl> mmm a / util / vectorrep . cc <nl> ppp b / util / vectorrep . cc <nl> class VectorRep : public MemTableRep { <nl> virtual void SeekToLast ( ) override ; <nl> } ; <nl> <nl> - / / Unhide default implementations of GetIterator ( ) <nl> - using MemTableRep : : GetIterator ; <nl> - <nl> / / Return an iterator over the keys in this representation . <nl> virtual MemTableRep : : Iterator * GetIterator ( Arena * arena ) override ; <nl> <nl>
Remove MemTableRep : : GetIterator ( const Slice & slice )
facebook/rocksdb
19de6a7aadf333d4c3a6bb5a790e21cfa597448f
2014-06-25T21:09:29Z
mmm a / taichi / backends / codegen_llvm . h <nl> ppp b / taichi / backends / codegen_llvm . h <nl> class CodeGenLLVM : public IRVisitor , public ModuleBuilder { <nl> <nl> llvm : : Value * threadIdx = nullptr , * blockDim = nullptr ; <nl> <nl> + RuntimeObject element ( " Element " , this , builder , get_arg ( 1 ) ) ; <nl> auto lower_bound = get_arg ( 2 ) ; <nl> auto upper_bound = get_arg ( 3 ) ; <nl> / / create_print ( " lower " , DataType : : i32 , lower_bound ) ; <nl> class CodeGenLLVM : public IRVisitor , public ModuleBuilder { <nl> auto refine = <nl> get_runtime_function ( leaf_block - > refine_coordinates_func_name ( ) ) ; <nl> auto new_coordinates = create_entry_block_alloca ( physical_coordinate_ty ) ; <nl> - RuntimeObject element ( " Element " , this , builder , get_arg ( 1 ) ) ; <nl> create_call ( refine , { element . get_ptr ( " pcoord " ) , new_coordinates , <nl> builder - > CreateLoad ( loop_index ) } ) ; <nl> <nl> mmm a / taichi / runtime / runtime . cpp <nl> ppp b / taichi / runtime / runtime . cpp <nl> void clear_list ( Runtime * runtime , StructMeta * parent , StructMeta * child ) { <nl> } <nl> <nl> / * <nl> - * The element list of a SNode , maintains pointers to its instances , and instances ' parents ' coordinates <nl> + * The element list of a SNode , maintains pointers to its instances , and <nl> + * instances ' parents ' coordinates <nl> * / <nl> void element_listgen ( Runtime * runtime , StructMeta * parent , StructMeta * child ) { <nl> auto parent_list = runtime - > element_lists [ parent - > snode_id ] ; <nl> void element_listgen ( Runtime * runtime , StructMeta * parent , StructMeta * child ) { <nl> PhysicalCoordinates refined_coord ; <nl> parent - > refine_coordinates ( & element . pcoord , & refined_coord , j ) ; <nl> if ( parent - > is_active ( ( Ptr ) parent , element . element , j ) ) { <nl> - auto ch_element = parent - > lookup_element ( ( Ptr ) parent , element . element , j ) ; <nl> + auto ch_element = <nl> + parent - > lookup_element ( ( Ptr ) parent , element . element , j ) ; <nl> ch_element = child - > from_parent_element ( ( Ptr ) ch_element ) ; <nl> Element elem ; <nl> elem . element = ch_element ; <nl> void block_helper ( void * ctx_ , int i ) { <nl> int part_size = ctx - > element_size / ctx - > element_split ; <nl> int part_id = i % ctx - > element_split ; <nl> / / printf ( " % d % d % d \ n " , element_id , part_size , part_id ) ; <nl> - ( * ctx - > task ) ( ctx - > context , & ctx - > list [ element_id ] , part_id * part_size , <nl> - ( part_id + 1 ) * part_size ) ; <nl> + auto & e = ctx - > list [ element_id ] ; <nl> + int lower = e . loop_bounds [ 0 ] + part_id * part_size ; <nl> + int upper = e . loop_bounds [ 0 ] + ( part_id + 1 ) * part_size ; <nl> + upper = std : : min ( upper , e . loop_bounds [ 1 ] ) ; <nl> + if ( lower < upper ) { <nl> + ( * ctx - > task ) ( ctx - > context , & ctx - > list [ element_id ] , lower , upper ) ; <nl> + } <nl> } <nl> <nl> void for_each_block ( Context * context , <nl>
CPU dynamic struct for passed
taichi-dev/taichi
72c333ab271cc8b41ee20cbc6eb8c4380cedec19
2019-12-30T01:33:53Z
mmm a / etc / evergreen . yml <nl> ppp b / etc / evergreen . yml <nl> buildvariants : <nl> - name : compile <nl> distros : <nl> - ubuntu1404 - build <nl> - - name : compile_all <nl> - distros : <nl> - - ubuntu1404 - build <nl> - - name : aggregation <nl> - - name : aggregation_WT <nl> - - name : aggregation_auth <nl> - - name : auth <nl> - name : dbtest <nl> - # - name : disk <nl> - # - name : durability <nl> - # - name : dur_jscore_passthrough <nl> - - name : failpoints <nl> - - name : failpoints_auth <nl> - - name : gle_auth <nl> - - name : gle_auth_write_cmd <nl> - - name : gle_auth_basics_passthrough <nl> - - name : gle_auth_basics_passthrough_write_cmd <nl> - - name : sharding_gle_auth_basics_passthrough <nl> - - name : sharding_gle_auth_basics_passthrough_write_cmd <nl> - name : jsCore <nl> - - name : jsCore_auth <nl> - - name : jsCore_compatibility <nl> - - name : generational_jstestfuzz <nl> - - name : generational_jstestfuzz_WT <nl> - - name : jstestfuzz <nl> - - name : jstestfuzz_concurrent_WT <nl> - - name : jstestfuzz_concurrent_replication_WT <nl> - - name : jstestfuzz_concurrent_sharded_WT <nl> - - name : jstestfuzz_replication <nl> - - name : jstestfuzz_sharded <nl> - - name : noPassthrough <nl> - - name : noPassthroughWithMongod <nl> - - name : bulk_gle_passthrough <nl> - - name : parallel <nl> - - name : parallel_compatibility <nl> - - name : concurrency <nl> - - name : concurrency_replication <nl> - - name : concurrency_sharded <nl> - # We use machines with more RAM to avoid OOM issues when validating collections . <nl> - distros : <nl> - - ubuntu1404 - build <nl> - - name : concurrency_simultaneous <nl> - - name : read_concern_linearizable_passthrough <nl> - - name : replica_sets <nl> - - name : replica_sets_auth <nl> - - name : replica_sets_jscore_passthrough <nl> - - name : rollback_fuzzer_WT <nl> - - name : master_slave <nl> - - name : master_slave_WT <nl> - - name : master_slave_auth <nl> - - name : master_slave_jscore_passthrough <nl> - - name : sharding <nl> - - name : sharding_auth <nl> - - name : slow1 <nl> - - name : serial_run <nl> - - name : sharding_jscore_passthrough <nl> <nl> # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # <nl> # Experimental buildvariants # <nl>
SERVER - 31676 Run only basic tests on RocksDB buildvariant
mongodb/mongo
9bf2188326c1cef5e11606c3099712cd8424c800
2017-10-24T00:57:08Z
mmm a / cmake / OpenCVFindMKL . cmake <nl> ppp b / cmake / OpenCVFindMKL . cmake <nl> <nl> # installation / package <nl> # <nl> # Parameters : <nl> - # MKL_WITH_TBB <nl> + # MKL_ROOT_DIR / ENV { MKLROOT } <nl> + # MKL_INCLUDE_DIR <nl> + # MKL_LIBRARIES <nl> + # MKL_USE_SINGLE_DYNAMIC_LIBRARY - use single dynamic library mkl_rt . lib / libmkl_rt . so <nl> + # MKL_WITH_TBB / MKL_WITH_OPENMP <nl> + # <nl> + # Extra : <nl> + # MKL_LIB_FIND_PATHS <nl> # <nl> # On return this will define : <nl> # <nl> <nl> # MKL_LIBRARIES - MKL libraries that are used by OpenCV <nl> # <nl> <nl> - macro ( mkl_find_lib VAR NAME DIRS ) <nl> - find_path ( $ { VAR } $ { NAME } $ { DIRS } NO_DEFAULT_PATH ) <nl> - set ( $ { VAR } $ { $ { VAR } } / $ { NAME } ) <nl> - unset ( $ { VAR } CACHE ) <nl> - endmacro ( ) <nl> - <nl> macro ( mkl_fail ) <nl> set ( HAVE_MKL OFF ) <nl> set ( MKL_ROOT_DIR " $ { MKL_ROOT_DIR } " CACHE PATH " Path to MKL directory " ) <nl> macro ( get_mkl_version VERSION_FILE ) <nl> set ( MKL_VERSION_STR " $ { MKL_VERSION_MAJOR } . $ { MKL_VERSION_MINOR } . $ { MKL_VERSION_UPDATE } " CACHE STRING " MKL version " FORCE ) <nl> endmacro ( ) <nl> <nl> + OCV_OPTION ( MKL_USE_SINGLE_DYNAMIC_LIBRARY " Use MKL Single Dynamic Library thorugh mkl_rt . lib / libmkl_rt . so " OFF ) <nl> + OCV_OPTION ( MKL_WITH_TBB " Use MKL with TBB multithreading " OFF ) # ON IF WITH_TBB ) <nl> + OCV_OPTION ( MKL_WITH_OPENMP " Use MKL with OpenMP multithreading " OFF ) # ON IF WITH_OPENMP ) <nl> <nl> - if ( NOT DEFINED MKL_USE_MULTITHREAD ) <nl> - OCV_OPTION ( MKL_WITH_TBB " Use MKL with TBB multithreading " OFF ) # ON IF WITH_TBB ) <nl> - OCV_OPTION ( MKL_WITH_OPENMP " Use MKL with OpenMP multithreading " OFF ) # ON IF WITH_OPENMP ) <nl> + if ( NOT MKL_ROOT_DIR AND DEFINED MKL_INCLUDE_DIR AND EXISTS " $ { MKL_INCLUDE_DIR } / mkl . h " ) <nl> + file ( TO_CMAKE_PATH " $ { MKL_INCLUDE_DIR } " MKL_INCLUDE_DIR ) <nl> + get_filename_component ( MKL_ROOT_DIR " $ { MKL_INCLUDE_DIR } / . . " ABSOLUTE ) <nl> endif ( ) <nl> - <nl> - # check current MKL_ROOT_DIR <nl> - if ( NOT MKL_ROOT_DIR OR NOT EXISTS " $ { MKL_ROOT_DIR } / include / mkl . h " ) <nl> - set ( mkl_root_paths " $ { MKL_ROOT_DIR } " ) <nl> - if ( DEFINED ENV { MKLROOT } ) <nl> - list ( APPEND mkl_root_paths " $ ENV { MKLROOT } " ) <nl> + if ( NOT MKL_ROOT_DIR ) <nl> + file ( TO_CMAKE_PATH " $ { MKL_ROOT_DIR } " mkl_root_paths ) <nl> + if ( DEFINED ENV { MKLROOT } ) <nl> + file ( TO_CMAKE_PATH " $ ENV { MKLROOT } " path ) <nl> + list ( APPEND mkl_root_paths " $ { path } " ) <nl> + endif ( ) <nl> + <nl> + if ( WITH_MKL AND NOT mkl_root_paths ) <nl> + if ( WIN32 ) <nl> + set ( ProgramFilesx86 " ProgramFiles ( x86 ) " ) <nl> + file ( TO_CMAKE_PATH " $ ENV { $ { ProgramFilesx86 } } " path ) <nl> + list ( APPEND mkl_root_paths $ { path } / IntelSWTools / compilers_and_libraries / windows / mkl ) <nl> endif ( ) <nl> - <nl> - if ( WITH_MKL AND NOT mkl_root_paths ) <nl> - if ( WIN32 ) <nl> - set ( ProgramFilesx86 " ProgramFiles ( x86 ) " ) <nl> - list ( APPEND mkl_root_paths $ ENV { $ { ProgramFilesx86 } } / IntelSWTools / compilers_and_libraries / windows / mkl ) <nl> - endif ( ) <nl> - if ( UNIX ) <nl> - list ( APPEND mkl_root_paths " / opt / intel / mkl " ) <nl> - endif ( ) <nl> + if ( UNIX ) <nl> + list ( APPEND mkl_root_paths " / opt / intel / mkl " ) <nl> endif ( ) <nl> + endif ( ) <nl> <nl> - find_path ( MKL_ROOT_DIR include / mkl . h PATHS $ { mkl_root_paths } ) <nl> + find_path ( MKL_ROOT_DIR include / mkl . h PATHS $ { mkl_root_paths } ) <nl> endif ( ) <nl> <nl> - set ( MKL_INCLUDE_DIRS " $ { MKL_ROOT_DIR } / include " CACHE PATH " Path to MKL include directory " ) <nl> + if ( NOT MKL_ROOT_DIR OR NOT EXISTS " $ { MKL_ROOT_DIR } / include / mkl . h " ) <nl> + mkl_fail ( ) <nl> + endif ( ) <nl> + <nl> + set ( MKL_INCLUDE_DIR " $ { MKL_ROOT_DIR } / include " CACHE PATH " Path to MKL include directory " ) <nl> <nl> if ( NOT MKL_ROOT_DIR <nl> OR NOT EXISTS " $ { MKL_ROOT_DIR } " <nl> - OR NOT EXISTS " $ { MKL_INCLUDE_DIRS } " <nl> - OR NOT EXISTS " $ { MKL_INCLUDE_DIRS } / mkl_version . h " <nl> + OR NOT EXISTS " $ { MKL_INCLUDE_DIR } " <nl> + OR NOT EXISTS " $ { MKL_INCLUDE_DIR } / mkl_version . h " <nl> ) <nl> - mkl_fail ( ) <nl> + mkl_fail ( ) <nl> endif ( ) <nl> <nl> - get_mkl_version ( $ { MKL_INCLUDE_DIRS } / mkl_version . h ) <nl> + get_mkl_version ( $ { MKL_INCLUDE_DIR } / mkl_version . h ) <nl> <nl> # determine arch <nl> if ( CMAKE_CXX_SIZEOF_DATA_PTR EQUAL 8 ) <nl> else ( ) <nl> set ( MKL_ARCH_SUFFIX " c " ) <nl> endif ( ) <nl> <nl> - if ( MKL_VERSION_STR VERSION_GREATER " 11 . 3 . 0 " OR MKL_VERSION_STR VERSION_EQUAL " 11 . 3 . 0 " ) <nl> - set ( mkl_lib_find_paths <nl> - $ { MKL_ROOT_DIR } / lib ) <nl> - foreach ( MKL_ARCH $ { MKL_ARCH_LIST } ) <nl> - list ( APPEND mkl_lib_find_paths <nl> - $ { MKL_ROOT_DIR } / lib / $ { MKL_ARCH } <nl> - $ { MKL_ROOT_DIR } / . . / tbb / lib / $ { MKL_ARCH } <nl> - $ { MKL_ROOT_DIR } / $ { MKL_ARCH } ) <nl> - endforeach ( ) <nl> - <nl> - set ( mkl_lib_list " mkl_intel_ $ { MKL_ARCH_SUFFIX } " ) <nl> - <nl> - if ( MKL_WITH_TBB ) <nl> - list ( APPEND mkl_lib_list mkl_tbb_thread tbb ) <nl> - elseif ( MKL_WITH_OPENMP ) <nl> - if ( MSVC ) <nl> - list ( APPEND mkl_lib_list mkl_intel_thread libiomp5md ) <nl> - else ( ) <nl> - list ( APPEND mkl_lib_list mkl_gnu_thread ) <nl> - endif ( ) <nl> + set ( mkl_lib_find_paths $ { MKL_LIB_FIND_PATHS } $ { MKL_ROOT_DIR } / lib ) <nl> + foreach ( MKL_ARCH $ { MKL_ARCH_LIST } ) <nl> + list ( APPEND mkl_lib_find_paths <nl> + $ { MKL_ROOT_DIR } / lib / $ { MKL_ARCH } <nl> + $ { MKL_ROOT_DIR } / $ { MKL_ARCH } <nl> + ) <nl> + endforeach ( ) <nl> + <nl> + if ( MKL_USE_SINGLE_DYNAMIC_LIBRARY AND NOT ( MKL_VERSION_STR VERSION_LESS " 10 . 3 . 0 " ) ) <nl> + <nl> + # https : / / software . intel . com / content / www / us / en / develop / articles / a - new - linking - model - single - dynamic - library - mkl_rt - since - intel - mkl - 103 . html <nl> + set ( mkl_lib_list " mkl_rt " ) <nl> + <nl> + elseif ( NOT ( MKL_VERSION_STR VERSION_LESS " 11 . 3 . 0 " ) ) <nl> + <nl> + foreach ( MKL_ARCH $ { MKL_ARCH_LIST } ) <nl> + list ( APPEND mkl_lib_find_paths <nl> + $ { MKL_ROOT_DIR } / . . / tbb / lib / $ { MKL_ARCH } <nl> + ) <nl> + endforeach ( ) <nl> + <nl> + set ( mkl_lib_list " mkl_intel_ $ { MKL_ARCH_SUFFIX } " ) <nl> + <nl> + if ( MKL_WITH_TBB ) <nl> + list ( APPEND mkl_lib_list mkl_tbb_thread tbb ) <nl> + elseif ( MKL_WITH_OPENMP ) <nl> + if ( MSVC ) <nl> + list ( APPEND mkl_lib_list mkl_intel_thread libiomp5md ) <nl> else ( ) <nl> - list ( APPEND mkl_lib_list mkl_sequential ) <nl> + list ( APPEND mkl_lib_list mkl_gnu_thread ) <nl> endif ( ) <nl> + else ( ) <nl> + list ( APPEND mkl_lib_list mkl_sequential ) <nl> + endif ( ) <nl> <nl> - list ( APPEND mkl_lib_list mkl_core ) <nl> + list ( APPEND mkl_lib_list mkl_core ) <nl> else ( ) <nl> - message ( STATUS " MKL version $ { MKL_VERSION_STR } is not supported " ) <nl> - mkl_fail ( ) <nl> + message ( STATUS " MKL version $ { MKL_VERSION_STR } is not supported " ) <nl> + mkl_fail ( ) <nl> endif ( ) <nl> <nl> - set ( MKL_LIBRARIES " " ) <nl> - foreach ( lib $ { mkl_lib_list } ) <nl> - find_library ( $ { lib } NAMES $ { lib } $ { lib } _dll HINTS $ { mkl_lib_find_paths } ) <nl> - mark_as_advanced ( $ { lib } ) <nl> - if ( NOT $ { lib } ) <nl> - mkl_fail ( ) <nl> + if ( NOT MKL_LIBRARIES ) <nl> + set ( MKL_LIBRARIES " " ) <nl> + foreach ( lib $ { mkl_lib_list } ) <nl> + set ( lib_var_name MKL_LIBRARY_ $ { lib } ) <nl> + find_library ( $ { lib_var_name } NAMES $ { lib } $ { lib } _dll HINTS $ { mkl_lib_find_paths } ) <nl> + mark_as_advanced ( $ { lib_var_name } ) <nl> + if ( NOT $ { lib_var_name } ) <nl> + mkl_fail ( ) <nl> endif ( ) <nl> - list ( APPEND MKL_LIBRARIES $ { $ { lib } } ) <nl> - endforeach ( ) <nl> + list ( APPEND MKL_LIBRARIES $ { $ { lib_var_name } } ) <nl> + endforeach ( ) <nl> + endif ( ) <nl> <nl> message ( STATUS " Found MKL $ { MKL_VERSION_STR } at : $ { MKL_ROOT_DIR } " ) <nl> set ( HAVE_MKL ON ) <nl> set ( MKL_ROOT_DIR " $ { MKL_ROOT_DIR } " CACHE PATH " Path to MKL directory " ) <nl> - set ( MKL_INCLUDE_DIRS " $ { MKL_INCLUDE_DIRS } " CACHE PATH " Path to MKL include directory " ) <nl> - set ( MKL_LIBRARIES " $ { MKL_LIBRARIES } " CACHE STRING " MKL libraries " ) <nl> - if ( UNIX AND NOT MKL_LIBRARIES_DONT_HACK ) <nl> + set ( MKL_INCLUDE_DIRS " $ { MKL_INCLUDE_DIR } " ) <nl> + set ( MKL_LIBRARIES " $ { MKL_LIBRARIES } " ) <nl> + if ( UNIX AND NOT MKL_USE_SINGLE_DYNAMIC_LIBRARY AND NOT MKL_LIBRARIES_DONT_HACK ) <nl> # it ' s ugly but helps to avoid cyclic lib problem <nl> set ( MKL_LIBRARIES $ { MKL_LIBRARIES } $ { MKL_LIBRARIES } $ { MKL_LIBRARIES } " - lpthread " " - lm " " - ldl " ) <nl> endif ( ) <nl>
Merge pull request from alalek : cmake_update_mkl
opencv/opencv
33761ee06bef6f829310fff4522687a354c158d5
2020-12-11T19:10:16Z
mmm a / include / spdlog / sinks / systemd_sink . h <nl> ppp b / include / spdlog / sinks / systemd_sink . h <nl> class systemd_sink : public base_sink < Mutex > <nl> <nl> size_t length = msg . payload . size ( ) ; <nl> / / limit to max int <nl> - if ( length > std : : numeric_limits < int > : : max ( ) ) <nl> + if ( length > static_cast < size_t > ( std : : numeric_limits < int > : : max ( ) ) ) <nl> { <nl> - length = std : : numeric_limits < int > : : max ( ) ; <nl> + length = static_cast < size_t > ( std : : numeric_limits < int > : : max ( ) ) ; <nl> } <nl> <nl> / / Do not send source location if not available <nl>
Fixed gcc9 conversion warning
gabime/spdlog
4578b0ad111a56ebbe129963d7b5084346ddbff6
2019-07-14T22:36:20Z
mmm a / test / rql_test / connections / connection . js <nl> ppp b / test / rql_test / connections / connection . js <nl> var spawn = require ( ' child_process ' ) . spawn <nl> <nl> var r = require ( path . resolve ( __dirname , ' . . ' , ' importRethinkDB . js ' ) ) . r ; <nl> <nl> - / / - - <nl> + / / - - get ENV inforamtion <nl> <nl> - var rethinkdbExe = process . env . RDB_EXE_PATH | | ' . . / . . / . . / build / debug / rethinkdb ' / / - ToDo : replace the hard code <nl> - var testDefault = process . env . TEST_DEFAULT_PORT = = " 1 " <nl> + var testDefault = process . env . TEST_DEFAULT_PORT = = " 1 " ; <nl> + var driverPort = process . env . RDB_DRIVER_PORT ; <nl> + var serverHost = process . env . RDB_SERVER_HOST | | ' localhost ' ; <nl> <nl> - var port = null ; <nl> + / / - - helper functions <nl> <nl> var assertErr = function ( err , type , msg ) { <nl> assertNotNull ( err ) ; <nl> var checkError = function ( type , msg ) { <nl> <nl> var withConnection = function ( f ) { <nl> return function ( done ) { <nl> - r . connect ( { port : port } , function ( err , c ) { <nl> + r . connect ( { host : serverHost , port : driverPort } , function ( err , c ) { <nl> assertNull ( err ) ; <nl> f ( done , c ) ; <nl> } ) ; <nl> } ; <nl> } ; <nl> <nl> - var testSimpleQuery = function ( c , done ) { <nl> - r ( 1 ) . run ( c , function ( err , res ) { <nl> - assertNull ( err ) ; <nl> - assert . equal ( res , 1 ) ; <nl> - done ( ) ; <nl> - } ) ; <nl> - } ; <nl> - <nl> var noError = function ( f ) { <nl> return function ( err ) { <nl> assertNull ( err ) ; <nl> var ifTestDefault = function ( f , c ) { <nl> <nl> describe ( ' Javascript connection API ' , function ( ) { <nl> it ( " times out with a server that doesn ' t do the handshake correctly " , function ( done ) { <nl> - var port = 8990 ; <nl> - <nl> / / Setup dummy sever <nl> - require ( ' net ' ) . createServer ( function ( c ) { <nl> - / / Do nothing <nl> - } ) . listen ( port ) ; <nl> - <nl> - r . connect ( { port : port , timeout : 1 } , givesError ( " RqlDriverError " , " Handshake timedout " , done ) ) ; <nl> + var server = require ( ' net ' ) . createServer ( function ( c ) { } ) ; <nl> + server . listen ( 0 , function ( ) { <nl> + var badPort = server . address ( ) . port ; <nl> + r . connect ( { port : badPort , timeout : 1 } , givesError ( " RqlDriverError " , " Handshake timedout " , done ) ) ; <nl> + } ) ; <nl> } ) ; <nl> - <nl> + <nl> describe ( ' With no server ' , function ( ) { <nl> it ( " fails when trying to connect " , function ( done ) { <nl> ifTestDefault ( <nl> describe ( ' Javascript connection API ' , function ( ) { <nl> r . connect ( { port : 11221 } , givesError ( " RqlDriverError " , " Could not connect to localhost : 11221 . \ nconnect ECONNREFUSED " , function ( ) { <nl> r . connect ( { host : ' 0 . 0 . 0 . 0 ' , port : 11221 } , givesError ( " RqlDriverError " , " Could not connect to 0 . 0 . 0 . 0 : 11221 . \ nconnect ECONNREFUSED " , done ) ) } ) ) } ) ; <nl> } ) ; <nl> - <nl> + <nl> it ( " empty run " , function ( done ) { <nl> r . expr ( 1 ) . run ( ) . then ( function ( ) { <nl> done ( new Error ( " Was expecting an error " ) ) <nl> } ) . error ( givesError ( " RqlDriverError " , " First argument to ` run ` must be an open connection . " , done ) ) ; <nl> } ) ; <nl> + <nl> it ( " run with an object " , function ( done ) { <nl> r . expr ( 1 ) . run ( { } ) . then ( function ( ) { <nl> done ( new Error ( " Was expecting an error " ) ) <nl> } ) . error ( givesError ( " RqlDriverError " , " First argument to ` run ` must be an open connection . " , done ) ) ; <nl> } ) ; <nl> } ) ; <nl> - <nl> + <nl> describe ( ' With a server ' , function ( ) { <nl> - <nl> - var cpp_server ; <nl> - var server_out_log ; <nl> - var server_err_log ; <nl> - var cluster_port ; <nl> - <nl> - beforeEach ( function ( done ) { <nl> - function setup ( ) { <nl> - port = Math . floor ( Math . random ( ) * ( 65535 - 1025 ) + 1025 ) ; <nl> - cluster_port = port + 1 ; <nl> - server_out_log = fs . openSync ( ' run / server - log . txt ' , ' a ' ) ; <nl> - server_err_log = fs . openSync ( ' run / server - error - log . txt ' , ' a ' ) ; <nl> - cpp_server = spawn ( <nl> - rethinkdbExe , <nl> - [ ' - - driver - port ' , port , ' - - http - port ' , ' 0 ' , ' - - cluster - port ' , cluster_port , ' - - cache - size ' , ' 512 ' ] , <nl> - { stdio : [ ' ignore ' , ' pipe ' , ' pipe ' ] } ) ; <nl> - <nl> - cpp_server . stdout . on ( ' data ' , function ( data ) { <nl> - fs . write ( server_out_log , data ) <nl> - if ( data . toString ( ) . match ( / Server ready / ) ) { <nl> - cpp_server . removeAllListeners ( ) ; <nl> - setTimeout ( done , 500 ) ; / / We give the server 500ms to avoid errors like ( " Cannot compute blueprint . . . " ) <nl> - } <nl> - <nl> - if ( data . toString ( ) . match ( / Could not bind to / ) ) { <nl> - / / The port is somehow used by someone else , let ' s spin up another server <nl> - cpp_server . removeAllListeners ( ) ; <nl> - setup ( ) ; <nl> - } <nl> - } ) ; <nl> - cpp_server . stderr . on ( ' data ' , function ( data ) { <nl> - fs . write ( server_err_log , data ) <nl> - } ) ; <nl> - } <nl> - <nl> - setup ( ) ; <nl> - } ) ; <nl> - <nl> - afterEach ( function ( done ) { <nl> - cpp_server . kill ( ) ; <nl> - cpp_server . removeAllListeners ( ) ; <nl> - spawn ( ' rm ' , [ ' - rf ' , ' rethinkdb_data ' ] ) ; <nl> - setTimeout ( done , 10 ) ; <nl> - fs . close ( server_out_log ) ; <nl> - fs . close ( server_err_log ) ; <nl> - } ) ; <nl> - <nl> - it ( " authorization key when none needed " , function ( done ) { <nl> - r . connect ( { port : port , authKey : " hunter2 " } , givesError ( " RqlDriverError " , " Server dropped connection with message : \ " ERROR : Incorrect authorization key . \ " " , done ) ) ; <nl> - } ) ; <nl> - <nl> - it ( " correct authorization key " , function ( done ) { <nl> - setTimeout ( function ( ) { <nl> - r . connect ( { port : port } , function ( e , c ) { <nl> - assertNull ( e ) ; <nl> - r . db ( ' rethinkdb ' ) . table ( ' cluster_config ' ) . update ( { auth_key : " hunter3 " } ) . run ( c , noError ( function ( ) { <nl> - r . connect ( { port : port , authKey : " hunter3 " } , function ( e , c ) { <nl> - assertNull ( e ) ; <nl> - r . expr ( 1 ) . run ( c , noError ( done ) ) ; <nl> - } ) ; <nl> - } ) ) ; <nl> - } ) ; <nl> - } , 500 ) ; <nl> - } ) ; <nl> - <nl> - it ( " wrong authorization key " , function ( done ) { <nl> - setTimeout ( function ( ) { <nl> - r . connect ( { port : port } , function ( e , c ) { <nl> - assertNull ( e ) ; <nl> - r . db ( ' rethinkdb ' ) . table ( ' cluster_config ' ) . update ( { auth_key : " hunter4 " } ) . run ( c , noError ( function ( ) { <nl> - r . connect ( { port : port , authKey : " hunter - wrong " } , givesError ( " RqlDriverError " , " Server dropped connection with message : \ " ERROR : Incorrect authorization key . \ " " , done ) ) ; <nl> - } ) ) ; <nl> - } ) ; <nl> - } , 500 ) ; <nl> - } ) ; <nl> - <nl> + <nl> / / TODO : test default port <nl> - <nl> - it ( " close twice and reconnect " , withConnection ( function ( done , c ) { <nl> - testSimpleQuery ( c , function ( ) { <nl> - assert . doesNotThrow ( function ( ) { <nl> - c . close ( { noreplyWait : false } ) ; <nl> - c . close ( { noreplyWait : false } ) ; <nl> - c . reconnect ( function ( err , c ) { <nl> - assertNull ( err ) ; <nl> - testSimpleQuery ( c , done ) ; <nl> - } ) ; <nl> - } ) ; <nl> + <nl> + describe ( ' close twice and reconnect ' , function ( ) { <nl> + simpleQuery = function ( c ) { return r ( 1 ) . run ( c ) ; } ; <nl> + <nl> + it ( " noreplyWait = false " , function ( done ) { <nl> + var conn = null ; <nl> + r . connect ( { host : serverHost , port : driverPort } ) . then ( function ( c ) { <nl> + conn = c ; <nl> + return simpleQuery ( conn ) ; <nl> + } ) . then ( function ( ) { <nl> + return conn . close ( { noreplyWait : false } ) ; <nl> + } ) . then ( function ( ) { <nl> + return conn . close ( { noreplyWait : false } ) ; <nl> + } ) . then ( function ( ) { <nl> + return conn . reconnect ( ) ; <nl> + } ) . then ( function ( ) { <nl> + return simpleQuery ( conn ) ; <nl> + } ) . then ( done ) <nl> } ) ; <nl> - } ) ) ; <nl> - it ( " close twice ( synchronously ) and reconnect " , withConnection ( function ( done , c ) { <nl> - testSimpleQuery ( c , function ( ) { <nl> - assert . doesNotThrow ( function ( ) { <nl> - c . close ( ) ; <nl> - c . close ( ) ; <nl> - c . reconnect ( function ( err , c ) { <nl> - assertNull ( err ) ; <nl> - testSimpleQuery ( c , done ) ; <nl> - } ) ; <nl> - } ) ; <nl> + <nl> + it ( " synchronously " , function ( done ) { <nl> + var conn = null ; <nl> + r . connect ( { host : serverHost , port : driverPort } ) . then ( function ( c ) { <nl> + conn = c ; <nl> + return simpleQuery ( conn ) ; <nl> + } ) . then ( function ( ) { <nl> + return conn . close ( ) ; <nl> + } ) . then ( function ( ) { <nl> + return conn . close ( ) ; <nl> + } ) . then ( function ( ) { <nl> + return conn . reconnect ( ) ; <nl> + } ) . then ( function ( ) { <nl> + return simpleQuery ( conn ) ; <nl> + } ) . then ( done ) <nl> } ) ; <nl> - } ) ) ; <nl> - <nl> + } ) <nl> + <nl> it ( " fails to query after close " , withConnection ( function ( done , c ) { <nl> c . close ( { noreplyWait : false } ) ; <nl> r ( 1 ) . run ( c , givesError ( " RqlDriverError " , " Connection is closed . " , done ) ) ; <nl> } ) ) ; <nl> - <nl> + <nl> it ( " noreplyWait waits " , withConnection ( function ( done , c ) { <nl> var t = new Date ( ) . getTime ( ) ; <nl> r . js ( ' while ( true ) ; ' , { timeout : 0 . 5 } ) . run ( c , { noreply : true } ) ; <nl> describe ( ' Javascript connection API ' , function ( ) { <nl> done ( ) ; <nl> } ) ; <nl> } ) ) ; <nl> - <nl> + <nl> it ( " close waits by default " , withConnection ( function ( done , c ) { <nl> var t = new Date ( ) . getTime ( ) ; <nl> r . js ( ' while ( true ) ; ' , { timeout : 0 . 5 } ) . run ( c , { noreply : true } ) ; <nl> describe ( ' Javascript connection API ' , function ( ) { <nl> done ( ) ; <nl> } ) ; <nl> } ) ) ; <nl> - <nl> + <nl> it ( " reconnect waits by default " , withConnection ( function ( done , c ) { <nl> var t = new Date ( ) . getTime ( ) ; <nl> r . js ( ' while ( true ) ; ' , { timeout : 0 . 5 } ) . run ( c , { noreply : true } ) ; <nl> describe ( ' Javascript connection API ' , function ( ) { <nl> done ( ) ; <nl> } ) ; <nl> } ) ) ; <nl> - <nl> + <nl> it ( " close does not wait if we want it not to " , withConnection ( function ( done , c ) { <nl> var t = new Date ( ) . getTime ( ) ; <nl> r . js ( ' while ( true ) ; ' , { timeout : 0 . 5 } ) . run ( c , { noreply : true } ) ; <nl> describe ( ' Javascript connection API ' , function ( ) { <nl> done ( ) ; <nl> } ) ; <nl> } ) ) ; <nl> - <nl> + <nl> it ( " reconnect does not wait if we want it not to " , withConnection ( function ( done , c ) { <nl> var t = new Date ( ) . getTime ( ) ; <nl> r . js ( ' while ( true ) ; ' , { timeout : 0 . 5 } ) . run ( c , { noreply : true } ) ; <nl> describe ( ' Javascript connection API ' , function ( ) { <nl> done ( ) ; <nl> } ) ; <nl> } ) ) ; <nl> - <nl> + <nl> it ( " close waits even without callback " , withConnection ( function ( done , c ) { <nl> var start = Date . now ( ) ; <nl> var timeout = 1 . 5 ; <nl> describe ( ' Javascript connection API ' , function ( ) { <nl> done ( ) <nl> } ) ; <nl> } ) ) ; <nl> - <nl> - it ( " test use " , withConnection ( function ( done , c ) { <nl> - r . db ( ' test ' ) . tableCreate ( ' t1 ' ) . run ( c , noError ( function ( ) { <nl> - r . dbCreate ( ' db2 ' ) . run ( c , noError ( function ( ) { <nl> - r . db ( ' db2 ' ) . tableCreate ( ' t2 ' ) . run ( c , noError ( function ( ) { <nl> - c . use ( ' db2 ' ) ; <nl> - r . table ( ' t2 ' ) . run ( c , noError ( function ( ) { <nl> - c . use ( ' test ' ) ; <nl> - r . table ( ' t2 ' ) . run ( c , givesError ( " RqlRuntimeError " , " Table ` test . t2 ` does not exist " , <nl> - done ) ) ; <nl> - } ) ) ; } ) ) ; } ) ) ; } ) ) ; } ) ) ; <nl> - <nl> + <nl> it ( " useOutdated " , withConnection ( function ( done , c ) { <nl> - r . db ( ' test ' ) . tableCreate ( ' t1 ' ) . run ( c , function ( ) { <nl> - r . db ( ' test ' ) . table ( ' t1 ' , { useOutdated : true } ) . run ( c , function ( ) { <nl> - r . db ( ' test ' ) . table ( ' t1 ' ) . run ( c , { useOutdated : true } , done ) ; } ) ; } ) ; <nl> + r . db ( ' test ' ) . tableCreate ( ' useOutdated ' ) . run ( c , function ( ) { <nl> + r . db ( ' test ' ) . table ( ' useOutdated ' , { useOutdated : true } ) . run ( c , function ( ) { <nl> + r . db ( ' test ' ) . table ( ' useOutdated ' ) . run ( c , { useOutdated : true } , done ) ; } ) ; } ) ; <nl> } ) ) ; <nl> - <nl> + <nl> it ( " test default durability " , withConnection ( function ( done , c ) { <nl> - r . db ( ' test ' ) . tableCreate ( ' t1 ' ) . run ( c , noError ( function ( ) { <nl> - r . db ( ' test ' ) . table ( ' t1 ' ) . insert ( { data : " 5 " } ) . run ( c , { durability : " default " } , <nl> + r . db ( ' test ' ) . tableCreate ( ' defaultDurability ' ) . run ( c , noError ( function ( ) { <nl> + r . db ( ' test ' ) . table ( ' defaultDurability ' ) . insert ( { data : " 5 " } ) . run ( c , { durability : " default " } , <nl> givesError ( " RqlRuntimeError " , " Durability option ` default ` unrecognized ( options are \ " hard \ " and \ " soft \ " ) " , done ) ) ; <nl> } ) ) ; <nl> } ) ) ; <nl> - <nl> + <nl> it ( " test wrong durability " , withConnection ( function ( done , c ) { <nl> - r . db ( ' test ' ) . tableCreate ( ' t1 ' ) . run ( c , noError ( function ( ) { <nl> - r . db ( ' test ' ) . table ( ' t1 ' ) . insert ( { data : " 5 " } ) . run ( c , { durability : " wrong " } , <nl> + r . db ( ' test ' ) . tableCreate ( ' wrongDurability ' ) . run ( c , noError ( function ( ) { <nl> + r . db ( ' test ' ) . table ( ' wrongDurability ' ) . insert ( { data : " 5 " } ) . run ( c , { durability : " wrong " } , <nl> givesError ( " RqlRuntimeError " , " Durability option ` wrong ` unrecognized ( options are \ " hard \ " and \ " soft \ " ) " , done ) ) <nl> } ) ) ; <nl> } ) ) ; <nl> - <nl> + <nl> it ( " test soft durability " , withConnection ( function ( done , c ) { <nl> - r . db ( ' test ' ) . tableCreate ( ' t1 ' ) . run ( c , noError ( function ( ) { <nl> - r . db ( ' test ' ) . table ( ' t1 ' ) . insert ( { data : " 5 " } ) . run ( c , { durability : " soft " } , noError ( done ) ) ; <nl> + r . db ( ' test ' ) . tableCreate ( ' softDurability ' ) . run ( c , noError ( function ( ) { <nl> + r . db ( ' test ' ) . table ( ' softDurability ' ) . insert ( { data : " 5 " } ) . run ( c , { durability : " soft " } , noError ( done ) ) ; <nl> } ) ) ; <nl> } ) ) ; <nl> - <nl> + <nl> it ( " test hard durability " , withConnection ( function ( done , c ) { <nl> - r . db ( ' test ' ) . tableCreate ( ' t1 ' ) . run ( c , noError ( function ( ) { <nl> - r . db ( ' test ' ) . table ( ' t1 ' ) . insert ( { data : " 5 " } ) . run ( c , { durability : " hard " } , noError ( done ) ) ; <nl> + r . db ( ' test ' ) . tableCreate ( ' hardDurability ' ) . run ( c , noError ( function ( ) { <nl> + r . db ( ' test ' ) . table ( ' hardDurability ' ) . insert ( { data : " 5 " } ) . run ( c , { durability : " hard " } , noError ( done ) ) ; <nl> } ) ) ; <nl> } ) ) ; <nl> - <nl> + <nl> it ( " test non - deterministic durability " , withConnection ( function ( done , c ) { <nl> - r . db ( ' test ' ) . tableCreate ( ' t1 ' ) . run ( c , noError ( function ( ) { <nl> - r . db ( ' test ' ) . table ( ' t1 ' ) . insert ( { data : " 5 " } ) . run ( c , { durability : r . js ( " ' so ' + ' ft ' " ) } , noError ( done ) ) ; <nl> + r . db ( ' test ' ) . tableCreate ( ' nonDeterministicDurability ' ) . run ( c , noError ( function ( ) { <nl> + r . db ( ' test ' ) . table ( ' nonDeterministicDurability ' ) . insert ( { data : " 5 " } ) . run ( c , { durability : r . js ( " ' so ' + ' ft ' " ) } , noError ( done ) ) ; <nl> } ) ) ; <nl> } ) ) ; <nl> - <nl> - it ( " fails to query after kill " , withConnection ( function ( done , c ) { <nl> - cpp_server . kill ( ) ; <nl> - setTimeout ( function ( ) { <nl> - r ( 1 ) . run ( c , givesError ( " RqlDriverError " , " Connection is closed . " , done ) ) ; <nl> - } , 100 ) ; <nl> - } ) ) ; <nl> - <nl> + <nl> it ( " pretty - printing " , function ( ) { <nl> assert . equal ( r . db ( ' db1 ' ) . table ( ' tbl1 ' ) . map ( function ( x ) { return x ; } ) . toString ( ) , <nl> ' r . db ( " db1 " ) . table ( " tbl1 " ) . map ( function ( var_0 ) { return var_0 ; } ) ' ) <nl> } ) ; <nl> - <nl> + <nl> it ( " connect ( ) with default db " , withConnection ( function ( done , c ) { <nl> r . dbCreate ( ' foo ' ) . run ( c , function ( err , res ) { <nl> r . db ( ' foo ' ) . tableCreate ( ' bar ' ) . run ( c , function ( err , res ) { <nl> c . close ( ) ; <nl> - r . connect ( { port : port , db : ' foo ' } , noError ( function ( err , c ) { <nl> + r . connect ( { host : serverHost , port : driverPort , db : ' foo ' } , noError ( function ( err , c ) { <nl> r . table ( ' bar ' ) . run ( c , noError ( done ) ) ; <nl> } ) ) ; <nl> } ) ; <nl> } ) ; <nl> } ) ) ; <nl> - <nl> + <nl> it ( " missing arguments cause exception " , withConnection ( function ( done , c ) { <nl> assert . throws ( function ( ) { c . use ( ) ; } ) ; <nl> done ( ) ; <nl> } ) ) ; <nl> - <nl> - / / Test the event emitter interface <nl> - <nl> + <nl> + / / - - event emitter interface <nl> + <nl> it ( " Emits connect event on connect " , withConnection ( function ( done , c ) { <nl> c . on ( ' connect ' , function ( err , c2 ) { <nl> done ( ) ; <nl> } ) ; <nl> - <nl> + <nl> c . reconnect ( function ( ) { } ) ; <nl> } ) ) ; <nl> - <nl> + <nl> it ( " Emits close event on close " , withConnection ( function ( done , c ) { <nl> c . on ( ' close ' , function ( ) { <nl> done ( ) ; <nl> } ) ; <nl> - <nl> + <nl> c . close ( ) ; <nl> } ) ) ; <nl> - <nl> + <nl> + / / - - bad options <nl> + <nl> it ( " Non valid optarg " , withConnection ( function ( done , c ) { <nl> r . expr ( 1 ) . run ( c , { nonValidOption : true } ) . then ( function ( ) { <nl> done ( new Error ( " Was expecting an error " ) ) <nl> } ) . error ( givesError ( " RqlCompileError " , " Unrecognized global optional argument ` non_valid_option ` " , done ) ) ; <nl> } ) ) ; <nl> - <nl> + <nl> it ( " Extra argument " , withConnection ( function ( done , c ) { <nl> r . expr ( 1 ) . run ( c , givesError ( " RqlDriverError " , " Second argument to ` run ` cannot be a function if a third argument is provided . " , done ) , 1 ) <nl> } ) ) ; <nl> - <nl> + <nl> it ( " Callback must be a function " , withConnection ( function ( done , c ) { <nl> r . expr ( 1 ) . run ( c , { } , " not_a_function " ) . error ( givesError ( " RqlDriverError " , " If provided , the callback must be a function . Please use ` run ( connection [ , options ] [ , callback ] ) " , done ) ) <nl> } ) ) ; <nl> + <nl> + / / - - auth_key tests <nl> + <nl> + it ( " authorization key when none needed " , function ( done ) { <nl> + r . connect ( { host : serverHost , port : driverPort , authKey : " hunter2 " } , givesError ( " RqlDriverError " , " Server dropped connection with message : \ " ERROR : Incorrect authorization key . \ " " , done ) ) ; <nl> + } ) ; <nl> + <nl> + it ( " correct authorization key " , function ( done ) { <nl> + setTimeout ( function ( ) { <nl> + r . connect ( { host : serverHost , port : driverPort } , function ( e , c ) { <nl> + assertNull ( e ) ; <nl> + r . db ( ' rethinkdb ' ) . table ( ' cluster_config ' ) . update ( { auth_key : " hunter3 " } ) . run ( c , noError ( function ( ) { <nl> + r . connect ( { host : serverHost , port : driverPort , authKey : " hunter3 " } , function ( e , c ) { <nl> + assertNull ( e ) ; <nl> + r . expr ( 1 ) . run ( c , noError ( done ) ) ; <nl> + / / undo the auth_key <nl> + r . db ( ' rethinkdb ' ) . table ( ' cluster_config ' ) . update ( { auth_key : null } ) . run ( c , assertNull ) ; <nl> + } ) ; <nl> + } ) ) ; <nl> + } ) ; <nl> + } , 500 ) ; <nl> + } ) ; <nl> + <nl> + it ( " wrong authorization key " , function ( done ) { <nl> + setTimeout ( function ( ) { <nl> + r . connect ( { host : serverHost , port : driverPort } , function ( e , c ) { <nl> + assertNull ( e ) ; <nl> + r . db ( ' rethinkdb ' ) . table ( ' cluster_config ' ) . update ( { auth_key : " hunter4 " } ) . run ( c , noError ( function ( ) { <nl> + r . connect ( { host : serverHost , port : driverPort , authKey : " hunter - wrong " } , givesError ( " RqlDriverError " , " Server dropped connection with message : \ " ERROR : Incorrect authorization key . \ " " , done ) ) ; <nl> + / / undo the auth_key <nl> + r . db ( ' rethinkdb ' ) . table ( ' cluster_config ' ) . update ( { auth_key : null } ) . run ( c , assertNull ) ; <nl> + } ) ) ; <nl> + } ) ; <nl> + } , 500 ) ; <nl> + } ) ; <nl> + <nl> + / / - - use tests <nl> + <nl> + this . timeout ( 8000 ) / / " test use " can take soem time <nl> + <nl> + it ( " test use " , withConnection ( function ( done , c ) { <nl> + r . db ( ' test ' ) . tableCreate ( ' t1 ' ) . run ( c , noError ( function ( ) { <nl> + r . dbCreate ( ' db2 ' ) . run ( c , noError ( function ( ) { <nl> + r . db ( ' db2 ' ) . tableCreate ( ' t2 ' ) . run ( c , noError ( function ( ) { <nl> + c . use ( ' db2 ' ) ; <nl> + r . table ( ' t2 ' ) . run ( c , noError ( function ( ) { <nl> + c . use ( ' test ' ) ; <nl> + r . table ( ' t2 ' ) . run ( c , givesError ( " RqlRuntimeError " , " Table ` test . t2 ` does not exist " , done ) ) ; <nl> + } ) ) ; } ) ) ; } ) ) ; } ) ) ; } ) ) ; <nl> } ) ; <nl> } ) ; <nl> <nl> mmm a / test / rql_test / connections / connection . js . test <nl> ppp b / test / rql_test / connections / connection . js . test <nl> <nl> # ! / usr / bin / env python <nl> <nl> import os , sys , subprocess <nl> + <nl> sys . path . insert ( 0 , os . path . join ( os . path . dirname ( os . path . realpath ( __file__ ) ) , os . pardir , os . pardir , " common " ) ) <nl> import utils <nl> <nl> - if not os . path . isdir ( ' run ' ) : <nl> - os . makedirs ( ' run ' ) <nl> + # - - start server if necessary <nl> + <nl> + if not ' RDB_DRIVER_PORT ' in os . environ : <nl> + import driver <nl> + <nl> + serverExe = sys . argv [ 1 ] if len ( sys . argv ) > 1 else utils . find_rethinkdb_executable ( ) <nl> + server = driver . Process ( executable_path = serverExe ) <nl> + <nl> + # expose the server info for the subprocess <nl> + <nl> + os . environ [ ' RDB_DRIVER_PORT ' ] = str ( server . driver_port ) <nl> + os . environ [ ' RDB_SERVER_HOST ' ] = server . host <nl> + <nl> + # create the ' test ' database <nl> + <nl> + r = utils . import_python_driver ( ) <nl> + conn = r . connect ( host = server . host , port = server . driver_port ) <nl> + r . db_create ( ' test ' ) . run ( conn ) <nl> <nl> - os . environ [ ' RDB_EXE_PATH ' ] = sys . argv [ 1 ] if len ( sys . argv ) > 1 else utils . find_rethinkdb_executable ( ) <nl> + # - - Run with mocha <nl> <nl> mochaReporterOptions = [ ' - R ' , ' spec ' ] <nl> if not utils . supportsTerminalColors ( ) : <nl>
merge fix for connections / connection . js test errors
rethinkdb/rethinkdb
f652ad156bc3fa38c20436ed7d4cc82e3b63d642
2015-04-06T23:00:07Z
mmm a / drivers / unix / net_socket_posix . cpp <nl> ppp b / drivers / unix / net_socket_posix . cpp <nl> void NetSocketPosix : : set_ipv6_only_enabled ( bool p_enabled ) { <nl> <nl> void NetSocketPosix : : set_tcp_no_delay_enabled ( bool p_enabled ) { <nl> ERR_FAIL_COND ( ! is_open ( ) ) ; <nl> - ERR_FAIL_COND ( _ip_type ! = TYPE_TCP ) ; <nl> + ERR_FAIL_COND ( ! _is_stream ) ; / / Not TCP <nl> <nl> int par = p_enabled ? 1 : 0 ; <nl> if ( setsockopt ( _sock , IPPROTO_TCP , TCP_NODELAY , SOCK_CBUF ( & par ) , sizeof ( int ) ) < 0 ) { <nl> mmm a / modules / gdscript / gdscript_function . cpp <nl> ppp b / modules / gdscript / gdscript_function . cpp <nl> Variant GDScriptFunction : : call ( GDScriptInstance * p_instance , const Variant * * p_a <nl> # ifdef DEBUG_ENABLED <nl> GDScriptNativeClass * nc = Object : : cast_to < GDScriptNativeClass > ( type - > operator Object * ( ) ) ; <nl> GD_ERR_BREAK ( ! nc ) ; <nl> - if ( ! src - > get_type ( ) ! = Variant : : OBJECT & & ! src - > get_type ( ) ! = Variant : : NIL ) { <nl> + if ( src - > get_type ( ) ! = Variant : : OBJECT & & src - > get_type ( ) ! = Variant : : NIL ) { <nl> err_text = " Trying to assign value of type ' " + Variant : : get_type_name ( src - > get_type ( ) ) + <nl> " ' to a variable of type ' " + nc - > get_name ( ) + " ' . " ; <nl> OPCODE_BREAK ; <nl> mmm a / modules / gdscript / gdscript_parser . cpp <nl> ppp b / modules / gdscript / gdscript_parser . cpp <nl> void GDScriptParser : : _determine_inheritance ( ClassNode * p_class ) { <nl> if ( found ) continue ; <nl> <nl> if ( p - > constant_expressions . has ( base ) ) { <nl> - if ( ! p - > constant_expressions [ base ] . expression - > type = = Node : : TYPE_CONSTANT ) { <nl> + if ( p - > constant_expressions [ base ] . expression - > type ! = Node : : TYPE_CONSTANT ) { <nl> _set_error ( " Could not resolve constant ' " + base + " ' . " , p_class - > line ) ; <nl> return ; <nl> } <nl> mmm a / modules / mbedtls / stream_peer_mbed_tls . cpp <nl> ppp b / modules / mbedtls / stream_peer_mbed_tls . cpp <nl> <nl> / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> <nl> # include " stream_peer_mbed_tls . h " <nl> + <nl> # include " core / io / stream_peer_tcp . h " <nl> # include " core / os / file_access . h " <nl> - # include " mbedtls / platform_util . h " <nl> + <nl> + # include < mbedtls / platform_util . h > <nl> <nl> static void my_debug ( void * ctx , int level , <nl> const char * file , int line , <nl> void StreamPeerMbedTLS : : poll ( ) { <nl> } <nl> <nl> Ref < StreamPeerTCP > tcp = base ; <nl> - if ( tcp . is_valid ( ) & & tcp - > get_status ( ) ! = STATUS_CONNECTED ) { <nl> + if ( tcp . is_valid ( ) & & tcp - > get_status ( ) ! = StreamPeerTCP : : STATUS_CONNECTED ) { <nl> disconnect_from_stream ( ) ; <nl> return ; <nl> } <nl> void StreamPeerMbedTLS : : disconnect_from_stream ( ) { <nl> return ; <nl> <nl> Ref < StreamPeerTCP > tcp = base ; <nl> - if ( tcp . is_valid ( ) & & tcp - > get_status ( ) = = STATUS_CONNECTED ) { <nl> + if ( tcp . is_valid ( ) & & tcp - > get_status ( ) = = StreamPeerTCP : : STATUS_CONNECTED ) { <nl> / / We are still connected on the socket , try to send close notity . <nl> mbedtls_ssl_close_notify ( & ssl ) ; <nl> } <nl> mmm a / modules / mbedtls / stream_peer_mbed_tls . h <nl> ppp b / modules / mbedtls / stream_peer_mbed_tls . h <nl> <nl> <nl> # include " core / io / stream_peer_ssl . h " <nl> <nl> - # include " mbedtls / config . h " <nl> - # include " mbedtls / ctr_drbg . h " <nl> - # include " mbedtls / debug . h " <nl> - # include " mbedtls / entropy . h " <nl> - # include " mbedtls / net . h " <nl> - # include " mbedtls / ssl . h " <nl> + # include < mbedtls / config . h > <nl> + # include < mbedtls / ctr_drbg . h > <nl> + # include < mbedtls / debug . h > <nl> + # include < mbedtls / entropy . h > <nl> + # include < mbedtls / net . h > <nl> + # include < mbedtls / ssl . h > <nl> <nl> # include < stdio . h > <nl> # include < stdlib . h > <nl>
Fix invalid comparison warnings : [ - Wbool - compare ] and [ - Wenum - compare ]
godotengine/godot
bca2d3ad40da1b5bea2e55a8640615d21736b175
2018-09-27T14:25:24Z
mmm a / php_swoole . h <nl> ppp b / php_swoole . h <nl> int php_swoole_dispatch_func ( swServer * serv , swConnection * conn , swEventData * da <nl> int php_swoole_client_onPackage ( swConnection * conn , char * data , uint32_t length ) ; <nl> void php_swoole_onTimeout ( swTimer * timer , swTimer_node * tnode ) ; <nl> void php_swoole_onInterval ( swTimer * timer , swTimer_node * tnode ) ; <nl> + zend_bool php_swoole_signal_isset_handler ( int signo ) ; <nl> <nl> PHPAPI zend_string * php_swoole_serialize ( zval * zvalue ) ; <nl> PHPAPI int php_swoole_unserialize ( void * buffer , size_t len , zval * return_value , zval * zobject_args , long flag ) ; <nl> mmm a / swoole_coroutine_util . cc <nl> ppp b / swoole_coroutine_util . cc <nl> PHP_FUNCTION ( swoole_coroutine_exec ) <nl> RETURN_FALSE ; <nl> } <nl> <nl> + if ( php_swoole_signal_isset_handler ( SIGCHLD ) ) <nl> + { <nl> + swoole_php_error ( E_WARNING , " The signal [ SIGCHLD ] is registered , cannot execute swoole_coroutine_exec . " , command ) ; <nl> + RETURN_FALSE ; <nl> + } <nl> + <nl> coro_check ( ) ; <nl> swoole_coroutine_signal_init ( ) ; <nl> php_swoole_check_reactor ( ) ; <nl>
defense
swoole/swoole-src
8678cf82291df53ccabe2e7d7b702c6be442764a
2018-11-02T09:51:02Z
mmm a / xbmc / linux / XTimeUtils . cpp <nl> ppp b / xbmc / linux / XTimeUtils . cpp <nl> BOOL SystemTimeToFileTime ( const SYSTEMTIME * lpSystemTime , LPFILETIME lpFileTi <nl> if ( IsLeapYear ( lpSystemTime - > wYear ) & & ( sysTime . tm_yday > 58 ) ) <nl> sysTime . tm_yday + + ; <nl> <nl> - # ifdef __APPLE__ <nl> - / / this solves a crash on startup ; timegm seems not threadsafe <nl> - / / http : / / www . opensubscriber . com / message / aolserver - sf @ listserv . aol . com / 4287726 . html <nl> - / / example is from man timegm <nl> - time_t t ; <nl> - { <nl> - char * tz ; <nl> - <nl> - tz = getenv ( " TZ " ) ; <nl> - setenv ( " TZ " , " " , 1 ) ; <nl> - tzset ( ) ; <nl> - t = mktime ( & sysTime ) ; <nl> - if ( tz ) <nl> - setenv ( " TZ " , ( const char * ) & sysTime , 1 ) ; <nl> - else <nl> - unsetenv ( " TZ " ) ; <nl> - tzset ( ) ; <nl> - } <nl> - # else <nl> time_t t = timegm ( & sysTime ) ; <nl> - # endif <nl> <nl> LARGE_INTEGER result ; <nl> result . QuadPart = ( long long ) t * 10000000 + ( long long ) lpSystemTime - > wMilliseconds * 10000 ; <nl>
Revert r25547 " [ osx ] work around crash on startup with thread unsafe timegm "
xbmc/xbmc
829242fdc3c7257f69861e5d340e79179bf6c5e8
2009-12-12T17:59:05Z
mmm a / tensorflow / lite / micro / kernels / logistic . cc <nl> ppp b / tensorflow / lite / micro / kernels / logistic . cc <nl> TfLiteStatus CalculateArithmeticOpData ( TfLiteContext * context , TfLiteNode * node , <nl> static_cast < double > ( input - > params . scale ) * <nl> static_cast < double > ( 1 < < ( 31 - kInputIntegerBits ) ) ; <nl> <nl> + data - > input_zero_point = input - > params . zero_point ; <nl> + <nl> const double q = std : : frexp ( input_real_multiplier , & data - > input_left_shift ) ; <nl> data - > input_multiplier = static_cast < int32_t > ( TfLiteRound ( q * ( 1ll < < 31 ) ) ) ; <nl> <nl> TfLiteStatus CalculateArithmeticOpData ( TfLiteContext * context , TfLiteNode * node , <nl> } <nl> } / / namespace <nl> <nl> + void * LogisticInit ( TfLiteContext * context , const char * buffer , size_t length ) { <nl> + TFLITE_DCHECK ( context - > AllocatePersistentBuffer ! = nullptr ) ; <nl> + void * data = nullptr ; <nl> + if ( context - > AllocatePersistentBuffer ( context , sizeof ( OpData ) , & data ) = = <nl> + kTfLiteError ) { <nl> + return nullptr ; <nl> + } <nl> + return data ; <nl> + } <nl> + <nl> + TfLiteStatus LogisticPrepare ( TfLiteContext * context , TfLiteNode * node ) { <nl> + TFLITE_DCHECK ( node - > user_data ! = nullptr ) ; <nl> + OpData * data = static_cast < OpData * > ( node - > user_data ) ; <nl> + <nl> + return CalculateArithmeticOpData ( context , node , data ) ; <nl> + } <nl> + <nl> TfLiteStatus LogisticEval ( TfLiteContext * context , TfLiteNode * node ) { <nl> const TfLiteTensor * input = GetInput ( context , node , kInputTensor ) ; <nl> TfLiteTensor * output = GetOutput ( context , node , kOutputTensor ) ; <nl> - OpData data ; <nl> - CalculateArithmeticOpData ( context , node , & data ) ; <nl> + <nl> + TFLITE_DCHECK ( node - > user_data ! = nullptr ) ; <nl> + OpData * data = static_cast < OpData * > ( node - > user_data ) ; <nl> <nl> if ( input - > type = = kTfLiteFloat32 ) { <nl> switch ( output - > type ) { <nl> TfLiteStatus LogisticEval ( TfLiteContext * context , TfLiteNode * node ) { <nl> switch ( output - > type ) { <nl> case kTfLiteInt8 : { <nl> reference_integer_ops : : Logistic ( <nl> - input - > params . zero_point , data . input_range_radius , <nl> - data . input_multiplier , data . input_left_shift , <nl> + data - > input_zero_point , data - > input_range_radius , <nl> + data - > input_multiplier , data - > input_left_shift , <nl> NumElements ( input - > dims ) , GetTensorData < int8_t > ( input ) , <nl> GetTensorData < int8_t > ( output ) ) ; <nl> return kTfLiteOk ; <nl> TfLiteStatus LogisticEval ( TfLiteContext * context , TfLiteNode * node ) { <nl> } / / namespace activations <nl> <nl> TfLiteRegistration Register_LOGISTIC ( ) { <nl> - return { / * init = * / nullptr , <nl> + return { / * init = * / activations : : LogisticInit , <nl> / * free = * / nullptr , <nl> - / * prepare = * / nullptr , <nl> + / * prepare = * / activations : : LogisticPrepare , <nl> / * invoke = * / activations : : LogisticEval , <nl> / * profiling_string = * / nullptr , <nl> / * builtin_code = * / 0 , <nl>
Move OpData calculation from Eval ( ) into a stored persistent buffer in the Logistic kernel .
tensorflow/tensorflow
ecf032e1ecdbfe6ea64f639b03f8d7ea7ea8befa
2020-07-07T19:27:01Z
mmm a / src / mongo / db / SConscript <nl> ppp b / src / mongo / db / SConscript <nl> env . Library ( <nl> ] , <nl> ) <nl> <nl> + env . Library ( <nl> + target = " prefetch " , <nl> + source = [ <nl> + " prefetch . cpp " , <nl> + ] , <nl> + LIBDEPS = [ <nl> + " catalog / catalog " , <nl> + " dbhelpers " , <nl> + " index / index_access_methods " , <nl> + ] , <nl> + ) <nl> + <nl> # mongod files - also files used in tools . present in dbtests , but not in mongos and not in client <nl> # libs . <nl> serverOnlyFiles = [ <nl> " instance . cpp " , <nl> - " prefetch . cpp " , <nl> " range_deleter_db_env . cpp " , <nl> " range_deleter_service . cpp " , <nl> " read_concern . cpp " , <nl> serveronlyLibdeps = [ <nl> " ops / write_ops_parsers " , <nl> " pipeline / aggregation " , <nl> " pipeline / serveronly " , <nl> + " prefetch " , <nl> " query / query " , <nl> " range_deleter " , <nl> " repl / bgsync " , <nl>
SERVER - 23103 Move prefetch to its own library
mongodb/mongo
971f4f6eb011eff58539b49f0301f6d84e1dfa22
2016-12-14T14:22:24Z
Binary files a / Code / GameTemplates / cpp / Blank / bin / win_x64 / Game . dll and b / Code / GameTemplates / cpp / Blank / bin / win_x64 / Game . dll differ <nl> mmm a / Code / GameTemplates / cpp / Blank / project . cfg <nl> ppp b / Code / GameTemplates / cpp / Blank / project . cfg <nl> <nl> - engine_version = 5 . 1 . 0 <nl> + engine_version = 5 . 1 . 1 <nl> sys_dll_game = Game <nl> sys_game_folder = Assets <nl> Binary files a / Code / GameTemplates / cs / Blank / bin / win_x64 / CryEngine . Common . dll and b / Code / GameTemplates / cs / Blank / bin / win_x64 / CryEngine . Common . dll differ <nl> Binary files a / Code / GameTemplates / cs / Blank / bin / win_x64 / CryEngine . Core . dll and b / Code / GameTemplates / cs / Blank / bin / win_x64 / CryEngine . Core . dll differ <nl> Binary files a / Code / GameTemplates / cs / Blank / bin / win_x64 / CryEngine . Launcher . dll and b / Code / GameTemplates / cs / Blank / bin / win_x64 / CryEngine . Launcher . dll differ <nl> Binary files a / Code / GameTemplates / cs / Blank / bin / win_x64 / Game . dll and b / Code / GameTemplates / cs / Blank / bin / win_x64 / Game . dll differ <nl> Binary files a / Code / GameTemplates / cs / Blank / bin / win_x64 / mono / AddIns / CryEngine . Common . dll and b / Code / GameTemplates / cs / Blank / bin / win_x64 / mono / AddIns / CryEngine . Common . dll differ <nl> Binary files a / Code / GameTemplates / cs / Blank / bin / win_x64 / mono / AddIns / CryEngine . Core . dll and b / Code / GameTemplates / cs / Blank / bin / win_x64 / mono / AddIns / CryEngine . Core . dll differ <nl> Binary files a / Code / GameTemplates / cs / Blank / bin / win_x64 / mono / AddIns / CryEngine . SampleApp . dll and b / Code / GameTemplates / cs / Blank / bin / win_x64 / mono / AddIns / CryEngine . SampleApp . dll differ <nl> mmm a / Code / GameTemplates / cs / Blank / project . cfg <nl> ppp b / Code / GameTemplates / cs / Blank / project . cfg <nl> <nl> - engine_version = 5 . 1 . 0 <nl> + engine_version = 5 . 1 . 1 <nl> sys_dll_game = Game <nl> sys_game_folder = Assets <nl> Binary files a / Code / GameTemplates / cs / SandboxInteraction / bin / win_x64 / CryEngine . Common . dll and b / Code / GameTemplates / cs / SandboxInteraction / bin / win_x64 / CryEngine . Common . dll differ <nl> Binary files a / Code / GameTemplates / cs / SandboxInteraction / bin / win_x64 / CryEngine . Core . dll and b / Code / GameTemplates / cs / SandboxInteraction / bin / win_x64 / CryEngine . Core . dll differ <nl> Binary files a / Code / GameTemplates / cs / SandboxInteraction / bin / win_x64 / CryEngine . Launcher . dll and b / Code / GameTemplates / cs / SandboxInteraction / bin / win_x64 / CryEngine . Launcher . dll differ <nl> Binary files a / Code / GameTemplates / cs / SandboxInteraction / bin / win_x64 / Game . dll and b / Code / GameTemplates / cs / SandboxInteraction / bin / win_x64 / Game . dll differ <nl> Binary files a / Code / GameTemplates / cs / SandboxInteraction / bin / win_x64 / mono / AddIns / CryEngine . Common . dll and b / Code / GameTemplates / cs / SandboxInteraction / bin / win_x64 / mono / AddIns / CryEngine . Common . dll differ <nl> Binary files a / Code / GameTemplates / cs / SandboxInteraction / bin / win_x64 / mono / AddIns / CryEngine . Core . dll and b / Code / GameTemplates / cs / SandboxInteraction / bin / win_x64 / mono / AddIns / CryEngine . Core . dll differ <nl> Binary files a / Code / GameTemplates / cs / SandboxInteraction / bin / win_x64 / mono / AddIns / CryEngine . Editor . dll and b / Code / GameTemplates / cs / SandboxInteraction / bin / win_x64 / mono / AddIns / CryEngine . Editor . dll differ <nl> Binary files a / Code / GameTemplates / cs / SandboxInteraction / bin / win_x64 / mono / AddIns / CryEngine . SandboxInteraction . dll and b / Code / GameTemplates / cs / SandboxInteraction / bin / win_x64 / mono / AddIns / CryEngine . SandboxInteraction . dll differ <nl> mmm a / Code / GameTemplates / cs / SandboxInteraction / project . cfg <nl> ppp b / Code / GameTemplates / cs / SandboxInteraction / project . cfg <nl> <nl> - engine_version = 5 . 1 . 0 <nl> + engine_version = 5 . 1 . 1 <nl> sys_dll_game = Game <nl> sys_game_folder = Assets <nl> Binary files a / Code / GameTemplates / cs / Sydewinder / bin / win_x64 / CryEngine . Common . dll and b / Code / GameTemplates / cs / Sydewinder / bin / win_x64 / CryEngine . Common . dll differ <nl> Binary files a / Code / GameTemplates / cs / Sydewinder / bin / win_x64 / CryEngine . Core . dll and b / Code / GameTemplates / cs / Sydewinder / bin / win_x64 / CryEngine . Core . dll differ <nl> Binary files a / Code / GameTemplates / cs / Sydewinder / bin / win_x64 / CryEngine . Launcher . dll and b / Code / GameTemplates / cs / Sydewinder / bin / win_x64 / CryEngine . Launcher . dll differ <nl> Binary files a / Code / GameTemplates / cs / Sydewinder / bin / win_x64 / Game . dll and b / Code / GameTemplates / cs / Sydewinder / bin / win_x64 / Game . dll differ <nl> Binary files a / Code / GameTemplates / cs / Sydewinder / bin / win_x64 / mono / AddIns / CryEngine . Common . dll and b / Code / GameTemplates / cs / Sydewinder / bin / win_x64 / mono / AddIns / CryEngine . Common . dll differ <nl> Binary files a / Code / GameTemplates / cs / Sydewinder / bin / win_x64 / mono / AddIns / CryEngine . Core . dll and b / Code / GameTemplates / cs / Sydewinder / bin / win_x64 / mono / AddIns / CryEngine . Core . dll differ <nl> Binary files a / Code / GameTemplates / cs / Sydewinder / bin / win_x64 / mono / AddIns / CryEngine . Sydewinder . dll and b / Code / GameTemplates / cs / Sydewinder / bin / win_x64 / mono / AddIns / CryEngine . Sydewinder . dll differ <nl> mmm a / Code / GameTemplates / cs / Sydewinder / project . cfg <nl> ppp b / Code / GameTemplates / cs / Sydewinder / project . cfg <nl> <nl> - engine_version = 5 . 1 . 0 <nl> + engine_version = 5 . 1 . 1 <nl> sys_dll_game = Game <nl> sys_game_folder = Assets <nl> mmm a / download_sdks . py <nl> ppp b / download_sdks . py <nl> def read_chunks ( url , block_sz = 8192 * 8 ) : <nl> return <nl> <nl> <nl> - BASE_URL = ' https : / / github . com / CRYTEK - CRYENGINE / CRYENGINE / releases / download / 5 . 1 . 0 / CRYENGINE_v5 . 1 . 0_SDKs ' <nl> + BASE_URL = ' https : / / github . com / CRYTEK - CRYENGINE / CRYENGINE / releases / download / 5 . 1 . 1 / CRYENGINE_v5 . 1 . 1_SDKs ' <nl> <nl> <nl> def main ( ) : <nl>
! XI ce / main_stabilisation - > ce / main @ 1400888 ( Approved by achim )
CRYTEK/CRYENGINE
93211d64575c7de9c9fcbd163e836ebbb7e4c6d6
2016-06-13T09:54:39Z
mmm a / tensorflow / python / eager / imperative_grad . py <nl> ppp b / tensorflow / python / eager / imperative_grad . py <nl> def imperative_grad ( <nl> <nl> Raises : <nl> RuntimeError : if something goes wrong . <nl> - ValueError : if there is no sequence of differentiable operations connecting <nl> - a source and any target Tensor . This can happen either if the target is <nl> - not computed based on the source , if the tracing was set up incorrectly , <nl> - or if only non - differentiable functions of the source were used in the <nl> - computation of target . <nl> " " " <nl> return pywrap_tensorflow . TFE_Py_TapeGradient ( <nl> tape . _tape , # pylint : disable = protected - access <nl>
Remove Raises documentation on imperative_grads for ValueErrror not raised .
tensorflow/tensorflow
87315f41ced19136819cef56ef37636c52c474de
2018-10-08T16:59:07Z
mmm a / src / core / lib / iomgr / tcp_posix . cc <nl> ppp b / src / core / lib / iomgr / tcp_posix . cc <nl> struct grpc_tcp { <nl> int bytes_counter ; <nl> bool socket_ts_enabled ; / * True if timestamping options are set on the socket <nl> * / <nl> + bool ts_capable ; / * Cache whether we can set timestamping options * / <nl> gpr_atm <nl> stop_error_notification ; / * Set to 1 if we do not want to be notified on <nl> errors anymore * / <nl> ssize_t tcp_send ( int fd , const struct msghdr * msg ) { <nl> * / <nl> static bool tcp_write_with_timestamps ( grpc_tcp * tcp , struct msghdr * msg , <nl> size_t sending_length , <nl> - ssize_t * sent_length , grpc_error * * error ) ; <nl> + ssize_t * sent_length ) ; <nl> <nl> / * * The callback function to be invoked when we get an error on the socket . * / <nl> static void tcp_handle_error ( void * arg / * grpc_tcp * / , grpc_error * error ) ; <nl> static void tcp_handle_error ( void * arg / * grpc_tcp * / , grpc_error * error ) ; <nl> # ifdef GRPC_LINUX_ERRQUEUE <nl> static bool tcp_write_with_timestamps ( grpc_tcp * tcp , struct msghdr * msg , <nl> size_t sending_length , <nl> - ssize_t * sent_length , <nl> - grpc_error * * error ) { <nl> + ssize_t * sent_length ) { <nl> if ( ! tcp - > socket_ts_enabled ) { <nl> uint32_t opt = grpc_core : : kTimestampingSocketOptions ; <nl> if ( setsockopt ( tcp - > fd , SOL_SOCKET , SO_TIMESTAMPING , <nl> static_cast < void * > ( & opt ) , sizeof ( opt ) ) ! = 0 ) { <nl> - * error = tcp_annotate_error ( GRPC_OS_ERROR ( errno , " setsockopt " ) , tcp ) ; <nl> grpc_slice_buffer_reset_and_unref_internal ( tcp - > outgoing_buffer ) ; <nl> if ( grpc_tcp_trace . enabled ( ) ) { <nl> gpr_log ( GPR_ERROR , " Failed to set timestamping options on the socket . " ) ; <nl> static void tcp_handle_error ( void * arg / * grpc_tcp * / , grpc_error * error ) { <nl> # else / * GRPC_LINUX_ERRQUEUE * / <nl> static bool tcp_write_with_timestamps ( grpc_tcp * tcp , struct msghdr * msg , <nl> size_t sending_length , <nl> - ssize_t * sent_length , <nl> - grpc_error * * error ) { <nl> + ssize_t * sent_length ) { <nl> gpr_log ( GPR_ERROR , " Write with timestamps not supported for this platform " ) ; <nl> GPR_ASSERT ( 0 ) ; <nl> return false ; <nl> void tcp_shutdown_buffer_list ( grpc_tcp * tcp ) { <nl> gpr_mu_lock ( & tcp - > tb_mu ) ; <nl> grpc_core : : TracedBuffer : : Shutdown ( <nl> & tcp - > tb_head , tcp - > outgoing_buffer_arg , <nl> - GRPC_ERROR_CREATE_FROM_STATIC_STRING ( " endpoint destroyed " ) ) ; <nl> + GRPC_ERROR_CREATE_FROM_STATIC_STRING ( " TracedBuffer list shutdown " ) ) ; <nl> gpr_mu_unlock ( & tcp - > tb_mu ) ; <nl> tcp - > outgoing_buffer_arg = nullptr ; <nl> } <nl> static bool tcp_flush ( grpc_tcp * tcp , grpc_error * * error ) { <nl> struct msghdr msg ; <nl> struct iovec iov [ MAX_WRITE_IOVEC ] ; <nl> msg_iovlen_type iov_size ; <nl> - ssize_t sent_length ; <nl> + ssize_t sent_length = 0 ; <nl> size_t sending_length ; <nl> size_t trailing ; <nl> size_t unwind_slice_idx ; <nl> static bool tcp_flush ( grpc_tcp * tcp , grpc_error * * error ) { <nl> msg . msg_iov = iov ; <nl> msg . msg_iovlen = iov_size ; <nl> msg . msg_flags = 0 ; <nl> + bool tried_sending_message = false ; <nl> if ( tcp - > outgoing_buffer_arg ! = nullptr ) { <nl> - if ( ! tcp_write_with_timestamps ( tcp , & msg , sending_length , & sent_length , <nl> - error ) ) { <nl> + if ( ! tcp - > ts_capable | | <nl> + ! tcp_write_with_timestamps ( tcp , & msg , sending_length , & sent_length ) ) { <nl> + / * We could not set socket options to collect Fathom timestamps . <nl> + * Fallback on writing without timestamps . * / <nl> + tcp - > ts_capable = false ; <nl> tcp_shutdown_buffer_list ( tcp ) ; <nl> - return true ; / * something went wrong with timestamps * / <nl> + } else { <nl> + tried_sending_message = true ; <nl> } <nl> - } else { <nl> + } <nl> + if ( ! tried_sending_message ) { <nl> msg . msg_control = nullptr ; <nl> msg . msg_controllen = 0 ; <nl> <nl> grpc_endpoint * grpc_tcp_create ( grpc_fd * em_fd , <nl> tcp - > is_first_read = true ; <nl> tcp - > bytes_counter = - 1 ; <nl> tcp - > socket_ts_enabled = false ; <nl> + tcp - > ts_capable = true ; <nl> tcp - > outgoing_buffer_arg = nullptr ; <nl> / * paired with unref in grpc_tcp_destroy * / <nl> gpr_ref_init ( & tcp - > refcount , 1 ) ; <nl>
Merge pull request from yashykt / softerrorsetsocket
grpc/grpc
8114c05a2f84515c0f36c227d37925375f7002c5
2018-12-19T00:40:03Z
mmm a / lib / AST / ASTPrinter . cpp <nl> ppp b / lib / AST / ASTPrinter . cpp <nl> class TypePrinter : public TypeVisitor < TypePrinter > { <nl> if ( T - > hasExplicitAnyObject ( ) ) <nl> Printer < < " AnyObject " ; <nl> else <nl> - Printer < < " Any " ; <nl> + Printer . printKeyword ( " Any " , Options ) ; <nl> } else { <nl> interleave ( T - > getMembers ( ) , [ & ] ( Type Ty ) { visit ( Ty ) ; } , <nl> [ & ] { Printer < < " & " ; } ) ; <nl> mmm a / lib / AST / TypeRepr . cpp <nl> ppp b / lib / AST / TypeRepr . cpp <nl> CompositionTypeRepr * CompositionTypeRepr : : create ( const ASTContext & C , <nl> void CompositionTypeRepr : : printImpl ( ASTPrinter & Printer , <nl> const PrintOptions & Opts ) const { <nl> if ( getTypes ( ) . empty ( ) ) { <nl> - Printer < < " Any " ; <nl> + Printer . printKeyword ( " Any " , Opts ) ; <nl> } else { <nl> interleave ( getTypes ( ) , [ & ] ( TypeRepr * T ) { printTypeRepr ( T , Printer , Opts ) ; } , <nl> [ & ] { Printer < < " & " ; } ) ; <nl> mmm a / test / IDE / complete_annotation . swift <nl> ppp b / test / IDE / complete_annotation . swift <nl> func testGlobal ( ) { <nl> / / GLOBAL_EXPR - DAG : Keyword [ # function ] / None : < name > # function < / name > ; name = # function <nl> / / GLOBAL_EXPR - DAG : Decl [ Module ] / None : < name > Swift < / name > ; name = Swift <nl> / / GLOBAL_EXPR - DAG : Decl [ Struct ] / OtherModule [ Swift ] : < name > Int < / name > ; name = Int <nl> - / / GLOBAL_EXPR - DAG : Decl [ FreeFunction ] / OtherModule [ Swift ] : < name > print < / name > ( < callarg > < callarg . label > _ < / callarg . label > < callarg . param > items < / callarg . param > : < callarg . type > Any < / callarg . type > . . . < / callarg > , < callarg > < callarg . label > to < / callarg . label > < callarg . param > output < / callarg . param > : & amp ; < callarg . type > < typeid . sys > TextOutputStream < / typeid . sys > < / callarg . type > < / callarg > ) ; name = print ( items : Any . . . , to : & TextOutputStream ) <nl> + / / GLOBAL_EXPR - DAG : Decl [ FreeFunction ] / OtherModule [ Swift ] : < name > print < / name > ( < callarg > < callarg . label > _ < / callarg . label > < callarg . param > items < / callarg . param > : < callarg . type > < keyword > Any < / keyword > < / callarg . type > . . . < / callarg > , < callarg > < callarg . label > to < / callarg . label > < callarg . param > output < / callarg . param > : & amp ; < callarg . type > < typeid . sys > TextOutputStream < / typeid . sys > < / callarg . type > < / callarg > ) ; name = print ( items : Any . . . , to : & TextOutputStream ) <nl> / / GLOBAL_EXPR : End completions <nl> <nl> <nl> mmm a / test / SourceKit / CursorInfo / cursor_info . swift <nl> ppp b / test / SourceKit / CursorInfo / cursor_info . swift <nl> enum E7 : String { <nl> case b = " \ u { 66 } " <nl> } <nl> <nl> + func checkAnyIsAKeyword ( x : Any ) { } <nl> + <nl> / / REQUIRES : objc_interop <nl> / / RUN : % empty - directory ( % t . tmp ) <nl> / / RUN : % swiftc_driver - emit - module - o % t . tmp / FooSwiftModule . swiftmodule % S / Inputs / FooSwiftModule . swift <nl> enum E7 : String { <nl> <nl> / / RUN : % sourcekitd - test - req = cursor - pos = 227 : 14 % s - - - F % S / . . / Inputs / libIDE - mock - sdk - I % t . tmp % s | % FileCheck - check - prefix = CHECK94 % s <nl> / / CHECK94 : < empty cursor info ; internal diagnostic : " Resolved to incomplete expression or statement . " > <nl> + <nl> + / / RUN : % sourcekitd - test - req = cursor - pos = 231 : 6 % s - - - F % S / . . / Inputs / libIDE - mock - sdk - I % t . tmp % s | % FileCheck - check - prefix = CHECK95 % s <nl> + / / CHECK95 : < Declaration > func checkAnyIsAKeyword ( x : Any ) < / Declaration > <nl> + / / CHECK95 - NEXT : < decl . function . free > < syntaxtype . keyword > func < / syntaxtype . keyword > < decl . name > checkAnyIsAKeyword < / decl . name > ( < decl . var . parameter > < decl . var . parameter . argument_label > x < / decl . var . parameter . argument_label > : < decl . var . parameter . type > < syntaxtype . keyword > Any < / syntaxtype . keyword > < / decl . var . parameter . type > < / decl . var . parameter > ) < / decl . function . free > <nl> mmm a / test / SourceKit / DocSupport / Inputs / cake . swift <nl> ppp b / test / SourceKit / DocSupport / Inputs / cake . swift <nl> public protocol P { <nl> public extension P { <nl> func bar ( ) where Self : Equatable { } <nl> } <nl> + <nl> + public func shouldPrintAnyAsKeyword ( x : Any ) { } <nl> mmm a / test / SourceKit / DocSupport / doc_clang_module . swift . response <nl> ppp b / test / SourceKit / DocSupport / doc_clang_module . swift . response <nl> var FooSubUnnamedEnumeratorA1 : Int { get } <nl> key . usr : " c : objc ( cs ) FooClassBase ( im ) fooBaseInstanceFunc1 : " , <nl> key . offset : 4534 , <nl> key . length : 60 , <nl> - key . fully_annotated_decl : " < decl . function . method . instance > < syntaxtype . keyword > func < / syntaxtype . keyword > < decl . name > fooBaseInstanceFunc1 < / decl . name > ( < decl . var . parameter > < decl . var . parameter . argument_label > _ < / decl . var . parameter . argument_label > < decl . var . parameter . name > anObject < / decl . var . parameter . name > : < decl . var . parameter . type > Any ! < / decl . var . parameter . type > < / decl . var . parameter > ) - & gt ; < decl . function . returntype > < ref . class usr = \ " c : objc ( cs ) FooClassBase \ " > FooClassBase < / ref . class > ! < / decl . function . returntype > < / decl . function . method . instance > " , <nl> + key . fully_annotated_decl : " < decl . function . method . instance > < syntaxtype . keyword > func < / syntaxtype . keyword > < decl . name > fooBaseInstanceFunc1 < / decl . name > ( < decl . var . parameter > < decl . var . parameter . argument_label > _ < / decl . var . parameter . argument_label > < decl . var . parameter . name > anObject < / decl . var . parameter . name > : < decl . var . parameter . type > < syntaxtype . keyword > Any < / syntaxtype . keyword > ! < / decl . var . parameter . type > < / decl . var . parameter > ) - & gt ; < decl . function . returntype > < ref . class usr = \ " c : objc ( cs ) FooClassBase \ " > FooClassBase < / ref . class > ! < / decl . function . returntype > < / decl . function . method . instance > " , <nl> key . entities : [ <nl> { <nl> key . kind : source . lang . swift . decl . var . local , <nl> var FooSubUnnamedEnumeratorA1 : Int { get } <nl> key . usr : " c : objc ( cs ) FooClassBase ( im ) _internalMeth1 " , <nl> key . offset : 4730 , <nl> key . length : 29 , <nl> - key . fully_annotated_decl : " < decl . function . method . instance > < syntaxtype . keyword > func < / syntaxtype . keyword > < decl . name > _internalMeth1 < / decl . name > ( ) - & gt ; < decl . function . returntype > Any ! < / decl . function . returntype > < / decl . function . method . instance > " <nl> + key . fully_annotated_decl : " < decl . function . method . instance > < syntaxtype . keyword > func < / syntaxtype . keyword > < decl . name > _internalMeth1 < / decl . name > ( ) - & gt ; < decl . function . returntype > < syntaxtype . keyword > Any < / syntaxtype . keyword > ! < / decl . function . returntype > < / decl . function . method . instance > " <nl> } , <nl> { <nl> key . kind : source . lang . swift . decl . function . method . instance , <nl> var FooSubUnnamedEnumeratorA1 : Int { get } <nl> key . usr : " c : objc ( cs ) FooClassBase ( im ) _internalMeth2 " , <nl> key . offset : 4765 , <nl> key . length : 29 , <nl> - key . fully_annotated_decl : " < decl . function . method . instance > < syntaxtype . keyword > func < / syntaxtype . keyword > < decl . name > _internalMeth2 < / decl . name > ( ) - & gt ; < decl . function . returntype > Any ! < / decl . function . returntype > < / decl . function . method . instance > " <nl> + key . fully_annotated_decl : " < decl . function . method . instance > < syntaxtype . keyword > func < / syntaxtype . keyword > < decl . name > _internalMeth2 < / decl . name > ( ) - & gt ; < decl . function . returntype > < syntaxtype . keyword > Any < / syntaxtype . keyword > ! < / decl . function . returntype > < / decl . function . method . instance > " <nl> } , <nl> { <nl> key . kind : source . lang . swift . decl . function . method . instance , <nl> var FooSubUnnamedEnumeratorA1 : Int { get } <nl> key . usr : " c : objc ( cs ) FooClassBase ( im ) nonInternalMeth " , <nl> key . offset : 4800 , <nl> key . length : 30 , <nl> - key . fully_annotated_decl : " < decl . function . method . instance > < syntaxtype . keyword > func < / syntaxtype . keyword > < decl . name > nonInternalMeth < / decl . name > ( ) - & gt ; < decl . function . returntype > Any ! < / decl . function . returntype > < / decl . function . method . instance > " <nl> + key . fully_annotated_decl : " < decl . function . method . instance > < syntaxtype . keyword > func < / syntaxtype . keyword > < decl . name > nonInternalMeth < / decl . name > ( ) - & gt ; < decl . function . returntype > < syntaxtype . keyword > Any < / syntaxtype . keyword > ! < / decl . function . returntype > < / decl . function . method . instance > " <nl> } , <nl> { <nl> key . kind : source . lang . swift . decl . function . method . instance , <nl> var FooSubUnnamedEnumeratorA1 : Int { get } <nl> key . usr : " c : objc ( cs ) FooClassBase ( im ) _internalMeth3 " , <nl> key . offset : 4836 , <nl> key . length : 29 , <nl> - key . fully_annotated_decl : " < decl . function . method . instance > < syntaxtype . keyword > func < / syntaxtype . keyword > < decl . name > _internalMeth3 < / decl . name > ( ) - & gt ; < decl . function . returntype > Any ! < / decl . function . returntype > < / decl . function . method . instance > " <nl> + key . fully_annotated_decl : " < decl . function . method . instance > < syntaxtype . keyword > func < / syntaxtype . keyword > < decl . name > _internalMeth3 < / decl . name > ( ) - & gt ; < decl . function . returntype > < syntaxtype . keyword > Any < / syntaxtype . keyword > ! < / decl . function . returntype > < / decl . function . method . instance > " <nl> } <nl> ] <nl> } , <nl> var FooSubUnnamedEnumeratorA1 : Int { get } <nl> key . original_usr : " c : objc ( cs ) FooClassBase ( im ) _internalMeth1 " , <nl> key . offset : 5224 , <nl> key . length : 29 , <nl> - key . fully_annotated_decl : " < decl . function . method . instance > < syntaxtype . keyword > func < / syntaxtype . keyword > < decl . name > _internalMeth1 < / decl . name > ( ) - & gt ; < decl . function . returntype > Any ! < / decl . function . returntype > < / decl . function . method . instance > " <nl> + key . fully_annotated_decl : " < decl . function . method . instance > < syntaxtype . keyword > func < / syntaxtype . keyword > < decl . name > _internalMeth1 < / decl . name > ( ) - & gt ; < decl . function . returntype > < syntaxtype . keyword > Any < / syntaxtype . keyword > ! < / decl . function . returntype > < / decl . function . method . instance > " <nl> } , <nl> { <nl> key . kind : source . lang . swift . decl . function . method . instance , <nl> var FooSubUnnamedEnumeratorA1 : Int { get } <nl> key . original_usr : " c : objc ( cs ) FooClassBase ( im ) _internalMeth2 " , <nl> key . offset : 5259 , <nl> key . length : 29 , <nl> - key . fully_annotated_decl : " < decl . function . method . instance > < syntaxtype . keyword > func < / syntaxtype . keyword > < decl . name > _internalMeth2 < / decl . name > ( ) - & gt ; < decl . function . returntype > Any ! < / decl . function . returntype > < / decl . function . method . instance > " <nl> + key . fully_annotated_decl : " < decl . function . method . instance > < syntaxtype . keyword > func < / syntaxtype . keyword > < decl . name > _internalMeth2 < / decl . name > ( ) - & gt ; < decl . function . returntype > < syntaxtype . keyword > Any < / syntaxtype . keyword > ! < / decl . function . returntype > < / decl . function . method . instance > " <nl> } , <nl> { <nl> key . kind : source . lang . swift . decl . function . method . instance , <nl> var FooSubUnnamedEnumeratorA1 : Int { get } <nl> key . original_usr : " c : objc ( cs ) FooClassBase ( im ) nonInternalMeth " , <nl> key . offset : 5294 , <nl> key . length : 30 , <nl> - key . fully_annotated_decl : " < decl . function . method . instance > < syntaxtype . keyword > func < / syntaxtype . keyword > < decl . name > nonInternalMeth < / decl . name > ( ) - & gt ; < decl . function . returntype > Any ! < / decl . function . returntype > < / decl . function . method . instance > " <nl> + key . fully_annotated_decl : " < decl . function . method . instance > < syntaxtype . keyword > func < / syntaxtype . keyword > < decl . name > nonInternalMeth < / decl . name > ( ) - & gt ; < decl . function . returntype > < syntaxtype . keyword > Any < / syntaxtype . keyword > ! < / decl . function . returntype > < / decl . function . method . instance > " <nl> } , <nl> { <nl> key . kind : source . lang . swift . decl . function . method . instance , <nl> var FooSubUnnamedEnumeratorA1 : Int { get } <nl> key . original_usr : " c : objc ( cs ) FooClassBase ( im ) _internalMeth3 " , <nl> key . offset : 5330 , <nl> key . length : 29 , <nl> - key . fully_annotated_decl : " < decl . function . method . instance > < syntaxtype . keyword > func < / syntaxtype . keyword > < decl . name > _internalMeth3 < / decl . name > ( ) - & gt ; < decl . function . returntype > Any ! < / decl . function . returntype > < / decl . function . method . instance > " <nl> + key . fully_annotated_decl : " < decl . function . method . instance > < syntaxtype . keyword > func < / syntaxtype . keyword > < decl . name > _internalMeth3 < / decl . name > ( ) - & gt ; < decl . function . returntype > < syntaxtype . keyword > Any < / syntaxtype . keyword > ! < / decl . function . returntype > < / decl . function . method . instance > " <nl> } <nl> ] <nl> } , <nl> var FooSubUnnamedEnumeratorA1 : Int { get } <nl> key . usr : " c : objc ( cs ) FooClassBase ( im ) _internalMeth1 " , <nl> key . offset : 6129 , <nl> key . length : 29 , <nl> - key . fully_annotated_decl : " < decl . function . method . instance > < syntaxtype . keyword > func < / syntaxtype . keyword > < decl . name > _internalMeth1 < / decl . name > ( ) - & gt ; < decl . function . returntype > Any ! < / decl . function . returntype > < / decl . function . method . instance > " <nl> + key . fully_annotated_decl : " < decl . function . method . instance > < syntaxtype . keyword > func < / syntaxtype . keyword > < decl . name > _internalMeth1 < / decl . name > ( ) - & gt ; < decl . function . returntype > < syntaxtype . keyword > Any < / syntaxtype . keyword > ! < / decl . function . returntype > < / decl . function . method . instance > " <nl> } <nl> ] <nl> } , <nl> var FooSubUnnamedEnumeratorA1 : Int { get } <nl> key . usr : " c : objc ( cs ) FooClassBase ( im ) _internalMeth2 " , <nl> key . offset : 6191 , <nl> key . length : 29 , <nl> - key . fully_annotated_decl : " < decl . function . method . instance > < syntaxtype . keyword > func < / syntaxtype . keyword > < decl . name > _internalMeth2 < / decl . name > ( ) - & gt ; < decl . function . returntype > Any ! < / decl . function . returntype > < / decl . function . method . instance > " <nl> + key . fully_annotated_decl : " < decl . function . method . instance > < syntaxtype . keyword > func < / syntaxtype . keyword > < decl . name > _internalMeth2 < / decl . name > ( ) - & gt ; < decl . function . returntype > < syntaxtype . keyword > Any < / syntaxtype . keyword > ! < / decl . function . returntype > < / decl . function . method . instance > " <nl> } , <nl> { <nl> key . kind : source . lang . swift . decl . function . method . instance , <nl> var FooSubUnnamedEnumeratorA1 : Int { get } <nl> key . usr : " c : objc ( cs ) FooClassBase ( im ) nonInternalMeth " , <nl> key . offset : 6226 , <nl> key . length : 30 , <nl> - key . fully_annotated_decl : " < decl . function . method . instance > < syntaxtype . keyword > func < / syntaxtype . keyword > < decl . name > nonInternalMeth < / decl . name > ( ) - & gt ; < decl . function . returntype > Any ! < / decl . function . returntype > < / decl . function . method . instance > " <nl> + key . fully_annotated_decl : " < decl . function . method . instance > < syntaxtype . keyword > func < / syntaxtype . keyword > < decl . name > nonInternalMeth < / decl . name > ( ) - & gt ; < decl . function . returntype > < syntaxtype . keyword > Any < / syntaxtype . keyword > ! < / decl . function . returntype > < / decl . function . method . instance > " <nl> } <nl> ] <nl> } , <nl> var FooSubUnnamedEnumeratorA1 : Int { get } <nl> key . usr : " c : objc ( cs ) FooClassBase ( im ) _internalMeth3 " , <nl> key . offset : 6289 , <nl> key . length : 29 , <nl> - key . fully_annotated_decl : " < decl . function . method . instance > < syntaxtype . keyword > func < / syntaxtype . keyword > < decl . name > _internalMeth3 < / decl . name > ( ) - & gt ; < decl . function . returntype > Any ! < / decl . function . returntype > < / decl . function . method . instance > " <nl> + key . fully_annotated_decl : " < decl . function . method . instance > < syntaxtype . keyword > func < / syntaxtype . keyword > < decl . name > _internalMeth3 < / decl . name > ( ) - & gt ; < decl . function . returntype > < syntaxtype . keyword > Any < / syntaxtype . keyword > ! < / decl . function . returntype > < / decl . function . method . instance > " <nl> } <nl> ] <nl> } , <nl> var FooSubUnnamedEnumeratorA1 : Int { get } <nl> key . usr : " c : objc ( cs ) FooClassPropertyOwnership ( py ) retainable " , <nl> key . offset : 6552 , <nl> key . length : 20 , <nl> - key . fully_annotated_decl : " < decl . var . instance > < syntaxtype . keyword > var < / syntaxtype . keyword > < decl . name > retainable < / decl . name > : < decl . var . type > Any ! < / decl . var . type > { < syntaxtype . keyword > get < / syntaxtype . keyword > < syntaxtype . keyword > set < / syntaxtype . keyword > } < / decl . var . instance > " <nl> + key . fully_annotated_decl : " < decl . var . instance > < syntaxtype . keyword > var < / syntaxtype . keyword > < decl . name > retainable < / decl . name > : < decl . var . type > < syntaxtype . keyword > Any < / syntaxtype . keyword > ! < / decl . var . type > { < syntaxtype . keyword > get < / syntaxtype . keyword > < syntaxtype . keyword > set < / syntaxtype . keyword > } < / decl . var . instance > " <nl> } , <nl> { <nl> key . kind : source . lang . swift . decl . var . instance , <nl> var FooSubUnnamedEnumeratorA1 : Int { get } <nl> key . usr : " c : objc ( cs ) FooClassPropertyOwnership ( py ) strongRef " , <nl> key . offset : 6578 , <nl> key . length : 19 , <nl> - key . fully_annotated_decl : " < decl . var . instance > < syntaxtype . keyword > var < / syntaxtype . keyword > < decl . name > strongRef < / decl . name > : < decl . var . type > Any ! < / decl . var . type > { < syntaxtype . keyword > get < / syntaxtype . keyword > < syntaxtype . keyword > set < / syntaxtype . keyword > } < / decl . var . instance > " <nl> + key . fully_annotated_decl : " < decl . var . instance > < syntaxtype . keyword > var < / syntaxtype . keyword > < decl . name > strongRef < / decl . name > : < decl . var . type > < syntaxtype . keyword > Any < / syntaxtype . keyword > ! < / decl . var . type > { < syntaxtype . keyword > get < / syntaxtype . keyword > < syntaxtype . keyword > set < / syntaxtype . keyword > } < / decl . var . instance > " <nl> } , <nl> { <nl> key . kind : source . lang . swift . decl . var . instance , <nl> var FooSubUnnamedEnumeratorA1 : Int { get } <nl> key . usr : " c : objc ( cs ) FooClassPropertyOwnership ( py ) copyable " , <nl> key . offset : 6603 , <nl> key . length : 18 , <nl> - key . fully_annotated_decl : " < decl . var . instance > < syntaxtype . keyword > var < / syntaxtype . keyword > < decl . name > copyable < / decl . name > : < decl . var . type > Any ! < / decl . var . type > { < syntaxtype . keyword > get < / syntaxtype . keyword > < syntaxtype . keyword > set < / syntaxtype . keyword > } < / decl . var . instance > " <nl> + key . fully_annotated_decl : " < decl . var . instance > < syntaxtype . keyword > var < / syntaxtype . keyword > < decl . name > copyable < / decl . name > : < decl . var . type > < syntaxtype . keyword > Any < / syntaxtype . keyword > ! < / decl . var . type > { < syntaxtype . keyword > get < / syntaxtype . keyword > < syntaxtype . keyword > set < / syntaxtype . keyword > } < / decl . var . instance > " <nl> } , <nl> { <nl> key . kind : source . lang . swift . decl . var . instance , <nl> var FooSubUnnamedEnumeratorA1 : Int { get } <nl> key . original_usr : " c : objc ( cs ) FooClassBase ( im ) _internalMeth1 " , <nl> key . offset : 6684 , <nl> key . length : 29 , <nl> - key . fully_annotated_decl : " < decl . function . method . instance > < syntaxtype . keyword > func < / syntaxtype . keyword > < decl . name > _internalMeth1 < / decl . name > ( ) - & gt ; < decl . function . returntype > Any ! < / decl . function . returntype > < / decl . function . method . instance > " <nl> + key . fully_annotated_decl : " < decl . function . method . instance > < syntaxtype . keyword > func < / syntaxtype . keyword > < decl . name > _internalMeth1 < / decl . name > ( ) - & gt ; < decl . function . returntype > < syntaxtype . keyword > Any < / syntaxtype . keyword > ! < / decl . function . returntype > < / decl . function . method . instance > " <nl> } , <nl> { <nl> key . kind : source . lang . swift . decl . function . method . instance , <nl> var FooSubUnnamedEnumeratorA1 : Int { get } <nl> key . original_usr : " c : objc ( cs ) FooClassBase ( im ) _internalMeth2 " , <nl> key . offset : 6719 , <nl> key . length : 29 , <nl> - key . fully_annotated_decl : " < decl . function . method . instance > < syntaxtype . keyword > func < / syntaxtype . keyword > < decl . name > _internalMeth2 < / decl . name > ( ) - & gt ; < decl . function . returntype > Any ! < / decl . function . returntype > < / decl . function . method . instance > " <nl> + key . fully_annotated_decl : " < decl . function . method . instance > < syntaxtype . keyword > func < / syntaxtype . keyword > < decl . name > _internalMeth2 < / decl . name > ( ) - & gt ; < decl . function . returntype > < syntaxtype . keyword > Any < / syntaxtype . keyword > ! < / decl . function . returntype > < / decl . function . method . instance > " <nl> } , <nl> { <nl> key . kind : source . lang . swift . decl . function . method . instance , <nl> var FooSubUnnamedEnumeratorA1 : Int { get } <nl> key . original_usr : " c : objc ( cs ) FooClassBase ( im ) nonInternalMeth " , <nl> key . offset : 6754 , <nl> key . length : 30 , <nl> - key . fully_annotated_decl : " < decl . function . method . instance > < syntaxtype . keyword > func < / syntaxtype . keyword > < decl . name > nonInternalMeth < / decl . name > ( ) - & gt ; < decl . function . returntype > Any ! < / decl . function . returntype > < / decl . function . method . instance > " <nl> + key . fully_annotated_decl : " < decl . function . method . instance > < syntaxtype . keyword > func < / syntaxtype . keyword > < decl . name > nonInternalMeth < / decl . name > ( ) - & gt ; < decl . function . returntype > < syntaxtype . keyword > Any < / syntaxtype . keyword > ! < / decl . function . returntype > < / decl . function . method . instance > " <nl> } , <nl> { <nl> key . kind : source . lang . swift . decl . function . method . instance , <nl> var FooSubUnnamedEnumeratorA1 : Int { get } <nl> key . original_usr : " c : objc ( cs ) FooClassBase ( im ) _internalMeth3 " , <nl> key . offset : 6790 , <nl> key . length : 29 , <nl> - key . fully_annotated_decl : " < decl . function . method . instance > < syntaxtype . keyword > func < / syntaxtype . keyword > < decl . name > _internalMeth3 < / decl . name > ( ) - & gt ; < decl . function . returntype > Any ! < / decl . function . returntype > < / decl . function . method . instance > " <nl> + key . fully_annotated_decl : " < decl . function . method . instance > < syntaxtype . keyword > func < / syntaxtype . keyword > < decl . name > _internalMeth3 < / decl . name > ( ) - & gt ; < decl . function . returntype > < syntaxtype . keyword > Any < / syntaxtype . keyword > ! < / decl . function . returntype > < / decl . function . method . instance > " <nl> } <nl> ] <nl> } , <nl> var FooSubUnnamedEnumeratorA1 : Int { get } <nl> key . original_usr : " c : objc ( cs ) FooClassBase ( im ) _internalMeth1 " , <nl> key . offset : 7293 , <nl> key . length : 29 , <nl> - key . fully_annotated_decl : " < decl . function . method . instance > < syntaxtype . keyword > func < / syntaxtype . keyword > < decl . name > _internalMeth1 < / decl . name > ( ) - & gt ; < decl . function . returntype > Any ! < / decl . function . returntype > < / decl . function . method . instance > " <nl> + key . fully_annotated_decl : " < decl . function . method . instance > < syntaxtype . keyword > func < / syntaxtype . keyword > < decl . name > _internalMeth1 < / decl . name > ( ) - & gt ; < decl . function . returntype > < syntaxtype . keyword > Any < / syntaxtype . keyword > ! < / decl . function . returntype > < / decl . function . method . instance > " <nl> } , <nl> { <nl> key . kind : source . lang . swift . decl . function . method . instance , <nl> var FooSubUnnamedEnumeratorA1 : Int { get } <nl> key . original_usr : " c : objc ( cs ) FooClassBase ( im ) _internalMeth2 " , <nl> key . offset : 7328 , <nl> key . length : 29 , <nl> - key . fully_annotated_decl : " < decl . function . method . instance > < syntaxtype . keyword > func < / syntaxtype . keyword > < decl . name > _internalMeth2 < / decl . name > ( ) - & gt ; < decl . function . returntype > Any ! < / decl . function . returntype > < / decl . function . method . instance > " <nl> + key . fully_annotated_decl : " < decl . function . method . instance > < syntaxtype . keyword > func < / syntaxtype . keyword > < decl . name > _internalMeth2 < / decl . name > ( ) - & gt ; < decl . function . returntype > < syntaxtype . keyword > Any < / syntaxtype . keyword > ! < / decl . function . returntype > < / decl . function . method . instance > " <nl> } , <nl> { <nl> key . kind : source . lang . swift . decl . function . method . instance , <nl> var FooSubUnnamedEnumeratorA1 : Int { get } <nl> key . original_usr : " c : objc ( cs ) FooClassBase ( im ) nonInternalMeth " , <nl> key . offset : 7363 , <nl> key . length : 30 , <nl> - key . fully_annotated_decl : " < decl . function . method . instance > < syntaxtype . keyword > func < / syntaxtype . keyword > < decl . name > nonInternalMeth < / decl . name > ( ) - & gt ; < decl . function . returntype > Any ! < / decl . function . returntype > < / decl . function . method . instance > " <nl> + key . fully_annotated_decl : " < decl . function . method . instance > < syntaxtype . keyword > func < / syntaxtype . keyword > < decl . name > nonInternalMeth < / decl . name > ( ) - & gt ; < decl . function . returntype > < syntaxtype . keyword > Any < / syntaxtype . keyword > ! < / decl . function . returntype > < / decl . function . method . instance > " <nl> } , <nl> { <nl> key . kind : source . lang . swift . decl . function . method . instance , <nl> var FooSubUnnamedEnumeratorA1 : Int { get } <nl> key . original_usr : " c : objc ( cs ) FooClassBase ( im ) _internalMeth3 " , <nl> key . offset : 7399 , <nl> key . length : 29 , <nl> - key . fully_annotated_decl : " < decl . function . method . instance > < syntaxtype . keyword > func < / syntaxtype . keyword > < decl . name > _internalMeth3 < / decl . name > ( ) - & gt ; < decl . function . returntype > Any ! < / decl . function . returntype > < / decl . function . method . instance > " <nl> + key . fully_annotated_decl : " < decl . function . method . instance > < syntaxtype . keyword > func < / syntaxtype . keyword > < decl . name > _internalMeth3 < / decl . name > ( ) - & gt ; < decl . function . returntype > < syntaxtype . keyword > Any < / syntaxtype . keyword > ! < / decl . function . returntype > < / decl . function . method . instance > " <nl> } <nl> ] <nl> } , <nl> mmm a / test / SourceKit / DocSupport / doc_swift_module . swift . response <nl> ppp b / test / SourceKit / DocSupport / doc_swift_module . swift . response <nl> extension S3 { <nl> <nl> func genfoo < T1 , T2 > ( x ix : T1 , y iy : T2 ) where T1 : cake . Prot , T2 : cake . C1 , T1 . Element = = Int <nl> <nl> + func shouldPrintAnyAsKeyword ( x x : Any ) <nl> + <nl> <nl> [ <nl> { <nl> func genfoo < T1 , T2 > ( x ix : T1 , y iy : T2 ) where T1 : cake . Prot , T2 : cake . C1 , T1 . E <nl> key . usr : " s : Si " , <nl> key . offset : 2408 , <nl> key . length : 3 <nl> + } , <nl> + { <nl> + key . kind : source . lang . swift . syntaxtype . keyword , <nl> + key . offset : 2413 , <nl> + key . length : 4 <nl> + } , <nl> + { <nl> + key . kind : source . lang . swift . syntaxtype . identifier , <nl> + key . offset : 2418 , <nl> + key . length : 23 <nl> + } , <nl> + { <nl> + key . kind : source . lang . swift . syntaxtype . argument , <nl> + key . offset : 2442 , <nl> + key . length : 1 <nl> + } , <nl> + { <nl> + key . kind : source . lang . swift . syntaxtype . parameter , <nl> + key . offset : 2444 , <nl> + key . length : 1 <nl> + } , <nl> + { <nl> + key . kind : source . lang . swift . syntaxtype . keyword , <nl> + key . offset : 2447 , <nl> + key . length : 3 <nl> } <nl> ] <nl> [ <nl> func genfoo < T1 , T2 > ( x ix : T1 , y iy : T2 ) where T1 : cake . Prot , T2 : cake . C1 , T1 . E <nl> key . length : 2 <nl> } <nl> ] <nl> + } , <nl> + { <nl> + key . kind : source . lang . swift . decl . function . free , <nl> + key . name : " shouldPrintAnyAsKeyword ( x : ) " , <nl> + key . usr : " s : 4cake23shouldPrintAnyAsKeyword1xyyp_tF " , <nl> + key . offset : 2413 , <nl> + key . length : 38 , <nl> + key . fully_annotated_decl : " < decl . function . free > < syntaxtype . keyword > func < / syntaxtype . keyword > < decl . name > shouldPrintAnyAsKeyword < / decl . name > ( < decl . var . parameter > < decl . var . parameter . argument_label > x < / decl . var . parameter . argument_label > : < decl . var . parameter . type > < syntaxtype . keyword > Any < / syntaxtype . keyword > < / decl . var . parameter . type > < / decl . var . parameter > ) < / decl . function . free > " , <nl> + key . entities : [ <nl> + { <nl> + key . kind : source . lang . swift . decl . var . local , <nl> + key . keyword : " x " , <nl> + key . name : " x " , <nl> + key . offset : 2447 , <nl> + key . length : 3 <nl> + } <nl> + ] <nl> } <nl> ] <nl>
[ ASTPrinter ] [ SourceKit ] Print ' Any ' as a keyword .
apple/swift
a9aba54b428ac0f967940c72d839697f900a9fe2
2020-04-28T20:35:06Z
mmm a / libraries / chain / include / eosio / chain / name . hpp <nl> ppp b / libraries / chain / include / eosio / chain / name . hpp <nl> <nl> namespace eosio { namespace chain { <nl> using std : : string ; <nl> <nl> - static constexpr char char_to_symbol ( char c ) { <nl> + static constexpr uint64_t char_to_symbol ( char c ) { <nl> if ( c > = ' a ' & & c < = ' z ' ) <nl> return ( c - ' a ' ) + 6 ; <nl> if ( c > = ' 1 ' & & c < = ' 5 ' ) <nl> namespace eosio { namespace chain { <nl> / / NOTE : char_to_symbol ( ) returns char type , and without this explicit <nl> / / expansion to uint64 type , the compilation fails at the point of usage <nl> / / of string_to_name ( ) , where the usage requires constant ( compile time ) expression . <nl> - name | = ( uint64_t ) ( char_to_symbol ( str [ i ] ) & 0x1f ) < < ( 64 - 5 * ( i + 1 ) ) ; <nl> + name | = ( char_to_symbol ( str [ i ] ) & 0x1f ) < < ( 64 - 5 * ( i + 1 ) ) ; <nl> } <nl> <nl> / / The for - loop encoded up to 60 high bits into uint64 ' name ' variable , <nl>
Merge pull request from EOSIO / Issue - 2434
EOSIO/eos
6dbdf6aba531e4722fd67059d137fc8bcc5b6c84
2018-04-17T14:40:09Z
mmm a / tensorflow / core / common_runtime / gpu / gpu_device . cc <nl> ppp b / tensorflow / core / common_runtime / gpu / gpu_device . cc <nl> Status BaseGPUDeviceFactory : : GetValidDeviceIds ( <nl> } <nl> <nl> auto stream_exec = executor . ValueOrDie ( ) ; <nl> - int64 free_bytes ; <nl> - int64 total_bytes ; <nl> - if ( ! stream_exec - > DeviceMemoryUsage ( & free_bytes , & total_bytes ) ) { <nl> - / / Logs internally on failure . <nl> - free_bytes = 0 ; <nl> - total_bytes = 0 ; <nl> - } <nl> const auto & description = stream_exec - > GetDeviceDescription ( ) ; <nl> # if GOOGLE_CUDA <nl> int cc_major ; <nl> Status BaseGPUDeviceFactory : : GetValidDeviceIds ( <nl> < < " \ nname : " < < description . name ( ) < < " major : " < < cc_major <nl> < < " minor : " < < cc_minor <nl> < < " memoryClockRate ( GHz ) : " < < description . clock_rate_ghz ( ) <nl> - < < " \ npciBusID : " < < description . pci_bus_id ( ) < < " \ ntotalMemory : " <nl> - < < strings : : HumanReadableNumBytes ( total_bytes ) <nl> - < < " freeMemory : " < < strings : : HumanReadableNumBytes ( free_bytes ) ; <nl> + < < " \ npciBusID : " < < description . pci_bus_id ( ) ; <nl> # elif TENSORFLOW_USE_ROCM <nl> int isa_version ; <nl> if ( ! description . rocm_amdgpu_isa_version ( & isa_version ) ) { <nl> Status BaseGPUDeviceFactory : : GetValidDeviceIds ( <nl> < < " \ nname : " < < description . name ( ) < < " \ nAMDGPU ISA : gfx " <nl> < < isa_version < < " \ nmemoryClockRate ( GHz ) " <nl> < < description . clock_rate_ghz ( ) < < " \ npciBusID " <nl> - < < description . pci_bus_id ( ) < < " \ nTotal memory : " <nl> - < < strings : : HumanReadableNumBytes ( total_bytes ) <nl> - < < " \ nFree memory : " <nl> - < < strings : : HumanReadableNumBytes ( free_bytes ) ; <nl> + < < description . pci_bus_id ( ) ; <nl> # endif <nl> } <nl> / / Checking peering and shows matrix if more than one gpu found . <nl>
Avoid printing memory info in GetValidDeviceIds
tensorflow/tensorflow
e32886dd7654d90c36af326c113ef74e5cb13aba
2019-04-23T01:35:55Z
mmm a / LICENSE <nl> ppp b / LICENSE <nl> android / sdk / src / main / java / com / taobao / weex / utils / WXDataStructureUtil . java <nl> * See the License for the specific language governing permissions and <nl> * limitations under the License . <nl> * / <nl> + <nl> + For fpconv <nl> + weex_core / Source / core / parser / dom_parser . cpp <nl> + / * <nl> + * Copyright ( c ) 2013 Andreas Samoljuk <nl> + * <nl> + * Permission is hereby granted , free of charge , to any person obtaining <nl> + * a copy of this software and associated documentation files ( the <nl> + * " Software " ) , to deal in the Software without restriction , including <nl> + * without limitation the rights to use , copy , modify , merge , publish , <nl> + * distribute , sublicense , and / or sell copies of the Software , and to <nl> + * permit persons to whom the Software is furnished to do so , subject to <nl> + * the following conditions : <nl> + * <nl> + * The above copyright notice and this permission notice shall be <nl> + * included in all copies or substantial portions of the Software . <nl> + * <nl> + * THE SOFTWARE IS PROVIDED " AS IS " , WITHOUT WARRANTY OF ANY KIND , <nl> + * EXPRESS OR IMPLIED , INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF <nl> + * MERCHANTABILITY , FITNESS FOR A PARTICULAR PURPOSE AND <nl> + * NONINFRINGEMENT . IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE <nl> + * LIABLE FOR ANY CLAIM , DAMAGES OR OTHER LIABILITY , WHETHER IN AN ACTION <nl> + * OF CONTRACT , TORT OR OTHERWISE , ARISING FROM , OUT OF OR IN CONNECTION <nl> + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE . <nl> + * / <nl> mmm a / POSSIBLE - NOTICES - FOR - BIN - DIST <nl> ppp b / POSSIBLE - NOTICES - FOR - BIN - DIST <nl> by tencent , licensed under the MIT License . <nl> <nl> This product contains software flexbox - layout ( https : / / github . com / google / flexbox - layout ) developed <nl> by google , licensed under the Apache License . <nl> + <nl> + This product contains software fpconv ( https : / / github . com / night - shift / fpconv ) developed <nl> + by night - shift , licensed under the MIT License . <nl>
* [ Core ] Add license for fpconv .
apache/incubator-weex
2347e3a8265d45262a213de0c27df9ad2899cdf8
2018-04-28T06:51:47Z
mmm a / src / builtins / arm / builtins - arm . cc <nl> ppp b / src / builtins / arm / builtins - arm . cc <nl> void Builtins : : Generate_MemCopyUint8Uint8 ( MacroAssembler * masm ) { <nl> __ Ret ( ) ; <nl> } <nl> <nl> + namespace { <nl> + <nl> + / / This code tries to be close to ia32 code so that any changes can be <nl> + / / easily ported . <nl> + void Generate_DeoptimizationEntry ( MacroAssembler * masm , <nl> + DeoptimizeKind deopt_kind ) { <nl> + Isolate * isolate = masm - > isolate ( ) ; <nl> + <nl> + static constexpr int kDoubleRegsSize = <nl> + kDoubleSize * DwVfpRegister : : kNumRegisters ; <nl> + <nl> + / / Save all allocatable VFP registers before messing with them . <nl> + { <nl> + / / We use a run - time check for VFP32DREGS . <nl> + CpuFeatureScope scope ( masm , VFP32DREGS , <nl> + CpuFeatureScope : : kDontCheckSupported ) ; <nl> + UseScratchRegisterScope temps ( masm ) ; <nl> + Register scratch = temps . Acquire ( ) ; <nl> + <nl> + / / Check CPU flags for number of registers , setting the Z condition flag . <nl> + __ CheckFor32DRegs ( scratch ) ; <nl> + <nl> + / / Push registers d0 - d15 , and possibly d16 - d31 , on the stack . <nl> + / / If d16 - d31 are not pushed , decrease the stack pointer instead . <nl> + __ vstm ( db_w , sp , d16 , d31 , ne ) ; <nl> + / / Okay to not call AllocateStackSpace here because the size is a known <nl> + / / small number and we need to use condition codes . <nl> + __ sub ( sp , sp , Operand ( 16 * kDoubleSize ) , LeaveCC , eq ) ; <nl> + __ vstm ( db_w , sp , d0 , d15 ) ; <nl> + } <nl> + <nl> + / / Save all general purpose registers before messing with them . <nl> + static constexpr int kNumberOfRegisters = Register : : kNumRegisters ; <nl> + STATIC_ASSERT ( kNumberOfRegisters = = 16 ) ; <nl> + <nl> + / / Everything but pc , lr and ip which will be saved but not restored . <nl> + RegList restored_regs = kJSCallerSaved | kCalleeSaved | ip . bit ( ) ; <nl> + <nl> + / / Push all 16 registers ( needed to populate FrameDescription : : registers_ ) . <nl> + / / TODO ( v8 : 1588 ) : Note that using pc with stm is deprecated , so we should <nl> + / / perhaps handle this a bit differently . <nl> + __ stm ( db_w , sp , restored_regs | sp . bit ( ) | lr . bit ( ) | pc . bit ( ) ) ; <nl> + <nl> + { <nl> + UseScratchRegisterScope temps ( masm ) ; <nl> + Register scratch = temps . Acquire ( ) ; <nl> + __ Move ( scratch , ExternalReference : : Create ( <nl> + IsolateAddressId : : kCEntryFPAddress , isolate ) ) ; <nl> + __ str ( fp , MemOperand ( scratch ) ) ; <nl> + } <nl> + <nl> + static constexpr int kSavedRegistersAreaSize = <nl> + ( kNumberOfRegisters * kPointerSize ) + kDoubleRegsSize ; <nl> + <nl> + __ mov ( r2 , Operand ( Deoptimizer : : kFixedExitSizeMarker ) ) ; <nl> + / / Get the address of the location in the code object ( r3 ) ( return <nl> + / / address for lazy deoptimization ) and compute the fp - to - sp delta in <nl> + / / register r4 . <nl> + __ mov ( r3 , lr ) ; <nl> + __ add ( r4 , sp , Operand ( kSavedRegistersAreaSize ) ) ; <nl> + __ sub ( r4 , fp , r4 ) ; <nl> + <nl> + / / Allocate a new deoptimizer object . <nl> + / / Pass four arguments in r0 to r3 and fifth argument on stack . <nl> + __ PrepareCallCFunction ( 6 ) ; <nl> + __ mov ( r0 , Operand ( 0 ) ) ; <nl> + Label context_check ; <nl> + __ ldr ( r1 , MemOperand ( fp , CommonFrameConstants : : kContextOrFrameTypeOffset ) ) ; <nl> + __ JumpIfSmi ( r1 , & context_check ) ; <nl> + __ ldr ( r0 , MemOperand ( fp , StandardFrameConstants : : kFunctionOffset ) ) ; <nl> + __ bind ( & context_check ) ; <nl> + __ mov ( r1 , Operand ( static_cast < int > ( deopt_kind ) ) ) ; <nl> + / / r2 : bailout id already loaded . <nl> + / / r3 : code address or 0 already loaded . <nl> + __ str ( r4 , MemOperand ( sp , 0 * kPointerSize ) ) ; / / Fp - to - sp delta . <nl> + __ Move ( r5 , ExternalReference : : isolate_address ( isolate ) ) ; <nl> + __ str ( r5 , MemOperand ( sp , 1 * kPointerSize ) ) ; / / Isolate . <nl> + / / Call Deoptimizer : : New ( ) . <nl> + { <nl> + AllowExternalCallThatCantCauseGC scope ( masm ) ; <nl> + __ CallCFunction ( ExternalReference : : new_deoptimizer_function ( ) , 6 ) ; <nl> + } <nl> + <nl> + / / Preserve " deoptimizer " object in register r0 and get the input <nl> + / / frame descriptor pointer to r1 ( deoptimizer - > input_ ) ; <nl> + __ ldr ( r1 , MemOperand ( r0 , Deoptimizer : : input_offset ( ) ) ) ; <nl> + <nl> + / / Copy core registers into FrameDescription : : registers_ [ kNumRegisters ] . <nl> + DCHECK_EQ ( Register : : kNumRegisters , kNumberOfRegisters ) ; <nl> + for ( int i = 0 ; i < kNumberOfRegisters ; i + + ) { <nl> + int offset = ( i * kPointerSize ) + FrameDescription : : registers_offset ( ) ; <nl> + __ ldr ( r2 , MemOperand ( sp , i * kPointerSize ) ) ; <nl> + __ str ( r2 , MemOperand ( r1 , offset ) ) ; <nl> + } <nl> + <nl> + / / Copy VFP registers to <nl> + / / double_registers_ [ DoubleRegister : : kNumAllocatableRegisters ] <nl> + int double_regs_offset = FrameDescription : : double_registers_offset ( ) ; <nl> + const RegisterConfiguration * config = RegisterConfiguration : : Default ( ) ; <nl> + for ( int i = 0 ; i < config - > num_allocatable_double_registers ( ) ; + + i ) { <nl> + int code = config - > GetAllocatableDoubleCode ( i ) ; <nl> + int dst_offset = code * kDoubleSize + double_regs_offset ; <nl> + int src_offset = code * kDoubleSize + kNumberOfRegisters * kPointerSize ; <nl> + __ vldr ( d0 , sp , src_offset ) ; <nl> + __ vstr ( d0 , r1 , dst_offset ) ; <nl> + } <nl> + <nl> + / / Mark the stack as not iterable for the CPU profiler which won ' t be able to <nl> + / / walk the stack without the return address . <nl> + { <nl> + UseScratchRegisterScope temps ( masm ) ; <nl> + Register is_iterable = temps . Acquire ( ) ; <nl> + Register zero = r4 ; <nl> + __ Move ( is_iterable , ExternalReference : : stack_is_iterable_address ( isolate ) ) ; <nl> + __ mov ( zero , Operand ( 0 ) ) ; <nl> + __ strb ( zero , MemOperand ( is_iterable ) ) ; <nl> + } <nl> + <nl> + / / Remove the saved registers from the stack . <nl> + __ add ( sp , sp , Operand ( kSavedRegistersAreaSize ) ) ; <nl> + <nl> + / / Compute a pointer to the unwinding limit in register r2 ; that is <nl> + / / the first stack slot not part of the input frame . <nl> + __ ldr ( r2 , MemOperand ( r1 , FrameDescription : : frame_size_offset ( ) ) ) ; <nl> + __ add ( r2 , r2 , sp ) ; <nl> + <nl> + / / Unwind the stack down to - but not including - the unwinding <nl> + / / limit and copy the contents of the activation frame to the input <nl> + / / frame description . <nl> + __ add ( r3 , r1 , Operand ( FrameDescription : : frame_content_offset ( ) ) ) ; <nl> + Label pop_loop ; <nl> + Label pop_loop_header ; <nl> + __ b ( & pop_loop_header ) ; <nl> + __ bind ( & pop_loop ) ; <nl> + __ pop ( r4 ) ; <nl> + __ str ( r4 , MemOperand ( r3 , 0 ) ) ; <nl> + __ add ( r3 , r3 , Operand ( sizeof ( uint32_t ) ) ) ; <nl> + __ bind ( & pop_loop_header ) ; <nl> + __ cmp ( r2 , sp ) ; <nl> + __ b ( ne , & pop_loop ) ; <nl> + <nl> + / / Compute the output frame in the deoptimizer . <nl> + __ push ( r0 ) ; / / Preserve deoptimizer object across call . <nl> + / / r0 : deoptimizer object ; r1 : scratch . <nl> + __ PrepareCallCFunction ( 1 ) ; <nl> + / / Call Deoptimizer : : ComputeOutputFrames ( ) . <nl> + { <nl> + AllowExternalCallThatCantCauseGC scope ( masm ) ; <nl> + __ CallCFunction ( ExternalReference : : compute_output_frames_function ( ) , 1 ) ; <nl> + } <nl> + __ pop ( r0 ) ; / / Restore deoptimizer object ( class Deoptimizer ) . <nl> + <nl> + __ ldr ( sp , MemOperand ( r0 , Deoptimizer : : caller_frame_top_offset ( ) ) ) ; <nl> + <nl> + / / Replace the current ( input ) frame with the output frames . <nl> + Label outer_push_loop , inner_push_loop , outer_loop_header , inner_loop_header ; <nl> + / / Outer loop state : r4 = current " FrameDescription * * output_ " , <nl> + / / r1 = one past the last FrameDescription * * . <nl> + __ ldr ( r1 , MemOperand ( r0 , Deoptimizer : : output_count_offset ( ) ) ) ; <nl> + __ ldr ( r4 , MemOperand ( r0 , Deoptimizer : : output_offset ( ) ) ) ; / / r4 is output_ . <nl> + __ add ( r1 , r4 , Operand ( r1 , LSL , 2 ) ) ; <nl> + __ jmp ( & outer_loop_header ) ; <nl> + __ bind ( & outer_push_loop ) ; <nl> + / / Inner loop state : r2 = current FrameDescription * , r3 = loop index . <nl> + __ ldr ( r2 , MemOperand ( r4 , 0 ) ) ; / / output_ [ ix ] <nl> + __ ldr ( r3 , MemOperand ( r2 , FrameDescription : : frame_size_offset ( ) ) ) ; <nl> + __ jmp ( & inner_loop_header ) ; <nl> + __ bind ( & inner_push_loop ) ; <nl> + __ sub ( r3 , r3 , Operand ( sizeof ( uint32_t ) ) ) ; <nl> + __ add ( r6 , r2 , Operand ( r3 ) ) ; <nl> + __ ldr ( r6 , MemOperand ( r6 , FrameDescription : : frame_content_offset ( ) ) ) ; <nl> + __ push ( r6 ) ; <nl> + __ bind ( & inner_loop_header ) ; <nl> + __ cmp ( r3 , Operand : : Zero ( ) ) ; <nl> + __ b ( ne , & inner_push_loop ) ; / / test for gt ? <nl> + __ add ( r4 , r4 , Operand ( kPointerSize ) ) ; <nl> + __ bind ( & outer_loop_header ) ; <nl> + __ cmp ( r4 , r1 ) ; <nl> + __ b ( lt , & outer_push_loop ) ; <nl> + <nl> + __ ldr ( r1 , MemOperand ( r0 , Deoptimizer : : input_offset ( ) ) ) ; <nl> + for ( int i = 0 ; i < config - > num_allocatable_double_registers ( ) ; + + i ) { <nl> + int code = config - > GetAllocatableDoubleCode ( i ) ; <nl> + DwVfpRegister reg = DwVfpRegister : : from_code ( code ) ; <nl> + int src_offset = code * kDoubleSize + double_regs_offset ; <nl> + __ vldr ( reg , r1 , src_offset ) ; <nl> + } <nl> + <nl> + / / Push pc and continuation from the last output frame . <nl> + __ ldr ( r6 , MemOperand ( r2 , FrameDescription : : pc_offset ( ) ) ) ; <nl> + __ push ( r6 ) ; <nl> + __ ldr ( r6 , MemOperand ( r2 , FrameDescription : : continuation_offset ( ) ) ) ; <nl> + __ push ( r6 ) ; <nl> + <nl> + / / Push the registers from the last output frame . <nl> + for ( int i = kNumberOfRegisters - 1 ; i > = 0 ; i - - ) { <nl> + int offset = ( i * kPointerSize ) + FrameDescription : : registers_offset ( ) ; <nl> + __ ldr ( r6 , MemOperand ( r2 , offset ) ) ; <nl> + __ push ( r6 ) ; <nl> + } <nl> + <nl> + / / Restore the registers from the stack . <nl> + __ ldm ( ia_w , sp , restored_regs ) ; / / all but pc registers . <nl> + <nl> + { <nl> + UseScratchRegisterScope temps ( masm ) ; <nl> + Register is_iterable = temps . Acquire ( ) ; <nl> + Register one = r4 ; <nl> + __ Move ( is_iterable , ExternalReference : : stack_is_iterable_address ( isolate ) ) ; <nl> + __ mov ( one , Operand ( 1 ) ) ; <nl> + __ strb ( one , MemOperand ( is_iterable ) ) ; <nl> + } <nl> + <nl> + / / Remove sp , lr and pc . <nl> + __ Drop ( 3 ) ; <nl> + { <nl> + UseScratchRegisterScope temps ( masm ) ; <nl> + Register scratch = temps . Acquire ( ) ; <nl> + __ pop ( scratch ) ; / / get continuation , leave pc on stack <nl> + __ pop ( lr ) ; <nl> + __ Jump ( scratch ) ; <nl> + } <nl> + <nl> + __ stop ( ) ; <nl> + } <nl> + <nl> + } / / namespace <nl> + <nl> + void Builtins : : Generate_DeoptimizationEntry_Eager ( MacroAssembler * masm ) { <nl> + Generate_DeoptimizationEntry ( masm , DeoptimizeKind : : kEager ) ; <nl> + } <nl> + <nl> + void Builtins : : Generate_DeoptimizationEntry_Soft ( MacroAssembler * masm ) { <nl> + Generate_DeoptimizationEntry ( masm , DeoptimizeKind : : kSoft ) ; <nl> + } <nl> + <nl> + void Builtins : : Generate_DeoptimizationEntry_Bailout ( MacroAssembler * masm ) { <nl> + Generate_DeoptimizationEntry ( masm , DeoptimizeKind : : kBailout ) ; <nl> + } <nl> + <nl> + void Builtins : : Generate_DeoptimizationEntry_Lazy ( MacroAssembler * masm ) { <nl> + Generate_DeoptimizationEntry ( masm , DeoptimizeKind : : kLazy ) ; <nl> + } <nl> + <nl> # undef __ <nl> <nl> } / / namespace internal <nl> mmm a / src / builtins / arm64 / builtins - arm64 . cc <nl> ppp b / src / builtins / arm64 / builtins - arm64 . cc <nl> void Builtins : : Generate_DirectCEntry ( MacroAssembler * masm ) { <nl> __ Ret ( ) ; <nl> } <nl> <nl> + namespace { <nl> + <nl> + void CopyRegListToFrame ( MacroAssembler * masm , const Register & dst , <nl> + int dst_offset , const CPURegList & reg_list , <nl> + const Register & temp0 , const Register & temp1 , <nl> + int src_offset = 0 ) { <nl> + DCHECK_EQ ( reg_list . Count ( ) % 2 , 0 ) ; <nl> + UseScratchRegisterScope temps ( masm ) ; <nl> + CPURegList copy_to_input = reg_list ; <nl> + int reg_size = reg_list . RegisterSizeInBytes ( ) ; <nl> + DCHECK_EQ ( temp0 . SizeInBytes ( ) , reg_size ) ; <nl> + DCHECK_EQ ( temp1 . SizeInBytes ( ) , reg_size ) ; <nl> + <nl> + / / Compute some temporary addresses to avoid having the macro assembler set <nl> + / / up a temp with an offset for accesses out of the range of the addressing <nl> + / / mode . <nl> + Register src = temps . AcquireX ( ) ; <nl> + masm - > Add ( src , sp , src_offset ) ; <nl> + masm - > Add ( dst , dst , dst_offset ) ; <nl> + <nl> + / / Write reg_list into the frame pointed to by dst . <nl> + for ( int i = 0 ; i < reg_list . Count ( ) ; i + = 2 ) { <nl> + masm - > Ldp ( temp0 , temp1 , MemOperand ( src , i * reg_size ) ) ; <nl> + <nl> + CPURegister reg0 = copy_to_input . PopLowestIndex ( ) ; <nl> + CPURegister reg1 = copy_to_input . PopLowestIndex ( ) ; <nl> + int offset0 = reg0 . code ( ) * reg_size ; <nl> + int offset1 = reg1 . code ( ) * reg_size ; <nl> + <nl> + / / Pair up adjacent stores , otherwise write them separately . <nl> + if ( offset1 = = offset0 + reg_size ) { <nl> + masm - > Stp ( temp0 , temp1 , MemOperand ( dst , offset0 ) ) ; <nl> + } else { <nl> + masm - > Str ( temp0 , MemOperand ( dst , offset0 ) ) ; <nl> + masm - > Str ( temp1 , MemOperand ( dst , offset1 ) ) ; <nl> + } <nl> + } <nl> + masm - > Sub ( dst , dst , dst_offset ) ; <nl> + } <nl> + <nl> + void RestoreRegList ( MacroAssembler * masm , const CPURegList & reg_list , <nl> + const Register & src_base , int src_offset ) { <nl> + DCHECK_EQ ( reg_list . Count ( ) % 2 , 0 ) ; <nl> + UseScratchRegisterScope temps ( masm ) ; <nl> + CPURegList restore_list = reg_list ; <nl> + int reg_size = restore_list . RegisterSizeInBytes ( ) ; <nl> + <nl> + / / Compute a temporary addresses to avoid having the macro assembler set <nl> + / / up a temp with an offset for accesses out of the range of the addressing <nl> + / / mode . <nl> + Register src = temps . AcquireX ( ) ; <nl> + masm - > Add ( src , src_base , src_offset ) ; <nl> + <nl> + / / No need to restore padreg . <nl> + restore_list . Remove ( padreg ) ; <nl> + <nl> + / / Restore every register in restore_list from src . <nl> + while ( ! restore_list . IsEmpty ( ) ) { <nl> + CPURegister reg0 = restore_list . PopLowestIndex ( ) ; <nl> + CPURegister reg1 = restore_list . PopLowestIndex ( ) ; <nl> + int offset0 = reg0 . code ( ) * reg_size ; <nl> + <nl> + if ( reg1 = = NoCPUReg ) { <nl> + masm - > Ldr ( reg0 , MemOperand ( src , offset0 ) ) ; <nl> + break ; <nl> + } <nl> + <nl> + int offset1 = reg1 . code ( ) * reg_size ; <nl> + <nl> + / / Pair up adjacent loads , otherwise read them separately . <nl> + if ( offset1 = = offset0 + reg_size ) { <nl> + masm - > Ldp ( reg0 , reg1 , MemOperand ( src , offset0 ) ) ; <nl> + } else { <nl> + masm - > Ldr ( reg0 , MemOperand ( src , offset0 ) ) ; <nl> + masm - > Ldr ( reg1 , MemOperand ( src , offset1 ) ) ; <nl> + } <nl> + } <nl> + } <nl> + <nl> + void Generate_DeoptimizationEntry ( MacroAssembler * masm , <nl> + DeoptimizeKind deopt_kind ) { <nl> + Isolate * isolate = masm - > isolate ( ) ; <nl> + <nl> + / / TODO ( all ) : This code needs to be revisited . We probably only need to save <nl> + / / caller - saved registers here . Callee - saved registers can be stored directly <nl> + / / in the input frame . <nl> + <nl> + / / Save all allocatable double registers . <nl> + CPURegList saved_double_registers ( <nl> + CPURegister : : kVRegister , kDRegSizeInBits , <nl> + RegisterConfiguration : : Default ( ) - > allocatable_double_codes_mask ( ) ) ; <nl> + DCHECK_EQ ( saved_double_registers . Count ( ) % 2 , 0 ) ; <nl> + __ PushCPURegList ( saved_double_registers ) ; <nl> + <nl> + / / We save all the registers except sp , lr , platform register ( x18 ) and the <nl> + / / masm scratches . <nl> + CPURegList saved_registers ( CPURegister : : kRegister , kXRegSizeInBits , 0 , 28 ) ; <nl> + saved_registers . Remove ( ip0 ) ; <nl> + saved_registers . Remove ( ip1 ) ; <nl> + saved_registers . Remove ( x18 ) ; <nl> + saved_registers . Combine ( fp ) ; <nl> + saved_registers . Align ( ) ; <nl> + DCHECK_EQ ( saved_registers . Count ( ) % 2 , 0 ) ; <nl> + __ PushCPURegList ( saved_registers ) ; <nl> + <nl> + __ Mov ( x3 , Operand ( ExternalReference : : Create ( <nl> + IsolateAddressId : : kCEntryFPAddress , isolate ) ) ) ; <nl> + __ Str ( fp , MemOperand ( x3 ) ) ; <nl> + <nl> + const int kSavedRegistersAreaSize = <nl> + ( saved_registers . Count ( ) * kXRegSize ) + <nl> + ( saved_double_registers . Count ( ) * kDRegSize ) ; <nl> + <nl> + / / Floating point registers are saved on the stack above core registers . <nl> + const int kDoubleRegistersOffset = saved_registers . Count ( ) * kXRegSize ; <nl> + <nl> + Register bailout_id = x2 ; <nl> + Register code_object = x3 ; <nl> + Register fp_to_sp = x4 ; <nl> + __ Mov ( bailout_id , Deoptimizer : : kFixedExitSizeMarker ) ; <nl> + / / Get the address of the location in the code object . This is the return <nl> + / / address for lazy deoptimization . <nl> + __ Mov ( code_object , lr ) ; <nl> + / / Compute the fp - to - sp delta . <nl> + __ Add ( fp_to_sp , sp , kSavedRegistersAreaSize ) ; <nl> + __ Sub ( fp_to_sp , fp , fp_to_sp ) ; <nl> + <nl> + / / Allocate a new deoptimizer object . <nl> + __ Ldr ( x1 , MemOperand ( fp , CommonFrameConstants : : kContextOrFrameTypeOffset ) ) ; <nl> + <nl> + / / Ensure we can safely load from below fp . <nl> + DCHECK_GT ( kSavedRegistersAreaSize , - StandardFrameConstants : : kFunctionOffset ) ; <nl> + __ Ldr ( x0 , MemOperand ( fp , StandardFrameConstants : : kFunctionOffset ) ) ; <nl> + <nl> + / / If x1 is a smi , zero x0 . <nl> + __ Tst ( x1 , kSmiTagMask ) ; <nl> + __ CzeroX ( x0 , eq ) ; <nl> + <nl> + __ Mov ( x1 , static_cast < int > ( deopt_kind ) ) ; <nl> + / / Following arguments are already loaded : <nl> + / / - x2 : bailout id <nl> + / / - x3 : code object address <nl> + / / - x4 : fp - to - sp delta <nl> + __ Mov ( x5 , ExternalReference : : isolate_address ( isolate ) ) ; <nl> + <nl> + { <nl> + / / Call Deoptimizer : : New ( ) . <nl> + AllowExternalCallThatCantCauseGC scope ( masm ) ; <nl> + __ CallCFunction ( ExternalReference : : new_deoptimizer_function ( ) , 6 ) ; <nl> + } <nl> + <nl> + / / Preserve " deoptimizer " object in register x0 . <nl> + Register deoptimizer = x0 ; <nl> + <nl> + / / Get the input frame descriptor pointer . <nl> + __ Ldr ( x1 , MemOperand ( deoptimizer , Deoptimizer : : input_offset ( ) ) ) ; <nl> + <nl> + / / Copy core registers into the input frame . <nl> + CopyRegListToFrame ( masm , x1 , FrameDescription : : registers_offset ( ) , <nl> + saved_registers , x2 , x3 ) ; <nl> + <nl> + / / Copy double registers to the input frame . <nl> + CopyRegListToFrame ( masm , x1 , FrameDescription : : double_registers_offset ( ) , <nl> + saved_double_registers , x2 , x3 , kDoubleRegistersOffset ) ; <nl> + <nl> + / / Mark the stack as not iterable for the CPU profiler which won ' t be able to <nl> + / / walk the stack without the return address . <nl> + { <nl> + UseScratchRegisterScope temps ( masm ) ; <nl> + Register is_iterable = temps . AcquireX ( ) ; <nl> + __ Mov ( is_iterable , ExternalReference : : stack_is_iterable_address ( isolate ) ) ; <nl> + __ strb ( xzr , MemOperand ( is_iterable ) ) ; <nl> + } <nl> + <nl> + / / Remove the saved registers from the stack . <nl> + DCHECK_EQ ( kSavedRegistersAreaSize % kXRegSize , 0 ) ; <nl> + __ Drop ( kSavedRegistersAreaSize / kXRegSize ) ; <nl> + <nl> + / / Compute a pointer to the unwinding limit in register x2 ; that is <nl> + / / the first stack slot not part of the input frame . <nl> + Register unwind_limit = x2 ; <nl> + __ Ldr ( unwind_limit , MemOperand ( x1 , FrameDescription : : frame_size_offset ( ) ) ) ; <nl> + <nl> + / / Unwind the stack down to - but not including - the unwinding <nl> + / / limit and copy the contents of the activation frame to the input <nl> + / / frame description . <nl> + __ Add ( x3 , x1 , FrameDescription : : frame_content_offset ( ) ) ; <nl> + __ SlotAddress ( x1 , 0 ) ; <nl> + __ Lsr ( unwind_limit , unwind_limit , kSystemPointerSizeLog2 ) ; <nl> + __ Mov ( x5 , unwind_limit ) ; <nl> + __ CopyDoubleWords ( x3 , x1 , x5 ) ; <nl> + __ Drop ( unwind_limit ) ; <nl> + <nl> + / / Compute the output frame in the deoptimizer . <nl> + __ Push ( padreg , x0 ) ; / / Preserve deoptimizer object across call . <nl> + { <nl> + / / Call Deoptimizer : : ComputeOutputFrames ( ) . <nl> + AllowExternalCallThatCantCauseGC scope ( masm ) ; <nl> + __ CallCFunction ( ExternalReference : : compute_output_frames_function ( ) , 1 ) ; <nl> + } <nl> + __ Pop ( x4 , padreg ) ; / / Restore deoptimizer object ( class Deoptimizer ) . <nl> + <nl> + { <nl> + UseScratchRegisterScope temps ( masm ) ; <nl> + Register scratch = temps . AcquireX ( ) ; <nl> + __ Ldr ( scratch , MemOperand ( x4 , Deoptimizer : : caller_frame_top_offset ( ) ) ) ; <nl> + __ Mov ( sp , scratch ) ; <nl> + } <nl> + <nl> + / / Replace the current ( input ) frame with the output frames . <nl> + Label outer_push_loop , outer_loop_header ; <nl> + __ Ldrsw ( x1 , MemOperand ( x4 , Deoptimizer : : output_count_offset ( ) ) ) ; <nl> + __ Ldr ( x0 , MemOperand ( x4 , Deoptimizer : : output_offset ( ) ) ) ; <nl> + __ Add ( x1 , x0 , Operand ( x1 , LSL , kSystemPointerSizeLog2 ) ) ; <nl> + __ B ( & outer_loop_header ) ; <nl> + <nl> + __ Bind ( & outer_push_loop ) ; <nl> + Register current_frame = x2 ; <nl> + Register frame_size = x3 ; <nl> + __ Ldr ( current_frame , MemOperand ( x0 , kSystemPointerSize , PostIndex ) ) ; <nl> + __ Ldr ( x3 , MemOperand ( current_frame , FrameDescription : : frame_size_offset ( ) ) ) ; <nl> + __ Lsr ( frame_size , x3 , kSystemPointerSizeLog2 ) ; <nl> + __ Claim ( frame_size ) ; <nl> + <nl> + __ Add ( x7 , current_frame , FrameDescription : : frame_content_offset ( ) ) ; <nl> + __ SlotAddress ( x6 , 0 ) ; <nl> + __ CopyDoubleWords ( x6 , x7 , frame_size ) ; <nl> + <nl> + __ Bind ( & outer_loop_header ) ; <nl> + __ Cmp ( x0 , x1 ) ; <nl> + __ B ( lt , & outer_push_loop ) ; <nl> + <nl> + __ Ldr ( x1 , MemOperand ( x4 , Deoptimizer : : input_offset ( ) ) ) ; <nl> + RestoreRegList ( masm , saved_double_registers , x1 , <nl> + FrameDescription : : double_registers_offset ( ) ) ; <nl> + <nl> + { <nl> + UseScratchRegisterScope temps ( masm ) ; <nl> + Register is_iterable = temps . AcquireX ( ) ; <nl> + Register one = x4 ; <nl> + __ Mov ( is_iterable , ExternalReference : : stack_is_iterable_address ( isolate ) ) ; <nl> + __ Mov ( one , Operand ( 1 ) ) ; <nl> + __ strb ( one , MemOperand ( is_iterable ) ) ; <nl> + } <nl> + <nl> + / / TODO ( all ) : ARM copies a lot ( if not all ) of the last output frame onto the <nl> + / / stack , then pops it all into registers . Here , we try to load it directly <nl> + / / into the relevant registers . Is this correct ? If so , we should improve the <nl> + / / ARM code . <nl> + <nl> + / / Restore registers from the last output frame . <nl> + / / Note that lr is not in the list of saved_registers and will be restored <nl> + / / later . We can use it to hold the address of last output frame while <nl> + / / reloading the other registers . <nl> + DCHECK ( ! saved_registers . IncludesAliasOf ( lr ) ) ; <nl> + Register last_output_frame = lr ; <nl> + __ Mov ( last_output_frame , current_frame ) ; <nl> + <nl> + RestoreRegList ( masm , saved_registers , last_output_frame , <nl> + FrameDescription : : registers_offset ( ) ) ; <nl> + <nl> + UseScratchRegisterScope temps ( masm ) ; <nl> + temps . Exclude ( x17 ) ; <nl> + Register continuation = x17 ; <nl> + __ Ldr ( continuation , MemOperand ( last_output_frame , <nl> + FrameDescription : : continuation_offset ( ) ) ) ; <nl> + __ Ldr ( lr , MemOperand ( last_output_frame , FrameDescription : : pc_offset ( ) ) ) ; <nl> + # ifdef V8_ENABLE_CONTROL_FLOW_INTEGRITY <nl> + __ Autibsp ( ) ; <nl> + # endif <nl> + __ Br ( continuation ) ; <nl> + } <nl> + <nl> + } / / namespace <nl> + <nl> + void Builtins : : Generate_DeoptimizationEntry_Eager ( MacroAssembler * masm ) { <nl> + Generate_DeoptimizationEntry ( masm , DeoptimizeKind : : kEager ) ; <nl> + } <nl> + <nl> + void Builtins : : Generate_DeoptimizationEntry_Soft ( MacroAssembler * masm ) { <nl> + Generate_DeoptimizationEntry ( masm , DeoptimizeKind : : kSoft ) ; <nl> + } <nl> + <nl> + void Builtins : : Generate_DeoptimizationEntry_Bailout ( MacroAssembler * masm ) { <nl> + Generate_DeoptimizationEntry ( masm , DeoptimizeKind : : kBailout ) ; <nl> + } <nl> + <nl> + void Builtins : : Generate_DeoptimizationEntry_Lazy ( MacroAssembler * masm ) { <nl> + Generate_DeoptimizationEntry ( masm , DeoptimizeKind : : kLazy ) ; <nl> + } <nl> + <nl> # undef __ <nl> <nl> } / / namespace internal <nl> mmm a / src / builtins / builtins - definitions . h <nl> ppp b / src / builtins / builtins - definitions . h <nl> namespace internal { <nl> TFC ( CompileLazyDeoptimizedCode , JSTrampoline ) \ <nl> TFC ( InstantiateAsmJs , JSTrampoline ) \ <nl> ASM ( NotifyDeoptimized , Dummy ) \ <nl> + ASM ( DeoptimizationEntry_Eager , DeoptimizationEntry ) \ <nl> + ASM ( DeoptimizationEntry_Soft , DeoptimizationEntry ) \ <nl> + ASM ( DeoptimizationEntry_Bailout , DeoptimizationEntry ) \ <nl> + ASM ( DeoptimizationEntry_Lazy , DeoptimizationEntry ) \ <nl> \ <nl> / * Trampolines called when returning from a deoptimization that expects * / \ <nl> / * to continue in a JavaScript builtin to finish the functionality of a * / \ <nl> mmm a / src / builtins / ia32 / builtins - ia32 . cc <nl> ppp b / src / builtins / ia32 / builtins - ia32 . cc <nl> void Builtins : : Generate_MemMove ( MacroAssembler * masm ) { <nl> MemMoveEmitPopAndReturn ( masm ) ; <nl> } <nl> <nl> + namespace { <nl> + <nl> + void Generate_DeoptimizationEntry ( MacroAssembler * masm , <nl> + DeoptimizeKind deopt_kind ) { <nl> + Isolate * isolate = masm - > isolate ( ) ; <nl> + <nl> + / / Save all general purpose registers before messing with them . <nl> + const int kNumberOfRegisters = Register : : kNumRegisters ; <nl> + <nl> + const int kDoubleRegsSize = kDoubleSize * XMMRegister : : kNumRegisters ; <nl> + __ AllocateStackSpace ( kDoubleRegsSize ) ; <nl> + const RegisterConfiguration * config = RegisterConfiguration : : Default ( ) ; <nl> + for ( int i = 0 ; i < config - > num_allocatable_double_registers ( ) ; + + i ) { <nl> + int code = config - > GetAllocatableDoubleCode ( i ) ; <nl> + XMMRegister xmm_reg = XMMRegister : : from_code ( code ) ; <nl> + int offset = code * kDoubleSize ; <nl> + __ movsd ( Operand ( esp , offset ) , xmm_reg ) ; <nl> + } <nl> + <nl> + __ pushad ( ) ; <nl> + <nl> + ExternalReference c_entry_fp_address = <nl> + ExternalReference : : Create ( IsolateAddressId : : kCEntryFPAddress , isolate ) ; <nl> + __ mov ( masm - > ExternalReferenceAsOperand ( c_entry_fp_address , esi ) , ebp ) ; <nl> + <nl> + const int kSavedRegistersAreaSize = <nl> + kNumberOfRegisters * kSystemPointerSize + kDoubleRegsSize ; <nl> + <nl> + / / Get the address of the location in the code object <nl> + / / and compute the fp - to - sp delta in register edx . <nl> + __ mov ( ecx , Operand ( esp , kSavedRegistersAreaSize ) ) ; <nl> + __ lea ( edx , Operand ( esp , kSavedRegistersAreaSize + 1 * kSystemPointerSize ) ) ; <nl> + <nl> + __ sub ( edx , ebp ) ; <nl> + __ neg ( edx ) ; <nl> + <nl> + / / Allocate a new deoptimizer object . <nl> + __ PrepareCallCFunction ( 6 , eax ) ; <nl> + __ mov ( eax , Immediate ( 0 ) ) ; <nl> + Label context_check ; <nl> + __ mov ( edi , Operand ( ebp , CommonFrameConstants : : kContextOrFrameTypeOffset ) ) ; <nl> + __ JumpIfSmi ( edi , & context_check ) ; <nl> + __ mov ( eax , Operand ( ebp , StandardFrameConstants : : kFunctionOffset ) ) ; <nl> + __ bind ( & context_check ) ; <nl> + __ mov ( Operand ( esp , 0 * kSystemPointerSize ) , eax ) ; / / Function . <nl> + __ mov ( Operand ( esp , 1 * kSystemPointerSize ) , <nl> + Immediate ( static_cast < int > ( deopt_kind ) ) ) ; <nl> + __ mov ( Operand ( esp , 2 * kSystemPointerSize ) , <nl> + Immediate ( Deoptimizer : : kFixedExitSizeMarker ) ) ; / / Bailout id . <nl> + __ mov ( Operand ( esp , 3 * kSystemPointerSize ) , ecx ) ; / / Code address or 0 . <nl> + __ mov ( Operand ( esp , 4 * kSystemPointerSize ) , edx ) ; / / Fp - to - sp delta . <nl> + __ Move ( Operand ( esp , 5 * kSystemPointerSize ) , <nl> + Immediate ( ExternalReference : : isolate_address ( masm - > isolate ( ) ) ) ) ; <nl> + { <nl> + AllowExternalCallThatCantCauseGC scope ( masm ) ; <nl> + __ CallCFunction ( ExternalReference : : new_deoptimizer_function ( ) , 6 ) ; <nl> + } <nl> + <nl> + / / Preserve deoptimizer object in register eax and get the input <nl> + / / frame descriptor pointer . <nl> + __ mov ( esi , Operand ( eax , Deoptimizer : : input_offset ( ) ) ) ; <nl> + <nl> + / / Fill in the input registers . <nl> + for ( int i = kNumberOfRegisters - 1 ; i > = 0 ; i - - ) { <nl> + int offset = <nl> + ( i * kSystemPointerSize ) + FrameDescription : : registers_offset ( ) ; <nl> + __ pop ( Operand ( esi , offset ) ) ; <nl> + } <nl> + <nl> + int double_regs_offset = FrameDescription : : double_registers_offset ( ) ; <nl> + / / Fill in the double input registers . <nl> + for ( int i = 0 ; i < config - > num_allocatable_double_registers ( ) ; + + i ) { <nl> + int code = config - > GetAllocatableDoubleCode ( i ) ; <nl> + int dst_offset = code * kDoubleSize + double_regs_offset ; <nl> + int src_offset = code * kDoubleSize ; <nl> + __ movsd ( xmm0 , Operand ( esp , src_offset ) ) ; <nl> + __ movsd ( Operand ( esi , dst_offset ) , xmm0 ) ; <nl> + } <nl> + <nl> + / / Clear FPU all exceptions . <nl> + / / TODO ( ulan ) : Find out why the TOP register is not zero here in some cases , <nl> + / / and check that the generated code never deoptimizes with unbalanced stack . <nl> + __ fnclex ( ) ; <nl> + <nl> + / / Mark the stack as not iterable for the CPU profiler which won ' t be able to <nl> + / / walk the stack without the return address . <nl> + __ mov_b ( __ ExternalReferenceAsOperand ( <nl> + ExternalReference : : stack_is_iterable_address ( isolate ) , edx ) , <nl> + Immediate ( 0 ) ) ; <nl> + <nl> + / / Remove the return address and the double registers . <nl> + __ add ( esp , Immediate ( kDoubleRegsSize + 1 * kSystemPointerSize ) ) ; <nl> + <nl> + / / Compute a pointer to the unwinding limit in register ecx ; that is <nl> + / / the first stack slot not part of the input frame . <nl> + __ mov ( ecx , Operand ( esi , FrameDescription : : frame_size_offset ( ) ) ) ; <nl> + __ add ( ecx , esp ) ; <nl> + <nl> + / / Unwind the stack down to - but not including - the unwinding <nl> + / / limit and copy the contents of the activation frame to the input <nl> + / / frame description . <nl> + __ lea ( edx , Operand ( esi , FrameDescription : : frame_content_offset ( ) ) ) ; <nl> + Label pop_loop_header ; <nl> + __ jmp ( & pop_loop_header ) ; <nl> + Label pop_loop ; <nl> + __ bind ( & pop_loop ) ; <nl> + __ pop ( Operand ( edx , 0 ) ) ; <nl> + __ add ( edx , Immediate ( sizeof ( uint32_t ) ) ) ; <nl> + __ bind ( & pop_loop_header ) ; <nl> + __ cmp ( ecx , esp ) ; <nl> + __ j ( not_equal , & pop_loop ) ; <nl> + <nl> + / / Compute the output frame in the deoptimizer . <nl> + __ push ( eax ) ; <nl> + __ PrepareCallCFunction ( 1 , esi ) ; <nl> + __ mov ( Operand ( esp , 0 * kSystemPointerSize ) , eax ) ; <nl> + { <nl> + AllowExternalCallThatCantCauseGC scope ( masm ) ; <nl> + __ CallCFunction ( ExternalReference : : compute_output_frames_function ( ) , 1 ) ; <nl> + } <nl> + __ pop ( eax ) ; <nl> + <nl> + __ mov ( esp , Operand ( eax , Deoptimizer : : caller_frame_top_offset ( ) ) ) ; <nl> + <nl> + / / Replace the current ( input ) frame with the output frames . <nl> + Label outer_push_loop , inner_push_loop , outer_loop_header , inner_loop_header ; <nl> + / / Outer loop state : eax = current FrameDescription * * , edx = one <nl> + / / past the last FrameDescription * * . <nl> + __ mov ( edx , Operand ( eax , Deoptimizer : : output_count_offset ( ) ) ) ; <nl> + __ mov ( eax , Operand ( eax , Deoptimizer : : output_offset ( ) ) ) ; <nl> + __ lea ( edx , Operand ( eax , edx , times_system_pointer_size , 0 ) ) ; <nl> + __ jmp ( & outer_loop_header ) ; <nl> + __ bind ( & outer_push_loop ) ; <nl> + / / Inner loop state : esi = current FrameDescription * , ecx = loop <nl> + / / index . <nl> + __ mov ( esi , Operand ( eax , 0 ) ) ; <nl> + __ mov ( ecx , Operand ( esi , FrameDescription : : frame_size_offset ( ) ) ) ; <nl> + __ jmp ( & inner_loop_header ) ; <nl> + __ bind ( & inner_push_loop ) ; <nl> + __ sub ( ecx , Immediate ( sizeof ( uint32_t ) ) ) ; <nl> + __ push ( Operand ( esi , ecx , times_1 , FrameDescription : : frame_content_offset ( ) ) ) ; <nl> + __ bind ( & inner_loop_header ) ; <nl> + __ test ( ecx , ecx ) ; <nl> + __ j ( not_zero , & inner_push_loop ) ; <nl> + __ add ( eax , Immediate ( kSystemPointerSize ) ) ; <nl> + __ bind ( & outer_loop_header ) ; <nl> + __ cmp ( eax , edx ) ; <nl> + __ j ( below , & outer_push_loop ) ; <nl> + <nl> + / / In case of a failed STUB , we have to restore the XMM registers . <nl> + for ( int i = 0 ; i < config - > num_allocatable_double_registers ( ) ; + + i ) { <nl> + int code = config - > GetAllocatableDoubleCode ( i ) ; <nl> + XMMRegister xmm_reg = XMMRegister : : from_code ( code ) ; <nl> + int src_offset = code * kDoubleSize + double_regs_offset ; <nl> + __ movsd ( xmm_reg , Operand ( esi , src_offset ) ) ; <nl> + } <nl> + <nl> + / / Push pc and continuation from the last output frame . <nl> + __ push ( Operand ( esi , FrameDescription : : pc_offset ( ) ) ) ; <nl> + __ push ( Operand ( esi , FrameDescription : : continuation_offset ( ) ) ) ; <nl> + <nl> + / / Push the registers from the last output frame . <nl> + for ( int i = 0 ; i < kNumberOfRegisters ; i + + ) { <nl> + int offset = <nl> + ( i * kSystemPointerSize ) + FrameDescription : : registers_offset ( ) ; <nl> + __ push ( Operand ( esi , offset ) ) ; <nl> + } <nl> + <nl> + __ mov_b ( __ ExternalReferenceAsOperand ( <nl> + ExternalReference : : stack_is_iterable_address ( isolate ) , edx ) , <nl> + Immediate ( 1 ) ) ; <nl> + <nl> + / / Restore the registers from the stack . <nl> + __ popad ( ) ; <nl> + <nl> + __ InitializeRootRegister ( ) ; <nl> + <nl> + / / Return to the continuation point . <nl> + __ ret ( 0 ) ; <nl> + } <nl> + <nl> + } / / namespace <nl> + <nl> + void Builtins : : Generate_DeoptimizationEntry_Eager ( MacroAssembler * masm ) { <nl> + Generate_DeoptimizationEntry ( masm , DeoptimizeKind : : kEager ) ; <nl> + } <nl> + <nl> + void Builtins : : Generate_DeoptimizationEntry_Soft ( MacroAssembler * masm ) { <nl> + Generate_DeoptimizationEntry ( masm , DeoptimizeKind : : kSoft ) ; <nl> + } <nl> + <nl> + void Builtins : : Generate_DeoptimizationEntry_Bailout ( MacroAssembler * masm ) { <nl> + Generate_DeoptimizationEntry ( masm , DeoptimizeKind : : kBailout ) ; <nl> + } <nl> + <nl> + void Builtins : : Generate_DeoptimizationEntry_Lazy ( MacroAssembler * masm ) { <nl> + Generate_DeoptimizationEntry ( masm , DeoptimizeKind : : kLazy ) ; <nl> + } <nl> + <nl> # undef __ <nl> <nl> } / / namespace internal <nl> mmm a / src / builtins / x64 / builtins - x64 . cc <nl> ppp b / src / builtins / x64 / builtins - x64 . cc <nl> void Builtins : : Generate_DirectCEntry ( MacroAssembler * masm ) { <nl> __ int3 ( ) ; / / Unused on this architecture . <nl> } <nl> <nl> + namespace { <nl> + <nl> + void Generate_DeoptimizationEntry ( MacroAssembler * masm , <nl> + DeoptimizeKind deopt_kind ) { <nl> + Isolate * isolate = masm - > isolate ( ) ; <nl> + <nl> + / / Save all double registers , they will later be copied to the deoptimizer ' s <nl> + / / FrameDescription . <nl> + static constexpr int kDoubleRegsSize = <nl> + kDoubleSize * XMMRegister : : kNumRegisters ; <nl> + __ AllocateStackSpace ( kDoubleRegsSize ) ; <nl> + <nl> + const RegisterConfiguration * config = RegisterConfiguration : : Default ( ) ; <nl> + for ( int i = 0 ; i < config - > num_allocatable_double_registers ( ) ; + + i ) { <nl> + int code = config - > GetAllocatableDoubleCode ( i ) ; <nl> + XMMRegister xmm_reg = XMMRegister : : from_code ( code ) ; <nl> + int offset = code * kDoubleSize ; <nl> + __ Movsd ( Operand ( rsp , offset ) , xmm_reg ) ; <nl> + } <nl> + <nl> + / / Save all general purpose registers , they will later be copied to the <nl> + / / deoptimizer ' s FrameDescription . <nl> + static constexpr int kNumberOfRegisters = Register : : kNumRegisters ; <nl> + for ( int i = 0 ; i < kNumberOfRegisters ; i + + ) { <nl> + __ pushq ( Register : : from_code ( i ) ) ; <nl> + } <nl> + <nl> + static constexpr int kSavedRegistersAreaSize = <nl> + kNumberOfRegisters * kSystemPointerSize + kDoubleRegsSize ; <nl> + static constexpr int kCurrentOffsetToReturnAddress = kSavedRegistersAreaSize ; <nl> + static constexpr int kCurrentOffsetToParentSP = <nl> + kCurrentOffsetToReturnAddress + kPCOnStackSize ; <nl> + <nl> + __ Store ( <nl> + ExternalReference : : Create ( IsolateAddressId : : kCEntryFPAddress , isolate ) , <nl> + rbp ) ; <nl> + <nl> + / / We use this to keep the value of the fifth argument temporarily . <nl> + / / Unfortunately we can ' t store it directly in r8 ( used for passing <nl> + / / this on linux ) , since it is another parameter passing register on windows . <nl> + Register arg5 = r11 ; <nl> + <nl> + __ movq ( arg_reg_3 , Immediate ( Deoptimizer : : kFixedExitSizeMarker ) ) ; <nl> + / / Get the address of the location in the code object <nl> + / / and compute the fp - to - sp delta in register arg5 . <nl> + __ movq ( arg_reg_4 , Operand ( rsp , kCurrentOffsetToReturnAddress ) ) ; <nl> + / / Load the fp - to - sp - delta . <nl> + __ leaq ( arg5 , Operand ( rsp , kCurrentOffsetToParentSP ) ) ; <nl> + __ subq ( arg5 , rbp ) ; <nl> + __ negq ( arg5 ) ; <nl> + <nl> + / / Allocate a new deoptimizer object . <nl> + __ PrepareCallCFunction ( 6 ) ; <nl> + __ movq ( rax , Immediate ( 0 ) ) ; <nl> + Label context_check ; <nl> + __ movq ( rdi , Operand ( rbp , CommonFrameConstants : : kContextOrFrameTypeOffset ) ) ; <nl> + __ JumpIfSmi ( rdi , & context_check ) ; <nl> + __ movq ( rax , Operand ( rbp , StandardFrameConstants : : kFunctionOffset ) ) ; <nl> + __ bind ( & context_check ) ; <nl> + __ movq ( arg_reg_1 , rax ) ; <nl> + __ Set ( arg_reg_2 , static_cast < int > ( deopt_kind ) ) ; <nl> + / / Args 3 and 4 are already in the right registers . <nl> + <nl> + / / On windows put the arguments on the stack ( PrepareCallCFunction <nl> + / / has created space for this ) . On linux pass the arguments in r8 and r9 . <nl> + # ifdef V8_TARGET_OS_WIN <nl> + __ movq ( Operand ( rsp , 4 * kSystemPointerSize ) , arg5 ) ; <nl> + __ LoadAddress ( arg5 , ExternalReference : : isolate_address ( isolate ) ) ; <nl> + __ movq ( Operand ( rsp , 5 * kSystemPointerSize ) , arg5 ) ; <nl> + # else <nl> + __ movq ( r8 , arg5 ) ; <nl> + __ LoadAddress ( r9 , ExternalReference : : isolate_address ( isolate ) ) ; <nl> + # endif <nl> + <nl> + { <nl> + AllowExternalCallThatCantCauseGC scope ( masm ) ; <nl> + __ CallCFunction ( ExternalReference : : new_deoptimizer_function ( ) , 6 ) ; <nl> + } <nl> + / / Preserve deoptimizer object in register rax and get the input <nl> + / / frame descriptor pointer . <nl> + __ movq ( rbx , Operand ( rax , Deoptimizer : : input_offset ( ) ) ) ; <nl> + <nl> + / / Fill in the input registers . <nl> + for ( int i = kNumberOfRegisters - 1 ; i > = 0 ; i - - ) { <nl> + int offset = <nl> + ( i * kSystemPointerSize ) + FrameDescription : : registers_offset ( ) ; <nl> + __ PopQuad ( Operand ( rbx , offset ) ) ; <nl> + } <nl> + <nl> + / / Fill in the double input registers . <nl> + int double_regs_offset = FrameDescription : : double_registers_offset ( ) ; <nl> + for ( int i = 0 ; i < XMMRegister : : kNumRegisters ; i + + ) { <nl> + int dst_offset = i * kDoubleSize + double_regs_offset ; <nl> + __ popq ( Operand ( rbx , dst_offset ) ) ; <nl> + } <nl> + <nl> + / / Mark the stack as not iterable for the CPU profiler which won ' t be able to <nl> + / / walk the stack without the return address . <nl> + __ movb ( __ ExternalReferenceAsOperand ( <nl> + ExternalReference : : stack_is_iterable_address ( isolate ) ) , <nl> + Immediate ( 0 ) ) ; <nl> + <nl> + / / Remove the return address from the stack . <nl> + __ addq ( rsp , Immediate ( kPCOnStackSize ) ) ; <nl> + <nl> + / / Compute a pointer to the unwinding limit in register rcx ; that is <nl> + / / the first stack slot not part of the input frame . <nl> + __ movq ( rcx , Operand ( rbx , FrameDescription : : frame_size_offset ( ) ) ) ; <nl> + __ addq ( rcx , rsp ) ; <nl> + <nl> + / / Unwind the stack down to - but not including - the unwinding <nl> + / / limit and copy the contents of the activation frame to the input <nl> + / / frame description . <nl> + __ leaq ( rdx , Operand ( rbx , FrameDescription : : frame_content_offset ( ) ) ) ; <nl> + Label pop_loop_header ; <nl> + __ jmp ( & pop_loop_header ) ; <nl> + Label pop_loop ; <nl> + __ bind ( & pop_loop ) ; <nl> + __ Pop ( Operand ( rdx , 0 ) ) ; <nl> + __ addq ( rdx , Immediate ( sizeof ( intptr_t ) ) ) ; <nl> + __ bind ( & pop_loop_header ) ; <nl> + __ cmpq ( rcx , rsp ) ; <nl> + __ j ( not_equal , & pop_loop ) ; <nl> + <nl> + / / Compute the output frame in the deoptimizer . <nl> + __ pushq ( rax ) ; <nl> + __ PrepareCallCFunction ( 2 ) ; <nl> + __ movq ( arg_reg_1 , rax ) ; <nl> + __ LoadAddress ( arg_reg_2 , ExternalReference : : isolate_address ( isolate ) ) ; <nl> + { <nl> + AllowExternalCallThatCantCauseGC scope ( masm ) ; <nl> + __ CallCFunction ( ExternalReference : : compute_output_frames_function ( ) , 2 ) ; <nl> + } <nl> + __ popq ( rax ) ; <nl> + <nl> + __ movq ( rsp , Operand ( rax , Deoptimizer : : caller_frame_top_offset ( ) ) ) ; <nl> + <nl> + / / Replace the current ( input ) frame with the output frames . <nl> + Label outer_push_loop , inner_push_loop , outer_loop_header , inner_loop_header ; <nl> + / / Outer loop state : rax = current FrameDescription * * , rdx = one past the <nl> + / / last FrameDescription * * . <nl> + __ movl ( rdx , Operand ( rax , Deoptimizer : : output_count_offset ( ) ) ) ; <nl> + __ movq ( rax , Operand ( rax , Deoptimizer : : output_offset ( ) ) ) ; <nl> + __ leaq ( rdx , Operand ( rax , rdx , times_system_pointer_size , 0 ) ) ; <nl> + __ jmp ( & outer_loop_header ) ; <nl> + __ bind ( & outer_push_loop ) ; <nl> + / / Inner loop state : rbx = current FrameDescription * , rcx = loop index . <nl> + __ movq ( rbx , Operand ( rax , 0 ) ) ; <nl> + __ movq ( rcx , Operand ( rbx , FrameDescription : : frame_size_offset ( ) ) ) ; <nl> + __ jmp ( & inner_loop_header ) ; <nl> + __ bind ( & inner_push_loop ) ; <nl> + __ subq ( rcx , Immediate ( sizeof ( intptr_t ) ) ) ; <nl> + __ Push ( Operand ( rbx , rcx , times_1 , FrameDescription : : frame_content_offset ( ) ) ) ; <nl> + __ bind ( & inner_loop_header ) ; <nl> + __ testq ( rcx , rcx ) ; <nl> + __ j ( not_zero , & inner_push_loop ) ; <nl> + __ addq ( rax , Immediate ( kSystemPointerSize ) ) ; <nl> + __ bind ( & outer_loop_header ) ; <nl> + __ cmpq ( rax , rdx ) ; <nl> + __ j ( below , & outer_push_loop ) ; <nl> + <nl> + for ( int i = 0 ; i < config - > num_allocatable_double_registers ( ) ; + + i ) { <nl> + int code = config - > GetAllocatableDoubleCode ( i ) ; <nl> + XMMRegister xmm_reg = XMMRegister : : from_code ( code ) ; <nl> + int src_offset = code * kDoubleSize + double_regs_offset ; <nl> + __ Movsd ( xmm_reg , Operand ( rbx , src_offset ) ) ; <nl> + } <nl> + <nl> + / / Push pc and continuation from the last output frame . <nl> + __ PushQuad ( Operand ( rbx , FrameDescription : : pc_offset ( ) ) ) ; <nl> + __ PushQuad ( Operand ( rbx , FrameDescription : : continuation_offset ( ) ) ) ; <nl> + <nl> + / / Push the registers from the last output frame . <nl> + for ( int i = 0 ; i < kNumberOfRegisters ; i + + ) { <nl> + int offset = <nl> + ( i * kSystemPointerSize ) + FrameDescription : : registers_offset ( ) ; <nl> + __ PushQuad ( Operand ( rbx , offset ) ) ; <nl> + } <nl> + <nl> + / / Restore the registers from the stack . <nl> + for ( int i = kNumberOfRegisters - 1 ; i > = 0 ; i - - ) { <nl> + Register r = Register : : from_code ( i ) ; <nl> + / / Do not restore rsp , simply pop the value into the next register <nl> + / / and overwrite this afterwards . <nl> + if ( r = = rsp ) { <nl> + DCHECK_GT ( i , 0 ) ; <nl> + r = Register : : from_code ( i - 1 ) ; <nl> + } <nl> + __ popq ( r ) ; <nl> + } <nl> + <nl> + __ movb ( __ ExternalReferenceAsOperand ( <nl> + ExternalReference : : stack_is_iterable_address ( isolate ) ) , <nl> + Immediate ( 1 ) ) ; <nl> + <nl> + / / Return to the continuation point . <nl> + __ ret ( 0 ) ; <nl> + } <nl> + <nl> + } / / namespace <nl> + <nl> + void Builtins : : Generate_DeoptimizationEntry_Eager ( MacroAssembler * masm ) { <nl> + Generate_DeoptimizationEntry ( masm , DeoptimizeKind : : kEager ) ; <nl> + } <nl> + <nl> + void Builtins : : Generate_DeoptimizationEntry_Soft ( MacroAssembler * masm ) { <nl> + Generate_DeoptimizationEntry ( masm , DeoptimizeKind : : kSoft ) ; <nl> + } <nl> + <nl> + void Builtins : : Generate_DeoptimizationEntry_Bailout ( MacroAssembler * masm ) { <nl> + Generate_DeoptimizationEntry ( masm , DeoptimizeKind : : kBailout ) ; <nl> + } <nl> + <nl> + void Builtins : : Generate_DeoptimizationEntry_Lazy ( MacroAssembler * masm ) { <nl> + Generate_DeoptimizationEntry ( masm , DeoptimizeKind : : kLazy ) ; <nl> + } <nl> + <nl> # undef __ <nl> <nl> } / / namespace internal <nl> mmm a / src / codegen / arm / macro - assembler - arm . cc <nl> ppp b / src / codegen / arm / macro - assembler - arm . cc <nl> void TurboAssembler : : Jump ( Handle < Code > code , RelocInfo : : Mode rmode , <nl> / / size s . t . pc - relative calls may be used . <nl> UseScratchRegisterScope temps ( this ) ; <nl> Register scratch = temps . Acquire ( ) ; <nl> - int offset = code - > builtin_index ( ) * kSystemPointerSize + <nl> - IsolateData : : builtin_entry_table_offset ( ) ; <nl> + int offset = IsolateData : : builtin_entry_slot_offset ( <nl> + static_cast < Builtins : : Name > ( code - > builtin_index ( ) ) ) ; <nl> ldr ( scratch , MemOperand ( kRootRegister , offset ) ) ; <nl> Jump ( scratch , cond ) ; <nl> return ; <nl> void TurboAssembler : : Call ( Handle < Code > code , RelocInfo : : Mode rmode , <nl> / / This branch is taken only for specific cctests , where we force isolate <nl> / / creation at runtime . At this point , Code space isn ' t restricted to a <nl> / / size s . t . pc - relative calls may be used . <nl> - int offset = code - > builtin_index ( ) * kSystemPointerSize + <nl> - IsolateData : : builtin_entry_table_offset ( ) ; <nl> + int offset = IsolateData : : builtin_entry_slot_offset ( <nl> + static_cast < Builtins : : Name > ( code - > builtin_index ( ) ) ) ; <nl> ldr ( ip , MemOperand ( kRootRegister , offset ) ) ; <nl> Call ( ip , cond ) ; <nl> return ; <nl> void TurboAssembler : : ResetSpeculationPoisonRegister ( ) { <nl> mov ( kSpeculationPoisonRegister , Operand ( - 1 ) ) ; <nl> } <nl> <nl> - void TurboAssembler : : CallForDeoptimization ( Address target , int deopt_id , <nl> - Label * exit , DeoptimizeKind kind ) { <nl> + void TurboAssembler : : CallForDeoptimization ( Builtins : : Name target , int , <nl> + Label * exit , DeoptimizeKind kind , <nl> + Label * ) { <nl> + BlockConstPoolScope block_const_pool ( this ) ; <nl> + ldr ( ip , MemOperand ( kRootRegister , <nl> + IsolateData : : builtin_entry_slot_offset ( target ) ) ) ; <nl> + Call ( ip ) ; <nl> + DCHECK_EQ ( SizeOfCodeGeneratedSince ( exit ) , <nl> + ( kind = = DeoptimizeKind : : kLazy ) <nl> + ? Deoptimizer : : kLazyDeoptExitSize <nl> + : Deoptimizer : : kNonLazyDeoptExitSize ) ; <nl> USE ( exit , kind ) ; <nl> - NoRootArrayScope no_root_array ( this ) ; <nl> - <nl> - / / Save the deopt id in r10 ( we don ' t need the roots array from now on ) . <nl> - DCHECK_LE ( deopt_id , 0xFFFF ) ; <nl> - if ( CpuFeatures : : IsSupported ( ARMv7 ) ) { <nl> - / / On ARMv7 , we can use movw ( with a maximum immediate of 0xFFFF ) <nl> - movw ( r10 , deopt_id ) ; <nl> - } else { <nl> - / / On ARMv6 , we might need two instructions . <nl> - mov ( r10 , Operand ( deopt_id & 0xFF ) ) ; / / Set the low byte . <nl> - if ( deopt_id > = 0xFF ) { <nl> - orr ( r10 , r10 , Operand ( deopt_id & 0xFF00 ) ) ; / / Set the high byte . <nl> - } <nl> - } <nl> - <nl> - Call ( target , RelocInfo : : RUNTIME_ENTRY ) ; <nl> - CheckConstPool ( false , false ) ; <nl> } <nl> <nl> void TurboAssembler : : Trap ( ) { stop ( ) ; } <nl> mmm a / src / codegen / arm / macro - assembler - arm . h <nl> ppp b / src / codegen / arm / macro - assembler - arm . h <nl> class V8_EXPORT_PRIVATE TurboAssembler : public TurboAssemblerBase { <nl> / / The return address on the stack is used by frame iteration . <nl> void StoreReturnAddressAndCall ( Register target ) ; <nl> <nl> - / / This should only be used when assembling a deoptimizer call because of <nl> - / / the CheckConstPool invocation , which is only needed for deoptimization . <nl> - void CallForDeoptimization ( Address target , int deopt_id , Label * exit , <nl> - DeoptimizeKind kind ) ; <nl> + void CallForDeoptimization ( Builtins : : Name target , int deopt_id , Label * exit , <nl> + DeoptimizeKind kind , <nl> + Label * jump_deoptimization_entry_label ) ; <nl> <nl> / / Emit code to discard a non - negative number of pointer - sized elements <nl> / / from the stack , clobbering only the sp register . <nl> mmm a / src / codegen / arm64 / macro - assembler - arm64 . cc <nl> ppp b / src / codegen / arm64 / macro - assembler - arm64 . cc <nl> void TurboAssembler : : LoadEntryFromBuiltinIndex ( Register builtin_index ) { <nl> } <nl> } <nl> <nl> + void TurboAssembler : : LoadEntryFromBuiltinIndex ( Builtins : : Name builtin_index , <nl> + Register destination ) { <nl> + Ldr ( destination , <nl> + MemOperand ( kRootRegister , <nl> + IsolateData : : builtin_entry_slot_offset ( builtin_index ) ) ) ; <nl> + } <nl> + <nl> void TurboAssembler : : CallBuiltinByIndex ( Register builtin_index ) { <nl> LoadEntryFromBuiltinIndex ( builtin_index ) ; <nl> Call ( builtin_index ) ; <nl> bool TurboAssembler : : IsNearCallOffset ( int64_t offset ) { <nl> return is_int26 ( offset ) ; <nl> } <nl> <nl> - void TurboAssembler : : CallForDeoptimization ( Address target , int deopt_id , <nl> - Label * exit , DeoptimizeKind kind ) { <nl> + void TurboAssembler : : CallForDeoptimization ( <nl> + Builtins : : Name target , int deopt_id , Label * exit , DeoptimizeKind kind , <nl> + Label * jump_deoptimization_entry_label ) { <nl> BlockPoolsScope scope ( this ) ; <nl> - int64_t offset = static_cast < int64_t > ( target ) - <nl> - static_cast < int64_t > ( options ( ) . code_range_start ) ; <nl> - DCHECK_EQ ( offset % kInstrSize , 0 ) ; <nl> - offset = offset / static_cast < int > ( kInstrSize ) ; <nl> - DCHECK ( IsNearCallOffset ( offset ) ) ; <nl> - near_call ( static_cast < int > ( offset ) , RelocInfo : : RUNTIME_ENTRY ) ; <nl> + bl ( jump_deoptimization_entry_label ) ; <nl> DCHECK_EQ ( SizeOfCodeGeneratedSince ( exit ) , <nl> ( kind = = DeoptimizeKind : : kLazy ) <nl> ? Deoptimizer : : kLazyDeoptExitSize <nl> mmm a / src / codegen / arm64 / macro - assembler - arm64 . h <nl> ppp b / src / codegen / arm64 / macro - assembler - arm64 . h <nl> class V8_EXPORT_PRIVATE TurboAssembler : public TurboAssemblerBase { <nl> / / Load the builtin given by the Smi in | builtin_index | into the same <nl> / / register . <nl> void LoadEntryFromBuiltinIndex ( Register builtin_index ) ; <nl> + void LoadEntryFromBuiltinIndex ( Builtins : : Name builtin_index , <nl> + Register destination ) ; <nl> void CallBuiltinByIndex ( Register builtin_index ) override ; <nl> void CallBuiltin ( int builtin_index ) ; <nl> <nl> class V8_EXPORT_PRIVATE TurboAssembler : public TurboAssemblerBase { <nl> / / The return address on the stack is used by frame iteration . <nl> void StoreReturnAddressAndCall ( Register target ) ; <nl> <nl> - void CallForDeoptimization ( Address target , int deopt_id , Label * exit , <nl> - DeoptimizeKind kind ) ; <nl> + void CallForDeoptimization ( Builtins : : Name target , int deopt_id , Label * exit , <nl> + DeoptimizeKind kind , <nl> + Label * jump_deoptimization_entry_label ) ; <nl> <nl> / / Calls a C function . <nl> / / The called function is not allowed to trigger a <nl> mmm a / src / codegen / ia32 / macro - assembler - ia32 . cc <nl> ppp b / src / codegen / ia32 / macro - assembler - ia32 . cc <nl> void TurboAssembler : : ComputeCodeStartAddress ( Register dst ) { <nl> } <nl> } <nl> <nl> - void TurboAssembler : : CallForDeoptimization ( Address target , int deopt_id , <nl> - Label * exit , DeoptimizeKind kind ) { <nl> + void TurboAssembler : : CallForDeoptimization ( Builtins : : Name target , int , <nl> + Label * exit , DeoptimizeKind kind , <nl> + Label * ) { <nl> + CallBuiltin ( target ) ; <nl> + DCHECK_EQ ( SizeOfCodeGeneratedSince ( exit ) , <nl> + ( kind = = DeoptimizeKind : : kLazy ) <nl> + ? Deoptimizer : : kLazyDeoptExitSize <nl> + : Deoptimizer : : kNonLazyDeoptExitSize ) ; <nl> USE ( exit , kind ) ; <nl> - NoRootArrayScope no_root_array ( this ) ; <nl> - / / Save the deopt id in ebx ( we don ' t need the roots array from now on ) . <nl> - mov ( ebx , deopt_id ) ; <nl> - call ( target , RelocInfo : : RUNTIME_ENTRY ) ; <nl> } <nl> <nl> void TurboAssembler : : Trap ( ) { int3 ( ) ; } <nl> mmm a / src / codegen / ia32 / macro - assembler - ia32 . h <nl> ppp b / src / codegen / ia32 / macro - assembler - ia32 . h <nl> class V8_EXPORT_PRIVATE TurboAssembler : public TurboAssemblerBase { <nl> void Trap ( ) override ; <nl> void DebugBreak ( ) override ; <nl> <nl> - void CallForDeoptimization ( Address target , int deopt_id , Label * exit , <nl> - DeoptimizeKind kind ) ; <nl> + void CallForDeoptimization ( Builtins : : Name target , int deopt_id , Label * exit , <nl> + DeoptimizeKind kind , <nl> + Label * jump_deoptimization_entry_label ) ; <nl> <nl> / / Jump the register contains a smi . <nl> inline void JumpIfSmi ( Register value , Label * smi_label , <nl> mmm a / src / codegen / interface - descriptors . h <nl> ppp b / src / codegen / interface - descriptors . h <nl> using DummyDescriptor = VoidDescriptor ; <nl> / / Dummy descriptor that marks builtins with C calling convention . <nl> using CCallDescriptor = VoidDescriptor ; <nl> <nl> + / / Marks deoptimization entry builtins . Precise calling conventions currently <nl> + / / differ based on the platform . <nl> + / / TODO ( jgruber ) : Once this is unified , we could create a better description <nl> + / / here . <nl> + using DeoptimizationEntryDescriptor = VoidDescriptor ; <nl> + <nl> class AllocateDescriptor : public CallInterfaceDescriptor { <nl> public : <nl> DEFINE_PARAMETERS_NO_CONTEXT ( kRequestedSize ) <nl> mmm a / src / codegen / optimized - compilation - info . cc <nl> ppp b / src / codegen / optimized - compilation - info . cc <nl> void OptimizedCompilationInfo : : ConfigureFlags ( ) { <nl> if ( FLAG_turbo_splitting ) set_splitting ( ) ; <nl> break ; <nl> case CodeKind : : BUILTIN : <nl> - case CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING : <nl> + case CodeKind : : FOR_TESTING : <nl> if ( FLAG_turbo_splitting ) set_splitting ( ) ; <nl> # if ENABLE_GDB_JIT_INTERFACE & & DEBUG <nl> set_source_positions ( ) ; <nl> std : : unique_ptr < char [ ] > OptimizedCompilationInfo : : GetDebugName ( ) const { <nl> <nl> StackFrame : : Type OptimizedCompilationInfo : : GetOutputStackFrameType ( ) const { <nl> switch ( code_kind ( ) ) { <nl> - case CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING : <nl> + case CodeKind : : FOR_TESTING : <nl> case CodeKind : : BYTECODE_HANDLER : <nl> case CodeKind : : BUILTIN : <nl> return StackFrame : : STUB ; <nl> mmm a / src / codegen / optimized - compilation - info . h <nl> ppp b / src / codegen / optimized - compilation - info . h <nl> class V8_EXPORT_PRIVATE OptimizedCompilationInfo final { <nl> return code_kind ( ) = = CodeKind : : NATIVE_CONTEXT_INDEPENDENT ; <nl> } <nl> bool IsTurboprop ( ) const { return code_kind ( ) = = CodeKind : : TURBOPROP ; } <nl> - bool IsStub ( ) const { <nl> - return code_kind ( ) = = CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ; <nl> - } <nl> bool IsWasm ( ) const { return code_kind ( ) = = CodeKind : : WASM_FUNCTION ; } <nl> <nl> void SetOptimizingForOsr ( BailoutId osr_offset , JavaScriptFrame * osr_frame ) { <nl> mmm a / src / codegen / reloc - info . cc <nl> ppp b / src / codegen / reloc - info . cc <nl> void RelocInfo : : Print ( Isolate * isolate , std : : ostream & os ) { / / NOLINT <nl> os < < " " < < Builtins : : name ( code . builtin_index ( ) ) ; <nl> } <nl> os < < " ) ( " < < reinterpret_cast < const void * > ( target_address ( ) ) < < " ) " ; <nl> - } else if ( IsRuntimeEntry ( rmode_ ) & & isolate - > deoptimizer_data ( ) ! = nullptr ) { <nl> + } else if ( IsRuntimeEntry ( rmode_ ) ) { <nl> / / Deoptimization bailouts are stored as runtime entries . <nl> DeoptimizeKind type ; <nl> if ( Deoptimizer : : IsDeoptimizationEntry ( isolate , target_address ( ) , & type ) ) { <nl> mmm a / src / codegen / x64 / macro - assembler - x64 . cc <nl> ppp b / src / codegen / x64 / macro - assembler - x64 . cc <nl> void TurboAssembler : : Call ( Handle < Code > code_object , RelocInfo : : Mode rmode ) { <nl> call ( code_object , rmode ) ; <nl> } <nl> <nl> + Operand TurboAssembler : : EntryFromBuiltinIndexAsOperand ( <nl> + Builtins : : Name builtin_index ) { <nl> + DCHECK ( root_array_available ( ) ) ; <nl> + return Operand ( kRootRegister , <nl> + IsolateData : : builtin_entry_slot_offset ( builtin_index ) ) ; <nl> + } <nl> + <nl> Operand TurboAssembler : : EntryFromBuiltinIndexAsOperand ( Register builtin_index ) { <nl> if ( SmiValuesAre32Bits ( ) ) { <nl> / / The builtin_index register contains the builtin index as a Smi . <nl> void TurboAssembler : : ResetSpeculationPoisonRegister ( ) { <nl> Set ( kSpeculationPoisonRegister , - 1 ) ; <nl> } <nl> <nl> - void TurboAssembler : : CallForDeoptimization ( Address target , int deopt_id , <nl> - Label * exit , DeoptimizeKind kind ) { <nl> + void TurboAssembler : : CallForDeoptimization ( Builtins : : Name target , int , <nl> + Label * exit , DeoptimizeKind kind , <nl> + Label * ) { <nl> + / / Note : Assembler : : call is used here on purpose to guarantee fixed - size <nl> + / / exits even on Atom CPUs ; see TurboAssembler : : Call for Atom - specific <nl> + / / performance tuning which emits a different instruction sequence . <nl> + call ( EntryFromBuiltinIndexAsOperand ( target ) ) ; <nl> + DCHECK_EQ ( SizeOfCodeGeneratedSince ( exit ) , <nl> + ( kind = = DeoptimizeKind : : kLazy ) <nl> + ? Deoptimizer : : kLazyDeoptExitSize <nl> + : Deoptimizer : : kNonLazyDeoptExitSize ) ; <nl> USE ( exit , kind ) ; <nl> - NoRootArrayScope no_root_array ( this ) ; <nl> - / / Save the deopt id in r13 ( we don ' t need the roots array from now on ) . <nl> - movq ( r13 , Immediate ( deopt_id ) ) ; <nl> - call ( target , RelocInfo : : RUNTIME_ENTRY ) ; <nl> } <nl> <nl> void TurboAssembler : : Trap ( ) { int3 ( ) ; } <nl> mmm a / src / codegen / x64 / macro - assembler - x64 . h <nl> ppp b / src / codegen / x64 / macro - assembler - x64 . h <nl> class V8_EXPORT_PRIVATE TurboAssembler : public TurboAssemblerBase { <nl> void Call ( ExternalReference ext ) ; <nl> void Call ( Label * target ) { call ( target ) ; } <nl> <nl> + Operand EntryFromBuiltinIndexAsOperand ( Builtins : : Name builtin_index ) ; <nl> Operand EntryFromBuiltinIndexAsOperand ( Register builtin_index ) ; <nl> void CallBuiltinByIndex ( Register builtin_index ) override ; <nl> void CallBuiltin ( int builtin_index ) ; <nl> class V8_EXPORT_PRIVATE TurboAssembler : public TurboAssemblerBase { <nl> <nl> void RetpolineJump ( Register reg ) ; <nl> <nl> - void CallForDeoptimization ( Address target , int deopt_id , Label * exit , <nl> - DeoptimizeKind kind ) ; <nl> + void CallForDeoptimization ( Builtins : : Name target , int deopt_id , Label * exit , <nl> + DeoptimizeKind kind , <nl> + Label * jump_deoptimization_entry_label ) ; <nl> <nl> void Trap ( ) override ; <nl> void DebugBreak ( ) override ; <nl> mmm a / src / common / globals . h <nl> ppp b / src / common / globals . h <nl> enum class DeoptimizeKind : uint8_t { <nl> kSoft , <nl> kBailout , <nl> kLazy , <nl> - kLastDeoptimizeKind = kLazy <nl> } ; <nl> + constexpr DeoptimizeKind kFirstDeoptimizeKind = DeoptimizeKind : : kEager ; <nl> + constexpr DeoptimizeKind kLastDeoptimizeKind = DeoptimizeKind : : kLazy ; <nl> + STATIC_ASSERT ( static_cast < int > ( kFirstDeoptimizeKind ) = = 0 ) ; <nl> + constexpr int kDeoptimizeKindCount = static_cast < int > ( kLastDeoptimizeKind ) + 1 ; <nl> inline size_t hash_value ( DeoptimizeKind kind ) { <nl> return static_cast < size_t > ( kind ) ; <nl> } <nl> inline std : : ostream & operator < < ( std : : ostream & os , DeoptimizeKind kind ) { <nl> case DeoptimizeKind : : kBailout : <nl> return os < < " Bailout " ; <nl> } <nl> - UNREACHABLE ( ) ; <nl> } <nl> <nl> / / Indicates whether the lookup is related to sloppy - mode block - scoped <nl> mmm a / src / compiler / backend / arm / code - generator - arm . cc <nl> ppp b / src / compiler / backend / arm / code - generator - arm . cc <nl> CodeGenerator : : CodeGenResult CodeGenerator : : AssembleArchInstruction ( <nl> case kArchDeoptimize : { <nl> DeoptimizationExit * exit = <nl> BuildTranslation ( instr , - 1 , 0 , OutputFrameStateCombine : : Ignore ( ) ) ; <nl> - CodeGenResult result = AssembleDeoptimizerCall ( exit ) ; <nl> - if ( result ! = kSuccess ) return result ; <nl> - unwinding_info_writer_ . MarkBlockWillExit ( ) ; <nl> + __ b ( exit - > label ( ) ) ; <nl> break ; <nl> } <nl> case kArchRet : <nl> void CodeGenerator : : AssembleReturn ( InstructionOperand * pop ) { <nl> <nl> void CodeGenerator : : FinishCode ( ) { __ CheckConstPool ( true , false ) ; } <nl> <nl> - void CodeGenerator : : PrepareForDeoptimizationExits ( int deopt_count ) { } <nl> + void CodeGenerator : : PrepareForDeoptimizationExits ( <nl> + ZoneDeque < DeoptimizationExit * > * exits ) { <nl> + __ CheckConstPool ( true , false ) ; <nl> + } <nl> <nl> void CodeGenerator : : AssembleMove ( InstructionOperand * source , <nl> InstructionOperand * destination ) { <nl> mmm a / src / compiler / backend / arm64 / code - generator - arm64 . cc <nl> ppp b / src / compiler / backend / arm64 / code - generator - arm64 . cc <nl> void CodeGenerator : : AssembleReturn ( InstructionOperand * pop ) { <nl> <nl> void CodeGenerator : : FinishCode ( ) { __ ForceConstantPoolEmissionWithoutJump ( ) ; } <nl> <nl> - void CodeGenerator : : PrepareForDeoptimizationExits ( int deopt_count ) { <nl> + void CodeGenerator : : PrepareForDeoptimizationExits ( <nl> + ZoneDeque < DeoptimizationExit * > * exits ) { <nl> __ ForceConstantPoolEmissionWithoutJump ( ) ; <nl> / / We are conservative here , assuming all deopts are lazy deopts . <nl> DCHECK_GE ( Deoptimizer : : kLazyDeoptExitSize , <nl> Deoptimizer : : kNonLazyDeoptExitSize ) ; <nl> - __ CheckVeneerPool ( false , false , <nl> - deopt_count * Deoptimizer : : kLazyDeoptExitSize ) ; <nl> + __ CheckVeneerPool ( <nl> + false , false , <nl> + static_cast < int > ( exits - > size ( ) ) * Deoptimizer : : kLazyDeoptExitSize ) ; <nl> + <nl> + / / Check which deopt kinds exist in this Code object , to avoid emitting jumps <nl> + / / to unused entries . <nl> + bool saw_deopt_kind [ kDeoptimizeKindCount ] = { false } ; <nl> + for ( auto exit : * exits ) { <nl> + saw_deopt_kind [ static_cast < int > ( exit - > kind ( ) ) ] = true ; <nl> + } <nl> + <nl> + / / Emit the jumps to deoptimization entries . <nl> + UseScratchRegisterScope scope ( tasm ( ) ) ; <nl> + Register scratch = scope . AcquireX ( ) ; <nl> + STATIC_ASSERT ( static_cast < int > ( kFirstDeoptimizeKind ) = = 0 ) ; <nl> + for ( int i = 0 ; i < kDeoptimizeKindCount ; i + + ) { <nl> + if ( ! saw_deopt_kind [ i ] ) continue ; <nl> + __ bind ( & jump_deoptimization_entry_labels_ [ i ] ) ; <nl> + __ LoadEntryFromBuiltinIndex ( Deoptimizer : : GetDeoptimizationEntry ( <nl> + isolate ( ) , static_cast < DeoptimizeKind > ( i ) ) , <nl> + scratch ) ; <nl> + __ Jump ( scratch ) ; <nl> + } <nl> } <nl> <nl> void CodeGenerator : : AssembleMove ( InstructionOperand * source , <nl> mmm a / src / compiler / backend / code - generator . cc <nl> ppp b / src / compiler / backend / code - generator . cc <nl> CodeGenerator : : CodeGenResult CodeGenerator : : AssembleDeoptimizerCall ( <nl> DeoptimizeKind deopt_kind = exit - > kind ( ) ; <nl> <nl> DeoptimizeReason deoptimization_reason = exit - > reason ( ) ; <nl> - Address deopt_entry = <nl> + Builtins : : Name deopt_entry = <nl> Deoptimizer : : GetDeoptimizationEntry ( tasm ( ) - > isolate ( ) , deopt_kind ) ; <nl> + Label * jump_deoptimization_entry_label = <nl> + & jump_deoptimization_entry_labels_ [ static_cast < int > ( deopt_kind ) ] ; <nl> if ( info ( ) - > source_positions ( ) ) { <nl> tasm ( ) - > RecordDeoptReason ( deoptimization_reason , exit - > pos ( ) , <nl> deoptimization_id ) ; <nl> CodeGenerator : : CodeGenResult CodeGenerator : : AssembleDeoptimizerCall ( <nl> } <nl> <nl> tasm ( ) - > CallForDeoptimization ( deopt_entry , deoptimization_id , exit - > label ( ) , <nl> - deopt_kind ) ; <nl> + deopt_kind , jump_deoptimization_entry_label ) ; <nl> exit - > set_emitted ( ) ; <nl> return kSuccess ; <nl> } <nl> void CodeGenerator : : AssembleCode ( ) { <nl> <nl> / / For some targets , we must make sure that constant and veneer pools are <nl> / / emitted before emitting the deoptimization exits . <nl> - PrepareForDeoptimizationExits ( static_cast < int > ( deoptimization_exits_ . size ( ) ) ) ; <nl> + PrepareForDeoptimizationExits ( & deoptimization_exits_ ) ; <nl> <nl> if ( Deoptimizer : : kSupportsFixedDeoptExitSizes ) { <nl> deopt_exit_start_offset_ = tasm ( ) - > pc_offset ( ) ; <nl> void CodeGenerator : : AssembleCode ( ) { <nl> / / Deoptimizer : : kSupportsFixedDeoptExitSizes is true , lazy deopts <nl> / / might need additional instructions . <nl> auto cmp = [ ] ( const DeoptimizationExit * a , const DeoptimizationExit * b ) { <nl> - static_assert ( DeoptimizeKind : : kLazy = = DeoptimizeKind : : kLastDeoptimizeKind , <nl> + static_assert ( DeoptimizeKind : : kLazy = = kLastDeoptimizeKind , <nl> " lazy deopts are expected to be emitted last " ) ; <nl> if ( a - > kind ( ) ! = b - > kind ( ) ) { <nl> return a - > kind ( ) < b - > kind ( ) ; <nl> mmm a / src / compiler / backend / code - generator . h <nl> ppp b / src / compiler / backend / code - generator . h <nl> class V8_EXPORT_PRIVATE CodeGenerator final : public GapResolver : : Assembler { <nl> InstructionOperand * op , MachineType type ) ; <nl> void MarkLazyDeoptSite ( ) ; <nl> <nl> - void PrepareForDeoptimizationExits ( int deopt_count ) ; <nl> + void PrepareForDeoptimizationExits ( ZoneDeque < DeoptimizationExit * > * exits ) ; <nl> DeoptimizationExit * AddDeoptimizationExit ( Instruction * instr , <nl> size_t frame_state_offset ) ; <nl> <nl> class V8_EXPORT_PRIVATE CodeGenerator final : public GapResolver : : Assembler { <nl> int handler_table_offset_ = 0 ; <nl> int last_lazy_deopt_pc_ = 0 ; <nl> <nl> + / / Deoptimization exits must be as small as possible , since their count grows <nl> + / / with function size . { jump_deoptimization_entry_labels_ } is an optimization <nl> + / / to that effect , which extracts the ( potentially large ) instruction <nl> + / / sequence for the final jump to the deoptimization entry into a single spot <nl> + / / per Code object . All deopt exits can then near - call to this label . Note : <nl> + / / not used on all architectures . <nl> + Label jump_deoptimization_entry_labels_ [ kDeoptimizeKindCount ] ; <nl> + <nl> / / The maximal combined height of all frames produced upon deoptimization , and <nl> / / the maximal number of pushed arguments for function calls . Applied as an <nl> / / offset to the first stack check of an optimized function . <nl> mmm a / src / compiler / backend / ia32 / code - generator - ia32 . cc <nl> ppp b / src / compiler / backend / ia32 / code - generator - ia32 . cc <nl> CodeGenerator : : CodeGenResult CodeGenerator : : AssembleArchInstruction ( <nl> case kArchDeoptimize : { <nl> DeoptimizationExit * exit = <nl> BuildTranslation ( instr , - 1 , 0 , OutputFrameStateCombine : : Ignore ( ) ) ; <nl> - CodeGenResult result = AssembleDeoptimizerCall ( exit ) ; <nl> - if ( result ! = kSuccess ) return result ; <nl> + __ jmp ( exit - > label ( ) ) ; <nl> break ; <nl> } <nl> case kArchRet : <nl> void CodeGenerator : : AssembleReturn ( InstructionOperand * additional_pop_count ) { <nl> <nl> void CodeGenerator : : FinishCode ( ) { } <nl> <nl> - void CodeGenerator : : PrepareForDeoptimizationExits ( int deopt_count ) { } <nl> + void CodeGenerator : : PrepareForDeoptimizationExits ( <nl> + ZoneDeque < DeoptimizationExit * > * exits ) { } <nl> <nl> void CodeGenerator : : AssembleMove ( InstructionOperand * source , <nl> InstructionOperand * destination ) { <nl> mmm a / src / compiler / backend / x64 / code - generator - x64 . cc <nl> ppp b / src / compiler / backend / x64 / code - generator - x64 . cc <nl> CodeGenerator : : CodeGenResult CodeGenerator : : AssembleArchInstruction ( <nl> case kArchDeoptimize : { <nl> DeoptimizationExit * exit = <nl> BuildTranslation ( instr , - 1 , 0 , OutputFrameStateCombine : : Ignore ( ) ) ; <nl> - CodeGenResult result = AssembleDeoptimizerCall ( exit ) ; <nl> - if ( result ! = kSuccess ) return result ; <nl> - unwinding_info_writer_ . MarkBlockWillExit ( ) ; <nl> + __ jmp ( exit - > label ( ) ) ; <nl> break ; <nl> } <nl> case kArchRet : <nl> void CodeGenerator : : AssembleReturn ( InstructionOperand * additional_pop_count ) { <nl> <nl> void CodeGenerator : : FinishCode ( ) { tasm ( ) - > PatchConstPool ( ) ; } <nl> <nl> - void CodeGenerator : : PrepareForDeoptimizationExits ( int deopt_count ) { } <nl> + void CodeGenerator : : PrepareForDeoptimizationExits ( <nl> + ZoneDeque < DeoptimizationExit * > * exits ) { } <nl> <nl> void CodeGenerator : : IncrementStackAccessCounter ( <nl> InstructionOperand * source , InstructionOperand * destination ) { <nl> mmm a / src / compiler / pipeline . cc <nl> ppp b / src / compiler / pipeline . cc <nl> PipelineCompilationJob : : Status PipelineCompilationJob : : PrepareJobImpl ( <nl> <nl> if ( compilation_info ( ) - > is_osr ( ) ) data_ . InitializeOsrHelper ( ) ; <nl> <nl> - / / Make sure that we have generated the deopt entries code . This is in order <nl> - / / to avoid triggering the generation of deopt entries later during code <nl> - / / assembly . <nl> - Deoptimizer : : EnsureCodeForDeoptimizationEntries ( isolate ) ; <nl> - <nl> pipeline_ . Serialize ( ) ; <nl> <nl> if ( ! data_ . broker ( ) - > is_concurrent_inlining ( ) ) { <nl> MaybeHandle < Code > Pipeline : : GenerateCodeForTesting ( <nl> PipelineImpl pipeline ( & data ) ; <nl> <nl> Linkage linkage ( Linkage : : ComputeIncoming ( data . instruction_zone ( ) , info ) ) ; <nl> - Deoptimizer : : EnsureCodeForDeoptimizationEntries ( isolate ) ; <nl> <nl> { <nl> CompilationHandleScope compilation_scope ( isolate , info ) ; <nl> bool Pipeline : : AllocateRegistersForTesting ( const RegisterConfiguration * config , <nl> bool use_mid_tier_register_allocator , <nl> bool run_verifier ) { <nl> OptimizedCompilationInfo info ( ArrayVector ( " testing " ) , sequence - > zone ( ) , <nl> - CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) ; <nl> + CodeKind : : FOR_TESTING ) ; <nl> ZoneStats zone_stats ( sequence - > isolate ( ) - > allocator ( ) ) ; <nl> PipelineData data ( & zone_stats , & info , sequence - > isolate ( ) , sequence ) ; <nl> data . InitializeFrameData ( nullptr ) ; <nl> mmm a / src / deoptimizer / arm / deoptimizer - arm . cc <nl> ppp b / src / deoptimizer / arm / deoptimizer - arm . cc <nl> <nl> / / Use of this source code is governed by a BSD - style license that can be <nl> / / found in the LICENSE file . <nl> <nl> - # include " src / codegen / assembler - inl . h " <nl> - # include " src / codegen / macro - assembler . h " <nl> - # include " src / codegen / register - configuration . h " <nl> - # include " src / codegen / safepoint - table . h " <nl> # include " src / deoptimizer / deoptimizer . h " <nl> - # include " src / objects / objects - inl . h " <nl> <nl> namespace v8 { <nl> namespace internal { <nl> <nl> - const bool Deoptimizer : : kSupportsFixedDeoptExitSizes = false ; <nl> - const int Deoptimizer : : kNonLazyDeoptExitSize = 0 ; <nl> - const int Deoptimizer : : kLazyDeoptExitSize = 0 ; <nl> - <nl> - # define __ masm - > <nl> - <nl> - / / This code tries to be close to ia32 code so that any changes can be <nl> - / / easily ported . <nl> - void Deoptimizer : : GenerateDeoptimizationEntries ( MacroAssembler * masm , <nl> - Isolate * isolate , <nl> - DeoptimizeKind deopt_kind ) { <nl> - NoRootArrayScope no_root_array ( masm ) ; <nl> - <nl> - / / Save all general purpose registers before messing with them . <nl> - const int kNumberOfRegisters = Register : : kNumRegisters ; <nl> - <nl> - / / Everything but pc , lr and ip which will be saved but not restored . <nl> - RegList restored_regs = kJSCallerSaved | kCalleeSaved | ip . bit ( ) ; <nl> - <nl> - const int kDoubleRegsSize = kDoubleSize * DwVfpRegister : : kNumRegisters ; <nl> - <nl> - / / Save all allocatable VFP registers before messing with them . <nl> - { <nl> - / / We use a run - time check for VFP32DREGS . <nl> - CpuFeatureScope scope ( masm , VFP32DREGS , <nl> - CpuFeatureScope : : kDontCheckSupported ) ; <nl> - UseScratchRegisterScope temps ( masm ) ; <nl> - Register scratch = temps . Acquire ( ) ; <nl> - <nl> - / / Check CPU flags for number of registers , setting the Z condition flag . <nl> - __ CheckFor32DRegs ( scratch ) ; <nl> - <nl> - / / Push registers d0 - d15 , and possibly d16 - d31 , on the stack . <nl> - / / If d16 - d31 are not pushed , decrease the stack pointer instead . <nl> - __ vstm ( db_w , sp , d16 , d31 , ne ) ; <nl> - / / Okay to not call AllocateStackSpace here because the size is a known <nl> - / / small number and we need to use condition codes . <nl> - __ sub ( sp , sp , Operand ( 16 * kDoubleSize ) , LeaveCC , eq ) ; <nl> - __ vstm ( db_w , sp , d0 , d15 ) ; <nl> - } <nl> - <nl> - / / Push all 16 registers ( needed to populate FrameDescription : : registers_ ) . <nl> - / / TODO ( 1588 ) Note that using pc with stm is deprecated , so we should perhaps <nl> - / / handle this a bit differently . <nl> - __ stm ( db_w , sp , restored_regs | sp . bit ( ) | lr . bit ( ) | pc . bit ( ) ) ; <nl> - <nl> - { <nl> - UseScratchRegisterScope temps ( masm ) ; <nl> - Register scratch = temps . Acquire ( ) ; <nl> - __ mov ( scratch , Operand ( ExternalReference : : Create ( <nl> - IsolateAddressId : : kCEntryFPAddress , isolate ) ) ) ; <nl> - __ str ( fp , MemOperand ( scratch ) ) ; <nl> - } <nl> - <nl> - const int kSavedRegistersAreaSize = <nl> - ( kNumberOfRegisters * kPointerSize ) + kDoubleRegsSize ; <nl> - <nl> - / / Get the bailout id is passed as r10 by the caller . <nl> - __ mov ( r2 , r10 ) ; <nl> - <nl> - / / Get the address of the location in the code object ( r3 ) ( return <nl> - / / address for lazy deoptimization ) and compute the fp - to - sp delta in <nl> - / / register r4 . <nl> - __ mov ( r3 , lr ) ; <nl> - __ add ( r4 , sp , Operand ( kSavedRegistersAreaSize ) ) ; <nl> - __ sub ( r4 , fp , r4 ) ; <nl> - <nl> - / / Allocate a new deoptimizer object . <nl> - / / Pass four arguments in r0 to r3 and fifth argument on stack . <nl> - __ PrepareCallCFunction ( 6 ) ; <nl> - __ mov ( r0 , Operand ( 0 ) ) ; <nl> - Label context_check ; <nl> - __ ldr ( r1 , MemOperand ( fp , CommonFrameConstants : : kContextOrFrameTypeOffset ) ) ; <nl> - __ JumpIfSmi ( r1 , & context_check ) ; <nl> - __ ldr ( r0 , MemOperand ( fp , StandardFrameConstants : : kFunctionOffset ) ) ; <nl> - __ bind ( & context_check ) ; <nl> - __ mov ( r1 , Operand ( static_cast < int > ( deopt_kind ) ) ) ; <nl> - / / r2 : bailout id already loaded . <nl> - / / r3 : code address or 0 already loaded . <nl> - __ str ( r4 , MemOperand ( sp , 0 * kPointerSize ) ) ; / / Fp - to - sp delta . <nl> - __ mov ( r5 , Operand ( ExternalReference : : isolate_address ( isolate ) ) ) ; <nl> - __ str ( r5 , MemOperand ( sp , 1 * kPointerSize ) ) ; / / Isolate . <nl> - / / Call Deoptimizer : : New ( ) . <nl> - { <nl> - AllowExternalCallThatCantCauseGC scope ( masm ) ; <nl> - __ CallCFunction ( ExternalReference : : new_deoptimizer_function ( ) , 6 ) ; <nl> - } <nl> - <nl> - / / Preserve " deoptimizer " object in register r0 and get the input <nl> - / / frame descriptor pointer to r1 ( deoptimizer - > input_ ) ; <nl> - __ ldr ( r1 , MemOperand ( r0 , Deoptimizer : : input_offset ( ) ) ) ; <nl> - <nl> - / / Copy core registers into FrameDescription : : registers_ [ kNumRegisters ] . <nl> - DCHECK_EQ ( Register : : kNumRegisters , kNumberOfRegisters ) ; <nl> - for ( int i = 0 ; i < kNumberOfRegisters ; i + + ) { <nl> - int offset = ( i * kPointerSize ) + FrameDescription : : registers_offset ( ) ; <nl> - __ ldr ( r2 , MemOperand ( sp , i * kPointerSize ) ) ; <nl> - __ str ( r2 , MemOperand ( r1 , offset ) ) ; <nl> - } <nl> - <nl> - / / Copy VFP registers to <nl> - / / double_registers_ [ DoubleRegister : : kNumAllocatableRegisters ] <nl> - int double_regs_offset = FrameDescription : : double_registers_offset ( ) ; <nl> - const RegisterConfiguration * config = RegisterConfiguration : : Default ( ) ; <nl> - for ( int i = 0 ; i < config - > num_allocatable_double_registers ( ) ; + + i ) { <nl> - int code = config - > GetAllocatableDoubleCode ( i ) ; <nl> - int dst_offset = code * kDoubleSize + double_regs_offset ; <nl> - int src_offset = code * kDoubleSize + kNumberOfRegisters * kPointerSize ; <nl> - __ vldr ( d0 , sp , src_offset ) ; <nl> - __ vstr ( d0 , r1 , dst_offset ) ; <nl> - } <nl> - <nl> - / / Mark the stack as not iterable for the CPU profiler which won ' t be able to <nl> - / / walk the stack without the return address . <nl> - { <nl> - UseScratchRegisterScope temps ( masm ) ; <nl> - Register is_iterable = temps . Acquire ( ) ; <nl> - Register zero = r4 ; <nl> - __ Move ( is_iterable , ExternalReference : : stack_is_iterable_address ( isolate ) ) ; <nl> - __ mov ( zero , Operand ( 0 ) ) ; <nl> - __ strb ( zero , MemOperand ( is_iterable ) ) ; <nl> - } <nl> - <nl> - / / Remove the saved registers from the stack . <nl> - __ add ( sp , sp , Operand ( kSavedRegistersAreaSize ) ) ; <nl> - <nl> - / / Compute a pointer to the unwinding limit in register r2 ; that is <nl> - / / the first stack slot not part of the input frame . <nl> - __ ldr ( r2 , MemOperand ( r1 , FrameDescription : : frame_size_offset ( ) ) ) ; <nl> - __ add ( r2 , r2 , sp ) ; <nl> - <nl> - / / Unwind the stack down to - but not including - the unwinding <nl> - / / limit and copy the contents of the activation frame to the input <nl> - / / frame description . <nl> - __ add ( r3 , r1 , Operand ( FrameDescription : : frame_content_offset ( ) ) ) ; <nl> - Label pop_loop ; <nl> - Label pop_loop_header ; <nl> - __ b ( & pop_loop_header ) ; <nl> - __ bind ( & pop_loop ) ; <nl> - __ pop ( r4 ) ; <nl> - __ str ( r4 , MemOperand ( r3 , 0 ) ) ; <nl> - __ add ( r3 , r3 , Operand ( sizeof ( uint32_t ) ) ) ; <nl> - __ bind ( & pop_loop_header ) ; <nl> - __ cmp ( r2 , sp ) ; <nl> - __ b ( ne , & pop_loop ) ; <nl> - <nl> - / / Compute the output frame in the deoptimizer . <nl> - __ push ( r0 ) ; / / Preserve deoptimizer object across call . <nl> - / / r0 : deoptimizer object ; r1 : scratch . <nl> - __ PrepareCallCFunction ( 1 ) ; <nl> - / / Call Deoptimizer : : ComputeOutputFrames ( ) . <nl> - { <nl> - AllowExternalCallThatCantCauseGC scope ( masm ) ; <nl> - __ CallCFunction ( ExternalReference : : compute_output_frames_function ( ) , 1 ) ; <nl> - } <nl> - __ pop ( r0 ) ; / / Restore deoptimizer object ( class Deoptimizer ) . <nl> - <nl> - __ ldr ( sp , MemOperand ( r0 , Deoptimizer : : caller_frame_top_offset ( ) ) ) ; <nl> - <nl> - / / Replace the current ( input ) frame with the output frames . <nl> - Label outer_push_loop , inner_push_loop , outer_loop_header , inner_loop_header ; <nl> - / / Outer loop state : r4 = current " FrameDescription * * output_ " , <nl> - / / r1 = one past the last FrameDescription * * . <nl> - __ ldr ( r1 , MemOperand ( r0 , Deoptimizer : : output_count_offset ( ) ) ) ; <nl> - __ ldr ( r4 , MemOperand ( r0 , Deoptimizer : : output_offset ( ) ) ) ; / / r4 is output_ . <nl> - __ add ( r1 , r4 , Operand ( r1 , LSL , 2 ) ) ; <nl> - __ jmp ( & outer_loop_header ) ; <nl> - __ bind ( & outer_push_loop ) ; <nl> - / / Inner loop state : r2 = current FrameDescription * , r3 = loop index . <nl> - __ ldr ( r2 , MemOperand ( r4 , 0 ) ) ; / / output_ [ ix ] <nl> - __ ldr ( r3 , MemOperand ( r2 , FrameDescription : : frame_size_offset ( ) ) ) ; <nl> - __ jmp ( & inner_loop_header ) ; <nl> - __ bind ( & inner_push_loop ) ; <nl> - __ sub ( r3 , r3 , Operand ( sizeof ( uint32_t ) ) ) ; <nl> - __ add ( r6 , r2 , Operand ( r3 ) ) ; <nl> - __ ldr ( r6 , MemOperand ( r6 , FrameDescription : : frame_content_offset ( ) ) ) ; <nl> - __ push ( r6 ) ; <nl> - __ bind ( & inner_loop_header ) ; <nl> - __ cmp ( r3 , Operand : : Zero ( ) ) ; <nl> - __ b ( ne , & inner_push_loop ) ; / / test for gt ? <nl> - __ add ( r4 , r4 , Operand ( kPointerSize ) ) ; <nl> - __ bind ( & outer_loop_header ) ; <nl> - __ cmp ( r4 , r1 ) ; <nl> - __ b ( lt , & outer_push_loop ) ; <nl> - <nl> - __ ldr ( r1 , MemOperand ( r0 , Deoptimizer : : input_offset ( ) ) ) ; <nl> - for ( int i = 0 ; i < config - > num_allocatable_double_registers ( ) ; + + i ) { <nl> - int code = config - > GetAllocatableDoubleCode ( i ) ; <nl> - DwVfpRegister reg = DwVfpRegister : : from_code ( code ) ; <nl> - int src_offset = code * kDoubleSize + double_regs_offset ; <nl> - __ vldr ( reg , r1 , src_offset ) ; <nl> - } <nl> - <nl> - / / Push pc and continuation from the last output frame . <nl> - __ ldr ( r6 , MemOperand ( r2 , FrameDescription : : pc_offset ( ) ) ) ; <nl> - __ push ( r6 ) ; <nl> - __ ldr ( r6 , MemOperand ( r2 , FrameDescription : : continuation_offset ( ) ) ) ; <nl> - __ push ( r6 ) ; <nl> - <nl> - / / Push the registers from the last output frame . <nl> - for ( int i = kNumberOfRegisters - 1 ; i > = 0 ; i - - ) { <nl> - int offset = ( i * kPointerSize ) + FrameDescription : : registers_offset ( ) ; <nl> - __ ldr ( r6 , MemOperand ( r2 , offset ) ) ; <nl> - __ push ( r6 ) ; <nl> - } <nl> - <nl> - / / Restore the registers from the stack . <nl> - __ ldm ( ia_w , sp , restored_regs ) ; / / all but pc registers . <nl> - <nl> - { <nl> - UseScratchRegisterScope temps ( masm ) ; <nl> - Register is_iterable = temps . Acquire ( ) ; <nl> - Register one = r4 ; <nl> - __ Move ( is_iterable , ExternalReference : : stack_is_iterable_address ( isolate ) ) ; <nl> - __ mov ( one , Operand ( 1 ) ) ; <nl> - __ strb ( one , MemOperand ( is_iterable ) ) ; <nl> - } <nl> - <nl> - / / Remove sp , lr and pc . <nl> - __ Drop ( 3 ) ; <nl> - { <nl> - UseScratchRegisterScope temps ( masm ) ; <nl> - Register scratch = temps . Acquire ( ) ; <nl> - __ pop ( scratch ) ; / / get continuation , leave pc on stack <nl> - __ pop ( lr ) ; <nl> - __ Jump ( scratch ) ; <nl> - } <nl> - <nl> - __ stop ( ) ; <nl> - } <nl> + const bool Deoptimizer : : kSupportsFixedDeoptExitSizes = true ; <nl> + const int Deoptimizer : : kNonLazyDeoptExitSize = 2 * kInstrSize ; <nl> + const int Deoptimizer : : kLazyDeoptExitSize = 2 * kInstrSize ; <nl> <nl> Float32 RegisterValues : : GetFloatRegister ( unsigned n ) const { <nl> const int kShift = n % 2 = = 0 ? 0 : 32 ; <nl> void FrameDescription : : SetCallerConstantPool ( unsigned offset , intptr_t value ) { <nl> <nl> void FrameDescription : : SetPc ( intptr_t pc ) { pc_ = pc ; } <nl> <nl> - # undef __ <nl> - <nl> } / / namespace internal <nl> } / / namespace v8 <nl> mmm a / src / deoptimizer / arm64 / deoptimizer - arm64 . cc <nl> ppp b / src / deoptimizer / arm64 / deoptimizer - arm64 . cc <nl> <nl> / / found in the LICENSE file . <nl> <nl> # include " src / api / api . h " <nl> - # include " src / codegen / arm64 / assembler - arm64 - inl . h " <nl> - # include " src / codegen / arm64 / macro - assembler - arm64 - inl . h " <nl> - # include " src / codegen / register - configuration . h " <nl> - # include " src / codegen / safepoint - table . h " <nl> # include " src / deoptimizer / deoptimizer . h " <nl> - # include " src / execution / frame - constants . h " <nl> # include " src / execution / pointer - authentication . h " <nl> <nl> namespace v8 { <nl> const int Deoptimizer : : kLazyDeoptExitSize = 2 * kInstrSize ; <nl> const int Deoptimizer : : kLazyDeoptExitSize = 1 * kInstrSize ; <nl> # endif <nl> <nl> - # define __ masm - > <nl> - <nl> - namespace { <nl> - <nl> - void CopyRegListToFrame ( MacroAssembler * masm , const Register & dst , <nl> - int dst_offset , const CPURegList & reg_list , <nl> - const Register & temp0 , const Register & temp1 , <nl> - int src_offset = 0 ) { <nl> - DCHECK_EQ ( reg_list . Count ( ) % 2 , 0 ) ; <nl> - UseScratchRegisterScope temps ( masm ) ; <nl> - CPURegList copy_to_input = reg_list ; <nl> - int reg_size = reg_list . RegisterSizeInBytes ( ) ; <nl> - DCHECK_EQ ( temp0 . SizeInBytes ( ) , reg_size ) ; <nl> - DCHECK_EQ ( temp1 . SizeInBytes ( ) , reg_size ) ; <nl> - <nl> - / / Compute some temporary addresses to avoid having the macro assembler set <nl> - / / up a temp with an offset for accesses out of the range of the addressing <nl> - / / mode . <nl> - Register src = temps . AcquireX ( ) ; <nl> - masm - > Add ( src , sp , src_offset ) ; <nl> - masm - > Add ( dst , dst , dst_offset ) ; <nl> - <nl> - / / Write reg_list into the frame pointed to by dst . <nl> - for ( int i = 0 ; i < reg_list . Count ( ) ; i + = 2 ) { <nl> - masm - > Ldp ( temp0 , temp1 , MemOperand ( src , i * reg_size ) ) ; <nl> - <nl> - CPURegister reg0 = copy_to_input . PopLowestIndex ( ) ; <nl> - CPURegister reg1 = copy_to_input . PopLowestIndex ( ) ; <nl> - int offset0 = reg0 . code ( ) * reg_size ; <nl> - int offset1 = reg1 . code ( ) * reg_size ; <nl> - <nl> - / / Pair up adjacent stores , otherwise write them separately . <nl> - if ( offset1 = = offset0 + reg_size ) { <nl> - masm - > Stp ( temp0 , temp1 , MemOperand ( dst , offset0 ) ) ; <nl> - } else { <nl> - masm - > Str ( temp0 , MemOperand ( dst , offset0 ) ) ; <nl> - masm - > Str ( temp1 , MemOperand ( dst , offset1 ) ) ; <nl> - } <nl> - } <nl> - masm - > Sub ( dst , dst , dst_offset ) ; <nl> - } <nl> - <nl> - void RestoreRegList ( MacroAssembler * masm , const CPURegList & reg_list , <nl> - const Register & src_base , int src_offset ) { <nl> - DCHECK_EQ ( reg_list . Count ( ) % 2 , 0 ) ; <nl> - UseScratchRegisterScope temps ( masm ) ; <nl> - CPURegList restore_list = reg_list ; <nl> - int reg_size = restore_list . RegisterSizeInBytes ( ) ; <nl> - <nl> - / / Compute a temporary addresses to avoid having the macro assembler set <nl> - / / up a temp with an offset for accesses out of the range of the addressing <nl> - / / mode . <nl> - Register src = temps . AcquireX ( ) ; <nl> - masm - > Add ( src , src_base , src_offset ) ; <nl> - <nl> - / / No need to restore padreg . <nl> - restore_list . Remove ( padreg ) ; <nl> - <nl> - / / Restore every register in restore_list from src . <nl> - while ( ! restore_list . IsEmpty ( ) ) { <nl> - CPURegister reg0 = restore_list . PopLowestIndex ( ) ; <nl> - CPURegister reg1 = restore_list . PopLowestIndex ( ) ; <nl> - int offset0 = reg0 . code ( ) * reg_size ; <nl> - <nl> - if ( reg1 = = NoCPUReg ) { <nl> - masm - > Ldr ( reg0 , MemOperand ( src , offset0 ) ) ; <nl> - break ; <nl> - } <nl> - <nl> - int offset1 = reg1 . code ( ) * reg_size ; <nl> - <nl> - / / Pair up adjacent loads , otherwise read them separately . <nl> - if ( offset1 = = offset0 + reg_size ) { <nl> - masm - > Ldp ( reg0 , reg1 , MemOperand ( src , offset0 ) ) ; <nl> - } else { <nl> - masm - > Ldr ( reg0 , MemOperand ( src , offset0 ) ) ; <nl> - masm - > Ldr ( reg1 , MemOperand ( src , offset1 ) ) ; <nl> - } <nl> - } <nl> - } <nl> - } / / namespace <nl> - <nl> - void Deoptimizer : : GenerateDeoptimizationEntries ( MacroAssembler * masm , <nl> - Isolate * isolate , <nl> - DeoptimizeKind deopt_kind ) { <nl> - NoRootArrayScope no_root_array ( masm ) ; <nl> - <nl> - / / TODO ( all ) : This code needs to be revisited . We probably only need to save <nl> - / / caller - saved registers here . Callee - saved registers can be stored directly <nl> - / / in the input frame . <nl> - <nl> - / / Save all allocatable double registers . <nl> - CPURegList saved_double_registers ( <nl> - CPURegister : : kVRegister , kDRegSizeInBits , <nl> - RegisterConfiguration : : Default ( ) - > allocatable_double_codes_mask ( ) ) ; <nl> - DCHECK_EQ ( saved_double_registers . Count ( ) % 2 , 0 ) ; <nl> - __ PushCPURegList ( saved_double_registers ) ; <nl> - <nl> - / / We save all the registers except sp , lr , platform register ( x18 ) and the <nl> - / / masm scratches . <nl> - CPURegList saved_registers ( CPURegister : : kRegister , kXRegSizeInBits , 0 , 28 ) ; <nl> - saved_registers . Remove ( ip0 ) ; <nl> - saved_registers . Remove ( ip1 ) ; <nl> - saved_registers . Remove ( x18 ) ; <nl> - saved_registers . Combine ( fp ) ; <nl> - saved_registers . Align ( ) ; <nl> - DCHECK_EQ ( saved_registers . Count ( ) % 2 , 0 ) ; <nl> - __ PushCPURegList ( saved_registers ) ; <nl> - <nl> - __ Mov ( x3 , Operand ( ExternalReference : : Create ( <nl> - IsolateAddressId : : kCEntryFPAddress , isolate ) ) ) ; <nl> - __ Str ( fp , MemOperand ( x3 ) ) ; <nl> - <nl> - const int kSavedRegistersAreaSize = <nl> - ( saved_registers . Count ( ) * kXRegSize ) + <nl> - ( saved_double_registers . Count ( ) * kDRegSize ) ; <nl> - <nl> - / / Floating point registers are saved on the stack above core registers . <nl> - const int kDoubleRegistersOffset = saved_registers . Count ( ) * kXRegSize ; <nl> - <nl> - / / We don ' t use a bailout id for arm64 , because we can compute the id from the <nl> - / / address . Pass kMaxUInt32 instead to signify this . <nl> - Register bailout_id = x2 ; <nl> - __ Mov ( bailout_id , kMaxUInt32 ) ; <nl> - <nl> - Register code_object = x3 ; <nl> - Register fp_to_sp = x4 ; <nl> - / / Get the address of the location in the code object . This is the return <nl> - / / address for lazy deoptimization . <nl> - __ Mov ( code_object , lr ) ; <nl> - / / Compute the fp - to - sp delta . <nl> - __ Add ( fp_to_sp , sp , kSavedRegistersAreaSize ) ; <nl> - __ Sub ( fp_to_sp , fp , fp_to_sp ) ; <nl> - <nl> - / / Allocate a new deoptimizer object . <nl> - __ Ldr ( x1 , MemOperand ( fp , CommonFrameConstants : : kContextOrFrameTypeOffset ) ) ; <nl> - <nl> - / / Ensure we can safely load from below fp . <nl> - DCHECK_GT ( kSavedRegistersAreaSize , - StandardFrameConstants : : kFunctionOffset ) ; <nl> - __ Ldr ( x0 , MemOperand ( fp , StandardFrameConstants : : kFunctionOffset ) ) ; <nl> - <nl> - / / If x1 is a smi , zero x0 . <nl> - __ Tst ( x1 , kSmiTagMask ) ; <nl> - __ CzeroX ( x0 , eq ) ; <nl> - <nl> - __ Mov ( x1 , static_cast < int > ( deopt_kind ) ) ; <nl> - / / Following arguments are already loaded : <nl> - / / - x2 : bailout id <nl> - / / - x3 : code object address <nl> - / / - x4 : fp - to - sp delta <nl> - __ Mov ( x5 , ExternalReference : : isolate_address ( isolate ) ) ; <nl> - <nl> - { <nl> - / / Call Deoptimizer : : New ( ) . <nl> - AllowExternalCallThatCantCauseGC scope ( masm ) ; <nl> - __ CallCFunction ( ExternalReference : : new_deoptimizer_function ( ) , 6 ) ; <nl> - } <nl> - <nl> - / / Preserve " deoptimizer " object in register x0 . <nl> - Register deoptimizer = x0 ; <nl> - <nl> - / / Get the input frame descriptor pointer . <nl> - __ Ldr ( x1 , MemOperand ( deoptimizer , Deoptimizer : : input_offset ( ) ) ) ; <nl> - <nl> - / / Copy core registers into the input frame . <nl> - CopyRegListToFrame ( masm , x1 , FrameDescription : : registers_offset ( ) , <nl> - saved_registers , x2 , x3 ) ; <nl> - <nl> - / / Copy double registers to the input frame . <nl> - CopyRegListToFrame ( masm , x1 , FrameDescription : : double_registers_offset ( ) , <nl> - saved_double_registers , x2 , x3 , kDoubleRegistersOffset ) ; <nl> - <nl> - / / Mark the stack as not iterable for the CPU profiler which won ' t be able to <nl> - / / walk the stack without the return address . <nl> - { <nl> - UseScratchRegisterScope temps ( masm ) ; <nl> - Register is_iterable = temps . AcquireX ( ) ; <nl> - __ Mov ( is_iterable , ExternalReference : : stack_is_iterable_address ( isolate ) ) ; <nl> - __ strb ( xzr , MemOperand ( is_iterable ) ) ; <nl> - } <nl> - <nl> - / / Remove the saved registers from the stack . <nl> - DCHECK_EQ ( kSavedRegistersAreaSize % kXRegSize , 0 ) ; <nl> - __ Drop ( kSavedRegistersAreaSize / kXRegSize ) ; <nl> - <nl> - / / Compute a pointer to the unwinding limit in register x2 ; that is <nl> - / / the first stack slot not part of the input frame . <nl> - Register unwind_limit = x2 ; <nl> - __ Ldr ( unwind_limit , MemOperand ( x1 , FrameDescription : : frame_size_offset ( ) ) ) ; <nl> - <nl> - / / Unwind the stack down to - but not including - the unwinding <nl> - / / limit and copy the contents of the activation frame to the input <nl> - / / frame description . <nl> - __ Add ( x3 , x1 , FrameDescription : : frame_content_offset ( ) ) ; <nl> - __ SlotAddress ( x1 , 0 ) ; <nl> - __ Lsr ( unwind_limit , unwind_limit , kSystemPointerSizeLog2 ) ; <nl> - __ Mov ( x5 , unwind_limit ) ; <nl> - __ CopyDoubleWords ( x3 , x1 , x5 ) ; <nl> - __ Drop ( unwind_limit ) ; <nl> - <nl> - / / Compute the output frame in the deoptimizer . <nl> - __ Push ( padreg , x0 ) ; / / Preserve deoptimizer object across call . <nl> - { <nl> - / / Call Deoptimizer : : ComputeOutputFrames ( ) . <nl> - AllowExternalCallThatCantCauseGC scope ( masm ) ; <nl> - __ CallCFunction ( ExternalReference : : compute_output_frames_function ( ) , 1 ) ; <nl> - } <nl> - __ Pop ( x4 , padreg ) ; / / Restore deoptimizer object ( class Deoptimizer ) . <nl> - <nl> - { <nl> - UseScratchRegisterScope temps ( masm ) ; <nl> - Register scratch = temps . AcquireX ( ) ; <nl> - __ Ldr ( scratch , MemOperand ( x4 , Deoptimizer : : caller_frame_top_offset ( ) ) ) ; <nl> - __ Mov ( sp , scratch ) ; <nl> - } <nl> - <nl> - / / Replace the current ( input ) frame with the output frames . <nl> - Label outer_push_loop , outer_loop_header ; <nl> - __ Ldrsw ( x1 , MemOperand ( x4 , Deoptimizer : : output_count_offset ( ) ) ) ; <nl> - __ Ldr ( x0 , MemOperand ( x4 , Deoptimizer : : output_offset ( ) ) ) ; <nl> - __ Add ( x1 , x0 , Operand ( x1 , LSL , kSystemPointerSizeLog2 ) ) ; <nl> - __ B ( & outer_loop_header ) ; <nl> - <nl> - __ Bind ( & outer_push_loop ) ; <nl> - Register current_frame = x2 ; <nl> - Register frame_size = x3 ; <nl> - __ Ldr ( current_frame , MemOperand ( x0 , kSystemPointerSize , PostIndex ) ) ; <nl> - __ Ldr ( x3 , MemOperand ( current_frame , FrameDescription : : frame_size_offset ( ) ) ) ; <nl> - __ Lsr ( frame_size , x3 , kSystemPointerSizeLog2 ) ; <nl> - __ Claim ( frame_size ) ; <nl> - <nl> - __ Add ( x7 , current_frame , FrameDescription : : frame_content_offset ( ) ) ; <nl> - __ SlotAddress ( x6 , 0 ) ; <nl> - __ CopyDoubleWords ( x6 , x7 , frame_size ) ; <nl> - <nl> - __ Bind ( & outer_loop_header ) ; <nl> - __ Cmp ( x0 , x1 ) ; <nl> - __ B ( lt , & outer_push_loop ) ; <nl> - <nl> - __ Ldr ( x1 , MemOperand ( x4 , Deoptimizer : : input_offset ( ) ) ) ; <nl> - RestoreRegList ( masm , saved_double_registers , x1 , <nl> - FrameDescription : : double_registers_offset ( ) ) ; <nl> - <nl> - { <nl> - UseScratchRegisterScope temps ( masm ) ; <nl> - Register is_iterable = temps . AcquireX ( ) ; <nl> - Register one = x4 ; <nl> - __ Mov ( is_iterable , ExternalReference : : stack_is_iterable_address ( isolate ) ) ; <nl> - __ Mov ( one , Operand ( 1 ) ) ; <nl> - __ strb ( one , MemOperand ( is_iterable ) ) ; <nl> - } <nl> - <nl> - / / TODO ( all ) : ARM copies a lot ( if not all ) of the last output frame onto the <nl> - / / stack , then pops it all into registers . Here , we try to load it directly <nl> - / / into the relevant registers . Is this correct ? If so , we should improve the <nl> - / / ARM code . <nl> - <nl> - / / Restore registers from the last output frame . <nl> - / / Note that lr is not in the list of saved_registers and will be restored <nl> - / / later . We can use it to hold the address of last output frame while <nl> - / / reloading the other registers . <nl> - DCHECK ( ! saved_registers . IncludesAliasOf ( lr ) ) ; <nl> - Register last_output_frame = lr ; <nl> - __ Mov ( last_output_frame , current_frame ) ; <nl> - <nl> - RestoreRegList ( masm , saved_registers , last_output_frame , <nl> - FrameDescription : : registers_offset ( ) ) ; <nl> - <nl> - UseScratchRegisterScope temps ( masm ) ; <nl> - temps . Exclude ( x17 ) ; <nl> - Register continuation = x17 ; <nl> - __ Ldr ( continuation , MemOperand ( last_output_frame , <nl> - FrameDescription : : continuation_offset ( ) ) ) ; <nl> - __ Ldr ( lr , MemOperand ( last_output_frame , FrameDescription : : pc_offset ( ) ) ) ; <nl> - # ifdef V8_ENABLE_CONTROL_FLOW_INTEGRITY <nl> - __ Autibsp ( ) ; <nl> - # endif <nl> - __ Br ( continuation ) ; <nl> - } <nl> - <nl> Float32 RegisterValues : : GetFloatRegister ( unsigned n ) const { <nl> return Float32 : : FromBits ( <nl> static_cast < uint32_t > ( double_registers_ [ n ] . get_bits ( ) ) ) ; <nl> void FrameDescription : : SetPc ( intptr_t pc ) { <nl> pc_ = pc ; <nl> } <nl> <nl> - # undef __ <nl> - <nl> } / / namespace internal <nl> } / / namespace v8 <nl> mmm a / src / deoptimizer / deoptimizer . cc <nl> ppp b / src / deoptimizer / deoptimizer . cc <nl> <nl> # include " src / objects / debug - objects - inl . h " <nl> # include " src / objects / heap - number - inl . h " <nl> # include " src / objects / smi . h " <nl> + # include " src / snapshot / embedded / embedded - data . h " <nl> # include " src / tracing / trace - event . h " <nl> # include " torque - generated / exported - class - definitions . h " <nl> <nl> class FrameWriter { <nl> unsigned top_offset_ ; <nl> } ; <nl> <nl> - DeoptimizerData : : DeoptimizerData ( Heap * heap ) : heap_ ( heap ) , current_ ( nullptr ) { <nl> - Code * start = & deopt_entry_code_ [ 0 ] ; <nl> - Code * end = & deopt_entry_code_ [ DeoptimizerData : : kLastDeoptimizeKind + 1 ] ; <nl> - strong_roots_entry_ = <nl> - heap_ - > RegisterStrongRoots ( FullObjectSlot ( start ) , FullObjectSlot ( end ) ) ; <nl> - } <nl> - <nl> - DeoptimizerData : : ~ DeoptimizerData ( ) { <nl> - heap_ - > UnregisterStrongRoots ( strong_roots_entry_ ) ; <nl> - } <nl> - <nl> - Code DeoptimizerData : : deopt_entry_code ( DeoptimizeKind kind ) { <nl> - return deopt_entry_code_ [ static_cast < int > ( kind ) ] ; <nl> - } <nl> - <nl> - void DeoptimizerData : : set_deopt_entry_code ( DeoptimizeKind kind , Code code ) { <nl> - deopt_entry_code_ [ static_cast < int > ( kind ) ] = code ; <nl> - } <nl> - <nl> Code Deoptimizer : : FindDeoptimizingCode ( Address addr ) { <nl> if ( function_ . IsHeapObject ( ) ) { <nl> / / Search all deoptimizing code in the native context of the function . <nl> Code Deoptimizer : : FindDeoptimizingCode ( Address addr ) { <nl> return Code ( ) ; <nl> } <nl> <nl> - / / We rely on this function not causing a GC . It is called from generated code <nl> + / / We rely on this function not causing a GC . It is called from generated code <nl> / / without having a real stack frame in place . <nl> Deoptimizer * Deoptimizer : : New ( Address raw_function , DeoptimizeKind kind , <nl> unsigned bailout_id , Address from , <nl> Deoptimizer * Deoptimizer : : New ( Address raw_function , DeoptimizeKind kind , <nl> JSFunction function = JSFunction : : cast ( Object ( raw_function ) ) ; <nl> Deoptimizer * deoptimizer = new Deoptimizer ( isolate , function , kind , <nl> bailout_id , from , fp_to_sp_delta ) ; <nl> - CHECK_NULL ( isolate - > deoptimizer_data ( ) - > current_ ) ; <nl> - isolate - > deoptimizer_data ( ) - > current_ = deoptimizer ; <nl> + isolate - > set_current_deoptimizer ( deoptimizer ) ; <nl> return deoptimizer ; <nl> } <nl> <nl> Deoptimizer * Deoptimizer : : Grab ( Isolate * isolate ) { <nl> - Deoptimizer * result = isolate - > deoptimizer_data ( ) - > current_ ; <nl> - CHECK_NOT_NULL ( result ) ; <nl> + Deoptimizer * result = isolate - > GetAndClearCurrentDeoptimizer ( ) ; <nl> result - > DeleteFrameDescriptions ( ) ; <nl> - isolate - > deoptimizer_data ( ) - > current_ = nullptr ; <nl> return result ; <nl> } <nl> <nl> const char * Deoptimizer : : MessageFor ( DeoptimizeKind kind , bool reuse_code ) { <nl> case DeoptimizeKind : : kBailout : <nl> return " bailout " ; <nl> } <nl> - FATAL ( " Unsupported deopt kind " ) ; <nl> - return nullptr ; <nl> } <nl> <nl> namespace { <nl> Deoptimizer : : Deoptimizer ( Isolate * isolate , JSFunction function , <nl> deoptimizing_throw_ = true ; <nl> } <nl> <nl> + DCHECK ( bailout_id_ = = kFixedExitSizeMarker | | <nl> + bailout_id_ < kMaxNumberOfEntries ) ; <nl> + <nl> DCHECK_NE ( from , kNullAddress ) ; <nl> compiled_code_ = FindOptimizedCode ( ) ; <nl> DCHECK ( ! compiled_code_ . is_null ( ) ) ; <nl> Deoptimizer : : Deoptimizer ( Isolate * isolate , JSFunction function , <nl> input_ = new ( size ) FrameDescription ( size , parameter_count ) ; <nl> <nl> if ( kSupportsFixedDeoptExitSizes ) { <nl> - DCHECK_EQ ( bailout_id_ , kMaxUInt32 ) ; <nl> + DCHECK_EQ ( bailout_id_ , kFixedExitSizeMarker ) ; <nl> / / Calculate bailout id from return address . <nl> DCHECK_GT ( kNonLazyDeoptExitSize , 0 ) ; <nl> DCHECK_GT ( kLazyDeoptExitSize , 0 ) ; <nl> Deoptimizer : : Deoptimizer ( Isolate * isolate , JSFunction function , <nl> Address lazy_deopt_start = <nl> deopt_start + non_lazy_deopt_count * kNonLazyDeoptExitSize ; <nl> / / The deoptimization exits are sorted so that lazy deopt exits appear last . <nl> - static_assert ( DeoptimizeKind : : kLazy = = DeoptimizeKind : : kLastDeoptimizeKind , <nl> + static_assert ( DeoptimizeKind : : kLazy = = kLastDeoptimizeKind , <nl> " lazy deopts are expected to be emitted last " ) ; <nl> / / from_ is the value of the link register after the call to the <nl> / / deoptimizer , so for the last lazy deopt , from_ points to the first <nl> void Deoptimizer : : DeleteFrameDescriptions ( ) { <nl> # endif / / DEBUG <nl> } <nl> <nl> - Address Deoptimizer : : GetDeoptimizationEntry ( Isolate * isolate , <nl> - DeoptimizeKind kind ) { <nl> - DeoptimizerData * data = isolate - > deoptimizer_data ( ) ; <nl> - CHECK_LE ( kind , DeoptimizerData : : kLastDeoptimizeKind ) ; <nl> - CHECK ( ! data - > deopt_entry_code ( kind ) . is_null ( ) ) ; <nl> - return data - > deopt_entry_code ( kind ) . raw_instruction_start ( ) ; <nl> - } <nl> - <nl> - bool Deoptimizer : : IsDeoptimizationEntry ( Isolate * isolate , Address addr , <nl> - DeoptimizeKind type ) { <nl> - DeoptimizerData * data = isolate - > deoptimizer_data ( ) ; <nl> - CHECK_LE ( type , DeoptimizerData : : kLastDeoptimizeKind ) ; <nl> - Code code = data - > deopt_entry_code ( type ) ; <nl> - if ( code . is_null ( ) ) return false ; <nl> - return addr = = code . raw_instruction_start ( ) ; <nl> + Builtins : : Name Deoptimizer : : GetDeoptimizationEntry ( Isolate * isolate , <nl> + DeoptimizeKind kind ) { <nl> + switch ( kind ) { <nl> + case DeoptimizeKind : : kEager : <nl> + return Builtins : : kDeoptimizationEntry_Eager ; <nl> + case DeoptimizeKind : : kSoft : <nl> + return Builtins : : kDeoptimizationEntry_Soft ; <nl> + case DeoptimizeKind : : kBailout : <nl> + return Builtins : : kDeoptimizationEntry_Bailout ; <nl> + case DeoptimizeKind : : kLazy : <nl> + return Builtins : : kDeoptimizationEntry_Lazy ; <nl> + } <nl> } <nl> <nl> bool Deoptimizer : : IsDeoptimizationEntry ( Isolate * isolate , Address addr , <nl> - DeoptimizeKind * type ) { <nl> - if ( IsDeoptimizationEntry ( isolate , addr , DeoptimizeKind : : kEager ) ) { <nl> - * type = DeoptimizeKind : : kEager ; <nl> - return true ; <nl> - } <nl> - if ( IsDeoptimizationEntry ( isolate , addr , DeoptimizeKind : : kSoft ) ) { <nl> - * type = DeoptimizeKind : : kSoft ; <nl> - return true ; <nl> - } <nl> - if ( IsDeoptimizationEntry ( isolate , addr , DeoptimizeKind : : kLazy ) ) { <nl> - * type = DeoptimizeKind : : kLazy ; <nl> - return true ; <nl> - } <nl> - if ( IsDeoptimizationEntry ( isolate , addr , DeoptimizeKind : : kBailout ) ) { <nl> - * type = DeoptimizeKind : : kBailout ; <nl> - return true ; <nl> + DeoptimizeKind * type_out ) { <nl> + Code maybe_code = InstructionStream : : TryLookupCode ( isolate , addr ) ; <nl> + if ( maybe_code . is_null ( ) ) return false ; <nl> + <nl> + Code code = maybe_code ; <nl> + switch ( code . builtin_index ( ) ) { <nl> + case Builtins : : kDeoptimizationEntry_Eager : <nl> + * type_out = DeoptimizeKind : : kEager ; <nl> + return true ; <nl> + case Builtins : : kDeoptimizationEntry_Soft : <nl> + * type_out = DeoptimizeKind : : kSoft ; <nl> + return true ; <nl> + case Builtins : : kDeoptimizationEntry_Bailout : <nl> + * type_out = DeoptimizeKind : : kBailout ; <nl> + return true ; <nl> + case Builtins : : kDeoptimizationEntry_Lazy : <nl> + * type_out = DeoptimizeKind : : kLazy ; <nl> + return true ; <nl> + default : <nl> + return false ; <nl> } <nl> - return false ; <nl> + <nl> + UNREACHABLE ( ) ; <nl> } <nl> <nl> int Deoptimizer : : GetDeoptimizedCodeCount ( Isolate * isolate ) { <nl> void Deoptimizer : : TraceDeoptMarked ( Isolate * isolate ) { <nl> / / without having a real stack frame in place . <nl> void Deoptimizer : : DoComputeOutputFrames ( ) { <nl> / / When we call this function , the return address of the previous frame has <nl> - / / been removed from the stack by GenerateDeoptimizationEntries ( ) so the stack <nl> - / / is not iterable by the SafeStackFrameIterator . <nl> + / / been removed from the stack by the DeoptimizationEntry builtin , so the <nl> + / / stack is not iterable by the SafeStackFrameIterator . <nl> # if V8_TARGET_ARCH_STORES_RETURN_ADDRESS_ON_STACK <nl> DCHECK_EQ ( 0 , isolate ( ) - > isolate_data ( ) - > stack_is_iterable ( ) ) ; <nl> # endif <nl> void Deoptimizer : : DoComputeOutputFrames ( ) { <nl> / / Do the input frame to output frame ( s ) translation . <nl> size_t count = translated_state_ . frames ( ) . size ( ) ; <nl> / / If we are supposed to go to the catch handler , find the catching frame <nl> - / / for the catch and make sure we only deoptimize upto that frame . <nl> + / / for the catch and make sure we only deoptimize up to that frame . <nl> if ( deoptimizing_throw_ ) { <nl> size_t catch_handler_frame_index = count ; <nl> for ( size_t i = count ; i - - > 0 ; ) { <nl> void Deoptimizer : : DoComputeInterpretedFrame ( TranslatedFrame * translated_frame , <nl> : builtins - > builtin ( Builtins : : kInterpreterEnterBytecodeDispatch ) ; <nl> if ( is_topmost ) { <nl> / / Only the pc of the topmost frame needs to be signed since it is <nl> - / / authenticated at the end of GenerateDeoptimizationEntries . <nl> + / / authenticated at the end of the DeoptimizationEntry builtin . <nl> const intptr_t top_most_pc = PointerAuthentication : : SignAndCheckPC ( <nl> static_cast < intptr_t > ( dispatch_builtin . InstructionStart ( ) ) , <nl> frame_writer . frame ( ) - > GetTop ( ) ) ; <nl> void Deoptimizer : : DoComputeConstructStubFrame ( TranslatedFrame * translated_frame , <nl> intptr_t pc_value = static_cast < intptr_t > ( start + pc_offset ) ; <nl> if ( is_topmost ) { <nl> / / Only the pc of the topmost frame needs to be signed since it is <nl> - / / authenticated at the end of GenerateDeoptimizationEntries . <nl> + / / authenticated at the end of the DeoptimizationEntry builtin . <nl> output_frame - > SetPc ( PointerAuthentication : : SignAndCheckPC ( <nl> pc_value , frame_writer . frame ( ) - > GetTop ( ) ) ) ; <nl> } else { <nl> void Deoptimizer : : DoComputeBuiltinContinuation ( <nl> mode , frame_info . frame_has_result_stack_slot ( ) ) ) ; <nl> if ( is_topmost ) { <nl> / / Only the pc of the topmost frame needs to be signed since it is <nl> - / / authenticated at the end of GenerateDeoptimizationEntries . <nl> + / / authenticated at the end of the DeoptimizationEntry builtin . <nl> const intptr_t top_most_pc = PointerAuthentication : : SignAndCheckPC ( <nl> static_cast < intptr_t > ( continue_to_builtin . InstructionStart ( ) ) , <nl> frame_writer . frame ( ) - > GetTop ( ) ) ; <nl> unsigned Deoptimizer : : ComputeIncomingArgumentSize ( SharedFunctionInfo shared ) { <nl> return parameter_slots * kSystemPointerSize ; <nl> } <nl> <nl> - void Deoptimizer : : EnsureCodeForDeoptimizationEntry ( Isolate * isolate , <nl> - DeoptimizeKind kind ) { <nl> - CHECK ( kind = = DeoptimizeKind : : kEager | | kind = = DeoptimizeKind : : kSoft | | <nl> - kind = = DeoptimizeKind : : kLazy | | kind = = DeoptimizeKind : : kBailout ) ; <nl> - DeoptimizerData * data = isolate - > deoptimizer_data ( ) ; <nl> - if ( ! data - > deopt_entry_code ( kind ) . is_null ( ) ) return ; <nl> - <nl> - MacroAssembler masm ( isolate , CodeObjectRequired : : kYes , <nl> - NewAssemblerBuffer ( 16 * KB ) ) ; <nl> - masm . set_emit_debug_code ( false ) ; <nl> - GenerateDeoptimizationEntries ( & masm , masm . isolate ( ) , kind ) ; <nl> - CodeDesc desc ; <nl> - masm . GetCode ( isolate , & desc ) ; <nl> - DCHECK ( ! RelocInfo : : RequiresRelocationAfterCodegen ( desc ) ) ; <nl> - <nl> - / / Allocate the code as immovable since the entry addresses will be used <nl> - / / directly and there is no support for relocating them . <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . set_immovable ( ) <nl> - . Build ( ) ; <nl> - CHECK ( isolate - > heap ( ) - > IsImmovable ( * code ) ) ; <nl> - <nl> - CHECK ( data - > deopt_entry_code ( kind ) . is_null ( ) ) ; <nl> - data - > set_deopt_entry_code ( kind , * code ) ; <nl> - } <nl> - <nl> - void Deoptimizer : : EnsureCodeForDeoptimizationEntries ( Isolate * isolate ) { <nl> - EnsureCodeForDeoptimizationEntry ( isolate , DeoptimizeKind : : kEager ) ; <nl> - EnsureCodeForDeoptimizationEntry ( isolate , DeoptimizeKind : : kLazy ) ; <nl> - EnsureCodeForDeoptimizationEntry ( isolate , DeoptimizeKind : : kSoft ) ; <nl> - EnsureCodeForDeoptimizationEntry ( isolate , DeoptimizeKind : : kBailout ) ; <nl> - } <nl> - <nl> FrameDescription : : FrameDescription ( uint32_t frame_size , int parameter_count ) <nl> : frame_size_ ( frame_size ) , <nl> parameter_count_ ( parameter_count ) , <nl> mmm a / src / deoptimizer / deoptimizer . h <nl> ppp b / src / deoptimizer / deoptimizer . h <nl> class Deoptimizer : public Malloced { <nl> <nl> static void ComputeOutputFrames ( Deoptimizer * deoptimizer ) ; <nl> <nl> - static Address GetDeoptimizationEntry ( Isolate * isolate , DeoptimizeKind kind ) ; <nl> + V8_EXPORT_PRIVATE static Builtins : : Name GetDeoptimizationEntry ( <nl> + Isolate * isolate , DeoptimizeKind kind ) ; <nl> <nl> / / Returns true if { addr } is a deoptimization entry and stores its type in <nl> - / / { type } . Returns false if { addr } is not a deoptimization entry . <nl> + / / { type_out } . Returns false if { addr } is not a deoptimization entry . <nl> static bool IsDeoptimizationEntry ( Isolate * isolate , Address addr , <nl> - DeoptimizeKind * type ) ; <nl> + DeoptimizeKind * type_out ) ; <nl> <nl> / / Code generation support . <nl> static int input_offset ( ) { return offsetof ( Deoptimizer , input_ ) ; } <nl> class Deoptimizer : public Malloced { <nl> <nl> V8_EXPORT_PRIVATE static int GetDeoptimizedCodeCount ( Isolate * isolate ) ; <nl> <nl> - static const int kNotDeoptimizationEntry = - 1 ; <nl> - <nl> - static void EnsureCodeForDeoptimizationEntry ( Isolate * isolate , <nl> - DeoptimizeKind kind ) ; <nl> - static void EnsureCodeForDeoptimizationEntries ( Isolate * isolate ) ; <nl> - <nl> Isolate * isolate ( ) const { return isolate_ ; } <nl> <nl> - static const int kMaxNumberOfEntries = 16384 ; <nl> + static constexpr int kMaxNumberOfEntries = 16384 ; <nl> + <nl> + / / This marker is passed to Deoptimizer : : New as { bailout_id } on platforms <nl> + / / that have fixed deopt sizes ( see also kSupportsFixedDeoptExitSizes ) . The <nl> + / / actual deoptimization id is then calculated from the return address . <nl> + static constexpr unsigned kFixedExitSizeMarker = kMaxUInt32 ; <nl> <nl> / / Set to true when the architecture supports deoptimization exit sequences <nl> / / of a fixed size , that can be sorted so that the deoptimization index is <nl> / / deduced from the address of the deoptimization exit . <nl> - static const bool kSupportsFixedDeoptExitSizes ; <nl> + / / TODO ( jgruber ) : Remove this , and support for variable deopt exit sizes , <nl> + / / once all architectures use fixed exit sizes . <nl> + V8_EXPORT_PRIVATE static const bool kSupportsFixedDeoptExitSizes ; <nl> <nl> / / Size of deoptimization exit sequence . This is only meaningful when <nl> / / kSupportsFixedDeoptExitSizes is true . <nl> - static const int kNonLazyDeoptExitSize ; <nl> - static const int kLazyDeoptExitSize ; <nl> + V8_EXPORT_PRIVATE static const int kNonLazyDeoptExitSize ; <nl> + V8_EXPORT_PRIVATE static const int kLazyDeoptExitSize ; <nl> <nl> / / Tracing . <nl> static void TraceMarkForDeoptimization ( Code code , const char * reason ) ; <nl> class Deoptimizer : public Malloced { <nl> Code FindOptimizedCode ( ) ; <nl> void DeleteFrameDescriptions ( ) ; <nl> <nl> - static bool IsDeoptimizationEntry ( Isolate * isolate , Address addr , <nl> - DeoptimizeKind type ) ; <nl> - <nl> void DoComputeOutputFrames ( ) ; <nl> void DoComputeInterpretedFrame ( TranslatedFrame * translated_frame , <nl> int frame_index , bool goto_catch_handler ) ; <nl> class Deoptimizer : public Malloced { <nl> static unsigned ComputeIncomingArgumentSize ( SharedFunctionInfo shared ) ; <nl> static unsigned ComputeOutgoingArgumentSize ( Code code , unsigned bailout_id ) ; <nl> <nl> - static void GenerateDeoptimizationEntries ( MacroAssembler * masm , <nl> - Isolate * isolate , <nl> - DeoptimizeKind kind ) ; <nl> - <nl> static void MarkAllCodeForContext ( NativeContext native_context ) ; <nl> static void DeoptimizeMarkedCodeForContext ( NativeContext native_context ) ; <nl> / / Searches the list of known deoptimizing code for a Code object <nl> class FrameDescription { <nl> } <nl> } ; <nl> <nl> - class DeoptimizerData { <nl> - public : <nl> - explicit DeoptimizerData ( Heap * heap ) ; <nl> - ~ DeoptimizerData ( ) ; <nl> - <nl> - # ifdef DEBUG <nl> - bool IsDeoptEntryCode ( Code code ) const { <nl> - for ( int i = 0 ; i < kLastDeoptimizeKind + 1 ; i + + ) { <nl> - if ( code = = deopt_entry_code_ [ i ] ) return true ; <nl> - } <nl> - return false ; <nl> - } <nl> - # endif / / DEBUG <nl> - <nl> - private : <nl> - Heap * heap_ ; <nl> - static const int kLastDeoptimizeKind = <nl> - static_cast < int > ( DeoptimizeKind : : kLastDeoptimizeKind ) ; <nl> - Code deopt_entry_code_ [ kLastDeoptimizeKind + 1 ] ; <nl> - Code deopt_entry_code ( DeoptimizeKind kind ) ; <nl> - void set_deopt_entry_code ( DeoptimizeKind kind , Code code ) ; <nl> - <nl> - Deoptimizer * current_ ; <nl> - StrongRootsEntry * strong_roots_entry_ ; <nl> - <nl> - friend class Deoptimizer ; <nl> - <nl> - DISALLOW_COPY_AND_ASSIGN ( DeoptimizerData ) ; <nl> - } ; <nl> - <nl> class TranslationBuffer { <nl> public : <nl> explicit TranslationBuffer ( Zone * zone ) : contents_ ( zone ) { } <nl> mmm a / src / deoptimizer / ia32 / deoptimizer - ia32 . cc <nl> ppp b / src / deoptimizer / ia32 / deoptimizer - ia32 . cc <nl> <nl> <nl> # if V8_TARGET_ARCH_IA32 <nl> <nl> - # include " src / codegen / macro - assembler . h " <nl> - # include " src / codegen / register - configuration . h " <nl> - # include " src / codegen / safepoint - table . h " <nl> # include " src / deoptimizer / deoptimizer . h " <nl> - # include " src / execution / frame - constants . h " <nl> <nl> namespace v8 { <nl> namespace internal { <nl> <nl> - const bool Deoptimizer : : kSupportsFixedDeoptExitSizes = false ; <nl> - const int Deoptimizer : : kNonLazyDeoptExitSize = 0 ; <nl> - const int Deoptimizer : : kLazyDeoptExitSize = 0 ; <nl> - <nl> - # define __ masm - > <nl> - <nl> - void Deoptimizer : : GenerateDeoptimizationEntries ( MacroAssembler * masm , <nl> - Isolate * isolate , <nl> - DeoptimizeKind deopt_kind ) { <nl> - NoRootArrayScope no_root_array ( masm ) ; <nl> - <nl> - / / Save all general purpose registers before messing with them . <nl> - const int kNumberOfRegisters = Register : : kNumRegisters ; <nl> - <nl> - const int kDoubleRegsSize = kDoubleSize * XMMRegister : : kNumRegisters ; <nl> - __ AllocateStackSpace ( kDoubleRegsSize ) ; <nl> - const RegisterConfiguration * config = RegisterConfiguration : : Default ( ) ; <nl> - for ( int i = 0 ; i < config - > num_allocatable_double_registers ( ) ; + + i ) { <nl> - int code = config - > GetAllocatableDoubleCode ( i ) ; <nl> - XMMRegister xmm_reg = XMMRegister : : from_code ( code ) ; <nl> - int offset = code * kDoubleSize ; <nl> - __ movsd ( Operand ( esp , offset ) , xmm_reg ) ; <nl> - } <nl> - <nl> - __ pushad ( ) ; <nl> - <nl> - ExternalReference c_entry_fp_address = <nl> - ExternalReference : : Create ( IsolateAddressId : : kCEntryFPAddress , isolate ) ; <nl> - __ mov ( masm - > ExternalReferenceAsOperand ( c_entry_fp_address , esi ) , ebp ) ; <nl> - <nl> - const int kSavedRegistersAreaSize = <nl> - kNumberOfRegisters * kSystemPointerSize + kDoubleRegsSize ; <nl> - <nl> - / / The bailout id is passed in ebx by the caller . <nl> - <nl> - / / Get the address of the location in the code object <nl> - / / and compute the fp - to - sp delta in register edx . <nl> - __ mov ( ecx , Operand ( esp , kSavedRegistersAreaSize ) ) ; <nl> - __ lea ( edx , Operand ( esp , kSavedRegistersAreaSize + 1 * kSystemPointerSize ) ) ; <nl> - <nl> - __ sub ( edx , ebp ) ; <nl> - __ neg ( edx ) ; <nl> - <nl> - / / Allocate a new deoptimizer object . <nl> - __ PrepareCallCFunction ( 6 , eax ) ; <nl> - __ mov ( eax , Immediate ( 0 ) ) ; <nl> - Label context_check ; <nl> - __ mov ( edi , Operand ( ebp , CommonFrameConstants : : kContextOrFrameTypeOffset ) ) ; <nl> - __ JumpIfSmi ( edi , & context_check ) ; <nl> - __ mov ( eax , Operand ( ebp , StandardFrameConstants : : kFunctionOffset ) ) ; <nl> - __ bind ( & context_check ) ; <nl> - __ mov ( Operand ( esp , 0 * kSystemPointerSize ) , eax ) ; / / Function . <nl> - __ mov ( Operand ( esp , 1 * kSystemPointerSize ) , <nl> - Immediate ( static_cast < int > ( deopt_kind ) ) ) ; <nl> - __ mov ( Operand ( esp , 2 * kSystemPointerSize ) , ebx ) ; / / Bailout id . <nl> - __ mov ( Operand ( esp , 3 * kSystemPointerSize ) , ecx ) ; / / Code address or 0 . <nl> - __ mov ( Operand ( esp , 4 * kSystemPointerSize ) , edx ) ; / / Fp - to - sp delta . <nl> - __ mov ( Operand ( esp , 5 * kSystemPointerSize ) , <nl> - Immediate ( ExternalReference : : isolate_address ( isolate ) ) ) ; <nl> - { <nl> - AllowExternalCallThatCantCauseGC scope ( masm ) ; <nl> - __ CallCFunction ( ExternalReference : : new_deoptimizer_function ( ) , 6 ) ; <nl> - } <nl> - <nl> - / / Preserve deoptimizer object in register eax and get the input <nl> - / / frame descriptor pointer . <nl> - __ mov ( esi , Operand ( eax , Deoptimizer : : input_offset ( ) ) ) ; <nl> - <nl> - / / Fill in the input registers . <nl> - for ( int i = kNumberOfRegisters - 1 ; i > = 0 ; i - - ) { <nl> - int offset = <nl> - ( i * kSystemPointerSize ) + FrameDescription : : registers_offset ( ) ; <nl> - __ pop ( Operand ( esi , offset ) ) ; <nl> - } <nl> - <nl> - int double_regs_offset = FrameDescription : : double_registers_offset ( ) ; <nl> - / / Fill in the double input registers . <nl> - for ( int i = 0 ; i < config - > num_allocatable_double_registers ( ) ; + + i ) { <nl> - int code = config - > GetAllocatableDoubleCode ( i ) ; <nl> - int dst_offset = code * kDoubleSize + double_regs_offset ; <nl> - int src_offset = code * kDoubleSize ; <nl> - __ movsd ( xmm0 , Operand ( esp , src_offset ) ) ; <nl> - __ movsd ( Operand ( esi , dst_offset ) , xmm0 ) ; <nl> - } <nl> - <nl> - / / Clear FPU all exceptions . <nl> - / / TODO ( ulan ) : Find out why the TOP register is not zero here in some cases , <nl> - / / and check that the generated code never deoptimizes with unbalanced stack . <nl> - __ fnclex ( ) ; <nl> - <nl> - / / Mark the stack as not iterable for the CPU profiler which won ' t be able to <nl> - / / walk the stack without the return address . <nl> - __ mov_b ( __ ExternalReferenceAsOperand ( <nl> - ExternalReference : : stack_is_iterable_address ( isolate ) , edx ) , <nl> - Immediate ( 0 ) ) ; <nl> - <nl> - / / Remove the return address and the double registers . <nl> - __ add ( esp , Immediate ( kDoubleRegsSize + 1 * kSystemPointerSize ) ) ; <nl> - <nl> - / / Compute a pointer to the unwinding limit in register ecx ; that is <nl> - / / the first stack slot not part of the input frame . <nl> - __ mov ( ecx , Operand ( esi , FrameDescription : : frame_size_offset ( ) ) ) ; <nl> - __ add ( ecx , esp ) ; <nl> - <nl> - / / Unwind the stack down to - but not including - the unwinding <nl> - / / limit and copy the contents of the activation frame to the input <nl> - / / frame description . <nl> - __ lea ( edx , Operand ( esi , FrameDescription : : frame_content_offset ( ) ) ) ; <nl> - Label pop_loop_header ; <nl> - __ jmp ( & pop_loop_header ) ; <nl> - Label pop_loop ; <nl> - __ bind ( & pop_loop ) ; <nl> - __ pop ( Operand ( edx , 0 ) ) ; <nl> - __ add ( edx , Immediate ( sizeof ( uint32_t ) ) ) ; <nl> - __ bind ( & pop_loop_header ) ; <nl> - __ cmp ( ecx , esp ) ; <nl> - __ j ( not_equal , & pop_loop ) ; <nl> - <nl> - / / Compute the output frame in the deoptimizer . <nl> - __ push ( eax ) ; <nl> - __ PrepareCallCFunction ( 1 , esi ) ; <nl> - __ mov ( Operand ( esp , 0 * kSystemPointerSize ) , eax ) ; <nl> - { <nl> - AllowExternalCallThatCantCauseGC scope ( masm ) ; <nl> - __ CallCFunction ( ExternalReference : : compute_output_frames_function ( ) , 1 ) ; <nl> - } <nl> - __ pop ( eax ) ; <nl> - <nl> - __ mov ( esp , Operand ( eax , Deoptimizer : : caller_frame_top_offset ( ) ) ) ; <nl> - <nl> - / / Replace the current ( input ) frame with the output frames . <nl> - Label outer_push_loop , inner_push_loop , outer_loop_header , inner_loop_header ; <nl> - / / Outer loop state : eax = current FrameDescription * * , edx = one <nl> - / / past the last FrameDescription * * . <nl> - __ mov ( edx , Operand ( eax , Deoptimizer : : output_count_offset ( ) ) ) ; <nl> - __ mov ( eax , Operand ( eax , Deoptimizer : : output_offset ( ) ) ) ; <nl> - __ lea ( edx , Operand ( eax , edx , times_system_pointer_size , 0 ) ) ; <nl> - __ jmp ( & outer_loop_header ) ; <nl> - __ bind ( & outer_push_loop ) ; <nl> - / / Inner loop state : esi = current FrameDescription * , ecx = loop <nl> - / / index . <nl> - __ mov ( esi , Operand ( eax , 0 ) ) ; <nl> - __ mov ( ecx , Operand ( esi , FrameDescription : : frame_size_offset ( ) ) ) ; <nl> - __ jmp ( & inner_loop_header ) ; <nl> - __ bind ( & inner_push_loop ) ; <nl> - __ sub ( ecx , Immediate ( sizeof ( uint32_t ) ) ) ; <nl> - __ push ( Operand ( esi , ecx , times_1 , FrameDescription : : frame_content_offset ( ) ) ) ; <nl> - __ bind ( & inner_loop_header ) ; <nl> - __ test ( ecx , ecx ) ; <nl> - __ j ( not_zero , & inner_push_loop ) ; <nl> - __ add ( eax , Immediate ( kSystemPointerSize ) ) ; <nl> - __ bind ( & outer_loop_header ) ; <nl> - __ cmp ( eax , edx ) ; <nl> - __ j ( below , & outer_push_loop ) ; <nl> - <nl> - / / In case of a failed STUB , we have to restore the XMM registers . <nl> - for ( int i = 0 ; i < config - > num_allocatable_double_registers ( ) ; + + i ) { <nl> - int code = config - > GetAllocatableDoubleCode ( i ) ; <nl> - XMMRegister xmm_reg = XMMRegister : : from_code ( code ) ; <nl> - int src_offset = code * kDoubleSize + double_regs_offset ; <nl> - __ movsd ( xmm_reg , Operand ( esi , src_offset ) ) ; <nl> - } <nl> - <nl> - / / Push pc and continuation from the last output frame . <nl> - __ push ( Operand ( esi , FrameDescription : : pc_offset ( ) ) ) ; <nl> - __ push ( Operand ( esi , FrameDescription : : continuation_offset ( ) ) ) ; <nl> - <nl> - / / Push the registers from the last output frame . <nl> - for ( int i = 0 ; i < kNumberOfRegisters ; i + + ) { <nl> - int offset = <nl> - ( i * kSystemPointerSize ) + FrameDescription : : registers_offset ( ) ; <nl> - __ push ( Operand ( esi , offset ) ) ; <nl> - } <nl> - <nl> - __ mov_b ( __ ExternalReferenceAsOperand ( <nl> - ExternalReference : : stack_is_iterable_address ( isolate ) , edx ) , <nl> - Immediate ( 1 ) ) ; <nl> - <nl> - / / Restore the registers from the stack . <nl> - __ popad ( ) ; <nl> - <nl> - __ InitializeRootRegister ( ) ; <nl> - <nl> - / / Return to the continuation point . <nl> - __ ret ( 0 ) ; <nl> - } <nl> + const bool Deoptimizer : : kSupportsFixedDeoptExitSizes = true ; <nl> + const int Deoptimizer : : kNonLazyDeoptExitSize = 5 ; <nl> + const int Deoptimizer : : kLazyDeoptExitSize = 5 ; <nl> <nl> Float32 RegisterValues : : GetFloatRegister ( unsigned n ) const { <nl> return Float32 : : FromBits ( <nl> void FrameDescription : : SetCallerConstantPool ( unsigned offset , intptr_t value ) { <nl> <nl> void FrameDescription : : SetPc ( intptr_t pc ) { pc_ = pc ; } <nl> <nl> - # undef __ <nl> - <nl> } / / namespace internal <nl> } / / namespace v8 <nl> <nl> mmm a / src / deoptimizer / x64 / deoptimizer - x64 . cc <nl> ppp b / src / deoptimizer / x64 / deoptimizer - x64 . cc <nl> <nl> <nl> # if V8_TARGET_ARCH_X64 <nl> <nl> - # include " src / codegen / macro - assembler . h " <nl> - # include " src / codegen / register - configuration . h " <nl> - # include " src / codegen / safepoint - table . h " <nl> # include " src / deoptimizer / deoptimizer . h " <nl> - # include " src / objects / objects - inl . h " <nl> <nl> namespace v8 { <nl> namespace internal { <nl> <nl> - const bool Deoptimizer : : kSupportsFixedDeoptExitSizes = false ; <nl> - const int Deoptimizer : : kNonLazyDeoptExitSize = 0 ; <nl> - const int Deoptimizer : : kLazyDeoptExitSize = 0 ; <nl> - <nl> - # define __ masm - > <nl> - <nl> - void Deoptimizer : : GenerateDeoptimizationEntries ( MacroAssembler * masm , <nl> - Isolate * isolate , <nl> - DeoptimizeKind deopt_kind ) { <nl> - NoRootArrayScope no_root_array ( masm ) ; <nl> - <nl> - / / Save all general purpose registers before messing with them . <nl> - const int kNumberOfRegisters = Register : : kNumRegisters ; <nl> - <nl> - const int kDoubleRegsSize = kDoubleSize * XMMRegister : : kNumRegisters ; <nl> - __ AllocateStackSpace ( kDoubleRegsSize ) ; <nl> - <nl> - const RegisterConfiguration * config = RegisterConfiguration : : Default ( ) ; <nl> - for ( int i = 0 ; i < config - > num_allocatable_double_registers ( ) ; + + i ) { <nl> - int code = config - > GetAllocatableDoubleCode ( i ) ; <nl> - XMMRegister xmm_reg = XMMRegister : : from_code ( code ) ; <nl> - int offset = code * kDoubleSize ; <nl> - __ Movsd ( Operand ( rsp , offset ) , xmm_reg ) ; <nl> - } <nl> - <nl> - / / We push all registers onto the stack , even though we do not need <nl> - / / to restore all later . <nl> - for ( int i = 0 ; i < kNumberOfRegisters ; i + + ) { <nl> - Register r = Register : : from_code ( i ) ; <nl> - __ pushq ( r ) ; <nl> - } <nl> - <nl> - const int kSavedRegistersAreaSize = <nl> - kNumberOfRegisters * kSystemPointerSize + kDoubleRegsSize ; <nl> - <nl> - __ Store ( <nl> - ExternalReference : : Create ( IsolateAddressId : : kCEntryFPAddress , isolate ) , <nl> - rbp ) ; <nl> - <nl> - / / We use this to keep the value of the fifth argument temporarily . <nl> - / / Unfortunately we can ' t store it directly in r8 ( used for passing <nl> - / / this on linux ) , since it is another parameter passing register on windows . <nl> - Register arg5 = r11 ; <nl> - <nl> - / / The bailout id is passed using r13 on the stack . <nl> - __ movq ( arg_reg_3 , r13 ) ; <nl> - <nl> - / / Get the address of the location in the code object <nl> - / / and compute the fp - to - sp delta in register arg5 . <nl> - __ movq ( arg_reg_4 , Operand ( rsp , kSavedRegistersAreaSize ) ) ; <nl> - __ leaq ( arg5 , Operand ( rsp , kSavedRegistersAreaSize + kPCOnStackSize ) ) ; <nl> - <nl> - __ subq ( arg5 , rbp ) ; <nl> - __ negq ( arg5 ) ; <nl> - <nl> - / / Allocate a new deoptimizer object . <nl> - __ PrepareCallCFunction ( 6 ) ; <nl> - __ movq ( rax , Immediate ( 0 ) ) ; <nl> - Label context_check ; <nl> - __ movq ( rdi , Operand ( rbp , CommonFrameConstants : : kContextOrFrameTypeOffset ) ) ; <nl> - __ JumpIfSmi ( rdi , & context_check ) ; <nl> - __ movq ( rax , Operand ( rbp , StandardFrameConstants : : kFunctionOffset ) ) ; <nl> - __ bind ( & context_check ) ; <nl> - __ movq ( arg_reg_1 , rax ) ; <nl> - __ Set ( arg_reg_2 , static_cast < int > ( deopt_kind ) ) ; <nl> - / / Args 3 and 4 are already in the right registers . <nl> - <nl> - / / On windows put the arguments on the stack ( PrepareCallCFunction <nl> - / / has created space for this ) . On linux pass the arguments in r8 and r9 . <nl> - # ifdef V8_TARGET_OS_WIN <nl> - __ movq ( Operand ( rsp , 4 * kSystemPointerSize ) , arg5 ) ; <nl> - __ LoadAddress ( arg5 , ExternalReference : : isolate_address ( isolate ) ) ; <nl> - __ movq ( Operand ( rsp , 5 * kSystemPointerSize ) , arg5 ) ; <nl> - # else <nl> - __ movq ( r8 , arg5 ) ; <nl> - __ LoadAddress ( r9 , ExternalReference : : isolate_address ( isolate ) ) ; <nl> - # endif <nl> - <nl> - { <nl> - AllowExternalCallThatCantCauseGC scope ( masm ) ; <nl> - __ CallCFunction ( ExternalReference : : new_deoptimizer_function ( ) , 6 ) ; <nl> - } <nl> - / / Preserve deoptimizer object in register rax and get the input <nl> - / / frame descriptor pointer . <nl> - __ movq ( rbx , Operand ( rax , Deoptimizer : : input_offset ( ) ) ) ; <nl> - <nl> - / / Fill in the input registers . <nl> - for ( int i = kNumberOfRegisters - 1 ; i > = 0 ; i - - ) { <nl> - int offset = <nl> - ( i * kSystemPointerSize ) + FrameDescription : : registers_offset ( ) ; <nl> - __ PopQuad ( Operand ( rbx , offset ) ) ; <nl> - } <nl> - <nl> - / / Fill in the double input registers . <nl> - int double_regs_offset = FrameDescription : : double_registers_offset ( ) ; <nl> - for ( int i = 0 ; i < XMMRegister : : kNumRegisters ; i + + ) { <nl> - int dst_offset = i * kDoubleSize + double_regs_offset ; <nl> - __ popq ( Operand ( rbx , dst_offset ) ) ; <nl> - } <nl> - <nl> - / / Mark the stack as not iterable for the CPU profiler which won ' t be able to <nl> - / / walk the stack without the return address . <nl> - __ movb ( __ ExternalReferenceAsOperand ( <nl> - ExternalReference : : stack_is_iterable_address ( isolate ) ) , <nl> - Immediate ( 0 ) ) ; <nl> - <nl> - / / Remove the return address from the stack . <nl> - __ addq ( rsp , Immediate ( kPCOnStackSize ) ) ; <nl> - <nl> - / / Compute a pointer to the unwinding limit in register rcx ; that is <nl> - / / the first stack slot not part of the input frame . <nl> - __ movq ( rcx , Operand ( rbx , FrameDescription : : frame_size_offset ( ) ) ) ; <nl> - __ addq ( rcx , rsp ) ; <nl> - <nl> - / / Unwind the stack down to - but not including - the unwinding <nl> - / / limit and copy the contents of the activation frame to the input <nl> - / / frame description . <nl> - __ leaq ( rdx , Operand ( rbx , FrameDescription : : frame_content_offset ( ) ) ) ; <nl> - Label pop_loop_header ; <nl> - __ jmp ( & pop_loop_header ) ; <nl> - Label pop_loop ; <nl> - __ bind ( & pop_loop ) ; <nl> - __ Pop ( Operand ( rdx , 0 ) ) ; <nl> - __ addq ( rdx , Immediate ( sizeof ( intptr_t ) ) ) ; <nl> - __ bind ( & pop_loop_header ) ; <nl> - __ cmpq ( rcx , rsp ) ; <nl> - __ j ( not_equal , & pop_loop ) ; <nl> - <nl> - / / Compute the output frame in the deoptimizer . <nl> - __ pushq ( rax ) ; <nl> - __ PrepareCallCFunction ( 2 ) ; <nl> - __ movq ( arg_reg_1 , rax ) ; <nl> - __ LoadAddress ( arg_reg_2 , ExternalReference : : isolate_address ( isolate ) ) ; <nl> - { <nl> - AllowExternalCallThatCantCauseGC scope ( masm ) ; <nl> - __ CallCFunction ( ExternalReference : : compute_output_frames_function ( ) , 2 ) ; <nl> - } <nl> - __ popq ( rax ) ; <nl> - <nl> - __ movq ( rsp , Operand ( rax , Deoptimizer : : caller_frame_top_offset ( ) ) ) ; <nl> - <nl> - / / Replace the current ( input ) frame with the output frames . <nl> - Label outer_push_loop , inner_push_loop , outer_loop_header , inner_loop_header ; <nl> - / / Outer loop state : rax = current FrameDescription * * , rdx = one past the <nl> - / / last FrameDescription * * . <nl> - __ movl ( rdx , Operand ( rax , Deoptimizer : : output_count_offset ( ) ) ) ; <nl> - __ movq ( rax , Operand ( rax , Deoptimizer : : output_offset ( ) ) ) ; <nl> - __ leaq ( rdx , Operand ( rax , rdx , times_system_pointer_size , 0 ) ) ; <nl> - __ jmp ( & outer_loop_header ) ; <nl> - __ bind ( & outer_push_loop ) ; <nl> - / / Inner loop state : rbx = current FrameDescription * , rcx = loop index . <nl> - __ movq ( rbx , Operand ( rax , 0 ) ) ; <nl> - __ movq ( rcx , Operand ( rbx , FrameDescription : : frame_size_offset ( ) ) ) ; <nl> - __ jmp ( & inner_loop_header ) ; <nl> - __ bind ( & inner_push_loop ) ; <nl> - __ subq ( rcx , Immediate ( sizeof ( intptr_t ) ) ) ; <nl> - __ Push ( Operand ( rbx , rcx , times_1 , FrameDescription : : frame_content_offset ( ) ) ) ; <nl> - __ bind ( & inner_loop_header ) ; <nl> - __ testq ( rcx , rcx ) ; <nl> - __ j ( not_zero , & inner_push_loop ) ; <nl> - __ addq ( rax , Immediate ( kSystemPointerSize ) ) ; <nl> - __ bind ( & outer_loop_header ) ; <nl> - __ cmpq ( rax , rdx ) ; <nl> - __ j ( below , & outer_push_loop ) ; <nl> - <nl> - for ( int i = 0 ; i < config - > num_allocatable_double_registers ( ) ; + + i ) { <nl> - int code = config - > GetAllocatableDoubleCode ( i ) ; <nl> - XMMRegister xmm_reg = XMMRegister : : from_code ( code ) ; <nl> - int src_offset = code * kDoubleSize + double_regs_offset ; <nl> - __ Movsd ( xmm_reg , Operand ( rbx , src_offset ) ) ; <nl> - } <nl> - <nl> - / / Push pc and continuation from the last output frame . <nl> - __ PushQuad ( Operand ( rbx , FrameDescription : : pc_offset ( ) ) ) ; <nl> - __ PushQuad ( Operand ( rbx , FrameDescription : : continuation_offset ( ) ) ) ; <nl> - <nl> - / / Push the registers from the last output frame . <nl> - for ( int i = 0 ; i < kNumberOfRegisters ; i + + ) { <nl> - int offset = <nl> - ( i * kSystemPointerSize ) + FrameDescription : : registers_offset ( ) ; <nl> - __ PushQuad ( Operand ( rbx , offset ) ) ; <nl> - } <nl> - <nl> - / / Restore the registers from the stack . <nl> - for ( int i = kNumberOfRegisters - 1 ; i > = 0 ; i - - ) { <nl> - Register r = Register : : from_code ( i ) ; <nl> - / / Do not restore rsp , simply pop the value into the next register <nl> - / / and overwrite this afterwards . <nl> - if ( r = = rsp ) { <nl> - DCHECK_GT ( i , 0 ) ; <nl> - r = Register : : from_code ( i - 1 ) ; <nl> - } <nl> - __ popq ( r ) ; <nl> - } <nl> - <nl> - __ movb ( __ ExternalReferenceAsOperand ( <nl> - ExternalReference : : stack_is_iterable_address ( isolate ) ) , <nl> - Immediate ( 1 ) ) ; <nl> - <nl> - / / Return to the continuation point . <nl> - __ ret ( 0 ) ; <nl> - } <nl> + const bool Deoptimizer : : kSupportsFixedDeoptExitSizes = true ; <nl> + const int Deoptimizer : : kNonLazyDeoptExitSize = 7 ; <nl> + const int Deoptimizer : : kLazyDeoptExitSize = 7 ; <nl> <nl> Float32 RegisterValues : : GetFloatRegister ( unsigned n ) const { <nl> return Float32 : : FromBits ( <nl> void FrameDescription : : SetCallerConstantPool ( unsigned offset , intptr_t value ) { <nl> <nl> void FrameDescription : : SetPc ( intptr_t pc ) { pc_ = pc ; } <nl> <nl> - # undef __ <nl> - <nl> } / / namespace internal <nl> } / / namespace v8 <nl> <nl> mmm a / src / diagnostics / disassembler . cc <nl> ppp b / src / diagnostics / disassembler . cc <nl> static void PrintRelocInfo ( StringBuilder * out , Isolate * isolate , <nl> host . as_wasm_code ( ) - > native_module ( ) - > GetRuntimeStubId ( <nl> relocinfo - > wasm_stub_call_address ( ) ) ) ; <nl> out - > AddFormatted ( " ; ; wasm stub : % s " , runtime_stub_name ) ; <nl> - } else if ( RelocInfo : : IsRuntimeEntry ( rmode ) & & isolate & & <nl> - isolate - > deoptimizer_data ( ) ! = nullptr ) { <nl> + } else if ( RelocInfo : : IsRuntimeEntry ( rmode ) & & isolate ! = nullptr ) { <nl> / / A runtime entry relocinfo might be a deoptimization bailout . <nl> Address addr = relocinfo - > target_address ( ) ; <nl> DeoptimizeKind type ; <nl> mmm a / src / diagnostics / objects - printer . cc <nl> ppp b / src / diagnostics / objects - printer . cc <nl> void JSFunction : : JSFunctionPrint ( std : : ostream & os ) { / / NOLINT <nl> os < < " \ n - kind : " < < shared ( ) . kind ( ) ; <nl> os < < " \ n - context : " < < Brief ( context ( ) ) ; <nl> os < < " \ n - code : " < < Brief ( code ( ) ) ; <nl> - if ( code ( ) . kind ( ) = = CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) { <nl> - os < < " \ n - FunctionTester function " ; <nl> - <nl> + if ( code ( ) . kind ( ) = = CodeKind : : FOR_TESTING ) { <nl> + os < < " \ n - FOR_TESTING " ; <nl> } else if ( ActiveTierIsIgnition ( ) ) { <nl> os < < " \ n - interpreted " ; <nl> if ( shared ( ) . HasBytecodeArray ( ) ) { <nl> mmm a / src / execution / isolate - data . h <nl> ppp b / src / execution / isolate - data . h <nl> class IsolateData final { <nl> static constexpr int builtin_entry_table_offset ( ) { <nl> return kBuiltinEntryTableOffset - kIsolateRootBias ; <nl> } <nl> + static constexpr int builtin_entry_slot_offset ( Builtins : : Name builtin_index ) { <nl> + CONSTEXPR_DCHECK ( Builtins : : IsBuiltinId ( builtin_index ) ) ; <nl> + return builtin_entry_table_offset ( ) + builtin_index * kSystemPointerSize ; <nl> + } <nl> <nl> / / Root - register - relative offset of the builtins table . <nl> static constexpr int builtins_table_offset ( ) { <nl> mmm a / src / execution / isolate . cc <nl> ppp b / src / execution / isolate . cc <nl> void Isolate : : Deinit ( ) { <nl> <nl> ReleaseSharedPtrs ( ) ; <nl> <nl> - delete deoptimizer_data_ ; <nl> - deoptimizer_data_ = nullptr ; <nl> string_table_ . reset ( ) ; <nl> builtins_ . TearDown ( ) ; <nl> bootstrapper_ - > TearDown ( ) ; <nl> bool Isolate : : Init ( SnapshotData * startup_snapshot_data , <nl> } <nl> DCHECK_NOT_NULL ( wasm_engine_ ) ; <nl> <nl> - deoptimizer_data_ = new DeoptimizerData ( heap ( ) ) ; <nl> - <nl> if ( setup_delegate_ = = nullptr ) { <nl> setup_delegate_ = new SetupIsolateDelegate ( create_heap_objects ) ; <nl> } <nl> mmm a / src / execution / isolate . h <nl> ppp b / src / execution / isolate . h <nl> class CompilationStatistics ; <nl> class CompilerDispatcher ; <nl> class Counters ; <nl> class Debug ; <nl> - class DeoptimizerData ; <nl> + class Deoptimizer ; <nl> class DescriptorLookupCache ; <nl> class EmbeddedFileWriterInterface ; <nl> class EternalHandles ; <nl> class V8_EXPORT_PRIVATE Isolate final : private HiddenFactory { <nl> <nl> StubCache * load_stub_cache ( ) { return load_stub_cache_ ; } <nl> StubCache * store_stub_cache ( ) { return store_stub_cache_ ; } <nl> - DeoptimizerData * deoptimizer_data ( ) { return deoptimizer_data_ ; } <nl> + Deoptimizer * GetAndClearCurrentDeoptimizer ( ) { <nl> + Deoptimizer * result = current_deoptimizer_ ; <nl> + CHECK_NOT_NULL ( result ) ; <nl> + current_deoptimizer_ = nullptr ; <nl> + return result ; <nl> + } <nl> + void set_current_deoptimizer ( Deoptimizer * deoptimizer ) { <nl> + DCHECK_NULL ( current_deoptimizer_ ) ; <nl> + DCHECK_NOT_NULL ( deoptimizer ) ; <nl> + current_deoptimizer_ = deoptimizer ; <nl> + } <nl> bool deoptimizer_lazy_throw ( ) const { return deoptimizer_lazy_throw_ ; } <nl> void set_deoptimizer_lazy_throw ( bool value ) { <nl> deoptimizer_lazy_throw_ = value ; <nl> class V8_EXPORT_PRIVATE Isolate final : private HiddenFactory { <nl> Logger * logger_ = nullptr ; <nl> StubCache * load_stub_cache_ = nullptr ; <nl> StubCache * store_stub_cache_ = nullptr ; <nl> - DeoptimizerData * deoptimizer_data_ = nullptr ; <nl> + Deoptimizer * current_deoptimizer_ = nullptr ; <nl> bool deoptimizer_lazy_throw_ = false ; <nl> MaterializedObjectStore * materialized_object_store_ = nullptr ; <nl> bool capture_stack_trace_for_uncaught_exceptions_ = false ; <nl> mmm a / src / heap / factory . cc <nl> ppp b / src / heap / factory . cc <nl> MaybeHandle < Code > Factory : : CodeBuilder : : BuildInternal ( <nl> if ( result . is_null ( ) ) return MaybeHandle < Code > ( ) ; <nl> } <nl> <nl> - if ( ! is_movable_ ) { <nl> - result = heap - > EnsureImmovableCode ( result , object_size ) ; <nl> - } <nl> - <nl> / / The code object has not been fully initialized yet . We rely on the <nl> / / fact that no allocation will happen from this point on . <nl> DisallowHeapAllocation no_gc ; <nl> mmm a / src / heap / factory . h <nl> ppp b / src / heap / factory . h <nl> class V8_EXPORT_PRIVATE Factory : public FactoryBase < Factory > { <nl> return * this ; <nl> } <nl> <nl> - CodeBuilder & set_immovable ( ) { <nl> - is_movable_ = false ; <nl> - return * this ; <nl> - } <nl> - <nl> CodeBuilder & set_is_turbofanned ( ) { <nl> is_turbofanned_ = true ; <nl> return * this ; <nl> class V8_EXPORT_PRIVATE Factory : public FactoryBase < Factory > { <nl> BasicBlockProfilerData * profiler_data_ = nullptr ; <nl> bool is_executable_ = true ; <nl> bool read_only_data_container_ = false ; <nl> - bool is_movable_ = true ; <nl> bool is_turbofanned_ = false ; <nl> int stack_slots_ = 0 ; <nl> } ; <nl> mmm a / src / heap / heap . cc <nl> ppp b / src / heap / heap . cc <nl> void Heap : : DisableInlineAllocation ( ) { <nl> } <nl> } <nl> <nl> - HeapObject Heap : : EnsureImmovableCode ( HeapObject heap_object , int object_size ) { <nl> - / / Code objects which should stay at a fixed address are allocated either <nl> - / / in the first page of code space , in large object space , or ( during <nl> - / / snapshot creation ) the containing page is marked as immovable . <nl> - DCHECK ( ! heap_object . is_null ( ) ) ; <nl> - # ifndef V8_ENABLE_THIRD_PARTY_HEAP <nl> - DCHECK ( code_space_ - > Contains ( heap_object ) ) ; <nl> - # endif <nl> - DCHECK_GE ( object_size , 0 ) ; <nl> - if ( ! Heap : : IsImmovable ( heap_object ) ) { <nl> - if ( isolate ( ) - > serializer_enabled ( ) | | <nl> - code_space_ - > first_page ( ) - > Contains ( heap_object . address ( ) ) ) { <nl> - BasicMemoryChunk : : FromHeapObject ( heap_object ) - > MarkNeverEvacuate ( ) ; <nl> - } else { <nl> - / / Discard the first code allocation , which was on a page where it could <nl> - / / be moved . <nl> - CreateFillerObjectAt ( heap_object . address ( ) , object_size , <nl> - ClearRecordedSlots : : kNo ) ; <nl> - heap_object = AllocateRawCodeInLargeObjectSpace ( object_size ) ; <nl> - UnprotectAndRegisterMemoryChunk ( heap_object ) ; <nl> - ZapCodeObject ( heap_object . address ( ) , object_size ) ; <nl> - OnAllocationEvent ( heap_object , object_size ) ; <nl> - } <nl> - } <nl> - return heap_object ; <nl> - } <nl> - <nl> HeapObject Heap : : AllocateRawWithLightRetrySlowPath ( <nl> int size , AllocationType allocation , AllocationOrigin origin , <nl> AllocationAlignment alignment ) { <nl> HeapObject Heap : : AllocateRawWithRetryOrFailSlowPath ( <nl> return HeapObject ( ) ; <nl> } <nl> <nl> - / / TODO ( jkummerow ) : Refactor this . AllocateRaw should take an " immovability " <nl> - / / parameter and just do what ' s necessary . <nl> - HeapObject Heap : : AllocateRawCodeInLargeObjectSpace ( int size ) { <nl> - AllocationResult alloc = code_lo_space ( ) - > AllocateRaw ( size ) ; <nl> - HeapObject result ; <nl> - if ( alloc . To ( & result ) ) { <nl> - DCHECK ( result ! = ReadOnlyRoots ( this ) . exception ( ) ) ; <nl> - return result ; <nl> - } <nl> - / / Two GCs before panicking . <nl> - for ( int i = 0 ; i < 2 ; i + + ) { <nl> - CollectGarbage ( alloc . RetrySpace ( ) , <nl> - GarbageCollectionReason : : kAllocationFailure ) ; <nl> - alloc = code_lo_space ( ) - > AllocateRaw ( size ) ; <nl> - if ( alloc . To ( & result ) ) { <nl> - DCHECK ( result ! = ReadOnlyRoots ( this ) . exception ( ) ) ; <nl> - return result ; <nl> - } <nl> - } <nl> - isolate ( ) - > counters ( ) - > gc_last_resort_from_handles ( ) - > Increment ( ) ; <nl> - CollectAllAvailableGarbage ( GarbageCollectionReason : : kLastResort ) ; <nl> - { <nl> - AlwaysAllocateScope scope ( this ) ; <nl> - alloc = code_lo_space ( ) - > AllocateRaw ( size ) ; <nl> - } <nl> - if ( alloc . To ( & result ) ) { <nl> - DCHECK ( result ! = ReadOnlyRoots ( this ) . exception ( ) ) ; <nl> - return result ; <nl> - } <nl> - / / TODO ( 1181417 ) : Fix this . <nl> - FatalProcessOutOfMemory ( " CALL_AND_RETRY_LAST " ) ; <nl> - return HeapObject ( ) ; <nl> - } <nl> - <nl> void Heap : : SetUp ( ) { <nl> # ifdef V8_ENABLE_ALLOCATION_TIMEOUT <nl> allocation_timeout_ = NextAllocationTimeout ( ) ; <nl> mmm a / src / heap / heap . h <nl> ppp b / src / heap / heap . h <nl> class Heap { <nl> int size , AllocationType allocation , AllocationOrigin origin , <nl> AllocationAlignment alignment = kWordAligned ) ; <nl> <nl> - V8_WARN_UNUSED_RESULT HeapObject AllocateRawCodeInLargeObjectSpace ( int size ) ; <nl> - <nl> / / Allocates a heap object based on the map . <nl> V8_WARN_UNUSED_RESULT AllocationResult Allocate ( Map map , <nl> AllocationType allocation ) ; <nl> <nl> - / / Takes a code object and checks if it is on memory which is not subject to <nl> - / / compaction . This method will return a new code object on an immovable <nl> - / / memory location if the original code object was movable . <nl> - HeapObject EnsureImmovableCode ( HeapObject heap_object , int object_size ) ; <nl> - <nl> / / Allocates a partial map for bootstrapping . <nl> V8_WARN_UNUSED_RESULT AllocationResult <nl> AllocatePartialMap ( InstanceType instance_type , int instance_size ) ; <nl> mmm a / src / logging / log . cc <nl> ppp b / src / logging / log . cc <nl> void ExistingCodeLogger : : LogCodeObject ( Object object ) { <nl> return ; / / We log this later using LogCompiledFunctions . <nl> case CodeKind : : BYTECODE_HANDLER : <nl> return ; / / We log it later by walking the dispatch table . <nl> - case CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING : <nl> + case CodeKind : : FOR_TESTING : <nl> description = " STUB code " ; <nl> tag = CodeEventListener : : STUB_TAG ; <nl> break ; <nl> mmm a / src / objects / code - kind . h <nl> ppp b / src / objects / code - kind . h <nl> <nl> namespace v8 { <nl> namespace internal { <nl> <nl> - / / TODO ( jgruber ) : Convert deopt entries to builtins and rename <nl> - / / DEOPT_ENTRIES_OR_FOR_TESTING to FOR_TESTING . <nl> - # define CODE_KIND_LIST ( V ) \ <nl> - V ( TURBOFAN ) \ <nl> - V ( BYTECODE_HANDLER ) \ <nl> - V ( DEOPT_ENTRIES_OR_FOR_TESTING ) \ <nl> - V ( BUILTIN ) \ <nl> - V ( REGEXP ) \ <nl> - V ( WASM_FUNCTION ) \ <nl> - V ( WASM_TO_CAPI_FUNCTION ) \ <nl> - V ( WASM_TO_JS_FUNCTION ) \ <nl> - V ( JS_TO_WASM_FUNCTION ) \ <nl> - V ( JS_TO_JS_FUNCTION ) \ <nl> - V ( C_WASM_ENTRY ) \ <nl> - V ( INTERPRETED_FUNCTION ) \ <nl> - V ( NATIVE_CONTEXT_INDEPENDENT ) \ <nl> + # define CODE_KIND_LIST ( V ) \ <nl> + V ( TURBOFAN ) \ <nl> + V ( BYTECODE_HANDLER ) \ <nl> + V ( FOR_TESTING ) \ <nl> + V ( BUILTIN ) \ <nl> + V ( REGEXP ) \ <nl> + V ( WASM_FUNCTION ) \ <nl> + V ( WASM_TO_CAPI_FUNCTION ) \ <nl> + V ( WASM_TO_JS_FUNCTION ) \ <nl> + V ( JS_TO_WASM_FUNCTION ) \ <nl> + V ( JS_TO_JS_FUNCTION ) \ <nl> + V ( C_WASM_ENTRY ) \ <nl> + V ( INTERPRETED_FUNCTION ) \ <nl> + V ( NATIVE_CONTEXT_INDEPENDENT ) \ <nl> V ( TURBOPROP ) <nl> <nl> enum class CodeKind { <nl> mmm a / src / snapshot / startup - serializer . cc <nl> ppp b / src / snapshot / startup - serializer . cc <nl> bool IsUnexpectedCodeObject ( Isolate * isolate , HeapObject obj ) { <nl> if ( ! obj . IsCode ( ) ) return false ; <nl> <nl> Code code = Code : : cast ( obj ) ; <nl> - <nl> - / / TODO ( v8 : 8768 ) : Deopt entry code should not be serialized . <nl> - if ( code . kind ( ) = = CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING & & <nl> - isolate - > deoptimizer_data ( ) ! = nullptr ) { <nl> - if ( isolate - > deoptimizer_data ( ) - > IsDeoptEntryCode ( code ) ) return false ; <nl> - } <nl> - <nl> if ( code . kind ( ) = = CodeKind : : REGEXP ) return false ; <nl> if ( ! code . is_builtin ( ) ) return true ; <nl> if ( code . is_off_heap_trampoline ( ) ) return false ; <nl> mmm a / test / cctest / assembler - helper - arm . cc <nl> ppp b / test / cctest / assembler - helper - arm . cc <nl> Handle < Code > AssembleCodeImpl ( std : : function < void ( MacroAssembler & ) > assemble ) { <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> if ( FLAG_print_code ) { <nl> code - > Print ( ) ; <nl> } <nl> mmm a / test / cctest / compiler / code - assembler - tester . h <nl> ppp b / test / cctest / compiler / code - assembler - tester . h <nl> class CodeAssemblerTester { <nl> const char * name = " test " ) <nl> : zone_ ( isolate - > allocator ( ) , ZONE_NAME , kCompressGraphZone ) , <nl> scope_ ( isolate ) , <nl> - state_ ( isolate , & zone_ , descriptor , <nl> - CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING , name , <nl> + state_ ( isolate , & zone_ , descriptor , CodeKind : : FOR_TESTING , name , <nl> PoisoningMitigationLevel : : kDontPoison , Builtins : : kNoBuiltinId ) { } <nl> <nl> / / Test generating code for a stub . Assumes VoidDescriptor call interface . <nl> class CodeAssemblerTester { <nl> const char * name = " test " ) <nl> : zone_ ( isolate - > allocator ( ) , ZONE_NAME , kCompressGraphZone ) , <nl> scope_ ( isolate ) , <nl> - state_ ( isolate , & zone_ , call_descriptor , <nl> - CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING , name , <nl> + state_ ( isolate , & zone_ , call_descriptor , CodeKind : : FOR_TESTING , name , <nl> PoisoningMitigationLevel : : kDontPoison , Builtins : : kNoBuiltinId ) { } <nl> <nl> CodeAssemblerState * state ( ) { return & state_ ; } <nl> mmm a / test / cctest / compiler / codegen - tester . h <nl> ppp b / test / cctest / compiler / codegen - tester . h <nl> class RawMachineAssemblerTester : public HandleAndZoneScope , <nl> } <nl> <nl> private : <nl> - CodeKind kind_ = CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ; <nl> + CodeKind kind_ = CodeKind : : FOR_TESTING ; <nl> MaybeHandle < Code > code_ ; <nl> } ; <nl> <nl> mmm a / test / cctest / compiler / test - code - generator . cc <nl> ppp b / test / cctest / compiler / test - code - generator . cc <nl> class CodeGeneratorTester { <nl> int extra_stack_space = 0 ) <nl> : zone_ ( environment - > main_zone ( ) ) , <nl> info_ ( ArrayVector ( " test " ) , environment - > main_zone ( ) , <nl> - CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) , <nl> + CodeKind : : FOR_TESTING ) , <nl> linkage_ ( environment - > test_descriptor ( ) ) , <nl> frame_ ( environment - > test_descriptor ( ) - > CalculateFixedFrameSize ( <nl> - CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) ) { <nl> + CodeKind : : FOR_TESTING ) ) { <nl> / / Pick half of the stack parameters at random and move them into spill <nl> / / slots , separated by ` extra_stack_space ` bytes . <nl> / / When testing a move with stack slots using CheckAssembleMove or <nl> mmm a / test / cctest / compiler / test - linkage . cc <nl> ppp b / test / cctest / compiler / test - linkage . cc <nl> TEST ( TestLinkageStubCall ) { <nl> Zone zone ( isolate - > allocator ( ) , ZONE_NAME ) ; <nl> Callable callable = Builtins : : CallableFor ( isolate , Builtins : : kToNumber ) ; <nl> OptimizedCompilationInfo info ( ArrayVector ( " test " ) , & zone , <nl> - CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) ; <nl> + CodeKind : : FOR_TESTING ) ; <nl> auto call_descriptor = Linkage : : GetStubCallDescriptor ( <nl> & zone , callable . descriptor ( ) , 0 , CallDescriptor : : kNoFlags , <nl> Operator : : kNoProperties ) ; <nl> TEST ( TestFPLinkageStubCall ) { <nl> Callable callable = <nl> Builtins : : CallableFor ( isolate , Builtins : : kWasmFloat64ToNumber ) ; <nl> OptimizedCompilationInfo info ( ArrayVector ( " test " ) , & zone , <nl> - CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) ; <nl> + CodeKind : : FOR_TESTING ) ; <nl> auto call_descriptor = Linkage : : GetStubCallDescriptor ( <nl> & zone , callable . descriptor ( ) , 0 , CallDescriptor : : kNoFlags , <nl> Operator : : kNoProperties ) ; <nl> mmm a / test / cctest / compiler / test - run - native - calls . cc <nl> ppp b / test / cctest / compiler / test - run - native - calls . cc <nl> Handle < Code > CompileGraph ( const char * name , CallDescriptor * call_descriptor , <nl> Graph * graph , Schedule * schedule = nullptr ) { <nl> Isolate * isolate = CcTest : : InitIsolateOnce ( ) ; <nl> OptimizedCompilationInfo info ( ArrayVector ( " testing " ) , graph - > zone ( ) , <nl> - CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) ; <nl> + CodeKind : : FOR_TESTING ) ; <nl> Handle < Code > code = Pipeline : : GenerateCodeForTesting ( <nl> & info , isolate , call_descriptor , graph , <nl> AssemblerOptions : : Default ( isolate ) , schedule ) <nl> mmm a / test / cctest / heap / heap - tester . h <nl> ppp b / test / cctest / heap / heap - tester . h <nl> <nl> V ( StressHandles ) \ <nl> V ( TestMemoryReducerSampleJsCalls ) \ <nl> V ( TestSizeOfObjects ) \ <nl> - V ( Regress5831 ) \ <nl> V ( Regress10560 ) \ <nl> V ( Regress538257 ) \ <nl> V ( Regress587004 ) \ <nl> mmm a / test / cctest / heap / test - concurrent - allocation . cc <nl> ppp b / test / cctest / heap / test - concurrent - allocation . cc <nl> UNINITIALIZED_TEST ( ConcurrentRecordRelocSlot ) { <nl> CodeDesc desc ; <nl> masm . GetCode ( i_isolate , & desc ) ; <nl> Handle < Code > code_handle = <nl> - Factory : : CodeBuilder ( i_isolate , desc , <nl> - CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Factory : : CodeBuilder ( i_isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> heap : : AbandonCurrentlyFreeMemory ( heap - > old_space ( ) ) ; <nl> Handle < HeapNumber > value_handle ( <nl> i_isolate - > factory ( ) - > NewHeapNumber < AllocationType : : kOld > ( 1 . 1 ) ) ; <nl> mmm a / test / cctest / heap / test - heap . cc <nl> ppp b / test / cctest / heap / test - heap . cc <nl> HEAP_TEST ( TestNewSpaceRefsInCopiedCode ) { <nl> <nl> CodeDesc desc ; <nl> masm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> <nl> Handle < Code > copy ; <nl> { <nl> static void CheckFindCodeObject ( Isolate * isolate ) { <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> CHECK ( code - > IsCode ( ) ) ; <nl> <nl> HeapObject obj = HeapObject : : cast ( * code ) ; <nl> static void CheckFindCodeObject ( Isolate * isolate ) { <nl> CHECK_EQ ( * code , found ) ; <nl> } <nl> <nl> - Handle < Code > copy = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > copy = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> HeapObject obj_copy = HeapObject : : cast ( * copy ) ; <nl> Object not_right = <nl> isolate - > FindCodeObject ( obj_copy . address ( ) + obj_copy . Size ( ) / 2 ) ; <nl> HEAP_TEST ( Regress670675 ) { <nl> DCHECK ( marking - > IsStopped ( ) ) ; <nl> } <nl> <nl> - namespace { <nl> - Handle < Code > GenerateDummyImmovableCode ( Isolate * isolate ) { <nl> - Assembler assm ( AssemblerOptions { } ) ; <nl> - <nl> - const int kNumberOfNops = 1 < < 10 ; <nl> - for ( int i = 0 ; i < kNumberOfNops ; i + + ) { <nl> - assm . nop ( ) ; / / supported on all architectures <nl> - } <nl> - <nl> - CodeDesc desc ; <nl> - assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . set_immovable ( ) <nl> - . Build ( ) ; <nl> - CHECK ( code - > IsCode ( ) ) ; <nl> - <nl> - return code ; <nl> - } <nl> - } / / namespace <nl> - <nl> - HEAP_TEST ( Regress5831 ) { <nl> - CcTest : : InitializeVM ( ) ; <nl> - Heap * heap = CcTest : : heap ( ) ; <nl> - Isolate * isolate = CcTest : : i_isolate ( ) ; <nl> - HandleScope handle_scope ( isolate ) ; <nl> - <nl> - / / Used to ensure that the generated code is not collected . <nl> - const int kInitialSize = 32 ; <nl> - Handle < FixedArray > array = isolate - > factory ( ) - > NewFixedArray ( kInitialSize ) ; <nl> - <nl> - / / Ensure that all immovable code space pages are full and we overflow into <nl> - / / LO_SPACE . <nl> - const int kMaxIterations = 1 < < 16 ; <nl> - bool overflowed_into_lospace = false ; <nl> - for ( int i = 0 ; i < kMaxIterations ; i + + ) { <nl> - Handle < Code > code = GenerateDummyImmovableCode ( isolate ) ; <nl> - array = FixedArray : : SetAndGrow ( isolate , array , i , code ) ; <nl> - CHECK ( heap - > code_space ( ) - > Contains ( * code ) | | <nl> - heap - > code_lo_space ( ) - > Contains ( * code ) ) ; <nl> - if ( heap - > code_lo_space ( ) - > Contains ( * code ) ) { <nl> - overflowed_into_lospace = true ; <nl> - break ; <nl> - } <nl> - } <nl> - <nl> - CHECK ( overflowed_into_lospace ) ; <nl> - <nl> - / / Fake a serializer run . <nl> - isolate - > serializer_enabled_ = true ; <nl> - <nl> - / / Generate the code . <nl> - Handle < Code > code = GenerateDummyImmovableCode ( isolate ) ; <nl> - CHECK_GE ( MemoryChunkLayout : : MaxRegularCodeObjectSize ( ) , code - > Size ( ) ) ; <nl> - CHECK ( ! heap - > code_space ( ) - > first_page ( ) - > Contains ( code - > address ( ) ) ) ; <nl> - <nl> - / / Ensure it ' s not in large object space . <nl> - MemoryChunk * chunk = MemoryChunk : : FromHeapObject ( * code ) ; <nl> - CHECK ( chunk - > owner_identity ( ) ! = LO_SPACE ) ; <nl> - CHECK ( chunk - > NeverEvacuate ( ) ) ; <nl> - } <nl> - <nl> HEAP_TEST ( RegressMissingWriteBarrierInAllocate ) { <nl> if ( ! FLAG_incremental_marking ) return ; <nl> ManualGCScope manual_gc_scope ; <nl> TEST ( Regress10900 ) { <nl> masm . Push ( ReadOnlyRoots ( heap ) . undefined_value_handle ( ) ) ; <nl> CodeDesc desc ; <nl> masm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> { <nl> / / Generate multiple code pages . <nl> CodeSpaceMemoryModificationScope modification_scope ( isolate - > heap ( ) ) ; <nl> mmm a / test / cctest / heap / test - weak - references . cc <nl> ppp b / test / cctest / heap / test - weak - references . cc <nl> TEST ( WeakReferencesBasic ) { <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> Handle < Code > code = <nl> - Factory : : CodeBuilder ( isolate , desc , <nl> - CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> CHECK ( code - > IsCode ( ) ) ; <nl> <nl> lh - > set_data1 ( HeapObjectReference : : Weak ( * code ) ) ; <nl> mmm a / test / cctest / test - accessor - assembler . cc <nl> ppp b / test / cctest / test - accessor - assembler . cc <nl> TEST ( TryProbeStubCache ) { <nl> <nl> / / Generate some number of handlers . <nl> for ( int i = 0 ; i < 30 ; i + + ) { <nl> - handlers . push_back ( <nl> - CreateCodeOfKind ( CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) ) ; <nl> + handlers . push_back ( CreateCodeOfKind ( CodeKind : : FOR_TESTING ) ) ; <nl> } <nl> <nl> / / Ensure that GC does happen because from now on we are going to fill our <nl> mmm a / test / cctest / test - assembler - arm . cc <nl> ppp b / test / cctest / test - assembler - arm . cc <nl> TEST ( 0 ) { <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> # ifdef DEBUG <nl> StdoutStream os ; <nl> code - > Print ( os ) ; <nl> TEST ( 1 ) { <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> # ifdef DEBUG <nl> StdoutStream os ; <nl> code - > Print ( os ) ; <nl> TEST ( 2 ) { <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> # ifdef DEBUG <nl> StdoutStream os ; <nl> code - > Print ( os ) ; <nl> TEST ( 3 ) { <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> # ifdef DEBUG <nl> StdoutStream os ; <nl> code - > Print ( os ) ; <nl> TEST ( 4 ) { <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> Handle < Code > code = <nl> - Factory : : CodeBuilder ( isolate , desc , <nl> - CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> # ifdef DEBUG <nl> StdoutStream os ; <nl> code - > Print ( os ) ; <nl> TEST ( 5 ) { <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> Handle < Code > code = <nl> - Factory : : CodeBuilder ( isolate , desc , <nl> - CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> # ifdef DEBUG <nl> StdoutStream os ; <nl> code - > Print ( os ) ; <nl> TEST ( 6 ) { <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> # ifdef DEBUG <nl> StdoutStream os ; <nl> code - > Print ( os ) ; <nl> static void TestRoundingMode ( VCVTTypes types , <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> # ifdef DEBUG <nl> StdoutStream os ; <nl> code - > Print ( os ) ; <nl> TEST ( 8 ) { <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> # ifdef DEBUG <nl> StdoutStream os ; <nl> code - > Print ( os ) ; <nl> TEST ( 9 ) { <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> # ifdef DEBUG <nl> StdoutStream os ; <nl> code - > Print ( os ) ; <nl> TEST ( 10 ) { <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> # ifdef DEBUG <nl> StdoutStream os ; <nl> code - > Print ( os ) ; <nl> TEST ( 11 ) { <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> # ifdef DEBUG <nl> StdoutStream os ; <nl> code - > Print ( os ) ; <nl> TEST ( 13 ) { <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> Handle < Code > code = <nl> - Factory : : CodeBuilder ( isolate , desc , <nl> - CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> # ifdef DEBUG <nl> StdoutStream os ; <nl> code - > Print ( os ) ; <nl> TEST ( 14 ) { <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> # ifdef DEBUG <nl> StdoutStream os ; <nl> code - > Print ( os ) ; <nl> TEST ( 15 ) { <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> Handle < Code > code = <nl> - Factory : : CodeBuilder ( isolate , desc , <nl> - CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> # ifdef DEBUG <nl> StdoutStream os ; <nl> code - > Print ( os ) ; <nl> TEST ( 16 ) { <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> # ifdef DEBUG <nl> StdoutStream os ; <nl> code - > Print ( os ) ; <nl> TEST ( sdiv ) { <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> Handle < Code > code = <nl> - Factory : : CodeBuilder ( isolate , desc , <nl> - CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> # ifdef DEBUG <nl> StdoutStream os ; <nl> code - > Print ( os ) ; <nl> TEST ( udiv ) { <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> Handle < Code > code = <nl> - Factory : : CodeBuilder ( isolate , desc , <nl> - CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> # ifdef DEBUG <nl> StdoutStream os ; <nl> code - > Print ( os ) ; <nl> TEST ( smmla ) { <nl> __ bx ( lr ) ; <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> # ifdef OBJECT_PRINT <nl> code - > Print ( std : : cout ) ; <nl> # endif <nl> TEST ( smmul ) { <nl> __ bx ( lr ) ; <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> # ifdef OBJECT_PRINT <nl> code - > Print ( std : : cout ) ; <nl> # endif <nl> TEST ( sxtb ) { <nl> __ bx ( lr ) ; <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> # ifdef OBJECT_PRINT <nl> code - > Print ( std : : cout ) ; <nl> # endif <nl> TEST ( sxtab ) { <nl> __ bx ( lr ) ; <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> # ifdef OBJECT_PRINT <nl> code - > Print ( std : : cout ) ; <nl> # endif <nl> TEST ( sxth ) { <nl> __ bx ( lr ) ; <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> # ifdef OBJECT_PRINT <nl> code - > Print ( std : : cout ) ; <nl> # endif <nl> TEST ( sxtah ) { <nl> __ bx ( lr ) ; <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> # ifdef OBJECT_PRINT <nl> code - > Print ( std : : cout ) ; <nl> # endif <nl> TEST ( uxtb ) { <nl> __ bx ( lr ) ; <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> # ifdef OBJECT_PRINT <nl> code - > Print ( std : : cout ) ; <nl> # endif <nl> TEST ( uxtab ) { <nl> __ bx ( lr ) ; <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> # ifdef OBJECT_PRINT <nl> code - > Print ( std : : cout ) ; <nl> # endif <nl> TEST ( uxth ) { <nl> __ bx ( lr ) ; <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> # ifdef OBJECT_PRINT <nl> code - > Print ( std : : cout ) ; <nl> # endif <nl> TEST ( uxtah ) { <nl> __ bx ( lr ) ; <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> # ifdef OBJECT_PRINT <nl> code - > Print ( std : : cout ) ; <nl> # endif <nl> TEST ( rbit ) { <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> Handle < Code > code = <nl> - Factory : : CodeBuilder ( isolate , desc , <nl> - CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> <nl> # ifdef OBJECT_PRINT <nl> code - > Print ( std : : cout ) ; <nl> TEST ( code_relative_offset ) { <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> + Handle < Code > code = Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) <nl> . set_self_reference ( code_object ) <nl> . Build ( ) ; <nl> auto f = GeneratedCode < F_iiiii > : : FromCode ( * code ) ; <nl> TEST ( msr_mrs ) { <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> # ifdef DEBUG <nl> StdoutStream os ; <nl> code - > Print ( os ) ; <nl> TEST ( ARMv8_float32_vrintX ) { <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> Handle < Code > code = <nl> - Factory : : CodeBuilder ( isolate , desc , <nl> - CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> # ifdef DEBUG <nl> StdoutStream os ; <nl> code - > Print ( os ) ; <nl> TEST ( ARMv8_vrintX ) { <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> Handle < Code > code = <nl> - Factory : : CodeBuilder ( isolate , desc , <nl> - CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> # ifdef DEBUG <nl> StdoutStream os ; <nl> code - > Print ( os ) ; <nl> TEST ( ARMv8_vsel ) { <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> Handle < Code > code = <nl> - Factory : : CodeBuilder ( isolate , desc , <nl> - CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> # ifdef DEBUG <nl> StdoutStream os ; <nl> code - > Print ( os ) ; <nl> TEST ( ARMv8_vminmax_f64 ) { <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> Handle < Code > code = <nl> - Factory : : CodeBuilder ( isolate , desc , <nl> - CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> # ifdef DEBUG <nl> StdoutStream os ; <nl> code - > Print ( os ) ; <nl> TEST ( ARMv8_vminmax_f32 ) { <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> Handle < Code > code = <nl> - Factory : : CodeBuilder ( isolate , desc , <nl> - CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> # ifdef DEBUG <nl> StdoutStream os ; <nl> code - > Print ( os ) ; <nl> static GeneratedCode < F_ppiii > GenerateMacroFloatMinMax ( <nl> CodeDesc desc ; <nl> assm . GetCode ( assm . isolate ( ) , & desc ) ; <nl> Handle < Code > code = <nl> - Factory : : CodeBuilder ( assm . isolate ( ) , desc , <nl> - CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Factory : : CodeBuilder ( assm . isolate ( ) , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> # ifdef DEBUG <nl> StdoutStream os ; <nl> code - > Print ( os ) ; <nl> TEST ( unaligned_loads ) { <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> # ifdef DEBUG <nl> StdoutStream os ; <nl> code - > Print ( os ) ; <nl> TEST ( unaligned_stores ) { <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> # ifdef DEBUG <nl> StdoutStream os ; <nl> code - > Print ( os ) ; <nl> TEST ( vswp ) { <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> # ifdef DEBUG <nl> StdoutStream os ; <nl> code - > Print ( os ) ; <nl> TEST ( split_add_immediate ) { <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> Handle < Code > code = <nl> - Factory : : CodeBuilder ( isolate , desc , <nl> - CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> # ifdef DEBUG <nl> StdoutStream os ; <nl> code - > Print ( os ) ; <nl> TEST ( split_add_immediate ) { <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> Handle < Code > code = <nl> - Factory : : CodeBuilder ( isolate , desc , <nl> - CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> # ifdef DEBUG <nl> StdoutStream os ; <nl> code - > Print ( os ) ; <nl> TEST ( split_add_immediate ) { <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> Handle < Code > code = <nl> - Factory : : CodeBuilder ( isolate , desc , <nl> - CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> # ifdef DEBUG <nl> StdoutStream os ; <nl> code - > Print ( os ) ; <nl> mmm a / test / cctest / test - assembler - arm64 . cc <nl> ppp b / test / cctest / test - assembler - arm64 . cc <nl> static void InitializeVM ( ) { <nl> <nl> # define RUN ( ) simulator . RunFrom ( reinterpret_cast < Instruction * > ( code - > entry ( ) ) ) <nl> <nl> - # define END ( ) \ <nl> - __ Debug ( " End test . " , __LINE__ , TRACE_DISABLE | LOG_ALL ) ; \ <nl> - core . Dump ( & masm ) ; \ <nl> - __ PopCalleeSavedRegisters ( ) ; \ <nl> - __ Ret ( ) ; \ <nl> - { \ <nl> - CodeDesc desc ; \ <nl> - __ GetCode ( masm . isolate ( ) , & desc ) ; \ <nl> - code = Factory : : CodeBuilder ( isolate , desc , \ <nl> - CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) \ <nl> - . Build ( ) ; \ <nl> - if ( FLAG_print_code ) code - > Print ( ) ; \ <nl> + # define END ( ) \ <nl> + __ Debug ( " End test . " , __LINE__ , TRACE_DISABLE | LOG_ALL ) ; \ <nl> + core . Dump ( & masm ) ; \ <nl> + __ PopCalleeSavedRegisters ( ) ; \ <nl> + __ Ret ( ) ; \ <nl> + { \ <nl> + CodeDesc desc ; \ <nl> + __ GetCode ( masm . isolate ( ) , & desc ) ; \ <nl> + code = Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; \ <nl> + if ( FLAG_print_code ) code - > Print ( ) ; \ <nl> } <nl> <nl> # else / / ifdef USE_SIMULATOR . <nl> static void InitializeVM ( ) { <nl> f . Call ( ) ; \ <nl> } <nl> <nl> - # define END ( ) \ <nl> - core . Dump ( & masm ) ; \ <nl> - __ PopCalleeSavedRegisters ( ) ; \ <nl> - __ Ret ( ) ; \ <nl> - { \ <nl> - CodeDesc desc ; \ <nl> - __ GetCode ( masm . isolate ( ) , & desc ) ; \ <nl> - code = Factory : : CodeBuilder ( isolate , desc , \ <nl> - CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) \ <nl> - . Build ( ) ; \ <nl> - if ( FLAG_print_code ) code - > Print ( ) ; \ <nl> + # define END ( ) \ <nl> + core . Dump ( & masm ) ; \ <nl> + __ PopCalleeSavedRegisters ( ) ; \ <nl> + __ Ret ( ) ; \ <nl> + { \ <nl> + CodeDesc desc ; \ <nl> + __ GetCode ( masm . isolate ( ) , & desc ) ; \ <nl> + code = Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; \ <nl> + if ( FLAG_print_code ) code - > Print ( ) ; \ <nl> } <nl> <nl> # endif / / ifdef USE_SIMULATOR . <nl> TEST ( pool_size ) { <nl> <nl> CodeDesc desc ; <nl> masm . GetCode ( isolate , & desc ) ; <nl> - code = Factory : : CodeBuilder ( isolate , desc , <nl> - CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> + code = Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) <nl> . set_self_reference ( masm . CodeObject ( ) ) <nl> . Build ( ) ; <nl> <nl> mmm a / test / cctest / test - assembler - ia32 . cc <nl> ppp b / test / cctest / test - assembler - ia32 . cc <nl> <nl> <nl> # include < stdlib . h > <nl> <nl> - # include " src / init / v8 . h " <nl> - <nl> # include " src / base / platform / platform . h " <nl> # include " src / base / utils / random - number - generator . h " <nl> # include " src / codegen / assembler - inl . h " <nl> # include " src / codegen / macro - assembler . h " <nl> + # include " src / deoptimizer / deoptimizer . h " <nl> # include " src / diagnostics / disassembler . h " <nl> # include " src / heap / factory . h " <nl> + # include " src / init / v8 . h " <nl> # include " src / utils / ostreams . h " <nl> # include " test / cctest / cctest . h " <nl> <nl> TEST ( AssemblerIa320 ) { <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> # ifdef OBJECT_PRINT <nl> StdoutStream os ; <nl> code - > Print ( os ) ; <nl> TEST ( AssemblerIa321 ) { <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> # ifdef OBJECT_PRINT <nl> StdoutStream os ; <nl> code - > Print ( os ) ; <nl> TEST ( AssemblerIa322 ) { <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> # ifdef OBJECT_PRINT <nl> StdoutStream os ; <nl> code - > Print ( os ) ; <nl> TEST ( AssemblerIa323 ) { <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> # ifdef OBJECT_PRINT <nl> StdoutStream os ; <nl> code - > Print ( os ) ; <nl> TEST ( AssemblerIa324 ) { <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> # ifdef OBJECT_PRINT <nl> StdoutStream os ; <nl> code - > Print ( os ) ; <nl> TEST ( AssemblerIa325 ) { <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> F0 f = FUNCTION_CAST < F0 > ( code - > entry ( ) ) ; <nl> int res = f ( ) ; <nl> CHECK_EQ ( 42 , res ) ; <nl> TEST ( AssemblerIa326 ) { <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> # ifdef OBJECT_PRINT <nl> StdoutStream os ; <nl> code - > Print ( os ) ; <nl> TEST ( AssemblerIa328 ) { <nl> __ ret ( 0 ) ; <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> # ifdef OBJECT_PRINT <nl> StdoutStream os ; <nl> code - > Print ( os ) ; <nl> TEST ( AssemblerMultiByteNop ) { <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> CHECK ( code - > IsCode ( ) ) ; <nl> <nl> F0 f = FUNCTION_CAST < F0 > ( code - > entry ( ) ) ; <nl> void DoSSE2 ( const v8 : : FunctionCallbackInfo < v8 : : Value > & args ) { <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> <nl> F0 f = FUNCTION_CAST < F0 > ( code - > entry ( ) ) ; <nl> int res = f ( ) ; <nl> TEST ( AssemblerIa32Extractps ) { <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> # ifdef OBJECT_PRINT <nl> StdoutStream os ; <nl> code - > Print ( os ) ; <nl> TEST ( AssemblerIa32SSE ) { <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> # ifdef OBJECT_PRINT <nl> StdoutStream os ; <nl> code - > Print ( os ) ; <nl> TEST ( AssemblerIa32SSE3 ) { <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> # ifdef OBJECT_PRINT <nl> StdoutStream os ; <nl> code - > Print ( os ) ; <nl> TEST ( AssemblerX64FMA_sd ) { <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> # ifdef OBJECT_PRINT <nl> StdoutStream os ; <nl> code - > Print ( os ) ; <nl> TEST ( AssemblerX64FMA_ss ) { <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> # ifdef OBJECT_PRINT <nl> StdoutStream os ; <nl> code - > Print ( os ) ; <nl> TEST ( AssemblerIa32BMI1 ) { <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> # ifdef OBJECT_PRINT <nl> StdoutStream os ; <nl> code - > Print ( os ) ; <nl> TEST ( AssemblerIa32LZCNT ) { <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> # ifdef OBJECT_PRINT <nl> StdoutStream os ; <nl> code - > Print ( os ) ; <nl> TEST ( AssemblerIa32POPCNT ) { <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> # ifdef OBJECT_PRINT <nl> StdoutStream os ; <nl> code - > Print ( os ) ; <nl> TEST ( AssemblerIa32BMI2 ) { <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> # ifdef OBJECT_PRINT <nl> StdoutStream os ; <nl> code - > Print ( os ) ; <nl> TEST ( AssemblerIa32JumpTables1 ) { <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> # ifdef OBJECT_PRINT <nl> StdoutStream os ; <nl> code - > Print ( os ) ; <nl> TEST ( AssemblerIa32JumpTables2 ) { <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> # ifdef OBJECT_PRINT <nl> StdoutStream os ; <nl> code - > Print ( os ) ; <nl> TEST ( Regress621926 ) { <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> <nl> # ifdef OBJECT_PRINT <nl> StdoutStream os ; <nl> TEST ( Regress621926 ) { <nl> CHECK_EQ ( 1 , f ( ) ) ; <nl> } <nl> <nl> + TEST ( DeoptExitSizeIsFixed ) { <nl> + CHECK ( Deoptimizer : : kSupportsFixedDeoptExitSizes ) ; <nl> + <nl> + Isolate * isolate = CcTest : : i_isolate ( ) ; <nl> + HandleScope handles ( isolate ) ; <nl> + v8 : : internal : : byte buffer [ 256 ] ; <nl> + MacroAssembler masm ( isolate , v8 : : internal : : CodeObjectRequired : : kYes , <nl> + ExternalAssemblerBuffer ( buffer , sizeof ( buffer ) ) ) ; <nl> + <nl> + STATIC_ASSERT ( static_cast < int > ( kFirstDeoptimizeKind ) = = 0 ) ; <nl> + for ( int i = 0 ; i < kDeoptimizeKindCount ; i + + ) { <nl> + DeoptimizeKind kind = static_cast < DeoptimizeKind > ( i ) ; <nl> + Builtins : : Name target = Deoptimizer : : GetDeoptimizationEntry ( isolate , kind ) ; <nl> + Label before_exit ; <nl> + masm . bind ( & before_exit ) ; <nl> + masm . CallForDeoptimization ( target , 42 , & before_exit , kind , nullptr ) ; <nl> + CHECK_EQ ( masm . SizeOfCodeGeneratedSince ( & before_exit ) , <nl> + kind = = DeoptimizeKind : : kLazy <nl> + ? Deoptimizer : : kLazyDeoptExitSize <nl> + : Deoptimizer : : kNonLazyDeoptExitSize ) ; <nl> + } <nl> + } <nl> + <nl> # undef __ <nl> <nl> } / / namespace internal <nl> mmm a / test / cctest / test - assembler - mips . cc <nl> ppp b / test / cctest / test - assembler - mips . cc <nl> TEST ( MIPS0 ) { <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> auto f = GeneratedCode < F2 > : : FromCode ( * code ) ; <nl> int res = reinterpret_cast < int > ( f . Call ( 0xAB0 , 0xC , 0 , 0 , 0 ) ) ; <nl> CHECK_EQ ( static_cast < int32_t > ( 0xABC ) , res ) ; <nl> TEST ( MIPS1 ) { <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> auto f = GeneratedCode < F1 > : : FromCode ( * code ) ; <nl> int res = reinterpret_cast < int > ( f . Call ( 50 , 0 , 0 , 0 , 0 ) ) ; <nl> CHECK_EQ ( 1275 , res ) ; <nl> TEST ( MIPS2 ) { <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> auto f = GeneratedCode < F2 > : : FromCode ( * code ) ; <nl> int res = reinterpret_cast < int > ( f . Call ( 0xAB0 , 0xC , 0 , 0 , 0 ) ) ; <nl> CHECK_EQ ( static_cast < int32_t > ( 0x31415926 ) , res ) ; <nl> TEST ( MIPS3 ) { <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> auto f = GeneratedCode < F3 > : : FromCode ( * code ) ; <nl> / / Double test values . <nl> t . a = 1 . 5e14 ; <nl> TEST ( MIPS4 ) { <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> auto f = GeneratedCode < F3 > : : FromCode ( * code ) ; <nl> t . a = 1 . 5e22 ; <nl> t . b = 2 . 75e11 ; <nl> TEST ( MIPS5 ) { <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> auto f = GeneratedCode < F3 > : : FromCode ( * code ) ; <nl> t . a = 1 . 5e4 ; <nl> t . b = 2 . 75e8 ; <nl> TEST ( MIPS6 ) { <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> auto f = GeneratedCode < F3 > : : FromCode ( * code ) ; <nl> t . ui = 0x11223344 ; <nl> t . si = 0x99AABBCC ; <nl> TEST ( MIPS7 ) { <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> auto f = GeneratedCode < F3 > : : FromCode ( * code ) ; <nl> t . a = 1 . 5e14 ; <nl> t . b = 2 . 75e11 ; <nl> TEST ( MIPS8 ) { <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> Handle < Code > code = <nl> - Factory : : CodeBuilder ( isolate , desc , <nl> - CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> auto f = GeneratedCode < F3 > : : FromCode ( * code ) ; <nl> t . input = 0x12345678 ; <nl> f . Call ( & t , 0x0 , 0 , 0 , 0 ) ; <nl> TEST ( MIPS9 ) { <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> USE ( code ) ; <nl> } <nl> <nl> TEST ( MIPS10 ) { <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> auto f = GeneratedCode < F3 > : : FromCode ( * code ) ; <nl> t . a = 2 . 147483646e + 09 ; / / 0x7FFFFFFE - > 0xFF80000041DFFFFF as double . <nl> t . b_word = 0x0FF00FF0 ; / / 0x0FF00FF0 - > 0x as double . <nl> TEST ( MIPS11 ) { <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> auto f = GeneratedCode < F3 > : : FromCode ( * code ) ; <nl> t . reg_init = 0xAABBCCDD ; <nl> t . mem_init = 0x11223344 ; <nl> TEST ( MIPS12 ) { <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> auto f = GeneratedCode < F3 > : : FromCode ( * code ) ; <nl> t . x = 1 ; <nl> t . y = 2 ; <nl> TEST ( MIPS13 ) { <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> auto f = GeneratedCode < F3 > : : FromCode ( * code ) ; <nl> <nl> t . cvt_big_in = 0xFFFFFFFF ; <nl> TEST ( MIPS14 ) { <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> auto f = GeneratedCode < F3 > : : FromCode ( * code ) ; <nl> <nl> t . round_up_in = 123 . 51 ; <nl> TEST ( seleqz_selnez ) { <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> Handle < Code > code = <nl> - Factory : : CodeBuilder ( isolate , desc , <nl> - CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> auto f = GeneratedCode < F3 > : : FromCode ( * code ) ; <nl> <nl> ( f . Call ( & test , 0 , 0 , 0 , 0 ) ) ; <nl> TEST ( min_max ) { <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> Handle < Code > code = <nl> - Factory : : CodeBuilder ( isolate , desc , <nl> - CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> auto f = GeneratedCode < F3 > : : FromCode ( * code ) ; <nl> for ( int i = 0 ; i < kTableLength ; i + + ) { <nl> test . a = inputsa [ i ] ; <nl> TEST ( rint_d ) { <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> Handle < Code > code = <nl> - Factory : : CodeBuilder ( isolate , desc , <nl> - CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> auto f = GeneratedCode < F3 > : : FromCode ( * code ) ; <nl> <nl> for ( int j = 0 ; j < 4 ; j + + ) { <nl> TEST ( sel ) { <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> Handle < Code > code = <nl> - Factory : : CodeBuilder ( isolate , desc , <nl> - CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> auto f = GeneratedCode < F3 > : : FromCode ( * code ) ; <nl> <nl> const int test_size = 3 ; <nl> TEST ( rint_s ) { <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> Handle < Code > code = <nl> - Factory : : CodeBuilder ( isolate , desc , <nl> - CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> auto f = GeneratedCode < F3 > : : FromCode ( * code ) ; <nl> <nl> for ( int j = 0 ; j < 4 ; j + + ) { <nl> TEST ( Cvt_d_uw ) { <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> auto f = GeneratedCode < F3 > : : FromCode ( * code ) ; <nl> for ( int i = 0 ; i < kTableLength ; i + + ) { <nl> test . input = inputs [ i ] ; <nl> TEST ( mina_maxa ) { <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> Handle < Code > code = <nl> - Factory : : CodeBuilder ( isolate , desc , <nl> - CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> auto f = GeneratedCode < F3 > : : FromCode ( * code ) ; <nl> for ( int i = 0 ; i < kTableLength ; i + + ) { <nl> test . a = inputsa [ i ] ; <nl> TEST ( trunc_l ) { <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> Handle < Code > code = <nl> - Factory : : CodeBuilder ( isolate , desc , <nl> - CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> auto f = GeneratedCode < F3 > : : FromCode ( * code ) ; <nl> for ( int i = 0 ; i < kTableLength ; i + + ) { <nl> test . a = inputs_D [ i ] ; <nl> TEST ( movz_movn ) { <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> Handle < Code > code = <nl> - Factory : : CodeBuilder ( isolate , desc , <nl> - CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> auto f = GeneratedCode < F3 > : : FromCode ( * code ) ; <nl> for ( int i = 0 ; i < kTableLength ; i + + ) { <nl> test . a = inputs_D [ i ] ; <nl> TEST ( movt_movd ) { <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> Handle < Code > code = <nl> - Factory : : CodeBuilder ( isolate , desc , <nl> - CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> auto f = GeneratedCode < F3 > : : FromCode ( * code ) ; <nl> <nl> ( f . Call ( & test , 0 , 0 , 0 , 0 ) ) ; <nl> TEST ( cvt_w_d ) { <nl> Test test ; <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> auto f = GeneratedCode < F3 > : : FromCode ( * code ) ; <nl> for ( int j = 0 ; j < 4 ; j + + ) { <nl> test . fcsr = fcsr_inputs [ j ] ; <nl> TEST ( trunc_w ) { <nl> Test test ; <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> auto f = GeneratedCode < F3 > : : FromCode ( * code ) ; <nl> for ( int i = 0 ; i < kTableLength ; i + + ) { <nl> test . a = inputs_D [ i ] ; <nl> TEST ( round_w ) { <nl> Test test ; <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> auto f = GeneratedCode < F3 > : : FromCode ( * code ) ; <nl> for ( int i = 0 ; i < kTableLength ; i + + ) { <nl> test . a = inputs_D [ i ] ; <nl> TEST ( round_l ) { <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> Handle < Code > code = <nl> - Factory : : CodeBuilder ( isolate , desc , <nl> - CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> auto f = GeneratedCode < F3 > : : FromCode ( * code ) ; <nl> for ( int i = 0 ; i < kTableLength ; i + + ) { <nl> test . a = inputs_D [ i ] ; <nl> TEST ( sub ) { <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> auto f = GeneratedCode < F3 > : : FromCode ( * code ) ; <nl> for ( int i = 0 ; i < kTableLength ; i + + ) { <nl> test . a = inputfs_S [ i ] ; <nl> TEST ( sqrt_rsqrt_recip ) { <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> auto f = GeneratedCode < F3 > : : FromCode ( * code ) ; <nl> <nl> for ( int i = 0 ; i < kTableLength ; i + + ) { <nl> TEST ( neg ) { <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> auto f = GeneratedCode < F3 > : : FromCode ( * code ) ; <nl> for ( int i = 0 ; i < kTableLength ; i + + ) { <nl> test . a = inputs_S [ i ] ; <nl> TEST ( mul ) { <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> auto f = GeneratedCode < F3 > : : FromCode ( * code ) ; <nl> for ( int i = 0 ; i < kTableLength ; i + + ) { <nl> test . a = inputfs_S [ i ] ; <nl> TEST ( mov ) { <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> auto f = GeneratedCode < F3 > : : FromCode ( * code ) ; <nl> for ( int i = 0 ; i < kTableLength ; i + + ) { <nl> test . a = inputs_D [ i ] ; <nl> TEST ( floor_w ) { <nl> Test test ; <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> auto f = GeneratedCode < F3 > : : FromCode ( * code ) ; <nl> for ( int i = 0 ; i < kTableLength ; i + + ) { <nl> test . a = inputs_D [ i ] ; <nl> TEST ( floor_l ) { <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> Handle < Code > code = <nl> - Factory : : CodeBuilder ( isolate , desc , <nl> - CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> auto f = GeneratedCode < F3 > : : FromCode ( * code ) ; <nl> for ( int i = 0 ; i < kTableLength ; i + + ) { <nl> test . a = inputs_D [ i ] ; <nl> TEST ( ceil_w ) { <nl> Test test ; <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> auto f = GeneratedCode < F3 > : : FromCode ( * code ) ; <nl> for ( int i = 0 ; i < kTableLength ; i + + ) { <nl> test . a = inputs_D [ i ] ; <nl> TEST ( ceil_l ) { <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> Handle < Code > code = <nl> - Factory : : CodeBuilder ( isolate , desc , <nl> - CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> auto f = GeneratedCode < F3 > : : FromCode ( * code ) ; <nl> for ( int i = 0 ; i < kTableLength ; i + + ) { <nl> test . a = inputs_D [ i ] ; <nl> TEST ( jump_tables1 ) { <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> # ifdef OBJECT_PRINT <nl> code - > Print ( std : : cout ) ; <nl> # endif <nl> TEST ( jump_tables2 ) { <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> # ifdef OBJECT_PRINT <nl> code - > Print ( std : : cout ) ; <nl> # endif <nl> TEST ( jump_tables3 ) { <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> # ifdef OBJECT_PRINT <nl> code - > Print ( std : : cout ) ; <nl> # endif <nl> TEST ( BITSWAP ) { <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> Handle < Code > code = <nl> - Factory : : CodeBuilder ( isolate , desc , <nl> - CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> auto f = GeneratedCode < F3 > : : FromCode ( * code ) ; <nl> t . r1 = 0x781A15C3 ; <nl> t . r2 = 0x8B71FCDE ; <nl> TEST ( class_fmt ) { <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> Handle < Code > code = <nl> - Factory : : CodeBuilder ( isolate , desc , <nl> - CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> auto f = GeneratedCode < F3 > : : FromCode ( * code ) ; <nl> <nl> t . dSignalingNan = std : : numeric_limits < double > : : signaling_NaN ( ) ; <nl> TEST ( ABS ) { <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> auto f = GeneratedCode < F3 > : : FromCode ( * code ) ; <nl> test . a = - 2 . 0 ; <nl> test . b = - 2 . 0 ; <nl> TEST ( ADD_FMT ) { <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> auto f = GeneratedCode < F3 > : : FromCode ( * code ) ; <nl> test . a = 2 . 0 ; <nl> test . b = 3 . 0 ; <nl> TEST ( C_COND_FMT ) { <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> Handle < Code > code = <nl> - Factory : : CodeBuilder ( isolate , desc , <nl> - CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> auto f = GeneratedCode < F3 > : : FromCode ( * code ) ; <nl> test . dOp1 = 2 . 0 ; <nl> test . dOp2 = 3 . 0 ; <nl> TEST ( CMP_COND_FMT ) { <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> Handle < Code > code = <nl> - Factory : : CodeBuilder ( isolate , desc , <nl> - CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> auto f = GeneratedCode < F3 > : : FromCode ( * code ) ; <nl> uint64_t dTrue = 0xFFFFFFFFFFFFFFFF ; <nl> uint64_t dFalse = 0x0000000000000000 ; <nl> TEST ( CVT ) { <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> auto f = GeneratedCode < F3 > : : FromCode ( * code ) ; <nl> <nl> test . cvt_d_s_in = - 0 . 51 ; <nl> TEST ( DIV_FMT ) { <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> <nl> auto f = GeneratedCode < F3 > : : FromCode ( * code ) ; <nl> <nl> uint32_t run_align ( uint32_t rs_value , uint32_t rt_value , uint8_t bp ) { <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> <nl> auto f = GeneratedCode < F2 > : : FromCode ( * code ) ; <nl> <nl> uint32_t run_aluipc ( int16_t offset ) { <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> <nl> auto f = GeneratedCode < F2 > : : FromCode ( * code ) ; <nl> PC = ( uint32_t ) code - > entry ( ) ; / / Set the program counter . <nl> uint32_t run_auipc ( int16_t offset ) { <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> <nl> auto f = GeneratedCode < F2 > : : FromCode ( * code ) ; <nl> PC = ( uint32_t ) code - > entry ( ) ; / / Set the program counter . <nl> uint32_t run_lwpc ( int offset ) { <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> <nl> auto f = GeneratedCode < F2 > : : FromCode ( * code ) ; <nl> <nl> uint32_t run_jic ( int16_t offset ) { <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> <nl> auto f = GeneratedCode < F2 > : : FromCode ( * code ) ; <nl> <nl> uint64_t run_beqzc ( int32_t value , int32_t offset ) { <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> <nl> auto f = GeneratedCode < F2 > : : FromCode ( * code ) ; <nl> <nl> void run_bz_bnz ( TestCaseMsaBranch * input , Branch GenerateBranch , <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> # ifdef OBJECT_PRINT <nl> code - > Print ( std : : cout ) ; <nl> # endif <nl> uint32_t run_jialc ( int16_t offset ) { <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> <nl> auto f = GeneratedCode < F2 > : : FromCode ( * code ) ; <nl> <nl> static uint32_t run_addiupc ( int32_t imm19 ) { <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> <nl> auto f = GeneratedCode < F2 > : : FromCode ( * code ) ; <nl> PC = ( uint32_t ) code - > entry ( ) ; / / Set the program counter . <nl> int32_t run_bc ( int32_t offset ) { <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> <nl> auto f = GeneratedCode < F2 > : : FromCode ( * code ) ; <nl> <nl> int32_t run_balc ( int32_t offset ) { <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> <nl> auto f = GeneratedCode < F2 > : : FromCode ( * code ) ; <nl> <nl> uint32_t run_aui ( uint32_t rs , uint16_t offset ) { <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> <nl> auto f = GeneratedCode < F2 > : : FromCode ( * code ) ; <nl> <nl> uint32_t run_bal ( int16_t offset ) { <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> <nl> auto f = GeneratedCode < F2 > : : FromCode ( * code ) ; <nl> <nl> TEST ( Trampoline ) { <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> auto f = GeneratedCode < F2 > : : FromCode ( * code ) ; <nl> <nl> int32_t res = reinterpret_cast < int32_t > ( f . Call ( 42 , 42 , 0 , 0 , 0 ) ) ; <nl> void helper_madd_msub_maddf_msubf ( F func ) { <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> auto f = GeneratedCode < F3 > : : FromCode ( * code ) ; <nl> <nl> const size_t kTableLength = sizeof ( test_cases ) / sizeof ( TestCaseMaddMsub < T > ) ; <nl> uint32_t run_Subu ( uint32_t imm , int32_t num_instr ) { <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> auto f = GeneratedCode < F2 > : : FromCode ( * code ) ; <nl> <nl> uint32_t res = reinterpret_cast < uint32_t > ( f . Call ( 0 , 0 , 0 , 0 , 0 ) ) ; <nl> TEST ( MSA_fill_copy ) { <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> # ifdef OBJECT_PRINT <nl> code - > Print ( std : : cout ) ; <nl> # endif <nl> TEST ( MSA_fill_copy_2 ) { <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> # ifdef OBJECT_PRINT <nl> code - > Print ( std : : cout ) ; <nl> # endif <nl> TEST ( MSA_fill_copy_3 ) { <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> # ifdef OBJECT_PRINT <nl> code - > Print ( std : : cout ) ; <nl> # endif <nl> void run_msa_insert ( int32_t rs_value , int n , msa_reg_t * w ) { <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> # ifdef OBJECT_PRINT <nl> code - > Print ( std : : cout ) ; <nl> # endif <nl> TEST ( MSA_move_v ) { <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> Handle < Code > code = <nl> - Factory : : CodeBuilder ( isolate , desc , <nl> - CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> # ifdef OBJECT_PRINT <nl> code - > Print ( std : : cout ) ; <nl> # endif <nl> void run_msa_sldi ( OperFunc GenerateOperation , <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> Handle < Code > code = <nl> - Factory : : CodeBuilder ( isolate , desc , <nl> - CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> # ifdef OBJECT_PRINT <nl> code - > Print ( std : : cout ) ; <nl> # endif <nl> void run_msa_ctc_cfc ( uint32_t value ) { <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> # ifdef OBJECT_PRINT <nl> code - > Print ( std : : cout ) ; <nl> # endif <nl> void run_msa_i8 ( SecondaryField opcode , uint64_t ws_lo , uint64_t ws_hi , <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> # ifdef OBJECT_PRINT <nl> code - > Print ( std : : cout ) ; <nl> # endif <nl> uint32_t run_Ins ( uint32_t imm , uint32_t source , uint16_t pos , uint16_t size ) { <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> auto f = GeneratedCode < F2 > : : FromCode ( * code ) ; <nl> <nl> uint32_t res = reinterpret_cast < uint32_t > ( f . Call ( 0 , 0 , 0 , 0 , 0 ) ) ; <nl> uint32_t run_Ext ( uint32_t source , uint16_t pos , uint16_t size ) { <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> auto f = GeneratedCode < F2 > : : FromCode ( * code ) ; <nl> <nl> uint32_t res = reinterpret_cast < uint32_t > ( f . Call ( 0 , 0 , 0 , 0 , 0 ) ) ; <nl> void run_msa_i5 ( struct TestCaseMsaI5 * input , bool i5_sign_ext , <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> # ifdef OBJECT_PRINT <nl> code - > Print ( std : : cout ) ; <nl> # endif <nl> void run_msa_2r ( const struct TestCaseMsa2R * input , <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> # ifdef OBJECT_PRINT <nl> code - > Print ( std : : cout ) ; <nl> # endif <nl> void run_msa_vector ( struct TestCaseMsaVector * input , <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> # ifdef OBJECT_PRINT <nl> code - > Print ( std : : cout ) ; <nl> # endif <nl> void run_msa_bit ( struct TestCaseMsaBit * input , InstFunc GenerateInstructionFunc , <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> # ifdef OBJECT_PRINT <nl> code - > Print ( std : : cout ) ; <nl> # endif <nl> void run_msa_i10 ( int32_t input , InstFunc GenerateVectorInstructionFunc , <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> # ifdef OBJECT_PRINT <nl> code - > Print ( std : : cout ) ; <nl> # endif <nl> void run_msa_mi10 ( InstFunc GenerateVectorInstructionFunc ) { <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> # ifdef OBJECT_PRINT <nl> code - > Print ( std : : cout ) ; <nl> # endif <nl> void run_msa_3r ( struct TestCaseMsa3R * input , InstFunc GenerateI5InstructionFunc , <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> # ifdef OBJECT_PRINT <nl> code - > Print ( std : : cout ) ; <nl> # endif <nl> void run_msa_3rf ( const struct TestCaseMsa3RF * input , <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> # ifdef OBJECT_PRINT <nl> code - > Print ( std : : cout ) ; <nl> # endif <nl> mmm a / test / cctest / test - assembler - mips64 . cc <nl> ppp b / test / cctest / test - assembler - mips64 . cc <nl> TEST ( MIPS0 ) { <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> auto f = GeneratedCode < F2 > : : FromCode ( * code ) ; <nl> int64_t res = reinterpret_cast < int64_t > ( f . Call ( 0xAB0 , 0xC , 0 , 0 , 0 ) ) ; <nl> CHECK_EQ ( 0xABCL , res ) ; <nl> TEST ( MIPS1 ) { <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> auto f = GeneratedCode < F1 > : : FromCode ( * code ) ; <nl> int64_t res = reinterpret_cast < int64_t > ( f . Call ( 50 , 0 , 0 , 0 , 0 ) ) ; <nl> CHECK_EQ ( 1275L , res ) ; <nl> TEST ( MIPS2 ) { <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> auto f = GeneratedCode < F2 > : : FromCode ( * code ) ; <nl> int64_t res = reinterpret_cast < int64_t > ( f . Call ( 0xAB0 , 0xC , 0 , 0 , 0 ) ) ; <nl> <nl> TEST ( MIPS3 ) { <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> auto f = GeneratedCode < F3 > : : FromCode ( * code ) ; <nl> / / Double test values . <nl> t . a = 1 . 5e14 ; <nl> TEST ( MIPS4 ) { <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> auto f = GeneratedCode < F3 > : : FromCode ( * code ) ; <nl> t . a = 1 . 5e22 ; <nl> t . b = 2 . 75e11 ; <nl> TEST ( MIPS5 ) { <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> auto f = GeneratedCode < F3 > : : FromCode ( * code ) ; <nl> t . a = 1 . 5e4 ; <nl> t . b = 2 . 75e8 ; <nl> TEST ( MIPS6 ) { <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> auto f = GeneratedCode < F3 > : : FromCode ( * code ) ; <nl> t . ui = 0x11223344 ; <nl> t . si = 0x99AABBCC ; <nl> TEST ( MIPS7 ) { <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> auto f = GeneratedCode < F3 > : : FromCode ( * code ) ; <nl> t . a = 1 . 5e14 ; <nl> t . b = 2 . 75e11 ; <nl> TEST ( MIPS8 ) { <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> Handle < Code > code = <nl> - Factory : : CodeBuilder ( isolate , desc , <nl> - CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> auto f = GeneratedCode < F3 > : : FromCode ( * code ) ; <nl> t . input = 0x12345678 ; <nl> f . Call ( & t , 0x0 , 0 , 0 , 0 ) ; <nl> TEST ( MIPS9 ) { <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> USE ( code ) ; <nl> } <nl> <nl> TEST ( MIPS10 ) { <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> Handle < Code > code = <nl> - Factory : : CodeBuilder ( isolate , desc , <nl> - CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> auto f = GeneratedCode < F3 > : : FromCode ( * code ) ; <nl> t . a = 2 . 147483647e9 ; / / 0x7FFFFFFF - > 0x41DFFFFFFFC00000 as double . <nl> t . b_long_hi = 0x000000FF ; / / 0xFF00FF00FF - > 0x426FE01FE01FE000 as double . <nl> TEST ( MIPS11 ) { <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> Handle < Code > code = <nl> - Factory : : CodeBuilder ( isolate , desc , <nl> - CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> auto f = GeneratedCode < F3 > : : FromCode ( * code ) ; <nl> t . reg_init = 0xAABBCCDD ; <nl> t . mem_init = 0x11223344 ; <nl> TEST ( MIPS12 ) { <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> auto f = GeneratedCode < F3 > : : FromCode ( * code ) ; <nl> t . x = 1 ; <nl> t . y = 2 ; <nl> TEST ( MIPS13 ) { <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> auto f = GeneratedCode < F3 > : : FromCode ( * code ) ; <nl> <nl> t . cvt_big_in = 0xFFFFFFFF ; <nl> TEST ( MIPS14 ) { <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> auto f = GeneratedCode < F3 > : : FromCode ( * code ) ; <nl> <nl> t . round_up_in = 123 . 51 ; <nl> TEST ( MIPS16 ) { <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> auto f = GeneratedCode < F3 > : : FromCode ( * code ) ; <nl> t . ui = 0x44332211 ; <nl> t . si = 0x99AABBCC ; <nl> TEST ( seleqz_selnez ) { <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> Handle < Code > code = <nl> - Factory : : CodeBuilder ( isolate , desc , <nl> - CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> auto f = GeneratedCode < F3 > : : FromCode ( * code ) ; <nl> <nl> f . Call ( & test , 0 , 0 , 0 , 0 ) ; <nl> TEST ( min_max ) { <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> Handle < Code > code = <nl> - Factory : : CodeBuilder ( isolate , desc , <nl> - CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> auto f = GeneratedCode < F3 > : : FromCode ( * code ) ; <nl> for ( int i = 4 ; i < kTableLength ; i + + ) { <nl> test . a = inputsa [ i ] ; <nl> TEST ( rint_d ) { <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> Handle < Code > code = <nl> - Factory : : CodeBuilder ( isolate , desc , <nl> - CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> auto f = GeneratedCode < F3 > : : FromCode ( * code ) ; <nl> <nl> for ( int j = 0 ; j < 4 ; j + + ) { <nl> TEST ( sel ) { <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> Handle < Code > code = <nl> - Factory : : CodeBuilder ( isolate , desc , <nl> - CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> auto f = GeneratedCode < F3 > : : FromCode ( * code ) ; <nl> <nl> const int test_size = 3 ; <nl> TEST ( rint_s ) { <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> Handle < Code > code = <nl> - Factory : : CodeBuilder ( isolate , desc , <nl> - CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> auto f = GeneratedCode < F3 > : : FromCode ( * code ) ; <nl> <nl> for ( int j = 0 ; j < 4 ; j + + ) { <nl> TEST ( mina_maxa ) { <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> Handle < Code > code = <nl> - Factory : : CodeBuilder ( isolate , desc , <nl> - CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> auto f = GeneratedCode < F3 > : : FromCode ( * code ) ; <nl> for ( int i = 0 ; i < kTableLength ; i + + ) { <nl> test . a = inputsa [ i ] ; <nl> TEST ( trunc_l ) { <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> Handle < Code > code = <nl> - Factory : : CodeBuilder ( isolate , desc , <nl> - CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> auto f = GeneratedCode < F3 > : : FromCode ( * code ) ; <nl> for ( int i = 0 ; i < kTableLength ; i + + ) { <nl> test . a = inputs_D [ i ] ; <nl> TEST ( movz_movn ) { <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> Handle < Code > code = <nl> - Factory : : CodeBuilder ( isolate , desc , <nl> - CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> auto f = GeneratedCode < F3 > : : FromCode ( * code ) ; <nl> for ( int i = 0 ; i < kTableLength ; i + + ) { <nl> test . a = inputs_D [ i ] ; <nl> TEST ( movt_movd ) { <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> Handle < Code > code = <nl> - Factory : : CodeBuilder ( isolate , desc , <nl> - CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> auto f = GeneratedCode < F3 > : : FromCode ( * code ) ; <nl> <nl> f . Call ( & test , 0 , 0 , 0 , 0 ) ; <nl> TEST ( cvt_w_d ) { <nl> Test test ; <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> auto f = GeneratedCode < F3 > : : FromCode ( * code ) ; <nl> for ( int j = 0 ; j < 4 ; j + + ) { <nl> test . fcsr = fcsr_inputs [ j ] ; <nl> TEST ( trunc_w ) { <nl> Test test ; <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> auto f = GeneratedCode < F3 > : : FromCode ( * code ) ; <nl> for ( int i = 0 ; i < kTableLength ; i + + ) { <nl> test . a = inputs_D [ i ] ; <nl> TEST ( round_w ) { <nl> Test test ; <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> auto f = GeneratedCode < F3 > : : FromCode ( * code ) ; <nl> for ( int i = 0 ; i < kTableLength ; i + + ) { <nl> test . a = inputs_D [ i ] ; <nl> TEST ( round_l ) { <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> Handle < Code > code = <nl> - Factory : : CodeBuilder ( isolate , desc , <nl> - CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> auto f = GeneratedCode < F3 > : : FromCode ( * code ) ; <nl> for ( int i = 0 ; i < kTableLength ; i + + ) { <nl> test . a = inputs_D [ i ] ; <nl> TEST ( sub ) { <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> auto f = GeneratedCode < F3 > : : FromCode ( * code ) ; <nl> for ( int i = 0 ; i < kTableLength ; i + + ) { <nl> test . a = inputfs_S [ i ] ; <nl> TEST ( sqrt_rsqrt_recip ) { <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> auto f = GeneratedCode < F3 > : : FromCode ( * code ) ; <nl> <nl> for ( int i = 0 ; i < kTableLength ; i + + ) { <nl> TEST ( neg ) { <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> auto f = GeneratedCode < F3 > : : FromCode ( * code ) ; <nl> for ( int i = 0 ; i < kTableLength ; i + + ) { <nl> test . a = inputs_S [ i ] ; <nl> TEST ( mul ) { <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> auto f = GeneratedCode < F3 > : : FromCode ( * code ) ; <nl> for ( int i = 0 ; i < kTableLength ; i + + ) { <nl> test . a = inputfs_S [ i ] ; <nl> TEST ( mov ) { <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> auto f = GeneratedCode < F3 > : : FromCode ( * code ) ; <nl> for ( int i = 0 ; i < kTableLength ; i + + ) { <nl> test . a = inputs_D [ i ] ; <nl> TEST ( floor_w ) { <nl> Test test ; <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> auto f = GeneratedCode < F3 > : : FromCode ( * code ) ; <nl> for ( int i = 0 ; i < kTableLength ; i + + ) { <nl> test . a = inputs_D [ i ] ; <nl> TEST ( floor_l ) { <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> Handle < Code > code = <nl> - Factory : : CodeBuilder ( isolate , desc , <nl> - CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> auto f = GeneratedCode < F3 > : : FromCode ( * code ) ; <nl> for ( int i = 0 ; i < kTableLength ; i + + ) { <nl> test . a = inputs_D [ i ] ; <nl> TEST ( ceil_w ) { <nl> Test test ; <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> auto f = GeneratedCode < F3 > : : FromCode ( * code ) ; <nl> for ( int i = 0 ; i < kTableLength ; i + + ) { <nl> test . a = inputs_D [ i ] ; <nl> TEST ( ceil_l ) { <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> Handle < Code > code = <nl> - Factory : : CodeBuilder ( isolate , desc , <nl> - CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> auto f = GeneratedCode < F3 > : : FromCode ( * code ) ; <nl> for ( int i = 0 ; i < kTableLength ; i + + ) { <nl> test . a = inputs_D [ i ] ; <nl> TEST ( jump_tables1 ) { <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> # ifdef OBJECT_PRINT <nl> code - > Print ( std : : cout ) ; <nl> # endif <nl> TEST ( jump_tables2 ) { <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> # ifdef OBJECT_PRINT <nl> code - > Print ( std : : cout ) ; <nl> # endif <nl> TEST ( jump_tables3 ) { <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> # ifdef OBJECT_PRINT <nl> code - > Print ( std : : cout ) ; <nl> # endif <nl> TEST ( BITSWAP ) { <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> Handle < Code > code = <nl> - Factory : : CodeBuilder ( isolate , desc , <nl> - CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> auto f = GeneratedCode < F3 > : : FromCode ( * code ) ; <nl> t . r1 = 0x00102100781A15C3 ; <nl> t . r2 = 0x001021008B71FCDE ; <nl> TEST ( class_fmt ) { <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> Handle < Code > code = <nl> - Factory : : CodeBuilder ( isolate , desc , <nl> - CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> auto f = GeneratedCode < F3 > : : FromCode ( * code ) ; <nl> <nl> / / Double test values . <nl> TEST ( ABS ) { <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> auto f = GeneratedCode < F3 > : : FromCode ( * code ) ; <nl> test . a = - 2 . 0 ; <nl> test . b = - 2 . 0 ; <nl> TEST ( ADD_FMT ) { <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> auto f = GeneratedCode < F3 > : : FromCode ( * code ) ; <nl> test . a = 2 . 0 ; <nl> test . b = 3 . 0 ; <nl> TEST ( C_COND_FMT ) { <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> Handle < Code > code = <nl> - Factory : : CodeBuilder ( isolate , desc , <nl> - CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> auto f = GeneratedCode < F3 > : : FromCode ( * code ) ; <nl> test . dOp1 = 2 . 0 ; <nl> test . dOp2 = 3 . 0 ; <nl> TEST ( CMP_COND_FMT ) { <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> Handle < Code > code = <nl> - Factory : : CodeBuilder ( isolate , desc , <nl> - CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> auto f = GeneratedCode < F3 > : : FromCode ( * code ) ; <nl> uint64_t dTrue = 0xFFFFFFFFFFFFFFFF ; <nl> uint64_t dFalse = 0x0000000000000000 ; <nl> TEST ( CVT ) { <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> auto f = GeneratedCode < F3 > : : FromCode ( * code ) ; <nl> <nl> test . cvt_d_s_in = - 0 . 51 ; <nl> TEST ( DIV_FMT ) { <nl> __ nop ( ) ; <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> auto f = GeneratedCode < F3 > : : FromCode ( * code ) ; <nl> <nl> f . Call ( & test , 0 , 0 , 0 , 0 ) ; <nl> uint64_t run_align ( uint64_t rs_value , uint64_t rt_value , uint8_t bp ) { <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> <nl> auto f = GeneratedCode < F4 > : : FromCode ( * code ) ; <nl> <nl> uint64_t run_dalign ( uint64_t rs_value , uint64_t rt_value , uint8_t bp ) { <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> <nl> auto f = GeneratedCode < F4 > : : FromCode ( * code ) ; <nl> uint64_t res = <nl> uint64_t run_aluipc ( int16_t offset ) { <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> <nl> auto f = GeneratedCode < F2 > : : FromCode ( * code ) ; <nl> PC = ( uint64_t ) code - > entry ( ) ; / / Set the program counter . <nl> uint64_t run_auipc ( int16_t offset ) { <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> <nl> auto f = GeneratedCode < F2 > : : FromCode ( * code ) ; <nl> PC = ( uint64_t ) code - > entry ( ) ; / / Set the program counter . <nl> uint64_t run_aui ( uint64_t rs , uint16_t offset ) { <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> <nl> auto f = GeneratedCode < F2 > : : FromCode ( * code ) ; <nl> <nl> uint64_t run_daui ( uint64_t rs , uint16_t offset ) { <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> <nl> auto f = GeneratedCode < F2 > : : FromCode ( * code ) ; <nl> <nl> uint64_t run_dahi ( uint64_t rs , uint16_t offset ) { <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> <nl> auto f = GeneratedCode < F2 > : : FromCode ( * code ) ; <nl> <nl> uint64_t run_dati ( uint64_t rs , uint16_t offset ) { <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> <nl> auto f = GeneratedCode < F2 > : : FromCode ( * code ) ; <nl> <nl> uint64_t run_li_macro ( uint64_t imm , LiFlags mode , int32_t num_instr = 0 ) { <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> # ifdef OBJECT_PRINT <nl> code - > Print ( std : : cout ) ; <nl> # endif <nl> uint64_t run_lwpc ( int offset ) { <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> <nl> auto f = GeneratedCode < F2 > : : FromCode ( * code ) ; <nl> <nl> uint64_t run_lwupc ( int offset ) { <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> <nl> auto f = GeneratedCode < F2 > : : FromCode ( * code ) ; <nl> <nl> uint64_t run_jic ( int16_t offset ) { <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> <nl> auto f = GeneratedCode < F2 > : : FromCode ( * code ) ; <nl> <nl> uint64_t run_beqzc ( int32_t value , int32_t offset ) { <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> <nl> auto f = GeneratedCode < F2 > : : FromCode ( * code ) ; <nl> <nl> void run_bz_bnz ( TestCaseMsaBranch * input , Branch GenerateBranch , <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> # ifdef OBJECT_PRINT <nl> code - > Print ( std : : cout ) ; <nl> # endif <nl> uint64_t run_jialc ( int16_t offset ) { <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> <nl> auto f = GeneratedCode < F2 > : : FromCode ( * code ) ; <nl> <nl> uint64_t run_addiupc ( int32_t imm19 ) { <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> <nl> auto f = GeneratedCode < F2 > : : FromCode ( * code ) ; <nl> PC = ( uint64_t ) code - > entry ( ) ; / / Set the program counter . <nl> uint64_t run_ldpc ( int offset ) { <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> <nl> auto f = GeneratedCode < F2 > : : FromCode ( * code ) ; <nl> <nl> int64_t run_bc ( int32_t offset ) { <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> <nl> auto f = GeneratedCode < F2 > : : FromCode ( * code ) ; <nl> <nl> int64_t run_balc ( int32_t offset ) { <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> <nl> auto f = GeneratedCode < F2 > : : FromCode ( * code ) ; <nl> <nl> uint64_t run_dsll ( uint64_t rt_value , uint16_t sa_value ) { <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> <nl> auto f = GeneratedCode < F4 > : : FromCode ( * code ) ; <nl> <nl> uint64_t run_bal ( int16_t offset ) { <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> <nl> auto f = GeneratedCode < F2 > : : FromCode ( * code ) ; <nl> <nl> TEST ( Trampoline ) { <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> auto f = GeneratedCode < F2 > : : FromCode ( * code ) ; <nl> <nl> int64_t res = reinterpret_cast < int64_t > ( f . Call ( 42 , 42 , 0 , 0 , 0 ) ) ; <nl> void helper_madd_msub_maddf_msubf ( F func ) { <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> auto f = GeneratedCode < F3 > : : FromCode ( * code ) ; <nl> <nl> const size_t kTableLength = sizeof ( test_cases ) / sizeof ( TestCaseMaddMsub < T > ) ; <nl> uint64_t run_Subu ( uint64_t imm , int32_t num_instr ) { <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> # ifdef OBJECT_PRINT <nl> code - > Print ( std : : cout ) ; <nl> # endif <nl> uint64_t run_Dsubu ( uint64_t imm , int32_t num_instr ) { <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> # ifdef OBJECT_PRINT <nl> code - > Print ( std : : cout ) ; <nl> # endif <nl> uint64_t run_Dins ( uint64_t imm , uint64_t source , uint16_t pos , uint16_t size ) { <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> auto f = GeneratedCode < F2 > : : FromCode ( * code ) ; <nl> <nl> uint64_t res = reinterpret_cast < uint64_t > ( f . Call ( 0 , 0 , 0 , 0 , 0 ) ) ; <nl> uint64_t run_Ins ( uint64_t imm , uint64_t source , uint16_t pos , uint16_t size ) { <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> auto f = GeneratedCode < F2 > : : FromCode ( * code ) ; <nl> <nl> uint64_t res = reinterpret_cast < uint64_t > ( f . Call ( 0 , 0 , 0 , 0 , 0 ) ) ; <nl> uint64_t run_Ext ( uint64_t source , uint16_t pos , uint16_t size ) { <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> auto f = GeneratedCode < F2 > : : FromCode ( * code ) ; <nl> <nl> uint64_t res = reinterpret_cast < uint64_t > ( f . Call ( 0 , 0 , 0 , 0 , 0 ) ) ; <nl> TEST ( MSA_fill_copy ) { <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> # ifdef OBJECT_PRINT <nl> code - > Print ( std : : cout ) ; <nl> # endif <nl> TEST ( MSA_fill_copy_2 ) { <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> # ifdef OBJECT_PRINT <nl> code - > Print ( std : : cout ) ; <nl> # endif <nl> TEST ( MSA_fill_copy_3 ) { <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> # ifdef OBJECT_PRINT <nl> code - > Print ( std : : cout ) ; <nl> # endif <nl> void run_msa_insert ( int64_t rs_value , int n , msa_reg_t * w ) { <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> # ifdef OBJECT_PRINT <nl> code - > Print ( std : : cout ) ; <nl> # endif <nl> void run_msa_ctc_cfc ( uint64_t value ) { <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> # ifdef OBJECT_PRINT <nl> code - > Print ( std : : cout ) ; <nl> # endif <nl> TEST ( MSA_move_v ) { <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> Handle < Code > code = <nl> - Factory : : CodeBuilder ( isolate , desc , <nl> - CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> # ifdef OBJECT_PRINT <nl> code - > Print ( std : : cout ) ; <nl> # endif <nl> void run_msa_sldi ( OperFunc GenerateOperation , <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> Handle < Code > code = <nl> - Factory : : CodeBuilder ( isolate , desc , <nl> - CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> # ifdef OBJECT_PRINT <nl> code - > Print ( std : : cout ) ; <nl> # endif <nl> void run_msa_i8 ( SecondaryField opcode , uint64_t ws_lo , uint64_t ws_hi , <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> # ifdef OBJECT_PRINT <nl> code - > Print ( std : : cout ) ; <nl> # endif <nl> void run_msa_i5 ( struct TestCaseMsaI5 * input , bool i5_sign_ext , <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> # ifdef OBJECT_PRINT <nl> code - > Print ( std : : cout ) ; <nl> # endif <nl> void run_msa_2r ( const struct TestCaseMsa2R * input , <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> # ifdef OBJECT_PRINT <nl> code - > Print ( std : : cout ) ; <nl> # endif <nl> void run_msa_vector ( struct TestCaseMsaVector * input , <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> # ifdef OBJECT_PRINT <nl> code - > Print ( std : : cout ) ; <nl> # endif <nl> void run_msa_bit ( struct TestCaseMsaBit * input , InstFunc GenerateInstructionFunc , <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> # ifdef OBJECT_PRINT <nl> code - > Print ( std : : cout ) ; <nl> # endif <nl> void run_msa_i10 ( int32_t input , InstFunc GenerateVectorInstructionFunc , <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> # ifdef OBJECT_PRINT <nl> code - > Print ( std : : cout ) ; <nl> # endif <nl> void run_msa_mi10 ( InstFunc GenerateVectorInstructionFunc ) { <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> # ifdef OBJECT_PRINT <nl> code - > Print ( std : : cout ) ; <nl> # endif <nl> void run_msa_3r ( struct TestCaseMsa3R * input , InstFunc GenerateI5InstructionFunc , <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> # ifdef OBJECT_PRINT <nl> code - > Print ( std : : cout ) ; <nl> # endif <nl> void run_msa_3rf ( const struct TestCaseMsa3RF * input , <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> # ifdef OBJECT_PRINT <nl> code - > Print ( std : : cout ) ; <nl> # endif <nl> mmm a / test / cctest / test - assembler - ppc . cc <nl> ppp b / test / cctest / test - assembler - ppc . cc <nl> TEST ( 0 ) { <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> # ifdef DEBUG <nl> code - > Print ( ) ; <nl> # endif <nl> TEST ( 1 ) { <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> # ifdef DEBUG <nl> code - > Print ( ) ; <nl> # endif <nl> TEST ( 2 ) { <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> # ifdef DEBUG <nl> code - > Print ( ) ; <nl> # endif <nl> TEST ( 3 ) { <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> # ifdef DEBUG <nl> code - > Print ( ) ; <nl> # endif <nl> TEST ( 4 ) { <nl> assm . GetCode ( isolate , & desc ) ; <nl> Object code = isolate - > heap ( ) - > CreateCode ( <nl> desc , <nl> - CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING , <nl> + CodeKind : : FOR_TESTING , <nl> Handle < Code > ( ) ) - > ToObjectChecked ( ) ; <nl> CHECK ( code - > IsCode ( ) ) ; <nl> # ifdef DEBUG <nl> TEST ( 5 ) { <nl> assm . GetCode ( isolate , & desc ) ; <nl> Object code = isolate - > heap ( ) - > CreateCode ( <nl> desc , <nl> - CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING , <nl> + CodeKind : : FOR_TESTING , <nl> Handle < Code > ( ) ) - > ToObjectChecked ( ) ; <nl> CHECK ( code - > IsCode ( ) ) ; <nl> # ifdef DEBUG <nl> TEST ( 6 ) { <nl> assm . GetCode ( isolate , & desc ) ; <nl> Object code = isolate - > heap ( ) - > CreateCode ( <nl> desc , <nl> - CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING , <nl> + CodeKind : : FOR_TESTING , <nl> Handle < Code > ( ) ) - > ToObjectChecked ( ) ; <nl> CHECK ( code - > IsCode ( ) ) ; <nl> # ifdef DEBUG <nl> static void TestRoundingMode ( VCVTTypes types , <nl> assm . GetCode ( isolate , & desc ) ; <nl> Object code = isolate - > heap ( ) - > CreateCode ( <nl> desc , <nl> - CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING , <nl> + CodeKind : : FOR_TESTING , <nl> Handle < Code > ( ) ) - > ToObjectChecked ( ) ; <nl> CHECK ( code - > IsCode ( ) ) ; <nl> # ifdef DEBUG <nl> TEST ( 8 ) { <nl> assm . GetCode ( isolate , & desc ) ; <nl> Object code = isolate - > heap ( ) - > CreateCode ( <nl> desc , <nl> - CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING , <nl> + CodeKind : : FOR_TESTING , <nl> Handle < Code > ( ) ) - > ToObjectChecked ( ) ; <nl> CHECK ( code - > IsCode ( ) ) ; <nl> # ifdef DEBUG <nl> TEST ( 9 ) { <nl> assm . GetCode ( isolate , & desc ) ; <nl> Object code = isolate - > heap ( ) - > CreateCode ( <nl> desc , <nl> - CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING , <nl> + CodeKind : : FOR_TESTING , <nl> Handle < Code > ( ) ) - > ToObjectChecked ( ) ; <nl> CHECK ( code - > IsCode ( ) ) ; <nl> # ifdef DEBUG <nl> TEST ( 10 ) { <nl> assm . GetCode ( isolate , & desc ) ; <nl> Object code = isolate - > heap ( ) - > CreateCode ( <nl> desc , <nl> - CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING , <nl> + CodeKind : : FOR_TESTING , <nl> Handle < Code > ( ) ) - > ToObjectChecked ( ) ; <nl> CHECK ( code - > IsCode ( ) ) ; <nl> # ifdef DEBUG <nl> TEST ( 11 ) { <nl> assm . GetCode ( isolate , & desc ) ; <nl> Object code = isolate - > heap ( ) - > CreateCode ( <nl> desc , <nl> - CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING , <nl> + CodeKind : : FOR_TESTING , <nl> Handle < Code > ( ) ) - > ToObjectChecked ( ) ; <nl> CHECK ( code - > IsCode ( ) ) ; <nl> # ifdef DEBUG <nl> mmm a / test / cctest / test - assembler - s390 . cc <nl> ppp b / test / cctest / test - assembler - s390 . cc <nl> TEST ( 0 ) { <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> # ifdef DEBUG <nl> code - > Print ( ) ; <nl> # endif <nl> TEST ( 1 ) { <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> # ifdef DEBUG <nl> code - > Print ( ) ; <nl> # endif <nl> TEST ( 2 ) { <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> # ifdef DEBUG <nl> code - > Print ( ) ; <nl> # endif <nl> TEST ( 3 ) { <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> # ifdef DEBUG <nl> code - > Print ( ) ; <nl> # endif <nl> TEST ( 4 ) { <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> Handle < Code > code = isolate - > factory ( ) - > NewCode ( <nl> - desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING , Handle < Code > ( ) ) ; <nl> + desc , CodeKind : : FOR_TESTING , Handle < Code > ( ) ) ; <nl> # ifdef DEBUG <nl> code - > Print ( ) ; <nl> # endif <nl> TEST ( 5 ) { <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> Handle < Code > code = isolate - > factory ( ) - > NewCode ( <nl> - desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING , Handle < Code > ( ) ) ; <nl> + desc , CodeKind : : FOR_TESTING , Handle < Code > ( ) ) ; <nl> # ifdef DEBUG <nl> code - > Print ( ) ; <nl> # endif <nl> TEST ( 6 ) { <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> Handle < Code > code = isolate - > factory ( ) - > NewCode ( <nl> - desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING , Handle < Code > ( ) ) ; <nl> + desc , CodeKind : : FOR_TESTING , Handle < Code > ( ) ) ; <nl> # ifdef DEBUG <nl> code - > Print ( ) ; <nl> # endif <nl> TEST ( 7 ) { <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> Handle < Code > code = isolate - > factory ( ) - > NewCode ( <nl> - desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING , Handle < Code > ( ) ) ; <nl> + desc , CodeKind : : FOR_TESTING , Handle < Code > ( ) ) ; <nl> # ifdef DEBUG <nl> code - > Print ( ) ; <nl> # endif <nl> TEST ( 8 ) { <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> Handle < Code > code = isolate - > factory ( ) - > NewCode ( <nl> - desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING , Handle < Code > ( ) ) ; <nl> + desc , CodeKind : : FOR_TESTING , Handle < Code > ( ) ) ; <nl> # ifdef DEBUG <nl> code - > Print ( ) ; <nl> # endif <nl> TEST ( 9 ) { <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> Handle < Code > code = isolate - > factory ( ) - > NewCode ( <nl> - desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING , Handle < Code > ( ) ) ; <nl> + desc , CodeKind : : FOR_TESTING , Handle < Code > ( ) ) ; <nl> # ifdef DEBUG <nl> code - > Print ( ) ; <nl> # endif <nl> TEST ( 10 ) { <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> # ifdef DEBUG <nl> code - > Print ( ) ; <nl> # endif <nl> TEST ( 11 ) { <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> # ifdef DEBUG <nl> code - > Print ( ) ; <nl> # endif <nl> TEST ( 12 ) { <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> # ifdef DEBUG <nl> code - > Print ( ) ; <nl> # endif <nl> TEST ( 13 ) { <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> # ifdef DEBUG <nl> code - > Print ( ) ; <nl> # endif <nl> TEST ( 14 ) { <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> # ifdef DEBUG <nl> code - > Print ( ) ; <nl> # endif <nl> TEST ( 15 ) { <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> # ifdef DEBUG <nl> code - > Print ( ) ; <nl> # endif <nl> TEST ( 16 ) { <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> # ifdef DEBUG <nl> code - > Print ( ) ; <nl> # endif <nl> TEST ( 17 ) { <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> # ifdef DEBUG <nl> code - > Print ( ) ; <nl> # endif <nl> TEST ( 18 ) { <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> # ifdef DEBUG <nl> code - > Print ( ) ; <nl> # endif <nl> mmm a / test / cctest / test - assembler - x64 . cc <nl> ppp b / test / cctest / test - assembler - x64 . cc <nl> TEST ( AssemblerMultiByteNop ) { <nl> <nl> CodeDesc desc ; <nl> masm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> <nl> auto f = GeneratedCode < F0 > : : FromCode ( * code ) ; <nl> int res = f . Call ( ) ; <nl> void DoSSE2 ( const v8 : : FunctionCallbackInfo < v8 : : Value > & args ) { <nl> <nl> CodeDesc desc ; <nl> masm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> <nl> auto f = GeneratedCode < F0 > : : FromCode ( * code ) ; <nl> int res = f . Call ( ) ; <nl> TEST ( AssemblerX64Extractps ) { <nl> <nl> CodeDesc desc ; <nl> masm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> # ifdef OBJECT_PRINT <nl> StdoutStream os ; <nl> code - > Print ( os ) ; <nl> TEST ( AssemblerX64SSE ) { <nl> <nl> CodeDesc desc ; <nl> masm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> # ifdef OBJECT_PRINT <nl> StdoutStream os ; <nl> code - > Print ( os ) ; <nl> TEST ( AssemblerX64SSE3 ) { <nl> <nl> CodeDesc desc ; <nl> masm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> # ifdef OBJECT_PRINT <nl> StdoutStream os ; <nl> code - > Print ( os ) ; <nl> TEST ( AssemblerX64FMA_sd ) { <nl> <nl> CodeDesc desc ; <nl> masm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> # ifdef OBJECT_PRINT <nl> StdoutStream os ; <nl> code - > Print ( os ) ; <nl> TEST ( AssemblerX64FMA_ss ) { <nl> <nl> CodeDesc desc ; <nl> masm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> # ifdef OBJECT_PRINT <nl> StdoutStream os ; <nl> code - > Print ( os ) ; <nl> TEST ( AssemblerX64SSE_ss ) { <nl> <nl> CodeDesc desc ; <nl> masm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> # ifdef OBJECT_PRINT <nl> StdoutStream os ; <nl> code - > Print ( os ) ; <nl> TEST ( AssemblerX64AVX_ss ) { <nl> <nl> CodeDesc desc ; <nl> masm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> # ifdef OBJECT_PRINT <nl> StdoutStream os ; <nl> code - > Print ( os ) ; <nl> TEST ( AssemblerX64AVX_sd ) { <nl> <nl> CodeDesc desc ; <nl> masm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> # ifdef OBJECT_PRINT <nl> StdoutStream os ; <nl> code - > Print ( os ) ; <nl> TEST ( AssemblerX64BMI1 ) { <nl> <nl> CodeDesc desc ; <nl> masm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> # ifdef OBJECT_PRINT <nl> StdoutStream os ; <nl> code - > Print ( os ) ; <nl> TEST ( AssemblerX64LZCNT ) { <nl> <nl> CodeDesc desc ; <nl> masm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> # ifdef OBJECT_PRINT <nl> StdoutStream os ; <nl> code - > Print ( os ) ; <nl> TEST ( AssemblerX64POPCNT ) { <nl> <nl> CodeDesc desc ; <nl> masm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> # ifdef OBJECT_PRINT <nl> StdoutStream os ; <nl> code - > Print ( os ) ; <nl> TEST ( AssemblerX64BMI2 ) { <nl> <nl> CodeDesc desc ; <nl> masm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> # ifdef OBJECT_PRINT <nl> StdoutStream os ; <nl> code - > Print ( os ) ; <nl> TEST ( AssemblerX64JumpTables1 ) { <nl> <nl> CodeDesc desc ; <nl> masm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> # ifdef OBJECT_PRINT <nl> code - > Print ( std : : cout ) ; <nl> # endif <nl> TEST ( AssemblerX64JumpTables2 ) { <nl> <nl> CodeDesc desc ; <nl> masm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> # ifdef OBJECT_PRINT <nl> code - > Print ( std : : cout ) ; <nl> # endif <nl> TEST ( AssemblerX64vmovups ) { <nl> <nl> CodeDesc desc ; <nl> masm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> # ifdef OBJECT_PRINT <nl> StdoutStream os ; <nl> code - > Print ( os ) ; <nl> mmm a / test / cctest / test - code - layout . cc <nl> ppp b / test / cctest / test - code - layout . cc <nl> TEST ( CodeLayoutWithoutUnwindingInfo ) { <nl> code_desc . unwinding_info_size = 0 ; <nl> code_desc . origin = nullptr ; <nl> <nl> - Handle < Code > code = <nl> - Factory : : CodeBuilder ( CcTest : : i_isolate ( ) , code_desc , <nl> - CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = Factory : : CodeBuilder ( CcTest : : i_isolate ( ) , code_desc , <nl> + CodeKind : : FOR_TESTING ) <nl> + . Build ( ) ; <nl> <nl> CHECK ( ! code - > has_unwinding_info ( ) ) ; <nl> CHECK_EQ ( code - > raw_instruction_size ( ) , buffer_size ) ; <nl> TEST ( CodeLayoutWithUnwindingInfo ) { <nl> code_desc . unwinding_info_size = unwinding_info_size ; <nl> code_desc . origin = nullptr ; <nl> <nl> - Handle < Code > code = <nl> - Factory : : CodeBuilder ( CcTest : : i_isolate ( ) , code_desc , <nl> - CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = Factory : : CodeBuilder ( CcTest : : i_isolate ( ) , code_desc , <nl> + CodeKind : : FOR_TESTING ) <nl> + . Build ( ) ; <nl> <nl> CHECK ( code - > has_unwinding_info ( ) ) ; <nl> CHECK_EQ ( code - > raw_instruction_size ( ) , buffer_size + unwinding_info_size ) ; <nl> mmm a / test / cctest / test - descriptor - array . cc <nl> ppp b / test / cctest / test - descriptor - array . cc <nl> Handle < JSFunction > CreateCsaDescriptorArrayLookup ( Isolate * isolate ) { <nl> <nl> compiler : : CodeAssemblerTester asm_tester ( <nl> isolate , kNumParams + 1 , / / + 1 to include receiver . <nl> - CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) ; <nl> + CodeKind : : FOR_TESTING ) ; <nl> { <nl> CodeStubAssembler m ( asm_tester . state ( ) ) ; <nl> <nl> Handle < JSFunction > CreateCsaTransitionArrayLookup ( Isolate * isolate ) { <nl> const int kNumParams = 2 ; <nl> compiler : : CodeAssemblerTester asm_tester ( <nl> isolate , kNumParams + 1 , / / + 1 to include receiver . <nl> - CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) ; <nl> + CodeKind : : FOR_TESTING ) ; <nl> { <nl> CodeStubAssembler m ( asm_tester . state ( ) ) ; <nl> <nl> mmm a / test / cctest / test - disasm - ia32 . cc <nl> ppp b / test / cctest / test - disasm - ia32 . cc <nl> TEST ( DisasmIa320 ) { <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> USE ( code ) ; <nl> # ifdef OBJECT_PRINT <nl> StdoutStream os ; <nl> mmm a / test / cctest / test - disasm - x64 . cc <nl> ppp b / test / cctest / test - disasm - x64 . cc <nl> TEST ( DisasmX64 ) { <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> USE ( code ) ; <nl> # ifdef OBJECT_PRINT <nl> StdoutStream os ; <nl> mmm a / test / cctest / test - heap - profiler . cc <nl> ppp b / test / cctest / test - heap - profiler . cc <nl> TEST ( WeakReference ) { <nl> i : : CodeDesc desc ; <nl> assm . GetCode ( i_isolate , & desc ) ; <nl> i : : Handle < i : : Code > code = <nl> - i : : Factory : : CodeBuilder ( i_isolate , desc , <nl> - i : : CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> + i : : Factory : : CodeBuilder ( i_isolate , desc , i : : CodeKind : : FOR_TESTING ) <nl> . Build ( ) ; <nl> CHECK ( code - > IsCode ( ) ) ; <nl> <nl> mmm a / test / cctest / test - macro - assembler - arm . cc <nl> ppp b / test / cctest / test - macro - assembler - arm . cc <nl> <nl> <nl> # include " src / codegen / assembler - inl . h " <nl> # include " src / codegen / macro - assembler . h " <nl> + # include " src / deoptimizer / deoptimizer . h " <nl> # include " src / execution / simulator . h " <nl> # include " src / init / v8 . h " <nl> # include " src / objects / objects - inl . h " <nl> TEST ( ExtractLane ) { <nl> <nl> CodeDesc desc ; <nl> masm - > GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> # ifdef DEBUG <nl> StdoutStream os ; <nl> code - > Print ( os ) ; <nl> TEST ( ReplaceLane ) { <nl> <nl> CodeDesc desc ; <nl> masm - > GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> # ifdef DEBUG <nl> StdoutStream os ; <nl> code - > Print ( os ) ; <nl> TEST ( ReplaceLane ) { <nl> } <nl> } <nl> <nl> + TEST ( DeoptExitSizeIsFixed ) { <nl> + CHECK ( Deoptimizer : : kSupportsFixedDeoptExitSizes ) ; <nl> + <nl> + Isolate * isolate = CcTest : : i_isolate ( ) ; <nl> + HandleScope handles ( isolate ) ; <nl> + auto buffer = AllocateAssemblerBuffer ( ) ; <nl> + MacroAssembler masm ( isolate , v8 : : internal : : CodeObjectRequired : : kYes , <nl> + buffer - > CreateView ( ) ) ; <nl> + <nl> + STATIC_ASSERT ( static_cast < int > ( kFirstDeoptimizeKind ) = = 0 ) ; <nl> + for ( int i = 0 ; i < kDeoptimizeKindCount ; i + + ) { <nl> + DeoptimizeKind kind = static_cast < DeoptimizeKind > ( i ) ; <nl> + Builtins : : Name target = Deoptimizer : : GetDeoptimizationEntry ( isolate , kind ) ; <nl> + Label before_exit ; <nl> + masm . bind ( & before_exit ) ; <nl> + masm . CallForDeoptimization ( target , 42 , & before_exit , kind , & before_exit ) ; <nl> + CHECK_EQ ( masm . SizeOfCodeGeneratedSince ( & before_exit ) , <nl> + kind = = DeoptimizeKind : : kLazy <nl> + ? Deoptimizer : : kLazyDeoptExitSize <nl> + : Deoptimizer : : kNonLazyDeoptExitSize ) ; <nl> + } <nl> + } <nl> + <nl> # undef __ <nl> <nl> } / / namespace test_macro_assembler_arm <nl> mmm a / test / cctest / test - macro - assembler - arm64 . cc <nl> ppp b / test / cctest / test - macro - assembler - arm64 . cc <nl> <nl> <nl> # include < stdlib . h > <nl> <nl> - # include " src / init / v8 . h " <nl> - <nl> # include " src / base / platform / platform . h " <nl> # include " src / codegen / arm64 / assembler - arm64 - inl . h " <nl> - # include " src / codegen / macro - assembler . h " <nl> + # include " src / codegen / macro - assembler - inl . h " <nl> + # include " src / deoptimizer / deoptimizer . h " <nl> # include " src / execution / simulator . h " <nl> # include " src / heap / factory . h " <nl> + # include " src / init / v8 . h " <nl> # include " src / objects / objects - inl . h " <nl> # include " src / objects / smi . h " <nl> # include " src / utils / ostreams . h " <nl> TEST ( EmbeddedObj ) { <nl> <nl> CodeDesc desc ; <nl> masm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> # ifdef DEBUG <nl> StdoutStream os ; <nl> code - > Print ( os ) ; <nl> TEST ( EmbeddedObj ) { <nl> # endif / / V8_COMPRESS_POINTERS <nl> } <nl> <nl> + TEST ( DeoptExitSizeIsFixed ) { <nl> + CHECK ( Deoptimizer : : kSupportsFixedDeoptExitSizes ) ; <nl> + <nl> + Isolate * isolate = CcTest : : i_isolate ( ) ; <nl> + HandleScope handles ( isolate ) ; <nl> + auto buffer = AllocateAssemblerBuffer ( ) ; <nl> + MacroAssembler masm ( isolate , v8 : : internal : : CodeObjectRequired : : kYes , <nl> + buffer - > CreateView ( ) ) ; <nl> + <nl> + STATIC_ASSERT ( static_cast < int > ( kFirstDeoptimizeKind ) = = 0 ) ; <nl> + for ( int i = 0 ; i < kDeoptimizeKindCount ; i + + ) { <nl> + DeoptimizeKind kind = static_cast < DeoptimizeKind > ( i ) ; <nl> + Builtins : : Name target = Deoptimizer : : GetDeoptimizationEntry ( isolate , kind ) ; <nl> + Label before_exit ; <nl> + / / Mirroring logic in code - generator . cc . <nl> + if ( kind = = DeoptimizeKind : : kLazy ) { <nl> + / / CFI emits an extra instruction here . <nl> + masm . BindExceptionHandler ( & before_exit ) ; <nl> + } else { <nl> + masm . bind ( & before_exit ) ; <nl> + } <nl> + masm . CallForDeoptimization ( target , 42 , & before_exit , kind , & before_exit ) ; <nl> + CHECK_EQ ( masm . SizeOfCodeGeneratedSince ( & before_exit ) , <nl> + kind = = DeoptimizeKind : : kLazy <nl> + ? Deoptimizer : : kLazyDeoptExitSize <nl> + : Deoptimizer : : kNonLazyDeoptExitSize ) ; <nl> + } <nl> + } <nl> + <nl> # undef __ <nl> <nl> } / / namespace test_macro_assembler_arm64 <nl> mmm a / test / cctest / test - macro - assembler - mips . cc <nl> ppp b / test / cctest / test - macro - assembler - mips . cc <nl> TEST ( BYTESWAP ) { <nl> <nl> CodeDesc desc ; <nl> masm - > GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> auto f = GeneratedCode < F3 > : : FromCode ( * code ) ; <nl> <nl> for ( size_t i = 0 ; i < arraysize ( test_values ) ; i + + ) { <nl> TEST ( jump_tables4 ) { <nl> <nl> CodeDesc desc ; <nl> masm - > GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> # ifdef OBJECT_PRINT <nl> code - > Print ( std : : cout ) ; <nl> # endif <nl> TEST ( jump_tables5 ) { <nl> <nl> CodeDesc desc ; <nl> masm - > GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> # ifdef OBJECT_PRINT <nl> code - > Print ( std : : cout ) ; <nl> # endif <nl> TEST ( jump_tables6 ) { <nl> <nl> CodeDesc desc ; <nl> masm - > GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> # ifdef OBJECT_PRINT <nl> code - > Print ( std : : cout ) ; <nl> # endif <nl> static uint32_t run_lsa ( uint32_t rt , uint32_t rs , int8_t sa ) { <nl> <nl> CodeDesc desc ; <nl> assembler . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> <nl> auto f = GeneratedCode < F1 > : : FromCode ( * code ) ; <nl> <nl> RET_TYPE run_Cvt ( IN_TYPE x , Func GenerateConvertInstructionFunc ) { <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> <nl> auto f = GeneratedCode < F_CVT > : : FromCode ( * code ) ; <nl> <nl> TEST ( OverflowInstructions ) { <nl> CodeDesc desc ; <nl> masm - > GetCode ( isolate , & desc ) ; <nl> Handle < Code > code = <nl> - Factory : : CodeBuilder ( isolate , desc , <nl> - CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> auto f = GeneratedCode < F3 > : : FromCode ( * code ) ; <nl> t . lhs = ii ; <nl> t . rhs = jj ; <nl> TEST ( min_max_nan ) { <nl> <nl> CodeDesc desc ; <nl> masm - > GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> auto f = GeneratedCode < F3 > : : FromCode ( * code ) ; <nl> for ( int i = 0 ; i < kTableLength ; i + + ) { <nl> test . a = inputsa [ i ] ; <nl> bool run_Unaligned ( char * memory_buffer , int32_t in_offset , int32_t out_offset , <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> <nl> auto f = GeneratedCode < F_CVT > : : FromCode ( * code ) ; <nl> <nl> bool run_Sltu ( uint32_t rs , uint32_t rd , Func GenerateSltuInstructionFunc ) { <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> <nl> auto f = GeneratedCode < F_CVT > : : FromCode ( * code ) ; <nl> int32_t res = reinterpret_cast < int32_t > ( f . Call ( rs , rd , 0 , 0 , 0 ) ) ; <nl> static GeneratedCode < F4 > GenerateMacroFloat32MinMax ( MacroAssembler * masm ) { <nl> CodeDesc desc ; <nl> masm - > GetCode ( masm - > isolate ( ) , & desc ) ; <nl> Handle < Code > code = <nl> - Factory : : CodeBuilder ( masm - > isolate ( ) , desc , <nl> - CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> + Factory : : CodeBuilder ( masm - > isolate ( ) , desc , CodeKind : : FOR_TESTING ) <nl> . Build ( ) ; <nl> # ifdef DEBUG <nl> StdoutStream os ; <nl> static GeneratedCode < F4 > GenerateMacroFloat64MinMax ( MacroAssembler * masm ) { <nl> CodeDesc desc ; <nl> masm - > GetCode ( masm - > isolate ( ) , & desc ) ; <nl> Handle < Code > code = <nl> - Factory : : CodeBuilder ( masm - > isolate ( ) , desc , <nl> - CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> + Factory : : CodeBuilder ( masm - > isolate ( ) , desc , CodeKind : : FOR_TESTING ) <nl> . Build ( ) ; <nl> # ifdef DEBUG <nl> StdoutStream os ; <nl> mmm a / test / cctest / test - macro - assembler - mips64 . cc <nl> ppp b / test / cctest / test - macro - assembler - mips64 . cc <nl> TEST ( BYTESWAP ) { <nl> <nl> CodeDesc desc ; <nl> masm - > GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> auto f = GeneratedCode < F3 > : : FromCode ( * code ) ; <nl> <nl> for ( size_t i = 0 ; i < arraysize ( test_values ) ; i + + ) { <nl> TEST ( LoadConstants ) { <nl> <nl> CodeDesc desc ; <nl> masm - > GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> <nl> auto f = GeneratedCode < FV > : : FromCode ( * code ) ; <nl> ( void ) f . Call ( reinterpret_cast < int64_t > ( result ) , 0 , 0 , 0 , 0 ) ; <nl> TEST ( LoadAddress ) { <nl> <nl> CodeDesc desc ; <nl> masm - > GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> <nl> auto f = GeneratedCode < FV > : : FromCode ( * code ) ; <nl> ( void ) f . Call ( 0 , 0 , 0 , 0 , 0 ) ; <nl> TEST ( jump_tables4 ) { <nl> <nl> CodeDesc desc ; <nl> masm - > GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> # ifdef OBJECT_PRINT <nl> code - > Print ( std : : cout ) ; <nl> # endif <nl> TEST ( jump_tables5 ) { <nl> <nl> CodeDesc desc ; <nl> masm - > GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> # ifdef OBJECT_PRINT <nl> code - > Print ( std : : cout ) ; <nl> # endif <nl> TEST ( jump_tables6 ) { <nl> <nl> CodeDesc desc ; <nl> masm - > GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> # ifdef OBJECT_PRINT <nl> code - > Print ( std : : cout ) ; <nl> # endif <nl> static uint64_t run_lsa ( uint32_t rt , uint32_t rs , int8_t sa ) { <nl> <nl> CodeDesc desc ; <nl> assembler . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> <nl> auto f = GeneratedCode < F1 > : : FromCode ( * code ) ; <nl> <nl> static uint64_t run_dlsa ( uint64_t rt , uint64_t rs , int8_t sa ) { <nl> <nl> CodeDesc desc ; <nl> assembler . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> <nl> auto f = GeneratedCode < FV > : : FromCode ( * code ) ; <nl> <nl> RET_TYPE run_Cvt ( IN_TYPE x , Func GenerateConvertInstructionFunc ) { <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> <nl> auto f = GeneratedCode < F_CVT > : : FromCode ( * code ) ; <nl> <nl> TEST ( OverflowInstructions ) { <nl> CodeDesc desc ; <nl> masm - > GetCode ( isolate , & desc ) ; <nl> Handle < Code > code = <nl> - Factory : : CodeBuilder ( isolate , desc , <nl> - CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> auto f = GeneratedCode < F3 > : : FromCode ( * code ) ; <nl> t . lhs = ii ; <nl> t . rhs = jj ; <nl> TEST ( min_max_nan ) { <nl> <nl> CodeDesc desc ; <nl> masm - > GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> auto f = GeneratedCode < F3 > : : FromCode ( * code ) ; <nl> for ( int i = 0 ; i < kTableLength ; i + + ) { <nl> test . a = inputsa [ i ] ; <nl> bool run_Unaligned ( char * memory_buffer , int32_t in_offset , int32_t out_offset , <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> <nl> auto f = GeneratedCode < F_CVT > : : FromCode ( * code ) ; <nl> <nl> bool run_Sltu ( uint64_t rs , uint64_t rd , Func GenerateSltuInstructionFunc ) { <nl> <nl> CodeDesc desc ; <nl> assm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> <nl> auto f = GeneratedCode < F_CVT > : : FromCode ( * code ) ; <nl> int64_t res = reinterpret_cast < int64_t > ( f . Call ( rs , rd , 0 , 0 , 0 ) ) ; <nl> static GeneratedCode < F4 > GenerateMacroFloat32MinMax ( MacroAssembler * masm ) { <nl> CodeDesc desc ; <nl> masm - > GetCode ( masm - > isolate ( ) , & desc ) ; <nl> Handle < Code > code = <nl> - Factory : : CodeBuilder ( masm - > isolate ( ) , desc , <nl> - CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> + Factory : : CodeBuilder ( masm - > isolate ( ) , desc , CodeKind : : FOR_TESTING ) <nl> . Build ( ) ; <nl> # ifdef DEBUG <nl> StdoutStream os ; <nl> static GeneratedCode < F4 > GenerateMacroFloat64MinMax ( MacroAssembler * masm ) { <nl> CodeDesc desc ; <nl> masm - > GetCode ( masm - > isolate ( ) , & desc ) ; <nl> Handle < Code > code = <nl> - Factory : : CodeBuilder ( masm - > isolate ( ) , desc , <nl> - CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> + Factory : : CodeBuilder ( masm - > isolate ( ) , desc , CodeKind : : FOR_TESTING ) <nl> . Build ( ) ; <nl> # ifdef DEBUG <nl> StdoutStream os ; <nl> mmm a / test / cctest / test - macro - assembler - x64 . cc <nl> ppp b / test / cctest / test - macro - assembler - x64 . cc <nl> <nl> <nl> # include < stdlib . h > <nl> <nl> - # include " src / init / v8 . h " <nl> - <nl> # include " src / base / platform / platform . h " <nl> # include " src / codegen / macro - assembler . h " <nl> # include " src / codegen / x64 / assembler - x64 - inl . h " <nl> + # include " src / deoptimizer / deoptimizer . h " <nl> # include " src / execution / simulator . h " <nl> # include " src / heap / factory . h " <nl> + # include " src / init / v8 . h " <nl> # include " src / objects / objects - inl . h " <nl> # include " src / objects / smi . h " <nl> # include " src / utils / ostreams . h " <nl> TEST ( EmbeddedObj ) { <nl> <nl> CodeDesc desc ; <nl> masm - > GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> # ifdef OBJECT_PRINT <nl> StdoutStream os ; <nl> code - > Print ( os ) ; <nl> TEST ( AreAliased ) { <nl> DCHECK ( AreAliased ( rax , no_reg , rbx , no_reg , rcx , no_reg , rdx , rax , no_reg ) ) ; <nl> } <nl> <nl> + TEST ( DeoptExitSizeIsFixed ) { <nl> + CHECK ( Deoptimizer : : kSupportsFixedDeoptExitSizes ) ; <nl> + <nl> + Isolate * isolate = CcTest : : i_isolate ( ) ; <nl> + HandleScope handles ( isolate ) ; <nl> + auto buffer = AllocateAssemblerBuffer ( ) ; <nl> + MacroAssembler masm ( isolate , v8 : : internal : : CodeObjectRequired : : kYes , <nl> + buffer - > CreateView ( ) ) ; <nl> + <nl> + STATIC_ASSERT ( static_cast < int > ( kFirstDeoptimizeKind ) = = 0 ) ; <nl> + for ( int i = 0 ; i < kDeoptimizeKindCount ; i + + ) { <nl> + DeoptimizeKind kind = static_cast < DeoptimizeKind > ( i ) ; <nl> + Builtins : : Name target = Deoptimizer : : GetDeoptimizationEntry ( isolate , kind ) ; <nl> + Label before_exit ; <nl> + masm . bind ( & before_exit ) ; <nl> + masm . CallForDeoptimization ( target , 42 , & before_exit , kind , nullptr ) ; <nl> + CHECK_EQ ( masm . SizeOfCodeGeneratedSince ( & before_exit ) , <nl> + kind = = DeoptimizeKind : : kLazy <nl> + ? Deoptimizer : : kLazyDeoptExitSize <nl> + : Deoptimizer : : kNonLazyDeoptExitSize ) ; <nl> + } <nl> + } <nl> + <nl> # undef __ <nl> <nl> } / / namespace test_macro_assembler_x64 <nl> mmm a / test / cctest / test - sync - primitives - arm64 . cc <nl> ppp b / test / cctest / test - sync - primitives - arm64 . cc <nl> void TestInvalidateExclusiveAccess ( TestData initial_data , MemoryAccess access1 , <nl> <nl> CodeDesc desc ; <nl> masm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> <nl> TestData t = initial_data ; <nl> Simulator : : current ( isolate ) - > Call < void > ( code - > entry ( ) , & t ) ; <nl> int ExecuteMemoryAccess ( Isolate * isolate , TestData * test_data , <nl> <nl> CodeDesc desc ; <nl> masm . GetCode ( isolate , & desc ) ; <nl> - Handle < Code > code = Factory : : CodeBuilder ( <nl> - isolate , desc , CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> Simulator : : current ( isolate ) - > Call < void > ( code - > entry ( ) , test_data ) ; <nl> return Simulator : : current ( isolate ) - > wreg ( 0 ) ; <nl> } <nl> mmm a / test / fuzzer / multi - return . cc <nl> ppp b / test / fuzzer / multi - return . cc <nl> extern " C " int LLVMFuzzerTestOneInput ( const uint8_t * data , size_t size ) { <nl> callee . Return ( static_cast < int > ( desc - > ReturnCount ( ) ) , returns . get ( ) ) ; <nl> <nl> OptimizedCompilationInfo info ( ArrayVector ( " testing " ) , & zone , <nl> - CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) ; <nl> + CodeKind : : FOR_TESTING ) ; <nl> Handle < Code > code = <nl> Pipeline : : GenerateCodeForTesting ( & info , i_isolate , desc , callee . graph ( ) , <nl> AssemblerOptions : : Default ( i_isolate ) , <nl> extern " C " int LLVMFuzzerTestOneInput ( const uint8_t * data , size_t size ) { <nl> <nl> / / Call the wrapper . <nl> OptimizedCompilationInfo wrapper_info ( ArrayVector ( " wrapper " ) , & zone , <nl> - CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) ; <nl> + CodeKind : : FOR_TESTING ) ; <nl> Handle < Code > wrapper_code = <nl> Pipeline : : GenerateCodeForTesting ( <nl> & wrapper_info , i_isolate , wrapper_desc , caller . graph ( ) , <nl> mmm a / test / unittests / assembler / turbo - assembler - arm - unittest . cc <nl> ppp b / test / unittests / assembler / turbo - assembler - arm - unittest . cc <nl> TEST_P ( TurboAssemblerTestMoveObjectAndSlot , MoveObjectAndSlot ) { <nl> tasm . GetCode ( nullptr , & desc ) ; <nl> if ( FLAG_print_code ) { <nl> Handle < Code > code = <nl> - Factory : : CodeBuilder ( isolate ( ) , desc , <nl> - CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Factory : : CodeBuilder ( isolate ( ) , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> StdoutStream os ; <nl> code - > Print ( os ) ; <nl> } <nl> mmm a / test / unittests / assembler / turbo - assembler - arm64 - unittest . cc <nl> ppp b / test / unittests / assembler / turbo - assembler - arm64 - unittest . cc <nl> TEST_P ( TurboAssemblerTestMoveObjectAndSlot , MoveObjectAndSlot ) { <nl> tasm . GetCode ( nullptr , & desc ) ; <nl> if ( FLAG_print_code ) { <nl> Handle < Code > code = <nl> - Factory : : CodeBuilder ( isolate ( ) , desc , <nl> - CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING ) <nl> - . Build ( ) ; <nl> + Factory : : CodeBuilder ( isolate ( ) , desc , CodeKind : : FOR_TESTING ) . Build ( ) ; <nl> StdoutStream os ; <nl> code - > Print ( os ) ; <nl> } <nl> mmm a / test / unittests / codegen / code - stub - assembler - unittest . cc <nl> ppp b / test / unittests / codegen / code - stub - assembler - unittest . cc <nl> CodeStubAssemblerTestState : : CodeStubAssemblerTestState ( <nl> CodeStubAssemblerTest * test ) <nl> : compiler : : CodeAssemblerState ( <nl> test - > isolate ( ) , test - > zone ( ) , VoidDescriptor { } , <nl> - CodeKind : : DEOPT_ENTRIES_OR_FOR_TESTING , " test " , <nl> + CodeKind : : FOR_TESTING , " test " , <nl> PoisoningMitigationLevel : : kPoisonCriticalOnly ) { } <nl> <nl> TARGET_TEST_F ( CodeStubAssemblerTest , SmiTag ) { <nl>
Reland " Reland " [ deoptimizer ] Change deopt entries into builtins " "
v8/v8
c7cb9beca18d98ba83c3b75860b912219d425d0e
2020-10-21T06:01:38Z
mmm a / tensorflow / docs_src / tutorials / recurrent_quickdraw . md <nl> ppp b / tensorflow / docs_src / tutorials / recurrent_quickdraw . md <nl> This download will take a while and download a bit more than 23GB of data . <nl> # # # Optional : Converting the data <nl> <nl> To convert the ` ndjson ` files to <nl> - @ { $ python / python_io # tfrecords_format_details $ TFRecord } files containing <nl> + @ { $ python / python_io # TFRecords_Format_Details $ TFRecord } files containing <nl> [ ` tf . train . Example ` ] ( https : / / www . tensorflow . org / code / tensorflow / core / example / example . proto ) <nl> protos run the following command . <nl> <nl> protos run the following command . <nl> ` ` ` <nl> <nl> This will store the data in 10 shards of <nl> - @ { $ python / python_io # tfrecords_format_details $ TFRecord } files with 10000 items <nl> + @ { $ python / python_io # TFRecords_Format_Details $ TFRecord } files with 10000 items <nl> per class for the training data and 1000 items per class as eval data . <nl> <nl> This conversion process is described in more detail in the following . <nl>
Fix two more case - sensitive anchor link
tensorflow/tensorflow
168559c27a2070d8f069e1f11ffd641ca579afc6
2018-03-18T14:10:10Z
mmm a / test / integration / big_values . py <nl> ppp b / test / integration / big_values . py <nl> def test_value_of_size ( size , port ) : <nl> too_big = False <nl> print " ok . " <nl> <nl> - elif msg . startswith ( " CLIENT_ERROR " ) : <nl> + elif msg . startswith ( " SERVER_ERROR object too large for cache " ) : <nl> print " too big . " <nl> too_big = True <nl> <nl> def test ( opts , port ) : <nl> <nl> test_values_near_size ( 100000 , port ) <nl> <nl> - <nl> - # threshold for max legal value size <nl> + # test values that are close to the limit <nl> test_values_near_size ( 1024 * 1024 , port ) <nl> <nl> + # test values that are way too big <nl> + test_values_near_size ( 1024 * 1024 + 100 , port ) <nl> + <nl> if __name__ = = " __main__ " : <nl> op = make_option_parser ( ) <nl> opts = op . parse ( sys . argv ) <nl>
Fixed up big values test a bit .
rethinkdb/rethinkdb
5e2e51391e4c09599192fa86b5d39f88ea9c0cba
2010-12-16T21:49:21Z
mmm a / xbmc / FileSystem / FileZip . h <nl> ppp b / xbmc / FileSystem / FileZip . h <nl> <nl> <nl> <nl> # include " IFile . h " <nl> + # ifdef _WIN32 <nl> # include " lib / zlib / zlib . h " <nl> + # else <nl> + # include < zlib . h > <nl> + # endif <nl> # include " utils / log . h " <nl> # include " GUIWindowManager . h " <nl> # include " FileSystem / File . h " <nl>
fixed : use correct zlib include . inspired by patch from fiveisalive , cheers
xbmc/xbmc
a948d64fecc94d01fe1fd95bcccd5190bb9e8f80
2010-02-11T22:57:18Z
mmm a / src / rdb_protocol / ql2 . proto <nl> ppp b / src / rdb_protocol / ql2 . proto <nl> message Term { <nl> REPLACE = 55 ; / / StreamSelection , Function ( 1 ) , { non_atomic : BOOL , durability : STRING , return_vals : BOOL } - > OBJECT | SingleSelection , Function ( 1 ) , { non_atomic : BOOL , durability : STRING , return_vals : BOOL } - > OBJECT <nl> / / Inserts into a table . If ` conflict ` is replace , overwrites <nl> / / entries with the same primary key . If ` conflict ` is <nl> - / / update , does an update on the entry . Otherwise , triggers <nl> - / / an error . <nl> + / / update , does an update on the entry . If ` conflict ` is <nl> + / / error , or is omitted , conflicts will trigger an error . <nl> INSERT = 56 ; / / Table , OBJECT , { conflict : STRING , durability : STRING , return_vals : BOOL } - > OBJECT | Table , Sequence , { conflict : STRING , durability : STRING , return_vals : BOOL } - > OBJECT <nl> <nl> / / * Administrative OPs <nl>
Describe conflict = error option in protobuf file
rethinkdb/rethinkdb
1831868fbb925fa7cf8b1cd6b1dfc2643e55d2d6
2014-07-09T01:38:44Z
mmm a / tools / dockerfile / test / bazel / Dockerfile <nl> ppp b / tools / dockerfile / test / bazel / Dockerfile <nl> RUN pip install futures = = 2 . 2 . 0 enum34 = = 1 . 0 . 4 protobuf = = 3 . 5 . 2 . post1 six = = 1 . 10 . 0 t <nl> # Bazel installation <nl> <nl> RUN apt - get update & & apt - get install - y wget & & apt - get clean <nl> - RUN wget - q https : / / github . com / bazelbuild / bazel / releases / download / 0 . 21 . 0 / bazel - 0 . 21 . 0 - linux - x86_64 - O / usr / local / bin / bazel <nl> + RUN wget - q https : / / github . com / bazelbuild / bazel / releases / download / 0 . 17 . 1 / bazel - 0 . 17 . 1 - linux - x86_64 - O / usr / local / bin / bazel <nl> RUN chmod 755 / usr / local / bin / bazel <nl> <nl> <nl>
Revert " Upgrade Bazel to 21 . 0 "
grpc/grpc
109a6a9a09320e48fbd8e8f73ca98425d150f2a1
2019-01-16T18:32:18Z
new file mode 100755 <nl> index 000000000000 . . f74ac3d549f8 <nl> mmm / dev / null <nl> ppp b / db / db_10 . sln <nl> <nl> +  <nl> + Microsoft Visual Studio Solution File , Format Version 11 . 00 <nl> + # Visual Studio 2010 <nl> + Project ( " { 2150E333 - 8FDC - 42A3 - 9474 - 1A3956D46DE8 } " ) = " examples " , " examples " , " { 4082881B - EB00 - 486F - 906C - 843B8EC06E18 } " <nl> + ProjectSection ( SolutionItems ) = preProject <nl> + driverHelpers . cpp = driverHelpers . cpp <nl> + EndProjectSection <nl> + EndProject <nl> + Project ( " { 2150E333 - 8FDC - 42A3 - 9474 - 1A3956D46DE8 } " ) = " tools " , " tools " , " { 2B262D59 - 9DC7 - 4BF1 - A431 - 1BD4966899A5 } " <nl> + ProjectSection ( SolutionItems ) = preProject <nl> + . . \ tools \ export . cpp = . . \ tools \ export . cpp <nl> + . . \ tools \ sniffer . cpp = . . \ tools \ sniffer . cpp <nl> + EndProjectSection <nl> + EndProject <nl> + Project ( " { 2150E333 - 8FDC - 42A3 - 9474 - 1A3956D46DE8 } " ) = " unix files " , " unix files " , " { 2F760952 - C71B - 4865 - 998F - AABAE96D1373 } " <nl> + ProjectSection ( SolutionItems ) = preProject <nl> + . . \ util \ processinfo_darwin . cpp = . . \ util \ processinfo_darwin . cpp <nl> + . . \ util \ processinfo_linux2 . cpp = . . \ util \ processinfo_linux2 . cpp <nl> + . . \ util \ processinfo_none . cpp = . . \ util \ processinfo_none . cpp <nl> + EndProjectSection <nl> + EndProject <nl> + Project ( " { 2150E333 - 8FDC - 42A3 - 9474 - 1A3956D46DE8 } " ) = " shell " , " shell " , " { 407B4B88 - 3451 - 433C - B74F - 31B31FEB5791 } " <nl> + EndProject <nl> + Project ( " { 2150E333 - 8FDC - 42A3 - 9474 - 1A3956D46DE8 } " ) = " other " , " other " , " { 12B11474 - 2D74 - 48C3 - BB3D - F03249BEA88F } " <nl> + EndProject <nl> + Project ( " { 8BC9CEB8 - 8B4A - 11D0 - 8D11 - 00A0C91BC942 } " ) = " mongod " , " db . vcxproj " , " { 215B2D68 - 0A70 - 4D10 - 8E75 - B31010C62A91 } " <nl> + EndProject <nl> + Project ( " { 8BC9CEB8 - 8B4A - 11D0 - 8D11 - 00A0C91BC942 } " ) = " mongos " , " . . \ s \ dbgrid . vcxproj " , " { E03717ED - 69B4 - 4D21 - BC55 - DF6690B585C6 } " <nl> + EndProject <nl> + Project ( " { 8BC9CEB8 - 8B4A - 11D0 - 8D11 - 00A0C91BC942 } " ) = " test " , " . . \ dbtests \ test . vcxproj " , " { 215B2D68 - 0A70 - 4D10 - 8E75 - B33010C62A91 } " <nl> + EndProject <nl> + Project ( " { 8BC9CEB8 - 8B4A - 11D0 - 8D11 - 00A0C91BC942 } " ) = " bsondemo " , " . . \ bson \ bsondemo \ bsondemo . vcxproj " , " { C9DB5EB7 - 81AA - 4185 - BAA1 - DA035654402F } " <nl> + EndProject <nl> + Project ( " { 8BC9CEB8 - 8B4A - 11D0 - 8D11 - 00A0C91BC942 } " ) = " mongoutils test program " , " . . \ util \ mongoutils \ mongoutils . vcxproj " , " { 7B84584E - 92BC - 4DB9 - 971B - A1A8F93E5053 } " <nl> + EndProject <nl> + Project ( " { 2150E333 - 8FDC - 42A3 - 9474 - 1A3956D46DE8 } " ) = " jstests " , " jstests " , " { F5ABFB2C - A34F - 48C1 - 9B5F - 01D456AF6C57 } " <nl> + ProjectSection ( SolutionItems ) = preProject <nl> + . . \ jstests \ index_many . js = . . \ jstests \ index_many . js <nl> + . . \ jstests \ indexapi . js = . . \ jstests \ indexapi . js <nl> + . . \ jstests \ objid5 . js = . . \ jstests \ objid5 . js <nl> + EndProjectSection <nl> + EndProject <nl> + Global <nl> + GlobalSection ( SolutionConfigurationPlatforms ) = preSolution <nl> + Debug | Any CPU = Debug | Any CPU <nl> + Debug | Mixed Platforms = Debug | Mixed Platforms <nl> + Debug | Win32 = Debug | Win32 <nl> + Debug | x64 = Debug | x64 <nl> + Release | Any CPU = Release | Any CPU <nl> + Release | Mixed Platforms = Release | Mixed Platforms <nl> + Release | Win32 = Release | Win32 <nl> + Release | x64 = Release | x64 <nl> + EndGlobalSection <nl> + GlobalSection ( ProjectConfigurationPlatforms ) = postSolution <nl> + { 215B2D68 - 0A70 - 4D10 - 8E75 - B31010C62A91 } . Debug | Any CPU . ActiveCfg = Debug | x64 <nl> + { 215B2D68 - 0A70 - 4D10 - 8E75 - B31010C62A91 } . Debug | Mixed Platforms . ActiveCfg = Debug | x64 <nl> + { 215B2D68 - 0A70 - 4D10 - 8E75 - B31010C62A91 } . Debug | Mixed Platforms . Build . 0 = Debug | x64 <nl> + { 215B2D68 - 0A70 - 4D10 - 8E75 - B31010C62A91 } . Debug | Win32 . ActiveCfg = Debug | Win32 <nl> + { 215B2D68 - 0A70 - 4D10 - 8E75 - B31010C62A91 } . Debug | Win32 . Build . 0 = Debug | Win32 <nl> + { 215B2D68 - 0A70 - 4D10 - 8E75 - B31010C62A91 } . Debug | x64 . ActiveCfg = Debug | x64 <nl> + { 215B2D68 - 0A70 - 4D10 - 8E75 - B31010C62A91 } . Debug | x64 . Build . 0 = Debug | x64 <nl> + { 215B2D68 - 0A70 - 4D10 - 8E75 - B31010C62A91 } . Release | Any CPU . ActiveCfg = Release | x64 <nl> + { 215B2D68 - 0A70 - 4D10 - 8E75 - B31010C62A91 } . Release | Mixed Platforms . ActiveCfg = Release | x64 <nl> + { 215B2D68 - 0A70 - 4D10 - 8E75 - B31010C62A91 } . Release | Mixed Platforms . Build . 0 = Release | x64 <nl> + { 215B2D68 - 0A70 - 4D10 - 8E75 - B31010C62A91 } . Release | Win32 . ActiveCfg = Release | Win32 <nl> + { 215B2D68 - 0A70 - 4D10 - 8E75 - B31010C62A91 } . Release | Win32 . Build . 0 = Release | Win32 <nl> + { 215B2D68 - 0A70 - 4D10 - 8E75 - B31010C62A91 } . Release | x64 . ActiveCfg = Release | x64 <nl> + { 215B2D68 - 0A70 - 4D10 - 8E75 - B31010C62A91 } . Release | x64 . Build . 0 = Release | x64 <nl> + { E03717ED - 69B4 - 4D21 - BC55 - DF6690B585C6 } . Debug | Any CPU . ActiveCfg = Debug | x64 <nl> + { E03717ED - 69B4 - 4D21 - BC55 - DF6690B585C6 } . Debug | Mixed Platforms . ActiveCfg = Debug | x64 <nl> + { E03717ED - 69B4 - 4D21 - BC55 - DF6690B585C6 } . Debug | Mixed Platforms . Build . 0 = Debug | x64 <nl> + { E03717ED - 69B4 - 4D21 - BC55 - DF6690B585C6 } . Debug | Win32 . ActiveCfg = Debug | Win32 <nl> + { E03717ED - 69B4 - 4D21 - BC55 - DF6690B585C6 } . Debug | Win32 . Build . 0 = Debug | Win32 <nl> + { E03717ED - 69B4 - 4D21 - BC55 - DF6690B585C6 } . Debug | x64 . ActiveCfg = Debug | x64 <nl> + { E03717ED - 69B4 - 4D21 - BC55 - DF6690B585C6 } . Debug | x64 . Build . 0 = Debug | x64 <nl> + { E03717ED - 69B4 - 4D21 - BC55 - DF6690B585C6 } . Release | Any CPU . ActiveCfg = Release | x64 <nl> + { E03717ED - 69B4 - 4D21 - BC55 - DF6690B585C6 } . Release | Mixed Platforms . ActiveCfg = Release | x64 <nl> + { E03717ED - 69B4 - 4D21 - BC55 - DF6690B585C6 } . Release | Mixed Platforms . Build . 0 = Release | x64 <nl> + { E03717ED - 69B4 - 4D21 - BC55 - DF6690B585C6 } . Release | Win32 . ActiveCfg = Release | Win32 <nl> + { E03717ED - 69B4 - 4D21 - BC55 - DF6690B585C6 } . Release | Win32 . Build . 0 = Release | Win32 <nl> + { E03717ED - 69B4 - 4D21 - BC55 - DF6690B585C6 } . Release | x64 . ActiveCfg = Release | x64 <nl> + { E03717ED - 69B4 - 4D21 - BC55 - DF6690B585C6 } . Release | x64 . Build . 0 = Release | x64 <nl> + { 215B2D68 - 0A70 - 4D10 - 8E75 - B33010C62A91 } . Debug | Any CPU . ActiveCfg = Debug | x64 <nl> + { 215B2D68 - 0A70 - 4D10 - 8E75 - B33010C62A91 } . Debug | Mixed Platforms . ActiveCfg = Debug | x64 <nl> + { 215B2D68 - 0A70 - 4D10 - 8E75 - B33010C62A91 } . Debug | Mixed Platforms . Build . 0 = Debug | x64 <nl> + { 215B2D68 - 0A70 - 4D10 - 8E75 - B33010C62A91 } . Debug | Win32 . ActiveCfg = Debug | Win32 <nl> + { 215B2D68 - 0A70 - 4D10 - 8E75 - B33010C62A91 } . Debug | Win32 . Build . 0 = Debug | Win32 <nl> + { 215B2D68 - 0A70 - 4D10 - 8E75 - B33010C62A91 } . Debug | x64 . ActiveCfg = Debug | x64 <nl> + { 215B2D68 - 0A70 - 4D10 - 8E75 - B33010C62A91 } . Debug | x64 . Build . 0 = Debug | x64 <nl> + { 215B2D68 - 0A70 - 4D10 - 8E75 - B33010C62A91 } . Release | Any CPU . ActiveCfg = Release | x64 <nl> + { 215B2D68 - 0A70 - 4D10 - 8E75 - B33010C62A91 } . Release | Mixed Platforms . ActiveCfg = Release | x64 <nl> + { 215B2D68 - 0A70 - 4D10 - 8E75 - B33010C62A91 } . Release | Mixed Platforms . Build . 0 = Release | x64 <nl> + { 215B2D68 - 0A70 - 4D10 - 8E75 - B33010C62A91 } . Release | Win32 . ActiveCfg = Release | Win32 <nl> + { 215B2D68 - 0A70 - 4D10 - 8E75 - B33010C62A91 } . Release | Win32 . Build . 0 = Release | Win32 <nl> + { 215B2D68 - 0A70 - 4D10 - 8E75 - B33010C62A91 } . Release | x64 . ActiveCfg = Release | x64 <nl> + { 215B2D68 - 0A70 - 4D10 - 8E75 - B33010C62A91 } . Release | x64 . Build . 0 = Release | x64 <nl> + { C9DB5EB7 - 81AA - 4185 - BAA1 - DA035654402F } . Debug | Any CPU . ActiveCfg = Debug | x64 <nl> + { C9DB5EB7 - 81AA - 4185 - BAA1 - DA035654402F } . Debug | Mixed Platforms . ActiveCfg = Debug | x64 <nl> + { C9DB5EB7 - 81AA - 4185 - BAA1 - DA035654402F } . Debug | Mixed Platforms . Build . 0 = Debug | x64 <nl> + { C9DB5EB7 - 81AA - 4185 - BAA1 - DA035654402F } . Debug | Win32 . ActiveCfg = Debug | Win32 <nl> + { C9DB5EB7 - 81AA - 4185 - BAA1 - DA035654402F } . Debug | Win32 . Build . 0 = Debug | Win32 <nl> + { C9DB5EB7 - 81AA - 4185 - BAA1 - DA035654402F } . Debug | x64 . ActiveCfg = Debug | x64 <nl> + { C9DB5EB7 - 81AA - 4185 - BAA1 - DA035654402F } . Debug | x64 . Build . 0 = Debug | x64 <nl> + { C9DB5EB7 - 81AA - 4185 - BAA1 - DA035654402F } . Release | Any CPU . ActiveCfg = Release | x64 <nl> + { C9DB5EB7 - 81AA - 4185 - BAA1 - DA035654402F } . Release | Mixed Platforms . ActiveCfg = Release | x64 <nl> + { C9DB5EB7 - 81AA - 4185 - BAA1 - DA035654402F } . Release | Mixed Platforms . Build . 0 = Release | x64 <nl> + { C9DB5EB7 - 81AA - 4185 - BAA1 - DA035654402F } . Release | Win32 . ActiveCfg = Release | Win32 <nl> + { C9DB5EB7 - 81AA - 4185 - BAA1 - DA035654402F } . Release | Win32 . Build . 0 = Release | Win32 <nl> + { C9DB5EB7 - 81AA - 4185 - BAA1 - DA035654402F } . Release | x64 . ActiveCfg = Release | x64 <nl> + { C9DB5EB7 - 81AA - 4185 - BAA1 - DA035654402F } . Release | x64 . Build . 0 = Release | x64 <nl> + { 7B84584E - 92BC - 4DB9 - 971B - A1A8F93E5053 } . Debug | Any CPU . ActiveCfg = Debug | Win32 <nl> + { 7B84584E - 92BC - 4DB9 - 971B - A1A8F93E5053 } . Debug | Mixed Platforms . ActiveCfg = Debug | Win32 <nl> + { 7B84584E - 92BC - 4DB9 - 971B - A1A8F93E5053 } . Debug | Mixed Platforms . Build . 0 = Debug | Win32 <nl> + { 7B84584E - 92BC - 4DB9 - 971B - A1A8F93E5053 } . Debug | Win32 . ActiveCfg = Debug | Win32 <nl> + { 7B84584E - 92BC - 4DB9 - 971B - A1A8F93E5053 } . Debug | Win32 . Build . 0 = Debug | Win32 <nl> + { 7B84584E - 92BC - 4DB9 - 971B - A1A8F93E5053 } . Debug | x64 . ActiveCfg = Debug | Win32 <nl> + { 7B84584E - 92BC - 4DB9 - 971B - A1A8F93E5053 } . Release | Any CPU . ActiveCfg = Release | Win32 <nl> + { 7B84584E - 92BC - 4DB9 - 971B - A1A8F93E5053 } . Release | Mixed Platforms . ActiveCfg = Release | Win32 <nl> + { 7B84584E - 92BC - 4DB9 - 971B - A1A8F93E5053 } . Release | Mixed Platforms . Build . 0 = Release | Win32 <nl> + { 7B84584E - 92BC - 4DB9 - 971B - A1A8F93E5053 } . Release | Win32 . ActiveCfg = Release | Win32 <nl> + { 7B84584E - 92BC - 4DB9 - 971B - A1A8F93E5053 } . Release | Win32 . Build . 0 = Release | Win32 <nl> + { 7B84584E - 92BC - 4DB9 - 971B - A1A8F93E5053 } . Release | x64 . ActiveCfg = Release | Win32 <nl> + EndGlobalSection <nl> + GlobalSection ( SolutionProperties ) = preSolution <nl> + HideSolutionNode = FALSE <nl> + EndGlobalSection <nl> + GlobalSection ( NestedProjects ) = preSolution <nl> + { 2B262D59 - 9DC7 - 4BF1 - A431 - 1BD4966899A5 } = { 12B11474 - 2D74 - 48C3 - BB3D - F03249BEA88F } <nl> + { 2F760952 - C71B - 4865 - 998F - AABAE96D1373 } = { 12B11474 - 2D74 - 48C3 - BB3D - F03249BEA88F } <nl> + { 407B4B88 - 3451 - 433C - B74F - 31B31FEB5791 } = { 12B11474 - 2D74 - 48C3 - BB3D - F03249BEA88F } <nl> + { 4082881B - EB00 - 486F - 906C - 843B8EC06E18 } = { 12B11474 - 2D74 - 48C3 - BB3D - F03249BEA88F } <nl> + { C9DB5EB7 - 81AA - 4185 - BAA1 - DA035654402F } = { 12B11474 - 2D74 - 48C3 - BB3D - F03249BEA88F } <nl> + { 7B84584E - 92BC - 4DB9 - 971B - A1A8F93E5053 } = { 12B11474 - 2D74 - 48C3 - BB3D - F03249BEA88F } <nl> + { F5ABFB2C - A34F - 48C1 - 9B5F - 01D456AF6C57 } = { 12B11474 - 2D74 - 48C3 - BB3D - F03249BEA88F } <nl> + EndGlobalSection <nl> + EndGlobal <nl>
missing sln file
mongodb/mongo
70599d7e8d478f51fe4d1312c39cd58df823fe5c
2011-01-12T02:43:22Z
mmm a / Makefile <nl> ppp b / Makefile <nl> <nl> # If not specified , Kaldi plugins will not be built <nl> # OPENCV_PATH = path to OpenCV 3 . 0 . 0 installation , so $ ( OPENCV_PATH ) exists <nl> # defaults to / usr / local / opencv - 3 . 0 . 0 <nl> + # LIBZIP_PATH = path to libzip installation , so $ ( LIBZIP_PATH ) exists <nl> + # defaults to / usr / local / <nl> <nl> ifndef BUILD_TOP <nl> BUILD_TOP = . <nl> endif <nl> # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # <nl> <nl> ifdef OPENCV_PATH <nl> + <nl> + LIBS + = - lopencv_core - lopencv_imgproc - lopencv_imgcodecs <nl> + <nl> + ifdef LIBZIP_PATH <nl> + CPPFLAGS + = - DUSE_ZIP <nl> + INCLUDEPATH + = $ ( LIBZIP_PATH ) / lib / libzip / include <nl> + LIBS + = - lzip <nl> + endif <nl> + <nl> IMAGEREADER_SRC = \ <nl> $ ( SOURCEDIR ) / Readers / ImageReader / Exports . cpp \ <nl> $ ( SOURCEDIR ) / Readers / ImageReader / ImageConfigHelper . cpp \ <nl> LIBPATH + = $ ( OPENCV_PATH ) / lib $ ( OPENCV_PATH ) / release / lib <nl> <nl> $ ( IMAGEREADER ) : $ ( IMAGEREADER_OBJ ) | $ ( CNTKMATH_LIB ) <nl> @ echo $ ( SEPARATOR ) <nl> - $ ( CXX ) $ ( LDFLAGS ) - shared $ ( patsubst % , - L % , $ ( LIBDIR ) $ ( LIBPATH ) ) $ ( patsubst % , $ ( RPATH ) % , $ ( ORIGINDIR ) $ ( LIBPATH ) ) - o $ @ $ ^ - l $ ( CNTKMATH ) - lopencv_core - lopencv_imgproc - lopencv_imgcodecs <nl> + $ ( CXX ) $ ( LDFLAGS ) - shared $ ( patsubst % , - L % , $ ( LIBDIR ) $ ( LIBPATH ) ) $ ( patsubst % , $ ( RPATH ) % , $ ( ORIGINDIR ) $ ( LIBPATH ) ) - o $ @ $ ^ - l $ ( CNTKMATH ) <nl> endif <nl> <nl> # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # <nl> mmm a / configure <nl> ppp b / configure <nl> cudnn_check = cuda / include / cudnn . h <nl> have_opencv = no <nl> opencv_path = <nl> opencv_check = include / opencv2 / opencv . hpp <nl> + <nl> + have_libzip = no <nl> + libzip_path = <nl> + libzip_check = include / zip . h <nl> + <nl> mathlib = <nl> <nl> default_use_1bitsgd = no <nl> default_gdks = " . gdk / usr " <nl> default_cubs = " cub - 1 . 4 . 1 " <nl> default_cudnns = " cudnn - 4 . 0 " <nl> default_opencvs = " opencv - 3 . 0 . 0 " <nl> + default_libzips = " libzip - 1 . 1 . 2 " <nl> <nl> function default_paths ( ) <nl> { <nl> function find_opencv ( ) <nl> { <nl> find_dir " $ default_opencvs " " $ opencv_check " <nl> } <nl> + <nl> + function find_libzip ( ) <nl> + { <nl> + find_dir " $ default_libzips " " $ libzip_check " <nl> + } <nl> + <nl> function is_hardlinked ( ) <nl> { <nl> r = no <nl> function show_help ( ) <nl> echo " - - with - buildtype = ( debug | release ) $ ( show_default $ default_buildtype ) " <nl> echo " - - with - kaldi [ = directory ] $ ( show_default $ ( find_kaldi ) ) " <nl> echo " - - with - opencv [ = directory ] $ ( show_default $ ( find_opencv ) ) " <nl> + echo " - - with - libzip [ = directory ] $ ( show_default $ ( find_libzip ) ) " <nl> echo " Libraries search path : " <nl> for head in $ ( default_paths ) <nl> do <nl> do <nl> fi <nl> fi <nl> ; ; <nl> + - - with - libzip * ) <nl> + have_libzip = yes <nl> + if test x $ optarg = x <nl> + then <nl> + libzip_path = $ ( find_libzip ) <nl> + if test x $ libzip_path = x <nl> + then <nl> + echo " Cannot find libzip directory . " <nl> + echo " Please specify a value for - - with - libzip " <nl> + echo " libzip can be downloaded from http : / / www . nih . at / libzip / " <nl> + exit 1 <nl> + fi <nl> + else <nl> + if test $ ( check_dir $ optarg $ $ libzip_check ) = yes <nl> + then <nl> + libzip_path = $ optarg <nl> + else <nl> + echo " Invalid libzip directory $ optarg " <nl> + exit 1 <nl> + fi <nl> + fi <nl> + ; ; <nl> * ) <nl> echo Invalid option $ key <nl> show_help <nl> then <nl> fi <nl> fi <nl> <nl> + if test x $ libzip_path = x <nl> + then <nl> + libzip_path = $ ( find_libzip ) <nl> + if test x $ libzip_path = x ; then <nl> + echo Cannot locate libzip files <nl> + echo ImageReader will be built without zip container support . <nl> + else <nl> + echo Found libzip at $ libzip_path <nl> + fi <nl> + fi <nl> + <nl> config = $ build_top / Config . make <nl> echo Generating $ config <nl> echo " # Configuration file for cntk " > $ config <nl> fi <nl> if test x $ opencv_path ! = x ; then <nl> echo OPENCV_PATH = $ opencv_path > > $ config <nl> fi <nl> + if test x $ libzip_path ! = x ; then <nl> + echo LIBZIP_PATH = $ libzip_path > > $ config <nl> + fi <nl> if test $ enable_1bitsgd = yes ; then <nl> echo CNTK_ENABLE_1BitSGD = true > > $ config <nl> fi <nl>
Added libzip support on Linux .
microsoft/CNTK
bbf67cf03b4e7f49ae2b076b1dd67a0fd9662a6a
2016-02-25T17:47:14Z
mmm a / tests / runner . py <nl> ppp b / tests / runner . py <nl> def run_generated_code ( self , engine , filename , args = [ ] , check_timeout = True , outp <nl> <nl> def build_native ( self , filename , args = [ ] ) : <nl> compiler = CLANG if filename . endswith ( ' cpp ' ) else CLANG_CC <nl> - process = Popen ( [ compiler , ' - O2 ' , ' - fno - math - errno ' , filename , ' - o ' , filename + ' . native ' ] + args , stdout = PIPE , stderr = self . stderr_redirect ) <nl> - output = process . communicate ( ) <nl> + process = run_process ( [ compiler , ' - O2 ' , ' - fno - math - errno ' , filename , ' - o ' , filename + ' . native ' ] + args , stdout = PIPE , stderr = self . stderr_redirect , check = False ) <nl> if process . returncode is not 0 : <nl> print ( " Building native executable with command ' % s ' failed with a return code % d ! " % ( ' ' . join ( [ CLANG , ' - O2 ' , filename , ' - o ' , filename + ' . native ' ] ) , process . returncode ) , file = sys . stderr ) <nl> - print ( " Output : " + output [ 0 ] ) <nl> + print ( " Output : " + process . stdout ) <nl> <nl> def run_native ( self , filename , args ) : <nl> - process = Popen ( [ filename + ' . native ' ] + args , stdout = PIPE ) ; <nl> - output = process . communicate ( ) <nl> + process = run_process ( [ filename + ' . native ' ] + args , stdout = PIPE , check = False ) <nl> if process . returncode is not 0 : <nl> print ( " Running native executable with command ' % s ' failed with a return code % d ! " % ( ' ' . join ( [ filename + ' . native ' ] + args ) , process . returncode ) , file = sys . stderr ) <nl> - print ( " Output : " + output [ 0 ] ) <nl> - return output [ 0 ] <nl> + print ( " Output : " + output . stdout ) <nl> + return output . stdout <nl> <nl> # Tests that the given two paths are identical , modulo path delimiters . E . g . " C : / foo " is equal to " C : \ foo " . <nl> def assertPathsIdentical ( self , path1 , path2 ) : <nl> mmm a / tests / test_browser . py <nl> ppp b / tests / test_browser . py <nl> def test_mmap_file ( self ) : <nl> <nl> def test_emrun_info ( self ) : <nl> if not has_browser ( ) : return self . skip ( ' need a browser ' ) <nl> - result = subprocess . check_output ( [ PYTHON , path_from_root ( ' emrun ' ) , ' - - system_info ' , ' - - browser_info ' ] ) <nl> + result = run_process ( [ PYTHON , path_from_root ( ' emrun ' ) , ' - - system_info ' , ' - - browser_info ' ] , stdout = PIPE ) . stdout <nl> assert ' CPU ' in result <nl> assert ' Browser ' in result <nl> assert ' Traceback ' not in result <nl> <nl> - result = subprocess . check_output ( [ PYTHON , path_from_root ( ' emrun ' ) , ' - - list_browsers ' ] ) <nl> + result = run_process ( [ PYTHON , path_from_root ( ' emrun ' ) , ' - - list_browsers ' ] , stdout = PIPE ) . stdout <nl> assert ' Traceback ' not in result <nl> <nl> # Deliberately named as test_zzz_emrun to make this test the last one <nl> mmm a / tests / test_core . py <nl> ppp b / tests / test_core . py <nl> def test_bigswitch ( self ) : <nl> @ no_emterpreter <nl> def test_biggerswitch ( self ) : <nl> num_cases = 20000 <nl> - switch_case , err = Popen ( [ PYTHON , path_from_root ( ' tests ' , ' gen_large_switchcase . py ' ) , str ( num_cases ) ] , stdout = PIPE , stderr = PIPE ) . communicate ( ) <nl> + switch_case = run_process ( [ PYTHON , path_from_root ( ' tests ' , ' gen_large_switchcase . py ' ) , str ( num_cases ) ] , stdout = PIPE , stderr = PIPE ) . stdout <nl> self . do_run ( switch_case , ' ' ' 58996 : 589965899658996 <nl> 59297 : 592975929759297 <nl> 59598 : default <nl> def ignore_nans ( out , err = ' ' ) : <nl> @ SIMD <nl> def test_sse1_full ( self ) : <nl> Popen ( [ CLANG , path_from_root ( ' tests ' , ' test_sse1_full . cpp ' ) , ' - o ' , ' test_sse1_full ' , ' - D_CRT_SECURE_NO_WARNINGS = 1 ' ] + get_clang_native_args ( ) , env = get_clang_native_env ( ) , stdout = PIPE ) . communicate ( ) <nl> - native_result , err = Popen ( ' . / test_sse1_full ' , stdout = PIPE ) . communicate ( ) <nl> - native_result = native_result . replace ( ' \ r \ n ' , ' \ n ' ) # Windows line endings fix <nl> + native_result = run_process ( ' . / test_sse1_full ' , stdout = PIPE ) . stdout <nl> <nl> Settings . PRECISE_F32 = 1 # SIMD currently requires Math . fround <nl> orig_args = self . emcc_args <nl> def test_sse2_full ( self ) : <nl> args = [ ] <nl> if ' - O0 ' in self . emcc_args : args + = [ ' - D_DEBUG = 1 ' ] <nl> Popen ( [ CLANG , path_from_root ( ' tests ' , ' test_sse2_full . cpp ' ) , ' - o ' , ' test_sse2_full ' , ' - D_CRT_SECURE_NO_WARNINGS = 1 ' ] + args + get_clang_native_args ( ) , env = get_clang_native_env ( ) , stdout = PIPE ) . communicate ( ) <nl> - native_result , err = Popen ( ' . / test_sse2_full ' , stdout = PIPE ) . communicate ( ) <nl> - native_result = native_result . replace ( ' \ r \ n ' , ' \ n ' ) # Windows line endings fix <nl> + native_result = run_process ( ' . / test_sse2_full ' , stdout = PIPE ) . stdout <nl> <nl> Settings . PRECISE_F32 = 1 # SIMD currently requires Math . fround <nl> orig_args = self . emcc_args <nl> def test_sse3_full ( self ) : <nl> args = [ ] <nl> if ' - O0 ' in self . emcc_args : args + = [ ' - D_DEBUG = 1 ' ] <nl> Popen ( [ CLANG , path_from_root ( ' tests ' , ' test_sse3_full . cpp ' ) , ' - o ' , ' test_sse3_full ' , ' - D_CRT_SECURE_NO_WARNINGS = 1 ' , ' - msse3 ' ] + args + get_clang_native_args ( ) , env = get_clang_native_env ( ) , stdout = PIPE ) . communicate ( ) <nl> - native_result , err = Popen ( ' . / test_sse3_full ' , stdout = PIPE ) . communicate ( ) <nl> - native_result = native_result . replace ( ' \ r \ n ' , ' \ n ' ) # Windows line endings fix <nl> + native_result = run_process ( ' . / test_sse3_full ' , stdout = PIPE ) . stdout <nl> <nl> Settings . PRECISE_F32 = 1 # SIMD currently requires Math . fround <nl> orig_args = self . emcc_args <nl> def test_ssse3_full ( self ) : <nl> args = [ ] <nl> if ' - O0 ' in self . emcc_args : args + = [ ' - D_DEBUG = 1 ' ] <nl> Popen ( [ CLANG , path_from_root ( ' tests ' , ' test_ssse3_full . cpp ' ) , ' - o ' , ' test_ssse3_full ' , ' - D_CRT_SECURE_NO_WARNINGS = 1 ' , ' - mssse3 ' ] + args + get_clang_native_args ( ) , env = get_clang_native_env ( ) , stdout = PIPE ) . communicate ( ) <nl> - native_result , err = Popen ( ' . / test_ssse3_full ' , stdout = PIPE ) . communicate ( ) <nl> - native_result = native_result . replace ( ' \ r \ n ' , ' \ n ' ) # Windows line endings fix <nl> + native_result = run_process ( ' . / test_ssse3_full ' , stdout = PIPE ) . stdout <nl> <nl> Settings . PRECISE_F32 = 1 # SIMD currently requires Math . fround <nl> orig_args = self . emcc_args <nl> def test_sse4_1_full ( self ) : <nl> args = [ ] <nl> if ' - O0 ' in self . emcc_args : args + = [ ' - D_DEBUG = 1 ' ] <nl> Popen ( [ CLANG , path_from_root ( ' tests ' , ' test_sse4_1_full . cpp ' ) , ' - o ' , ' test_sse4_1_full ' , ' - D_CRT_SECURE_NO_WARNINGS = 1 ' , ' - msse4 . 1 ' ] + args + get_clang_native_args ( ) , env = get_clang_native_env ( ) , stdout = PIPE ) . communicate ( ) <nl> - native_result , err = Popen ( ' . / test_sse4_1_full ' , stdout = PIPE ) . communicate ( ) <nl> - native_result = native_result . replace ( ' \ r \ n ' , ' \ n ' ) # Windows line endings fix <nl> + native_result = run_process ( ' . / test_sse4_1_full ' , stdout = PIPE ) . stdout <nl> <nl> Settings . PRECISE_F32 = 1 # SIMD currently requires Math . fround <nl> orig_args = self . emcc_args <nl> def run_all ( x ) : <nl> # Autodebug the code <nl> def do_autodebug ( self , filename ) : <nl> Building . llvm_dis ( filename ) <nl> - output = Popen ( [ PYTHON , AUTODEBUGGER , filename + ' . o . ll ' , filename + ' . o . ll . ll ' ] , stdout = PIPE , stderr = self . stderr_redirect ) . communicate ( ) [ 0 ] <nl> + output = run_process ( [ PYTHON , AUTODEBUGGER , filename + ' . o . ll ' , filename + ' . o . ll . ll ' ] , stdout = PIPE , stderr = self . stderr_redirect ) . stdout <nl> assert ' Success . ' in output , output <nl> self . prep_ll_run ( filename , filename + ' . o . ll . ll ' , force_recompile = True ) # rebuild . bc # TODO : use code in do_autodebug_post for this <nl> <nl> def do_autodebug_post ( self , filename ) : <nl> return True <nl> print ( ' Autodebugging during post time ' ) <nl> delattr ( self , ' post ' ) <nl> - output = Popen ( [ PYTHON , AUTODEBUGGER , filename + ' . o . ll ' , filename + ' . o . ll . ll ' ] , stdout = PIPE , stderr = self . stderr_redirect ) . communicate ( ) [ 0 ] <nl> + output = run_process ( [ PYTHON , AUTODEBUGGER , filename + ' . o . ll ' , filename + ' . o . ll . ll ' ] , stdout = PIPE , stderr = self . stderr_redirect ) . stdout <nl> assert ' Success . ' in output , output <nl> shutil . copyfile ( filename + ' . o . ll . ll ' , filename + ' . o . ll ' ) <nl> Building . llvm_as ( filename ) <nl> mmm a / tests / test_other . py <nl> ppp b / tests / test_other . py <nl> <nl> <nl> # Runs an emcc task ( used from another process in test test_emcc_multiprocess_cache_access , needs to be at top level for it to be pickleable ) . <nl> def multiprocess_task ( c_file , cache_dir_name ) : <nl> - output = subprocess . check_output ( [ PYTHON , EMCC , c_file , ' - - cache ' , cache_dir_name ] , stderr = subprocess . STDOUT ) <nl> + output = run_process ( [ PYTHON , EMCC , c_file , ' - - cache ' , cache_dir_name ] , stderr = subprocess . STDOUT , stdout = PIPE ) . stdout <nl> if len ( output . strip ( ) ) > 0 : <nl> print ( ' mmmmmm ' ) <nl> print ( output ) <nl> class other ( RunnerCore ) : <nl> def test_emcc_v ( self ) : <nl> for compiler in [ EMCC , EMXX ] : <nl> # - v , without input files <nl> - output = Popen ( [ PYTHON , compiler , ' - v ' ] , stdout = PIPE , stderr = PIPE ) . communicate ( ) <nl> - self . assertContained ( ' ' ' clang version % s . 0 ' ' ' % expected_llvm_version ( ) , output [ 1 ] . replace ( ' \ r ' , ' ' ) , output [ 1 ] . replace ( ' \ r ' , ' ' ) ) <nl> - self . assertContained ( ' ' ' GNU ' ' ' , output [ 0 ] ) <nl> - self . assertNotContained ( ' this is dangerous ' , output [ 0 ] ) <nl> - self . assertNotContained ( ' this is dangerous ' , output [ 1 ] ) <nl> + output = run_process ( [ PYTHON , compiler , ' - v ' ] , stdout = PIPE , stderr = PIPE ) <nl> + self . assertContained ( ' ' ' clang version % s . 0 ' ' ' % expected_llvm_version ( ) , output . stderr . replace ( ' \ r ' , ' ' ) , output . stderr . replace ( ' \ r ' , ' ' ) ) <nl> + self . assertContained ( ' ' ' GNU ' ' ' , output . stdout ) <nl> + self . assertNotContained ( ' this is dangerous ' , output . stdout ) <nl> + self . assertNotContained ( ' this is dangerous ' , output . stderr ) <nl> <nl> def test_emcc ( self ) : <nl> for compiler in [ EMCC , EMXX ] : <nl> def test_emcc ( self ) : <nl> suffix = ' . c ' if compiler = = EMCC else ' . cpp ' <nl> <nl> # - - version <nl> - output = Popen ( [ PYTHON , compiler , ' - - version ' ] , stdout = PIPE , stderr = PIPE ) . communicate ( ) <nl> - output = output [ 0 ] . replace ( ' \ r ' , ' ' ) <nl> + output = run_process ( [ PYTHON , compiler , ' - - version ' ] , stdout = PIPE , stderr = PIPE ) <nl> + output = output . stdout . replace ( ' \ r ' , ' ' ) <nl> self . assertContained ( ' ' ' emcc ( Emscripten gcc / clang - like replacement ) ' ' ' , output ) <nl> self . assertContained ( ' ' ' Copyright ( C ) 2014 the Emscripten authors ( see AUTHORS . txt ) <nl> This is free and open source software under the MIT license . <nl> def test_emcc ( self ) : <nl> ' ' ' , output ) <nl> <nl> # - - help <nl> - output = Popen ( [ PYTHON , compiler , ' - - help ' ] , stdout = PIPE , stderr = PIPE ) . communicate ( ) <nl> - self . assertContained ( ' Display this information ' , output [ 0 ] ) <nl> - self . assertContained ( ' Most clang options will work ' , output [ 0 ] ) <nl> + output = run_process ( [ PYTHON , compiler , ' - - help ' ] , stdout = PIPE , stderr = PIPE ) <nl> + self . assertContained ( ' Display this information ' , output . stdout ) <nl> + self . assertContained ( ' Most clang options will work ' , output . stdout ) <nl> <nl> # - dumpmachine <nl> - output = Popen ( [ PYTHON , compiler , ' - dumpmachine ' ] , stdout = PIPE , stderr = PIPE ) . communicate ( ) <nl> - self . assertContained ( get_llvm_target ( ) , output [ 0 ] ) <nl> + output = run_process ( [ PYTHON , compiler , ' - dumpmachine ' ] , stdout = PIPE , stderr = PIPE ) <nl> + self . assertContained ( get_llvm_target ( ) , output . stdout ) <nl> <nl> # emcc src . cpp = = > writes a . out . js <nl> self . clear ( ) <nl> - output = Popen ( [ PYTHON , compiler , path_from_root ( ' tests ' , ' hello_world ' + suffix ) ] , stdout = PIPE , stderr = PIPE ) . communicate ( ) <nl> - assert len ( output [ 0 ] ) = = 0 , output [ 0 ] <nl> - assert os . path . exists ( ' a . out . js ' ) , ' \ n ' . join ( output ) <nl> + output = run_process ( [ PYTHON , compiler , path_from_root ( ' tests ' , ' hello_world ' + suffix ) ] , stdout = PIPE , stderr = PIPE ) <nl> + assert len ( output . stdout ) = = 0 , output . stdout <nl> + assert os . path . exists ( ' a . out . js ' ) , output . stdout + ' \ n ' + output . stderr <nl> self . assertContained ( ' hello , world ! ' , run_js ( ' a . out . js ' ) ) <nl> <nl> # properly report source code errors , and stop there <nl> self . clear ( ) <nl> assert not os . path . exists ( ' a . out . js ' ) <nl> - process = Popen ( [ PYTHON , compiler , path_from_root ( ' tests ' , ' hello_world_error ' + suffix ) ] , stdout = PIPE , stderr = PIPE ) <nl> - output = process . communicate ( ) <nl> + process = run_process ( [ PYTHON , compiler , path_from_root ( ' tests ' , ' hello_world_error ' + suffix ) ] , stdout = PIPE , stderr = PIPE , check = False ) <nl> assert not os . path . exists ( ' a . out . js ' ) , ' compilation failed , so no output file is expected ' <nl> - assert len ( output [ 0 ] ) = = 0 , output [ 0 ] <nl> + assert len ( process . stdout ) = = 0 , process . stdout <nl> assert process . returncode is not 0 , ' Failed compilation must return a nonzero error code ! ' <nl> - self . assertNotContained ( ' IOError ' , output [ 1 ] ) # no python stack <nl> - self . assertNotContained ( ' Traceback ' , output [ 1 ] ) # no python stack <nl> - self . assertContained ( ' error : invalid preprocessing directive ' , output [ 1 ] ) <nl> - self . assertContained ( [ " error : use of undeclared identifier ' cheez " , " error : unknown type name ' cheez ' " ] , output [ 1 ] ) <nl> - self . assertContained ( ' errors generated ' , output [ 1 ] ) <nl> - assert ' compiler frontend failed to generate LLVM bitcode , halting ' in output [ 1 ] . split ( ' errors generated . ' ) [ 1 ] <nl> + self . assertNotContained ( ' IOError ' , process . stderr ) # no python stack <nl> + self . assertNotContained ( ' Traceback ' , process . stderr ) # no python stack <nl> + self . assertContained ( ' error : invalid preprocessing directive ' , process . stderr ) <nl> + self . assertContained ( [ " error : use of undeclared identifier ' cheez " , " error : unknown type name ' cheez ' " ] , process . stderr ) <nl> + self . assertContained ( ' errors generated ' , process . stderr ) <nl> + assert ' compiler frontend failed to generate LLVM bitcode , halting ' in process . stderr . split ( ' errors generated . ' ) [ 1 ] <nl> <nl> # emcc src . cpp - c and emcc src . cpp - o src . [ o | bc ] = = > should give a . bc file <nl> # regression check : - o js should create " js " , with bitcode content <nl> def test_emcc ( self ) : <nl> if target = = ' js ' : # make sure emcc can recognize the target as a bitcode file <nl> shutil . move ( target , target + ' . bc ' ) <nl> target + = ' . bc ' <nl> - output = Popen ( [ PYTHON , compiler , target , ' - o ' , target + ' . js ' ] , stdout = PIPE , stderr = PIPE ) . communicate ( ) <nl> - assert len ( output [ 0 ] ) = = 0 , output [ 0 ] <nl> - assert os . path . exists ( target + ' . js ' ) , ' Expected % s to exist since args are % s : % s ' % ( target + ' . js ' , str ( args ) , ' \ n ' . join ( output ) ) <nl> + output = run_process ( [ PYTHON , compiler , target , ' - o ' , target + ' . js ' ] , stdout = PIPE , stderr = PIPE ) <nl> + assert len ( output . stdout ) = = 0 , output . stdout <nl> + assert os . path . exists ( target + ' . js ' ) , ' Expected % s to exist since args are % s : % s ' % ( target + ' . js ' , str ( args ) , output . stdout + ' \ n ' + output . stderr ) <nl> self . assertContained ( ' hello , world ! ' , run_js ( target + ' . js ' ) ) <nl> <nl> # handle singleton archives <nl> def test_emcc ( self ) : <nl> Popen ( [ PYTHON , compiler , path_from_root ( ' tests ' , ' hello_world ' + suffix ) , ' - o ' , ' a . bc ' ] , stdout = PIPE , stderr = PIPE ) . communicate ( ) <nl> Popen ( [ LLVM_AR , ' r ' , ' a . a ' , ' a . bc ' ] , stdout = PIPE , stderr = PIPE ) . communicate ( ) <nl> assert os . path . exists ( ' a . a ' ) <nl> - output = Popen ( [ PYTHON , compiler , ' a . a ' ] ) . communicate ( ) <nl> + output = run_process ( [ PYTHON , compiler , ' a . a ' ] ) <nl> assert os . path . exists ( ' a . out . js ' ) , output <nl> self . assertContained ( ' hello , world ! ' , run_js ( ' a . out . js ' ) ) <nl> <nl> # emcc src . ll = = > generates . js <nl> self . clear ( ) <nl> - output = Popen ( [ PYTHON , compiler , path_from_root ( ' tests ' , ' hello_world . ll ' ) ] , stdout = PIPE , stderr = PIPE ) . communicate ( ) <nl> - assert len ( output [ 0 ] ) = = 0 , output [ 0 ] <nl> - assert os . path . exists ( ' a . out . js ' ) , ' \ n ' . join ( output ) <nl> + output = run_process ( [ PYTHON , compiler , path_from_root ( ' tests ' , ' hello_world . ll ' ) ] , stdout = PIPE , stderr = PIPE ) <nl> + assert len ( output . stdout ) = = 0 , output . stdout <nl> + assert os . path . exists ( ' a . out . js ' ) , output . stdout + ' \ n ' + output . stderr <nl> self . assertContained ( ' hello , world ! ' , run_js ( ' a . out . js ' ) ) <nl> <nl> # emcc [ . . ] - o [ path ] = = > should work with absolute paths <nl> def test_emcc ( self ) : <nl> if not os . path . exists ( ' a_dir ' ) : os . mkdir ( ' a_dir ' ) <nl> os . chdir ( ' a_dir ' ) <nl> if not os . path . exists ( ' b_dir ' ) : os . mkdir ( ' b_dir ' ) <nl> - output = Popen ( [ PYTHON , compiler , path_from_root ( ' tests ' , ' hello_world . ll ' ) , ' - o ' , path ] , stdout = PIPE , stderr = PIPE ) . communicate ( ) <nl> + output = run_process ( [ PYTHON , compiler , path_from_root ( ' tests ' , ' hello_world . ll ' ) , ' - o ' , path ] , stdout = PIPE , stderr = PIPE ) <nl> print ( output ) <nl> - assert os . path . exists ( path ) , path + ' does not exist ; ' + ' \ n ' . join ( output ) <nl> + assert os . path . exists ( path ) , path + ' does not exist ; ' + output . stdout + ' \ n ' + output . stderr <nl> last = os . getcwd ( ) <nl> os . chdir ( os . path . dirname ( path ) ) <nl> self . assertContained ( ' hello , world ! ' , run_js ( os . path . basename ( path ) ) ) <nl> def test_emcc ( self ) : <nl> keep_debug = ' - g ' in params <nl> args = [ PYTHON , compiler , path_from_root ( ' tests ' , ' hello_world_loop ' + ( ' _malloc ' if has_malloc else ' ' ) + ' . cpp ' ) ] + params <nl> print ( ' . . ' , args ) <nl> - output = Popen ( args , <nl> - stdout = PIPE , stderr = PIPE ) . communicate ( ) <nl> - assert len ( output [ 0 ] ) = = 0 , output [ 0 ] <nl> + output = run_process ( args , stdout = PIPE , stderr = PIPE ) <nl> + assert len ( output . stdout ) = = 0 , output . stdout <nl> if bc_params is not None : <nl> - assert os . path . exists ( ' something . bc ' ) , output [ 1 ] <nl> + assert os . path . exists ( ' something . bc ' ) , output . stderr <nl> bc_args = [ PYTHON , compiler , ' something . bc ' , ' - o ' , ' something . js ' ] + bc_params <nl> print ( ' . . . . ' , bc_args ) <nl> - output = Popen ( bc_args , stdout = PIPE , stderr = PIPE ) . communicate ( ) <nl> - assert os . path . exists ( ' something . js ' ) , output [ 1 ] <nl> + output = run_process ( bc_args , stdout = PIPE , stderr = PIPE ) <nl> + assert os . path . exists ( ' something . js ' ) , output . stderr <nl> self . assertContained ( ' hello , world ! ' , run_js ( ' something . js ' ) ) <nl> <nl> # Verify optimization level etc . in the generated code <nl> def test_emcc ( self ) : <nl> ] : <nl> print ( params , text ) <nl> self . clear ( ) <nl> - output = Popen ( [ PYTHON , compiler , path_from_root ( ' tests ' , ' hello_world_loop . cpp ' ) , ' - o ' , ' a . out . js ' ] + params , stdout = PIPE , stderr = PIPE ) . communicate ( ) <nl> - assert len ( output [ 0 ] ) = = 0 , output [ 0 ] <nl> - assert os . path . exists ( ' a . out . js ' ) , ' \ n ' . join ( output ) <nl> + output = run_process ( [ PYTHON , compiler , path_from_root ( ' tests ' , ' hello_world_loop . cpp ' ) , ' - o ' , ' a . out . js ' ] + params , stdout = PIPE , stderr = PIPE ) <nl> + assert len ( output . stdout ) = = 0 , output . stdout <nl> + assert os . path . exists ( ' a . out . js ' ) , output . stdout + ' \ n ' + output . stderr <nl> self . assertContained ( ' hello , world ! ' , run_js ( ' a . out . js ' ) ) <nl> assert test ( open ( ' a . out . js ' ) . read ( ) ) , text <nl> <nl> # Compiling two source files into a final JS . <nl> for args , target in [ ( [ ] , ' a . out . js ' ) , ( [ ' - o ' , ' combined . js ' ] , ' combined . js ' ) ] : <nl> self . clear ( ) <nl> - output = Popen ( [ PYTHON , compiler , path_from_root ( ' tests ' , ' twopart_main . cpp ' ) , path_from_root ( ' tests ' , ' twopart_side . cpp ' ) ] + args , <nl> - stdout = PIPE , stderr = PIPE ) . communicate ( ) <nl> - assert len ( output [ 0 ] ) = = 0 , output [ 0 ] <nl> - assert os . path . exists ( target ) , ' \ n ' . join ( output ) <nl> + output = run_process ( [ PYTHON , compiler , path_from_root ( ' tests ' , ' twopart_main . cpp ' ) , path_from_root ( ' tests ' , ' twopart_side . cpp ' ) ] + args , <nl> + stdout = PIPE , stderr = PIPE ) <nl> + assert len ( output . stdout ) = = 0 , output . stdout <nl> + assert os . path . exists ( target ) , output . stdout + ' \ n ' + output . stderr <nl> self . assertContained ( ' side got : hello from main , over ' , run_js ( target ) ) <nl> <nl> # Compiling two files with - c will generate separate . bc files <nl> self . clear ( ) <nl> - output = Popen ( [ PYTHON , compiler , path_from_root ( ' tests ' , ' twopart_main . cpp ' ) , path_from_root ( ' tests ' , ' twopart_side . cpp ' ) , ' - c ' ] + args , <nl> - stdout = PIPE , stderr = PIPE ) . communicate ( ) <nl> - if ' - o ' in args : <nl> - # specifying - o and - c is an error <nl> - assert ' fatal error ' in output [ 1 ] , output [ 1 ] <nl> + expect_error = ' - o ' in args # specifying - o and - c is an error <nl> + output = run_process ( [ PYTHON , compiler , path_from_root ( ' tests ' , ' twopart_main . cpp ' ) , path_from_root ( ' tests ' , ' twopart_side . cpp ' ) , ' - c ' ] + args , <nl> + stdout = PIPE , stderr = PIPE , check = not expect_error ) <nl> + if expect_error : <nl> + assert ' fatal error ' in output . stderr , output . stderr <nl> continue <nl> <nl> - assert os . path . exists ( ' twopart_main . o ' ) , ' \ n ' . join ( output ) <nl> - assert os . path . exists ( ' twopart_side . o ' ) , ' \ n ' . join ( output ) <nl> - assert not os . path . exists ( target ) , ' We should only have created bitcode here : ' + ' \ n ' . join ( output ) <nl> + assert os . path . exists ( ' twopart_main . o ' ) , output . stdout + ' \ n ' + output . stderr <nl> + assert os . path . exists ( ' twopart_side . o ' ) , output . stdout + ' \ n ' + output . stderr <nl> + assert not os . path . exists ( target ) , ' We should only have created bitcode here : ' + output . stdout + ' \ n ' + output . stderr <nl> <nl> # Compiling one of them alone is expected to fail <nl> - output = Popen ( [ PYTHON , compiler , ' twopart_main . o ' , ' - O1 ' , ' - g ' ] + args , stdout = PIPE , stderr = PIPE ) . communicate ( ) <nl> - assert os . path . exists ( target ) , ' \ n ' . join ( output ) <nl> - # print ' \ n ' . join ( output ) <nl> + output = run_process ( [ PYTHON , compiler , ' twopart_main . o ' , ' - O1 ' , ' - g ' ] + args , stdout = PIPE , stderr = PIPE ) <nl> + assert os . path . exists ( target ) , output . stdout + ' \ n ' + output . stderr <nl> + # print output . stdout + ' \ n ' + output . stderr <nl> self . assertContained ( ' missing function ' , run_js ( target , stderr = STDOUT , assert_returncode = None ) ) <nl> try_delete ( target ) <nl> <nl> # Combining those bc files into js should work <nl> - output = Popen ( [ PYTHON , compiler , ' twopart_main . o ' , ' twopart_side . o ' ] + args , stdout = PIPE , stderr = PIPE ) . communicate ( ) <nl> - assert os . path . exists ( target ) , ' \ n ' . join ( output ) <nl> + output = run_process ( [ PYTHON , compiler , ' twopart_main . o ' , ' twopart_side . o ' ] + args , stdout = PIPE , stderr = PIPE ) <nl> + assert os . path . exists ( target ) , output . stdout + ' \ n ' + output . stderr <nl> self . assertContained ( ' side got : hello from main , over ' , run_js ( target ) ) <nl> <nl> # Combining bc files into another bc should also work <nl> try_delete ( target ) <nl> assert not os . path . exists ( target ) <nl> - output = Popen ( [ PYTHON , compiler , ' twopart_main . o ' , ' twopart_side . o ' , ' - o ' , ' combined . bc ' ] + args , stdout = PIPE , stderr = PIPE ) . communicate ( ) <nl> + output = run_process ( [ PYTHON , compiler , ' twopart_main . o ' , ' twopart_side . o ' , ' - o ' , ' combined . bc ' ] + args , stdout = PIPE , stderr = PIPE ) <nl> syms = Building . llvm_nm ( ' combined . bc ' ) <nl> assert len ( syms . defs ) = = 2 and ' main ' in syms . defs , ' Failed to generate valid bitcode ' <nl> - output = Popen ( [ PYTHON , compiler , ' combined . bc ' , ' - o ' , ' combined . bc . js ' ] , stdout = PIPE , stderr = PIPE ) . communicate ( ) <nl> - assert len ( output [ 0 ] ) = = 0 , output [ 0 ] <nl> + output = run_process ( [ PYTHON , compiler , ' combined . bc ' , ' - o ' , ' combined . bc . js ' ] , stdout = PIPE , stderr = PIPE ) <nl> + assert len ( output . stdout ) = = 0 , output . stdout <nl> assert os . path . exists ( ' combined . bc . js ' ) , ' Expected % s to exist ' % ( ' combined . bc . js ' ) <nl> self . assertContained ( ' side got : hello from main , over ' , run_js ( ' combined . bc . js ' ) ) <nl> <nl> def test_emcc_cache_flag ( self ) : <nl> def test_emcc_cflags ( self ) : <nl> # see we print them out <nl> with clean_write_access_to_canonical_temp_dir ( ) : # - - cflags needs to set EMCC_DEBUG = 1 , which needs to create canonical temp directory . <nl> - output = Popen ( [ PYTHON , EMCC , ' - - cflags ' ] , stdout = PIPE , stderr = PIPE ) . communicate ( ) <nl> - flags = output [ 0 ] . strip ( ) <nl> + output = run_process ( [ PYTHON , EMCC , ' - - cflags ' ] , stdout = PIPE , stderr = PIPE ) <nl> + flags = output . stdout . strip ( ) <nl> self . assertContained ( ' ' . join ( Building . doublequote_spaces ( COMPILER_OPTS ) ) , flags ) <nl> # check they work <nl> cmd = [ CLANG , path_from_root ( ' tests ' , ' hello_world . cpp ' ) ] + shlex . split ( flags . replace ( ' \ \ ' , ' \ \ \ \ ' ) ) + [ ' - c ' , ' - emit - llvm ' , ' - o ' , ' a . bc ' ] <nl> def test_emar_em_config_flag ( self ) : <nl> # We expand this in case the EM_CONFIG is ~ / . emscripten ( default ) <nl> config = os . path . expanduser ( EM_CONFIG ) <nl> # We pass - version twice to work around the newargs > 2 check in emar <nl> - ( out , err ) = Popen ( [ PYTHON , EMAR , ' - - em - config ' , config , ' - version ' , ' - version ' ] , stdout = PIPE , stderr = PIPE ) . communicate ( ) <nl> - assert out <nl> - assert not err <nl> - self . assertContained ( ' LLVM ' , out ) <nl> + output = run_process ( [ PYTHON , EMAR , ' - - em - config ' , config , ' - version ' , ' - version ' ] , stdout = PIPE , stderr = PIPE ) <nl> + assert output . stdout <nl> + assert not output . stderr <nl> + self . assertContained ( ' LLVM ' , output . stdout ) <nl> <nl> def test_cmake ( self ) : <nl> # Test all supported generators . <nl> def check_makefile ( configuration , dirname ) : <nl> if test_dir = = ' target_html ' : <nl> env [ ' EMCC_SKIP_SANITY_CHECK ' ] = ' 1 ' <nl> print ( str ( cmd ) ) <nl> - ret = Popen ( cmd , env = env , stdout = None if EM_BUILD_VERBOSE_LEVEL > = 2 else PIPE , stderr = None if EM_BUILD_VERBOSE_LEVEL > = 1 else PIPE ) . communicate ( ) <nl> - if len ( ret ) > 1 and ret [ 1 ] ! = None and len ( ret [ 1 ] . strip ( ) ) > 0 : <nl> - logging . error ( ret [ 1 ] ) # If there were any errors , print them directly to console for diagnostics . <nl> - if len ( ret ) > 1 and ret [ 1 ] ! = None and ' error ' in ret [ 1 ] . lower ( ) : <nl> + ret = run_process ( cmd , env = env , stdout = None if EM_BUILD_VERBOSE_LEVEL > = 2 else PIPE , stderr = None if EM_BUILD_VERBOSE_LEVEL > = 1 else PIPE ) <nl> + if ret . stderr ! = None and len ( ret . stderr . strip ( ) ) > 0 : <nl> + logging . error ( ret . stderr ) # If there were any errors , print them directly to console for diagnostics . <nl> + if ret . stderr ! = None and ' error ' in ret . stderr . lower ( ) : <nl> logging . error ( ' Failed command : ' + ' ' . join ( cmd ) ) <nl> - logging . error ( ' Result : \ n ' + ret [ 1 ] ) <nl> + logging . error ( ' Result : \ n ' + ret . stderr ) <nl> raise Exception ( ' cmake call failed ! ' ) <nl> <nl> if prebuild : <nl> def check_makefile ( configuration , dirname ) : <nl> cmd = make <nl> if EM_BUILD_VERBOSE_LEVEL > = 3 and ' Ninja ' not in generator : <nl> cmd + = [ ' VERBOSE = 1 ' ] <nl> - ret = Popen ( cmd , stdout = None if EM_BUILD_VERBOSE_LEVEL > = 2 else PIPE ) . communicate ( ) <nl> - if len ( ret ) > 1 and ret [ 1 ] ! = None and len ( ret [ 1 ] . strip ( ) ) > 0 : <nl> - logging . error ( ret [ 1 ] ) # If there were any errors , print them directly to console for diagnostics . <nl> - if len ( ret ) > 0 and ret [ 0 ] ! = None and ' error ' in ret [ 0 ] . lower ( ) and not ' 0 error ( s ) ' in ret [ 0 ] . lower ( ) : <nl> + ret = run_process ( cmd , stdout = None if EM_BUILD_VERBOSE_LEVEL > = 2 else PIPE ) <nl> + if ret . stderr ! = None and len ( ret . stderr . strip ( ) ) > 0 : <nl> + logging . error ( ret . stderr ) # If there were any errors , print them directly to console for diagnostics . <nl> + if ret . stdout ! = None and ' error ' in ret . stdout . lower ( ) and not ' 0 error ( s ) ' in ret . stdout . lower ( ) : <nl> logging . error ( ' Failed command : ' + ' ' . join ( cmd ) ) <nl> - logging . error ( ' Result : \ n ' + ret [ 0 ] ) <nl> + logging . error ( ' Result : \ n ' + ret . stdout ) <nl> raise Exception ( ' make failed ! ' ) <nl> assert os . path . exists ( tempdirname + ' / ' + output_file ) , ' Building a cmake - generated Makefile failed to produce an output file % s ! ' % tempdirname + ' / ' + output_file <nl> <nl> def check_makefile ( configuration , dirname ) : <nl> <nl> # Run through node , if CMake produced a . js file . <nl> if output_file . endswith ( ' . js ' ) : <nl> - ret = Popen ( NODE_JS + [ tempdirname + ' / ' + output_file ] , stdout = PIPE ) . communicate ( ) [ 0 ] <nl> + ret = run_process ( NODE_JS + [ tempdirname + ' / ' + output_file ] , stdout = PIPE ) . stdout <nl> self . assertTextDataIdentical ( open ( cmakelistsdir + ' / out . txt ' , ' r ' ) . read ( ) . strip ( ) , ret . strip ( ) ) <nl> finally : <nl> os . chdir ( path_from_root ( ' tests ' ) ) # Move away from the directory we are about to remove . <nl> def test_cmake_compile_features ( self ) : <nl> os . chdir ( tempdirname_native ) <nl> cmd = [ ' cmake ' , ' - DCMAKE_C_COMPILER = ' + CLANG_CC , ' - DCMAKE_CXX_COMPILER = ' + CLANG_CPP , path_from_root ( ' tests ' , ' cmake ' , ' stdproperty ' ) ] <nl> print ( str ( cmd ) ) <nl> - native_features = Popen ( cmd , stdout = PIPE ) . communicate ( ) [ 0 ] <nl> + native_features = run_process ( cmd , stdout = PIPE ) . stdout <nl> finally : <nl> os . chdir ( tempdirname_emscripten ) <nl> try : <nl> def test_cmake_compile_features ( self ) : <nl> os . chdir ( tempdirname_emscripten ) <nl> cmd = [ emconfigure , ' cmake ' , path_from_root ( ' tests ' , ' cmake ' , ' stdproperty ' ) ] <nl> print ( str ( cmd ) ) <nl> - emscripten_features = Popen ( cmd , stdout = PIPE ) . communicate ( ) [ 0 ] <nl> + emscripten_features = run_process ( cmd , stdout = PIPE ) . stdout <nl> finally : <nl> os . chdir ( path_from_root ( ' tests ' ) ) <nl> try : <nl> def test_cmake_with_embind_cpp11_mode ( self ) : <nl> print ( str ( build ) ) <nl> subprocess . check_call ( build ) <nl> <nl> - ret = Popen ( NODE_JS + [ os . path . join ( tempdirname , ' cpp_with_emscripten_val . js ' ) ] , stdout = PIPE ) . communicate ( ) [ 0 ] . strip ( ) <nl> + ret = run_process ( NODE_JS + [ os . path . join ( tempdirname , ' cpp_with_emscripten_val . js ' ) ] , stdout = PIPE ) . stdout . strip ( ) <nl> if ' - DNO_GNU_EXTENSIONS = 1 ' in args : <nl> self . assertTextDataIdentical ( ' Hello ! __STRICT_ANSI__ : 1 , __cplusplus : 201103 ' , ret ) <nl> else : <nl> def test_failure_error_code ( self ) : <nl> def test_use_cxx ( self ) : <nl> open ( ' empty_file ' , ' w ' ) . write ( ' ' ) <nl> try : <nl> - dash_xc = Popen ( [ PYTHON , EMCC , ' - v ' , ' - xc ' , ' empty_file ' ] , stdout = PIPE , stderr = PIPE ) . communicate ( ) [ 1 ] <nl> + dash_xc = run_process ( [ PYTHON , EMCC , ' - v ' , ' - xc ' , ' empty_file ' ] , stdout = PIPE , stderr = PIPE ) . stderr <nl> self . assertNotContained ( ' - std = c + + 03 ' , dash_xc ) <nl> - dash_xcpp = Popen ( [ PYTHON , EMCC , ' - v ' , ' - xc + + ' , ' empty_file ' ] , stdout = PIPE , stderr = PIPE ) . communicate ( ) [ 1 ] <nl> + dash_xcpp = run_process ( [ PYTHON , EMCC , ' - v ' , ' - xc + + ' , ' empty_file ' ] , stdout = PIPE , stderr = PIPE ) . stderr <nl> self . assertContained ( ' - std = c + + 03 ' , dash_xcpp ) <nl> finally : <nl> try_delete ( ' empty_file ' ) <nl> def test_link_group ( self ) : <nl> <nl> def test ( lib_args , err_expected ) : <nl> print ( err_expected ) <nl> - output = Popen ( [ PYTHON , EMCC , main_name , ' - o ' , ' a . out . js ' ] + lib_args , stdout = PIPE , stderr = PIPE ) . communicate ( ) <nl> - # print output [ 1 ] <nl> + output = run_process ( [ PYTHON , EMCC , main_name , ' - o ' , ' a . out . js ' ] + lib_args , stdout = PIPE , stderr = PIPE , check = not err_expected ) <nl> + # print output . stderr <nl> if err_expected : <nl> - self . assertContained ( err_expected , output [ 1 ] ) <nl> + self . assertContained ( err_expected , output . stderr ) <nl> else : <nl> - self . assertNotContained ( ' unresolved symbol ' , output [ 1 ] ) <nl> + self . assertNotContained ( ' unresolved symbol ' , output . stderr ) <nl> out_js = os . path . join ( self . get_dir ( ) , ' a . out . js ' ) <nl> - assert os . path . exists ( out_js ) , ' \ n ' . join ( output ) <nl> + assert os . path . exists ( out_js ) , output . stdout + ' \ n ' + output . stderr <nl> self . assertContained ( ' result : 42 ' , run_js ( out_js ) ) <nl> <nl> test ( [ ' - Wl , - - start - group ' , lib_name ] , ' - - start - group without matching - - end - group ' ) <nl> def tmp_source ( name , code ) : <nl> <nl> # lib_a does not satisfy any symbols from main , so it will not be included , <nl> # and there will be an unresolved symbol . <nl> - output = Popen ( [ PYTHON , EMCC ] + args + libs_list , stdout = PIPE , stderr = PIPE ) . communicate ( ) <nl> - self . assertContained ( ' error : unresolved symbol : x ' , output [ 1 ] ) <nl> + output = run_process ( [ PYTHON , EMCC ] + args + libs_list , stdout = PIPE , stderr = PIPE , check = False ) <nl> + self . assertContained ( ' error : unresolved symbol : x ' , output . stderr ) <nl> <nl> # - Wl , - - start - group and - Wl , - - end - group around the libs will cause a rescan <nl> # of lib_a after lib_b adds undefined symbol " x " , so a . c . o will now be <nl> # included ( and the link will succeed ) . <nl> libs = [ ' - Wl , - - start - group ' ] + libs_list + [ ' - Wl , - - end - group ' ] <nl> - output = Popen ( [ PYTHON , EMCC ] + args + libs , stdout = PIPE , stderr = PIPE ) . communicate ( ) <nl> + output = run_process ( [ PYTHON , EMCC ] + args + libs , stdout = PIPE , stderr = PIPE ) <nl> out_js = os . path . join ( self . get_dir ( ) , ' a . out . js ' ) <nl> - assert os . path . exists ( out_js ) , ' \ n ' . join ( output ) <nl> + assert os . path . exists ( out_js ) , output . stdout + ' \ n ' + output . stderr <nl> self . assertContained ( ' result : 42 ' , run_js ( out_js ) ) <nl> <nl> # - ( and - ) should also work . <nl> args = [ ' - s ' , ' ERROR_ON_UNDEFINED_SYMBOLS = 1 ' , main , ' - o ' , ' a2 . out . js ' ] <nl> libs = [ ' - Wl , - ( ' ] + libs_list + [ ' - Wl , - ) ' ] <nl> - output = Popen ( [ PYTHON , EMCC ] + args + libs , stdout = PIPE , stderr = PIPE ) . communicate ( ) <nl> + output = run_process ( [ PYTHON , EMCC ] + args + libs , stdout = PIPE , stderr = PIPE ) <nl> out_js = os . path . join ( self . get_dir ( ) , ' a2 . out . js ' ) <nl> - assert os . path . exists ( out_js ) , ' \ n ' . join ( output ) <nl> + assert os . path . exists ( out_js ) , output . stdout + ' \ n ' + output . stderr <nl> self . assertContained ( ' result : 42 ' , run_js ( out_js ) ) <nl> <nl> def test_redundant_link ( self ) : <nl> def test_ungetc_fscanf ( self ) : <nl> ' ' ' ) <nl> open ( ' my_test . input ' , ' w ' ) . write ( ' abc ' ) <nl> Building . emcc ( ' main . cpp ' , [ ' - - embed - file ' , ' my_test . input ' ] , output_filename = ' a . out . js ' ) <nl> - self . assertContained ( ' zyx ' , Popen ( JS_ENGINES [ 0 ] + [ ' a . out . js ' ] , stdout = PIPE , stderr = PIPE ) . communicate ( ) [ 0 ] ) <nl> + self . assertContained ( ' zyx ' , run_process ( JS_ENGINES [ 0 ] + [ ' a . out . js ' ] , stdout = PIPE , stderr = PIPE ) . stdout ) <nl> <nl> def test_abspaths ( self ) : <nl> # Includes with absolute paths are generally dangerous , things like - I / usr / . . will get to system local headers , not our portable ones . <nl> def test_abspaths ( self ) : <nl> ( [ ' - Lsubdir / something ' , ' - Wwarn - absolute - paths ' ] , False ) , <nl> ( [ ] , False ) ] : <nl> print ( args , expected ) <nl> - proc = Popen ( [ PYTHON , EMCC , ' main . c ' ] + args , stderr = PIPE ) <nl> - err = proc . communicate ( ) [ 1 ] <nl> - assert proc . returncode is 0 <nl> - assert ( ' encountered . If this is to a local system header / library , it may cause problems ( local system files make sense for compiling natively on your system , but not necessarily to JavaScript ) ' in err ) = = expected , err <nl> + proc = run_process ( [ PYTHON , EMCC , ' main . c ' ] + args , stderr = PIPE ) <nl> + assert ( ' encountered . If this is to a local system header / library , it may cause problems ( local system files make sense for compiling natively on your system , but not necessarily to JavaScript ) ' in proc . stderr ) = = expected , proc . stderr <nl> if not expected : <nl> - assert err = = ' ' , err <nl> + assert proc . stderr = = ' ' , proc . stderr <nl> <nl> def test_local_link ( self ) : <nl> # Linking a local library directly , like / usr / lib / libsomething . so , cannot work of course since it <nl> def test_dup_o_in_one_a ( self ) : <nl> b ( ) ; <nl> } <nl> ' ' ' ) <nl> - out , err = Popen ( [ PYTHON , EMCC , ' main . c ' , ' - L . ' , ' - la ' ] , stderr = PIPE ) . communicate ( ) <nl> + err = run_process ( [ PYTHON , EMCC , ' main . c ' , ' - L . ' , ' - la ' ] , stderr = PIPE ) . stderr <nl> assert ' loading from archive ' not in err , err <nl> assert ' which has duplicate entries ' not in err , err <nl> assert ' duplicate : common . o ' not in err , err <nl> self . assertContained ( ' a \ nb . . . \ n ' , run_js ( ' a . out . js ' ) ) <nl> <nl> - text = Popen ( [ PYTHON , EMAR , ' t ' , ' liba . a ' ] , stdout = PIPE ) . communicate ( ) [ 0 ] <nl> + text = run_process ( [ PYTHON , EMAR , ' t ' , ' liba . a ' ] , stdout = PIPE ) . stdout <nl> assert ' common . o ' not in text , text <nl> assert text . count ( ' common_ ' ) = = 2 , text <nl> for line in text . split ( ' \ n ' ) : <nl> def test_dup_o_in_one_a ( self ) : <nl> <nl> # make the hashing fail : ' q ' is just a quick append , no replacement , so hashing is not done , and dupes are easy <nl> Popen ( [ PYTHON , EMAR , ' q ' , ' liba . a ' , ' common . o ' , os . path . join ( ' libdir ' , ' common . o ' ) ] ) . communicate ( ) <nl> - out , err = Popen ( [ PYTHON , EMCC , ' main . c ' , ' - L . ' , ' - la ' ] , stderr = PIPE ) . communicate ( ) <nl> + err = run_process ( [ PYTHON , EMCC , ' main . c ' , ' - L . ' , ' - la ' ] , stderr = PIPE ) . stderr <nl> assert ' loading from archive ' in err , err <nl> assert ' which has duplicate entries ' in err , err <nl> assert ' duplicate : common . o ' in err , err <nl> def test_sdl_endianness ( self ) : <nl> def test_libpng ( self ) : <nl> shutil . copyfile ( path_from_root ( ' tests ' , ' pngtest . png ' ) , ' pngtest . png ' ) <nl> Building . emcc ( path_from_root ( ' tests ' , ' pngtest . c ' ) , [ ' - - embed - file ' , ' pngtest . png ' , ' - s ' , ' USE_ZLIB = 1 ' , ' - s ' , ' USE_LIBPNG = 1 ' ] , output_filename = ' a . out . js ' ) <nl> - self . assertContained ( ' TESTS PASSED ' , Popen ( JS_ENGINES [ 0 ] + [ ' a . out . js ' ] , stdout = PIPE , stderr = PIPE ) . communicate ( ) [ 0 ] ) <nl> + self . assertContained ( ' TESTS PASSED ' , run_process ( JS_ENGINES [ 0 ] + [ ' a . out . js ' ] , stdout = PIPE , stderr = PIPE ) . stdout ) <nl> <nl> def test_bullet ( self ) : <nl> Building . emcc ( path_from_root ( ' tests ' , ' bullet_hello_world . cpp ' ) , [ ' - s ' , ' USE_BULLET = 1 ' ] , output_filename = ' a . out . js ' ) <nl> - self . assertContained ( ' BULLET RUNNING ' , Popen ( JS_ENGINES [ 0 ] + [ ' a . out . js ' ] , stdout = PIPE , stderr = PIPE ) . communicate ( ) [ 0 ] ) <nl> + self . assertContained ( ' BULLET RUNNING ' , run_process ( JS_ENGINES [ 0 ] + [ ' a . out . js ' ] , stdout = PIPE , stderr = PIPE ) . stdout ) <nl> <nl> def test_vorbis ( self ) : <nl> # This will also test if ogg compiles , because vorbis depends on ogg <nl> Building . emcc ( path_from_root ( ' tests ' , ' vorbis_test . c ' ) , [ ' - s ' , ' USE_VORBIS = 1 ' ] , output_filename = ' a . out . js ' ) <nl> - self . assertContained ( ' ALL OK ' , Popen ( JS_ENGINES [ 0 ] + [ ' a . out . js ' ] , stdout = PIPE , stderr = PIPE ) . communicate ( ) [ 0 ] ) <nl> + self . assertContained ( ' ALL OK ' , run_process ( JS_ENGINES [ 0 ] + [ ' a . out . js ' ] , stdout = PIPE , stderr = PIPE ) . stdout ) <nl> <nl> def test_freetype ( self ) : <nl> # copy the Liberation Sans Bold truetype file located in the < emscripten_root > / tests / freetype to the compilation folder <nl> def test_freetype ( self ) : <nl> ' * * * * * * * * * * \ n ' + \ <nl> ' * * * * + + * * * + \ n ' + \ <nl> ' + * * * + + * * * + \ n ' <nl> - self . assertContained ( expectedOutput , Popen ( JS_ENGINES [ 0 ] + [ ' a . out . js ' ] , stdout = PIPE , stderr = PIPE ) . communicate ( ) [ 0 ] ) <nl> + self . assertContained ( expectedOutput , run_process ( JS_ENGINES [ 0 ] + [ ' a . out . js ' ] , stdout = PIPE , stderr = PIPE ) . stdout ) <nl> <nl> def test_link_memcpy ( self ) : <nl> # memcpy can show up * after * optimizations , so after our opportunity to link in libc , so it must be special - cased <nl> def clear ( ) : try_delete ( ' a . out . js ' ) <nl> clear ( ) <nl> print ( ' warn ' , args , action , value ) <nl> extra = [ ' - s ' , action + ' _ON_UNDEFINED_SYMBOLS = % d ' % value ] if action else [ ] <nl> - output = Popen ( [ PYTHON , EMCC , os . path . join ( self . get_dir ( ) , ' main . cpp ' ) ] + extra + args , stderr = PIPE ) . communicate ( ) <nl> + output = run_process ( [ PYTHON , EMCC , os . path . join ( self . get_dir ( ) , ' main . cpp ' ) ] + extra + args , stderr = PIPE , check = False ) <nl> if action = = None or ( action = = ' WARN ' and value ) : <nl> - self . assertContained ( ' unresolved symbol : something ' , output [ 1 ] ) <nl> - self . assertContained ( ' unresolved symbol : elsey ' , output [ 1 ] ) <nl> + self . assertContained ( ' unresolved symbol : something ' , output . stderr ) <nl> + self . assertContained ( ' unresolved symbol : elsey ' , output . stderr ) <nl> assert os . path . exists ( ' a . out . js ' ) <nl> - self . assertNotContained ( ' unresolved symbol : emscripten_ ' , output [ 1 ] ) <nl> + self . assertNotContained ( ' unresolved symbol : emscripten_ ' , output . stderr ) <nl> elif action = = ' ERROR ' and value : <nl> - self . assertContained ( ' unresolved symbol : something ' , output [ 1 ] ) <nl> - self . assertContained ( ' unresolved symbol : elsey ' , output [ 1 ] ) <nl> - self . assertNotContained ( ' warning ' , output [ 1 ] ) <nl> + self . assertContained ( ' unresolved symbol : something ' , output . stderr ) <nl> + self . assertContained ( ' unresolved symbol : elsey ' , output . stderr ) <nl> + self . assertNotContained ( ' warning ' , output . stderr ) <nl> assert not os . path . exists ( ' a . out . js ' ) <nl> elif action = = ' WARN ' and not value : <nl> - self . assertNotContained ( ' unresolved symbol ' , output [ 1 ] ) <nl> + self . assertNotContained ( ' unresolved symbol ' , output . stderr ) <nl> assert os . path . exists ( ' a . out . js ' ) <nl> <nl> def test_toobig ( self ) : <nl> def test_toobig ( self ) : <nl> return 0 ; <nl> } <nl> ' ' ' ) <nl> - output = Popen ( [ PYTHON , EMCC , os . path . join ( self . get_dir ( ) , ' main . cpp ' ) ] , stderr = PIPE ) . communicate ( ) [ 1 ] <nl> + output = run_process ( [ PYTHON , EMCC , os . path . join ( self . get_dir ( ) , ' main . cpp ' ) ] , stderr = PIPE ) . stderr <nl> print ( output ) <nl> assert os . path . exists ( ' a . out . js ' ) <nl> <nl> def test_js_optimizer ( self ) : <nl> <nl> # test calling js optimizer <nl> print ( ' js ' ) <nl> - output = Popen ( NODE_JS + [ path_from_root ( ' tools ' , ' js - optimizer . js ' ) , input ] + passes , stdin = PIPE , stdout = PIPE ) . communicate ( ) [ 0 ] <nl> + output = run_process ( NODE_JS + [ path_from_root ( ' tools ' , ' js - optimizer . js ' ) , input ] + passes , stdin = PIPE , stdout = PIPE ) . stdout <nl> <nl> def check_js ( js , expected ) : <nl> # print > > sys . stderr , ' chak \ n = = = = = = = = = = = = = = = = = = = = = = = = = = \ n ' , js , ' \ n = = = = = = = = = = = = = = = = = = = = = = = = = = = \ n ' <nl> def check_json ( ) : <nl> if ' last ' not in passes and \ <nl> ' null_if ' not in input and ' null_else ' not in input : # null - * tests are js optimizer or native , not a mixture ( they mix badly ) <nl> print ( ' native ( receiveJSON ) ' ) <nl> - output = Popen ( [ js_optimizer . get_native_optimizer ( ) , input_temp + ' . js ' ] + passes + [ ' receiveJSON ' , ' emitJSON ' ] , stdin = PIPE , stdout = open ( output_temp , ' w ' ) ) . communicate ( ) [ 0 ] <nl> + output = run_process ( [ js_optimizer . get_native_optimizer ( ) , input_temp + ' . js ' ] + passes + [ ' receiveJSON ' , ' emitJSON ' ] , stdin = PIPE , stdout = open ( output_temp , ' w ' ) ) . stdout <nl> check_json ( ) <nl> <nl> print ( ' native ( parsing JS ) ' ) <nl> - output = Popen ( [ js_optimizer . get_native_optimizer ( ) , input ] + passes + [ ' emitJSON ' ] , stdin = PIPE , stdout = open ( output_temp , ' w ' ) ) . communicate ( ) [ 0 ] <nl> + output = run_process ( [ js_optimizer . get_native_optimizer ( ) , input ] + passes + [ ' emitJSON ' ] , stdin = PIPE , stdout = open ( output_temp , ' w ' ) ) . stdout <nl> check_json ( ) <nl> <nl> print ( ' native ( emitting JS ) ' ) <nl> - output = Popen ( [ js_optimizer . get_native_optimizer ( ) , input ] + passes , stdin = PIPE , stdout = PIPE ) . communicate ( ) [ 0 ] <nl> + output = run_process ( [ js_optimizer . get_native_optimizer ( ) , input ] + passes , stdin = PIPE , stdout = PIPE ) . stdout <nl> check_js ( output , expected ) <nl> <nl> def test_m_mm ( self ) : <nl> open ( os . path . join ( self . get_dir ( ) , ' foo . c ' ) , ' w ' ) . write ( ' ' ' # include < emscripten . h > ' ' ' ) <nl> for opt in [ ' M ' , ' MM ' ] : <nl> - output , err = Popen ( [ PYTHON , EMCC , os . path . join ( self . get_dir ( ) , ' foo . c ' ) , ' - ' + opt ] , stdout = PIPE , stderr = PIPE ) . communicate ( ) <nl> - assert ' foo . o : ' in output , ' - % s failed to produce the right output : % s ' % ( opt , output ) <nl> - assert ' error ' not in err , ' Unexpected stderr : ' + err <nl> + proc = run_process ( [ PYTHON , EMCC , os . path . join ( self . get_dir ( ) , ' foo . c ' ) , ' - ' + opt ] , stdout = PIPE , stderr = PIPE ) <nl> + assert ' foo . o : ' in proc . stdout , ' - % s failed to produce the right output : % s ' % ( opt , proc . stdout ) <nl> + assert ' error ' not in proc . stderr , ' Unexpected stderr : ' + proc . stderr <nl> <nl> def test_emcc_debug_files ( self ) : <nl> if os . environ . get ( ' EMCC_DEBUG ' ) : return self . skip ( ' cannot run in debug mode ' ) <nl> def test_debuginfo ( self ) : <nl> ] : <nl> print ( args , expect_llvm , expect_js ) <nl> with clean_write_access_to_canonical_temp_dir ( ) : <nl> - output , err = Popen ( [ PYTHON , EMCC , path_from_root ( ' tests ' , ' hello_world . cpp ' ) ] + args , stdout = PIPE , stderr = PIPE ) . communicate ( ) <nl> + err = run_process ( [ PYTHON , EMCC , path_from_root ( ' tests ' , ' hello_world . cpp ' ) ] + args , stdout = PIPE , stderr = PIPE ) . stderr <nl> assert expect_llvm = = ( ' strip - debug ' not in err ) <nl> assert expect_js = = ( ' registerize ' not in err ) <nl> finally : <nl> def test_llvm_nativizer ( self ) : <nl> open ( os . path . join ( self . get_dir ( ) , ' test . file ' ) , ' w ' ) . write ( ' ' ' ay file . . . . . . . . . . . . . . , , , , , , , , , , , , , , ' ' ' ) <nl> open ( os . path . join ( self . get_dir ( ) , ' stdin ' ) , ' w ' ) . write ( ' ' ' inter - active ' ' ' ) <nl> subprocess . check_call ( [ PYTHON , EMCC , os . path . join ( self . get_dir ( ) , ' files . cpp ' ) , ' - c ' ] ) <nl> - nativize_llvm = Popen ( [ PYTHON , path_from_root ( ' tools ' , ' nativize_llvm . py ' ) , os . path . join ( self . get_dir ( ) , ' files . o ' ) ] , stdout = PIPE ) <nl> - out = nativize_llvm . communicate ( input ) <nl> - assert nativize_llvm . returncode = = 0 , out <nl> - output = Popen ( [ os . path . join ( self . get_dir ( ) , ' files . o . run ' ) ] , stdin = open ( os . path . join ( self . get_dir ( ) , ' stdin ' ) ) , stdout = PIPE , stderr = PIPE ) . communicate ( ) <nl> + run_process ( [ PYTHON , path_from_root ( ' tools ' , ' nativize_llvm . py ' ) , os . path . join ( self . get_dir ( ) , ' files . o ' ) ] , stdout = PIPE ) <nl> + output = run_process ( [ os . path . join ( self . get_dir ( ) , ' files . o . run ' ) ] , stdin = open ( os . path . join ( self . get_dir ( ) , ' stdin ' ) ) , stdout = PIPE , stderr = PIPE ) <nl> self . assertContained ( ' ' ' size : 37 <nl> data : 119 , 97 , 107 , 97 , 32 , 119 , 97 , 107 , 97 , 35 , 35 , 35 , 35 , 35 , 35 , 35 , 35 , 35 , 35 , 35 , 35 , 35 , 35 , 35 , 35 , 35 , 35 , 35 , 35 , 35 , 35 , 35 , 35 , 35 , 35 , 35 , 35 <nl> loop : 119 97 107 97 32 119 97 107 97 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 ' ' ' + ' ' ' <nl> def test_llvm_nativizer ( self ) : <nl> 5 : 10 , 30 , 20 , 11 , 88 <nl> other = ay file . . . <nl> seeked = file . <nl> - ' ' ' , output [ 0 ] ) <nl> - self . assertContained ( ' texte \ n ' , output [ 1 ] ) <nl> + ' ' ' , output . stdout ) <nl> + self . assertContained ( ' texte \ n ' , output . stderr ) <nl> <nl> def test_emconfig ( self ) : <nl> - output = Popen ( [ PYTHON , EMCONFIG , ' LLVM_ROOT ' ] , stdout = PIPE , stderr = PIPE ) . communicate ( ) [ 0 ] . strip ( ) <nl> + output = run_process ( [ PYTHON , EMCONFIG , ' LLVM_ROOT ' ] , stdout = PIPE , stderr = PIPE ) . stdout . strip ( ) <nl> try : <nl> assert output = = LLVM_ROOT <nl> except : <nl> def test_emconfig ( self ) : <nl> raise <nl> invalid = ' Usage : em - config VAR_NAME ' <nl> # Don ' t accept variables that do not exist <nl> - output = Popen ( [ PYTHON , EMCONFIG , ' VAR_WHICH_DOES_NOT_EXIST ' ] , stdout = PIPE , stderr = PIPE ) . communicate ( ) [ 0 ] . strip ( ) <nl> + output = run_process ( [ PYTHON , EMCONFIG , ' VAR_WHICH_DOES_NOT_EXIST ' ] , stdout = PIPE , stderr = PIPE , check = False ) . stdout . strip ( ) <nl> assert output = = invalid <nl> # Don ' t accept no arguments <nl> - output = Popen ( [ PYTHON , EMCONFIG ] , stdout = PIPE , stderr = PIPE ) . communicate ( ) [ 0 ] . strip ( ) <nl> + output = run_process ( [ PYTHON , EMCONFIG ] , stdout = PIPE , stderr = PIPE , check = False ) . stdout . strip ( ) <nl> assert output = = invalid <nl> # Don ' t accept more than one variable <nl> - output = Popen ( [ PYTHON , EMCONFIG , ' LLVM_ROOT ' , ' EMCC ' ] , stdout = PIPE , stderr = PIPE ) . communicate ( ) [ 0 ] . strip ( ) <nl> + output = run_process ( [ PYTHON , EMCONFIG , ' LLVM_ROOT ' , ' EMCC ' ] , stdout = PIPE , stderr = PIPE , check = False ) . stdout . strip ( ) <nl> assert output = = invalid <nl> # Don ' t accept arbitrary python code <nl> - output = Popen ( [ PYTHON , EMCONFIG , ' sys . argv [ 1 ] ' ] , stdout = PIPE , stderr = PIPE ) . communicate ( ) [ 0 ] . strip ( ) <nl> + output = run_process ( [ PYTHON , EMCONFIG , ' sys . argv [ 1 ] ' ] , stdout = PIPE , stderr = PIPE , check = False ) . stdout . strip ( ) <nl> assert output = = invalid <nl> <nl> def test_link_s ( self ) : <nl> def test_conftest_s_flag_passing ( self ) : <nl> ' ' ' ) <nl> os . environ [ " EMMAKEN_JUST_CONFIGURE " ] = " 1 " <nl> cmd = [ PYTHON , EMCC , ' - s ' , ' ASSERTIONS = 1 ' , os . path . join ( self . get_dir ( ) , ' conftest . c ' ) , ' - o ' , ' conftest ' ] <nl> - output = Popen ( cmd , stderr = PIPE ) . communicate ( ) <nl> + output = run_process ( cmd , stderr = PIPE ) <nl> del os . environ [ " EMMAKEN_JUST_CONFIGURE " ] <nl> - self . assertNotContained ( ' emcc : warning : treating - s as linker option ' , output [ 1 ] ) <nl> + self . assertNotContained ( ' emcc : warning : treating - s as linker option ' , output . stderr ) <nl> assert os . path . exists ( ' conftest ' ) <nl> <nl> def test_file_packager ( self ) : <nl> def test_file_packager ( self ) : <nl> os . chdir ( ' subdir ' ) <nl> open ( ' data2 . txt ' , ' w ' ) . write ( ' data2 ' ) <nl> # relative path to below the current dir is invalid <nl> - out , err = Popen ( [ PYTHON , FILE_PACKAGER , ' test . data ' , ' - - preload ' , ' . . / data1 . txt ' ] , stdout = PIPE , stderr = PIPE ) . communicate ( ) <nl> - assert len ( out ) = = 0 <nl> - assert ' below the current directory ' in err <nl> + output = run_process ( [ PYTHON , FILE_PACKAGER , ' test . data ' , ' - - preload ' , ' . . / data1 . txt ' ] , stdout = PIPE , stderr = PIPE , check = False ) <nl> + assert len ( output . stdout ) = = 0 <nl> + assert ' below the current directory ' in output . stderr <nl> # relative path that ends up under us is cool <nl> - out , err = Popen ( [ PYTHON , FILE_PACKAGER , ' test . data ' , ' - - preload ' , ' . . / subdir / data2 . txt ' ] , stdout = PIPE , stderr = PIPE ) . communicate ( ) <nl> - assert len ( out ) > 0 <nl> - assert ' below the current directory ' not in err <nl> + output = run_process ( [ PYTHON , FILE_PACKAGER , ' test . data ' , ' - - preload ' , ' . . / subdir / data2 . txt ' ] , stdout = PIPE , stderr = PIPE ) <nl> + assert len ( output . stdout ) > 0 <nl> + assert ' below the current directory ' not in output . stderr <nl> # direct path leads to the same code being generated - relative path does not make us do anything different <nl> - out2 , err2 = Popen ( [ PYTHON , FILE_PACKAGER , ' test . data ' , ' - - preload ' , ' data2 . txt ' ] , stdout = PIPE , stderr = PIPE ) . communicate ( ) <nl> - assert len ( out2 ) > 0 <nl> - assert ' below the current directory ' not in err2 <nl> + output2 = run_process ( [ PYTHON , FILE_PACKAGER , ' test . data ' , ' - - preload ' , ' data2 . txt ' ] , stdout = PIPE , stderr = PIPE ) <nl> + assert len ( output2 . stdout ) > 0 <nl> + assert ' below the current directory ' not in output2 . stderr <nl> def clean ( txt ) : <nl> return [ line for line in txt . split ( ' \ n ' ) if ' PACKAGE_UUID ' not in line and ' loadPackage ( { ' not in line ] <nl> - out = clean ( out ) <nl> - out2 = clean ( out2 ) <nl> - assert out = = out2 <nl> + assert clean ( output . stdout ) = = clean ( output2 . stdout ) <nl> # verify ' - - separate - metadata ' option produces separate metadata file <nl> os . chdir ( ' . . ' ) <nl> Popen ( [ PYTHON , FILE_PACKAGER , ' test . data ' , ' - - preload ' , ' data1 . txt ' , ' - - preload ' , ' subdir / data2 . txt ' , ' - - js - output = immutable . js ' , ' - - separate - metadata ' ] ) . communicate ( ) <nl> def test_file_packager_unicode ( self ) : <nl> return <nl> full = os . path . join ( unicode_name , ' data . txt ' ) <nl> open ( full , ' w ' ) . write ( ' data ' ) <nl> - proc = Popen ( [ PYTHON , FILE_PACKAGER , ' test . data ' , ' - - preload ' , full ] , stdout = PIPE , stderr = PIPE ) <nl> - out , err = proc . communicate ( ) <nl> - assert proc . returncode = = 0 , err <nl> - assert len ( out ) > 0 , err <nl> - assert len ( err ) = = 0 , err <nl> - assert unicode_name in out , out <nl> - print ( len ( err ) ) <nl> + proc = run_process ( [ PYTHON , FILE_PACKAGER , ' test . data ' , ' - - preload ' , full ] , stdout = PIPE , stderr = PIPE ) <nl> + assert len ( proc . stdout ) > 0 , proc . stderr <nl> + assert len ( proc . stderr ) = = 0 , proc . stderr <nl> + assert unicode_name in proc . stdout , proc . stdout <nl> + print ( len ( proc . stderr ) ) <nl> <nl> def test_crunch ( self ) : <nl> try : <nl> def test_headless ( self ) : <nl> def test_preprocess ( self ) : <nl> self . clear ( ) <nl> <nl> - out , err = Popen ( [ PYTHON , EMCC , path_from_root ( ' tests ' , ' hello_world . c ' ) , ' - E ' ] , stdout = PIPE ) . communicate ( ) <nl> + out = run_process ( [ PYTHON , EMCC , path_from_root ( ' tests ' , ' hello_world . c ' ) , ' - E ' ] , stdout = PIPE ) . stdout <nl> assert not os . path . exists ( ' a . out . js ' ) <nl> # Test explicitly that the output contains a line typically written by the preprocessor . <nl> # Clang outputs on Windows lines like " # line 1 " , on Unix ' # 1 ' . <nl> def test_EMCC_BUILD_DIR ( self ) : <nl> open ( ' lib . js ' , ' w ' ) . write ( r ' ' ' <nl> printErr ( ' dir was ' + process . env . EMCC_BUILD_DIR ) ; <nl> ' ' ' ) <nl> - out , err = Popen ( [ PYTHON , EMCC , path_from_root ( ' tests ' , ' hello_world . cpp ' ) , ' - - js - library ' , ' lib . js ' ] , stderr = PIPE ) . communicate ( ) <nl> + err = run_process ( [ PYTHON , EMCC , path_from_root ( ' tests ' , ' hello_world . cpp ' ) , ' - - js - library ' , ' lib . js ' ] , stderr = PIPE ) . stderr <nl> self . assertContained ( ' dir was ' + os . path . realpath ( os . path . normpath ( self . get_dir ( ) ) ) , err ) <nl> <nl> def test_float_h ( self ) : <nl> - process = Popen ( [ PYTHON , EMCC , path_from_root ( ' tests ' , ' float + . c ' ) ] , stdout = PIPE , stderr = PIPE ) <nl> - out , err = process . communicate ( ) <nl> - assert process . returncode is 0 , ' float . h should agree with our system : ' + out + ' \ n \ n \ n ' + err <nl> + process = run_process ( [ PYTHON , EMCC , path_from_root ( ' tests ' , ' float + . c ' ) ] , stdout = PIPE , stderr = PIPE ) <nl> + assert process . returncode is 0 , ' float . h should agree with our system : ' + process . stdout + ' \ n \ n \ n ' + process . stderr <nl> <nl> def test_default_obj_ext ( self ) : <nl> outdir = os . path . join ( self . get_dir ( ) , ' out_dir ' ) + ' / ' <nl> <nl> self . clear ( ) <nl> os . mkdir ( outdir ) <nl> - process = Popen ( [ PYTHON , EMCC , ' - c ' , path_from_root ( ' tests ' , ' hello_world . c ' ) , ' - o ' , outdir ] , stderr = PIPE ) <nl> - out , err = process . communicate ( ) <nl> + err = run_process ( [ PYTHON , EMCC , ' - c ' , path_from_root ( ' tests ' , ' hello_world . c ' ) , ' - o ' , outdir ] , stderr = PIPE ) . stderr <nl> assert not err , err <nl> assert os . path . isfile ( outdir + ' hello_world . o ' ) <nl> <nl> self . clear ( ) <nl> os . mkdir ( outdir ) <nl> - process = Popen ( [ PYTHON , EMCC , ' - c ' , path_from_root ( ' tests ' , ' hello_world . c ' ) , ' - o ' , outdir , ' - - default - obj - ext ' , ' obj ' ] , stderr = PIPE ) <nl> - out , err = process . communicate ( ) <nl> + err = run_process ( [ PYTHON , EMCC , ' - c ' , path_from_root ( ' tests ' , ' hello_world . c ' ) , ' - o ' , outdir , ' - - default - obj - ext ' , ' obj ' ] , stderr = PIPE ) . stderr <nl> assert not err , err <nl> assert os . path . isfile ( outdir + ' hello_world . obj ' ) <nl> <nl> def test_precompiled_headers ( self ) : <nl> assert ' | 5 | ' in output , output <nl> <nl> # also verify that the gch is actually used <nl> - err = Popen ( [ PYTHON , EMCC , ' src . cpp ' , ' - include ' , ' header . h ' , ' - Xclang ' , ' - print - stats ' ] , stderr = PIPE ) . communicate ( ) <nl> - self . assertTextDataContained ( ' * * * PCH / Modules Loaded : \ nModule : header . h . ' + suffix , err [ 1 ] ) <nl> + err = run_process ( [ PYTHON , EMCC , ' src . cpp ' , ' - include ' , ' header . h ' , ' - Xclang ' , ' - print - stats ' ] , stderr = PIPE ) . stderr <nl> + self . assertTextDataContained ( ' * * * PCH / Modules Loaded : \ nModule : header . h . ' + suffix , err ) <nl> # and sanity check it is not mentioned when not <nl> try_delete ( ' header . h . ' + suffix ) <nl> - err = Popen ( [ PYTHON , EMCC , ' src . cpp ' , ' - include ' , ' header . h ' , ' - Xclang ' , ' - print - stats ' ] , stderr = PIPE ) . communicate ( ) <nl> - assert ' * * * PCH / Modules Loaded : \ nModule : header . h . ' + suffix not in err [ 1 ] . replace ( ' \ r \ n ' , ' \ n ' ) , err [ 1 ] <nl> + err = run_process ( [ PYTHON , EMCC , ' src . cpp ' , ' - include ' , ' header . h ' , ' - Xclang ' , ' - print - stats ' ] , stderr = PIPE ) . stderr <nl> + assert ' * * * PCH / Modules Loaded : \ nModule : header . h . ' + suffix not in err . replace ( ' \ r \ n ' , ' \ n ' ) , err <nl> <nl> # with specified target via - o <nl> try_delete ( ' header . h . ' + suffix ) <nl> def test_warn_unaligned ( self ) : <nl> return 0 ; <nl> } <nl> ' ' ' ) <nl> - output = Popen ( [ PYTHON , EMCC , ' src . cpp ' , ' - s ' , ' WARN_UNALIGNED = 1 ' ] , stderr = PIPE ) . communicate ( ) <nl> - assert ' emcc : warning : unaligned store ' in output [ 1 ] , output [ 1 ] <nl> - output = Popen ( [ PYTHON , EMCC , ' src . cpp ' , ' - s ' , ' WARN_UNALIGNED = 1 ' , ' - g ' ] , stderr = PIPE ) . communicate ( ) <nl> - assert ' emcc : warning : unaligned store ' in output [ 1 ] , output [ 1 ] <nl> - assert ' @ line 11 " src . cpp " ' in output [ 1 ] , output [ 1 ] <nl> + output = run_process ( [ PYTHON , EMCC , ' src . cpp ' , ' - s ' , ' WARN_UNALIGNED = 1 ' ] , stderr = PIPE ) <nl> + output = run_process ( [ PYTHON , EMCC , ' src . cpp ' , ' - s ' , ' WARN_UNALIGNED = 1 ' , ' - g ' ] , stderr = PIPE ) <nl> + assert ' emcc : warning : unaligned store ' in output . stderr , output . stderr <nl> + assert ' emcc : warning : unaligned store ' in output . stderr , output . stderr <nl> + assert ' @ line 11 " src . cpp " ' in output . stderr , output . stderr <nl> <nl> def test_LEGACY_VM_SUPPORT ( self ) : <nl> # when modern features are lacking , we can polyfill them or at least warn <nl> def test_os_oz ( self ) : <nl> ] : <nl> print ( args , expect ) <nl> with clean_write_access_to_canonical_temp_dir ( ) : <nl> - output , err = Popen ( [ PYTHON , EMCC , path_from_root ( ' tests ' , ' hello_world . cpp ' ) ] + args , stdout = PIPE , stderr = PIPE ) . communicate ( ) <nl> + err = run_process ( [ PYTHON , EMCC , path_from_root ( ' tests ' , ' hello_world . cpp ' ) ] + args , stdout = PIPE , stderr = PIPE ) . stderr <nl> self . assertContained ( expect , err ) <nl> if ' - O3 ' in args or ' - Oz ' in args or ' - Os ' in args : <nl> self . assertContained ( ' registerizeHarder ' , err ) <nl> def test_implicit_func ( self ) : <nl> ] : <nl> print ( opts , expected ) <nl> try_delete ( ' a . out . js ' ) <nl> - stdout , stderr = Popen ( [ PYTHON , EMCC , ' src . c ' ] + opts , stderr = PIPE ) . communicate ( ) <nl> + stderr = run_process ( [ PYTHON , EMCC , ' src . c ' ] + opts , stderr = PIPE , check = False ) . stderr <nl> for ce in compile_expected + [ ' ' ' warning : incompatible pointer types ' ' ' ] : <nl> self . assertContained ( ce , stderr ) <nl> if expected is None : <nl> def test_incorrect_static_call ( self ) : <nl> if opts ! = 1 - asserts : extra = [ ' - s ' , ' ASSERTIONS = ' + str ( asserts ) ] <nl> cmd = [ PYTHON , EMCC , path_from_root ( ' tests ' , ' sillyfuncast2_noasm . ll ' ) , ' - O ' + str ( opts ) ] + extra <nl> print ( cmd ) <nl> - stdout , stderr = Popen ( cmd , stderr = PIPE ) . communicate ( ) <nl> + stderr = run_process ( cmd , stderr = PIPE ) . stderr <nl> assert ( ' ' ' unexpected number of arguments 3 in call to ' doit ' , should be 2 ' ' ' in stderr ) = = asserts , stderr <nl> assert ( ' ' ' unexpected return type i32 in call to ' doit ' , should be void ' ' ' in stderr ) = = asserts , stderr <nl> assert ( ' ' ' unexpected argument type float at index 1 in call to ' doit ' , should be i32 ' ' ' in stderr ) = = asserts , stderr <nl> def test_llvm_lit ( self ) : <nl> <nl> def test_bad_triple ( self ) : <nl> Popen ( [ CLANG , path_from_root ( ' tests ' , ' hello_world . c ' ) , ' - c ' , ' - emit - llvm ' , ' - o ' , ' a . bc ' ] + get_clang_native_args ( ) , env = get_clang_native_env ( ) , stdout = PIPE , stderr = PIPE ) . communicate ( ) <nl> - out , err = Popen ( [ PYTHON , EMCC , ' a . bc ' ] , stdout = PIPE , stderr = PIPE ) . communicate ( ) <nl> + err = run_process ( [ PYTHON , EMCC , ' a . bc ' ] , stdout = PIPE , stderr = PIPE , check = False ) . stderr <nl> assert ' warning ' in err or ' WARNING ' in err , err <nl> assert ' incorrect target triple ' in err or ' different target triples ' in err , err <nl> <nl> def test_valid_abspath ( self ) : <nl> # Test whether abspath warning appears <nl> abs_include_path = os . path . abspath ( self . get_dir ( ) ) <nl> - process = Popen ( [ PYTHON , EMCC , ' - I % s ' % abs_include_path , ' - Wwarn - absolute - paths ' , path_from_root ( ' tests ' , ' hello_world . c ' ) ] , stdout = PIPE , stderr = PIPE ) <nl> - out , err = process . communicate ( ) <nl> + err = run_process ( [ PYTHON , EMCC , ' - I % s ' % abs_include_path , ' - Wwarn - absolute - paths ' , path_from_root ( ' tests ' , ' hello_world . c ' ) ] , stdout = PIPE , stderr = PIPE ) . stderr <nl> warning = ' - I or - L of an absolute path " - I % s " encountered . If this is to a local system header / library , it may cause problems ( local system files make sense for compiling natively on your system , but not necessarily to JavaScript ) . ' % abs_include_path <nl> assert ( warning in err ) <nl> <nl> # Passing an absolute path to a directory inside the emscripten tree is always ok and should not issue a warning . <nl> abs_include_path = path_from_root ( ' tests ' ) <nl> - process = Popen ( [ PYTHON , EMCC , ' - I % s ' % abs_include_path , ' - Wwarn - absolute - paths ' , path_from_root ( ' tests ' , ' hello_world . c ' ) ] , stdout = PIPE , stderr = PIPE ) <nl> - out , err = process . communicate ( ) <nl> + err = run_process ( [ PYTHON , EMCC , ' - I % s ' % abs_include_path , ' - Wwarn - absolute - paths ' , path_from_root ( ' tests ' , ' hello_world . c ' ) ] , stdout = PIPE , stderr = PIPE ) . stderr <nl> warning = ' - I or - L of an absolute path " - I % s " encountered . If this is to a local system header / library , it may cause problems ( local system files make sense for compiling natively on your system , but not necessarily to JavaScript ) . ' % abs_include_path <nl> assert ( warning not in err ) <nl> <nl> # Hide warning for this include path <nl> - process = Popen ( [ PYTHON , EMCC , ' - - valid - abspath ' , abs_include_path , ' - I % s ' % abs_include_path , ' - Wwarn - absolute - paths ' , path_from_root ( ' tests ' , ' hello_world . c ' ) ] , stdout = PIPE , stderr = PIPE ) <nl> - out , err = process . communicate ( ) <nl> + err = run_process ( [ PYTHON , EMCC , ' - - valid - abspath ' , abs_include_path , ' - I % s ' % abs_include_path , ' - Wwarn - absolute - paths ' , path_from_root ( ' tests ' , ' hello_world . c ' ) ] , stdout = PIPE , stderr = PIPE ) . stderr <nl> assert ( warning not in err ) <nl> <nl> def test_valid_abspath_2 ( self ) : <nl> def test_warn_dylibs ( self ) : <nl> shared_suffixes = [ ' . so ' , ' . dylib ' , ' . dll ' ] <nl> <nl> for suffix in [ ' . o ' , ' . a ' , ' . bc ' , ' . so ' , ' . lib ' , ' . dylib ' , ' . js ' , ' . html ' ] : <nl> - process = Popen ( [ PYTHON , EMCC , path_from_root ( ' tests ' , ' hello_world . c ' ) , ' - o ' , ' out ' + suffix ] , stdout = PIPE , stderr = PIPE ) <nl> - out , err = process . communicate ( ) <nl> + err = run_process ( [ PYTHON , EMCC , path_from_root ( ' tests ' , ' hello_world . c ' ) , ' - o ' , ' out ' + suffix ] , stdout = PIPE , stderr = PIPE ) . stderr <nl> warning = ' Dynamic libraries ( . so , . dylib , . dll ) are currently not supported by Emscripten ' <nl> if suffix in shared_suffixes : <nl> assert ( warning in err ) <nl> def test_symbol_map ( self ) : <nl> if m : cmd + = [ ' - - emit - symbol - map ' ] <nl> if wasm : cmd + = [ ' - s ' , ' WASM = 1 ' ] <nl> print ( cmd ) <nl> - stdout , stderr = Popen ( cmd , stderr = PIPE ) . communicate ( ) <nl> + stderr = run_process ( cmd , stderr = PIPE ) . stderr <nl> assert ( os . path . exists ( ' a . out . js . symbols ' ) = = m ) , stderr <nl> if m : <nl> symbols = open ( ' a . out . js . symbols ' ) . read ( ) <nl> def test_bad_export ( self ) : <nl> self . clear ( ) <nl> cmd = [ PYTHON , EMCC , path_from_root ( ' tests ' , ' hello_world . c ' ) , ' - s ' , ' EXPORTED_FUNCTIONS = [ " ' + m + ' _main " ] ' ] <nl> print ( cmd ) <nl> - stdout , stderr = Popen ( cmd , stderr = PIPE ) . communicate ( ) <nl> + stderr = run_process ( cmd , stderr = PIPE ) . stderr <nl> if m : <nl> assert ' function requested to be exported , but not implemented : " _main " ' in stderr , stderr <nl> else : <nl> def test_bad_export ( self ) : <nl> <nl> def test_no_dynamic_execution ( self ) : <nl> cmd = [ PYTHON , EMCC , path_from_root ( ' tests ' , ' hello_world . c ' ) , ' - O1 ' , ' - s ' , ' NO_DYNAMIC_EXECUTION = 1 ' ] <nl> - stdout , stderr = Popen ( cmd , stderr = PIPE ) . communicate ( ) <nl> + stderr = run_process ( cmd , stderr = PIPE ) . stderr <nl> self . assertContained ( ' hello , world ! ' , run_js ( ' a . out . js ' ) ) <nl> src = open ( ' a . out . js ' ) . read ( ) <nl> assert ' eval ( ' not in src <nl> def test_no_dynamic_execution ( self ) : <nl> <nl> # Test that - - preload - file doesn ' t add an use of eval ( ) . <nl> cmd = [ PYTHON , EMCC , path_from_root ( ' tests ' , ' hello_world . c ' ) , ' - O1 ' , ' - s ' , ' NO_DYNAMIC_EXECUTION = 1 ' , ' - - preload - file ' , ' temp . txt ' ] <nl> - stdout , stderr = Popen ( cmd , stderr = PIPE ) . communicate ( ) <nl> + stderr = run_process ( cmd , stderr = PIPE ) . stderr <nl> self . assertContained ( ' hello , world ! ' , run_js ( ' a . out . js ' ) ) <nl> src = open ( ' a . out . js ' ) . read ( ) <nl> assert ' eval ( ' not in src <nl> def test_returncode ( self ) : <nl> subprocess . check_call ( [ PYTHON , EMCC , ' src . cpp ' , ' - DCODE = % d ' % code , ' - s ' , ' NO_EXIT_RUNTIME = % d ' % no_exit , ' - DCALL_EXIT = % d ' % call_exit ] ) <nl> for engine in JS_ENGINES : <nl> print ( code , no_exit , call_exit , engine ) <nl> - process = Popen ( engine + [ ' a . out . js ' ] , stdout = PIPE , stderr = PIPE ) <nl> - out , err = process . communicate ( ) <nl> + process = run_process ( engine + [ ' a . out . js ' ] , stdout = PIPE , stderr = PIPE , check = False ) <nl> # we always emit the right exit code , whether we exit the runtime or not <nl> - assert process . returncode = = code , [ process . returncode , out , err ] <nl> - assert not out , out <nl> + assert process . returncode = = code , [ process . returncode , process . stdout , process . stderr ] <nl> + assert not process . stdout , process . stdout <nl> if not call_exit : <nl> - assert not err , err <nl> - assert ( ' but NO_EXIT_RUNTIME is set , so halting execution but not exiting the runtime or preventing further async execution ( build with NO_EXIT_RUNTIME = 0 , if you want a true shutdown ) ' in err ) = = ( no_exit and call_exit ) , err <nl> + assert not process . stderr , process . stderr <nl> + assert ( ' but NO_EXIT_RUNTIME is set , so halting execution but not exiting the runtime or preventing further async execution ( build with NO_EXIT_RUNTIME = 0 , if you want a true shutdown ) ' in process . stderr ) = = ( no_exit and call_exit ) , process . stderr <nl> <nl> def test_emscripten_force_exit_NO_EXIT_RUNTIME ( self ) : <nl> open ( ' src . cpp ' , ' w ' ) . write ( r ' ' ' <nl> def test_dashE ( self ) : <nl> ' ' ' ) <nl> def test ( args = [ ] ) : <nl> print ( args ) <nl> - out = Popen ( [ PYTHON , EMCC , ' src . cpp ' , ' - E ' ] + args , stdout = PIPE ) . communicate ( ) [ 0 ] <nl> + out = run_process ( [ PYTHON , EMCC , ' src . cpp ' , ' - E ' ] + args , stdout = PIPE ) . stdout <nl> self . assertContained ( r ' ' ' __attribute__ ( ( used ) ) % d % d % d __attribute__ ( ( used ) ) ' ' ' % ( EMSCRIPTEN_VERSION_MAJOR , EMSCRIPTEN_VERSION_MINOR , EMSCRIPTEN_VERSION_TINY ) , out ) <nl> test ( ) <nl> test ( [ ' - - bind ' ] ) <nl> <nl> def test_dashE_consistent ( self ) : # issue # 3365 <nl> - normal = Popen ( [ PYTHON , EMXX , ' - v ' , ' - Wwarn - absolute - paths ' , path_from_root ( ' tests ' , ' hello_world . cpp ' ) , ' - c ' ] , stdout = PIPE , stderr = PIPE ) . communicate ( ) [ 1 ] <nl> - dash_e = Popen ( [ PYTHON , EMXX , ' - v ' , ' - Wwarn - absolute - paths ' , path_from_root ( ' tests ' , ' hello_world . cpp ' ) , ' - E ' ] , stdout = PIPE , stderr = PIPE ) . communicate ( ) [ 1 ] <nl> + normal = run_process ( [ PYTHON , EMXX , ' - v ' , ' - Wwarn - absolute - paths ' , path_from_root ( ' tests ' , ' hello_world . cpp ' ) , ' - c ' ] , stdout = PIPE , stderr = PIPE ) . stderr <nl> + dash_e = run_process ( [ PYTHON , EMXX , ' - v ' , ' - Wwarn - absolute - paths ' , path_from_root ( ' tests ' , ' hello_world . cpp ' ) , ' - E ' ] , stdout = PIPE , stderr = PIPE ) . stderr <nl> <nl> import difflib <nl> diff = [ a . rstrip ( ) + ' \ n ' for a in difflib . unified_diff ( normal . split ( ' \ n ' ) , dash_e . split ( ' \ n ' ) , fromfile = ' normal ' , tofile = ' dash_e ' ) ] <nl> def test_dashE_consistent ( self ) : # issue # 3365 <nl> assert len ( bad ) = = 0 , ' \ n \ n ' . join ( diff ) <nl> <nl> def test_dashE_respect_dashO ( self ) : # issue # 3365 <nl> - with_dash_o = Popen ( [ PYTHON , EMXX , path_from_root ( ' tests ' , ' hello_world . cpp ' ) , ' - E ' , ' - o ' , ' / dev / null ' ] , stdout = PIPE , stderr = PIPE ) . communicate ( ) [ 0 ] <nl> - without_dash_o = Popen ( [ PYTHON , EMXX , path_from_root ( ' tests ' , ' hello_world . cpp ' ) , ' - E ' ] , stdout = PIPE , stderr = PIPE ) . communicate ( ) [ 0 ] <nl> + with_dash_o = run_process ( [ PYTHON , EMXX , path_from_root ( ' tests ' , ' hello_world . cpp ' ) , ' - E ' , ' - o ' , ' / dev / null ' ] , stdout = PIPE , stderr = PIPE ) . stdout <nl> + without_dash_o = run_process ( [ PYTHON , EMXX , path_from_root ( ' tests ' , ' hello_world . cpp ' ) , ' - E ' ] , stdout = PIPE , stderr = PIPE ) . stdout <nl> assert len ( with_dash_o ) = = 0 <nl> assert len ( without_dash_o ) ! = 0 <nl> <nl> def test_dashM ( self ) : <nl> - out = Popen ( [ PYTHON , EMXX , path_from_root ( ' tests ' , ' hello_world . cpp ' ) , ' - M ' ] , stdout = PIPE ) . communicate ( ) [ 0 ] <nl> + out = run_process ( [ PYTHON , EMXX , path_from_root ( ' tests ' , ' hello_world . cpp ' ) , ' - M ' ] , stdout = PIPE ) . stdout <nl> self . assertContained ( ' hello_world . o : ' , out ) # Verify output is just a dependency rule instead of bitcode or js <nl> <nl> def test_dashM_consistent ( self ) : <nl> - normal = Popen ( [ PYTHON , EMXX , ' - v ' , ' - Wwarn - absolute - paths ' , path_from_root ( ' tests ' , ' hello_world . cpp ' ) , ' - c ' ] , stdout = PIPE , stderr = PIPE ) . communicate ( ) [ 1 ] <nl> - dash_m = Popen ( [ PYTHON , EMXX , ' - v ' , ' - Wwarn - absolute - paths ' , path_from_root ( ' tests ' , ' hello_world . cpp ' ) , ' - M ' ] , stdout = PIPE , stderr = PIPE ) . communicate ( ) [ 1 ] <nl> + normal = run_process ( [ PYTHON , EMXX , ' - v ' , ' - Wwarn - absolute - paths ' , path_from_root ( ' tests ' , ' hello_world . cpp ' ) , ' - c ' ] , stdout = PIPE , stderr = PIPE ) . stderr <nl> + dash_m = run_process ( [ PYTHON , EMXX , ' - v ' , ' - Wwarn - absolute - paths ' , path_from_root ( ' tests ' , ' hello_world . cpp ' ) , ' - M ' ] , stdout = PIPE , stderr = PIPE ) . stderr <nl> <nl> import difflib <nl> diff = [ a . rstrip ( ) + ' \ n ' for a in difflib . unified_diff ( normal . split ( ' \ n ' ) , dash_m . split ( ' \ n ' ) , fromfile = ' normal ' , tofile = ' dash_m ' ) ] <nl> def test_dashM_consistent ( self ) : <nl> assert len ( bad ) = = 0 , ' \ n \ n ' . join ( diff ) <nl> <nl> def test_dashM_respect_dashO ( self ) : <nl> - with_dash_o = Popen ( [ PYTHON , EMXX , path_from_root ( ' tests ' , ' hello_world . cpp ' ) , ' - M ' , ' - o ' , ' / dev / null ' ] , stdout = PIPE , stderr = PIPE ) . communicate ( ) [ 0 ] <nl> - without_dash_o = Popen ( [ PYTHON , EMXX , path_from_root ( ' tests ' , ' hello_world . cpp ' ) , ' - M ' ] , stdout = PIPE , stderr = PIPE ) . communicate ( ) [ 0 ] <nl> + with_dash_o = run_process ( [ PYTHON , EMXX , path_from_root ( ' tests ' , ' hello_world . cpp ' ) , ' - M ' , ' - o ' , ' / dev / null ' ] , stdout = PIPE , stderr = PIPE ) . stdout <nl> + without_dash_o = run_process ( [ PYTHON , EMXX , path_from_root ( ' tests ' , ' hello_world . cpp ' ) , ' - M ' ] , stdout = PIPE , stderr = PIPE ) . stdout <nl> assert len ( with_dash_o ) = = 0 <nl> assert len ( without_dash_o ) ! = 0 <nl> <nl> def test_truncate_from_0 ( self ) : <nl> <nl> def test_emcc_s_typo ( self ) : <nl> # with suggestions <nl> - out , err = Popen ( [ PYTHON , EMCC , path_from_root ( ' tests ' , ' hello_world . c ' ) , ' - s ' , ' DISABLE_EXCEPTION_CATCH = 1 ' ] , stderr = PIPE ) . communicate ( ) <nl> + err = run_process ( [ PYTHON , EMCC , path_from_root ( ' tests ' , ' hello_world . c ' ) , ' - s ' , ' DISABLE_EXCEPTION_CATCH = 1 ' ] , stderr = PIPE ) . stderr <nl> self . assertContained ( r ' ' ' Assigning a non - existent settings attribute " DISABLE_EXCEPTION_CATCH " ' ' ' , err ) <nl> self . assertContained ( r ' ' ' did you mean one of DISABLE_EXCEPTION_CATCHING ? ' ' ' , err ) <nl> # no suggestions <nl> - out , err = Popen ( [ PYTHON , EMCC , path_from_root ( ' tests ' , ' hello_world . c ' ) , ' - s ' , ' CHEEZ = 1 ' ] , stderr = PIPE ) . communicate ( ) <nl> + err = run_process ( [ PYTHON , EMCC , path_from_root ( ' tests ' , ' hello_world . c ' ) , ' - s ' , ' CHEEZ = 1 ' ] , stderr = PIPE ) . stderr <nl> self . assertContained ( r ' ' ' perhaps a typo in emcc ' s - s X = Y notation ? ' ' ' , err ) <nl> self . assertContained ( r ' ' ' ( see src / settings . js for valid values ) ' ' ' , err ) <nl> <nl> def do_log_test ( source , expected , func ) : <nl> print ( ' log test ' , source , expected ) <nl> try : <nl> os . environ [ ' EMCC_LOG_EMTERPRETER_CODE ' ] = ' 1 ' <nl> - out , err = Popen ( [ PYTHON , EMCC , source , ' - O3 ' , ' - s ' , ' EMTERPRETIFY = 1 ' ] , stderr = PIPE ) . communicate ( ) <nl> + err = run_process ( [ PYTHON , EMCC , source , ' - O3 ' , ' - s ' , ' EMTERPRETIFY = 1 ' ] , stderr = PIPE ) . stderr <nl> finally : <nl> del os . environ [ ' EMCC_LOG_EMTERPRETER_CODE ' ] <nl> lines = err . split ( ' \ n ' ) <nl> def do_log_test ( source , expected , func ) : <nl> do_log_test ( path_from_root ( ' tests ' , ' fannkuch . cpp ' ) , list ( range ( 226 , 235 ) ) , ' __Z15fannkuch_workerPv ' ) <nl> <nl> def test_emterpreter_advise ( self ) : <nl> - out , err = Popen ( [ PYTHON , EMCC , path_from_root ( ' tests ' , ' emterpreter_advise . cpp ' ) , ' - s ' , ' EMTERPRETIFY = 1 ' , ' - s ' , ' EMTERPRETIFY_ASYNC = 1 ' , ' - s ' , ' EMTERPRETIFY_ADVISE = 1 ' ] , stdout = PIPE ) . communicate ( ) <nl> + out = run_process ( [ PYTHON , EMCC , path_from_root ( ' tests ' , ' emterpreter_advise . cpp ' ) , ' - s ' , ' EMTERPRETIFY = 1 ' , ' - s ' , ' EMTERPRETIFY_ASYNC = 1 ' , ' - s ' , ' EMTERPRETIFY_ADVISE = 1 ' ] , stdout = PIPE ) . stdout <nl> self . assertContained ( ' - s EMTERPRETIFY_WHITELIST = \ ' [ " __Z6middlev " , " __Z7sleeperv " , " __Z8recurserv " , " _main " ] \ ' ' , out ) <nl> <nl> - out , err = Popen ( [ PYTHON , EMCC , path_from_root ( ' tests ' , ' emterpreter_advise_funcptr . cpp ' ) , ' - s ' , ' EMTERPRETIFY = 1 ' , ' - s ' , ' EMTERPRETIFY_ASYNC = 1 ' , ' - s ' , ' EMTERPRETIFY_ADVISE = 1 ' ] , stdout = PIPE ) . communicate ( ) <nl> + out = run_process ( [ PYTHON , EMCC , path_from_root ( ' tests ' , ' emterpreter_advise_funcptr . cpp ' ) , ' - s ' , ' EMTERPRETIFY = 1 ' , ' - s ' , ' EMTERPRETIFY_ASYNC = 1 ' , ' - s ' , ' EMTERPRETIFY_ADVISE = 1 ' ] , stdout = PIPE ) . stdout <nl> self . assertContained ( ' - s EMTERPRETIFY_WHITELIST = \ ' [ " __Z4posti " , " __Z5post2i " , " __Z6middlev " , " __Z7sleeperv " , " __Z8recurserv " , " _main " ] \ ' ' , out ) <nl> <nl> def test_link_with_a_static ( self ) : <nl> def test_link_with_bad_o_in_a ( self ) : <nl> def test_require ( self ) : <nl> inname = path_from_root ( ' tests ' , ' hello_world . c ' ) <nl> Building . emcc ( inname , args = [ ' - s ' , ' ASSERTIONS = 0 ' ] , output_filename = ' a . out . js ' ) <nl> - output = Popen ( NODE_JS + [ ' - e ' , ' require ( " . / a . out . js " ) ' ] , stdout = PIPE , stderr = PIPE ) . communicate ( ) <nl> - assert output = = ( ' hello , world ! \ n ' , ' ' ) , ' expected no output , got \ n = = = \ nSTDOUT \ n % s \ n = = = \ nSTDERR \ n % s \ n = = = \ n ' % output <nl> + output = run_process ( NODE_JS + [ ' - e ' , ' require ( " . / a . out . js " ) ' ] , stdout = PIPE , stderr = PIPE ) <nl> + assert output . stdout = = ' hello , world ! \ n ' and output . stderr = = ' ' , ' expected no output , got \ n = = = \ nSTDOUT \ n % s \ n = = = \ nSTDERR \ n % s \ n = = = \ n ' % ( output . stdout , output . stderr ) <nl> <nl> def test_require_modularize ( self ) : <nl> Popen ( [ PYTHON , EMCC , path_from_root ( ' tests ' , ' hello_world . c ' ) , ' - s ' , ' MODULARIZE = 1 ' , ' - s ' , ' ASSERTIONS = 0 ' ] ) . communicate ( ) <nl> src = open ( ' a . out . js ' ) . read ( ) <nl> assert " module [ ' exports ' ] = Module ; " in src <nl> - output = Popen ( NODE_JS + [ ' - e ' , ' var m = require ( " . / a . out . js " ) ; m ( ) ; ' ] , stdout = PIPE , stderr = PIPE ) . communicate ( ) <nl> - assert output = = ( ' hello , world ! \ n ' , ' ' ) , ' expected output , got \ n = = = \ nSTDOUT \ n % s \ n = = = \ nSTDERR \ n % s \ n = = = \ n ' % output <nl> + output = run_process ( NODE_JS + [ ' - e ' , ' var m = require ( " . / a . out . js " ) ; m ( ) ; ' ] , stdout = PIPE , stderr = PIPE ) <nl> + assert output . stdout = = ' hello , world ! \ n ' and output . stderr = = ' ' , ' expected output , got \ n = = = \ nSTDOUT \ n % s \ n = = = \ nSTDERR \ n % s \ n = = = \ n ' % ( output . stdout , output . stderr ) <nl> Popen ( [ PYTHON , EMCC , path_from_root ( ' tests ' , ' hello_world . c ' ) , ' - s ' , ' MODULARIZE = 1 ' , ' - s ' , ' EXPORT_NAME = " NotModule " ' , ' - s ' , ' ASSERTIONS = 0 ' ] ) . communicate ( ) <nl> src = open ( ' a . out . js ' ) . read ( ) <nl> assert " module [ ' exports ' ] = NotModule ; " in src <nl> - output = Popen ( NODE_JS + [ ' - e ' , ' var m = require ( " . / a . out . js " ) ; m ( ) ; ' ] , stdout = PIPE , stderr = PIPE ) . communicate ( ) <nl> - assert output = = ( ' hello , world ! \ n ' , ' ' ) , ' expected output , got \ n = = = \ nSTDOUT \ n % s \ n = = = \ nSTDERR \ n % s \ n = = = \ n ' % output <nl> + output = run_process ( NODE_JS + [ ' - e ' , ' var m = require ( " . / a . out . js " ) ; m ( ) ; ' ] , stdout = PIPE , stderr = PIPE ) <nl> + assert output . stdout = = ' hello , world ! \ n ' and output . stderr = = ' ' , ' expected output , got \ n = = = \ nSTDOUT \ n % s \ n = = = \ nSTDERR \ n % s \ n = = = \ n ' % ( output . stdout , output . stderr ) <nl> Popen ( [ PYTHON , EMCC , path_from_root ( ' tests ' , ' hello_world . c ' ) , ' - s ' , ' MODULARIZE = 1 ' ] ) . communicate ( ) <nl> # We call require ( ) twice to ensure it returns wrapper function each time <nl> - output = Popen ( NODE_JS + [ ' - e ' , ' require ( " . / a . out . js " ) ( ) ; var m = require ( " . / a . out . js " ) ; m ( ) ; ' ] , stdout = PIPE , stderr = PIPE ) . communicate ( ) <nl> - assert output [ 0 ] = = ' hello , world ! \ nhello , world ! \ n ' , ' expected output , got \ n = = = \ nSTDOUT \ n % s \ n = = = \ nSTDERR \ n % s \ n = = = \ n ' % output <nl> + output = run_process ( NODE_JS + [ ' - e ' , ' require ( " . / a . out . js " ) ( ) ; var m = require ( " . / a . out . js " ) ; m ( ) ; ' ] , stdout = PIPE , stderr = PIPE ) <nl> + assert output . stdout = = ' hello , world ! \ nhello , world ! \ n ' , ' expected output , got \ n = = = \ nSTDOUT \ n % s \ n = = = \ nSTDERR \ n % s \ n = = = \ n ' % ( output . stdout , output . stderr ) <nl> <nl> def test_native_optimizer ( self ) : <nl> def test ( args , expected ) : <nl> def test ( args , expected ) : <nl> os . environ [ ' EMCC_DEBUG ' ] = ' 1 ' <nl> os . environ [ ' EMCC_NATIVE_OPTIMIZER ' ] = ' 1 ' <nl> with clean_write_access_to_canonical_temp_dir ( ) : <nl> - out , err = Popen ( [ PYTHON , EMCC , path_from_root ( ' tests ' , ' hello_world . c ' ) , ' - O2 ' , ] + args , stderr = PIPE ) . communicate ( ) <nl> + err = run_process ( [ PYTHON , EMCC , path_from_root ( ' tests ' , ' hello_world . c ' ) , ' - O2 ' , ] + args , stderr = PIPE ) . stderr <nl> finally : <nl> if old_debug : os . environ [ ' EMCC_DEBUG ' ] = old_debug <nl> else : del os . environ [ ' EMCC_DEBUG ' ] <nl> def test ( args , llvm_opts = None ) : <nl> if os . environ . get ( ' EMCC_DEBUG ' ) : return self . skip ( ' cannot run in debug mode ' ) <nl> try : <nl> os . environ [ ' EMCC_DEBUG ' ] = ' 1 ' <nl> - out , err = Popen ( [ PYTHON , EMCC , ' - c ' , main_name , lib_name ] + args , stderr = PIPE ) . communicate ( ) <nl> + err = run_process ( [ PYTHON , EMCC , ' - c ' , main_name , lib_name ] + args , stderr = PIPE ) . stderr <nl> finally : <nl> del os . environ [ ' EMCC_DEBUG ' ] <nl> <nl> def test_emmake_emconfigure ( self ) : <nl> def check ( what , args , fail = True , expect = ' ' ) : <nl> args = [ PYTHON , path_from_root ( what ) ] + args <nl> print ( what , args , fail , expect ) <nl> - out , err = Popen ( args , stdout = PIPE , stderr = PIPE ) . communicate ( ) <nl> - assert ( ' is a helper for ' in err ) = = fail <nl> - assert ( ' Typical usage ' in err ) = = fail <nl> - self . assertContained ( expect , out ) <nl> + output = run_process ( args , stdout = PIPE , stderr = PIPE , check = False ) <nl> + assert ( ' is a helper for ' in output . stderr ) = = fail <nl> + assert ( ' Typical usage ' in output . stderr ) = = fail <nl> + self . assertContained ( expect , output . stdout ) <nl> check ( ' emmake ' , [ ] ) <nl> check ( ' emconfigure ' , [ ] ) <nl> check ( ' emmake ' , [ ' - - version ' ] ) <nl> def test_sdl2_config ( self ) : <nl> [ [ ' - - cflags ' , ' - - libs ' ] , ' - s USE_SDL = 2 ' ] , <nl> ] : <nl> print ( args , expected ) <nl> - out , err = Popen ( [ PYTHON , path_from_root ( ' system ' , ' bin ' , ' sdl2 - config ' ) ] + args , stdout = PIPE , stderr = PIPE ) . communicate ( ) <nl> + out = run_process ( [ PYTHON , path_from_root ( ' system ' , ' bin ' , ' sdl2 - config ' ) ] + args , stdout = PIPE , stderr = PIPE ) . stdout <nl> assert expected in out , out <nl> print ( ' via emmake ' ) <nl> - out , err = Popen ( [ PYTHON , path_from_root ( ' emmake ' ) , ' sdl2 - config ' ] + args , stdout = PIPE , stderr = PIPE ) . communicate ( ) <nl> + out = run_process ( [ PYTHON , path_from_root ( ' emmake ' ) , ' sdl2 - config ' ] + args , stdout = PIPE , stderr = PIPE ) . stdout <nl> assert expected in out , out <nl> <nl> def test_warn_toomany_vars ( self ) : <nl> def test_warn_toomany_vars ( self ) : <nl> for opts in [ 0 , 1 , 2 , ' s ' ] : <nl> print ( source , opts ) <nl> self . clear ( ) <nl> - out , err = Popen ( [ PYTHON , EMCC , source , ' - O ' + str ( opts ) ] , stderr = PIPE ) . communicate ( ) <nl> + err = run_process ( [ PYTHON , EMCC , source , ' - O ' + str ( opts ) ] , stderr = PIPE ) . stderr <nl> assert os . path . exists ( ' a . out . js ' ) <nl> assert ( ' emitted code will contain very large numbers of local variables ' in err ) = = ( warn and ( opts in [ 0 , 1 ] ) ) <nl> <nl> def test_underscore_exit ( self ) : <nl> def test_file_packager_huge ( self ) : <nl> open ( ' huge . dat ' , ' w ' ) . write ( ' a ' * ( 1024 * 1024 * 257 ) ) <nl> open ( ' tiny . dat ' , ' w ' ) . write ( ' a ' ) <nl> - out , err = Popen ( [ PYTHON , FILE_PACKAGER , ' test . data ' , ' - - preload ' , ' tiny . dat ' ] , stdout = PIPE , stderr = PIPE ) . communicate ( ) <nl> + err = run_process ( [ PYTHON , FILE_PACKAGER , ' test . data ' , ' - - preload ' , ' tiny . dat ' ] , stdout = PIPE , stderr = PIPE ) . stderr <nl> assert err = = ' ' , err <nl> - out , err = Popen ( [ PYTHON , FILE_PACKAGER , ' test . data ' , ' - - preload ' , ' huge . dat ' ] , stdout = PIPE , stderr = PIPE ) . communicate ( ) <nl> + err = run_process ( [ PYTHON , FILE_PACKAGER , ' test . data ' , ' - - preload ' , ' huge . dat ' ] , stdout = PIPE , stderr = PIPE ) . stderr <nl> assert ' warning : file packager is creating an asset bundle of 257 MB . this is very large , and browsers might have trouble loading it ' in err , err <nl> self . clear ( ) <nl> <nl> def test_emscripten_print_double ( self ) : <nl> ' ' ' , out ) <nl> <nl> def test_no_warn_exported_jslibfunc ( self ) : <nl> - out , err = Popen ( [ PYTHON , EMCC , path_from_root ( ' tests ' , ' hello_world . c ' ) , ' - s ' , ' DEFAULT_LIBRARY_FUNCS_TO_INCLUDE = [ " alGetError " ] ' , ' - s ' , ' EXPORTED_FUNCTIONS = [ " _main " , " _alGetError " ] ' ] , stdout = PIPE , stderr = PIPE ) . communicate ( ) <nl> + err = run_process ( [ PYTHON , EMCC , path_from_root ( ' tests ' , ' hello_world . c ' ) , ' - s ' , ' DEFAULT_LIBRARY_FUNCS_TO_INCLUDE = [ " alGetError " ] ' , ' - s ' , ' EXPORTED_FUNCTIONS = [ " _main " , " _alGetError " ] ' ] , stdout = PIPE , stderr = PIPE ) . stderr <nl> self . assertNotContained ( ' ' ' function requested to be exported , but not implemented : " _alGetError " ' ' ' , err ) <nl> <nl> def test_almost_asm_warning ( self ) : <nl> def test_almost_asm_warning ( self ) : <nl> # last warning flag should " win " <nl> ( [ ' - O1 ' , ' - s ' , ' ALLOW_MEMORY_GROWTH = 1 ' , ' - Wno - almost - asm ' , ' - Walmost - asm ' ] , True ) ] : <nl> print ( args , expected ) <nl> - proc = Popen ( [ PYTHON , EMCC , path_from_root ( ' tests ' , ' hello_world . c ' ) ] + args , stderr = PIPE ) <nl> - err = proc . communicate ( ) [ 1 ] <nl> - assert proc . returncode is 0 <nl> + err = run_process ( [ PYTHON , EMCC , path_from_root ( ' tests ' , ' hello_world . c ' ) ] + args , stderr = PIPE ) . stderr <nl> assert ( warning in err ) = = expected , err <nl> if not expected : <nl> assert err = = ' ' , err <nl> def test_static_syscalls ( self ) : <nl> <nl> def test_emcc_dev_null ( self ) : <nl> if WINDOWS : return self . skip ( ' posix - only ' ) <nl> - proc = Popen ( [ PYTHON , EMCC , ' - dM ' , ' - E ' , ' - x ' , ' c ' , ' / dev / null ' ] , stdout = PIPE ) <nl> - out , err = proc . communicate ( ) <nl> - assert proc . returncode = = 0 <nl> + out = run_process ( [ PYTHON , EMCC , ' - dM ' , ' - E ' , ' - x ' , ' c ' , ' / dev / null ' ] , stdout = PIPE ) . stdout <nl> self . assertContained ( ' # define __EMSCRIPTEN__ 1 ' , out ) # all our defines should show up <nl> <nl> def test_umask_0 ( self ) : <nl> def test_no_missing_symbols ( self ) : # simple hello world should not show any miss <nl> } ( ) ) , <nl> } ) ; <nl> ' ' ' ) <nl> - proc = Popen ( [ PYTHON , EMCC , ' test . cpp ' , ' - s ' , ' ERROR_ON_UNDEFINED_SYMBOLS = 1 ' , ' - - js - library ' , ' library_foo . js ' ] , stderr = PIPE ) <nl> - out , err = proc . communicate ( ) <nl> - assert proc . returncode ! = 0 <nl> + err = run_process ( [ PYTHON , EMCC , ' test . cpp ' , ' - s ' , ' ERROR_ON_UNDEFINED_SYMBOLS = 1 ' , ' - - js - library ' , ' library_foo . js ' ] , stderr = PIPE , check = False ) . stderr <nl> assert ' unresolved symbol ' in err <nl> <nl> # and also for missing C code , of course ( without the - - js - library , it ' s just a missing C method ) <nl> - proc = Popen ( [ PYTHON , EMCC , ' test . cpp ' , ' - s ' , ' ERROR_ON_UNDEFINED_SYMBOLS = 1 ' ] , stderr = PIPE ) <nl> - out , err = proc . communicate ( ) <nl> - assert proc . returncode ! = 0 <nl> + err = run_process ( [ PYTHON , EMCC , ' test . cpp ' , ' - s ' , ' ERROR_ON_UNDEFINED_SYMBOLS = 1 ' ] , stderr = PIPE , check = False ) . stderr <nl> assert ' unresolved symbol ' in err <nl> <nl> def test_realpath ( self ) : <nl> def test_no_warnings ( self ) : <nl> # build once before to make sure system libs etc . exist <nl> subprocess . check_call ( [ PYTHON , EMCC , path_from_root ( ' tests ' , ' hello_libcxx . cpp ' ) ] ) <nl> # check that there is nothing in stderr for a regular compile <nl> - out , err = Popen ( [ PYTHON , EMCC , path_from_root ( ' tests ' , ' hello_libcxx . cpp ' ) ] , stderr = PIPE ) . communicate ( ) <nl> + err = run_process ( [ PYTHON , EMCC , path_from_root ( ' tests ' , ' hello_libcxx . cpp ' ) ] , stderr = PIPE ) . stderr <nl> assert err = = ' ' , err <nl> <nl> def test_emterpreter_file_suggestion ( self ) : <nl> def test_emterpreter_file_suggestion ( self ) : <nl> if to_file : <nl> cmd + = [ ' - s ' , ' EMTERPRETIFY_FILE = " code . dat " ' ] <nl> print ( cmd ) <nl> - stdout , stderr = Popen ( cmd , stderr = PIPE ) . communicate ( ) <nl> + stderr = run_process ( cmd , stderr = PIPE ) . stderr <nl> need_warning = linkable and not to_file <nl> assert ( ' ' ' warning : emterpreter bytecode is fairly large ' ' ' in stderr ) = = need_warning , stderr <nl> assert ( ' ' ' It is recommended to use - s EMTERPRETIFY_FILE = . . ' ' ' in stderr ) = = need_warning , stderr <nl> def test_zeroinit ( self ) : <nl> <nl> def test_separate_asm_warning ( self ) : <nl> # Test that - s PRECISE_F32 = 2 raises a warning that - - separate - asm is implied . <nl> - stdout , stderr = Popen ( [ PYTHON , EMCC , path_from_root ( ' tests ' , ' hello_world . c ' ) , ' - s ' , ' PRECISE_F32 = 2 ' , ' - o ' , ' a . html ' ] , stderr = PIPE ) . communicate ( ) <nl> + stderr = run_process ( [ PYTHON , EMCC , path_from_root ( ' tests ' , ' hello_world . c ' ) , ' - s ' , ' PRECISE_F32 = 2 ' , ' - o ' , ' a . html ' ] , stderr = PIPE ) . stderr <nl> self . assertContained ( ' forcing separate asm output ' , stderr ) <nl> <nl> # Test that - s PRECISE_F32 = 2 - - separate - asm should not post a warning . <nl> - stdout , stderr = Popen ( [ PYTHON , EMCC , path_from_root ( ' tests ' , ' hello_world . c ' ) , ' - s ' , ' PRECISE_F32 = 2 ' , ' - o ' , ' a . html ' , ' - - separate - asm ' ] , stderr = PIPE ) . communicate ( ) <nl> + stderr = run_process ( [ PYTHON , EMCC , path_from_root ( ' tests ' , ' hello_world . c ' ) , ' - s ' , ' PRECISE_F32 = 2 ' , ' - o ' , ' a . html ' , ' - - separate - asm ' ] , stderr = PIPE ) . stderr <nl> self . assertNotContained ( ' forcing separate asm output ' , stderr ) <nl> <nl> # Test that - s PRECISE_F32 = 1 should not post a warning . <nl> - stdout , stderr = Popen ( [ PYTHON , EMCC , path_from_root ( ' tests ' , ' hello_world . c ' ) , ' - s ' , ' PRECISE_F32 = 1 ' , ' - o ' , ' a . html ' ] , stderr = PIPE ) . communicate ( ) <nl> + stderr = run_process ( [ PYTHON , EMCC , path_from_root ( ' tests ' , ' hello_world . c ' ) , ' - s ' , ' PRECISE_F32 = 1 ' , ' - o ' , ' a . html ' ] , stderr = PIPE ) . stderr <nl> self . assertNotContained ( ' forcing separate asm output ' , stderr ) <nl> <nl> # Manually doing separate asm should show a warning , if not targeting html <nl> warning = ' - - separate - asm works best when compiling to HTML ' <nl> - stdout , stderr = Popen ( [ PYTHON , EMCC , path_from_root ( ' tests ' , ' hello_world . c ' ) , ' - - separate - asm ' ] , stderr = PIPE ) . communicate ( ) <nl> + stderr = run_process ( [ PYTHON , EMCC , path_from_root ( ' tests ' , ' hello_world . c ' ) , ' - - separate - asm ' ] , stderr = PIPE ) . stderr <nl> self . assertContained ( warning , stderr ) <nl> - stdout , stderr = Popen ( [ PYTHON , EMCC , path_from_root ( ' tests ' , ' hello_world . c ' ) , ' - - separate - asm ' , ' - o ' , ' a . html ' ] , stderr = PIPE ) . communicate ( ) <nl> + stderr = run_process ( [ PYTHON , EMCC , path_from_root ( ' tests ' , ' hello_world . c ' ) , ' - - separate - asm ' , ' - o ' , ' a . html ' ] , stderr = PIPE ) . stderr <nl> self . assertNotContained ( warning , stderr ) <nl> <nl> # test that the warning can be suppressed <nl> - stdout , stderr = Popen ( [ PYTHON , EMCC , path_from_root ( ' tests ' , ' hello_world . c ' ) , ' - - separate - asm ' , ' - Wno - separate - asm ' ] , stderr = PIPE ) . communicate ( ) <nl> + stderr = run_process ( [ PYTHON , EMCC , path_from_root ( ' tests ' , ' hello_world . c ' ) , ' - - separate - asm ' , ' - Wno - separate - asm ' ] , stderr = PIPE ) . stderr <nl> self . assertNotContained ( warning , stderr ) <nl> <nl> def test_canonicalize_nan_warning ( self ) : <nl> def test_canonicalize_nan_warning ( self ) : <nl> } <nl> ' ' ' ) <nl> <nl> - stdout , stderr = Popen ( [ PYTHON , EMCC , ' src . cpp ' , ' - O1 ' ] , stderr = PIPE ) . communicate ( ) <nl> + stderr = run_process ( [ PYTHON , EMCC , ' src . cpp ' , ' - O1 ' ] , stderr = PIPE ) . stderr <nl> self . assertContained ( " emcc : warning : cannot represent a NaN literal " , stderr ) <nl> <nl> - stdout , stderr = Popen ( [ PYTHON , EMCC , ' src . cpp ' , ' - O1 ' , ' - g ' ] , stderr = PIPE ) . communicate ( ) <nl> + stderr = run_process ( [ PYTHON , EMCC , ' src . cpp ' , ' - O1 ' , ' - g ' ] , stderr = PIPE ) . stderr <nl> self . assertContained ( " emcc : warning : cannot represent a NaN literal " , stderr ) <nl> self . assertContained ( ' / / @ line 12 " src . cpp " ' , stderr ) <nl> <nl> def test_EM_ASM_i64 ( self ) : <nl> } , int64_t ( 0x12345678ABCDEF1FLL ) ) ; <nl> } <nl> ' ' ' ) <nl> - out , err = Popen ( [ PYTHON , EMCC , ' src . cpp ' , ' - Oz ' ] , stderr = PIPE ) . communicate ( ) <nl> + err = run_process ( [ PYTHON , EMCC , ' src . cpp ' , ' - Oz ' ] , stderr = PIPE ) . stderr <nl> self . assertContained ( ' LLVM ERROR : EM_ASM should not receive i64s as inputs , they are not valid in JS ' , err ) <nl> <nl> def test_eval_ctors ( self ) : <nl> def test ( p1 , p2 , p3 , last , expected ) : <nl> int main ( ) { } <nl> ' ' ' ) <nl> with clean_write_access_to_canonical_temp_dir ( ) : <nl> - out , err = Popen ( [ PYTHON , EMCC , ' src . cpp ' , ' - Oz ' ] , stderr = PIPE ) . communicate ( ) <nl> + err = run_process ( [ PYTHON , EMCC , ' src . cpp ' , ' - Oz ' ] , stderr = PIPE ) . stderr <nl> self . assertContained ( ' ___syscall54 ' , err ) # the failing call should be mentioned <nl> self . assertContained ( ' ctorEval . js ' , err ) # with a stack trace <nl> self . assertContained ( ' ctor_evaller : not successful ' , err ) # with logging <nl> def function_eliminator_test_helper ( self , input_file , expected_output_file , use_ <nl> if use_hash_info : <nl> command . append ( ' - - use - hash - info ' ) <nl> <nl> - output , err = Popen ( NODE_JS + command , stdin = PIPE , stderr = PIPE , stdout = PIPE ) . communicate ( ) <nl> - assert err = = ' ' , err <nl> + proc = run_process ( NODE_JS + command , stdin = PIPE , stderr = PIPE , stdout = PIPE ) <nl> + assert proc . stderr = = ' ' , proc . stderr <nl> expected_output = self . get_file_contents ( expected_output_file ) <nl> - output = self . normalize_line_endings ( output ) <nl> + output = self . normalize_line_endings ( proc . stdout ) <nl> <nl> self . assertIdentical ( expected_output , output ) <nl> <nl> def test_source_file_with_fixed_language_mode ( self ) : <nl> return 0 ; <nl> } <nl> ' ' ' ) <nl> - stdout , stderr = Popen ( [ PYTHON , EMCC , ' - Wall ' , ' - std = c + + 14 ' , ' - x ' , ' c + + ' , ' src_tmp_fixed_lang ' ] , stderr = PIPE ) . communicate ( ) <nl> + stderr = run_process ( [ PYTHON , EMCC , ' - Wall ' , ' - std = c + + 14 ' , ' - x ' , ' c + + ' , ' src_tmp_fixed_lang ' ] , stderr = PIPE ) . stderr <nl> self . assertNotContained ( " Input file has an unknown suffix , don ' t know what to do with it ! " , stderr ) <nl> self . assertNotContained ( " Unknown file suffix when compiling to LLVM bitcode " , stderr ) <nl> self . assertContained ( " Test_source_fixed_lang_hello " , run_js ( ' a . out . js ' ) ) <nl> <nl> - stdout , stderr = Popen ( [ PYTHON , EMCC , ' - Wall ' , ' - std = c + + 14 ' , ' src_tmp_fixed_lang ' ] , stderr = PIPE ) . communicate ( ) <nl> + stderr = run_process ( [ PYTHON , EMCC , ' - Wall ' , ' - std = c + + 14 ' , ' src_tmp_fixed_lang ' ] , stderr = PIPE , check = False ) . stderr <nl> self . assertContained ( " Input file has an unknown suffix , don ' t know what to do with it ! " , stderr ) <nl> <nl> def test_disable_inlining ( self ) : <nl> def test_binaryen_opts ( self ) : <nl> try_delete ( ' a . out . wast ' ) <nl> cmd = [ PYTHON , EMCC , path_from_root ( ' tests ' , ' core ' , ' test_i64 . c ' ) , ' - s ' , option + ' = 1 ' , ' - s ' , ' BINARYEN_METHOD = " interpret - s - expr " ' ] + args <nl> print ( args , ' js opts : ' , expect_js_opts , ' only - wasm : ' , expect_only_wasm , ' ' , ' ' . join ( cmd ) ) <nl> - proc = Popen ( cmd , stdout = PIPE , stderr = PIPE ) <nl> - output , err = proc . communicate ( ) <nl> - assert proc . returncode = = 0 <nl> + err = run_process ( cmd , stdout = PIPE , stderr = PIPE ) . stderr <nl> assert expect_js_opts = = ( ' applying js optimization passes : ' in err ) , err <nl> assert expect_only_wasm = = ( ' - emscripten - only - wasm ' in err and ' - - wasm - only ' in err ) , err # check both flag to fastcomp and to asm2wasm <nl> wast = open ( ' a . out . wast ' ) . read ( ) <nl> def test_binaryen_and_precise_f32 ( self ) : <nl> print ( args , expect ) <nl> try_delete ( ' a . out . js ' ) <nl> with clean_write_access_to_canonical_temp_dir ( ) : <nl> - output , err = Popen ( [ PYTHON , EMCC , path_from_root ( ' tests ' , ' hello_world . cpp ' ) , ' - s ' , ' BINARYEN = 1 ' , ' - s ' , ' BINARYEN_METHOD = " interpret - binary " ' ] + args , stdout = PIPE , stderr = PIPE ) . communicate ( ) <nl> + err = run_process ( [ PYTHON , EMCC , path_from_root ( ' tests ' , ' hello_world . cpp ' ) , ' - s ' , ' BINARYEN = 1 ' , ' - s ' , ' BINARYEN_METHOD = " interpret - binary " ' ] + args , stdout = PIPE , stderr = PIPE ) . stderr <nl> assert expect = = ( ' - emscripten - precise - f32 ' in err ) , err <nl> self . assertContained ( ' hello , world ! ' , run_js ( ' a . out . js ' ) ) <nl> finally : <nl> def test_binaryen_warn_sync ( self ) : <nl> if method is not None : <nl> cmd + = [ ' - s ' , ' BINARYEN_METHOD = " ' + method + ' " ' ] <nl> print ( ' ' . join ( cmd ) ) <nl> - proc = Popen ( cmd , stdout = PIPE , stderr = PIPE ) <nl> - out , err = proc . communicate ( ) <nl> + err = run_process ( cmd , stdout = PIPE , stderr = PIPE ) . stderr <nl> print ( err ) <nl> warning = ' BINARYEN_ASYNC_COMPILATION disabled due to user options . This will reduce performance and compatibility ' <nl> if method and ' , ' in method : <nl> def test_binaryen_mem ( self ) : <nl> def test_binaryen_invalid_mem ( self ) : <nl> ret = subprocess . check_call ( [ PYTHON , EMCC , path_from_root ( ' tests ' , ' hello_world . c ' ) , ' - s ' , ' WASM = 1 ' , ' - s ' , ' TOTAL_MEMORY = 33MB ' ] ) <nl> <nl> - ret = subprocess . Popen ( [ PYTHON , EMCC , path_from_root ( ' tests ' , ' hello_world . c ' ) , ' - s ' , ' WASM = 1 ' , ' - s ' , ' TOTAL_MEMORY = 32MB + 1 ' ] , stderr = subprocess . PIPE ) . communicate ( ) [ 1 ] <nl> + ret = run_process ( [ PYTHON , EMCC , path_from_root ( ' tests ' , ' hello_world . c ' ) , ' - s ' , ' WASM = 1 ' , ' - s ' , ' TOTAL_MEMORY = 32MB + 1 ' ] , stderr = subprocess . PIPE , check = False ) . stderr <nl> assert ' TOTAL_MEMORY must be a multiple of 64KB ' in ret , ret <nl> <nl> ret = subprocess . check_call ( [ PYTHON , EMCC , path_from_root ( ' tests ' , ' hello_world . c ' ) , ' - s ' , ' TOTAL_MEMORY = 32MB ' ] ) <nl> <nl> - ret = subprocess . Popen ( [ PYTHON , EMCC , path_from_root ( ' tests ' , ' hello_world . c ' ) , ' - s ' , ' TOTAL_MEMORY = 33MB ' ] , stderr = subprocess . PIPE ) . communicate ( ) [ 1 ] <nl> + ret = run_process ( [ PYTHON , EMCC , path_from_root ( ' tests ' , ' hello_world . c ' ) , ' - s ' , ' TOTAL_MEMORY = 33MB ' ] , stderr = subprocess . PIPE , check = False ) . stderr <nl> assert ' TOTAL_MEMORY must be a multiple of 16MB ' in ret , ret <nl> <nl> - ret = subprocess . Popen ( [ PYTHON , EMCC , path_from_root ( ' tests ' , ' hello_world . c ' ) , ' - s ' , ' WASM_MEM_MAX = 33MB ' ] , stderr = subprocess . PIPE ) . communicate ( ) [ 1 ] <nl> + ret = run_process ( [ PYTHON , EMCC , path_from_root ( ' tests ' , ' hello_world . c ' ) , ' - s ' , ' WASM_MEM_MAX = 33MB ' ] , stderr = subprocess . PIPE , check = False ) . stderr <nl> assert ' WASM_MEM_MAX must be a multiple of 64KB ' not in ret , ret <nl> <nl> - ret = subprocess . Popen ( [ PYTHON , EMCC , path_from_root ( ' tests ' , ' hello_world . c ' ) , ' - s ' , ' WASM_MEM_MAX = 33MB + 1 ' ] , stderr = subprocess . PIPE ) . communicate ( ) [ 1 ] <nl> + ret = run_process ( [ PYTHON , EMCC , path_from_root ( ' tests ' , ' hello_world . c ' ) , ' - s ' , ' WASM_MEM_MAX = 33MB + 1 ' ] , stderr = subprocess . PIPE , check = False ) . stderr <nl> assert ' WASM_MEM_MAX must be a multiple of 64KB ' in ret , ret <nl> <nl> def test_binaryen_ctors ( self ) : <nl> def test_binaryen_debug ( self ) : <nl> try_delete ( ' a . out . wast ' ) <nl> cmd = [ PYTHON , EMCC , path_from_root ( ' tests ' , ' hello_world . cpp ' ) , ' - s ' , ' WASM = 1 ' ] + args <nl> print ( ' ' . join ( cmd ) ) <nl> - proc = Popen ( cmd , stdout = PIPE , stderr = PIPE ) <nl> - output , err = proc . communicate ( ) <nl> - assert proc . returncode = = 0 <nl> + err = run_process ( cmd , stdout = PIPE , stderr = PIPE ) . stderr <nl> asm2wasm_line = [ x for x in err . split ( ' \ n ' ) if ' asm2wasm ' in x ] [ 0 ] <nl> asm2wasm_line = asm2wasm_line . strip ( ) + ' ' # ensure it ends with a space , for simpler searches below <nl> print ( ' | ' + asm2wasm_line + ' | ' ) <nl> def test_binaryen_ignore_implicit_traps ( self ) : <nl> print ( args , expect ) <nl> cmd = [ PYTHON , EMCC , path_from_root ( ' tests ' , ' hello_libcxx . cpp ' ) , ' - s ' , ' WASM = 1 ' , ' - O3 ' ] + args <nl> print ( ' ' . join ( cmd ) ) <nl> - output , err = Popen ( cmd , stdout = PIPE , stderr = PIPE ) . communicate ( ) <nl> + err = run_process ( cmd , stdout = PIPE , stderr = PIPE ) . stderr <nl> asm2wasm_line = [ x for x in err . split ( ' \ n ' ) if ' asm2wasm ' in x ] [ 0 ] <nl> asm2wasm_line = asm2wasm_line . strip ( ) + ' ' # ensure it ends with a space , for simpler searches below <nl> print ( ' | ' + asm2wasm_line + ' | ' ) <nl> def break_cashew ( ) : <nl> try_delete ( ' a . wasm . wasm ' ) <nl> else : <nl> raise Exception ( ' internal test error ' ) <nl> - proc = subprocess . Popen ( NODE_JS + [ ' a . wasm . js ' ] , stdout = subprocess . PIPE , stderr = subprocess . PIPE ) <nl> - out , err = proc . communicate ( ) <nl> + proc = run_process ( NODE_JS + [ ' a . wasm . js ' ] , stdout = subprocess . PIPE , stderr = subprocess . PIPE , check = success ) <nl> if success : <nl> - assert proc . returncode = = 0 , err <nl> - assert ' hello , world ! ' in out , out <nl> + assert ' hello , world ! ' in proc . stdout , proc . stdout <nl> else : <nl> - assert proc . returncode ! = 0 , err <nl> - assert ' hello , world ! ' not in out , out <nl> + assert proc . returncode ! = 0 , proc . stderr <nl> + assert ' hello , world ! ' not in proc . stdout , proc . stdout <nl> <nl> def test_binaryen_metadce ( self ) : <nl> sizes = { } <nl> def test_sysconf_phys_pages ( self ) : <nl> <nl> def test_wasm_targets ( self ) : <nl> for f in [ ' a . wasm ' , ' a . wast ' ] : <nl> - process = Popen ( [ PYTHON , EMCC , path_from_root ( ' tests ' , ' hello_world . cpp ' ) , ' - o ' , f ] , stdout = PIPE , stderr = PIPE ) <nl> - out , err = process . communicate ( ) <nl> - print ( err ) <nl> + process = run_process ( [ PYTHON , EMCC , path_from_root ( ' tests ' , ' hello_world . cpp ' ) , ' - o ' , f ] , stdout = PIPE , stderr = PIPE , check = False ) <nl> + print ( process . stderr ) <nl> assert process . returncode is not 0 , ' wasm suffix is an error ' <nl> - self . assertContained ( ' ' ' output file " % s " has a wasm suffix , but we cannot emit wasm by itself , except as a dynamic library ' ' ' % f , err ) <nl> + self . assertContained ( ' ' ' output file " % s " has a wasm suffix , but we cannot emit wasm by itself , except as a dynamic library ' ' ' % f , process . stderr ) <nl> # side modules do allow a wasm target <nl> for opts , target in [ ( [ ] , ' a . out . wasm ' ) , ( [ ' - o ' , ' lib . wasm ' ] , ' lib . wasm ' ) ] : <nl> # specified target <nl> def test_error_on_missing_libraries ( self ) : <nl> def test_native_link_error_message ( self ) : <nl> Popen ( [ CLANG , ' - c ' , path_from_root ( ' tests ' , ' hello_world . c ' ) , ' - o ' , ' hello_world . o ' ] + get_clang_native_args ( ) , env = get_clang_native_env ( ) , stdout = PIPE , stderr = PIPE ) . communicate ( ) <nl> Popen ( [ LLVM_AR , ' r ' , ' hello_world . a ' , ' hello_world . o ' ] , env = get_clang_native_env ( ) , stdout = PIPE , stderr = PIPE ) . communicate ( ) <nl> - out , err = Popen ( [ PYTHON , EMCC , ' hello_world . a ' , ' - o ' , ' hello_world . js ' ] , stdout = PIPE , stderr = PIPE ) . communicate ( ) <nl> + err = run_process ( [ PYTHON , EMCC , ' hello_world . a ' , ' - o ' , ' hello_world . js ' ] , stdout = PIPE , stderr = PIPE ) . stderr <nl> assert ' exists but was not an LLVM bitcode file suitable for Emscripten . Perhaps accidentally mixing native built object files with Emscripten ? ' in err <nl> <nl> def test_o_level_clamp ( self ) : <nl> for level in [ 3 , 4 , 20 ] : <nl> - out , err = Popen ( [ PYTHON , EMCC , ' - O ' + str ( level ) , path_from_root ( ' tests ' , ' hello_world . c ' ) ] , stdout = PIPE , stderr = PIPE ) . communicate ( ) <nl> + err = run_process ( [ PYTHON , EMCC , ' - O ' + str ( level ) , path_from_root ( ' tests ' , ' hello_world . c ' ) ] , stdout = PIPE , stderr = PIPE ) . stderr <nl> assert os . path . exists ( ' a . out . js ' ) , ' - O ' + str ( level ) + ' should produce output ' <nl> if level > 3 : <nl> self . assertContained ( " optimization level ' - O " + str ( level ) + " ' is not supported ; using ' - O3 ' instead " , err ) <nl> def test_emar_M ( self ) : <nl> open ( ' file2 ' , ' w ' ) . write ( ' ' ) <nl> subprocess . call ( [ PYTHON , EMAR , ' cr ' , ' file1 . a ' , ' file1 ' ] ) <nl> subprocess . call ( [ PYTHON , EMAR , ' cr ' , ' file2 . a ' , ' file2 ' ] ) <nl> - emar = subprocess . Popen ( [ PYTHON , EMAR , ' - M ' ] , stdin = PIPE ) <nl> - emar . communicate ( ' ' ' create combined . a <nl> + emar = run_process ( [ PYTHON , EMAR , ' - M ' ] , input = ' ' ' create combined . a <nl> addlib file1 . a <nl> addlib file2 . a <nl> save <nl> end <nl> ' ' ' ) <nl> - result = subprocess . check_output ( [ PYTHON , EMAR , ' t ' , ' combined . a ' ] ) <nl> + result = run_process ( [ PYTHON , EMAR , ' t ' , ' combined . a ' ] , stdout = PIPE ) . stdout <nl> assert ' file1 ' in result <nl> assert ' file2 ' in result <nl> <nl> mmm a / tools / shared . py <nl> ppp b / tools / shared . py <nl> def __init__ ( self , returncode , cmd , output = None , stderr = None ) : <nl> <nl> # https : / / docs . python . org / 3 / library / subprocess . html # subprocess . CompletedProcess <nl> class Py2CompletedProcess : <nl> - def __init__ ( self , process , args ) : <nl> - ( self . stdout , self . stderr ) = process . communicate ( ) <nl> + def __init__ ( self , args , returncode , stdout , stderr ) : <nl> self . args = args <nl> - self . returncode = process . returncode <nl> + self . returncode = returncode <nl> + self . stdout = stdout <nl> + self . stderr = stderr <nl> <nl> def __repr__ ( self ) : <nl> _repr = [ ' args = % s , returncode = % s ' % ( self . args , self . returncode ) ] <nl> if self . stdout is not None : <nl> - _repr + = ' stdout = ' + self . stdout <nl> + _repr + = ' stdout = ' + repr ( self . stdout ) <nl> if self . stderr is not None : <nl> - _repr + = ' stderr = ' + self . stderr <nl> + _repr + = ' stderr = ' + repr ( self . stderr ) <nl> return ' CompletedProcess ( % s ) ' % ' , ' . join ( _repr ) <nl> <nl> def check_returncode ( self ) : <nl> if self . returncode is not 0 : <nl> raise Py2CalledProcessError ( returncode = self . returncode , cmd = self . args , output = self . stdout , stderr = self . stderr ) <nl> <nl> - def run_base ( cmd , check = False , * args , * * kw ) : <nl> + def run_base ( cmd , check = False , input = None , * args , * * kw ) : <nl> if hasattr ( subprocess , " run " ) : <nl> - return subprocess . run ( cmd , check = check , * args , * * kw ) <nl> + return subprocess . run ( cmd , check = check , input = input , * args , * * kw ) <nl> <nl> # Python 2 compatibility : Introduce Python 3 subprocess . run - like behavior <nl> - result = Py2CompletedProcess ( Popen ( cmd , * args , * * kw ) , cmd ) <nl> + if input is not None : <nl> + kw [ ' stdin ' ] = subprocess . PIPE <nl> + proc = Popen ( cmd , * args , * * kw ) <nl> + stdout , stderr = proc . communicate ( input ) <nl> + result = Py2CompletedProcess ( cmd , proc . returncode , stdout , stderr ) <nl> if check : <nl> result . check_returncode ( ) <nl> return result <nl>
Python 3 compatibility : Use run_process in tests ( )
emscripten-core/emscripten
1a43499f7a13a5255a9652561ec77cf581687738
2017-12-18T23:58:38Z
new file mode 100644 <nl> index 000000000000 . . b99f4bb7db7a <nl> mmm / dev / null <nl> ppp b / validation - test / compiler_crashers / 28476 - anonymous - namespace - verifier - walktodeclpost - swift - decl . swift <nl> <nl> + / / This source file is part of the Swift . org open source project <nl> + / / Copyright ( c ) 2014 - 2016 Apple Inc . and the Swift project authors <nl> + / / Licensed under Apache License v2 . 0 with Runtime Library Exception <nl> + / / <nl> + / / See http : / / swift . org / LICENSE . txt for license information <nl> + / / See http : / / swift . org / CONTRIBUTORS . txt for the list of Swift project authors <nl> + <nl> + / / RUN : not - - crash % target - swift - frontend % s - emit - ir <nl> + protocol a : A protocol A : A { struct B { var e = triC : protocol A : a { class A : A { func < <nl>
Merge pull request from practicalswift / swiftc - 28476 - anonymous - namespace - verifier - walktodeclpost - swift - decl
apple/swift
2325b0649ed27ec7d12ede13b8daca766a23a6dd
2016-11-07T15:20:13Z
mmm a / include / swift / Basic / Demangler . h <nl> ppp b / include / swift / Basic / Demangler . h <nl> class Demangler { <nl> NodePointer demangleGenericRequirement ( ) ; <nl> NodePointer demangleGenericType ( ) ; <nl> NodePointer demangleValueWitness ( ) ; <nl> + <nl> + NodePointer demangleObjCTypeName ( ) ; <nl> } ; <nl> <nl> } / / end namespace NewMangling <nl> mmm a / lib / Basic / Demangler . cpp <nl> ppp b / lib / Basic / Demangler . cpp <nl> namespace NewMangling { <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> <nl> NodePointer Demangler : : demangleTopLevel ( ) { <nl> + <nl> + if ( nextIf ( " _Tt " ) ) <nl> + return demangleObjCTypeName ( ) ; <nl> + <nl> if ( ! nextIf ( MANGLING_PREFIX_STR ) ) <nl> return nullptr ; <nl> <nl> NodePointer Demangler : : demangleIdentifier ( ) { <nl> return nullptr ; <nl> if ( isPunycoded ) <nl> nextIf ( ' _ ' ) ; <nl> - if ( Pos + numChars > = Text . size ( ) ) <nl> + if ( Pos + numChars > Text . size ( ) ) <nl> return nullptr ; <nl> StringRef Slice = StringRef ( Text . data ( ) + Pos , numChars ) ; <nl> if ( isPunycoded ) { <nl> NodePointer Demangler : : demangleValueWitness ( ) { <nl> return addChild ( VW , popNode ( Node : : Kind : : Type ) ) ; <nl> } <nl> <nl> + NodePointer Demangler : : demangleObjCTypeName ( ) { <nl> + NodePointer Ty = NodeFactory : : create ( Node : : Kind : : Type ) ; <nl> + NodePointer Global = addChild ( NodeFactory : : create ( Node : : Kind : : Global ) , <nl> + addChild ( NodeFactory : : create ( Node : : Kind : : TypeMangling ) , <nl> + Ty ) ) ; <nl> + NodePointer Nominal ; <nl> + bool isProto = false ; <nl> + if ( nextIf ( ' C ' ) ) { <nl> + Nominal = NodeFactory : : create ( Node : : Kind : : Class ) ; <nl> + addChild ( Ty , Nominal ) ; <nl> + } else if ( nextIf ( ' P ' ) ) { <nl> + isProto = true ; <nl> + Nominal = NodeFactory : : create ( Node : : Kind : : Protocol ) ; <nl> + addChild ( Ty , addChild ( NodeFactory : : create ( Node : : Kind : : ProtocolList ) , <nl> + addChild ( NodeFactory : : create ( Node : : Kind : : TypeList ) , <nl> + addChild ( NodeFactory : : create ( Node : : Kind : : Type ) , <nl> + Nominal ) ) ) ) ; <nl> + } else { <nl> + return nullptr ; <nl> + } <nl> + <nl> + NodePointer Ident = demangleIdentifier ( ) ; <nl> + if ( ! Ident ) <nl> + return nullptr ; <nl> + Nominal - > addChild ( changeKind ( Ident , Node : : Kind : : Module ) ) ; <nl> + <nl> + Ident = demangleIdentifier ( ) ; <nl> + if ( ! Ident ) <nl> + return nullptr ; <nl> + Nominal - > addChild ( Ident ) ; <nl> + <nl> + if ( isProto & & ! nextIf ( ' _ ' ) ) <nl> + return nullptr ; <nl> + <nl> + if ( Pos < Text . size ( ) ) <nl> + return nullptr ; <nl> + <nl> + return Global ; <nl> + } <nl> + <nl> } / / end namespace NewMangling <nl> } / / end namespace swift <nl> <nl>
Let the demangler handle old - style mangled ObjC runtime type names .
apple/swift
2df8d5e8ade00d88846f31476751b081d4f21d43
2017-02-17T02:20:05Z
mmm a / src / apps / EventViewer / Resources / MainMenu . xib <nl> ppp b / src / apps / EventViewer / Resources / MainMenu . xib <nl> <nl> < ? xml version = " 1 . 0 " encoding = " UTF - 8 " ? > <nl> < document type = " com . apple . InterfaceBuilder3 . Cocoa . XIB " version = " 3 . 0 " toolsVersion = " 14313 . 18 " targetRuntime = " MacOSX . Cocoa " propertyAccessControl = " none " useAutolayout = " YES " > <nl> < dependencies > <nl> + < deployment identifier = " macosx " / > <nl> < plugIn identifier = " com . apple . InterfaceBuilder . CocoaPlugin " version = " 14313 . 18 " / > <nl> < capability name = " documents saved in the Xcode 8 format " minToolsVersion = " 8 . 0 " / > <nl> < / dependencies > <nl> <nl> < / menuItem > <nl> < / items > <nl> < / menu > <nl> - < window title = " EventViewer " allowsToolTipsWhenApplicationIsInactive = " NO " autorecalculatesKeyViewLoop = " NO " releasedWhenClosed = " NO " animationBehavior = " default " id = " 371 " > <nl> + < window title = " EventViewer " allowsToolTipsWhenApplicationIsInactive = " NO " autorecalculatesKeyViewLoop = " NO " releasedWhenClosed = " NO " appearanceType = " aqua " animationBehavior = " default " id = " 371 " > <nl> < windowStyleMask key = " styleMask " titled = " YES " closable = " YES " resizable = " YES " / > <nl> < windowPositionMask key = " initialPositionMask " leftStrut = " YES " rightStrut = " YES " topStrut = " YES " bottomStrut = " YES " / > <nl> < rect key = " contentRect " x = " 335 " y = " 122 " width = " 874 " height = " 550 " / > <nl> - < rect key = " screenRect " x = " 0 . 0 " y = " 0 . 0 " width = " 1920 " height = " 1178 " / > <nl> + < rect key = " screenRect " x = " 0 . 0 " y = " 0 . 0 " width = " 1920 " height = " 1177 " / > <nl> < value key = " minSize " type = " size " width = " 874 " height = " 550 " / > <nl> < view key = " contentView " wantsLayer = " YES " id = " 372 " > <nl> < rect key = " frame " x = " 0 . 0 " y = " 0 . 0 " width = " 874 " height = " 550 " / > <nl> <nl> < autoresizingMask key = " autoresizingMask " widthSizable = " YES " heightSizable = " YES " / > <nl> < subviews > <nl> < box borderType = " line " title = " Keyboard & amp ; Pointing events " translatesAutoresizingMaskIntoConstraints = " NO " id = " 614 " > <nl> - < rect key = " frame " x = " 14 " y = " 197 " width = " 806 " height = " 286 " / > <nl> + < rect key = " frame " x = " 14 " y = " 198 " width = " 806 " height = " 285 " / > <nl> < view key = " contentView " id = " pJS - 41 - sBt " > <nl> - < rect key = " frame " x = " 1 " y = " 1 " width = " 804 " height = " 270 " / > <nl> + < rect key = " frame " x = " 3 " y = " 3 " width = " 800 " height = " 267 " / > <nl> < autoresizingMask key = " autoresizingMask " widthSizable = " YES " heightSizable = " YES " / > <nl> < subviews > <nl> < button verticalHuggingPriority = " 750 " translatesAutoresizingMaskIntoConstraints = " NO " id = " 541 " > <nl> - < rect key = " frame " x = " 11 " y = " 232 " width = " 158 " height = " 32 " / > <nl> + < rect key = " frame " x = " 11 " y = " 229 " width = " 158 " height = " 32 " / > <nl> < buttonCell key = " cell " type = " push " title = " copy to pasteboard " bezelStyle = " rounded " alignment = " center " refusesFirstResponder = " YES " borderStyle = " border " imageScaling = " proportionallyDown " inset = " 2 " id = " 542 " > <nl> < behavior key = " behavior " pushIn = " YES " lightByBackground = " YES " lightByGray = " YES " / > <nl> < font key = " font " metaFont = " system " / > <nl> <nl> < / connections > <nl> < / button > <nl> < button verticalHuggingPriority = " 750 " translatesAutoresizingMaskIntoConstraints = " NO " id = " 539 " > <nl> - < rect key = " frame " x = " 167 " y = " 232 " width = " 131 " height = " 32 " / > <nl> + < rect key = " frame " x = " 167 " y = " 229 " width = " 131 " height = " 32 " / > <nl> < buttonCell key = " cell " type = " push " title = " clear the result " bezelStyle = " rounded " alignment = " center " refusesFirstResponder = " YES " borderStyle = " border " imageScaling = " proportionallyDown " inset = " 2 " id = " 540 " > <nl> < behavior key = " behavior " pushIn = " YES " lightByBackground = " YES " lightByGray = " YES " / > <nl> < font key = " font " metaFont = " system " / > <nl> <nl> < / connections > <nl> < / button > <nl> < scrollView horizontalLineScroll = " 16 " horizontalPageScroll = " 10 " verticalLineScroll = " 16 " verticalPageScroll = " 10 " hasHorizontalScroller = " NO " usesPredominantAxisScrolling = " NO " translatesAutoresizingMaskIntoConstraints = " NO " id = " 561 " > <nl> - < rect key = " frame " x = " 17 " y = " 10 " width = " 770 " height = " 219 " / > <nl> - < clipView key = " contentView " id = " OS0 - 60 - iDz " > <nl> - < rect key = " frame " x = " 1 " y = " 0 . 0 " width = " 753 " height = " 218 " / > <nl> - < autoresizingMask key = " autoresizingMask " / > <nl> + < rect key = " frame " x = " 17 " y = " 10 " width = " 766 " height = " 216 " / > <nl> + < clipView key = " contentView " drawsBackground = " NO " id = " OS0 - 60 - iDz " > <nl> + < rect key = " frame " x = " 1 " y = " 0 . 0 " width = " 749 " height = " 215 " / > <nl> + < autoresizingMask key = " autoresizingMask " widthSizable = " YES " heightSizable = " YES " / > <nl> < subviews > <nl> < tableView focusRingType = " none " verticalHuggingPriority = " 750 " allowsExpansionToolTips = " YES " columnAutoresizingStyle = " lastColumnOnly " alternatingRowBackgroundColors = " YES " columnReordering = " NO " columnResizing = " NO " multipleSelection = " NO " autosaveColumns = " NO " typeSelect = " NO " enabled = " NO " rowHeight = " 14 " headerView = " 565 " id = " 564 " > <nl> - < rect key = " frame " x = " 0 . 0 " y = " 0 . 0 " width = " 753 " height = " 195 " / > <nl> + < rect key = " frame " x = " 0 . 0 " y = " 0 . 0 " width = " 749 " height = " 192 " / > <nl> < autoresizingMask key = " autoresizingMask " / > <nl> < size key = " intercellSpacing " width = " 3 " height = " 2 " / > <nl> < color key = " backgroundColor " name = " controlBackgroundColor " catalog = " System " colorSpace = " catalog " / > <nl> <nl> < color key = " backgroundColor " name = " controlBackgroundColor " catalog = " System " colorSpace = " catalog " / > <nl> < / textFieldCell > <nl> < / tableColumn > <nl> - < tableColumn identifier = " misc " editable = " NO " width = " 410 " minWidth = " 10 " maxWidth = " 3 . 4028234663852886e + 38 " id = " 585 " > <nl> + < tableColumn identifier = " misc " editable = " NO " width = " 407 " minWidth = " 10 " maxWidth = " 3 . 4028234663852886e + 38 " id = " 585 " > <nl> < tableHeaderCell key = " headerCell " lineBreakMode = " truncatingTail " enabled = " NO " borderStyle = " border " alignment = " left " title = " misc " > <nl> < font key = " font " metaFont = " smallSystem " / > <nl> < color key = " textColor " name = " headerTextColor " catalog = " System " colorSpace = " catalog " / > <nl> <nl> < / connections > <nl> < / tableView > <nl> < / subviews > <nl> - < color key = " backgroundColor " white = " 1 " alpha = " 1 " colorSpace = " calibratedWhite " / > <nl> + < nil key = " backgroundColor " / > <nl> < / clipView > <nl> < scroller key = " horizontalScroller " hidden = " YES " verticalHuggingPriority = " 750 " horizontal = " YES " id = " 563 " > <nl> < rect key = " frame " x = " - 100 " y = " - 100 " width = " 785 " height = " 15 " / > <nl> < autoresizingMask key = " autoresizingMask " / > <nl> < / scroller > <nl> < scroller key = " verticalScroller " verticalHuggingPriority = " 750 " horizontal = " NO " id = " 562 " > <nl> - < rect key = " frame " x = " 754 " y = " 23 " width = " 15 " height = " 195 " / > <nl> + < rect key = " frame " x = " 750 " y = " 23 " width = " 15 " height = " 192 " / > <nl> < autoresizingMask key = " autoresizingMask " / > <nl> < / scroller > <nl> < tableHeaderView key = " headerView " autoresizesSubviews = " NO " focusRingType = " none " id = " 565 " > <nl> - < rect key = " frame " x = " 0 . 0 " y = " 0 . 0 " width = " 753 " height = " 23 " / > <nl> + < rect key = " frame " x = " 0 . 0 " y = " 0 . 0 " width = " 749 " height = " 23 " / > <nl> < autoresizingMask key = " autoresizingMask " / > <nl> < / tableHeaderView > <nl> < / scrollView > <nl> < button verticalHuggingPriority = " 750 " translatesAutoresizingMaskIntoConstraints = " NO " id = " e5W - WO - Kah " > <nl> - < rect key = " frame " x = " 712 " y = " 232 " width = " 81 " height = " 32 " / > <nl> + < rect key = " frame " x = " 708 " y = " 229 " width = " 81 " height = " 32 " / > <nl> < buttonCell key = " cell " type = " push " title = " Button " bezelStyle = " rounded " alignment = " center " borderStyle = " border " imageScaling = " proportionallyDown " inset = " 2 " id = " ShI - z6 - Eh3 " > <nl> < behavior key = " behavior " pushIn = " YES " lightByBackground = " YES " lightByGray = " YES " / > <nl> < font key = " font " metaFont = " system " / > <nl> <nl> < / view > <nl> < / box > <nl> < box title = " Input Area " translatesAutoresizingMaskIntoConstraints = " NO " id = " HuX - nl - e5r " > <nl> - < rect key = " frame " x = " 14 " y = " 6 " width = " 806 " height = " 165 " / > <nl> + < rect key = " frame " x = " 14 " y = " 6 " width = " 806 " height = " 166 " / > <nl> < view key = " contentView " id = " dbf - S3 - bPS " > <nl> - < rect key = " frame " x = " 2 " y = " 2 " width = " 802 " height = " 148 " / > <nl> + < rect key = " frame " x = " 3 " y = " 3 " width = " 800 " height = " 148 " / > <nl> < autoresizingMask key = " autoresizingMask " widthSizable = " YES " heightSizable = " YES " / > <nl> < subviews > <nl> < textField horizontalHuggingPriority = " 251 " verticalHuggingPriority = " 750 " translatesAutoresizingMaskIntoConstraints = " NO " id = " ITd - Nj - Y8H " > <nl> <nl> < / textFieldCell > <nl> < / textField > <nl> < scrollView horizontalLineScroll = " 10 " horizontalPageScroll = " 10 " verticalLineScroll = " 10 " verticalPageScroll = " 10 " hasHorizontalScroller = " NO " usesPredominantAxisScrolling = " NO " translatesAutoresizingMaskIntoConstraints = " NO " id = " Ko0 - IW - 1A7 " > <nl> - < rect key = " frame " x = " 10 " y = " 10 " width = " 644 " height = " 111 " / > <nl> + < rect key = " frame " x = " 10 " y = " 10 " width = " 642 " height = " 111 " / > <nl> < clipView key = " contentView " drawsBackground = " NO " id = " Hx6 - 3h - z4E " > <nl> - < rect key = " frame " x = " 1 " y = " 1 " width = " 627 " height = " 109 " / > <nl> - < autoresizingMask key = " autoresizingMask " / > <nl> + < rect key = " frame " x = " 1 " y = " 1 " width = " 625 " height = " 109 " / > <nl> + < autoresizingMask key = " autoresizingMask " widthSizable = " YES " heightSizable = " YES " / > <nl> < subviews > <nl> < textView importsGraphics = " NO " verticallyResizable = " YES " baseWritingDirection = " leftToRight " usesFontPanel = " YES " findStyle = " panel " allowsUndo = " YES " usesRuler = " YES " allowsNonContiguousLayout = " YES " smartInsertDelete = " YES " id = " A4A - YB - ifF " > <nl> - < rect key = " frame " x = " 0 . 0 " y = " 0 . 0 " width = " 627 " height = " 109 " / > <nl> + < rect key = " frame " x = " 0 . 0 " y = " 0 . 0 " width = " 625 " height = " 109 " / > <nl> < autoresizingMask key = " autoresizingMask " widthSizable = " YES " heightSizable = " YES " / > <nl> < color key = " textColor " red = " 0 . 13333333333333333 " green = " 0 . 13333333333333333 " blue = " 0 . 13333333333333333 " alpha = " 1 " colorSpace = " custom " customColorSpace = " sRGB " / > <nl> < color key = " backgroundColor " name = " textBackgroundColor " catalog = " System " colorSpace = " catalog " / > <nl> - < size key = " minSize " width = " 627 " height = " 109 " / > <nl> + < size key = " minSize " width = " 625 " height = " 109 " / > <nl> < size key = " maxSize " width = " 881 " height = " 10000000 " / > <nl> < attributedString key = " textStorage " > <nl> < fragment > <nl> <nl> < autoresizingMask key = " autoresizingMask " / > <nl> < / scroller > <nl> < scroller key = " verticalScroller " verticalHuggingPriority = " 750 " doubleValue = " 1 " horizontal = " NO " id = " fRi - UI - 8x2 " > <nl> - < rect key = " frame " x = " 628 " y = " 1 " width = " 15 " height = " 109 " / > <nl> + < rect key = " frame " x = " 626 " y = " 1 " width = " 15 " height = " 109 " / > <nl> < autoresizingMask key = " autoresizingMask " / > <nl> < / scroller > <nl> < / scrollView > <nl> < customView translatesAutoresizingMaskIntoConstraints = " NO " id = " 925 " customClass = " KeyResponder " > <nl> - < rect key = " frame " x = " 664 " y = " 10 " width = " 128 " height = " 128 " / > <nl> + < rect key = " frame " x = " 662 " y = " 10 " width = " 128 " height = " 128 " / > <nl> < constraints > <nl> < constraint firstAttribute = " height " constant = " 128 " id = " ZpY - NJ - utg " / > <nl> < constraint firstAttribute = " width " constant = " 128 " id = " emK - zy - Ulc " / > <nl> <nl> < autoresizingMask key = " autoresizingMask " widthSizable = " YES " heightSizable = " YES " / > <nl> < subviews > <nl> < box borderType = " line " title = " Window behavior " translatesAutoresizingMaskIntoConstraints = " NO " id = " Qpe - gM - a7s " > <nl> - < rect key = " frame " x = " 14 " y = " 409 " width = " 806 " height = " 74 " / > <nl> + < rect key = " frame " x = " 14 " y = " 407 " width = " 806 " height = " 76 " / > <nl> < view key = " contentView " id = " sxi - Co - MLe " > <nl> - < rect key = " frame " x = " 1 " y = " 1 " width = " 804 " height = " 58 " / > <nl> + < rect key = " frame " x = " 3 " y = " 3 " width = " 800 " height = " 58 " / > <nl> < autoresizingMask key = " autoresizingMask " widthSizable = " YES " heightSizable = " YES " / > <nl> < subviews > <nl> < button translatesAutoresizingMaskIntoConstraints = " NO " id = " qpH - oY - yl0 " > <nl> <nl> < / view > <nl> < / box > <nl> < box borderType = " line " title = " Others " translatesAutoresizingMaskIntoConstraints = " NO " id = " lH0 - 6O - BWP " > <nl> - < rect key = " frame " x = " 14 " y = " 353 " width = " 806 " height = " 50 " / > <nl> + < rect key = " frame " x = " 14 " y = " 349 " width = " 806 " height = " 52 " / > <nl> < view key = " contentView " id = " xoA - 9x - cwN " > <nl> - < rect key = " frame " x = " 1 " y = " 1 " width = " 804 " height = " 34 " / > <nl> + < rect key = " frame " x = " 3 " y = " 3 " width = " 800 " height = " 34 " / > <nl> < autoresizingMask key = " autoresizingMask " widthSizable = " YES " heightSizable = " YES " / > <nl> < subviews > <nl> < button translatesAutoresizingMaskIntoConstraints = " NO " id = " cCs - zq - ovo " > <nl> mmm a / src / apps / PreferencesWindow / Resources / MainMenu . xib <nl> ppp b / src / apps / PreferencesWindow / Resources / MainMenu . xib <nl> <nl> < / menuItem > <nl> < / items > <nl> < / menu > <nl> - < window title = " Karabiner - Elements Preferences " allowsToolTipsWhenApplicationIsInactive = " NO " autorecalculatesKeyViewLoop = " NO " releasedWhenClosed = " NO " animationBehavior = " default " id = " QvC - M9 - y7g " > <nl> + < window title = " Karabiner - Elements Preferences " allowsToolTipsWhenApplicationIsInactive = " NO " autorecalculatesKeyViewLoop = " NO " releasedWhenClosed = " NO " appearanceType = " aqua " animationBehavior = " default " id = " QvC - M9 - y7g " > <nl> < windowStyleMask key = " styleMask " titled = " YES " closable = " YES " miniaturizable = " YES " resizable = " YES " / > <nl> < rect key = " contentRect " x = " 335 " y = " 390 " width = " 1000 " height = " 550 " / > <nl> - < rect key = " screenRect " x = " 0 . 0 " y = " 0 . 0 " width = " 1920 " height = " 1178 " / > <nl> + < rect key = " screenRect " x = " 0 . 0 " y = " 0 . 0 " width = " 1920 " height = " 1177 " / > <nl> < value key = " minSize " type = " size " width = " 1000 " height = " 550 " / > <nl> < view key = " contentView " id = " EiT - Mj - 1SZ " > <nl> < rect key = " frame " x = " 0 . 0 " y = " 0 . 0 " width = " 1000 " height = " 550 " / > <nl> <nl> < rect key = " frame " x = " 221 " y = " 447 " width = " 513 " height = " 31 " / > <nl> < subviews > <nl> < popUpButton verticalHuggingPriority = " 750 " translatesAutoresizingMaskIntoConstraints = " NO " id = " oB5 - NY - D3P " > <nl> - < rect key = " frame " x = " 101 " y = " 2 " width = " 405 " height = " 26 " / > <nl> + < rect key = " frame " x = " 101 " y = " 2 " width = " 405 " height = " 25 " / > <nl> < constraints > <nl> < constraint firstAttribute = " width " relation = " greaterThanOrEqual " constant = " 400 " id = " bbc - gt - Qjj " / > <nl> < / constraints > <nl> <nl> < autoresizingMask key = " autoresizingMask " widthSizable = " YES " heightSizable = " YES " / > <nl> < subviews > <nl> < popUpButton verticalHuggingPriority = " 750 " translatesAutoresizingMaskIntoConstraints = " NO " id = " l7m - AB - Jzs " > <nl> - < rect key = " frame " x = " 8 " y = " 0 . 0 " width = " 384 " height = " 26 " / > <nl> + < rect key = " frame " x = " 8 " y = " 0 . 0 " width = " 384 " height = " 25 " / > <nl> < popUpButtonCell key = " cell " type = " push " bezelStyle = " rounded " alignment = " left " lineBreakMode = " truncatingTail " borderStyle = " borderAndBezel " imageScaling = " proportionallyDown " inset = " 2 " id = " 32z - u1 - 2FH " > <nl> < behavior key = " behavior " lightByBackground = " YES " lightByGray = " YES " / > <nl> < font key = " font " metaFont = " menu " / > <nl> <nl> < autoresizingMask key = " autoresizingMask " widthSizable = " YES " heightSizable = " YES " / > <nl> < subviews > <nl> < popUpButton verticalHuggingPriority = " 750 " translatesAutoresizingMaskIntoConstraints = " NO " id = " grX - GY - 0Tj " > <nl> - < rect key = " frame " x = " 8 " y = " 0 . 0 " width = " 385 " height = " 26 " / > <nl> + < rect key = " frame " x = " 8 " y = " 0 . 0 " width = " 385 " height = " 25 " / > <nl> < popUpButtonCell key = " cell " type = " push " bezelStyle = " rounded " alignment = " left " lineBreakMode = " truncatingTail " borderStyle = " borderAndBezel " imageScaling = " proportionallyDown " inset = " 2 " id = " nkp - Ia - q39 " > <nl> < behavior key = " behavior " lightByBackground = " YES " lightByGray = " YES " / > <nl> < font key = " font " metaFont = " menu " / > <nl> <nl> < autoresizingMask key = " autoresizingMask " widthSizable = " YES " heightSizable = " YES " / > <nl> < subviews > <nl> < button verticalHuggingPriority = " 750 " imageHugsTitle = " YES " translatesAutoresizingMaskIntoConstraints = " NO " id = " zfo - 6t - 308 " > <nl> - < rect key = " frame " x = " - 2 " y = " - 4 " width = " 113 " height = " 32 " / > <nl> + < rect key = " frame " x = " - 1 " y = " - 4 " width = " 113 " height = " 32 " / > <nl> < buttonCell key = " cell " type = " push " title = " Remove " bezelStyle = " rounded " image = " ic_remove_circle_18pt " imagePosition = " left " alignment = " center " borderStyle = " border " imageScaling = " proportionallyDown " inset = " 2 " id = " Bdt - L4 - 6qN " > <nl> < behavior key = " behavior " pushIn = " YES " lightByBackground = " YES " lightByGray = " YES " / > <nl> < font key = " font " metaFont = " system " / > <nl> <nl> < rect key = " frame " x = " 221 " y = " 447 " width = " 513 " height = " 31 " / > <nl> < subviews > <nl> < popUpButton verticalHuggingPriority = " 750 " translatesAutoresizingMaskIntoConstraints = " NO " id = " grf - jw - eCn " > <nl> - < rect key = " frame " x = " 101 " y = " 2 " width = " 405 " height = " 26 " / > <nl> + < rect key = " frame " x = " 101 " y = " 2 " width = " 405 " height = " 25 " / > <nl> < constraints > <nl> < constraint firstAttribute = " width " relation = " greaterThanOrEqual " constant = " 400 " id = " oUU - f3 - pe7 " / > <nl> < / constraints > <nl> <nl> < autoresizingMask key = " autoresizingMask " widthSizable = " YES " heightSizable = " YES " / > <nl> < subviews > <nl> < popUpButton verticalHuggingPriority = " 750 " translatesAutoresizingMaskIntoConstraints = " NO " id = " uDk - 9o - 9ek " > <nl> - < rect key = " frame " x = " 8 " y = " 0 . 0 " width = " 797 " height = " 26 " / > <nl> + < rect key = " frame " x = " 8 " y = " 0 . 0 " width = " 797 " height = " 25 " / > <nl> < popUpButtonCell key = " cell " type = " push " bezelStyle = " rounded " alignment = " left " lineBreakMode = " truncatingTail " borderStyle = " borderAndBezel " imageScaling = " proportionallyDown " inset = " 2 " id = " JXH - j9 - ngj " > <nl> < behavior key = " behavior " lightByBackground = " YES " lightByGray = " YES " / > <nl> < font key = " font " metaFont = " menu " / > <nl> <nl> < autoresizingMask key = " autoresizingMask " widthSizable = " YES " heightSizable = " YES " / > <nl> < subviews > <nl> < box title = " basic " translatesAutoresizingMaskIntoConstraints = " NO " id = " E8I - 6o - sAw " > <nl> - < rect key = " frame " x = " 14 " y = " 259 " width = " 886 " height = " 154 " / > <nl> + < rect key = " frame " x = " 14 " y = " 257 " width = " 886 " height = " 156 " / > <nl> < view key = " contentView " id = " AOh - cS - AAf " > <nl> - < rect key = " frame " x = " 2 " y = " 2 " width = " 882 " height = " 137 " / > <nl> + < rect key = " frame " x = " 3 " y = " 3 " width = " 880 " height = " 138 " / > <nl> < autoresizingMask key = " autoresizingMask " widthSizable = " YES " heightSizable = " YES " / > <nl> < subviews > <nl> < textField horizontalHuggingPriority = " 251 " verticalHuggingPriority = " 750 " allowsCharacterPickerTouchBarItem = " YES " translatesAutoresizingMaskIntoConstraints = " NO " id = " otc - Wi - CC9 " > <nl> - < rect key = " frame " x = " 15 " y = " 108 " width = " 200 " height = " 17 " / > <nl> + < rect key = " frame " x = " 15 " y = " 109 " width = " 200 " height = " 17 " / > <nl> < textFieldCell key = " cell " scrollable = " YES " lineBreakMode = " clipping " sendsActionOnEndEditing = " YES " title = " to_if_alone_timeout_milliseconds " id = " D7X - 7J - krC " > <nl> < font key = " font " metaFont = " system " / > <nl> < color key = " textColor " name = " labelColor " catalog = " System " colorSpace = " catalog " / > <nl> <nl> < / textFieldCell > <nl> < / textField > <nl> < textField verticalHuggingPriority = " 750 " allowsCharacterPickerTouchBarItem = " YES " translatesAutoresizingMaskIntoConstraints = " NO " id = " B5e - sA - OFJ " > <nl> - < rect key = " frame " x = " 283 " y = " 105 " width = " 100 " height = " 22 " / > <nl> + < rect key = " frame " x = " 283 " y = " 106 " width = " 100 " height = " 22 " / > <nl> < constraints > <nl> < constraint firstAttribute = " width " constant = " 100 " id = " BV2 - gB - 5QP " / > <nl> < / constraints > <nl> <nl> < / connections > <nl> < / textField > <nl> < stepper horizontalHuggingPriority = " 750 " verticalHuggingPriority = " 750 " translatesAutoresizingMaskIntoConstraints = " NO " id = " cfX - J1 - 0CG " > <nl> - < rect key = " frame " x = " 382 " y = " 103 " width = " 19 " height = " 27 " / > <nl> + < rect key = " frame " x = " 382 " y = " 104 " width = " 19 " height = " 27 " / > <nl> < stepperCell key = " cell " continuous = " YES " alignment = " left " increment = " 100 " maxValue = " 10000 " id = " oLh - iM - Aqc " / > <nl> < connections > <nl> < action selector = " valueChanged : " target = " ihI - ZX - C7a " id = " ejc - nY - 9Kn " / > <nl> < / connections > <nl> < / stepper > <nl> < textField horizontalHuggingPriority = " 251 " verticalHuggingPriority = " 750 " allowsCharacterPickerTouchBarItem = " YES " translatesAutoresizingMaskIntoConstraints = " NO " id = " B6h - dy - l1f " > <nl> - < rect key = " frame " x = " 416 " y = " 108 " width = " 141 " height = " 17 " / > <nl> + < rect key = " frame " x = " 416 " y = " 109 " width = " 141 " height = " 17 " / > <nl> < textFieldCell key = " cell " scrollable = " YES " lineBreakMode = " clipping " sendsActionOnEndEditing = " YES " title = " ( Default value is 1000 ) " id = " Fo2 - yn - bIz " > <nl> < font key = " font " metaFont = " system " / > <nl> < color key = " textColor " name = " labelColor " catalog = " System " colorSpace = " catalog " / > <nl> <nl> < / textFieldCell > <nl> < / textField > <nl> < textField horizontalHuggingPriority = " 251 " verticalHuggingPriority = " 750 " allowsCharacterPickerTouchBarItem = " YES " translatesAutoresizingMaskIntoConstraints = " NO " id = " XKD - Tw - O9I " userLabel = " to_if_held_down_threshold_milliseconds " > <nl> - < rect key = " frame " x = " 15 " y = " 76 " width = " 244 " height = " 17 " / > <nl> + < rect key = " frame " x = " 15 " y = " 77 " width = " 244 " height = " 17 " / > <nl> < textFieldCell key = " cell " scrollable = " YES " lineBreakMode = " clipping " sendsActionOnEndEditing = " YES " title = " to_if_held_down_threshold_milliseconds " id = " fzo - Pm - DRt " > <nl> < font key = " font " metaFont = " system " / > <nl> < color key = " textColor " name = " labelColor " catalog = " System " colorSpace = " catalog " / > <nl> <nl> < / textFieldCell > <nl> < / textField > <nl> < textField verticalHuggingPriority = " 750 " allowsCharacterPickerTouchBarItem = " YES " translatesAutoresizingMaskIntoConstraints = " NO " id = " pIt - dV - R1r " > <nl> - < rect key = " frame " x = " 283 " y = " 73 " width = " 100 " height = " 22 " / > <nl> + < rect key = " frame " x = " 283 " y = " 74 " width = " 100 " height = " 22 " / > <nl> < constraints > <nl> < constraint firstAttribute = " width " constant = " 100 " id = " Ps0 - rV - XCf " / > <nl> < / constraints > <nl> <nl> < / connections > <nl> < / textField > <nl> < stepper horizontalHuggingPriority = " 750 " verticalHuggingPriority = " 750 " translatesAutoresizingMaskIntoConstraints = " NO " id = " JYX - np - sxS " > <nl> - < rect key = " frame " x = " 382 " y = " 71 " width = " 19 " height = " 27 " / > <nl> + < rect key = " frame " x = " 382 " y = " 72 " width = " 19 " height = " 27 " / > <nl> < stepperCell key = " cell " continuous = " YES " alignment = " left " increment = " 100 " maxValue = " 10000 " id = " P7Y - 0o - gNR " / > <nl> < connections > <nl> < action selector = " valueChanged : " target = " ihI - ZX - C7a " id = " Flu - MT - 34o " / > <nl> < / connections > <nl> < / stepper > <nl> < textField horizontalHuggingPriority = " 251 " verticalHuggingPriority = " 750 " allowsCharacterPickerTouchBarItem = " YES " translatesAutoresizingMaskIntoConstraints = " NO " id = " J7z - El - zvD " > <nl> - < rect key = " frame " x = " 416 " y = " 76 " width = " 135 " height = " 17 " / > <nl> + < rect key = " frame " x = " 416 " y = " 77 " width = " 135 " height = " 17 " / > <nl> < textFieldCell key = " cell " scrollable = " YES " lineBreakMode = " clipping " sendsActionOnEndEditing = " YES " title = " ( Default value is 500 ) " id = " KMT - ou - xXl " > <nl> < font key = " font " metaFont = " system " / > <nl> < color key = " textColor " name = " labelColor " catalog = " System " colorSpace = " catalog " / > <nl> <nl> < / textFieldCell > <nl> < / textField > <nl> < textField horizontalHuggingPriority = " 251 " verticalHuggingPriority = " 750 " allowsCharacterPickerTouchBarItem = " YES " translatesAutoresizingMaskIntoConstraints = " NO " id = " Sf6 - Wc - 6Rh " > <nl> - < rect key = " frame " x = " 15 " y = " 44 " width = " 230 " height = " 17 " / > <nl> + < rect key = " frame " x = " 15 " y = " 45 " width = " 230 " height = " 17 " / > <nl> < textFieldCell key = " cell " scrollable = " YES " lineBreakMode = " clipping " sendsActionOnEndEditing = " YES " title = " to_delayed_action_delay_milliseconds " id = " Daz - 54 - 9VZ " > <nl> < font key = " font " metaFont = " system " / > <nl> < color key = " textColor " name = " labelColor " catalog = " System " colorSpace = " catalog " / > <nl> <nl> < / textFieldCell > <nl> < / textField > <nl> < textField verticalHuggingPriority = " 750 " allowsCharacterPickerTouchBarItem = " YES " translatesAutoresizingMaskIntoConstraints = " NO " id = " wXk - qe - VZ6 " > <nl> - < rect key = " frame " x = " 283 " y = " 41 " width = " 100 " height = " 22 " / > <nl> + < rect key = " frame " x = " 283 " y = " 42 " width = " 100 " height = " 22 " / > <nl> < constraints > <nl> < constraint firstAttribute = " width " constant = " 100 " id = " An2 - UI - dyv " / > <nl> < / constraints > <nl> <nl> < / connections > <nl> < / textField > <nl> < stepper horizontalHuggingPriority = " 750 " verticalHuggingPriority = " 750 " translatesAutoresizingMaskIntoConstraints = " NO " id = " s1b - e2 - YLY " > <nl> - < rect key = " frame " x = " 382 " y = " 39 " width = " 19 " height = " 27 " / > <nl> + < rect key = " frame " x = " 382 " y = " 40 " width = " 19 " height = " 27 " / > <nl> < stepperCell key = " cell " continuous = " YES " alignment = " left " increment = " 100 " maxValue = " 10000 " id = " lOX - lc - TGU " / > <nl> < connections > <nl> < action selector = " valueChanged : " target = " ihI - ZX - C7a " id = " 5MD - L4 - gsp " / > <nl> < / connections > <nl> < / stepper > <nl> < textField horizontalHuggingPriority = " 251 " verticalHuggingPriority = " 750 " allowsCharacterPickerTouchBarItem = " YES " translatesAutoresizingMaskIntoConstraints = " NO " id = " 00L - qW - CRt " > <nl> - < rect key = " frame " x = " 416 " y = " 44 " width = " 135 " height = " 17 " / > <nl> + < rect key = " frame " x = " 416 " y = " 45 " width = " 135 " height = " 17 " / > <nl> < textFieldCell key = " cell " scrollable = " YES " lineBreakMode = " clipping " sendsActionOnEndEditing = " YES " title = " ( Default value is 500 ) " id = " 5Le - Ae - euU " > <nl> < font key = " font " metaFont = " system " / > <nl> < color key = " textColor " name = " labelColor " catalog = " System " colorSpace = " catalog " / > <nl> <nl> < / textFieldCell > <nl> < / textField > <nl> < textField horizontalHuggingPriority = " 251 " verticalHuggingPriority = " 750 " allowsCharacterPickerTouchBarItem = " YES " translatesAutoresizingMaskIntoConstraints = " NO " id = " xmv - LY - lFx " > <nl> - < rect key = " frame " x = " 15 " y = " 12 " width = " 228 " height = " 17 " / > <nl> + < rect key = " frame " x = " 15 " y = " 13 " width = " 228 " height = " 17 " / > <nl> < textFieldCell key = " cell " scrollable = " YES " lineBreakMode = " clipping " sendsActionOnEndEditing = " YES " title = " simultaneous_threshold_milliseconds " id = " unP - nG - ONK " > <nl> < font key = " font " metaFont = " system " / > <nl> < color key = " textColor " name = " labelColor " catalog = " System " colorSpace = " catalog " / > <nl> <nl> < autoresizingMask key = " autoresizingMask " widthSizable = " YES " heightSizable = " YES " / > <nl> < subviews > <nl> < box title = " Country Code " translatesAutoresizingMaskIntoConstraints = " NO " id = " LjF - ys - Tb3 " > <nl> - < rect key = " frame " x = " 14 " y = " 282 " width = " 926 " height = " 198 " / > <nl> + < rect key = " frame " x = " 14 " y = " 281 " width = " 926 " height = " 199 " / > <nl> < view key = " contentView " id = " WWS - oi - B4G " > <nl> - < rect key = " frame " x = " 2 " y = " 2 " width = " 922 " height = " 181 " / > <nl> + < rect key = " frame " x = " 3 " y = " 3 " width = " 920 " height = " 181 " / > <nl> < autoresizingMask key = " autoresizingMask " widthSizable = " YES " heightSizable = " YES " / > <nl> < subviews > <nl> < textField horizontalHuggingPriority = " 251 " verticalHuggingPriority = " 750 " allowsCharacterPickerTouchBarItem = " YES " translatesAutoresizingMaskIntoConstraints = " NO " id = " wfH - C6 - 3Zk " > <nl> <nl> < / connections > <nl> < / textField > <nl> < stepper horizontalHuggingPriority = " 750 " verticalHuggingPriority = " 750 " translatesAutoresizingMaskIntoConstraints = " NO " id = " 8oq - XL - Uqg " > <nl> - < rect key = " frame " x = " 172 " y = " 152 " width = " 19 " height = " 27 " / > <nl> + < rect key = " frame " x = " 172 " y = " 151 " width = " 19 " height = " 27 " / > <nl> < stepperCell key = " cell " continuous = " YES " alignment = " left " maxValue = " 255 " id = " Op4 - 4d - caF " / > <nl> < connections > <nl> < action selector = " changeVirtualHIDKeyboardCountryCode : " target = " 5ke - qB - Wr5 " id = " sre - rz - azz " / > <nl> <nl> < imageCell key = " cell " refusesFirstResponder = " YES " alignment = " left " animates = " YES " imageScaling = " proportionallyUpOrDown " image = " ic_warning_18pt " id = " f24 - UD - uRU " / > <nl> < / imageView > <nl> < textField verticalHuggingPriority = " 750 " horizontalCompressionResistancePriority = " 250 " translatesAutoresizingMaskIntoConstraints = " NO " id = " MMW - NV - Mwq " > <nl> - < rect key = " frame " x = " 77 " y = " 10 " width = " 830 " height = " 136 " / > <nl> + < rect key = " frame " x = " 77 " y = " 10 " width = " 828 " height = " 136 " / > <nl> < textFieldCell key = " cell " sendsActionOnEndEditing = " YES " id = " pVM - zu - tB2 " > <nl> < font key = " font " metaFont = " system " / > <nl> < string key = " title " > You usually don ' t need to change the Country Code value . <nl> In this case , you have to change the country code to avoid the conflict . <nl> < / textFieldCell > <nl> < / textField > <nl> < button verticalHuggingPriority = " 750 " translatesAutoresizingMaskIntoConstraints = " NO " id = " 7dB - iC - Z4u " > <nl> - < rect key = " frame " x = " 711 " y = " - 5 " width = " 79 " height = " 32 " / > <nl> + < rect key = " frame " x = " 711 " y = " - 4 " width = " 79 " height = " 32 " / > <nl> < buttonCell key = " cell " type = " push " title = " Select " bezelStyle = " rounded " alignment = " center " borderStyle = " border " imageScaling = " proportionallyDown " inset = " 2 " id = " uwD - 3g - 0lE " > <nl> < behavior key = " behavior " pushIn = " YES " lightByBackground = " YES " lightByGray = " YES " / > <nl> < font key = " font " metaFont = " system " / > <nl> In this case , you have to change the country code to avoid the conflict . <nl> < / textFieldCell > <nl> < / textField > <nl> < button verticalHuggingPriority = " 750 " imageHugsTitle = " YES " translatesAutoresizingMaskIntoConstraints = " NO " id = " 9Ub - kd - yPy " > <nl> - < rect key = " frame " x = " 763 " y = " 457 " width = " 179 " height = " 28 " / > <nl> + < rect key = " frame " x = " 763 " y = " 457 " width = " 179 " height = " 27 " / > <nl> < buttonCell key = " cell " type = " push " title = " Quit Karabiner - Elements " bezelStyle = " rounded " image = " ic_cancel_18pt " imagePosition = " left " alignment = " center " controlSize = " small " borderStyle = " border " imageScaling = " proportionallyDown " inset = " 2 " id = " DMD - gs - Fc2 " > <nl> < behavior key = " behavior " pushIn = " YES " lightByBackground = " YES " lightByGray = " YES " / > <nl> < font key = " font " metaFont = " smallSystem " / > <nl> In this case , you have to change the country code to avoid the conflict . <nl> < / connections > <nl> < / button > <nl> < button verticalHuggingPriority = " 750 " imageHugsTitle = " YES " translatesAutoresizingMaskIntoConstraints = " NO " id = " VG0 - yy - 2JZ " userLabel = " Restart Karabiner - Elements " > <nl> - < rect key = " frame " x = " 568 " y = " 457 " width = " 195 " height = " 28 " / > <nl> + < rect key = " frame " x = " 568 " y = " 457 " width = " 195 " height = " 27 " / > <nl> < buttonCell key = " cell " type = " push " title = " Restart Karabiner - Elements " bezelStyle = " rounded " image = " ic_refresh_18pt " imagePosition = " left " alignment = " center " controlSize = " small " borderStyle = " border " imageScaling = " proportionallyDown " inset = " 2 " id = " PvM - 2w - cA8 " > <nl> < behavior key = " behavior " pushIn = " YES " lightByBackground = " YES " lightByGray = " YES " / > <nl> < font key = " font " metaFont = " smallSystem " / > <nl> In this case , you have to change the country code to avoid the conflict . <nl> < / connections > <nl> < / button > <nl> < box borderType = " line " title = " Update " translatesAutoresizingMaskIntoConstraints = " NO " id = " 3j8 - 8U - bBH " > <nl> - < rect key = " frame " x = " 14 " y = " 366 " width = " 926 " height = " 77 " / > <nl> + < rect key = " frame " x = " 14 " y = " 364 " width = " 926 " height = " 79 " / > <nl> < view key = " contentView " id = " Blg - HH - 9LH " > <nl> - < rect key = " frame " x = " 1 " y = " 1 " width = " 924 " height = " 61 " / > <nl> + < rect key = " frame " x = " 3 " y = " 3 " width = " 920 " height = " 61 " / > <nl> < autoresizingMask key = " autoresizingMask " widthSizable = " YES " heightSizable = " YES " / > <nl> < subviews > <nl> < button translatesAutoresizingMaskIntoConstraints = " NO " id = " xCD - vQ - a37 " > <nl> In this case , you have to change the country code to avoid the conflict . <nl> < / connections > <nl> < / button > <nl> < button verticalHuggingPriority = " 750 " imageHugsTitle = " YES " translatesAutoresizingMaskIntoConstraints = " NO " id = " lRS - BL - uVJ " > <nl> - < rect key = " frame " x = " 706 " y = " 1 " width = " 207 " height = " 32 " / > <nl> + < rect key = " frame " x = " 702 " y = " 1 " width = " 207 " height = " 32 " / > <nl> < buttonCell key = " cell " type = " push " title = " Check for beta updates " bezelStyle = " rounded " image = " ic_refresh_18pt " imagePosition = " left " alignment = " center " borderStyle = " border " imageScaling = " proportionallyDown " inset = " 2 " id = " mbv - qj - mvU " > <nl> < behavior key = " behavior " pushIn = " YES " lightByBackground = " YES " lightByGray = " YES " / > <nl> < font key = " font " metaFont = " system " / > <nl> In this case , you have to change the country code to avoid the conflict . <nl> < / view > <nl> < / box > <nl> < box borderType = " line " title = " Uninstall " translatesAutoresizingMaskIntoConstraints = " NO " id = " bRw - jJ - vdo " > <nl> - < rect key = " frame " x = " 14 " y = " 297 " width = " 926 " height = " 53 " / > <nl> + < rect key = " frame " x = " 14 " y = " 293 " width = " 926 " height = " 55 " / > <nl> < view key = " contentView " id = " E8s - vq - cpp " > <nl> - < rect key = " frame " x = " 1 " y = " 1 " width = " 924 " height = " 37 " / > <nl> + < rect key = " frame " x = " 3 " y = " 3 " width = " 920 " height = " 37 " / > <nl> < autoresizingMask key = " autoresizingMask " widthSizable = " YES " heightSizable = " YES " / > <nl> < subviews > <nl> < button verticalHuggingPriority = " 750 " imageHugsTitle = " YES " translatesAutoresizingMaskIntoConstraints = " NO " id = " CzP - aW - AzB " > <nl> In this case , you have to change the country code to avoid the conflict . <nl> < / view > <nl> < / box > <nl> < box borderType = " line " title = " Web Sites " translatesAutoresizingMaskIntoConstraints = " NO " id = " ZAS - Lc - pSo " > <nl> - < rect key = " frame " x = " 14 " y = " 228 " width = " 926 " height = " 53 " / > <nl> + < rect key = " frame " x = " 14 " y = " 222 " width = " 926 " height = " 55 " / > <nl> < view key = " contentView " id = " ibU - 6J - Zdv " > <nl> - < rect key = " frame " x = " 1 " y = " 1 " width = " 924 " height = " 37 " / > <nl> + < rect key = " frame " x = " 3 " y = " 3 " width = " 920 " height = " 37 " / > <nl> < autoresizingMask key = " autoresizingMask " widthSizable = " YES " heightSizable = " YES " / > <nl> < subviews > <nl> < button verticalHuggingPriority = " 750 " imageHugsTitle = " YES " translatesAutoresizingMaskIntoConstraints = " NO " id = " i87 - Pa - TZD " > <nl> In this case , you have to change the country code to avoid the conflict . <nl> < / view > <nl> < / box > <nl> < box borderType = " line " title = " System Default Configuration " translatesAutoresizingMaskIntoConstraints = " NO " id = " gUV - If - Nhn " > <nl> - < rect key = " frame " x = " 14 " y = " 118 " width = " 926 " height = " 94 " / > <nl> + < rect key = " frame " x = " 14 " y = " 110 " width = " 926 " height = " 96 " / > <nl> < view key = " contentView " id = " TF9 - 1O - zm8 " > <nl> - < rect key = " frame " x = " 1 " y = " 1 " width = " 924 " height = " 78 " / > <nl> + < rect key = " frame " x = " 3 " y = " 3 " width = " 920 " height = " 78 " / > <nl> < autoresizingMask key = " autoresizingMask " widthSizable = " YES " heightSizable = " YES " / > <nl> < subviews > <nl> < textField horizontalHuggingPriority = " 251 " verticalHuggingPriority = " 750 " allowsCharacterPickerTouchBarItem = " YES " translatesAutoresizingMaskIntoConstraints = " NO " id = " 5oB - kz - f5x " > <nl> - < rect key = " frame " x = " 15 " y = " 36 " width = " 894 " height = " 34 " / > <nl> + < rect key = " frame " x = " 15 " y = " 36 " width = " 890 " height = " 34 " / > <nl> < textFieldCell key = " cell " scrollable = " YES " lineBreakMode = " clipping " sendsActionOnEndEditing = " YES " id = " gSI - ND - aKs " > <nl> < font key = " font " metaFont = " system " / > <nl> < string key = " title " > You can use Karabiner - Elements even before login by setting the system default configuration . <nl> In this case , you have to change the country code to avoid the conflict . <nl> < / textFieldCell > <nl> < / textField > <nl> < button verticalHuggingPriority = " 750 " imageHugsTitle = " YES " translatesAutoresizingMaskIntoConstraints = " NO " id = " sAi - Da - rG4 " > <nl> - < rect key = " frame " x = " 12 " y = " 2 " width = " 399 " height = " 28 " / > <nl> + < rect key = " frame " x = " 12 " y = " 2 " width = " 399 " height = " 27 " / > <nl> < buttonCell key = " cell " type = " push " title = " Copy the current configuration to the system default configuration " bezelStyle = " rounded " image = " ic_star_rate_18pt " imagePosition = " left " alignment = " center " controlSize = " small " borderStyle = " border " imageScaling = " proportionallyDown " inset = " 2 " id = " B2t - va - 0wM " > <nl> < behavior key = " behavior " pushIn = " YES " lightByBackground = " YES " lightByGray = " YES " / > <nl> < font key = " font " metaFont = " smallSystem " / > <nl> In this case , you have to change the country code to avoid the conflict . <nl> < / textFieldCell > <nl> < / textField > <nl> < button verticalHuggingPriority = " 750 " imageHugsTitle = " YES " translatesAutoresizingMaskIntoConstraints = " NO " id = " RVr - L2 - a5V " > <nl> - < rect key = " frame " x = " 431 " y = " 2 " width = " 265 " height = " 28 " / > <nl> + < rect key = " frame " x = " 431 " y = " 2 " width = " 265 " height = " 27 " / > <nl> < buttonCell key = " cell " type = " push " title = " Remove the system default configuration " bezelStyle = " rounded " image = " ic_cancel_18pt " imagePosition = " left " alignment = " center " controlSize = " small " borderStyle = " border " imageScaling = " proportionallyDown " inset = " 2 " id = " jwQ - 69 - bk6 " > <nl> < behavior key = " behavior " pushIn = " YES " lightByBackground = " YES " lightByGray = " YES " / > <nl> < font key = " font " metaFont = " smallSystem " / > <nl> In this case , you have to change the country code to avoid the conflict . <nl> < / view > <nl> < / box > <nl> < box title = " Miscellaneous " translatesAutoresizingMaskIntoConstraints = " NO " id = " BAq - 6J - 75B " > <nl> - < rect key = " frame " x = " 14 " y = " 31 " width = " 926 " height = " 71 " / > <nl> + < rect key = " frame " x = " 14 " y = " 22 " width = " 926 " height = " 72 " / > <nl> < view key = " contentView " id = " 9XA - gC - pTe " > <nl> - < rect key = " frame " x = " 2 " y = " 2 " width = " 922 " height = " 54 " / > <nl> + < rect key = " frame " x = " 3 " y = " 3 " width = " 920 " height = " 54 " / > <nl> < autoresizingMask key = " autoresizingMask " widthSizable = " YES " heightSizable = " YES " / > <nl> < subviews > <nl> < button translatesAutoresizingMaskIntoConstraints = " NO " id = " AHk - df - Lmk " > <nl> In this case , you have to change the country code to avoid the conflict . <nl> < / view > <nl> < point key = " canvasLocation " x = " 117 " y = " 245 " / > <nl> < / window > <nl> - < window title = " Add rule " allowsToolTipsWhenApplicationIsInactive = " NO " autorecalculatesKeyViewLoop = " NO " hidesOnDeactivate = " YES " releasedWhenClosed = " NO " visibleAtLaunch = " NO " frameAutosaveName = " " animationBehavior = " default " id = " FqN - OP - TO2 " customClass = " NSPanel " > <nl> + < window title = " Add rule " allowsToolTipsWhenApplicationIsInactive = " NO " autorecalculatesKeyViewLoop = " NO " hidesOnDeactivate = " YES " releasedWhenClosed = " NO " visibleAtLaunch = " NO " appearanceType = " aqua " frameAutosaveName = " " animationBehavior = " default " id = " FqN - OP - TO2 " customClass = " NSPanel " > <nl> < windowStyleMask key = " styleMask " titled = " YES " closable = " YES " miniaturizable = " YES " resizable = " YES " utility = " YES " / > <nl> < windowPositionMask key = " initialPositionMask " leftStrut = " YES " rightStrut = " YES " topStrut = " YES " bottomStrut = " YES " / > <nl> < rect key = " contentRect " x = " 196 " y = " 132 " width = " 900 " height = " 400 " / > <nl> - < rect key = " screenRect " x = " 0 . 0 " y = " 0 . 0 " width = " 1920 " height = " 1178 " / > <nl> + < rect key = " screenRect " x = " 0 . 0 " y = " 0 . 0 " width = " 1920 " height = " 1177 " / > <nl> < value key = " minSize " type = " size " width = " 900 " height = " 400 " / > <nl> < value key = " maxSize " type = " size " width = " 900 " height = " 400 " / > <nl> < view key = " contentView " id = " uOP - Fc - vEW " > <nl> In this case , you have to change the country code to avoid the conflict . <nl> < / buttonCell > <nl> < / button > <nl> < button hidden = " YES " verticalHuggingPriority = " 750 " imageHugsTitle = " YES " translatesAutoresizingMaskIntoConstraints = " NO " id = " aoS - Bs - ODT " > <nl> - < rect key = " frame " x = " 39 " y = " - 5 " width = " 105 " height = " 32 " / > <nl> + < rect key = " frame " x = " 39 " y = " - 4 " width = " 105 " height = " 32 " / > <nl> < buttonCell key = " cell " type = " push " title = " Enable " bezelStyle = " rounded " image = " ic_add_circle_18pt " imagePosition = " left " alignment = " center " borderStyle = " border " imageScaling = " proportionallyDown " inset = " 2 " id = " 6TO - Hp - Ppt " > <nl> < behavior key = " behavior " pushIn = " YES " lightByBackground = " YES " lightByGray = " YES " / > <nl> < font key = " font " metaFont = " system " / > <nl> In this case , you have to change the country code to avoid the conflict . <nl> < / scroller > <nl> < / scrollView > <nl> < button verticalHuggingPriority = " 750 " imageHugsTitle = " YES " translatesAutoresizingMaskIntoConstraints = " NO " id = " lWl - Op - 37M " > <nl> - < rect key = " frame " x = " 12 " y = " 32 " width = " 113 " height = " 28 " / > <nl> + < rect key = " frame " x = " 12 " y = " 32 " width = " 113 " height = " 27 " / > <nl> < buttonCell key = " cell " type = " push " title = " Expand tree " bezelStyle = " rounded " image = " ic_expand_more_18pt " imagePosition = " left " alignment = " center " controlSize = " small " borderStyle = " border " imageScaling = " proportionallyDown " inset = " 2 " id = " pWt - V1 - 3zc " > <nl> < behavior key = " behavior " pushIn = " YES " lightByBackground = " YES " lightByGray = " YES " / > <nl> < font key = " font " metaFont = " smallSystem " / > <nl> In this case , you have to change the country code to avoid the conflict . <nl> < / connections > <nl> < / button > <nl> < button verticalHuggingPriority = " 750 " imageHugsTitle = " YES " translatesAutoresizingMaskIntoConstraints = " NO " id = " Tqb - fK - IZi " > <nl> - < rect key = " frame " x = " 125 " y = " 32 " width = " 120 " height = " 28 " / > <nl> + < rect key = " frame " x = " 125 " y = " 32 " width = " 120 " height = " 27 " / > <nl> < buttonCell key = " cell " type = " push " title = " Collapse tree " bezelStyle = " rounded " image = " ic_chevron_right_18pt " imagePosition = " left " alignment = " center " controlSize = " small " borderStyle = " border " imageScaling = " proportionallyDown " inset = " 2 " id = " pvE - NN - dNd " > <nl> < behavior key = " behavior " pushIn = " YES " lightByBackground = " YES " lightByGray = " YES " / > <nl> < font key = " font " metaFont = " smallSystem " / > <nl> Gw <nl> < / view > <nl> < point key = " canvasLocation " x = " - 20 " y = " - 264 " / > <nl> < / window > <nl> - < window title = " Import complex modifications file " allowsToolTipsWhenApplicationIsInactive = " NO " autorecalculatesKeyViewLoop = " NO " hidesOnDeactivate = " YES " releasedWhenClosed = " NO " visibleAtLaunch = " NO " frameAutosaveName = " " animationBehavior = " default " id = " ZY4 - nd - 9zB " userLabel = " Import Complex Modifications File Panel " customClass = " NSPanel " > <nl> + < window title = " Import complex modifications file " allowsToolTipsWhenApplicationIsInactive = " NO " autorecalculatesKeyViewLoop = " NO " hidesOnDeactivate = " YES " releasedWhenClosed = " NO " visibleAtLaunch = " NO " appearanceType = " aqua " frameAutosaveName = " " animationBehavior = " default " id = " ZY4 - nd - 9zB " userLabel = " Import Complex Modifications File Panel " customClass = " NSPanel " > <nl> < windowStyleMask key = " styleMask " titled = " YES " closable = " YES " miniaturizable = " YES " resizable = " YES " utility = " YES " / > <nl> < windowPositionMask key = " initialPositionMask " leftStrut = " YES " rightStrut = " YES " topStrut = " YES " bottomStrut = " YES " / > <nl> < rect key = " contentRect " x = " 196 " y = " 132 " width = " 900 " height = " 200 " / > <nl> - < rect key = " screenRect " x = " 0 . 0 " y = " 0 . 0 " width = " 1920 " height = " 1178 " / > <nl> + < rect key = " screenRect " x = " 0 . 0 " y = " 0 . 0 " width = " 1920 " height = " 1177 " / > <nl> < value key = " minSize " type = " size " width = " 900 " height = " 200 " / > <nl> < value key = " maxSize " type = " size " width = " 900 " height = " 200 " / > <nl> < view key = " contentView " id = " YVO - Df - Mre " > <nl> Gw <nl> < / view > <nl> < point key = " canvasLocation " x = " 46 " y = " 640 " / > <nl> < / window > <nl> - < window title = " Window " allowsToolTipsWhenApplicationIsInactive = " NO " autorecalculatesKeyViewLoop = " NO " hidesOnDeactivate = " YES " releasedWhenClosed = " NO " visibleAtLaunch = " NO " frameAutosaveName = " " animationBehavior = " default " id = " WRr - 7z - BZH " userLabel = " Alert Panel " customClass = " NSPanel " > <nl> + < window title = " Window " allowsToolTipsWhenApplicationIsInactive = " NO " autorecalculatesKeyViewLoop = " NO " hidesOnDeactivate = " YES " releasedWhenClosed = " NO " visibleAtLaunch = " NO " appearanceType = " aqua " frameAutosaveName = " " animationBehavior = " default " id = " WRr - 7z - BZH " userLabel = " Alert Panel " customClass = " NSPanel " > <nl> < windowStyleMask key = " styleMask " titled = " YES " closable = " YES " miniaturizable = " YES " resizable = " YES " utility = " YES " / > <nl> < windowPositionMask key = " initialPositionMask " leftStrut = " YES " rightStrut = " YES " topStrut = " YES " bottomStrut = " YES " / > <nl> < rect key = " contentRect " x = " 196 " y = " 132 " width = " 900 " height = " 600 " / > <nl> - < rect key = " screenRect " x = " 0 . 0 " y = " 0 . 0 " width = " 1920 " height = " 1178 " / > <nl> + < rect key = " screenRect " x = " 0 . 0 " y = " 0 . 0 " width = " 1920 " height = " 1177 " / > <nl> < value key = " minSize " type = " size " width = " 900 " height = " 600 " / > <nl> < value key = " maxSize " type = " size " width = " 900 " height = " 600 " / > <nl> < view key = " contentView " id = " t6Q - r2 - 1Lh " > <nl> You have to allow the system software from developer " Fumihiko Takayama " ( the au <nl> < / view > <nl> < point key = " canvasLocation " x = " 75 . 5 " y = " 888 " / > <nl> < / window > <nl> - < window title = " ManipulateCapsLockLED Confirmation Panel " allowsToolTipsWhenApplicationIsInactive = " NO " autorecalculatesKeyViewLoop = " NO " hidesOnDeactivate = " YES " releasedWhenClosed = " NO " visibleAtLaunch = " NO " frameAutosaveName = " " animationBehavior = " default " id = " Q4d - fj - 0zt " customClass = " NSPanel " > <nl> + < window title = " ManipulateCapsLockLED Confirmation Panel " allowsToolTipsWhenApplicationIsInactive = " NO " autorecalculatesKeyViewLoop = " NO " hidesOnDeactivate = " YES " releasedWhenClosed = " NO " visibleAtLaunch = " NO " appearanceType = " aqua " frameAutosaveName = " " animationBehavior = " default " id = " Q4d - fj - 0zt " customClass = " NSPanel " > <nl> < windowStyleMask key = " styleMask " titled = " YES " closable = " YES " miniaturizable = " YES " resizable = " YES " utility = " YES " / > <nl> < windowPositionMask key = " initialPositionMask " leftStrut = " YES " rightStrut = " YES " topStrut = " YES " bottomStrut = " YES " / > <nl> < rect key = " contentRect " x = " 196 " y = " 132 " width = " 600 " height = " 300 " / > <nl> - < rect key = " screenRect " x = " 0 . 0 " y = " 0 . 0 " width = " 1920 " height = " 1178 " / > <nl> + < rect key = " screenRect " x = " 0 . 0 " y = " 0 . 0 " width = " 1920 " height = " 1177 " / > <nl> < view key = " contentView " id = " Sw1 - 0x - oK2 " > <nl> < rect key = " frame " x = " 0 . 0 " y = " 0 . 0 " width = " 600 " height = " 300 " / > <nl> < autoresizingMask key = " autoresizingMask " / > <nl> Please keep the checkbox off if the device does not have a caps lock LED . < / strin <nl> < string key = " userLabel " > Karabiner - Elements tries to manipulate the caps lock LED . However , the LED manipulation might cause a problem if the device does not have a caps lock LED . Please keep the checkbox off if the device does not have a caps lock LED . < / string > <nl> < / textField > <nl> < customView translatesAutoresizingMaskIntoConstraints = " NO " id = " uTI - aw - tOw " > <nl> - < rect key = " frame " x = " 76 " y = " 20 " width = " 448 " height = " 31 " / > <nl> + < rect key = " frame " x = " 85 " y = " 20 " width = " 430 " height = " 31 " / > <nl> < subviews > <nl> < button verticalHuggingPriority = " 750 " imageHugsTitle = " YES " translatesAutoresizingMaskIntoConstraints = " NO " id = " rN3 - uz - e7c " > <nl> < rect key = " frame " x = " - 1 " y = " - 2 " width = " 212 " height = " 32 " / > <nl> Gw <nl> < / connections > <nl> < / button > <nl> < button verticalHuggingPriority = " 750 " imageHugsTitle = " YES " translatesAutoresizingMaskIntoConstraints = " NO " id = " kmG - ha - BRe " > <nl> - < rect key = " frame " x = " 250 " y = " 0 . 0 " width = " 198 " height = " 28 " / > <nl> + < rect key = " frame " x = " 250 " y = " 1 " width = " 180 " height = " 27 " / > <nl> < buttonCell key = " cell " type = " push " title = " Enable LED manipulation " bezelStyle = " rounded " image = " ic_check_18pt " imagePosition = " left " alignment = " center " controlSize = " small " borderStyle = " border " imageScaling = " proportionallyDown " inset = " 2 " id = " CzH - uV - HZ1 " > <nl> < behavior key = " behavior " pushIn = " YES " lightByBackground = " YES " lightByGray = " YES " / > <nl> < font key = " font " metaFont = " smallSystem " / > <nl> Gw <nl> < / window > <nl> < / objects > <nl> < resources > <nl> - < image name = " NSCaution " width = " 32 " height = " 32 " / > <nl> + < image name = " NSCaution " width = " 128 " height = " 128 " / > <nl> < image name = " ic_add_circle_18pt " width = " 36 " height = " 36 " / > <nl> < image name = " ic_arrow_downward_18pt " width = " 36 " height = " 36 " / > <nl> < image name = " ic_arrow_upward_18pt " width = " 36 " height = " 36 " / > <nl>
disable dark mode
pqrs-org/Karabiner-Elements
692183d7b9cc3cc5be4c70862186ae8f6ae5ace8
2018-10-26T14:01:07Z
mmm a / modules / control / control_component . cc <nl> ppp b / modules / control / control_component . cc <nl> Status ControlComponent : : ProduceControlCommand ( <nl> : local_view_ . trajectory . estop ( ) . is_estop ( ) ; <nl> <nl> if ( local_view_ . trajectory . estop ( ) . is_estop ( ) ) { <nl> - estop_reason_ = " estop from planning " ; <nl> + estop_ = true ; <nl> + estop_reason_ = " estop from planning : " ; <nl> + estop_reason_ + = local_view_ . trajectory . estop ( ) . reason ( ) ; <nl> } <nl> <nl> if ( local_view_ . trajectory . trajectory_point_size ( ) = = 0 ) { <nl> Status ControlComponent : : ProduceControlCommand ( <nl> estop_reason_ = " estop for empty planning trajectory " ; <nl> } <nl> <nl> - / / if planning set estop , then no control process triggered <nl> if ( ! estop_ ) { <nl> if ( local_view_ . chassis . driving_mode ( ) = = Chassis : : COMPLETE_MANUAL ) { <nl> controller_agent_ . Reset ( ) ; <nl> Status ControlComponent : : ProduceControlCommand ( <nl> status = status_compute ; <nl> } <nl> } <nl> - <nl> + / / if planning set estop , then no control process triggered <nl> if ( estop_ ) { <nl> AWARN_EVERY ( 100 ) < < " Estop triggered ! No control core method executed ! " ; <nl> / / set Estop command <nl> mmm a / modules / planning / on_lane_planning . cc <nl> ppp b / modules / planning / on_lane_planning . cc <nl> void OnLanePlanning : : RunOnce ( const LocalView & local_view , <nl> if ( ! status . ok ( ) | | ! update_ego_info ) { <nl> AERROR < < status . ToString ( ) ; <nl> if ( FLAGS_publish_estop ) { <nl> - / / Because the function " Control : : ProduceControlCommand ( ) " checks the <nl> - / / " estop " signal with the following line ( Line 170 in control . cc ) : <nl> - / / estop_ = estop_ | | trajectory_ . estop ( ) . is_estop ( ) ; <nl> + / / " estop " signal check in function " Control : : ProduceControlCommand ( ) " <nl> + / / estop_ = estop_ | | local_view_ . trajectory . estop ( ) . is_estop ( ) ; <nl> / / we should add more information to ensure the estop being triggered . <nl> ADCTrajectory estop_trajectory ; <nl> EStop * estop = estop_trajectory . mutable_estop ( ) ; <nl>
* supple estop information in control
ApolloAuto/apollo
138df927a70abe1f54a68a664befa119e9febf43
2019-03-21T21:23:50Z
mmm a / src / preferences / options . ui <nl> ppp b / src / preferences / options . ui <nl> <nl> < / widget > <nl> < widget class = " QStackedWidget " name = " tabOption " > <nl> < property name = " currentIndex " > <nl> - < number > 2 < / number > <nl> + < number > 0 < / number > <nl> < / property > <nl> < widget class = " QWidget " name = " tabOptionPage1 " > <nl> < layout class = " QVBoxLayout " name = " verticalLayout_10 " > <nl>
Fix default options tab
qbittorrent/qBittorrent
b48b9479d22ff1761887dbb1182e30d90cbd8fa1
2011-05-01T11:22:56Z
mmm a / hphp / test / frameworks / run . php <nl> ppp b / hphp / test / frameworks / run . php <nl> public function __construct ( string $ name ) { <nl> protected function getInfo ( ) : Map { <nl> return Map { <nl> " install_root " = > __DIR__ . " / frameworks / phpbb3 " , <nl> - " git_path " = > " https : / / github . com / JoelMarcey / phpbb . git " , <nl> - " git_commit " = > " e0c8a81603a6e132c714adbdcb0a8762d01cbdfe " , <nl> + " git_path " = > " https : / / github . com / phpbb / phpbb . git " , <nl> + " git_commit " = > " b474917ba3fbb26e50a7145fa904efec949f20ce " , <nl> " test_path " = > __DIR__ . " / frameworks / phpbb3 " , <nl> + " env_vars " = > Map { ' PHP_BINARY ' = > get_runtime_build ( false , true ) } , <nl> / / This may work if we increase the timeout . Blacklist for now <nl> " blacklist " = > Set { <nl> __DIR__ . " / frameworks / phpbb3 / tests / lint_test . php " , <nl>
Update phpbb3 hash
facebook/hhvm
c0199e49a944da6c841f02788b655e62edf892a1
2013-12-04T22:30:58Z
mmm a / AirLib / include / common / AirSimSettings . hpp <nl> ppp b / AirLib / include / common / AirSimSettings . hpp <nl> struct AirSimSettings { <nl> initial_view_mode = 6 ; / / ECameraDirectorMode : : CAMREA_DIRECTOR_MODE_BACKUP ; <nl> else if ( view_mode_string = = " NoDisplay " ) <nl> initial_view_mode = 7 ; / / ECameraDirectorMode : : CAMREA_DIRECTOR_MODE_NODISPLAY ; <nl> + else if ( view_mode_string = = " Front " ) <nl> + initial_view_mode = 8 ; / / ECameraDirectorMode : : CAMREA_DIRECTOR_MODE_FRONT ; <nl> else <nl> warning_messages . push_back ( " ViewMode setting is not recognized : " + view_mode_string ) ; <nl> } <nl> mmm a / Unreal / Plugins / AirSim / Source / CameraDirector . cpp <nl> ppp b / Unreal / Plugins / AirSim / Source / CameraDirector . cpp <nl> void ACameraDirector : : setCameras ( APIPCamera * external_camera , VehiclePawnWrapper <nl> external_camera_ = external_camera ; <nl> follow_actor_ = vehicle_pawn_wrapper - > getPawn ( ) ; <nl> fpv_camera_ = vehicle_pawn_wrapper - > getCameraCount ( ) > fpv_camera_index_ ? vehicle_pawn_wrapper - > getCamera ( fpv_camera_index_ ) : nullptr ; <nl> + front_camera_ = vehicle_pawn_wrapper - > getCameraCount ( ) > front_camera_index_ ? vehicle_pawn_wrapper - > getCamera ( front_camera_index_ ) : nullptr ; <nl> backup_camera_ = backup_camera_index_ > = 0 & & vehicle_pawn_wrapper - > getCameraCount ( ) > backup_camera_index_ ? vehicle_pawn_wrapper - > getCamera ( backup_camera_index_ ) : nullptr ; <nl> camera_start_location_ = external_camera_ - > GetActorLocation ( ) ; <nl> camera_start_rotation_ = external_camera_ - > GetActorRotation ( ) ; <nl> void ACameraDirector : : setCameras ( APIPCamera * external_camera , VehiclePawnWrapper <nl> case ECameraDirectorMode : : CAMERA_DIRECTOR_MODE_SPRINGARM_CHASE : inputEventSpringArmChaseView ( ) ; break ; <nl> case ECameraDirectorMode : : CAMERA_DIRECTOR_MODE_BACKUP : inputEventBackupView ( ) ; break ; <nl> case ECameraDirectorMode : : CAMERA_DIRECTOR_MODE_NODISPLAY : inputEventNoDisplayView ( ) ; break ; <nl> + case ECameraDirectorMode : : CAMERA_DIRECTOR_MODE_FRONT : inputEventFrontView ( ) ; break ; <nl> default : <nl> throw std : : out_of_range ( " Unsupported view mode specified in CameraDirector : : initializeForBeginPlay " ) ; <nl> } <nl> void ACameraDirector : : setupInputBindings ( ) <nl> UAirBlueprintLib : : BindActionToKey ( " inputEventSpringArmChaseView " , EKeys : : Slash , this , & ACameraDirector : : inputEventSpringArmChaseView ) ; <nl> UAirBlueprintLib : : BindActionToKey ( " inputEventBackupView " , EKeys : : K , this , & ACameraDirector : : inputEventBackupView ) ; <nl> UAirBlueprintLib : : BindActionToKey ( " inputEventNoDisplayView " , EKeys : : Hyphen , this , & ACameraDirector : : inputEventNoDisplayView ) ; <nl> + UAirBlueprintLib : : BindActionToKey ( " inputEventFrontView " , EKeys : : I , this , & ACameraDirector : : inputEventFrontView ) ; <nl> } <nl> <nl> <nl> void ACameraDirector : : inputEventFpvView ( ) <nl> fpv_camera_ - > showToScreen ( ) ; <nl> } <nl> <nl> + void ACameraDirector : : inputEventFrontView ( ) <nl> + { <nl> + setMode ( ECameraDirectorMode : : CAMERA_DIRECTOR_MODE_FRONT ) ; <nl> + external_camera_ - > disableMain ( ) ; <nl> + if ( backup_camera_ ) <nl> + backup_camera_ - > disableMain ( ) ; <nl> + if ( front_camera_ ) <nl> + front_camera_ - > showToScreen ( ) ; <nl> + } <nl> + <nl> void ACameraDirector : : inputEventSpringArmChaseView ( ) <nl> { <nl> setMode ( ECameraDirectorMode : : CAMERA_DIRECTOR_MODE_SPRINGARM_CHASE ) ; <nl> mmm a / Unreal / Plugins / AirSim / Source / CameraDirector . h <nl> ppp b / Unreal / Plugins / AirSim / Source / CameraDirector . h <nl> enum class ECameraDirectorMode : uint8 <nl> CAMERA_DIRECTOR_MODE_MANUAL = 4 UMETA ( DisplayName = " Manual " ) , <nl> CAMERA_DIRECTOR_MODE_SPRINGARM_CHASE = 5 UMETA ( DisplayName = " SpringArmChase " ) , <nl> CAMERA_DIRECTOR_MODE_BACKUP = 6 UMETA ( DisplayName = " Backup " ) , <nl> - CAMERA_DIRECTOR_MODE_NODISPLAY = 7 UMETA ( DisplayName = " No Display " ) <nl> + CAMERA_DIRECTOR_MODE_NODISPLAY = 7 UMETA ( DisplayName = " No Display " ) , <nl> + CAMERA_DIRECTOR_MODE_FRONT = 8 UMETA ( DisplayName = " Front " ) <nl> } ; <nl> <nl> UCLASS ( ) <nl> class AIRSIM_API ACameraDirector : public AActor <nl> void inputEventSpringArmChaseView ( ) ; <nl> void inputEventBackupView ( ) ; <nl> void inputEventNoDisplayView ( ) ; <nl> + void inputEventFrontView ( ) ; <nl> <nl> public : <nl> ACameraDirector ( ) ; <nl> class AIRSIM_API ACameraDirector : public AActor <nl> APIPCamera * fpv_camera_ ; <nl> APIPCamera * backup_camera_ ; <nl> APIPCamera * external_camera_ ; <nl> + APIPCamera * front_camera_ ; <nl> AActor * follow_actor_ ; <nl> <nl> USceneComponent * last_parent_ = nullptr ; <nl> class AIRSIM_API ACameraDirector : public AActor <nl> bool camera_rotation_lag_enabled_ ; <nl> int fpv_camera_index_ ; <nl> int backup_camera_index_ = 4 ; <nl> - } ; <nl> + int front_camera_index_ = 0 ; <nl> + } ; <nl> \ No newline at end of file <nl>
Merge pull request from bmeaut / FrontCamera
microsoft/AirSim
3bf382901b7317409b931743de2ea38a3de93f65
2018-04-09T20:38:14Z
mmm a / Tools / CMake / CommonMacros . cmake <nl> ppp b / Tools / CMake / CommonMacros . cmake <nl> macro ( add_sources name ) <nl> endforeach ( ) <nl> endmacro ( ) <nl> <nl> + # Automatically add sources in current CMakeLists directory , respecting directory structure <nl> + macro ( add_sources_recursive_search ) <nl> + set ( _src_root_path " $ { CMAKE_CURRENT_SOURCE_DIR } " ) <nl> + file ( <nl> + GLOB_RECURSE _source_list <nl> + LIST_DIRECTORIES false <nl> + " $ { _src_root_path } / * . cpp " <nl> + " $ { _src_root_path } / * . h " <nl> + ) <nl> + <nl> + foreach ( _source IN ITEMS $ { _source_list } ) <nl> + get_filename_component ( _source_path " $ { _source } " PATH ) <nl> + file ( RELATIVE_PATH _source_path_rel " $ { _src_root_path } " " $ { _source_path } " ) <nl> + string ( REPLACE " / " " \ \ " _group_path " $ { _source_path_rel } " ) <nl> + source_group ( " $ { _group_path } " FILES " $ { _source } " ) <nl> + file ( RELATIVE_PATH _source_rel " $ { _src_root_path } " " $ { _source } " ) <nl> + <nl> + if ( _group_path STREQUAL " " ) <nl> + set ( _group_path " Root " ) <nl> + endif ( ) <nl> + <nl> + string ( REPLACE " \ \ " " _ " _group_path " $ { _group_path } " ) <nl> + <nl> + set ( _group_path " $ { _group_path } . cpp " ) <nl> + <nl> + list ( FIND UBERFILES $ { _group_path } GROUP_INDEX ) <nl> + if ( GROUP_INDEX EQUAL - 1 ) <nl> + list ( APPEND UBERFILES " $ { _group_path } " ) <nl> + set ( $ { _group_path } _PROJECTS $ { UB_PROJECTS } ) <nl> + endif ( ) <nl> + <nl> + add_to_uberfile ( $ { _group_path } $ { _source_rel } ) <nl> + endforeach ( ) <nl> + endmacro ( ) <nl> + <nl> macro ( get_source_group output group ) <nl> string ( REPLACE " " " _ " group_var $ { group } ) <nl> set ( $ { output } $ { SOURCE_GROUP_ $ { group_var } } ) <nl>
! T ( CMake ) Add macro for automatically adding sources in directory
CRYTEK/CRYENGINE
e4f62d25a2cbf3a48542e7f43693617fa5eeaeb2
2017-08-28T15:31:12Z