Commit 542aa4b2 authored by Michael Starzinger's avatar Michael Starzinger Committed by Commit Bot

[simulator] De-dupe {CALL_GENERATED_CODE} macro definition.

R=clemensh@chromium.org

Change-Id: Ib7e625763f0e017fe4490fb87c4e90e8d57489fd
Reviewed-on: https://chromium-review.googlesource.com/817442Reviewed-by: 's avatarClemens Hammacher <clemensh@chromium.org>
Commit-Queue: Michael Starzinger <mstarzinger@chromium.org>
Cr-Commit-Position: refs/heads/master@{#50001}
parent 943ccb98
......@@ -18,29 +18,7 @@
#include "src/base/platform/mutex.h"
#include "src/boxed-float.h"
#if !defined(USE_SIMULATOR)
// Running without a simulator on a native arm platform.
namespace v8 {
namespace internal {
// When running without a simulator we call the entry directly.
#define CALL_GENERATED_CODE(isolate, entry, p0, p1, p2, p3, p4) \
(entry(p0, p1, p2, p3, p4))
typedef int (*arm_regexp_matcher)(String*, int, const byte*, const byte*, int*,
int, Address, int, Isolate*);
// Call the generated regexp code directly. The code at the entry address
// should act as a function matching the type arm_regexp_matcher.
#define CALL_GENERATED_REGEXP_CODE(isolate, entry, p0, p1, p2, p3, p4, p5, p6, \
p7, p8) \
(FUNCTION_CAST<arm_regexp_matcher>(entry)(p0, p1, p2, p3, p4, p5, p6, p7, p8))
} // namespace internal
} // namespace v8
#else // !defined(USE_SIMULATOR)
#if defined(USE_SIMULATOR)
// Running with a simulator.
#include "src/arm/constants-arm.h"
......@@ -537,5 +515,5 @@ class Simulator {
} // namespace internal
} // namespace v8
#endif // !defined(USE_SIMULATOR)
#endif // defined(USE_SIMULATOR)
#endif // V8_ARM_SIMULATOR_ARM_H_
......@@ -21,31 +21,7 @@
namespace v8 {
namespace internal {
#if !defined(USE_SIMULATOR)
// Running without a simulator on a native ARM64 platform.
// When running without a simulator we call the entry directly.
#define CALL_GENERATED_CODE(isolate, entry, p0, p1, p2, p3, p4) \
(entry(p0, p1, p2, p3, p4))
typedef int (*arm64_regexp_matcher)(String* input,
int64_t start_offset,
const byte* input_start,
const byte* input_end,
int* output,
int64_t output_size,
Address stack_base,
int64_t direct_call,
Isolate* isolate);
// Call the generated regexp code directly. The code at the entry address
// should act as a function matching the type arm64_regexp_matcher.
#define CALL_GENERATED_REGEXP_CODE(isolate, entry, p0, p1, p2, p3, p4, p5, p6, \
p7, p8) \
(FUNCTION_CAST<arm64_regexp_matcher>(entry)(p0, p1, p2, p3, p4, p5, p6, p7, \
p8))
#else // !defined(USE_SIMULATOR)
#if defined(USE_SIMULATOR)
// Assemble the specified IEEE-754 components into the target type and apply
// appropriate rounding.
......@@ -2398,7 +2374,7 @@ inline float Simulator::FPDefaultNaN<float>() {
static_cast<int>(Simulator::current(isolate)->CallRegExp( \
entry, p0, p1, p2, p3, p4, p5, p6, p7, p8))
#endif // !defined(USE_SIMULATOR)
#endif // defined(USE_SIMULATOR)
} // namespace internal
} // namespace v8
......
......@@ -5,27 +5,6 @@
#ifndef V8_IA32_SIMULATOR_IA32_H_
#define V8_IA32_SIMULATOR_IA32_H_
#include "src/allocation.h"
namespace v8 {
namespace internal {
// Since there is no simulator for the ia32 architecture the only thing we can
// do is to call the entry directly.
#define CALL_GENERATED_CODE(isolate, entry, p0, p1, p2, p3, p4) \
(entry(p0, p1, p2, p3, p4))
typedef int (*regexp_matcher)(String*, int, const byte*,
const byte*, int*, int, Address, int, Isolate*);
// Call the generated regexp code directly. The code at the entry address should
// expect eight int/pointer sized arguments and return an int.
#define CALL_GENERATED_REGEXP_CODE(isolate, entry, p0, p1, p2, p3, p4, p5, p6, \
p7, p8) \
(FUNCTION_CAST<regexp_matcher>(entry)(p0, p1, p2, p3, p4, p5, p6, p7, p8))
} // namespace internal
} // namespace v8
// Since there is no simulator for the ia32 architecture this file is empty.
#endif // V8_IA32_SIMULATOR_IA32_H_
......@@ -16,40 +16,7 @@
#include "src/allocation.h"
#include "src/mips/constants-mips.h"
#if !defined(USE_SIMULATOR)
// Running without a simulator on a native mips platform.
namespace v8 {
namespace internal {
// When running without a simulator we call the entry directly.
#define CALL_GENERATED_CODE(isolate, entry, p0, p1, p2, p3, p4) \
entry(p0, p1, p2, p3, p4)
typedef int (*mips_regexp_matcher)(String*, int, const byte*, const byte*, int*,
int, Address, int, Isolate*);
// Call the generated regexp code directly. The code at the entry address
// should act as a function matching the type arm_regexp_matcher.
#define CALL_GENERATED_REGEXP_CODE(isolate, entry, p0, p1, p2, p3, p4, p5, p6, \
p7, p8) \
(FUNCTION_CAST<mips_regexp_matcher>(entry)(p0, p1, p2, p3, p4, p5, p6, p7, \
p8))
} // namespace internal
} // namespace v8
// Calculated the stack limit beyond which we will throw stack overflow errors.
// This macro must be called from a C++ method. It relies on being able to take
// the address of "this" to get a value on the current execution stack and then
// calculates the stack limit based on that value.
// NOTE: The check for overflow is not safe as there is no guarantee that the
// running thread has its stack in all memory up to address 0x00000000.
#define GENERATED_CODE_STACK_LIMIT(limit) \
(reinterpret_cast<uintptr_t>(this) >= limit ? \
reinterpret_cast<uintptr_t>(this) - limit : 0)
#else // !defined(USE_SIMULATOR)
#if defined(USE_SIMULATOR)
// Running with a simulator.
#include "src/assembler.h"
......@@ -612,5 +579,5 @@ class Simulator {
} // namespace internal
} // namespace v8
#endif // !defined(USE_SIMULATOR)
#endif // defined(USE_SIMULATOR)
#endif // V8_MIPS_SIMULATOR_MIPS_H_
......@@ -16,48 +16,7 @@
#include "src/allocation.h"
#include "src/mips64/constants-mips64.h"
#if !defined(USE_SIMULATOR)
// Running without a simulator on a native mips platform.
namespace v8 {
namespace internal {
// When running without a simulator we call the entry directly.
#define CALL_GENERATED_CODE(isolate, entry, p0, p1, p2, p3, p4) \
entry(p0, p1, p2, p3, p4)
// Call the generated regexp code directly. The code at the entry address
// should act as a function matching the type arm_regexp_matcher.
typedef int (*mips_regexp_matcher)(String* input,
int64_t start_offset,
const byte* input_start,
const byte* input_end,
int* output,
int64_t output_size,
Address stack_base,
int64_t direct_call,
Isolate* isolate);
#define CALL_GENERATED_REGEXP_CODE(isolate, entry, p0, p1, p2, p3, p4, p5, p6, \
p7, p8) \
(FUNCTION_CAST<mips_regexp_matcher>(entry)(p0, p1, p2, p3, p4, p5, p6, p7, \
p8))
} // namespace internal
} // namespace v8
// Calculated the stack limit beyond which we will throw stack overflow errors.
// This macro must be called from a C++ method. It relies on being able to take
// the address of "this" to get a value on the current execution stack and then
// calculates the stack limit based on that value.
// NOTE: The check for overflow is not safe as there is no guarantee that the
// running thread has its stack in all memory up to address 0x00000000.
#define GENERATED_CODE_STACK_LIMIT(limit) \
(reinterpret_cast<uintptr_t>(this) >= limit ? \
reinterpret_cast<uintptr_t>(this) - limit : 0)
#else // !defined(USE_SIMULATOR)
#if defined(USE_SIMULATOR)
// Running with a simulator.
#include "src/assembler.h"
......@@ -644,5 +603,5 @@ class Simulator {
} // namespace internal
} // namespace v8
#endif // !defined(USE_SIMULATOR)
#endif // defined(USE_SIMULATOR)
#endif // V8_MIPS_SIMULATOR_MIPS_H_
......@@ -15,29 +15,7 @@
#include "src/allocation.h"
#if !defined(USE_SIMULATOR)
// Running without a simulator on a native ppc platform.
namespace v8 {
namespace internal {
// When running without a simulator we call the entry directly.
#define CALL_GENERATED_CODE(isolate, entry, p0, p1, p2, p3, p4) \
(entry(p0, p1, p2, p3, p4))
typedef int (*ppc_regexp_matcher)(String*, int, const byte*, const byte*, int*,
int, Address, int, Isolate*);
// Call the generated regexp code directly. The code at the entry address
// should act as a function matching the type ppc_regexp_matcher.
#define CALL_GENERATED_REGEXP_CODE(isolate, entry, p0, p1, p2, p3, p4, p5, p6, \
p7, p8) \
(FUNCTION_CAST<ppc_regexp_matcher>(entry)(p0, p1, p2, p3, p4, p5, p6, p7, p8))
} // namespace internal
} // namespace v8
#else // !defined(USE_SIMULATOR)
#if defined(USE_SIMULATOR)
// Running with a simulator.
#include "src/assembler.h"
......@@ -477,5 +455,5 @@ class Simulator {
} // namespace internal
} // namespace v8
#endif // !defined(USE_SIMULATOR)
#endif // defined(USE_SIMULATOR)
#endif // V8_PPC_SIMULATOR_PPC_H_
......@@ -14,30 +14,7 @@
#include "src/allocation.h"
#if !defined(USE_SIMULATOR)
// Running without a simulator on a native s390 platform.
namespace v8 {
namespace internal {
// When running without a simulator we call the entry directly.
#define CALL_GENERATED_CODE(isolate, entry, p0, p1, p2, p3, p4) \
(entry(p0, p1, p2, p3, p4))
typedef int (*s390_regexp_matcher)(String*, int, const byte*, const byte*, int*,
int, Address, int, Isolate*);
// Call the generated regexp code directly. The code at the entry address
// should act as a function matching the type ppc_regexp_matcher.
#define CALL_GENERATED_REGEXP_CODE(isolate, entry, p0, p1, p2, p3, p4, p5, p6, \
p7, p8) \
(FUNCTION_CAST<s390_regexp_matcher>(entry)(p0, p1, p2, p3, p4, p5, p6, p7, \
p8))
} // namespace internal
} // namespace v8
#else // !defined(USE_SIMULATOR)
#if defined(USE_SIMULATOR)
// Running with a simulator.
#include "src/assembler.h"
......@@ -1243,5 +1220,5 @@ class Simulator {
} // namespace internal
} // namespace v8
#endif // !defined(USE_SIMULATOR)
#endif // defined(USE_SIMULATOR)
#endif // V8_S390_SIMULATOR_S390_H_
......@@ -79,6 +79,19 @@ class SimulatorStack : public v8::internal::AllStatic {
}
};
// When running without a simulator we call the entry directly.
#define CALL_GENERATED_CODE(isolate, entry, p0, p1, p2, p3, p4) \
(entry(p0, p1, p2, p3, p4))
typedef int (*regexp_matcher)(String*, int, const byte*, const byte*, int*, int,
Address, int, Isolate*);
// Call the generated regexp code directly. The code at the entry address
// should act as a function matching the type {regexp_matcher} above.
#define CALL_GENERATED_REGEXP_CODE(isolate, entry, p0, p1, p2, p3, p4, p5, p6, \
p7, p8) \
(FUNCTION_CAST<regexp_matcher>(entry)(p0, p1, p2, p3, p4, p5, p6, p7, p8))
#endif // defined(USE_SIMULATOR)
} // namespace internal
......
......@@ -3,3 +3,5 @@
// found in the LICENSE file.
#include "src/x64/simulator-x64.h"
// Since there is no simulator for the x64 architecture this file is empty.
......@@ -5,27 +5,6 @@
#ifndef V8_X64_SIMULATOR_X64_H_
#define V8_X64_SIMULATOR_X64_H_
#include "src/allocation.h"
namespace v8 {
namespace internal {
// Since there is no simulator for the x64 architecture the only thing we can
// do is to call the entry directly.
// TODO(X64): Don't pass p0, since it isn't used?
#define CALL_GENERATED_CODE(isolate, entry, p0, p1, p2, p3, p4) \
(entry(p0, p1, p2, p3, p4))
typedef int (*regexp_matcher)(String*, int, const byte*,
const byte*, int*, int, Address, int, Isolate*);
// Call the generated regexp code directly. The code at the entry address should
// expect eight int/pointer sized arguments and return an int.
#define CALL_GENERATED_REGEXP_CODE(isolate, entry, p0, p1, p2, p3, p4, p5, p6, \
p7, p8) \
(FUNCTION_CAST<regexp_matcher>(entry)(p0, p1, p2, p3, p4, p5, p6, p7, p8))
} // namespace internal
} // namespace v8
// Since there is no simulator for the x64 architecture this file is empty.
#endif // V8_X64_SIMULATOR_X64_H_
......@@ -27,7 +27,6 @@
#include <iostream> // NOLINT(readability/streams)
#include "src/arm/simulator-arm.h"
#include "src/assembler-inl.h"
#include "src/base/utils/random-number-generator.h"
#include "src/disassembler.h"
......@@ -35,6 +34,7 @@
#include "src/factory.h"
#include "src/macro-assembler.h"
#include "src/ostreams.h"
#include "src/simulator.h"
#include "src/v8.h"
#include "test/cctest/assembler-helper-arm.h"
#include "test/cctest/cctest.h"
......
......@@ -35,7 +35,7 @@
#include "src/factory.h"
#include "src/macro-assembler.h"
#include "src/mips/macro-assembler-mips.h"
#include "src/mips/simulator-mips.h"
#include "src/simulator.h"
#include "test/cctest/cctest.h"
......
......@@ -35,7 +35,7 @@
#include "src/factory.h"
#include "src/macro-assembler.h"
#include "src/mips64/macro-assembler-mips64.h"
#include "src/mips64/simulator-mips64.h"
#include "src/simulator.h"
#include "test/cctest/cctest.h"
......
......@@ -30,7 +30,7 @@
#include "src/disassembler.h"
#include "src/factory.h"
#include "src/ppc/assembler-ppc-inl.h"
#include "src/ppc/simulator-ppc.h"
#include "src/simulator.h"
#include "test/cctest/cctest.h"
namespace v8 {
......
......@@ -31,7 +31,7 @@
#include "src/factory.h"
#include "src/macro-assembler.h"
#include "src/s390/assembler-s390-inl.h"
#include "src/s390/simulator-s390.h"
#include "src/simulator.h"
#include "test/cctest/cctest.h"
namespace v8 {
......
......@@ -27,10 +27,10 @@
#include <stdlib.h>
#include "src/arm/simulator-arm.h"
#include "src/assembler-inl.h"
#include "src/macro-assembler.h"
#include "src/objects-inl.h"
#include "src/simulator.h"
#include "src/v8.h"
#include "test/cctest/cctest.h"
......
......@@ -32,8 +32,8 @@
#include "src/base/utils/random-number-generator.h"
#include "src/macro-assembler.h"
#include "src/mips/macro-assembler-mips.h"
#include "src/mips/simulator-mips.h"
#include "src/objects-inl.h"
#include "src/simulator.h"
#include "src/v8.h"
#include "test/cctest/cctest.h"
......
......@@ -34,8 +34,8 @@
#include "src/base/utils/random-number-generator.h"
#include "src/macro-assembler.h"
#include "src/mips64/macro-assembler-mips64.h"
#include "src/mips64/simulator-mips64.h"
#include "src/objects-inl.h"
#include "src/simulator.h"
namespace v8 {
namespace internal {
......
......@@ -29,11 +29,11 @@
#include "test/cctest/assembler-helper-arm.h"
#include "test/cctest/cctest.h"
#include "src/arm/simulator-arm.h"
#include "src/assembler-inl.h"
#include "src/disassembler.h"
#include "src/factory.h"
#include "src/macro-assembler.h"
#include "src/simulator.h"
namespace v8 {
namespace internal {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment