Commit 72de7ab7 authored by lrn@chromium.org's avatar lrn@chromium.org

Separate native and interpreted regexp by compile time flag, not runtime.

Clean-up of RegExp code.

Review URL: http://codereview.chromium.org/155085


git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@2366 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 1bee2d8a
...@@ -95,7 +95,12 @@ ANDROID_LINKFLAGS = ['-nostdlib', ...@@ -95,7 +95,12 @@ ANDROID_LINKFLAGS = ['-nostdlib',
LIBRARY_FLAGS = { LIBRARY_FLAGS = {
'all': { 'all': {
'CPPDEFINES': ['ENABLE_LOGGING_AND_PROFILING'], 'CPPDEFINES': ['ENABLE_LOGGING_AND_PROFILING'],
'CPPPATH': [join(root_dir, 'src')] 'CPPPATH': [join(root_dir, 'src')],
'regexp:native': {
'arch:ia32' : {
'CPPDEFINES': ['V8_NATIVE_REGEXP']
}
}
}, },
'gcc': { 'gcc': {
'all': { 'all': {
...@@ -546,6 +551,11 @@ SIMPLE_OPTIONS = { ...@@ -546,6 +551,11 @@ SIMPLE_OPTIONS = {
'default': ARCH_GUESS, 'default': ARCH_GUESS,
'help': 'the architecture to build for (' + ARCH_GUESS + ')' 'help': 'the architecture to build for (' + ARCH_GUESS + ')'
}, },
'regexp': {
'values': ['native', 'interpreted'],
'default': 'native',
'help': 'Whether to use native or interpreted regexp implementation'
},
'snapshot': { 'snapshot': {
'values': ['on', 'off', 'nobuild'], 'values': ['on', 'off', 'nobuild'],
'default': 'off', 'default': 'off',
...@@ -677,6 +687,8 @@ def VerifyOptions(env): ...@@ -677,6 +687,8 @@ def VerifyOptions(env):
return False return False
if not IsLegal(env, 'sample', ["shell", "process"]): if not IsLegal(env, 'sample', ["shell", "process"]):
return False return False
if not IsLegal(env, 'regexp', ["native", "interpreted"]):
return False
if env['os'] == 'win32' and env['library'] == 'shared' and env['prof'] == 'on': if env['os'] == 'win32' and env['library'] == 'shared' and env['prof'] == 'on':
Abort("Profiling on windows only supported for static library.") Abort("Profiling on windows only supported for static library.")
if env['prof'] == 'oprofile' and env['os'] != 'linux': if env['prof'] == 'oprofile' and env['os'] != 'linux':
......
...@@ -208,8 +208,6 @@ DEFINE_bool(preemption, false, ...@@ -208,8 +208,6 @@ DEFINE_bool(preemption, false,
// Regexp // Regexp
DEFINE_bool(trace_regexps, false, "trace regexp execution") DEFINE_bool(trace_regexps, false, "trace regexp execution")
DEFINE_bool(regexp_native, true,
"use native code regexp implementation (IA32 only)")
DEFINE_bool(regexp_optimization, true, "generate optimized regexp code") DEFINE_bool(regexp_optimization, true, "generate optimized regexp code")
// Testing flags test/cctest/test-{flags,api,serialization}.cc // Testing flags test/cctest/test-{flags,api,serialization}.cc
......
...@@ -263,7 +263,6 @@ Handle<Object> RegExpImpl::AtomExec(Handle<JSRegExp> re, ...@@ -263,7 +263,6 @@ Handle<Object> RegExpImpl::AtomExec(Handle<JSRegExp> re,
// Irregexp implementation. // Irregexp implementation.
// Ensures that the regexp object contains a compiled version of the // Ensures that the regexp object contains a compiled version of the
// source for either ASCII or non-ASCII strings. // source for either ASCII or non-ASCII strings.
// If the compiled version doesn't already exist, it is compiled // If the compiled version doesn't already exist, it is compiled
...@@ -271,25 +270,26 @@ Handle<Object> RegExpImpl::AtomExec(Handle<JSRegExp> re, ...@@ -271,25 +270,26 @@ Handle<Object> RegExpImpl::AtomExec(Handle<JSRegExp> re,
// If compilation fails, an exception is thrown and this function // If compilation fails, an exception is thrown and this function
// returns false. // returns false.
bool RegExpImpl::EnsureCompiledIrregexp(Handle<JSRegExp> re, bool is_ascii) { bool RegExpImpl::EnsureCompiledIrregexp(Handle<JSRegExp> re, bool is_ascii) {
int index; #ifdef V8_NATIVE_REGEXP
if (is_ascii) { if (re->DataAt(JSRegExp::code_index(is_ascii))->IsCode()) return true;
index = JSRegExp::kIrregexpASCIICodeIndex; #else // ! V8_NATIVE_REGEXP (RegExp interpreter code)
} else { if (re->DataAt(JSRegExp::code_index(is_ascii))->IsByteArray()) return true;
index = JSRegExp::kIrregexpUC16CodeIndex; #endif
} return CompileIrregexp(re, is_ascii);
Object* entry = re->DataAt(index); }
if (!entry->IsTheHole()) {
// A value has already been compiled.
if (entry->IsJSObject()) {
// If it's a JS value, it's an error.
Top::Throw(entry);
return false;
}
return true;
}
bool RegExpImpl::CompileIrregexp(Handle<JSRegExp> re, bool is_ascii) {
// Compile the RegExp. // Compile the RegExp.
CompilationZoneScope zone_scope(DELETE_ON_EXIT); CompilationZoneScope zone_scope(DELETE_ON_EXIT);
Object* entry = re->DataAt(JSRegExp::code_index(is_ascii));
if (entry->IsJSObject()) {
// If it's a JSObject, a previous compilation failed and threw this object.
// Re-throw the object without trying again.
Top::Throw(entry);
return false;
}
ASSERT(entry->IsTheHole());
JSRegExp::Flags flags = re->GetFlags(); JSRegExp::Flags flags = re->GetFlags();
...@@ -302,7 +302,7 @@ bool RegExpImpl::EnsureCompiledIrregexp(Handle<JSRegExp> re, bool is_ascii) { ...@@ -302,7 +302,7 @@ bool RegExpImpl::EnsureCompiledIrregexp(Handle<JSRegExp> re, bool is_ascii) {
FlatStringReader reader(pattern); FlatStringReader reader(pattern);
if (!ParseRegExp(&reader, flags.is_multiline(), &compile_data)) { if (!ParseRegExp(&reader, flags.is_multiline(), &compile_data)) {
// Throw an exception if we fail to parse the pattern. // Throw an exception if we fail to parse the pattern.
// THIS SHOULD NOT HAPPEN. We already parsed it successfully once. // THIS SHOULD NOT HAPPEN. We already pre-parsed it successfully once.
ThrowRegExpException(re, ThrowRegExpException(re,
pattern, pattern,
compile_data.error, compile_data.error,
...@@ -325,17 +325,15 @@ bool RegExpImpl::EnsureCompiledIrregexp(Handle<JSRegExp> re, bool is_ascii) { ...@@ -325,17 +325,15 @@ bool RegExpImpl::EnsureCompiledIrregexp(Handle<JSRegExp> re, bool is_ascii) {
Handle<Object> regexp_err = Handle<Object> regexp_err =
Factory::NewSyntaxError("malformed_regexp", array); Factory::NewSyntaxError("malformed_regexp", array);
Top::Throw(*regexp_err); Top::Throw(*regexp_err);
re->SetDataAt(index, *regexp_err); re->SetDataAt(JSRegExp::code_index(is_ascii), *regexp_err);
return false; return false;
} }
NoHandleAllocation no_handles; Handle<FixedArray> data = Handle<FixedArray>(FixedArray::cast(re->data()));
data->set(JSRegExp::code_index(is_ascii), result.code);
FixedArray* data = FixedArray::cast(re->data()); int register_max = IrregexpMaxRegisterCount(*data);
data->set(index, result.code);
int register_max = IrregexpMaxRegisterCount(data);
if (result.num_registers > register_max) { if (result.num_registers > register_max) {
SetIrregexpMaxRegisterCount(data, result.num_registers); SetIrregexpMaxRegisterCount(*data, result.num_registers);
} }
return true; return true;
...@@ -364,24 +362,12 @@ int RegExpImpl::IrregexpNumberOfRegisters(FixedArray* re) { ...@@ -364,24 +362,12 @@ int RegExpImpl::IrregexpNumberOfRegisters(FixedArray* re) {
ByteArray* RegExpImpl::IrregexpByteCode(FixedArray* re, bool is_ascii) { ByteArray* RegExpImpl::IrregexpByteCode(FixedArray* re, bool is_ascii) {
int index; return ByteArray::cast(re->get(JSRegExp::code_index(is_ascii)));
if (is_ascii) {
index = JSRegExp::kIrregexpASCIICodeIndex;
} else {
index = JSRegExp::kIrregexpUC16CodeIndex;
}
return ByteArray::cast(re->get(index));
} }
Code* RegExpImpl::IrregexpNativeCode(FixedArray* re, bool is_ascii) { Code* RegExpImpl::IrregexpNativeCode(FixedArray* re, bool is_ascii) {
int index; return Code::cast(re->get(JSRegExp::code_index(is_ascii)));
if (is_ascii) {
index = JSRegExp::kIrregexpASCIICodeIndex;
} else {
index = JSRegExp::kIrregexpUC16CodeIndex;
}
return Code::cast(re->get(index));
} }
...@@ -408,12 +394,14 @@ Handle<Object> RegExpImpl::IrregexpExec(Handle<JSRegExp> jsregexp, ...@@ -408,12 +394,14 @@ Handle<Object> RegExpImpl::IrregexpExec(Handle<JSRegExp> jsregexp,
int number_of_capture_registers = int number_of_capture_registers =
(IrregexpNumberOfCaptures(FixedArray::cast(jsregexp->data())) + 1) * 2; (IrregexpNumberOfCaptures(FixedArray::cast(jsregexp->data())) + 1) * 2;
#ifndef V8_NATIVE_REGEXP
#ifdef DEBUG #ifdef DEBUG
if (FLAG_trace_regexp_bytecodes) { if (FLAG_trace_regexp_bytecodes) {
String* pattern = jsregexp->Pattern(); String* pattern = jsregexp->Pattern();
PrintF("\n\nRegexp match: /%s/\n\n", *(pattern->ToCString())); PrintF("\n\nRegexp match: /%s/\n\n", *(pattern->ToCString()));
PrintF("\n\nSubject string: '%s'\n\n", *(subject->ToCString())); PrintF("\n\nSubject string: '%s'\n\n", *(subject->ToCString()));
} }
#endif
#endif #endif
if (!subject->IsFlat()) { if (!subject->IsFlat()) {
...@@ -422,88 +410,83 @@ Handle<Object> RegExpImpl::IrregexpExec(Handle<JSRegExp> jsregexp, ...@@ -422,88 +410,83 @@ Handle<Object> RegExpImpl::IrregexpExec(Handle<JSRegExp> jsregexp,
last_match_info->EnsureSize(number_of_capture_registers + kLastMatchOverhead); last_match_info->EnsureSize(number_of_capture_registers + kLastMatchOverhead);
bool rc; Handle<FixedArray> array;
// We have to initialize this with something to make gcc happy but we can't
// initialize it with its real value until after the GC-causing things are
// over.
FixedArray* array = NULL;
// Dispatch to the correct RegExp implementation. // Dispatch to the correct RegExp implementation.
Handle<String> original_subject = subject;
Handle<FixedArray> regexp(FixedArray::cast(jsregexp->data())); Handle<FixedArray> regexp(FixedArray::cast(jsregexp->data()));
if (UseNativeRegexp()) { #ifdef V8_NATIVE_REGEXP
#if V8_TARGET_ARCH_IA32 #if V8_TARGET_ARCH_IA32
OffsetsVector captures(number_of_capture_registers); OffsetsVector captures(number_of_capture_registers);
int* captures_vector = captures.vector(); int* captures_vector = captures.vector();
RegExpMacroAssemblerIA32::Result res; RegExpMacroAssemblerIA32::Result res;
do { do {
bool is_ascii = subject->IsAsciiRepresentation();
if (!EnsureCompiledIrregexp(jsregexp, is_ascii)) {
return Handle<Object>::null();
}
Handle<Code> code(RegExpImpl::IrregexpNativeCode(*regexp, is_ascii));
res = RegExpMacroAssemblerIA32::Match(code,
subject,
captures_vector,
captures.length(),
previous_index);
// If result is RETRY, the string have changed representation, and we
// must restart from scratch.
} while (res == RegExpMacroAssemblerIA32::RETRY);
if (res == RegExpMacroAssemblerIA32::EXCEPTION) {
ASSERT(Top::has_pending_exception());
return Handle<Object>::null();
}
ASSERT(res == RegExpMacroAssemblerIA32::SUCCESS
|| res == RegExpMacroAssemblerIA32::FAILURE);
rc = (res == RegExpMacroAssemblerIA32::SUCCESS);
if (!rc) return Factory::null_value();
array = last_match_info->elements();
ASSERT(array->length() >= number_of_capture_registers + kLastMatchOverhead);
// The captures come in (start, end+1) pairs.
for (int i = 0; i < number_of_capture_registers; i += 2) {
SetCapture(array, i, captures_vector[i]);
SetCapture(array, i + 1, captures_vector[i + 1]);
}
#else // !V8_TARGET_ARCH_IA32
UNREACHABLE();
#endif
} else {
bool is_ascii = subject->IsAsciiRepresentation(); bool is_ascii = subject->IsAsciiRepresentation();
if (!EnsureCompiledIrregexp(jsregexp, is_ascii)) { if (!EnsureCompiledIrregexp(jsregexp, is_ascii)) {
return Handle<Object>::null(); return Handle<Object>::null();
} }
// Now that we have done EnsureCompiledIrregexp we can get the number of Handle<Code> code(RegExpImpl::IrregexpNativeCode(*regexp, is_ascii));
// registers. res = RegExpMacroAssemblerIA32::Match(code,
int number_of_registers = subject,
IrregexpNumberOfRegisters(FixedArray::cast(jsregexp->data())); captures_vector,
OffsetsVector registers(number_of_registers); captures.length(),
int* register_vector = registers.vector(); previous_index);
for (int i = number_of_capture_registers - 1; i >= 0; i--) { // If result is RETRY, the string have changed representation, and we
register_vector[i] = -1; // must restart from scratch.
} } while (res == RegExpMacroAssemblerIA32::RETRY);
Handle<ByteArray> byte_codes(IrregexpByteCode(*regexp, is_ascii)); if (res == RegExpMacroAssemblerIA32::EXCEPTION) {
ASSERT(Top::has_pending_exception());
rc = IrregexpInterpreter::Match(byte_codes, return Handle<Object>::null();
subject,
register_vector,
previous_index);
if (!rc) return Factory::null_value();
array = last_match_info->elements();
ASSERT(array->length() >= number_of_capture_registers + kLastMatchOverhead);
// The captures come in (start, end+1) pairs.
for (int i = 0; i < number_of_capture_registers; i += 2) {
SetCapture(array, i, register_vector[i]);
SetCapture(array, i + 1, register_vector[i + 1]);
}
} }
ASSERT(res == RegExpMacroAssemblerIA32::SUCCESS
|| res == RegExpMacroAssemblerIA32::FAILURE);
SetLastCaptureCount(array, number_of_capture_registers); if (res != RegExpMacroAssemblerIA32::SUCCESS) return Factory::null_value();
SetLastSubject(array, *original_subject);
SetLastInput(array, *original_subject); array = Handle<FixedArray>(last_match_info->elements());
ASSERT(array->length() >= number_of_capture_registers + kLastMatchOverhead);
// The captures come in (start, end+1) pairs.
for (int i = 0; i < number_of_capture_registers; i += 2) {
SetCapture(*array, i, captures_vector[i]);
SetCapture(*array, i + 1, captures_vector[i + 1]);
}
#else // !V8_TARGET_ARCH_IA32
UNREACHABLE();
#endif // V8_TARGET_ARCH_IA32
#else // !V8_NATIVE_REGEXP
bool is_ascii = subject->IsAsciiRepresentation();
if (!EnsureCompiledIrregexp(jsregexp, is_ascii)) {
return Handle<Object>::null();
}
// Now that we have done EnsureCompiledIrregexp we can get the number of
// registers.
int number_of_registers =
IrregexpNumberOfRegisters(FixedArray::cast(jsregexp->data()));
OffsetsVector registers(number_of_registers);
int* register_vector = registers.vector();
for (int i = number_of_capture_registers - 1; i >= 0; i--) {
register_vector[i] = -1;
}
Handle<ByteArray> byte_codes(IrregexpByteCode(*regexp, is_ascii));
if (!IrregexpInterpreter::Match(byte_codes,
subject,
register_vector,
previous_index)) {
return Factory::null_value();
}
array = Handle<FixedArray>(last_match_info->elements());
ASSERT(array->length() >= number_of_capture_registers + kLastMatchOverhead);
// The captures come in (start, end+1) pairs.
for (int i = 0; i < number_of_capture_registers; i += 2) {
SetCapture(*array, i, register_vector[i]);
SetCapture(*array, i + 1, register_vector[i + 1]);
}
#endif // V8_NATIVE_REGEXP
SetLastCaptureCount(*array, number_of_capture_registers);
SetLastSubject(*array, *subject);
SetLastInput(*array, *subject);
return last_match_info; return last_match_info;
} }
...@@ -4474,35 +4457,38 @@ RegExpEngine::CompilationResult RegExpEngine::Compile(RegExpCompileData* data, ...@@ -4474,35 +4457,38 @@ RegExpEngine::CompilationResult RegExpEngine::Compile(RegExpCompileData* data,
NodeInfo info = *node->info(); NodeInfo info = *node->info();
if (RegExpImpl::UseNativeRegexp()) { #ifdef V8_NATIVE_REGEXP
#ifdef V8_TARGET_ARCH_ARM #ifdef V8_TARGET_ARCH_ARM
UNREACHABLE(); // ARM native regexp not implemented yet.
UNREACHABLE();
#endif #endif
#ifdef V8_TARGET_ARCH_X64 #ifdef V8_TARGET_ARCH_X64
UNREACHABLE(); // X64 native regexp not implemented yet.
UNREACHABLE();
#endif #endif
#ifdef V8_TARGET_ARCH_IA32 #ifdef V8_TARGET_ARCH_IA32
RegExpMacroAssemblerIA32::Mode mode; RegExpMacroAssemblerIA32::Mode mode;
if (is_ascii) { if (is_ascii) {
mode = RegExpMacroAssemblerIA32::ASCII; mode = RegExpMacroAssemblerIA32::ASCII;
} else { } else {
mode = RegExpMacroAssemblerIA32::UC16; mode = RegExpMacroAssemblerIA32::UC16;
}
RegExpMacroAssemblerIA32 macro_assembler(mode,
(data->capture_count + 1) * 2);
return compiler.Assemble(&macro_assembler,
node,
data->capture_count,
pattern);
#endif
} }
RegExpMacroAssemblerIA32 macro_assembler(mode,
(data->capture_count + 1) * 2);
return compiler.Assemble(&macro_assembler,
node,
data->capture_count,
pattern);
#endif
#else // ! V8_NATIVE_REGEXP
// Interpreted regexp.
EmbeddedVector<byte, 1024> codes; EmbeddedVector<byte, 1024> codes;
RegExpMacroAssemblerIrregexp macro_assembler(codes); RegExpMacroAssemblerIrregexp macro_assembler(codes);
return compiler.Assemble(&macro_assembler, return compiler.Assemble(&macro_assembler,
node, node,
data->capture_count, data->capture_count,
pattern); pattern);
#endif // V8_NATIVE_REGEXP
} }
}} // namespace v8::internal }} // namespace v8::internal
...@@ -37,13 +37,15 @@ class RegExpMacroAssembler; ...@@ -37,13 +37,15 @@ class RegExpMacroAssembler;
class RegExpImpl { class RegExpImpl {
public: public:
static inline bool UseNativeRegexp() { // Whether V8 is compiled with native regexp support or not.
#ifdef V8_TARGET_ARCH_IA32 static bool UsesNativeRegExp() {
return FLAG_regexp_native; #ifdef V8_NATIVE_REGEXP
return true;
#else #else
return false; return false;
#endif #endif
} }
// Creates a regular expression literal in the old space. // Creates a regular expression literal in the old space.
// This function calls the garbage collector if necessary. // This function calls the garbage collector if necessary.
static Handle<Object> CreateRegExpLiteral(Handle<JSFunction> constructor, static Handle<Object> CreateRegExpLiteral(Handle<JSFunction> constructor,
...@@ -148,7 +150,8 @@ class RegExpImpl { ...@@ -148,7 +150,8 @@ class RegExpImpl {
static String* last_ascii_string_; static String* last_ascii_string_;
static String* two_byte_cached_string_; static String* two_byte_cached_string_;
static bool EnsureCompiledIrregexp(Handle<JSRegExp> re, bool is_ascii); static bool CompileIrregexp(Handle<JSRegExp> re, bool is_ascii);
static inline bool EnsureCompiledIrregexp(Handle<JSRegExp> re, bool is_ascii);
// Set the subject cache. The previous string buffer is not deleted, so the // Set the subject cache. The previous string buffer is not deleted, so the
......
...@@ -714,7 +714,7 @@ void JSRegExp::JSRegExpVerify() { ...@@ -714,7 +714,7 @@ void JSRegExp::JSRegExpVerify() {
break; break;
} }
case JSRegExp::IRREGEXP: { case JSRegExp::IRREGEXP: {
bool is_native = RegExpImpl::UseNativeRegexp(); bool is_native = RegExpImpl::UsesNativeRegExp();
FixedArray* arr = FixedArray::cast(data()); FixedArray* arr = FixedArray::cast(data());
Object* ascii_data = arr->get(JSRegExp::kIrregexpASCIICodeIndex); Object* ascii_data = arr->get(JSRegExp::kIrregexpASCIICodeIndex);
......
...@@ -3270,6 +3270,9 @@ class JSRegExp: public JSObject { ...@@ -3270,6 +3270,9 @@ class JSRegExp: public JSObject {
inline Object* DataAt(int index); inline Object* DataAt(int index);
// Set implementation data after the object has been prepared. // Set implementation data after the object has been prepared.
inline void SetDataAt(int index, Object* value); inline void SetDataAt(int index, Object* value);
static int code_index(bool is_ascii) {
return is_ascii ? kIrregexpASCIICodeIndex : kIrregexpUC16CodeIndex;
}
static inline JSRegExp* cast(Object* obj); static inline JSRegExp* cast(Object* obj);
......
...@@ -1016,16 +1016,16 @@ static Object* Runtime_RegExpExec(Arguments args) { ...@@ -1016,16 +1016,16 @@ static Object* Runtime_RegExpExec(Arguments args) {
ASSERT(args.length() == 4); ASSERT(args.length() == 4);
CONVERT_ARG_CHECKED(JSRegExp, regexp, 0); CONVERT_ARG_CHECKED(JSRegExp, regexp, 0);
CONVERT_ARG_CHECKED(String, subject, 1); CONVERT_ARG_CHECKED(String, subject, 1);
// Due to the way the JS files are constructed this must be less than the // Due to the way the JS calls are constructed this must be less than the
// length of a string, i.e. it is always a Smi. We check anyway for security. // length of a string, i.e. it is always a Smi. We check anyway for security.
CONVERT_CHECKED(Smi, index, args[2]); CONVERT_SMI_CHECKED(index, args[2]);
CONVERT_ARG_CHECKED(JSArray, last_match_info, 3); CONVERT_ARG_CHECKED(JSArray, last_match_info, 3);
RUNTIME_ASSERT(last_match_info->HasFastElements()); RUNTIME_ASSERT(last_match_info->HasFastElements());
RUNTIME_ASSERT(index->value() >= 0); RUNTIME_ASSERT(index >= 0);
RUNTIME_ASSERT(index->value() <= subject->length()); RUNTIME_ASSERT(index <= subject->length());
Handle<Object> result = RegExpImpl::Exec(regexp, Handle<Object> result = RegExpImpl::Exec(regexp,
subject, subject,
index->value(), index,
last_match_info); last_match_info);
if (result.is_null()) return Failure::Exception(); if (result.is_null()) return Failure::Exception();
return *result; return *result;
......
...@@ -4892,6 +4892,7 @@ TEST(DebugBreakInMessageHandler) { ...@@ -4892,6 +4892,7 @@ TEST(DebugBreakInMessageHandler) {
} }
#ifdef V8_NATIVE_REGEXP
// Debug event handler which gets the function on the top frame and schedules a // Debug event handler which gets the function on the top frame and schedules a
// break a number of times. // break a number of times.
static void DebugEventDebugBreak( static void DebugEventDebugBreak(
...@@ -4928,11 +4929,10 @@ static void DebugEventDebugBreak( ...@@ -4928,11 +4929,10 @@ static void DebugEventDebugBreak(
TEST(RegExpDebugBreak) { TEST(RegExpDebugBreak) {
// This test only applies to native regexps.
v8::HandleScope scope; v8::HandleScope scope;
DebugLocalContext env; DebugLocalContext env;
i::FLAG_regexp_native = true;
// Create a function for checking the function when hitting a break point. // Create a function for checking the function when hitting a break point.
frame_function_name = CompileFunction(&env, frame_function_name = CompileFunction(&env,
frame_function_name_source, frame_function_name_source,
...@@ -4957,6 +4957,7 @@ TEST(RegExpDebugBreak) { ...@@ -4957,6 +4957,7 @@ TEST(RegExpDebugBreak) {
CHECK_EQ(20, break_point_hit_count); CHECK_EQ(20, break_point_hit_count);
CHECK_EQ("exec", last_function_hit); CHECK_EQ("exec", last_function_hit);
} }
#endif // V8_NATIVE_REGEXP
// Common part of EvalContextData and NestedBreakEventContextData tests. // Common part of EvalContextData and NestedBreakEventContextData tests.
......
...@@ -597,6 +597,8 @@ TEST(DispatchTableConstruction) { ...@@ -597,6 +597,8 @@ TEST(DispatchTableConstruction) {
} }
// Tests of interpreter.
TEST(MacroAssembler) { TEST(MacroAssembler) {
V8::Initialize(NULL); V8::Initialize(NULL);
byte codes[1024]; byte codes[1024];
...@@ -660,8 +662,8 @@ TEST(MacroAssembler) { ...@@ -660,8 +662,8 @@ TEST(MacroAssembler) {
CHECK_EQ(42, captures[0]); CHECK_EQ(42, captures[0]);
} }
#ifdef V8_TARGET_ARCH_IA32 // IA32 Native Regexp only tests.
#ifdef V8_TARGET_ARCH_IA32 // IA32 only tests. #ifdef V8_NATIVE_REGEXP
class ContextInitializer { class ContextInitializer {
public: public:
...@@ -1284,10 +1286,10 @@ TEST(MacroAssemblerIA32LotsOfRegisters) { ...@@ -1284,10 +1286,10 @@ TEST(MacroAssemblerIA32LotsOfRegisters) {
Top::clear_pending_exception(); Top::clear_pending_exception();
} }
#endif // V8_REGEXP_NATIVE
#endif // V8_TARGET_ARCH_IA32
#endif // !defined ARM
TEST(AddInverseToTable) { TEST(AddInverseToTable) {
static const int kLimit = 1000; static const int kLimit = 1000;
static const int kRangeCount = 16; static const int kRangeCount = 16;
......
...@@ -419,7 +419,8 @@ ...@@ -419,7 +419,8 @@
'target_name': 'v8_base', 'target_name': 'v8_base',
'type': '<(library)', 'type': '<(library)',
'defines': [ 'defines': [
'V8_TARGET_ARCH_IA32' 'V8_TARGET_ARCH_IA32',
'V8_NATIVE_REGEXP'
], ],
'include_dirs+': [ 'include_dirs+': [
'../../src', '../../src',
...@@ -477,7 +478,8 @@ ...@@ -477,7 +478,8 @@
'target_name': 'v8_nosnapshot', 'target_name': 'v8_nosnapshot',
'type': '<(library)', 'type': '<(library)',
'defines': [ 'defines': [
'V8_TARGET_ARCH_IA32' 'V8_TARGET_ARCH_IA32',
'V8_NATIVE_REGEXP'
], ],
'dependencies': [ 'dependencies': [
'js2c', 'js2c',
...@@ -509,7 +511,8 @@ ...@@ -509,7 +511,8 @@
'target_name': 'v8', 'target_name': 'v8',
'type': '<(library)', 'type': '<(library)',
'defines': [ 'defines': [
'V8_TARGET_ARCH_IA32' 'V8_TARGET_ARCH_IA32',
'V8_NATIVE_REGEXP'
], ],
'dependencies': [ 'dependencies': [
'js2c', 'js2c',
...@@ -549,7 +552,8 @@ ...@@ -549,7 +552,8 @@
'target_name': 'v8_shell', 'target_name': 'v8_shell',
'type': 'executable', 'type': 'executable',
'defines': [ 'defines': [
'V8_TARGET_ARCH_IA32' 'V8_TARGET_ARCH_IA32',
'V8_NATIVE_REGEXP'
], ],
'dependencies': [ 'dependencies': [
'v8', 'v8',
...@@ -579,7 +583,8 @@ ...@@ -579,7 +583,8 @@
'v8', 'v8',
], ],
'defines': [ 'defines': [
'V8_TARGET_ARCH_IA32' 'V8_TARGET_ARCH_IA32',
'V8_NATIVE_REGEXP'
], ],
'include_dirs': [ 'include_dirs': [
'../../src', '../../src',
......
...@@ -1449,6 +1449,7 @@ ...@@ -1449,6 +1449,7 @@
GCC_PREPROCESSOR_DEFINITIONS = ( GCC_PREPROCESSOR_DEFINITIONS = (
"$(GCC_PREPROCESSOR_DEFINITIONS)", "$(GCC_PREPROCESSOR_DEFINITIONS)",
V8_TARGET_ARCH_IA32, V8_TARGET_ARCH_IA32,
V8_NATIVE_REGEXP,
DEBUG, DEBUG,
); );
HEADER_SEARCH_PATHS = ../src; HEADER_SEARCH_PATHS = ../src;
...@@ -1462,6 +1463,7 @@ ...@@ -1462,6 +1463,7 @@
GCC_PREPROCESSOR_DEFINITIONS = ( GCC_PREPROCESSOR_DEFINITIONS = (
"$(GCC_PREPROCESSOR_DEFINITIONS)", "$(GCC_PREPROCESSOR_DEFINITIONS)",
V8_TARGET_ARCH_IA32, V8_TARGET_ARCH_IA32,
V8_NATIVE_REGEXP,
NDEBUG, NDEBUG,
); );
HEADER_SEARCH_PATHS = ../src; HEADER_SEARCH_PATHS = ../src;
...@@ -1477,6 +1479,7 @@ ...@@ -1477,6 +1479,7 @@
"$(GCC_PREPROCESSOR_DEFINITIONS)", "$(GCC_PREPROCESSOR_DEFINITIONS)",
ENABLE_DISASSEMBLER, ENABLE_DISASSEMBLER,
V8_TARGET_ARCH_IA32, V8_TARGET_ARCH_IA32,
V8_NATIVE_REGEXP,
ENABLE_LOGGING_AND_PROFILING, ENABLE_LOGGING_AND_PROFILING,
); );
HEADER_SEARCH_PATHS = ../src; HEADER_SEARCH_PATHS = ../src;
...@@ -1492,6 +1495,7 @@ ...@@ -1492,6 +1495,7 @@
GCC_PREPROCESSOR_DEFINITIONS = ( GCC_PREPROCESSOR_DEFINITIONS = (
"$(GCC_PREPROCESSOR_DEFINITIONS)", "$(GCC_PREPROCESSOR_DEFINITIONS)",
V8_TARGET_ARCH_IA32, V8_TARGET_ARCH_IA32,
V8_NATIVE_REGEXP,
NDEBUG, NDEBUG,
); );
HEADER_SEARCH_PATHS = ../src; HEADER_SEARCH_PATHS = ../src;
......
...@@ -6,6 +6,6 @@ ...@@ -6,6 +6,6 @@
> >
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
PreprocessorDefinitions="V8_TARGET_ARCH_IA32" PreprocessorDefinitions="V8_TARGET_ARCH_IA32;V8_NATIVE_REGEXP"
/> />
</VisualStudioPropertySheet> </VisualStudioPropertySheet>
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