2020-07-03 07:26:57 +00:00
|
|
|
// Copyright 2015 the V8 project authors. All rights reserved.
|
|
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
|
|
// found in the LICENSE file.
|
|
|
|
|
|
|
|
#include "src/heap/incremental-marking.h"
|
|
|
|
#include "src/heap/mark-compact.h"
|
|
|
|
#include "src/heap/spaces.h"
|
Reland "[no-wasm] Exclude src/wasm from compilation"
This is a reland of 80f5dfda0147d6b078ae6c9d0eb947bd012bf72d. A condition
in pipeline.cc was inverted, which lead to a CSA verifier error.
Original change's description:
> [no-wasm] Exclude src/wasm from compilation
>
> This is the biggest chunk, including
> - all of src/wasm,
> - torque file for wasm objects,
> - torque file for wasm builtins,
> - wasm builtins,
> - wasm runtime functions,
> - int64 lowering,
> - simd scala lowering,
> - WasmGraphBuilder (TF graph construction for wasm),
> - wasm frame types,
> - wasm interrupts,
> - the JSWasmCall opcode,
> - wasm backing store allocation.
>
> Those components are all recursively entangled, so I found no way to
> split this change up further.
>
> Some includes that were recursively included by wasm headers needed to
> be added explicitly now.
>
> backing-store-unittest.cc is renamed to wasm-backing-store-unittest.cc
> because it only tests wasm backing stores. This file is excluded from
> no-wasm builds then.
>
> R=jkummerow@chromium.org, jgruber@chromium.org, mlippautz@chromium.org, petermarshall@chromium.org
>
> Bug: v8:11238
> Change-Id: I7558f2d12d2dd6c65128c4de7b79173668c80b2b
> Cq-Include-Trybots: luci.v8.try:v8_linux64_no_wasm_compile_rel
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2742955
> Commit-Queue: Clemens Backes <clemensb@chromium.org>
> Reviewed-by: Peter Marshall <petermarshall@chromium.org>
> Reviewed-by: Toon Verwaest <verwaest@chromium.org>
> Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
> Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
> Reviewed-by: Jakob Gruber <jgruber@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#73344}
TBR=jgruber@chromium.org
Bug: v8:11238
Change-Id: I20bd2847a59c68738b5a336cd42582b7b1499585
Cq-Include-Trybots: luci.v8.try:v8_linux64_no_wasm_compile_rel
Cq-Include-Trybots: luci.v8.try:v8_linux_verify_csa_rel_ng
Cq-Include-Trybots: luci.v8.try:v8_linux64_verify_csa_rel_ng
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2752867
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Reviewed-by: Jakob Gruber <jgruber@chromium.org>
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#73348}
2021-03-11 13:42:01 +00:00
|
|
|
#include "src/objects/js-array-buffer-inl.h"
|
2020-07-03 07:26:57 +00:00
|
|
|
#include "src/objects/objects-inl.h"
|
|
|
|
#include "test/cctest/cctest.h"
|
|
|
|
#include "test/cctest/heap/heap-tester.h"
|
|
|
|
#include "test/cctest/heap/heap-utils.h"
|
|
|
|
|
|
|
|
namespace v8 {
|
|
|
|
namespace internal {
|
|
|
|
namespace heap {
|
|
|
|
|
|
|
|
HEAP_TEST(WriteBarrier_Marking) {
|
2021-04-21 00:32:15 +00:00
|
|
|
if (!FLAG_incremental_marking) return;
|
2020-07-03 07:26:57 +00:00
|
|
|
ManualGCScope manual_gc_scope;
|
|
|
|
CcTest::InitializeVM();
|
|
|
|
Isolate* isolate = CcTest::i_isolate();
|
|
|
|
Factory* factory = isolate->factory();
|
|
|
|
MarkCompactCollector* collector = isolate->heap()->mark_compact_collector();
|
|
|
|
HandleScope outer(isolate);
|
|
|
|
Handle<FixedArray> objects = factory->NewFixedArray(3);
|
2021-04-17 12:45:36 +00:00
|
|
|
v8::Global<Value> global_objects(CcTest::isolate(), Utils::ToLocal(objects));
|
2020-07-03 07:26:57 +00:00
|
|
|
{
|
|
|
|
// Make sure that these objects are not immediately reachable from
|
|
|
|
// the roots to prevent them being marked grey at the start of marking.
|
|
|
|
HandleScope inner(isolate);
|
|
|
|
Handle<FixedArray> host = factory->NewFixedArray(1);
|
|
|
|
Handle<HeapNumber> value1 = factory->NewHeapNumber(1.1);
|
|
|
|
Handle<HeapNumber> value2 = factory->NewHeapNumber(1.2);
|
|
|
|
objects->set(0, *host);
|
|
|
|
objects->set(1, *value1);
|
|
|
|
objects->set(2, *value2);
|
|
|
|
}
|
|
|
|
heap::SimulateIncrementalMarking(CcTest::heap(), false);
|
|
|
|
FixedArray host = FixedArray::cast(objects->get(0));
|
|
|
|
HeapObject value1 = HeapObject::cast(objects->get(1));
|
|
|
|
HeapObject value2 = HeapObject::cast(objects->get(2));
|
|
|
|
CHECK(collector->marking_state()->IsWhite(host));
|
|
|
|
CHECK(collector->marking_state()->IsWhite(value1));
|
|
|
|
WriteBarrier::Marking(host, host.RawFieldOfElementAt(0), value1);
|
|
|
|
CHECK_EQ(V8_CONCURRENT_MARKING_BOOL,
|
|
|
|
collector->marking_state()->IsGrey(value1));
|
|
|
|
collector->marking_state()->WhiteToGrey(host);
|
|
|
|
collector->marking_state()->GreyToBlack(host);
|
|
|
|
CHECK(collector->marking_state()->IsWhite(value2));
|
|
|
|
WriteBarrier::Marking(host, host.RawFieldOfElementAt(0), value2);
|
|
|
|
CHECK(collector->marking_state()->IsGrey(value2));
|
|
|
|
heap::SimulateIncrementalMarking(CcTest::heap(), true);
|
|
|
|
CHECK(collector->marking_state()->IsBlack(host));
|
|
|
|
CHECK(collector->marking_state()->IsBlack(value1));
|
|
|
|
CHECK(collector->marking_state()->IsBlack(value2));
|
|
|
|
}
|
|
|
|
|
|
|
|
HEAP_TEST(WriteBarrier_MarkingExtension) {
|
2021-04-21 00:32:15 +00:00
|
|
|
if (!FLAG_incremental_marking) return;
|
2020-07-03 07:26:57 +00:00
|
|
|
ManualGCScope manual_gc_scope;
|
|
|
|
CcTest::InitializeVM();
|
|
|
|
Isolate* isolate = CcTest::i_isolate();
|
|
|
|
Factory* factory = isolate->factory();
|
|
|
|
MarkCompactCollector* collector = isolate->heap()->mark_compact_collector();
|
|
|
|
HandleScope outer(isolate);
|
|
|
|
Handle<FixedArray> objects = factory->NewFixedArray(1);
|
|
|
|
ArrayBufferExtension* extension;
|
|
|
|
{
|
|
|
|
HandleScope inner(isolate);
|
|
|
|
Local<v8::ArrayBuffer> ab = v8::ArrayBuffer::New(CcTest::isolate(), 100);
|
|
|
|
Handle<JSArrayBuffer> host = v8::Utils::OpenHandle(*ab);
|
|
|
|
extension = host->extension();
|
|
|
|
objects->set(0, *host);
|
|
|
|
}
|
|
|
|
heap::SimulateIncrementalMarking(CcTest::heap(), false);
|
|
|
|
JSArrayBuffer host = JSArrayBuffer::cast(objects->get(0));
|
|
|
|
CHECK(collector->marking_state()->IsWhite(host));
|
|
|
|
CHECK(!extension->IsMarked());
|
|
|
|
WriteBarrier::Marking(host, extension);
|
2021-04-17 12:45:36 +00:00
|
|
|
// Concurrent marking barrier should mark this object.
|
2020-07-03 07:26:57 +00:00
|
|
|
CHECK_EQ(V8_CONCURRENT_MARKING_BOOL, extension->IsMarked());
|
2021-04-17 12:45:36 +00:00
|
|
|
// Keep object alive using the global handle.
|
|
|
|
v8::Global<ArrayBuffer> global_host(CcTest::isolate(),
|
|
|
|
Utils::ToLocal(handle(host, isolate)));
|
2020-07-03 07:26:57 +00:00
|
|
|
heap::SimulateIncrementalMarking(CcTest::heap(), true);
|
|
|
|
CHECK(collector->marking_state()->IsBlack(host));
|
|
|
|
CHECK(extension->IsMarked());
|
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace heap
|
|
|
|
} // namespace internal
|
|
|
|
} // namespace v8
|