Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Mar 29, 2024. It is now read-only.

Commit 45e0cf7

Browse files
committed
Remove deprecated and non-working script cache options, closes #99
1 parent 17bbe95 commit 45e0cf7

File tree

5 files changed

+4
-515
lines changed

5 files changed

+4
-515
lines changed

‎src/php_v8_script_compiler.cc

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -349,10 +349,6 @@ PHP_MINIT_FUNCTION(php_v8_script_compiler)
349349
this_ce = zend_register_internal_class(&ce);
350350

351351
zend_declare_class_constant_long(this_ce, ZEND_STRL("OPTION_NO_COMPILE_OPTIONS"), static_cast<zend_long>(v8::ScriptCompiler::CompileOptions::kNoCompileOptions));
352-
zend_declare_class_constant_long(this_ce, ZEND_STRL("OPTION_PRODUCE_PARSER_CACHE"), static_cast<zend_long>(v8::ScriptCompiler::CompileOptions::kProduceParserCache));
353-
zend_declare_class_constant_long(this_ce, ZEND_STRL("OPTION_CONSUME_PARSER_CACHE"), static_cast<zend_long>(v8::ScriptCompiler::CompileOptions::kConsumeParserCache));
354-
zend_declare_class_constant_long(this_ce, ZEND_STRL("OPTION_PRODUCE_CODE_CACHE"), static_cast<zend_long>(v8::ScriptCompiler::CompileOptions::kProduceCodeCache));
355-
zend_declare_class_constant_long(this_ce, ZEND_STRL("OPTION_PRODUCE_FULL_CODE_CACHE"), static_cast<zend_long>(v8::ScriptCompiler::CompileOptions::kProduceFullCodeCache));
356352
zend_declare_class_constant_long(this_ce, ZEND_STRL("OPTION_CONSUME_CODE_CACHE"), static_cast<zend_long>(v8::ScriptCompiler::CompileOptions::kConsumeCodeCache));
357353
zend_declare_class_constant_long(this_ce, ZEND_STRL("OPTION_EAGER_COMPILE"), static_cast<zend_long>(v8::ScriptCompiler::CompileOptions::kEagerCompile));
358354

‎stubs/src/ScriptCompiler.php

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,9 @@
2525
*/
2626
class ScriptCompiler
2727
{
28-
const OPTION_NO_COMPILE_OPTIONS = 0;
29-
const OPTION_PRODUCE_PARSER_CACHE = 1;
30-
const OPTION_CONSUME_PARSER_CACHE = 2;
31-
const OPTION_PRODUCE_CODE_CACHE = 3;
32-
const OPTION_PRODUCE_FULL_CODE_CACHE = 4;
33-
const OPTION_CONSUME_CODE_CACHE = 5;
34-
const OPTION_EAGER_COMPILE = 6;
28+
const OPTION_NO_COMPILE_OPTIONS = 0;
29+
const OPTION_CONSUME_CODE_CACHE = 5;
30+
const OPTION_EAGER_COMPILE = 6;
3531

3632
private function __construct()
3733
{

‎tests/001-verify_extension_entities.phpt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -406,10 +406,6 @@ class V8\ScriptCompiler\Source
406406

407407
class V8\ScriptCompiler
408408
const OPTION_NO_COMPILE_OPTIONS = 0
409-
const OPTION_PRODUCE_PARSER_CACHE = 1
410-
const OPTION_CONSUME_PARSER_CACHE = 2
411-
const OPTION_PRODUCE_CODE_CACHE = 3
412-
const OPTION_PRODUCE_FULL_CODE_CACHE = 4
413409
const OPTION_CONSUME_CODE_CACHE = 5
414410
const OPTION_EAGER_COMPILE = 6
415411
public static function getCachedDataVersionTag(): float

‎tests/ScriptCompiler_compile.phpt

Lines changed: 1 addition & 296 deletions
Original file line numberDiff line numberDiff line change
@@ -71,219 +71,12 @@ $cache_data = null;
7171
$source = new \V8\ScriptCompiler\Source($source_string);
7272
$helper->assert('Source cache data is not set', $source->getCachedData() === null);
7373
try {
74-
$script = V8\ScriptCompiler::compile($context, $source, V8\ScriptCompiler::OPTION_CONSUME_PARSER_CACHE);
74+
$script = V8\ScriptCompiler::compile($context, $source, V8\ScriptCompiler::OPTION_CONSUME_CODE_CACHE);
7575
} catch (\V8\Exceptions\Exception $e) {
7676
$helper->exception_export($e);
7777
}
7878
}
7979

80-
{
81-
$helper->header('Test generating code cache');
82-
$source_string = new V8\StringValue($isolate, '"test " + status');
83-
$source = new \V8\ScriptCompiler\Source($source_string);
84-
$helper->assert('Source cache data is NULL', $source->getCachedData() === null);
85-
$script = V8\ScriptCompiler::compile($context, $source, V8\ScriptCompiler::OPTION_PRODUCE_CODE_CACHE);
86-
$helper->assert('Source cache data is update', $source->getCachedData() != null);
87-
$helper->assert('Source cache data is not rejected', $source->getCachedData()->isRejected() === false);
88-
89-
$cache_data = $source->getCachedData();
90-
$helper->line();
91-
}
92-
93-
{
94-
$helper->header('Test consuming code cache');
95-
96-
$source = new \V8\ScriptCompiler\Source($source_string, null, $cache_data);
97-
$helper->assert('Source cache data is set', $source->getCachedData() != null);
98-
$script = V8\ScriptCompiler::compile($context, $source, V8\ScriptCompiler::OPTION_CONSUME_CODE_CACHE);
99-
$helper->assert('Source cache data is still set', $source->getCachedData() != null);
100-
$helper->assert('Source cache data is not rejected', $source->getCachedData()->isRejected() === false);
101-
102-
$helper->line();
103-
}
104-
105-
{
106-
$helper->header('Test generating full code cache');
107-
$source_string = new V8\StringValue($isolate, '"test " + status');
108-
$source = new \V8\ScriptCompiler\Source($source_string);
109-
$helper->assert('Source cache data is NULL', $source->getCachedData() === null);
110-
$script = V8\ScriptCompiler::compile($context, $source, V8\ScriptCompiler::OPTION_PRODUCE_FULL_CODE_CACHE);
111-
$helper->assert('Source cache data is update', $source->getCachedData() != null);
112-
$helper->assert('Source cache data is not rejected', $source->getCachedData()->isRejected() === false);
113-
114-
$cache_data = $source->getCachedData();
115-
$helper->line();
116-
}
117-
118-
{
119-
$helper->header('Test consuming full code cache');
120-
121-
$source = new \V8\ScriptCompiler\Source($source_string, null, $cache_data);
122-
$helper->assert('Source cache data is set', $source->getCachedData() != null);
123-
$script = V8\ScriptCompiler::compile($context, $source, V8\ScriptCompiler::OPTION_CONSUME_CODE_CACHE);
124-
$helper->assert('Source cache data is still set', $source->getCachedData() != null);
125-
$helper->assert('Source cache data is not rejected', $source->getCachedData()->isRejected() === false);
126-
127-
$helper->line();
128-
}
129-
130-
{
131-
$helper->header('Test consuming code cache for wrong source');
132-
$source_string = new V8\StringValue($isolate, '"other " + status');
133-
$source = new \V8\ScriptCompiler\Source($source_string, null, $cache_data);
134-
$helper->assert('Source cache data is set', $source->getCachedData() != null);
135-
$script = V8\ScriptCompiler::compile($context, $source, V8\ScriptCompiler::OPTION_CONSUME_CODE_CACHE);
136-
$helper->assert('Source cache data is still set', $source->getCachedData() != null);
137-
$helper->assert('Source cache data is rejected', $source->getCachedData()->isRejected() === true);
138-
139-
$helper->line();
140-
}
141-
142-
{
143-
$helper->header('Test consuming code cache for source with different formatting');
144-
$source_string = new V8\StringValue($isolate, ' "test " + status');
145-
$source = new \V8\ScriptCompiler\Source($source_string, null, $cache_data);
146-
$helper->assert('Source cache data is set', $source->getCachedData() != null);
147-
$script = V8\ScriptCompiler::compile($context, $source, V8\ScriptCompiler::OPTION_CONSUME_CODE_CACHE);
148-
$helper->assert('Source cache data is still set', $source->getCachedData() != null);
149-
$helper->assert('Source cache data is not rejected', $source->getCachedData()->isRejected() !== false);
150-
151-
$helper->line();
152-
}
153-
154-
{
155-
$helper->header('Test generating code cache when it already set');
156-
$source_string = new V8\StringValue($isolate, '"test " + status');
157-
$source = new \V8\ScriptCompiler\Source($source_string, null, $cache_data);
158-
$helper->assert('Source cache data is set', $source->getCachedData() != null);
159-
$script = V8\ScriptCompiler::compile($context, $source, V8\ScriptCompiler::OPTION_PRODUCE_CODE_CACHE);
160-
$helper->assert('Source cache data is still set', $source->getCachedData() != null);
161-
$helper->assert('Source cache data is rejected', $source->getCachedData()->isRejected() === true);
162-
163-
$helper->line();
164-
}
165-
166-
{
167-
$helper->header('Test consuming code cache when requesting parser cache');
168-
169-
$source_string = new V8\StringValue($isolate, '"test " + status');
170-
$source = new \V8\ScriptCompiler\Source($source_string, null, $cache_data);
171-
$helper->assert('Source cache data is set', $source->getCachedData() != null);
172-
$script = V8\ScriptCompiler::compile($context, $source, V8\ScriptCompiler::OPTION_CONSUME_PARSER_CACHE);
173-
$helper->assert('Source cache data is still set', $source->getCachedData() != null);
174-
$helper->assert('Source cache data is not rejected', $source->getCachedData()->isRejected() !== true);
175-
176-
$helper->line();
177-
}
178-
179-
{
180-
$helper->header('Test parser cache generated not for for all code');
181-
182-
$source_string = new V8\StringValue($isolate, '"test " + status');
183-
$source = new \V8\ScriptCompiler\Source($source_string);
184-
$helper->assert('Source cache data is NULL', $source->getCachedData() === null);
185-
$script = V8\ScriptCompiler::compile($context, $source, V8\ScriptCompiler::OPTION_PRODUCE_PARSER_CACHE);
186-
$helper->assert('Source cache data is NOT updated', $source->getCachedData() === null);
187-
188-
$helper->line();
189-
}
190-
191-
$parser_cache_src= 'function test(arg1, args) {
192-
if (arg1 > arg2) {
193-
return 1+1;
194-
} else {
195-
return arg1 + arg2;
196-
}
197-
}';
198-
199-
{
200-
$helper->header('Test generating parser cache');
201-
202-
$source_string = new V8\StringValue($isolate, $parser_cache_src);
203-
$source = new \V8\ScriptCompiler\Source($source_string);
204-
$helper->assert('Source cache data is NULL', $source->getCachedData() === null);
205-
$script = V8\ScriptCompiler::compile($context, $source, V8\ScriptCompiler::OPTION_PRODUCE_PARSER_CACHE);
206-
$helper->assert('Source cache data is update', $source->getCachedData() != null);
207-
$helper->assert('Source cache data is not rejected', $source->getCachedData()->isRejected() === false);
208-
209-
$cache_data = $source->getCachedData();
210-
211-
//$helper->dump($cache_data->getData());
212-
$helper->line();
213-
}
214-
215-
{
216-
$helper->header('Test consuming parser cache');
217-
218-
$source_string = new V8\StringValue($isolate, $parser_cache_src);
219-
$source = new \V8\ScriptCompiler\Source($source_string, null, $cache_data);
220-
$helper->assert('Source cache data is set', $source->getCachedData() != null);
221-
$script = V8\ScriptCompiler::compile($context, $source, V8\ScriptCompiler::OPTION_CONSUME_PARSER_CACHE);
222-
$helper->assert('Source cache data is still set', $source->getCachedData() != null);
223-
$helper->assert('Source cache data is not rejected', $source->getCachedData()->isRejected() === false);
224-
225-
$helper->line();
226-
}
227-
228-
{
229-
$helper->header('Test consuming parser cache on different source (function with the same name)');
230-
231-
$bin = $cache_data->getData();
232-
$source_string = new V8\StringValue($isolate, 'function test() { return 1+1;}');
233-
$source = new \V8\ScriptCompiler\Source($source_string, null, $cache_data);
234-
$helper->assert('Source cache data is set', $source->getCachedData() != null);
235-
try {
236-
$script = V8\ScriptCompiler::compile($context, $source, V8\ScriptCompiler::OPTION_CONSUME_PARSER_CACHE);
237-
} catch (\V8\Exceptions\TryCatchException $e) {
238-
$helper->exception_export($e);
239-
}
240-
241-
$helper->line();
242-
}
243-
244-
{
245-
$helper->header('Test consuming parser cache on different source');
246-
247-
$bin = $cache_data->getData();
248-
$source_string = new V8\StringValue($isolate, 'function test2() { return 1+1;}');
249-
$source = new \V8\ScriptCompiler\Source($source_string, null, $cache_data);
250-
$helper->assert('Source cache data is set', $source->getCachedData() != null);
251-
$script = V8\ScriptCompiler::compile($context, $source, V8\ScriptCompiler::OPTION_CONSUME_PARSER_CACHE);
252-
$helper->assert('Source cache data is still set', $source->getCachedData() != null);
253-
$helper->assert('Source cache data is rejected', $source->getCachedData()->isRejected() === true);
254-
$helper->assert('Source cache data is not changed', $source->getCachedData()->getData() === $bin);
255-
256-
$helper->line();
257-
}
258-
259-
{
260-
$helper->header('Test consuming parser cache on the same source with different formatting');
261-
262-
$source_string = new V8\StringValue($isolate, '' . $parser_cache_src);
263-
$source = new \V8\ScriptCompiler\Source($source_string, null, $cache_data);
264-
$helper->assert('Source cache data is set', $source->getCachedData() != null);
265-
$script = V8\ScriptCompiler::compile($context, $source, V8\ScriptCompiler::OPTION_CONSUME_PARSER_CACHE);
266-
$helper->assert('Source cache data is still set', $source->getCachedData() != null);
267-
$helper->assert('Source cache data is rejected', $source->getCachedData()->isRejected() === true);
268-
269-
$helper->line();
270-
}
271-
272-
{
273-
$helper->header('Test consuming code cache when parser cache given');
274-
275-
$source_string = new V8\StringValue($isolate, $parser_cache_src);
276-
$source = new \V8\ScriptCompiler\Source($source_string, null, $cache_data);
277-
$helper->assert('Source cache data is set', $source->getCachedData() != null);
278-
$script = V8\ScriptCompiler::compile($context, $source, V8\ScriptCompiler::OPTION_CONSUME_CODE_CACHE);
279-
$helper->assert('Source cache data is still set', $source->getCachedData() != null);
280-
$helper->assert('Source cache data is not rejected', $source->getCachedData()->isRejected() === false);
281-
282-
$helper->line();
283-
}
284-
285-
286-
28780
?>
28881
--EXPECT--
28982
Compiling:
@@ -303,91 +96,3 @@ Test cache when no cache set:
30396
-----------------------------
30497
Source cache data is not set: ok
30598
V8\Exceptions\Exception: Unable to consume cache when it's not set
306-
Test generating code cache:
307-
---------------------------
308-
Source cache data is NULL: ok
309-
Source cache data is update: ok
310-
Source cache data is not rejected: ok
311-
312-
Test consuming code cache:
313-
--------------------------
314-
Source cache data is set: ok
315-
Source cache data is still set: ok
316-
Source cache data is not rejected: ok
317-
318-
Test generating full code cache:
319-
--------------------------------
320-
Source cache data is NULL: ok
321-
Source cache data is update: ok
322-
Source cache data is not rejected: ok
323-
324-
Test consuming full code cache:
325-
-------------------------------
326-
Source cache data is set: ok
327-
Source cache data is still set: ok
328-
Source cache data is not rejected: ok
329-
330-
Test consuming code cache for wrong source:
331-
-------------------------------------------
332-
Source cache data is set: ok
333-
Source cache data is still set: ok
334-
Source cache data is rejected: ok
335-
336-
Test consuming code cache for source with different formatting:
337-
---------------------------------------------------------------
338-
Source cache data is set: ok
339-
Source cache data is still set: ok
340-
Source cache data is not rejected: ok
341-
342-
Test generating code cache when it already set:
343-
-----------------------------------------------
344-
Source cache data is set: ok
345-
Source cache data is still set: ok
346-
Source cache data is rejected: ok
347-
348-
Test consuming code cache when requesting parser cache:
349-
-------------------------------------------------------
350-
Source cache data is set: ok
351-
Source cache data is still set: ok
352-
Source cache data is not rejected: ok
353-
354-
Test parser cache generated not for for all code:
355-
-------------------------------------------------
356-
Source cache data is NULL: ok
357-
Source cache data is NOT updated: ok
358-
359-
Test generating parser cache:
360-
-----------------------------
361-
Source cache data is NULL: ok
362-
Source cache data is update: ok
363-
Source cache data is not rejected: ok
364-
365-
Test consuming parser cache:
366-
----------------------------
367-
Source cache data is set: ok
368-
Source cache data is still set: ok
369-
Source cache data is not rejected: ok
370-
371-
Test consuming parser cache on different source (function with the same name):
372-
------------------------------------------------------------------------------
373-
Source cache data is set: ok
374-
V8\Exceptions\TryCatchException: SyntaxError: Unexpected end of input
375-
376-
Test consuming parser cache on different source:
377-
------------------------------------------------
378-
Source cache data is set: ok
379-
Source cache data is still set: ok
380-
Source cache data is rejected: ok
381-
Source cache data is not changed: ok
382-
383-
Test consuming parser cache on the same source with different formatting:
384-
-------------------------------------------------------------------------
385-
Source cache data is set: ok
386-
Source cache data is still set: ok
387-
Source cache data is rejected: ok
388-
389-
Test consuming code cache when parser cache given:
390-
--------------------------------------------------
391-
Source cache data is set: ok
392-
Source cache data is still set: ok
393-
Source cache data is not rejected: ok

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /