[turbofan] Put some tests under a canonical handle scope.
The heap broker expects that handles get canonicalized. R=jarin@chromium.org Bug: v8:7790 Change-Id: If6162316bb2a256e783a8175ac7d4172d040b28b Reviewed-on: https://chromium-review.googlesource.com/1155123 Commit-Queue: Georg Neis <neis@chromium.org> Reviewed-by: Jaroslav Sevcik <jarin@chromium.org> Cr-Commit-Position: refs/heads/master@{#54823}
This commit is contained in:
parent
c26c333819
commit
bb9cf1cb03
@ -193,9 +193,7 @@ double MutableHeapNumberRef::value() const {
|
||||
}
|
||||
|
||||
bool ObjectRef::equals(const ObjectRef& other) const {
|
||||
// TODO(neis): Change this to "data_ == other.data_" once the canonical handle
|
||||
// scopes are fixed in tests.
|
||||
return data_->object.equals(other.data_->object);
|
||||
return data_ == other.data_;
|
||||
}
|
||||
|
||||
StringRef ObjectRef::TypeOf() const {
|
||||
@ -309,16 +307,7 @@ void JSHeapBroker::AddData(Handle<Object> object, ObjectData* data) {
|
||||
object->ShortPrint();
|
||||
PrintF(")\n");
|
||||
}
|
||||
if (isolate()->handle_scope_data()->canonical_scope == nullptr) {
|
||||
// TODO(neis): Change the tests to always have canonical handle scopes.
|
||||
CHECK_EQ(mode(), kDisabled);
|
||||
if (FLAG_trace_heap_broker) {
|
||||
PrintF(
|
||||
"... but not remembering it because there's no canonical handle "
|
||||
"scope\n");
|
||||
}
|
||||
return;
|
||||
}
|
||||
CHECK_NOT_NULL(isolate()->handle_scope_data()->canonical_scope);
|
||||
CHECK(refs_.insert({object.address(), data}).second);
|
||||
}
|
||||
|
||||
|
@ -21,6 +21,7 @@ namespace compiler {
|
||||
|
||||
FunctionTester::FunctionTester(const char* source, uint32_t flags)
|
||||
: isolate(main_isolate()),
|
||||
canonical(isolate),
|
||||
function((FLAG_allow_natives_syntax = true, NewFunction(source))),
|
||||
flags_(flags) {
|
||||
Compile(function);
|
||||
@ -30,6 +31,7 @@ FunctionTester::FunctionTester(const char* source, uint32_t flags)
|
||||
|
||||
FunctionTester::FunctionTester(Graph* graph, int param_count)
|
||||
: isolate(main_isolate()),
|
||||
canonical(isolate),
|
||||
function(NewFunction(BuildFunction(param_count).c_str())),
|
||||
flags_(0) {
|
||||
CompileGraph(graph);
|
||||
@ -37,6 +39,7 @@ FunctionTester::FunctionTester(Graph* graph, int param_count)
|
||||
|
||||
FunctionTester::FunctionTester(Handle<Code> code, int param_count)
|
||||
: isolate(main_isolate()),
|
||||
canonical(isolate),
|
||||
function((FLAG_allow_natives_syntax = true,
|
||||
NewFunction(BuildFunction(param_count).c_str()))),
|
||||
flags_(0) {
|
||||
|
@ -31,6 +31,7 @@ class FunctionTester : public InitializedHandleScope {
|
||||
explicit FunctionTester(Handle<Code> code);
|
||||
|
||||
Isolate* isolate;
|
||||
CanonicalHandleScope canonical;
|
||||
Handle<JSFunction> function;
|
||||
|
||||
MaybeHandle<Object> Call() {
|
||||
|
@ -22,7 +22,8 @@ namespace compiler {
|
||||
class ContextSpecializationTester : public HandleAndZoneScope {
|
||||
public:
|
||||
explicit ContextSpecializationTester(Maybe<OuterContext> context)
|
||||
: graph_(new (main_zone()) Graph(main_zone())),
|
||||
: canonical_(main_isolate()),
|
||||
graph_(new (main_zone()) Graph(main_zone())),
|
||||
common_(main_zone()),
|
||||
javascript_(main_zone()),
|
||||
machine_(main_zone()),
|
||||
@ -50,6 +51,7 @@ class ContextSpecializationTester : public HandleAndZoneScope {
|
||||
size_t expected_new_depth);
|
||||
|
||||
private:
|
||||
CanonicalHandleScope canonical_;
|
||||
Graph* graph_;
|
||||
CommonOperatorBuilder common_;
|
||||
JSOperatorBuilder javascript_;
|
||||
|
@ -23,6 +23,7 @@ class JSTypedLoweringTester : public HandleAndZoneScope {
|
||||
public:
|
||||
explicit JSTypedLoweringTester(int num_parameters = 0)
|
||||
: isolate(main_isolate()),
|
||||
canonical(isolate),
|
||||
js_heap_broker(isolate, main_zone()),
|
||||
binop(nullptr),
|
||||
unop(nullptr),
|
||||
@ -39,6 +40,7 @@ class JSTypedLoweringTester : public HandleAndZoneScope {
|
||||
}
|
||||
|
||||
Isolate* isolate;
|
||||
CanonicalHandleScope canonical;
|
||||
JSHeapBroker js_heap_broker;
|
||||
const Operator* binop;
|
||||
const Operator* unop;
|
||||
|
@ -128,6 +128,7 @@ CallDescriptor* CreateDescriptorForStackArguments(Zone* zone,
|
||||
void TestHelper(int n, int m, bool tail) {
|
||||
HandleAndZoneScope scope;
|
||||
Isolate* isolate = scope.main_isolate();
|
||||
CanonicalHandleScope canonical(isolate);
|
||||
Zone* zone = scope.main_zone();
|
||||
CallDescriptor* caller_descriptor =
|
||||
CreateDescriptorForStackArguments(zone, n);
|
||||
|
@ -108,6 +108,7 @@ CallDescriptor* CreateDescriptorForStackArguments(Zone* zone,
|
||||
void TestHelper(int n, int m) {
|
||||
HandleAndZoneScope scope;
|
||||
Isolate* isolate = scope.main_isolate();
|
||||
CanonicalHandleScope canonical(isolate);
|
||||
Zone* zone = scope.main_zone();
|
||||
CallDescriptor* caller_descriptor =
|
||||
CreateDescriptorForStackArguments(zone, n);
|
||||
|
@ -33,12 +33,14 @@ struct Tests {
|
||||
|
||||
Isolate* isolate;
|
||||
HandleScope scope;
|
||||
CanonicalHandleScope canonical;
|
||||
Zone zone;
|
||||
Types T;
|
||||
|
||||
Tests()
|
||||
: isolate(CcTest::InitIsolateOnce()),
|
||||
scope(isolate),
|
||||
canonical(isolate),
|
||||
zone(isolate->allocator(), ZONE_NAME),
|
||||
T(&zone, isolate, isolate->random_number_generator()) {}
|
||||
|
||||
|
@ -16,6 +16,7 @@ namespace compiler {
|
||||
GraphTest::GraphTest(int num_parameters)
|
||||
: TestWithNativeContext(),
|
||||
TestWithIsolateAndZone(),
|
||||
canonical_(isolate()),
|
||||
common_(zone()),
|
||||
graph_(zone()),
|
||||
js_heap_broker_(isolate(), zone()),
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include "src/compiler/graph.h"
|
||||
#include "src/compiler/node-origin-table.h"
|
||||
#include "src/compiler/typer.h"
|
||||
#include "src/handles.h"
|
||||
#include "test/unittests/test-utils.h"
|
||||
#include "testing/gmock/include/gmock/gmock.h"
|
||||
|
||||
@ -17,8 +18,6 @@ namespace v8 {
|
||||
namespace internal {
|
||||
|
||||
// Forward declarations.
|
||||
template <class T>
|
||||
class Handle;
|
||||
class HeapObject;
|
||||
|
||||
namespace compiler {
|
||||
@ -65,6 +64,7 @@ class GraphTest : public virtual TestWithNativeContext,
|
||||
JSHeapBroker* js_heap_broker() { return &js_heap_broker_; }
|
||||
|
||||
private:
|
||||
CanonicalHandleScope canonical_;
|
||||
CommonOperatorBuilder common_;
|
||||
Graph graph_;
|
||||
JSHeapBroker js_heap_broker_;
|
||||
|
Loading…
Reference in New Issue
Block a user