Update test/benchmarks/cpp/BUILD.gn and test/benchmarks/cpp/cppgc/BUILD.gn so that fast_api_benchmark and other C++ benchmarks can be built in a Chrome checkout (build_with_chromium) in addition to a standalone V8 checkout: - Use relative paths (../../..:v8, ../../..:v8_libbase, etc.) instead of root-relative paths (//:v8) which point to the Chromium root in a Chrome checkout. - Add ../../..:internal_config_base to benchmark targets so V8 include paths are configured when building in Chromium. - Depend on //third_party/google_benchmark when build_with_chromium is true instead of //third_party/google_benchmark_chrome. - Add //build/config/compiler:no_exit_time_destructors to cppgc benchmarks. - Include "benchmark/benchmark.h" via the benchmark_config include_dirs instead of hardcoding the third_party/google_benchmark_chrome path. TAG=agy CONV=33ee5221-0921-45d8-bcc0-6413b5599ef7 Change-Id: Ia6cf7c1b8651b7808046003c16139b9c48570d01 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/8657242 Commit-Queue: Andreas Haas <ahaas@chromium.org> Reviewed-by: Michael Achenbach <machenbach@chromium.org> Cr-Commit-Position: refs/heads/main@{#111149}
42 lines
1.2 KiB
C++
42 lines
1.2 KiB
C++
// Copyright 2024 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.
|
|
|
|
#ifndef TEST_BENCHMARK_CPP_BENCHMARK_UTILS_H_
|
|
#define TEST_BENCHMARK_CPP_BENCHMARK_UTILS_H_
|
|
|
|
#include "benchmark/benchmark.h"
|
|
#include "include/v8-array-buffer.h"
|
|
#include "include/v8-cppgc.h"
|
|
#include "include/v8-isolate.h"
|
|
#include "include/v8-platform.h"
|
|
|
|
namespace v8::benchmarking {
|
|
|
|
static constexpr uint16_t kEmbedderId = 0;
|
|
static constexpr size_t kTypeOffset = 0;
|
|
static constexpr size_t kInstanceOffset = 1;
|
|
|
|
// BenchmarkWithIsolate is a basic benchmark fixture that sets up the process
|
|
// with a single Isolate.
|
|
class BenchmarkWithIsolate : public benchmark::Fixture {
|
|
public:
|
|
static void InitializeProcess();
|
|
static void ShutdownProcess();
|
|
|
|
protected:
|
|
V8_INLINE v8::Isolate* v8_isolate() { return v8_isolate_; }
|
|
V8_INLINE cppgc::AllocationHandle& allocation_handle() {
|
|
return v8_isolate_->GetCppHeap()->GetAllocationHandle();
|
|
}
|
|
|
|
private:
|
|
static v8::Platform* platform_;
|
|
static v8::Isolate* v8_isolate_;
|
|
static v8::ArrayBuffer::Allocator* v8_ab_allocator_;
|
|
};
|
|
|
|
} // namespace v8::benchmarking
|
|
|
|
#endif // TEST_BENCHMARK_CPP_BENCHMARK_UTILS_H_
|