| 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 2839 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2937 | 2931 |
| 2938 BytecodeGraphTester tester(isolate, zone, script.start()); | 2932 BytecodeGraphTester tester(isolate, zone, script.start()); |
| 2939 auto callable = tester.GetCallable<>(); | 2933 auto callable = tester.GetCallable<>(); |
| 2940 Handle<Object> return_value = callable().ToHandleChecked(); | 2934 Handle<Object> return_value = callable().ToHandleChecked(); |
| 2941 CHECK(return_value->SameValue(*snippet.return_value())); | 2935 CHECK(return_value->SameValue(*snippet.return_value())); |
| 2942 } | 2936 } |
| 2943 | 2937 |
| 2944 } // namespace compiler | 2938 } // namespace compiler |
| 2945 } // namespace internal | 2939 } // namespace internal |
| 2946 } // namespace v8 | 2940 } // namespace v8 |
| OLD | NEW |