Commit e7d8279a authored by ishell's avatar ishell Committed by Commit bot

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}
parent 5a5c115e
......@@ -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) {}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment