OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <utility> | 5 #include <utility> |
6 | 6 |
7 #include "src/compiler/pipeline.h" | 7 #include "src/compiler/pipeline.h" |
8 #include "src/execution.h" | 8 #include "src/execution.h" |
9 #include "src/handles.h" | 9 #include "src/handles.h" |
10 #include "src/interpreter/bytecode-array-builder.h" | 10 #include "src/interpreter/bytecode-array-builder.h" |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 | 72 |
73 class BytecodeGraphTester { | 73 class BytecodeGraphTester { |
74 public: | 74 public: |
75 BytecodeGraphTester(Isolate* isolate, Zone* zone, const char* script, | 75 BytecodeGraphTester(Isolate* isolate, Zone* zone, const char* script, |
76 const char* filter = kFunctionName) | 76 const char* filter = kFunctionName) |
77 : isolate_(isolate), zone_(zone), script_(script) { | 77 : isolate_(isolate), zone_(zone), script_(script) { |
78 i::FLAG_ignition = true; | 78 i::FLAG_ignition = true; |
79 i::FLAG_always_opt = false; | 79 i::FLAG_always_opt = false; |
80 i::FLAG_allow_natives_syntax = true; | 80 i::FLAG_allow_natives_syntax = true; |
81 i::FLAG_loop_assignment_analysis = false; | 81 i::FLAG_loop_assignment_analysis = false; |
82 // Set ignition filter flag via SetFlagsFromString to avoid double-free | |
83 // (or potential leak with StrDup() based on ownership confusion). | |
84 ScopedVector<char> ignition_filter(64); | |
85 SNPrintF(ignition_filter, "--ignition-filter=%s", filter); | |
86 FlagList::SetFlagsFromString(ignition_filter.start(), | |
87 ignition_filter.length()); | |
88 // Ensure handler table is generated. | 82 // Ensure handler table is generated. |
89 isolate->interpreter()->Initialize(); | 83 isolate->interpreter()->Initialize(); |
90 } | 84 } |
91 virtual ~BytecodeGraphTester() {} | 85 virtual ~BytecodeGraphTester() {} |
92 | 86 |
93 template <class... A> | 87 template <class... A> |
94 BytecodeGraphCallable<A...> GetCallable( | 88 BytecodeGraphCallable<A...> GetCallable( |
95 const char* functionName = kFunctionName) { | 89 const char* functionName = kFunctionName) { |
96 return BytecodeGraphCallable<A...>(isolate_, GetFunction(functionName)); | 90 return BytecodeGraphCallable<A...>(isolate_, GetFunction(functionName)); |
97 } | 91 } |
(...skipping 2899 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2997 | 2991 |
2998 BytecodeGraphTester tester(isolate, zone, script.start()); | 2992 BytecodeGraphTester tester(isolate, zone, script.start()); |
2999 auto callable = tester.GetCallable<>(); | 2993 auto callable = tester.GetCallable<>(); |
3000 Handle<Object> return_value = callable().ToHandleChecked(); | 2994 Handle<Object> return_value = callable().ToHandleChecked(); |
3001 CHECK(return_value->SameValue(*snippet.return_value())); | 2995 CHECK(return_value->SameValue(*snippet.return_value())); |
3002 } | 2996 } |
3003 | 2997 |
3004 } // namespace compiler | 2998 } // namespace compiler |
3005 } // namespace internal | 2999 } // namespace internal |
3006 } // namespace v8 | 3000 } // namespace v8 |
OLD | NEW |