v8/test/cctest/test-isolate-independent-builtins.cc

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

206 lines
6.1 KiB
C++
Raw Normal View History

// Copyright 2018 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/cctest.h"
Reland "Reland "[builtins] Add .incbin cctest"" This is a reland of ef06feded6c72d71baab96afc61e25a06b8373d8. Original change's description: > Reland "[builtins] Add .incbin cctest" > > This is a reland of b012816155bb1bb53c3f4fc839b8ba42dbb6af98. > > Original change's description: > > [builtins] Add .incbin cctest > > > > Just to ensure this is portable across all platforms. > > > > Credits go to https://github.com/graphitemaster/incbin, bits of the > > .incbin code were taken from there. Thanks! > > > > Reland of https://crrev.com/c/881181 > > > > Bug: v8:6666 > > Change-Id: I5c0dbf56b1c987fd88607dca69b39d65b59cdefc > > Reviewed-on: https://chromium-review.googlesource.com/895597 > > Commit-Queue: Jakob Gruber <jgruber@chromium.org> > > Reviewed-by: Michael Achenbach <machenbach@chromium.org> > > Cr-Commit-Position: refs/heads/master@{#51042} > > Cq-Include-Trybots: luci.v8.try:v8_win64_msvc_compile_rel > Bug: v8:6666 > Change-Id: I8fc0963e28996a84ed56c2e740d895e26611abf0 > Reviewed-on: https://chromium-review.googlesource.com/897630 > Commit-Queue: Jakob Gruber <jgruber@chromium.org> > Reviewed-by: Michael Achenbach <machenbach@chromium.org> > Cr-Commit-Position: refs/heads/master@{#51054} Bug: v8:6666 Change-Id: Icc6816e260dac2d8b8f6c9c4a2725b271dac4664 Cq-Include-Trybots: luci.v8.try:v8_win64_msvc_compile_rel;master.tryserver.chromium.linux:linux_chromium_rel_ng Reviewed-on: https://chromium-review.googlesource.com/898927 Commit-Queue: Jakob Gruber <jgruber@chromium.org> Reviewed-by: Michael Achenbach <machenbach@chromium.org> Cr-Commit-Position: refs/heads/master@{#51075}
2018-02-02 15:17:03 +00:00
#include "src/assembler-inl.h"
#include "src/handles-inl.h"
#include "src/isolate.h"
Reland "Reland "[builtins] Add .incbin cctest"" This is a reland of ef06feded6c72d71baab96afc61e25a06b8373d8. Original change's description: > Reland "[builtins] Add .incbin cctest" > > This is a reland of b012816155bb1bb53c3f4fc839b8ba42dbb6af98. > > Original change's description: > > [builtins] Add .incbin cctest > > > > Just to ensure this is portable across all platforms. > > > > Credits go to https://github.com/graphitemaster/incbin, bits of the > > .incbin code were taken from there. Thanks! > > > > Reland of https://crrev.com/c/881181 > > > > Bug: v8:6666 > > Change-Id: I5c0dbf56b1c987fd88607dca69b39d65b59cdefc > > Reviewed-on: https://chromium-review.googlesource.com/895597 > > Commit-Queue: Jakob Gruber <jgruber@chromium.org> > > Reviewed-by: Michael Achenbach <machenbach@chromium.org> > > Cr-Commit-Position: refs/heads/master@{#51042} > > Cq-Include-Trybots: luci.v8.try:v8_win64_msvc_compile_rel > Bug: v8:6666 > Change-Id: I8fc0963e28996a84ed56c2e740d895e26611abf0 > Reviewed-on: https://chromium-review.googlesource.com/897630 > Commit-Queue: Jakob Gruber <jgruber@chromium.org> > Reviewed-by: Michael Achenbach <machenbach@chromium.org> > Cr-Commit-Position: refs/heads/master@{#51054} Bug: v8:6666 Change-Id: Icc6816e260dac2d8b8f6c9c4a2725b271dac4664 Cq-Include-Trybots: luci.v8.try:v8_win64_msvc_compile_rel;master.tryserver.chromium.linux:linux_chromium_rel_ng Reviewed-on: https://chromium-review.googlesource.com/898927 Commit-Queue: Jakob Gruber <jgruber@chromium.org> Reviewed-by: Michael Achenbach <machenbach@chromium.org> Cr-Commit-Position: refs/heads/master@{#51075}
2018-02-02 15:17:03 +00:00
#include "src/macro-assembler-inl.h"
#include "src/simulator.h"
Reland "[builtins] Embed builtins into the binary" This is a reland of 491d5a81ddd5a6ced8cde8cdd40f85f3da786d6a Original change's description: > [builtins] Embed builtins into the binary > > This embeds code for off-heap-safe builtins into the binary. Actual > execution of embedded code is not implemented yet. > > The embedded file has the following format: > > namespace v8 { > namespace internal { > > namespace { > > V8_EMBEDDED_TEXT_HEADER(v8_embedded_blob_) > __asm__( /* builtin offsets and lengths */ ); > __asm__(V8_ASM_LABEL("Builtins_RecordWrite")); > __asm__( /* binary instruction stream */ ); > /* Repeat for other builtins. */ > > extern "C" const uint8_t v8_embedded_blob_[]; > static const uint32_t v8_embedded_blob_size_ = /* size in bytes */; > > } // namespace > > const uint8_t* DefaultEmbeddedBlob() { return v8_embedded_blob_; } > uint32_t DefaultEmbeddedBlobSize() { return v8_embedded_blob_size_; } > > } // namespace internal > } // namespace v8 > > Bug: v8:6666 > Cq-Include-Trybots: luci.chromium.try:linux_chromium_rel_ng;luci.v8.try:v8_linux64_fyi_rel_ng > Change-Id: Ic989f01da69ebe2863f31d934bfbe2c5d6e80864 > Reviewed-on: https://chromium-review.googlesource.com/946011 > Commit-Queue: Jakob Gruber <jgruber@chromium.org> > Reviewed-by: Yang Guo <yangguo@chromium.org> > Cr-Commit-Position: refs/heads/master@{#51759} TBR=yangguo@chromium.org Bug: v8:6666 Change-Id: I89b0498f22b4ce573723748d55d86a82ba285a88 Cq-Include-Trybots: luci.chromium.try:linux_chromium_rel_ng;luci.v8.try:v8_linux64_fyi_rel_ng Reviewed-on: https://chromium-review.googlesource.com/957024 Reviewed-by: Yang Guo <yangguo@chromium.org> Reviewed-by: Michael Achenbach <machenbach@chromium.org> Reviewed-by: Jakob Gruber <jgruber@chromium.org> Commit-Queue: Jakob Gruber <jgruber@chromium.org> Cr-Commit-Position: refs/heads/master@{#51832}
2018-03-09 09:29:10 +00:00
#include "src/snapshot/macros.h"
#include "src/snapshot/snapshot.h"
// To generate the binary files for the test function, enable this section and
// run GenerateTestFunctionData once on each arch.
Reland "Reland "[builtins] Add .incbin cctest"" This is a reland of ef06feded6c72d71baab96afc61e25a06b8373d8. Original change's description: > Reland "[builtins] Add .incbin cctest" > > This is a reland of b012816155bb1bb53c3f4fc839b8ba42dbb6af98. > > Original change's description: > > [builtins] Add .incbin cctest > > > > Just to ensure this is portable across all platforms. > > > > Credits go to https://github.com/graphitemaster/incbin, bits of the > > .incbin code were taken from there. Thanks! > > > > Reland of https://crrev.com/c/881181 > > > > Bug: v8:6666 > > Change-Id: I5c0dbf56b1c987fd88607dca69b39d65b59cdefc > > Reviewed-on: https://chromium-review.googlesource.com/895597 > > Commit-Queue: Jakob Gruber <jgruber@chromium.org> > > Reviewed-by: Michael Achenbach <machenbach@chromium.org> > > Cr-Commit-Position: refs/heads/master@{#51042} > > Cq-Include-Trybots: luci.v8.try:v8_win64_msvc_compile_rel > Bug: v8:6666 > Change-Id: I8fc0963e28996a84ed56c2e740d895e26611abf0 > Reviewed-on: https://chromium-review.googlesource.com/897630 > Commit-Queue: Jakob Gruber <jgruber@chromium.org> > Reviewed-by: Michael Achenbach <machenbach@chromium.org> > Cr-Commit-Position: refs/heads/master@{#51054} Bug: v8:6666 Change-Id: Icc6816e260dac2d8b8f6c9c4a2725b271dac4664 Cq-Include-Trybots: luci.v8.try:v8_win64_msvc_compile_rel;master.tryserver.chromium.linux:linux_chromium_rel_ng Reviewed-on: https://chromium-review.googlesource.com/898927 Commit-Queue: Jakob Gruber <jgruber@chromium.org> Reviewed-by: Michael Achenbach <machenbach@chromium.org> Cr-Commit-Position: refs/heads/master@{#51075}
2018-02-02 15:17:03 +00:00
#define GENERATE_TEST_FUNCTION_DATA false
namespace v8 {
namespace internal {
namespace test_isolate_independent_builtins {
// V8_CC_MSVC is true for both MSVC and clang on windows. clang can handle
// __asm__-style inline assembly but MSVC cannot, and thus we need a more
// precise compiler detection that can distinguish between the two. clang on
// windows sets both __clang__ and _MSC_VER, MSVC sets only _MSC_VER.
#if defined(_MSC_VER) && !defined(__clang__)
#define V8_COMPILER_IS_MSVC
#endif
#ifndef V8_COMPILER_IS_MSVC
Reland "Reland "[builtins] Add .incbin cctest"" This is a reland of ef06feded6c72d71baab96afc61e25a06b8373d8. Original change's description: > Reland "[builtins] Add .incbin cctest" > > This is a reland of b012816155bb1bb53c3f4fc839b8ba42dbb6af98. > > Original change's description: > > [builtins] Add .incbin cctest > > > > Just to ensure this is portable across all platforms. > > > > Credits go to https://github.com/graphitemaster/incbin, bits of the > > .incbin code were taken from there. Thanks! > > > > Reland of https://crrev.com/c/881181 > > > > Bug: v8:6666 > > Change-Id: I5c0dbf56b1c987fd88607dca69b39d65b59cdefc > > Reviewed-on: https://chromium-review.googlesource.com/895597 > > Commit-Queue: Jakob Gruber <jgruber@chromium.org> > > Reviewed-by: Michael Achenbach <machenbach@chromium.org> > > Cr-Commit-Position: refs/heads/master@{#51042} > > Cq-Include-Trybots: luci.v8.try:v8_win64_msvc_compile_rel > Bug: v8:6666 > Change-Id: I8fc0963e28996a84ed56c2e740d895e26611abf0 > Reviewed-on: https://chromium-review.googlesource.com/897630 > Commit-Queue: Jakob Gruber <jgruber@chromium.org> > Reviewed-by: Michael Achenbach <machenbach@chromium.org> > Cr-Commit-Position: refs/heads/master@{#51054} Bug: v8:6666 Change-Id: Icc6816e260dac2d8b8f6c9c4a2725b271dac4664 Cq-Include-Trybots: luci.v8.try:v8_win64_msvc_compile_rel;master.tryserver.chromium.linux:linux_chromium_rel_ng Reviewed-on: https://chromium-review.googlesource.com/898927 Commit-Queue: Jakob Gruber <jgruber@chromium.org> Reviewed-by: Michael Achenbach <machenbach@chromium.org> Cr-Commit-Position: refs/heads/master@{#51075}
2018-02-02 15:17:03 +00:00
#if GENERATE_TEST_FUNCTION_DATA
// Arch-specific defines.
#if V8_TARGET_ARCH_IA32
#define TEST_FUNCTION_FILE "f-ia32.bin"
#elif V8_TARGET_ARCH_X64 && _WIN64
#define TEST_FUNCTION_FILE "f-x64-win.bin"
#elif V8_TARGET_ARCH_X64
#define TEST_FUNCTION_FILE "f-x64.bin"
#elif V8_TARGET_ARCH_ARM64
#define TEST_FUNCTION_FILE "f-arm64.bin"
#elif V8_TARGET_ARCH_ARM
#define TEST_FUNCTION_FILE "f-arm.bin"
#elif V8_TARGET_ARCH_PPC
#define TEST_FUNCTION_FILE "f-ppc.bin"
#elif V8_TARGET_ARCH_MIPS
#define TEST_FUNCTION_FILE "f-mips.bin"
#elif V8_TARGET_ARCH_MIPS64
#define TEST_FUNCTION_FILE "f-mips64.bin"
#elif V8_TARGET_ARCH_S390
#define TEST_FUNCTION_FILE "f-s390.bin"
#else
#error "Unknown architecture."
#endif
#define __ masm.
Reland "Reland "[builtins] Add .incbin cctest"" This is a reland of ef06feded6c72d71baab96afc61e25a06b8373d8. Original change's description: > Reland "[builtins] Add .incbin cctest" > > This is a reland of b012816155bb1bb53c3f4fc839b8ba42dbb6af98. > > Original change's description: > > [builtins] Add .incbin cctest > > > > Just to ensure this is portable across all platforms. > > > > Credits go to https://github.com/graphitemaster/incbin, bits of the > > .incbin code were taken from there. Thanks! > > > > Reland of https://crrev.com/c/881181 > > > > Bug: v8:6666 > > Change-Id: I5c0dbf56b1c987fd88607dca69b39d65b59cdefc > > Reviewed-on: https://chromium-review.googlesource.com/895597 > > Commit-Queue: Jakob Gruber <jgruber@chromium.org> > > Reviewed-by: Michael Achenbach <machenbach@chromium.org> > > Cr-Commit-Position: refs/heads/master@{#51042} > > Cq-Include-Trybots: luci.v8.try:v8_win64_msvc_compile_rel > Bug: v8:6666 > Change-Id: I8fc0963e28996a84ed56c2e740d895e26611abf0 > Reviewed-on: https://chromium-review.googlesource.com/897630 > Commit-Queue: Jakob Gruber <jgruber@chromium.org> > Reviewed-by: Michael Achenbach <machenbach@chromium.org> > Cr-Commit-Position: refs/heads/master@{#51054} Bug: v8:6666 Change-Id: Icc6816e260dac2d8b8f6c9c4a2725b271dac4664 Cq-Include-Trybots: luci.v8.try:v8_win64_msvc_compile_rel;master.tryserver.chromium.linux:linux_chromium_rel_ng Reviewed-on: https://chromium-review.googlesource.com/898927 Commit-Queue: Jakob Gruber <jgruber@chromium.org> Reviewed-by: Michael Achenbach <machenbach@chromium.org> Cr-Commit-Position: refs/heads/master@{#51075}
2018-02-02 15:17:03 +00:00
TEST(GenerateTestFunctionData) {
CcTest::InitializeVM();
Isolate* isolate = CcTest::i_isolate();
HandleScope scope(isolate);
#if V8_TARGET_ARCH_IA32
v8::internal::byte buffer[256];
Assembler masm(isolate, buffer, sizeof(buffer));
__ mov(eax, Operand(esp, 4));
__ add(eax, Operand(esp, 8));
__ ret(0);
#elif V8_TARGET_ARCH_X64
size_t allocated;
byte* buffer = AllocateAssemblerBuffer(&allocated);
Assembler masm(isolate, buffer, static_cast<int>(allocated));
#ifdef _WIN64
static const Register arg1 = rcx;
static const Register arg2 = rdx;
#else
static const Register arg1 = rdi;
static const Register arg2 = rsi;
#endif
__ movq(rax, arg2);
__ addq(rax, arg1);
__ ret(0);
#elif V8_TARGET_ARCH_ARM64
MacroAssembler masm(isolate, nullptr, 0,
v8::internal::CodeObjectRequired::kYes);
__ Add(x0, x0, x1);
__ Ret();
#elif V8_TARGET_ARCH_ARM
Assembler masm(isolate, nullptr, 0);
__ add(r0, r0, Operand(r1));
__ mov(pc, Operand(lr));
#elif V8_TARGET_ARCH_PPC
Assembler masm(isolate, nullptr, 0);
__ function_descriptor();
__ add(r3, r3, r4);
__ blr();
#elif V8_TARGET_ARCH_MIPS
MacroAssembler masm(isolate, nullptr, 0,
v8::internal::CodeObjectRequired::kYes);
__ addu(v0, a0, a1);
__ jr(ra);
__ nop();
#elif V8_TARGET_ARCH_MIPS64
MacroAssembler masm(isolate, nullptr, 0,
v8::internal::CodeObjectRequired::kYes);
__ addu(v0, a0, a1);
__ jr(ra);
__ nop();
#elif V8_TARGET_ARCH_S390
Assembler masm(isolate, nullptr, 0);
s390: Reland "Reland "[builtins] Add .incbin cctest"" Port 47e272b206b5622b0be6a09724ebdd8757163193 Original Commit Message: This is a reland of ef06feded6c72d71baab96afc61e25a06b8373d8. Original change's description: > Reland "[builtins] Add .incbin cctest" > > This is a reland of b012816155bb1bb53c3f4fc839b8ba42dbb6af98. > > Original change's description: > > [builtins] Add .incbin cctest > > > > Just to ensure this is portable across all platforms. > > > > Credits go to https://github.com/graphitemaster/incbin, bits of the > > .incbin code were taken from there. Thanks! > > > > Reland of https://crrev.com/c/881181 > > > > Bug: v8:6666 > > Change-Id: I5c0dbf56b1c987fd88607dca69b39d65b59cdefc > > Reviewed-on: https://chromium-review.googlesource.com/895597 > > Commit-Queue: Jakob Gruber <jgruber@chromium.org> > > Reviewed-by: Michael Achenbach <machenbach@chromium.org> > > Cr-Commit-Position: refs/heads/master@{#51042} > > Cq-Include-Trybots: luci.v8.try:v8_win64_msvc_compile_rel > Bug: v8:6666 > Change-Id: I8fc0963e28996a84ed56c2e740d895e26611abf0 > Reviewed-on: https://chromium-review.googlesource.com/897630 > Commit-Queue: Jakob Gruber <jgruber@chromium.org> > Reviewed-by: Michael Achenbach <machenbach@chromium.org> > Cr-Commit-Position: refs/heads/master@{#51054} R=jgruber@chromium.org, joransiu@ca.ibm.com, michael_dawson@ca.ibm.com BUG= LOG=N Change-Id: I863d01a4a7d91f9f2128e4598f417efe49c43e7b Reviewed-on: https://chromium-review.googlesource.com/902431 Reviewed-by: Jakob Gruber <jgruber@chromium.org> Commit-Queue: Junliang Yan <jyan@ca.ibm.com> Cr-Commit-Position: refs/heads/master@{#51124}
2018-02-05 20:11:59 +00:00
__ agr(r2, r3);
Reland "Reland "[builtins] Add .incbin cctest"" This is a reland of ef06feded6c72d71baab96afc61e25a06b8373d8. Original change's description: > Reland "[builtins] Add .incbin cctest" > > This is a reland of b012816155bb1bb53c3f4fc839b8ba42dbb6af98. > > Original change's description: > > [builtins] Add .incbin cctest > > > > Just to ensure this is portable across all platforms. > > > > Credits go to https://github.com/graphitemaster/incbin, bits of the > > .incbin code were taken from there. Thanks! > > > > Reland of https://crrev.com/c/881181 > > > > Bug: v8:6666 > > Change-Id: I5c0dbf56b1c987fd88607dca69b39d65b59cdefc > > Reviewed-on: https://chromium-review.googlesource.com/895597 > > Commit-Queue: Jakob Gruber <jgruber@chromium.org> > > Reviewed-by: Michael Achenbach <machenbach@chromium.org> > > Cr-Commit-Position: refs/heads/master@{#51042} > > Cq-Include-Trybots: luci.v8.try:v8_win64_msvc_compile_rel > Bug: v8:6666 > Change-Id: I8fc0963e28996a84ed56c2e740d895e26611abf0 > Reviewed-on: https://chromium-review.googlesource.com/897630 > Commit-Queue: Jakob Gruber <jgruber@chromium.org> > Reviewed-by: Michael Achenbach <machenbach@chromium.org> > Cr-Commit-Position: refs/heads/master@{#51054} Bug: v8:6666 Change-Id: Icc6816e260dac2d8b8f6c9c4a2725b271dac4664 Cq-Include-Trybots: luci.v8.try:v8_win64_msvc_compile_rel;master.tryserver.chromium.linux:linux_chromium_rel_ng Reviewed-on: https://chromium-review.googlesource.com/898927 Commit-Queue: Jakob Gruber <jgruber@chromium.org> Reviewed-by: Michael Achenbach <machenbach@chromium.org> Cr-Commit-Position: refs/heads/master@{#51075}
2018-02-02 15:17:03 +00:00
__ b(r14);
#else // Unknown architecture.
#error "Unknown architecture."
#endif // Target architecture.
CodeDesc desc;
masm.GetCode(isolate, &desc);
std::ofstream of(TEST_FUNCTION_FILE, std::ios::out | std::ios::binary);
of.write(reinterpret_cast<char*>(desc.buffer), desc.instr_size);
}
Reland "[builtins] Embed builtins into the binary" This is a reland of 491d5a81ddd5a6ced8cde8cdd40f85f3da786d6a Original change's description: > [builtins] Embed builtins into the binary > > This embeds code for off-heap-safe builtins into the binary. Actual > execution of embedded code is not implemented yet. > > The embedded file has the following format: > > namespace v8 { > namespace internal { > > namespace { > > V8_EMBEDDED_TEXT_HEADER(v8_embedded_blob_) > __asm__( /* builtin offsets and lengths */ ); > __asm__(V8_ASM_LABEL("Builtins_RecordWrite")); > __asm__( /* binary instruction stream */ ); > /* Repeat for other builtins. */ > > extern "C" const uint8_t v8_embedded_blob_[]; > static const uint32_t v8_embedded_blob_size_ = /* size in bytes */; > > } // namespace > > const uint8_t* DefaultEmbeddedBlob() { return v8_embedded_blob_; } > uint32_t DefaultEmbeddedBlobSize() { return v8_embedded_blob_size_; } > > } // namespace internal > } // namespace v8 > > Bug: v8:6666 > Cq-Include-Trybots: luci.chromium.try:linux_chromium_rel_ng;luci.v8.try:v8_linux64_fyi_rel_ng > Change-Id: Ic989f01da69ebe2863f31d934bfbe2c5d6e80864 > Reviewed-on: https://chromium-review.googlesource.com/946011 > Commit-Queue: Jakob Gruber <jgruber@chromium.org> > Reviewed-by: Yang Guo <yangguo@chromium.org> > Cr-Commit-Position: refs/heads/master@{#51759} TBR=yangguo@chromium.org Bug: v8:6666 Change-Id: I89b0498f22b4ce573723748d55d86a82ba285a88 Cq-Include-Trybots: luci.chromium.try:linux_chromium_rel_ng;luci.v8.try:v8_linux64_fyi_rel_ng Reviewed-on: https://chromium-review.googlesource.com/957024 Reviewed-by: Yang Guo <yangguo@chromium.org> Reviewed-by: Michael Achenbach <machenbach@chromium.org> Reviewed-by: Jakob Gruber <jgruber@chromium.org> Commit-Queue: Jakob Gruber <jgruber@chromium.org> Cr-Commit-Position: refs/heads/master@{#51832}
2018-03-09 09:29:10 +00:00
#undef __
Reland "Reland "[builtins] Add .incbin cctest"" This is a reland of ef06feded6c72d71baab96afc61e25a06b8373d8. Original change's description: > Reland "[builtins] Add .incbin cctest" > > This is a reland of b012816155bb1bb53c3f4fc839b8ba42dbb6af98. > > Original change's description: > > [builtins] Add .incbin cctest > > > > Just to ensure this is portable across all platforms. > > > > Credits go to https://github.com/graphitemaster/incbin, bits of the > > .incbin code were taken from there. Thanks! > > > > Reland of https://crrev.com/c/881181 > > > > Bug: v8:6666 > > Change-Id: I5c0dbf56b1c987fd88607dca69b39d65b59cdefc > > Reviewed-on: https://chromium-review.googlesource.com/895597 > > Commit-Queue: Jakob Gruber <jgruber@chromium.org> > > Reviewed-by: Michael Achenbach <machenbach@chromium.org> > > Cr-Commit-Position: refs/heads/master@{#51042} > > Cq-Include-Trybots: luci.v8.try:v8_win64_msvc_compile_rel > Bug: v8:6666 > Change-Id: I8fc0963e28996a84ed56c2e740d895e26611abf0 > Reviewed-on: https://chromium-review.googlesource.com/897630 > Commit-Queue: Jakob Gruber <jgruber@chromium.org> > Reviewed-by: Michael Achenbach <machenbach@chromium.org> > Cr-Commit-Position: refs/heads/master@{#51054} Bug: v8:6666 Change-Id: Icc6816e260dac2d8b8f6c9c4a2725b271dac4664 Cq-Include-Trybots: luci.v8.try:v8_win64_msvc_compile_rel;master.tryserver.chromium.linux:linux_chromium_rel_ng Reviewed-on: https://chromium-review.googlesource.com/898927 Commit-Queue: Jakob Gruber <jgruber@chromium.org> Reviewed-by: Michael Achenbach <machenbach@chromium.org> Cr-Commit-Position: refs/heads/master@{#51075}
2018-02-02 15:17:03 +00:00
#endif // GENERATE_TEST_FUNCTION_DATA
#if V8_TARGET_ARCH_IA32
#define FUNCTION_BYTES \
".byte 0x8b, 0x44, 0x24, 0x04, 0x03, 0x44, 0x24, 0x08, 0xc3\n"
#elif V8_TARGET_ARCH_X64 && _WIN64
#define FUNCTION_BYTES ".byte 0x48, 0x8b, 0xc2, 0x48, 0x03, 0xc1, 0xc3\n"
#elif V8_TARGET_ARCH_X64
#define FUNCTION_BYTES ".byte 0x48, 0x8b, 0xc6, 0x48, 0x03, 0xc7, 0xc3\n"
#elif V8_TARGET_ARCH_ARM64
#define FUNCTION_BYTES ".byte 0x00, 0x00, 0x01, 0x8b, 0xc0, 0x03, 0x5f, 0xd6\n"
#elif V8_TARGET_ARCH_ARM
#define FUNCTION_BYTES ".byte 0x01, 0x00, 0x80, 0xe0, 0x0e, 0xf0, 0xa0, 0xe1\n"
#elif V8_TARGET_ARCH_PPC
#if defined(V8_OS_AIX)
#define FUNCTION_BYTES ".byte 0x7c, 0x64, 0x1a, 0x14, 0x4e, 0x80, 0x00, 0x20\n"
#else
#define FUNCTION_BYTES ".byte 0x14, 0x22, 0x63, 0x7c, 0x20, 0x00, 0x80, 0x4e\n"
#endif
#elif defined(V8_TARGET_ARCH_MIPS) || defined(V8_TARGET_ARCH_MIPS64)
#if defined(V8_TARGET_BIG_ENDIAN)
#define FUNCTION_BYTES \
".byte 0x00, 0x85, 0x10, 0x21, 0x03, 0xe0, 0x00, " \
"0x08, 0x00, 0x00, 0x00, 0x00\n"
#else
#define FUNCTION_BYTES \
".byte 0x21, 0x10, 0x85, 0x00, 0x08, 0x00, 0xe0, " \
"0x03, 0x00, 0x00, 0x00, 0x00\n"
#endif
#elif V8_TARGET_ARCH_S390
#define FUNCTION_BYTES \
".byte 0xb9, 0x08, 0x00, 0x23, 0x07, 0xfe\n"
#else
#error "Unknown architecture."
#endif
Reland "[builtins] Embed builtins into the binary" This is a reland of 491d5a81ddd5a6ced8cde8cdd40f85f3da786d6a Original change's description: > [builtins] Embed builtins into the binary > > This embeds code for off-heap-safe builtins into the binary. Actual > execution of embedded code is not implemented yet. > > The embedded file has the following format: > > namespace v8 { > namespace internal { > > namespace { > > V8_EMBEDDED_TEXT_HEADER(v8_embedded_blob_) > __asm__( /* builtin offsets and lengths */ ); > __asm__(V8_ASM_LABEL("Builtins_RecordWrite")); > __asm__( /* binary instruction stream */ ); > /* Repeat for other builtins. */ > > extern "C" const uint8_t v8_embedded_blob_[]; > static const uint32_t v8_embedded_blob_size_ = /* size in bytes */; > > } // namespace > > const uint8_t* DefaultEmbeddedBlob() { return v8_embedded_blob_; } > uint32_t DefaultEmbeddedBlobSize() { return v8_embedded_blob_size_; } > > } // namespace internal > } // namespace v8 > > Bug: v8:6666 > Cq-Include-Trybots: luci.chromium.try:linux_chromium_rel_ng;luci.v8.try:v8_linux64_fyi_rel_ng > Change-Id: Ic989f01da69ebe2863f31d934bfbe2c5d6e80864 > Reviewed-on: https://chromium-review.googlesource.com/946011 > Commit-Queue: Jakob Gruber <jgruber@chromium.org> > Reviewed-by: Yang Guo <yangguo@chromium.org> > Cr-Commit-Position: refs/heads/master@{#51759} TBR=yangguo@chromium.org Bug: v8:6666 Change-Id: I89b0498f22b4ce573723748d55d86a82ba285a88 Cq-Include-Trybots: luci.chromium.try:linux_chromium_rel_ng;luci.v8.try:v8_linux64_fyi_rel_ng Reviewed-on: https://chromium-review.googlesource.com/957024 Reviewed-by: Yang Guo <yangguo@chromium.org> Reviewed-by: Michael Achenbach <machenbach@chromium.org> Reviewed-by: Jakob Gruber <jgruber@chromium.org> Commit-Queue: Jakob Gruber <jgruber@chromium.org> Cr-Commit-Position: refs/heads/master@{#51832}
2018-03-09 09:29:10 +00:00
V8_EMBEDDED_RODATA_HEADER(test_string0_bytes)
__asm__(".byte 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37\n"
".byte 0x38, 0x39, 0x0a, 0x00\n");
extern "C" V8_ALIGNED(16) const char test_string0_bytes[];
Reland "[builtins] Embed builtins into the binary" This is a reland of 491d5a81ddd5a6ced8cde8cdd40f85f3da786d6a Original change's description: > [builtins] Embed builtins into the binary > > This embeds code for off-heap-safe builtins into the binary. Actual > execution of embedded code is not implemented yet. > > The embedded file has the following format: > > namespace v8 { > namespace internal { > > namespace { > > V8_EMBEDDED_TEXT_HEADER(v8_embedded_blob_) > __asm__( /* builtin offsets and lengths */ ); > __asm__(V8_ASM_LABEL("Builtins_RecordWrite")); > __asm__( /* binary instruction stream */ ); > /* Repeat for other builtins. */ > > extern "C" const uint8_t v8_embedded_blob_[]; > static const uint32_t v8_embedded_blob_size_ = /* size in bytes */; > > } // namespace > > const uint8_t* DefaultEmbeddedBlob() { return v8_embedded_blob_; } > uint32_t DefaultEmbeddedBlobSize() { return v8_embedded_blob_size_; } > > } // namespace internal > } // namespace v8 > > Bug: v8:6666 > Cq-Include-Trybots: luci.chromium.try:linux_chromium_rel_ng;luci.v8.try:v8_linux64_fyi_rel_ng > Change-Id: Ic989f01da69ebe2863f31d934bfbe2c5d6e80864 > Reviewed-on: https://chromium-review.googlesource.com/946011 > Commit-Queue: Jakob Gruber <jgruber@chromium.org> > Reviewed-by: Yang Guo <yangguo@chromium.org> > Cr-Commit-Position: refs/heads/master@{#51759} TBR=yangguo@chromium.org Bug: v8:6666 Change-Id: I89b0498f22b4ce573723748d55d86a82ba285a88 Cq-Include-Trybots: luci.chromium.try:linux_chromium_rel_ng;luci.v8.try:v8_linux64_fyi_rel_ng Reviewed-on: https://chromium-review.googlesource.com/957024 Reviewed-by: Yang Guo <yangguo@chromium.org> Reviewed-by: Michael Achenbach <machenbach@chromium.org> Reviewed-by: Jakob Gruber <jgruber@chromium.org> Commit-Queue: Jakob Gruber <jgruber@chromium.org> Cr-Commit-Position: refs/heads/master@{#51832}
2018-03-09 09:29:10 +00:00
V8_EMBEDDED_TEXT_HEADER(test_function0_bytes)
__asm__(FUNCTION_BYTES);
extern "C" V8_ALIGNED(16) const char test_function0_bytes[];
// clang-format on
// A historical note: We use .byte over .incbin since the latter leads to
// complications involving generation of build-time dependencies. Goma parses
// #include statements, and clang has -MD/-MMD. Neither recognize .incbin.
TEST(ByteInRodata) {
CHECK_EQ(0, std::strcmp("0123456789\n", test_string0_bytes));
}
TEST(ByteInText) {
CcTest::InitializeVM();
Isolate* isolate = CcTest::i_isolate();
auto f = GeneratedCode<int(int, int)>::FromAddress(
isolate, reinterpret_cast<Address>(&test_function0_bytes[0]));
CHECK_EQ(7, f.Call(3, 4));
CHECK_EQ(11, f.Call(5, 6));
}
Reland "Reland "[builtins] Add .incbin cctest"" This is a reland of ef06feded6c72d71baab96afc61e25a06b8373d8. Original change's description: > Reland "[builtins] Add .incbin cctest" > > This is a reland of b012816155bb1bb53c3f4fc839b8ba42dbb6af98. > > Original change's description: > > [builtins] Add .incbin cctest > > > > Just to ensure this is portable across all platforms. > > > > Credits go to https://github.com/graphitemaster/incbin, bits of the > > .incbin code were taken from there. Thanks! > > > > Reland of https://crrev.com/c/881181 > > > > Bug: v8:6666 > > Change-Id: I5c0dbf56b1c987fd88607dca69b39d65b59cdefc > > Reviewed-on: https://chromium-review.googlesource.com/895597 > > Commit-Queue: Jakob Gruber <jgruber@chromium.org> > > Reviewed-by: Michael Achenbach <machenbach@chromium.org> > > Cr-Commit-Position: refs/heads/master@{#51042} > > Cq-Include-Trybots: luci.v8.try:v8_win64_msvc_compile_rel > Bug: v8:6666 > Change-Id: I8fc0963e28996a84ed56c2e740d895e26611abf0 > Reviewed-on: https://chromium-review.googlesource.com/897630 > Commit-Queue: Jakob Gruber <jgruber@chromium.org> > Reviewed-by: Michael Achenbach <machenbach@chromium.org> > Cr-Commit-Position: refs/heads/master@{#51054} Bug: v8:6666 Change-Id: Icc6816e260dac2d8b8f6c9c4a2725b271dac4664 Cq-Include-Trybots: luci.v8.try:v8_win64_msvc_compile_rel;master.tryserver.chromium.linux:linux_chromium_rel_ng Reviewed-on: https://chromium-review.googlesource.com/898927 Commit-Queue: Jakob Gruber <jgruber@chromium.org> Reviewed-by: Michael Achenbach <machenbach@chromium.org> Cr-Commit-Position: refs/heads/master@{#51075}
2018-02-02 15:17:03 +00:00
#endif // #ifndef V8_COMPILER_IS_MSVC
#undef V8_COMPILER_IS_MSVC
#undef FUNCTION_BYTES
#undef GENERATE_TEST_FUNCTION_DATA
#undef TEST_FUNCTION_FILE
} // namespace test_isolate_independent_builtins
} // namespace internal
} // namespace v8