3cb376dc83
Currently each isolate stores its own array of {CallInterfaceDescriptorData}. This array has size 173, and each entry has 40 bytes. That's already 7kB per isolate. Additionally, each {CallInterfaceDescriptorData} allocates two heap-allocated arrays, which probably add up to more than the static size of the {CallInterfaceDescriptorData}. Note that all the {CallInterfaceDescriptorData} instances are initialized eagerly on isolate creation. Since {CallInterfaceDescriptor} is totally isolate independent itself, this CL refactors the current design to avoid a copy of them per isolate, and instead shares them process-wide. Still, we need to free the allocated heap arrays when the last isolate dies to avoid leaks. This can probably be refactored later by statically initializing more and avoiding the heap allocations all together. This refactoring will also allow us to use {CallInterfaceDescriptor}s from wasm background compilation threads, which are not bound to any isolate. R=mstarzinger@chromium.org, titzer@chromium.org Bug: v8:6600 Change-Id: If8625b89951eec8fa8986b49a5c166e874a72494 Reviewed-on: https://chromium-review.googlesource.com/1100879 Commit-Queue: Clemens Hammacher <clemensh@chromium.org> Reviewed-by: Michael Starzinger <mstarzinger@chromium.org> Reviewed-by: Igor Sheludko <ishell@chromium.org> Cr-Commit-Position: refs/heads/master@{#53803}
73 lines
2.2 KiB
C++
73 lines
2.2 KiB
C++
// Copyright 2017 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 "test/unittests/code-stub-assembler-unittest.h"
|
|
|
|
#include "src/code-factory.h"
|
|
#include "src/compiler/node.h"
|
|
#include "src/interface-descriptors.h"
|
|
#include "src/isolate.h"
|
|
#include "src/objects-inl.h"
|
|
#include "test/unittests/compiler/compiler-test-utils.h"
|
|
#include "test/unittests/compiler/node-test-utils.h"
|
|
|
|
using ::testing::_;
|
|
using v8::internal::compiler::Node;
|
|
|
|
namespace c = v8::internal::compiler;
|
|
|
|
namespace v8 {
|
|
namespace internal {
|
|
|
|
#ifdef ENABLE_VERIFY_CSA
|
|
#define IS_BITCAST_WORD_TO_TAGGED_SIGNED(x) IsBitcastWordToTaggedSigned(x)
|
|
#define IS_BITCAST_TAGGED_TO_WORD(x) IsBitcastTaggedToWord(x)
|
|
#else
|
|
#define IS_BITCAST_WORD_TO_TAGGED_SIGNED(x) (x)
|
|
#define IS_BITCAST_TAGGED_TO_WORD(x) (x)
|
|
#endif
|
|
|
|
CodeStubAssemblerTestState::CodeStubAssemblerTestState(
|
|
CodeStubAssemblerTest* test)
|
|
: compiler::CodeAssemblerState(
|
|
test->isolate(), test->zone(), VoidDescriptor{}, Code::STUB, "test",
|
|
PoisoningMitigationLevel::kPoisonCriticalOnly) {}
|
|
|
|
TARGET_TEST_F(CodeStubAssemblerTest, SmiTag) {
|
|
CodeStubAssemblerTestState state(this);
|
|
CodeStubAssemblerForTest m(&state);
|
|
Node* value = m.Int32Constant(44);
|
|
EXPECT_THAT(m.SmiTag(value),
|
|
IS_BITCAST_WORD_TO_TAGGED_SIGNED(c::IsIntPtrConstant(
|
|
static_cast<intptr_t>(44) << (kSmiShiftSize + kSmiTagSize))));
|
|
EXPECT_THAT(m.SmiUntag(value),
|
|
c::IsIntPtrConstant(static_cast<intptr_t>(44) >>
|
|
(kSmiShiftSize + kSmiTagSize)));
|
|
}
|
|
|
|
TARGET_TEST_F(CodeStubAssemblerTest, IntPtrMax) {
|
|
CodeStubAssemblerTestState state(this);
|
|
CodeStubAssemblerForTest m(&state);
|
|
{
|
|
Node* a = m.IntPtrConstant(100);
|
|
Node* b = m.IntPtrConstant(1);
|
|
Node* z = m.IntPtrMax(a, b);
|
|
EXPECT_THAT(z, c::IsIntPtrConstant(100));
|
|
}
|
|
}
|
|
|
|
TARGET_TEST_F(CodeStubAssemblerTest, IntPtrMin) {
|
|
CodeStubAssemblerTestState state(this);
|
|
CodeStubAssemblerForTest m(&state);
|
|
{
|
|
Node* a = m.IntPtrConstant(100);
|
|
Node* b = m.IntPtrConstant(1);
|
|
Node* z = m.IntPtrMin(a, b);
|
|
EXPECT_THAT(z, c::IsIntPtrConstant(1));
|
|
}
|
|
}
|
|
|
|
} // namespace internal
|
|
} // namespace v8
|