@@ -104,6 +104,31 @@ $cache_data = null;
104
104
$ helper ->line ();
105
105
}
106
106
107
+ {
108
+ $ helper ->header ('Test generating full code cache ' );
109
+ $ source_string = new V8 \StringValue ($ isolate , '"test " + status ' );
110
+ $ source = new \V8 \ScriptCompiler \Source ($ source_string );
111
+ $ helper ->assert ('Source cache data is NULL ' , $ source ->getCachedData () === null );
112
+ $ script = V8 \ScriptCompiler::compile ($ context , $ source , V8 \ScriptCompiler::OPTION_PRODUCE_FULL_CODE_CACHE );
113
+ $ helper ->assert ('Source cache data is update ' , $ source ->getCachedData () != null );
114
+ $ helper ->assert ('Source cache data is not rejected ' , $ source ->getCachedData ()->isRejected () === false );
115
+
116
+ $ cache_data = $ source ->getCachedData ();
117
+ $ helper ->line ();
118
+ }
119
+
120
+ {
121
+ $ helper ->header ('Test consuming full code cache ' );
122
+
123
+ $ source = new \V8 \ScriptCompiler \Source ($ source_string , null , $ cache_data );
124
+ $ helper ->assert ('Source cache data is set ' , $ source ->getCachedData () != null );
125
+ $ script = V8 \ScriptCompiler::compile ($ context , $ source , V8 \ScriptCompiler::OPTION_CONSUME_CODE_CACHE );
126
+ $ helper ->assert ('Source cache data is still set ' , $ source ->getCachedData () != null );
127
+ $ helper ->assert ('Source cache data is not rejected ' , $ source ->getCachedData ()->isRejected () === false );
128
+
129
+ $ helper ->line ();
130
+ }
131
+
107
132
{
108
133
$ helper ->header ('Test consuming code cache for wrong source ' );
109
134
$ source_string = new V8 \StringValue ($ isolate , '"other " + status ' );
@@ -292,6 +317,18 @@ Source cache data is set: ok
292
317
Source cache data is still set: ok
293
318
Source cache data is not rejected: ok
294
319
320
+ Test generating full code cache:
321
+ --------------------------------
322
+ Source cache data is NULL: ok
323
+ Source cache data is update: ok
324
+ Source cache data is not rejected: ok
325
+
326
+ Test consuming full code cache:
327
+ -------------------------------
328
+ Source cache data is set: ok
329
+ Source cache data is still set: ok
330
+ Source cache data is not rejected: ok
331
+
295
332
Test consuming code cache for wrong source:
296
333
-------------------------------------------
297
334
Source cache data is set: ok
0 commit comments