}
},
'arch:ia32': {
- 'CPPDEFINES': ['V8_ARCH_IA32', 'ILP32']
+ 'CPPDEFINES': ['V8_TARGET_ARCH_IA32']
},
'arch:arm': {
- 'CPPDEFINES': ['V8_ARCH_ARM', 'ILP32']
+ 'CPPDEFINES': ['V8_TARGET_ARCH_ARM']
},
'arch:x64': {
- 'CPPDEFINES': ['V8_ARCH_X64', 'LP64']
+ 'CPPDEFINES': ['V8_TARGET_ARCH_X64']
},
'prof:oprofile': {
'CPPDEFINES': ['ENABLE_OPROFILE_AGENT']
'CCPDBFLAGS': ['/Zi']
},
'arch:ia32': {
- 'CPPDEFINES': ['V8_ARCH_IA32']
+ 'CPPDEFINES': ['V8_TARGET_ARCH_IA32']
},
'mode:debug': {
'CCFLAGS': ['/Od', '/Gm'],
'LIBS': ['winmm', 'ws2_32']
},
'arch:arm': {
- 'CPPDEFINES': ['V8_ARCH_ARM'],
+ 'CPPDEFINES': ['V8_TARGET_ARCH_ARM'],
# /wd4996 is to silence the warning about sscanf
# used by the arm simulator.
'WARNINGFLAGS': ['/wd4996']
'CPPDEFINES': ['USING_V8_SHARED']
},
'arch:ia32': {
- 'CPPDEFINES': ['V8_ARCH_IA32']
+ 'CPPDEFINES': ['V8_TARGET_ARCH_IA32']
}
}
}
}
},
'arch:ia32': {
- 'CPPDEFINES': ['V8_ARCH_IA32']
+ 'CPPDEFINES': ['V8_TARGET_ARCH_IA32']
},
'mode:debug': {
'CCFLAGS': ['/Od'],
enum OverwriteMode { NO_OVERWRITE, OVERWRITE_LEFT, OVERWRITE_RIGHT };
-#ifdef V8_ARCH_ARM
-#include "arm/codegen-arm.h"
-#endif
-
-#ifdef V8_ARCH_X64
-#include "x64/codegen-x64.h"
-#endif
-
-#ifdef V8_ARCH_IA32
+#if V8_TARGET_ARCH_IA32
#include "ia32/codegen-ia32.h"
+#elif V8_TARGET_ARCH_X64
+#include "x64/codegen-x64.h"
+#elif V8_TARGET_ARCH_ARM
+#include "arm/codegen-arm.h"
#endif
namespace v8 { namespace internal {
#include "api.h"
#include "codegen-inl.h"
-#ifdef V8_ARCH_ARM
-#include "arm/simulator-arm.h"
-#endif
-
-#ifdef V8_ARCH_X64
-#include "x64/simulator-x64.h"
-#endif
-
-#ifdef V8_ARCH_IA32
+#if V8_TARGET_ARCH_IA32
#include "ia32/simulator-ia32.h"
+#elif V8_TARGET_ARCH_X64
+#include "x64/simulator-x64.h"
+#elif V8_TARGET_ARCH_ARM
+#include "arm/simulator-arm.h"
#endif
#include "debug.h"
#define V8_FRAMES_INL_H_
#include "frames.h"
-#ifdef V8_ARCH_ARM
-#include "arm/frames-arm.h"
-#endif
-
-#ifdef V8_ARCH_X64
-#include "x64/frames-x64.h"
-#endif
-#ifdef V8_ARCH_IA32
+#if V8_TARGET_ARCH_IA32
#include "ia32/frames-ia32.h"
+#elif V8_TARGET_ARCH_X64
+#include "x64/frames-x64.h"
+#elif V8_TARGET_ARCH_ARM
+#include "arm/frames-arm.h"
#endif
-
namespace v8 { namespace internal {
namespace v8 { namespace internal {
+// Processor architecture detection. For more info on what's defined, see:
+// http://msdn.microsoft.com/en-us/library/b0084kay.aspx
+// http://www.agner.org/optimize/calling_conventions.pdf
+// or with gcc, run: "echo | gcc -E -dM -"
+#if defined(_M_X64) || defined(__x86_64__)
+#define V8_HOST_ARCH_X64 1
+#define V8_HOST_ARCH_64_BIT 1
+#define V8_HOST_CAN_READ_UNALIGNED 1
+#elif defined(_M_IX86) || defined(__i386__)
+#define V8_HOST_ARCH_IA32 1
+#define V8_HOST_ARCH_32_BIT 1
+#define V8_HOST_CAN_READ_UNALIGNED 1
+#elif defined(__ARMEL__)
+#define V8_HOST_ARCH_ARM 1
+#define V8_HOST_ARCH_32_BIT 1
+#else
+#error Your architecture was not detected as supported by v8
+#endif
+
// Support for alternative bool type. This is only enabled if the code is
// compiled with USE_MYBOOL defined. This catches some nasty type bugs.
// For instance, 'bool b = "false";' results in b == true! This is a hidden
// Define our own macros for writing 64-bit constants. This is less fragile
// than defining __STDC_CONSTANT_MACROS before including <stdint.h>, and it
// works on compilers that don't have it (like MSVC).
+#if V8_HOST_ARCH_64_BIT
#ifdef _MSC_VER
#define V8_UINT64_C(x) (x ## UI64)
#define V8_INT64_C(x) (x ## I64)
#else
-#define V8_UINT64_C(x) (x ## ULL)
-#define V8_INT64_C(x) (x ## LL)
+#define V8_UINT64_C(x) (x ## UL)
+#define V8_INT64_C(x) (x ## L)
#endif
+#endif // V8_HOST_ARCH_64_BIT
// Code-point values in Unicode 4.0 are 21 bits wide.
typedef uint16_t uc16;
typedef int32_t uc32;
-#if defined(V8_ARCH_IA32) || defined(V8_ARCH_X64)
-#define CAN_READ_UNALIGNED 1
-#endif
-
// -----------------------------------------------------------------------------
// Constants
const int kDoubleSize = sizeof(double); // NOLINT
const int kPointerSize = sizeof(void*); // NOLINT
-#ifdef V8_ARCH_X64
+#if V8_HOST_ARCH_64_BIT
const int kPointerSizeLog2 = 3;
#else
const int kPointerSizeLog2 = 2;
// Zap-value: The value used for zapping dead objects.
// Should be a recognizable hex value tagged as a heap object pointer.
-#ifdef V8_ARCH_X64
+#ifdef V8_HOST_ARCH_64_BIT
const Address kZapValue =
reinterpret_cast<Address>(V8_UINT64_C(0xdeadbeedbeadbeed));
const Address kHandleZapValue =
// exception'.
//
// Bit_cast uses the memcpy exception to move the bits from a variable of one
-// type o a variable of another type. Of course the end result is likely to
+// type of a variable of another type. Of course the end result is likely to
// be implementation dependent. Most compilers (gcc-4.2 and MSVC 2005)
// will completely optimize bit_cast away.
//
#include "regexp-macro-assembler-irregexp.h"
#include "regexp-stack.h"
-#ifdef V8_ARCH_ARM
-#include "arm/regexp-macro-assembler-arm.h"
-#endif
-
-#ifdef V8_ARCH_X64
-#include "x64/macro-assembler-x64.h"
-#include "x64/regexp-macro-assembler-x64.h"
-#endif
-
-#ifdef V8_ARCH_IA32
+#ifdef V8_TARGET_ARCH_IA32
#include "ia32/macro-assembler-ia32.h"
#include "ia32/regexp-macro-assembler-ia32.h"
+#elif V8_TARGET_ARCH_X64
+#include "x64/macro-assembler-x64.h"
+#include "x64/regexp-macro-assembler-x64.h"
+#elif V8_TARGET_ARCH_ARM
+#include "arm/regexp-macro-assembler-arm.h"
#endif
#include "interpreter-irregexp.h"
Handle<String> original_subject = subject;
Handle<FixedArray> regexp(FixedArray::cast(jsregexp->data()));
if (UseNativeRegexp()) {
-#ifdef V8_ARCH_ARM
- UNREACHABLE();
-#endif
-#ifdef V8_ARCH_X64
- UNIMPLEMENTED();
-#endif
-#ifdef V8_ARCH_IA32
+#if V8_TARGET_ARCH_IA32
RegExpMacroAssemblerIA32::Result res;
do {
bool is_ascii = subject->IsAsciiRepresentation();
|| res == RegExpMacroAssemblerIA32::FAILURE);
rc = (res == RegExpMacroAssemblerIA32::SUCCESS);
+#else
+ UNREACHABLE();
#endif
} else {
bool is_ascii = subject->IsAsciiRepresentation();
int ChoiceNode::CalculatePreloadCharacters(RegExpCompiler* compiler) {
int preload_characters = EatsAtLeast(4, 0);
-#ifdef CAN_READ_UNALIGNED
+#ifdef V8_HOST_CAN_READ_UNALIGNED
bool ascii = compiler->ascii();
if (ascii) {
if (preload_characters > 4) preload_characters = 4;
NodeInfo info = *node->info();
if (RegExpImpl::UseNativeRegexp()) {
-#ifdef V8_ARCH_ARM
+#ifdef V8_TARGET_ARCH_ARM
UNREACHABLE();
#endif
-#ifdef V8_ARCH_X64
+#ifdef V8_TARGET_ARCH_X64
UNREACHABLE();
#endif
-#ifdef V8_ARCH_IA32
+#ifdef V8_TARGET_ARCH_IA32
RegExpMacroAssemblerIA32::Mode mode;
if (is_ascii) {
mode = RegExpMacroAssemblerIA32::ASCII;
class RegExpImpl {
public:
static inline bool UseNativeRegexp() {
-#ifdef V8_ARCH_ARM
- return false;
-#endif
-#ifdef V8_ARCH_X64
- return false;
-#endif
-#ifdef V8_ARCH_IA32
+#ifdef V8_TARGET_ARCH_IA32
return FLAG_regexp_native;
+#else
+ return false;
#endif
}
// Creates a regular expression literal in the old space.
#ifndef V8_MACRO_ASSEMBLER_H_
#define V8_MACRO_ASSEMBLER_H_
-#ifdef V8_ARCH_ARM
-#include "arm/constants-arm.h"
+#if V8_TARGET_ARCH_IA32
#include "assembler.h"
-#include "arm/assembler-arm.h"
-#include "arm/assembler-arm-inl.h"
+#include "ia32/assembler-ia32.h"
+#include "ia32/assembler-ia32-inl.h"
#include "code.h" // must be after assembler_*.h
-#include "arm/macro-assembler-arm.h"
-#endif
-
-#ifdef V8_ARCH_X64
+#include "ia32/macro-assembler-ia32.h"
+#elif V8_TARGET_ARCH_X64
#include "assembler.h"
#include "x64/assembler-x64.h"
#include "x64/assembler-x64-inl.h"
#include "code.h" // must be after assembler_*.h
#include "x64/macro-assembler-x64.h"
-#endif
-
-#ifdef V8_ARCH_IA32
+#elif V8_TARGET_ARCH_ARM
+#include "arm/constants-arm.h"
#include "assembler.h"
-#include "ia32/assembler-ia32.h"
-#include "ia32/assembler-ia32-inl.h"
+#include "arm/assembler-arm.h"
+#include "arm/assembler-arm-inl.h"
#include "code.h" // must be after assembler_*.h
-#include "ia32/macro-assembler-ia32.h"
+#include "arm/macro-assembler-arm.h"
#endif
#endif // V8_MACRO_ASSEMBLER_H_
const Char* pa = a.start();
const Char* pb = b.start();
int i = 0;
-#ifndef CAN_READ_UNALIGNED
+#ifndef V8_HOST_CAN_READ_UNALIGNED
// If this architecture isn't comfortable reading unaligned ints
// then we have to check that the strings are aligned before
// comparing them blockwise.
return false;
}
}
-#ifndef CAN_READ_UNALIGNED
+#ifndef V8_HOST_CAN_READ_UNALIGNED
}
#endif
// Compare the remaining characters that didn't fit into a block.
template <typename sourcechar, typename sinkchar>
static inline void CopyChars(sinkchar* dest, const sourcechar* src, int chars) {
sinkchar* limit = dest + chars;
-#ifdef CAN_READ_UNALIGNED
+#ifdef V8_HOST_CAN_READ_UNALIGNED
if (sizeof(*dest) == sizeof(*src)) {
// Number of characters in a uint32_t.
static const int kStepSize = sizeof(uint32_t) / sizeof(*dest); // NOLINT
} } // namespace v8::internal
-#ifdef V8_ARCH_ARM
-#include "arm/virtual-frame-arm.h"
-#endif
-
-#ifdef V8_ARCH_X64
-#include "x64/virtual-frame-x64.h"
-#endif
-
-#ifdef V8_ARCH_IA32
+#if V8_TARGET_ARCH_IA32
#include "ia32/virtual-frame-ia32.h"
+#elif V8_TARGET_ARCH_X64
+#include "x64/virtual-frame-x64.h"
+#elif V8_TARGET_ARCH_ARM
+#include "arm/virtual-frame-arm.h"
#endif
#endif // V8_VIRTUAL_FRAME_H_
#include "jsregexp-inl.h"
#include "regexp-macro-assembler.h"
#include "regexp-macro-assembler-irregexp.h"
-#ifdef V8_ARCH_ARM
+#ifdef V8_TARGET_ARCH_ARM
#include "arm/regexp-macro-assembler-arm.h"
#endif
-#ifdef V8_ARCH_X64
+#ifdef V8_TARGET_ARCH_X64
// No X64-implementation yet.
#endif
-#ifdef V8_ARCH_IA32
+#ifdef V8_TARGET_ARCH_IA32
#include "ia32/macro-assembler-ia32.h"
#include "ia32/regexp-macro-assembler-ia32.h"
#endif
}
-#ifdef V8_ARCH_IA32 // IA32 only tests.
+#ifdef V8_TARGET_ARCH_IA32 // IA32 only tests.
class ContextInitializer {
public:
'target_name': 'v8_base',
'type': '<(library)',
'defines': [
- 'V8_ARCH_IA32'
+ 'V8_TARGET_ARCH_IA32'
],
'include_dirs+': [
'../../src',
'target_name': 'v8_nosnapshot',
'type': '<(library)',
'defines': [
- 'V8_ARCH_IA32'
+ 'V8_TARGET_ARCH_IA32'
],
'dependencies': [
'js2c',
'target_name': 'v8',
'type': '<(library)',
'defines': [
- 'V8_ARCH_IA32'
+ 'V8_TARGET_ARCH_IA32'
],
'dependencies': [
'js2c',
'target_name': 'v8_shell',
'type': 'executable',
'defines': [
- 'V8_ARCH_IA32'
+ 'V8_TARGET_ARCH_IA32'
],
'dependencies': [
'v8',
'v8',
],
'defines': [
- 'V8_ARCH_IA32'
+ 'V8_TARGET_ARCH_IA32'
],
'include_dirs': [
'../../src',
'js2c',
],
'defines': [
- 'V8_ARCH_ARM',
+ 'V8_TARGET_ARCH_ARM',
],
'include_dirs+': [
'../../src',
'v8_arm',
],
'defines': [
- 'V8_ARCH_ARM',
+ 'V8_TARGET_ARCH_ARM',
],
'sources': [
'../../samples/shell.cc',
'v8_arm',
],
'defines': [
- 'V8_ARCH_ARM',
+ 'V8_TARGET_ARCH_ARM',
],
'include_dirs': [
'../../src',
buildSettings = {
GCC_PREPROCESSOR_DEFINITIONS = (
"$(GCC_PREPROCESSOR_DEFINITIONS)",
- V8_ARCH_IA32,
+ V8_TARGET_ARCH_IA32,
DEBUG,
);
HEADER_SEARCH_PATHS = ../src;
buildSettings = {
GCC_PREPROCESSOR_DEFINITIONS = (
"$(GCC_PREPROCESSOR_DEFINITIONS)",
- V8_ARCH_IA32,
+ V8_TARGET_ARCH_IA32,
NDEBUG,
);
HEADER_SEARCH_PATHS = ../src;
GCC_PREPROCESSOR_DEFINITIONS = (
"$(GCC_PREPROCESSOR_DEFINITIONS)",
ENABLE_DISASSEMBLER,
- V8_ARCH_IA32,
+ V8_TARGET_ARCH_IA32,
ENABLE_LOGGING_AND_PROFILING,
);
HEADER_SEARCH_PATHS = ../src;
DEPLOYMENT_POSTPROCESSING = NO;
GCC_PREPROCESSOR_DEFINITIONS = (
"$(GCC_PREPROCESSOR_DEFINITIONS)",
- V8_ARCH_IA32,
+ V8_TARGET_ARCH_IA32,
NDEBUG,
);
HEADER_SEARCH_PATHS = ../src;
DEPLOYMENT_POSTPROCESSING = NO;
GCC_PREPROCESSOR_DEFINITIONS = (
"$(GCC_PREPROCESSOR_DEFINITIONS)",
- V8_ARCH_ARM,
+ V8_TARGET_ARCH_ARM,
ENABLE_DISASSEMBLER,
ENABLE_LOGGING_AND_PROFILING,
);
DEPLOYMENT_POSTPROCESSING = NO;
GCC_PREPROCESSOR_DEFINITIONS = (
"$(GCC_PREPROCESSOR_DEFINITIONS)",
- V8_ARCH_ARM,
+ V8_TARGET_ARCH_ARM,
);
HEADER_SEARCH_PATHS = ../src;
PRODUCT_NAME = "v8-arm";
>
<Tool
Name="VCCLCompilerTool"
- PreprocessorDefinitions="V8_ARCH_ARM"
+ PreprocessorDefinitions="V8_TARGET_ARCH_ARM"
DisableSpecificWarnings="4996"
/>
</VisualStudioPropertySheet>
>
<Tool
Name="VCCLCompilerTool"
- PreprocessorDefinitions="V8_ARCH_IA32"
+ PreprocessorDefinitions="V8_TARGET_ARCH_IA32"
/>
</VisualStudioPropertySheet>