Skip to content
This repository was archived by the owner on Jul 3, 2020. It is now read-only.

Commit 5f4424d

Browse files
authored
Merge pull request #128 from runtimejs/v8-flags
Allow V8 flags to be configured at runtime
2 parents 7299d5e + 61ecf59 commit 5f4424d

13 files changed

Lines changed: 1447 additions & 5 deletions

File tree

.eslintrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ globals:
55
debug: true
66
__SYSCALL: true
77
runtime: true
8+
performance: true
89

910
env:
1011
es6: true

SConstruct

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ config = {
119119
'deps/printf',
120120
'deps/miniz',
121121
'deps/libsodium/src/libsodium/include',
122+
'deps/json11',
122123
'src',
123124
'test',
124125
],
@@ -130,6 +131,7 @@ config = {
130131
'acpica',
131132
'printf',
132133
'sodium',
134+
'json11',
133135
'musl',
134136
'gcc',
135137
],

deps/SConscript

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ libs_config = {
1212
'concurrentqueue',
1313
'printf',
1414
'trace_event',
15+
'json11',
1516
'v8/include',
1617
'v8/src',
1718
'v8',
@@ -1238,11 +1239,23 @@ libs_config = {
12381239
'libsodium/src/libsodium/sodium/version.c',
12391240
],
12401241
},
1242+
"json11": {
1243+
"include": [
1244+
'musl/src/internal',
1245+
'musl/include',
1246+
'musl/arch/x86_64',
1247+
'musl/arch/x86_64/bits',
1248+
'libcxx/include',
1249+
'json11'
1250+
],
1251+
"source": [
1252+
'json11/json11.cpp',
1253+
],
1254+
},
12411255
}
12421256

12431257

12441258
for targetname, params in libs_config.items():
12451259
target_env = env_base.Clone();
12461260
target_env.Replace(CPPPATH = params["include"])
12471261
target_env.Library(target = targetname, source = params["source"])
1248-

deps/json11/.gitignore

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# generated files
2+
test
3+
libjson11.a
4+
json11.pc
5+
6+
# Cmake
7+
CMakeCache.txt
8+
CTestTestfile.cmake
9+
CMakeFiles
10+
CMakeScripts
11+
cmake_install.cmake
12+
install_manifest.txt

deps/json11/CMakeLists.txt

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
cmake_minimum_required(VERSION 3.2)
2+
project(json11 VERSION 1.0.0 LANGUAGES CXX)
3+
4+
enable_testing()
5+
6+
option(JSON11_BUILD_TESTS "Build unit tests" ON)
7+
8+
add_library(json11 json11.cpp)
9+
target_include_directories(json11 PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
10+
target_compile_options(json11
11+
PUBLIC -std=c++11
12+
PRIVATE -fno-rtti -fno-exceptions -Wall -Wextra -Werror)
13+
configure_file("json11.pc.in" "json11.pc" @ONLY)
14+
15+
if (JSON11_BUILD_TESTS)
16+
add_executable(json11_test test.cpp)
17+
target_link_libraries(json11_test json11)
18+
endif()
19+
20+
install(TARGETS json11 DESTINATION lib)
21+
install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/json11.hpp" DESTINATION include)
22+
install(FILES "${CMAKE_BINARY_DIR}/json11.pc" DESTINATION lib/pkgconfig)

deps/json11/LICENSE.txt

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
Copyright (c) 2013 Dropbox, Inc.
2+
3+
Permission is hereby granted, free of charge, to any person obtaining a copy
4+
of this software and associated documentation files (the "Software"), to deal
5+
in the Software without restriction, including without limitation the rights
6+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7+
copies of the Software, and to permit persons to whom the Software is
8+
furnished to do so, subject to the following conditions:
9+
10+
The above copyright notice and this permission notice shall be included in
11+
all copies or substantial portions of the Software.
12+
13+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19+
THE SOFTWARE.

deps/json11/Makefile

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Environment variable to enable or disable code which demonstrates the behavior change
2+
# in Xcode 7 / Clang 3.7, introduced by DR1467 and described here:
3+
# https://llvm.org/bugs/show_bug.cgi?id=23812
4+
# Defaults to on in order to act as a warning to anyone who's unaware of the issue.
5+
ifneq ($(JSON11_ENABLE_DR1467_CANARY),)
6+
CANARY_ARGS = -DJSON11_ENABLE_DR1467_CANARY=$(JSON11_ENABLE_DR1467_CANARY)
7+
endif
8+
9+
test: json11.cpp json11.hpp test.cpp
10+
$(CXX) $(CANARY_ARGS) -O -std=c++11 json11.cpp test.cpp -o test -fno-rtti -fno-exceptions
11+
12+
clean:
13+
if [ -e test ]; then rm test; fi
14+
15+
.PHONY: clean

deps/json11/README.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
json11
2+
------
3+
4+
json11 is a tiny JSON library for C++11, providing JSON parsing and serialization.
5+
6+
The core object provided by the library is json11::Json. A Json object represents any JSON
7+
value: null, bool, number (int or double), string (std::string), array (std::vector), or
8+
object (std::map).
9+
10+
Json objects act like values. They can be assigned, copied, moved, compared for equality or
11+
order, and so on. There are also helper methods Json::dump, to serialize a Json to a string, and
12+
Json::parse (static) to parse a std::string as a Json object.
13+
14+
It's easy to make a JSON object with C++11's new initializer syntax:
15+
16+
Json my_json = Json::object {
17+
{ "key1", "value1" },
18+
{ "key2", false },
19+
{ "key3", Json::array { 1, 2, 3 } },
20+
};
21+
std::string json_str = my_json.dump();
22+
23+
There are also implicit constructors that allow standard and user-defined types to be
24+
automatically converted to JSON. For example:
25+
26+
class Point {
27+
public:
28+
int x;
29+
int y;
30+
Point (int x, int y) : x(x), y(y) {}
31+
Json to_json() const { return Json::array { x, y }; }
32+
};
33+
34+
std::vector<Point> points = { { 1, 2 }, { 10, 20 }, { 100, 200 } };
35+
std::string points_json = Json(points).dump();
36+
37+
JSON values can have their values queried and inspected:
38+
39+
Json json = Json::array { Json::object { { "k", "v" } } };
40+
std::string str = json[0]["k"].string_value();
41+
42+
More documentation is still to come. For now, see json11.hpp.

0 commit comments

Comments
 (0)