30fabc4cdf
This ensures that there is only one entrance point from C++ to generated code, hence only one method has to be excluded from CFI. It also introduces type safety by only allowing the code to be called with the right arguments. This CL includes minor drive-by fixes in the tests, like removing unused dummy variables. R=mstarzinger@chromium.org Bug: v8:7182 Change-Id: Ied9164a2497db9e7c032324c5e082094fdffc72d Reviewed-on: https://chromium-review.googlesource.com/852213 Reviewed-by: Jakob Gruber <jgruber@chromium.org> Reviewed-by: Michael Starzinger <mstarzinger@chromium.org> Commit-Queue: Clemens Hammacher <clemensh@chromium.org> Cr-Commit-Position: refs/heads/master@{#50426}
34 lines
805 B
C++
34 lines
805 B
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/cctest/assembler-helper-arm.h"
|
|
|
|
#include "src/assembler-inl.h"
|
|
#include "src/isolate-inl.h"
|
|
#include "src/v8.h"
|
|
#include "test/cctest/cctest.h"
|
|
|
|
namespace v8 {
|
|
namespace internal {
|
|
|
|
Handle<Code> AssembleCodeImpl(std::function<void(Assembler&)> assemble) {
|
|
Isolate* isolate = CcTest::i_isolate();
|
|
Assembler assm(isolate, nullptr, 0);
|
|
|
|
assemble(assm);
|
|
assm.bx(lr);
|
|
|
|
CodeDesc desc;
|
|
assm.GetCode(isolate, &desc);
|
|
Handle<Code> code =
|
|
isolate->factory()->NewCode(desc, Code::STUB, Handle<Code>());
|
|
if (FLAG_print_code) {
|
|
code->Print();
|
|
}
|
|
return code;
|
|
}
|
|
|
|
} // namespace internal
|
|
} // namespace v8
|