Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(431)

Side by Side Diff: test/cctest/interpreter/test-bytecode-generator.cc

Issue 2393453003: [interpreter] Add some bytecode tests for modules. (Closed)
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « test/cctest/interpreter/generate-bytecode-expectations.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/interpreter/bytecode-array-iterator.h" 9 #include "src/interpreter/bytecode-array-iterator.h"
10 #include "src/interpreter/bytecode-generator.h" 10 #include "src/interpreter/bytecode-generator.h"
(...skipping 2185 matching lines...) Expand 10 before | Expand all | Expand 10 after
2196 "f();\n", 2196 "f();\n",
2197 2197
2198 "function* f() { for (let x of [42]) yield x }\n" 2198 "function* f() { for (let x of [42]) yield x }\n"
2199 "f();\n", 2199 "f();\n",
2200 }; 2200 };
2201 2201
2202 CHECK(CompareTexts(BuildActual(printer, snippets), 2202 CHECK(CompareTexts(BuildActual(printer, snippets),
2203 LoadGolden("Generators.golden"))); 2203 LoadGolden("Generators.golden")));
2204 } 2204 }
2205 2205
2206 TEST(Modules) {
2207 InitializedIgnitionHandleScope scope;
2208 BytecodeExpectationsPrinter printer(CcTest::isolate());
2209 printer.set_wrap(false);
2210 printer.set_module(true);
2211 printer.set_top_level(true);
2212
2213 const char* snippets[] = {
2214 "import \"bar\";\n",
2215
2216 "import {foo} from \"bar\";\n",
2217
2218 "import {foo as goo} from \"bar\";\n"
2219 "goo(42);\n"
2220 "{ let x; { goo(42) } };\n",
2221
2222 "export var foo = 42;\n"
2223 "foo++;\n"
2224 "{ let x; { foo++ } };\n",
2225
2226 "export let foo = 42;\n"
2227 "foo++;\n"
2228 "{ let x; { foo++ } };\n",
2229
2230 "export const foo = 42;\n"
2231 "foo++;\n"
2232 "{ let x; { foo++ } };\n",
2233
2234 "export default (function () {});\n",
2235
2236 "export default (class {});\n",
2237
2238 "export {foo as goo} from \"bar\"\n",
2239
2240 "export * from \"bar\"\n",
2241 };
2242
2243 CHECK(CompareTexts(BuildActual(printer, snippets),
2244 LoadGolden("Modules.golden")));
2245 }
2246
2206 } // namespace interpreter 2247 } // namespace interpreter
2207 } // namespace internal 2248 } // namespace internal
2208 } // namespace v8 2249 } // namespace v8
OLDNEW
« no previous file with comments | « test/cctest/interpreter/generate-bytecode-expectations.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698