Make CodeStubAssemblerTester use its own zone instead of Isolate::runtime_zone().
... to ensure that the zone is properly shut down. Review-Url: https://codereview.chromium.org/2034463003 Cr-Commit-Position: refs/heads/master@{#36684}
This commit is contained in:
parent
5a5c115efd
commit
e7d8279a14
@ -12,18 +12,31 @@ namespace internal {
|
||||
using compiler::FunctionTester;
|
||||
using compiler::Node;
|
||||
|
||||
class CodeStubAssemblerTester : public CodeStubAssembler {
|
||||
class ZoneHolder {
|
||||
public:
|
||||
explicit ZoneHolder(Isolate* isolate) : zone_(isolate->allocator()) {}
|
||||
Zone* zone() { return &zone_; }
|
||||
|
||||
private:
|
||||
Zone zone_;
|
||||
};
|
||||
|
||||
// Inherit from ZoneHolder in order to create a zone that can be passed to
|
||||
// CodeStubAssembler base class constructor.
|
||||
class CodeStubAssemblerTester : private ZoneHolder, public CodeStubAssembler {
|
||||
public:
|
||||
// Test generating code for a stub.
|
||||
CodeStubAssemblerTester(Isolate* isolate,
|
||||
const CallInterfaceDescriptor& descriptor)
|
||||
: CodeStubAssembler(isolate, isolate->runtime_zone(), descriptor,
|
||||
: ZoneHolder(isolate),
|
||||
CodeStubAssembler(isolate, ZoneHolder::zone(), descriptor,
|
||||
Code::ComputeFlags(Code::STUB), "test"),
|
||||
scope_(isolate) {}
|
||||
|
||||
// Test generating code for a JS function (e.g. builtins).
|
||||
CodeStubAssemblerTester(Isolate* isolate, int parameter_count)
|
||||
: CodeStubAssembler(isolate, isolate->runtime_zone(), parameter_count,
|
||||
: ZoneHolder(isolate),
|
||||
CodeStubAssembler(isolate, ZoneHolder::zone(), parameter_count,
|
||||
Code::ComputeFlags(Code::FUNCTION), "test"),
|
||||
scope_(isolate) {}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user