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 <fstream> | 5 #include <fstream> |
6 | 6 |
7 #include "src/v8.h" | 7 #include "src/v8.h" |
8 | 8 |
9 #include "src/compiler.h" | 9 #include "src/compiler.h" |
10 #include "src/interpreter/bytecode-array-iterator.h" | 10 #include "src/interpreter/bytecode-array-iterator.h" |
(...skipping 2131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2142 " constructor() { super(); this.y_ = 2; }\n" | 2142 " constructor() { super(); this.y_ = 2; }\n" |
2143 " }\n" | 2143 " }\n" |
2144 " test = new B().constructor;\n" | 2144 " test = new B().constructor;\n" |
2145 "})();\n", | 2145 "})();\n", |
2146 }; | 2146 }; |
2147 | 2147 |
2148 CHECK_EQ(BuildActual(printer, snippets), | 2148 CHECK_EQ(BuildActual(printer, snippets), |
2149 LoadGolden("ClassAndSuperClass.golden")); | 2149 LoadGolden("ClassAndSuperClass.golden")); |
2150 } | 2150 } |
2151 | 2151 |
| 2152 TEST(Generators) { |
| 2153 bool old_flag = FLAG_ignition_generators; |
| 2154 FLAG_ignition_generators = true; |
| 2155 |
| 2156 InitializedIgnitionHandleScope scope; |
| 2157 BytecodeExpectationsPrinter printer(CcTest::isolate(), |
| 2158 ConstantPoolType::kMixed); |
| 2159 printer.set_wrap(false); |
| 2160 printer.set_test_function_name("f"); |
| 2161 |
| 2162 const char* snippets[] = { |
| 2163 "function* f() { }", |
| 2164 |
| 2165 "function* f() { yield 42 }", |
| 2166 |
| 2167 "function* f() { for (let x of [42]) yield x }", |
| 2168 }; |
| 2169 |
| 2170 CHECK_EQ(BuildActual(printer, snippets), LoadGolden("Generators.golden")); |
| 2171 |
| 2172 FLAG_ignition_generators = old_flag; |
| 2173 } |
| 2174 |
2152 } // namespace interpreter | 2175 } // namespace interpreter |
2153 } // namespace internal | 2176 } // namespace internal |
2154 } // namespace v8 | 2177 } // namespace v8 |
OLD | NEW |