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

Side by Side Diff: test/cctest/compiler/code-assembler-tester.h

Issue 2072813003: [test] Move CodeAssembler tests to a separate file. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Minor cleanup Created 4 years, 6 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/cctest.gyp ('k') | test/cctest/compiler/test-code-assembler.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2016 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "src/handles.h"
6 #include "src/interface-descriptors.h"
7 #include "src/isolate.h"
8 #include "test/cctest/compiler/function-tester.h"
9
10 namespace v8 {
11 namespace internal {
12 namespace compiler {
13
14 class ZoneHolder {
15 public:
16 explicit ZoneHolder(Isolate* isolate) : zone_(isolate->allocator()) {}
17 Zone* zone() { return &zone_; }
18
19 private:
20 Zone zone_;
21 };
22
23 // Inherit from ZoneHolder in order to create a zone that can be passed to
24 // CodeAssembler base class constructor.
25 template <typename CodeAssemblerT>
26 class CodeAssemblerTesterImpl : private ZoneHolder, public CodeAssemblerT {
27 public:
28 // Test generating code for a stub.
29 CodeAssemblerTesterImpl(Isolate* isolate,
30 const CallInterfaceDescriptor& descriptor)
31 : ZoneHolder(isolate),
32 CodeAssemblerT(isolate, ZoneHolder::zone(), descriptor,
33 Code::ComputeFlags(Code::STUB), "test"),
34 scope_(isolate) {}
35
36 // Test generating code for a JS function (e.g. builtins).
37 CodeAssemblerTesterImpl(Isolate* isolate, int parameter_count)
38 : ZoneHolder(isolate),
39 CodeAssemblerT(isolate, ZoneHolder::zone(), parameter_count,
40 Code::ComputeFlags(Code::FUNCTION), "test"),
41 scope_(isolate) {}
42
43 // This constructor is intended to be used for creating code objects with
44 // specific flags.
45 CodeAssemblerTesterImpl(Isolate* isolate, Code::Flags flags)
46 : ZoneHolder(isolate),
47 CodeAssemblerT(isolate, ZoneHolder::zone(), 0, flags, "test"),
48 scope_(isolate) {}
49
50 Handle<Code> GenerateCodeCloseAndEscape() {
51 return scope_.CloseAndEscape(CodeAssemblerT::GenerateCode());
52 }
53
54 // Expose some internal methods.
55
56 Node* SmiShiftBitsConstant() {
57 return CodeAssemblerT::SmiShiftBitsConstant();
58 }
59
60 private:
61 HandleScope scope_;
62 LocalContext context_;
63 };
64
65 } // namespace compiler
66 } // namespace internal
67 } // namespace v8
OLDNEW
« no previous file with comments | « test/cctest/cctest.gyp ('k') | test/cctest/compiler/test-code-assembler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698