],
'arch:arm': ['assembler-arm.cc', 'builtins-arm.cc', 'codegen-arm.cc',
'cpu-arm.cc', 'disasm-arm.cc', 'frames-arm.cc', 'ic-arm.cc',
- 'macro-assembler-arm.cc', 'stub-cache-arm.cc'],
+ 'macro-assembler-arm.cc', 'regexp-macro-assembler-arm.cc',
+ 'stub-cache-arm.cc'],
'arch:ia32': ['assembler-ia32.cc', 'builtins-ia32.cc', 'codegen-ia32.cc',
'cpu-ia32.cc', 'disasm-ia32.cc', 'frames-ia32.cc', 'ic-ia32.cc',
'macro-assembler-ia32.cc', 'regexp-macro-assembler-ia32.cc',
// CodeGenerator::FastCaseSwitchMinCaseCount
// CodeGenerator::FastCaseSwitchMaxOverheadFactor
-#if defined(ARM)
+#ifdef ARM
#include "codegen-arm.h"
#else
#include "codegen-ia32.h"
#include "api.h"
#include "codegen-inl.h"
-#if defined(ARM) || defined (__arm__) || defined(__thumb__)
+#ifdef ARM
#include "simulator-arm.h"
#else // ia32
#include "simulator-ia32.h"
#define V8_FRAMES_INL_H_
#include "frames.h"
-#if defined(ARM) || defined (__arm__) || defined(__thumb__)
+#ifdef ARM
#include "frames-arm.h"
#else
#include "frames-ia32.h"
#include "assembler-irregexp.h"
#include "regexp-macro-assembler.h"
#include "regexp-macro-assembler-irregexp.h"
-#if defined __arm__ || defined __thumb__ || defined ARM
-// include regexp-macro-assembler-arm.h when created.
-#else // ia32
+
+#ifdef ARM
+#include "regexp-macro-assembler-arm.h"
+#else // IA32
+#include "macro-assembler-ia32.h"
#include "regexp-macro-assembler-ia32.h"
#endif
+
#include "interpreter-irregexp.h"
// Including pcre.h undefines DEBUG to avoid getting debug output from
return Handle<FixedArray>::null();
}
-#if !(defined ARM || defined __arm__ || defined __thumb__)
- if (FLAG_irregexp_native) { // Flag only checked in IA32 mode.
- // TODO(lrn) Move compilation to a later point in the life-cycle
- // of the RegExp. We don't know the type of input string yet.
- // For now, always assume two-byte strings.
+ if (FLAG_irregexp_native) {
+#ifdef ARM
+ UNIMPLEMENTED();
+#else // IA32
RegExpMacroAssemblerIA32 macro_assembler(RegExpMacroAssemblerIA32::UC16,
(input->capture_count + 1) * 2);
return compiler.Assemble(¯o_assembler,
node,
input->capture_count);
- }
#endif
+ }
byte codes[1024];
IrregexpAssembler assembler(Vector<byte>(codes, 1024));
RegExpMacroAssemblerIrregexp macro_assembler(&assembler);
#ifndef V8_MACRO_ASSEMBLER_H_
#define V8_MACRO_ASSEMBLER_H_
-#if defined(ARM) || defined (__arm__) || defined(__thumb__)
+#ifdef ARM
#include "constants-arm.h"
#include "assembler.h"
--- /dev/null
+// Copyright 2006-2008 the V8 project authors. All rights reserved.
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following
+// disclaimer in the documentation and/or other materials provided
+// with the distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived
+// from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+#include "v8.h"
+#include "ast.h"
+#include "regexp-macro-assembler.h"
+#include "regexp-macro-assembler-arm.h"
+
+namespace v8 { namespace internal {
+
+RegExpMacroAssemblerARM::RegExpMacroAssemblerARM() {
+ UNIMPLEMENTED();
+}
+
+
+RegExpMacroAssemblerARM::~RegExpMacroAssemblerARM() {}
+
+}} // namespace v8::internal
+
--- /dev/null
+// Copyright 2006-2008 the V8 project authors. All rights reserved.
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following
+// disclaimer in the documentation and/or other materials provided
+// with the distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived
+// from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+#ifndef REGEXP_MACRO_ASSEMBLER_ARM_H_
+#define REGEXP_MACRO_ASSEMBLER_ARM_H_
+
+namespace v8 { namespace internal {
+
+class RegExpMacroAssemblerARM: public RegExpMacroAssembler {
+ public:
+ RegExpMacroAssemblerARM();
+ virtual ~RegExpMacroAssemblerARM();
+};
+
+}} // namespace v8::internal
+
+#endif /* REGEXP_MACRO_ASSEMBLER_ARM_H_ */
#include "log.h"
#include "ast.h"
#include "macro-assembler.h"
+#include "regexp-macro-assembler.h"
+#include "macro-assembler-ia32.h"
#include "regexp-macro-assembler-ia32.h"
namespace v8 { namespace internal {
+
/*
* This assembler uses the following register assignment convention
* - edx : current character. Must be loaded using LoadCurrentCharacter
__ bind(&entry_label_);
__ push(esi);
__ push(edi);
- __ enter(Immediate(num_registers_ * sizeof(uint32_t)));
+ __ enter(Immediate(num_registers_ * kPointerSize));
__ mov(esi, Operand(ebp, kInputEndOffset));
__ mov(edi, Operand(ebp, kInputStartOffset));
__ sub(edi, Operand(esi));
if (char_size() == 2) {
__ shr(eax);
}
- __ mov(Operand(ebx, i * sizeof(int32_t)), eax);
+ __ mov(Operand(ebx, i * kPointerSize), eax);
}
}
__ mov(eax, Immediate(1));
Operand RegExpMacroAssemblerIA32::register_location(
int register_index) {
ASSERT(register_index < (1<<30));
- return Operand(ebp, -(register_index + 1) * sizeof(uint32_t));
+ return Operand(ebp, -(register_index + 1) * kPointerSize);
}
}
#undef __
-}}
+}} // namespace v8::internal
#ifndef REGEXP_MACRO_ASSEMBLER_IA32_H_
#define REGEXP_MACRO_ASSEMBLER_IA32_H_
-#if !(defined(ARM) || defined(__arm__) || defined(__thumb__))
-
-#include "regexp-macro-assembler.h"
-#include "macro-assembler-ia32.h"
-
namespace v8 { namespace internal {
class RegExpMacroAssemblerIA32: public RegExpMacroAssembler {
public:
+ // Type of input string to generate code for.
enum Mode {ASCII = 1, UC16 = 2};
+
RegExpMacroAssemblerIA32(Mode mode, int registers_to_save);
virtual ~RegExpMacroAssemblerIA32();
virtual void AdvanceCurrentPosition(int by);
virtual void Succeed();
virtual void WriteCurrentPositionToRegister(int reg);
virtual void WriteStackPointerToRegister(int reg);
+
private:
// Offsets from ebp of arguments to function.
static const int kBackup_edi = 1 * sizeof(uint32_t);
static const int kInputEndOffset = 6 * sizeof(uint32_t);
static const int kRegisterOutput = 7 * sizeof(uint32_t);
+ // Initial size of code buffer.
+ static const size_t kRegExpCodeSize = 1024;
+ // Initial size of constant buffers allocated during compilation.
+ static const int kRegExpConstantsSize = 256;
+ // Only unroll loops up to this length.
+ static const int kMaxInlineStringTests = 8;
+ // Special "character" marking end of input.
+ static const uint32_t kEndOfInput = ~0;
+
// The ebp-relative location of a regexp register.
Operand register_location(int register_index);
// (and checks if we have hit the stack limit too).
void CheckStackLimit();
- // Initial size of code buffer.
- static const size_t kRegExpCodeSize = 1024;
- // Initial size of constant buffers allocated during compilation.
- static const int kRegExpConstantsSize = 256;
- // Only unroll loops up to this length.
- static const int kMaxInlineStringTests = 8;
- // Special "character" marking end of input.
- static const uint32_t kEndOfInput = ~0;
-
MacroAssembler* masm_;
+ // Constant buffer provider. Allocates external storage for storing
+ // constants.
ByteArrayProvider constants_;
// Which mode to generate code for (ASCII or UTF16).
Mode mode_;
// Number of registers to output at the end (the saved registers
// are always 0..num_saved_registers_-1)
int num_saved_registers_;
- // Whether to generate code that is case-insensitive. Only relevant for
- // back-references.
+ // Labels used internally.
Label entry_label_;
Label start_label_;
Label success_label_;
// Handle used to represent the generated code object itself.
Handle<Object> self_;
};
-}}
-#endif // !ARM
+}} // namespace v8::internal
#endif /* REGEXP_MACRO_ASSEMBLER_IA32_H_ */
#include "assembler-irregexp.h"
#include "regexp-macro-assembler.h"
#include "regexp-macro-assembler-irregexp.h"
+#ifdef ARM
+#include "regexp-macro-assembler-arm.h"
+#else // IA32
+#include "macro-assembler-ia32.h"
#include "regexp-macro-assembler-ia32.h"
+#endif
#include "interpreter-irregexp.h"
}
-#if !(defined(ARM) || defined(__arm__) || defined(__thumb__))
+#ifndef ARM // IA32 only tests.
TEST(MacroAssemblerIA32Success) {
typedef bool (*AsciiTest) (
CHECK_EQ(9, output[4]);
}
-#endif // !(defined(ARM) || defined(__arm__) || defined(__thumb__))
+#endif // !defined ARM
TEST(AddInverseToTable) {
static const int kLimit = 1000;