assembler-helper-arm.cc 812 Bytes
Newer Older
1 2 3 4 5 6
// 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"

7
#include "src/codegen/macro-assembler.h"
8
#include "src/isolate-inl.h"
9 10 11 12 13 14
#include "src/v8.h"
#include "test/cctest/cctest.h"

namespace v8 {
namespace internal {

15
Handle<Code> AssembleCodeImpl(std::function<void(MacroAssembler&)> assemble) {
16
  Isolate* isolate = CcTest::i_isolate();
17
  MacroAssembler assm(AssemblerOptions{});
18 19 20 21 22 23

  assemble(assm);
  assm.bx(lr);

  CodeDesc desc;
  assm.GetCode(isolate, &desc);
24
  Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build();
25
  if (FLAG_print_code) {
26
    code->Print();
27
  }
28
  return code;
29 30 31 32
}

}  // namespace internal
}  // namespace v8