Skip to content

Commit 8f31398

Browse files
committed
squash! fix Temporal support
1 parent 1af9e54 commit 8f31398

2 files changed

Lines changed: 69 additions & 1 deletion

File tree

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
diff --git a/deps/v8/src/objects/js-temporal-zoneinfo64.cc b/deps/v8/src/objects/js-temporal-zoneinfo64.cc
2+
index 99dd3a84c1e..b6b399c10dc 100644
3+
--- a/deps/v8/src/objects/js-temporal-zoneinfo64.cc
4+
+++ b/deps/v8/src/objects/js-temporal-zoneinfo64.cc
5+
@@ -11,12 +11,44 @@
6+
#include "temporal_rs/TimeZone.hpp"
7+
8+
#ifdef V8_INTL_SUPPORT
9+
-#include "udatamem.h"
10+
+#include "unicode/udata.h"
11+
+typedef struct {
12+
+ uint16_t headerSize;
13+
+ uint8_t magic1;
14+
+ uint8_t magic2;
15+
+} MappedData;
16+
+typedef struct {
17+
+ MappedData dataHeader;
18+
+ UDataInfo info;
19+
+} DataHeader;
20+
+typedef struct {
21+
+ void* Lookup;
22+
+ void* NumEntries;
23+
+} commonDataFuncs;
24+
+struct UDataMemory {
25+
+ const commonDataFuncs *vFuncs; /* Function Pointers for accessing TOC */
26+
+
27+
+ const DataHeader *pHeader; /* Header of the memory being described by this */
28+
+ /* UDataMemory object. */
29+
+ const void *toc; /* For common memory, table of contents for */
30+
+ /* the pieces within. */
31+
+ UBool heapAllocated; /* True if this UDataMemory Object is on the */
32+
+ /* heap and thus needs to be deleted when closed. */
33+
+
34+
+ void *mapAddr; /* For mapped or allocated memory, the start addr. */
35+
+ /* Only non-null if a close operation should unmap */
36+
+ /* the associated data. */
37+
+ void *map; /* Handle, or other data, OS dependent. */
38+
+ /* Only non-null if a close operation should unmap */
39+
+ /* the associated data, and additional info */
40+
+ /* beyond the mapAddr is needed to do that. */
41+
+ int32_t length; /* Length of the data in bytes; -1 if unknown. */
42+
+};
43+
#else
44+
// Defined in builtins-temporal-zoneinfo64-data.cc, generated by
45+
// include-file-as-bytes.py
46+
-extern "C" uint32_t zoneinfo64_static_data[];
47+
-extern "C" size_t zoneinfo64_static_data_len;
48+
+static uint32_t zoneinfo64_static_data[] = {};
49+
+static size_t zoneinfo64_static_data_len = 0;
50+
#endif
51+
52+
namespace v8::internal {
53+
@@ -33,7 +65,7 @@ ZoneInfo64Provider::ZoneInfo64Provider() {
54+
// NOT udata_getLength: this ignores the header,
55+
// and we're parsing resb files with the header
56+
auto length = memory->length;
57+
- const void* data = udata_getRawMemory(memory);
58+
+ const void* data = udata_getMemory(memory);
59+
DCHECK_WITH_MSG(length % 4 == 0, "ICU4C should align udata to uint32_t");
60+
if (length % 4 != 0) {
61+
// This really shouldn't happen: ICU4C aligns these files
62+
--
63+
2.51.0

tools/nix/v8.nix

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,10 +87,15 @@ stdenv.mkDerivation (finalAttrs: {
8787
);
8888
};
8989

90+
patches = lib.optional (
91+
# V8 accesses internal ICU headers and methods in the Temporal files.
92+
!(builtins.isString icu) && builtins.elem "--v8-enable-temporal-support" configureFlags
93+
) ./temporal-no-vendored-icu.patch;
94+
9095
# We need to download and patch GYP to work from within Nix sandbox
9196
# and so the local pycache does not pollute the hash.
9297
prePatch = ''
93-
patches=()
98+
${lib.optionalString (builtins.length finalAttrs.patches == 0) "patches=()"}
9499
for patch in ${lib.concatStringsSep " " patches}; do
95100
filtered=$(mktemp)
96101
filterdiff -p1 -i 'tools/gyp/pylib/*' "$patch" > "$filtered"

0 commit comments

Comments
 (0)