summaryrefslogtreecommitdiff
path: root/Source/JavaScriptCore/testRegExp.cpp
diff options
context:
space:
mode:
authorKonstantin Tokarev <annulen@yandex.ru>2016-08-25 19:20:41 +0300
committerKonstantin Tokarev <annulen@yandex.ru>2017-02-02 12:30:55 +0000
commit6882a04fb36642862b11efe514251d32070c3d65 (patch)
treeb7959826000b061fd5ccc7512035c7478742f7b0 /Source/JavaScriptCore/testRegExp.cpp
parentab6df191029eeeb0b0f16f127d553265659f739e (diff)
downloadqtwebkit-6882a04fb36642862b11efe514251d32070c3d65.tar.gz
Imported QtWebKit TP3 (git b57bc6801f1876c3220d5a4bfea33d620d477443)
Change-Id: I3b1d8a2808782c9f34d50240000e20cb38d3680f Reviewed-by: Konstantin Tokarev <annulen@yandex.ru>
Diffstat (limited to 'Source/JavaScriptCore/testRegExp.cpp')
-rw-r--r--Source/JavaScriptCore/testRegExp.cpp79
1 files changed, 55 insertions, 24 deletions
diff --git a/Source/JavaScriptCore/testRegExp.cpp b/Source/JavaScriptCore/testRegExp.cpp
index 9185d7281..abb17365b 100644
--- a/Source/JavaScriptCore/testRegExp.cpp
+++ b/Source/JavaScriptCore/testRegExp.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011 Apple Inc. All rights reserved.
+ * Copyright (C) 2011, 2015 Apple Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -21,11 +21,10 @@
#include "config.h"
#include "RegExp.h"
-#include "APIShims.h"
#include <wtf/CurrentTime.h>
#include "InitializeThreading.h"
+#include "JSCInlines.h"
#include "JSGlobalObject.h"
-#include "Operations.h"
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
@@ -40,7 +39,7 @@
#include <sys/time.h>
#endif
-#if COMPILER(MSVC) && !OS(WINCE)
+#if COMPILER(MSVC)
#include <crtdbg.h>
#include <mmsystem.h>
#include <windows.h>
@@ -82,12 +81,12 @@ private:
void StopWatch::start()
{
- m_startTime = currentTime();
+ m_startTime = monotonicallyIncreasingTime();
}
void StopWatch::stop()
{
- m_stopTime = currentTime();
+ m_stopTime = monotonicallyIncreasingTime();
}
long StopWatch::getElapsedMS()
@@ -122,13 +121,13 @@ public:
return globalObject;
}
- static const ClassInfo s_info;
+ DECLARE_INFO;
static const bool needsDestructor = false;
static Structure* createStructure(VM& vm, JSValue prototype)
{
- return Structure::create(vm, 0, prototype, TypeInfo(GlobalObjectType, StructureFlags), &s_info);
+ return Structure::create(vm, 0, prototype, TypeInfo(GlobalObjectType, StructureFlags), info());
}
protected:
@@ -139,9 +138,7 @@ protected:
}
};
-COMPILE_ASSERT(!IsInteger<GlobalObject>::value, WTF_IsInteger_GlobalObject_false);
-
-const ClassInfo GlobalObject::s_info = { "global", &JSGlobalObject::s_info, 0, ExecState::globalObjectTable, CREATE_METHOD_TABLE(GlobalObject) };
+const ClassInfo GlobalObject::s_info = { "global", &JSGlobalObject::s_info, nullptr, CREATE_METHOD_TABLE(GlobalObject) };
GlobalObject::GlobalObject(VM& vm, Structure* structure, const Vector<String>& arguments)
: JSGlobalObject(vm, structure)
@@ -154,7 +151,7 @@ GlobalObject::GlobalObject(VM& vm, Structure* structure, const Vector<String>& a
// be in a separate main function because the realMain function requires object
// unwinding.
-#if COMPILER(MSVC) && !COMPILER(INTEL) && !defined(_DEBUG) && !OS(WINCE)
+#if COMPILER(MSVC) && !defined(_DEBUG)
#define TRY __try {
#define EXCEPT(x) } __except (EXCEPTION_EXECUTE_HANDLER) { x; }
#else
@@ -167,12 +164,19 @@ int realMain(int argc, char** argv);
int main(int argc, char** argv)
{
#if OS(WINDOWS)
-#if !OS(WINCE)
+#if defined(_M_X64) || defined(__x86_64__)
+ // The VS2013 runtime has a bug where it mis-detects AVX-capable processors
+ // if the feature has been disabled in firmware. This causes us to crash
+ // in some of the math functions. For now, we disable those optimizations
+ // because Microsoft is not going to fix the problem in VS2013.
+ // FIXME: http://webkit.org/b/141449: Remove this workaround when we switch to VS2015+.
+ _set_FMA3_enable(0);
+#endif
+
// Cygwin calls ::SetErrorMode(SEM_FAILCRITICALERRORS), which we will inherit. This is bad for
// testing/debugging, as it causes the post-mortem debugger not to be invoked. We reset the
// error mode here to work around Cygwin's behavior. See <http://webkit.org/b/55222>.
::SetErrorMode(0);
-#endif
#if defined(_DEBUG)
_CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDERR);
@@ -216,12 +220,22 @@ static bool testOneRegExp(VM& vm, RegExp* regexp, RegExpTest* regExpTest, bool v
} else if (matchResult != -1) {
if (outVector.size() != regExpTest->expectVector.size()) {
result = false;
- if (verbose)
- printf("Line %d: output vector size mismatch - expected %lu got %lu\n", lineNumber, regExpTest->expectVector.size(), outVector.size());
+ if (verbose) {
+#if OS(WINDOWS)
+ printf("Line %d: output vector size mismatch - expected %Iu got %Iu\n", lineNumber, regExpTest->expectVector.size(), outVector.size());
+#else
+ printf("Line %d: output vector size mismatch - expected %zu got %zu\n", lineNumber, regExpTest->expectVector.size(), outVector.size());
+#endif
+ }
} else if (outVector.size() % 2) {
result = false;
- if (verbose)
- printf("Line %d: output vector size is odd (%lu), should be even\n", lineNumber, outVector.size());
+ if (verbose) {
+#if OS(WINDOWS)
+ printf("Line %d: output vector size is odd (%Iu), should be even\n", lineNumber, outVector.size());
+#else
+ printf("Line %d: output vector size is odd (%zu), should be even\n", lineNumber, outVector.size());
+#endif
+ }
} else {
// Check in pairs since the first value of the pair could be -1 in which case the second doesn't matter.
size_t pairCount = outVector.size() / 2;
@@ -229,13 +243,23 @@ static bool testOneRegExp(VM& vm, RegExp* regexp, RegExpTest* regExpTest, bool v
size_t startIndex = i*2;
if (outVector[startIndex] != regExpTest->expectVector[startIndex]) {
result = false;
- if (verbose)
- printf("Line %d: output vector mismatch at index %lu - expected %d got %d\n", lineNumber, startIndex, regExpTest->expectVector[startIndex], outVector[startIndex]);
+ if (verbose) {
+#if OS(WINDOWS)
+ printf("Line %d: output vector mismatch at index %Iu - expected %d got %d\n", lineNumber, startIndex, regExpTest->expectVector[startIndex], outVector[startIndex]);
+#else
+ printf("Line %d: output vector mismatch at index %zu - expected %d got %d\n", lineNumber, startIndex, regExpTest->expectVector[startIndex], outVector[startIndex]);
+#endif
+ }
}
if ((i > 0) && (regExpTest->expectVector[startIndex] != -1) && (outVector[startIndex+1] != regExpTest->expectVector[startIndex+1])) {
result = false;
- if (verbose)
- printf("Line %d: output vector mismatch at index %lu - expected %d got %d\n", lineNumber, startIndex+1, regExpTest->expectVector[startIndex+1], outVector[startIndex+1]);
+ if (verbose) {
+#if OS(WINDOWS)
+ printf("Line %d: output vector mismatch at index %Iu - expected %d got %d\n", lineNumber, startIndex + 1, regExpTest->expectVector[startIndex + 1], outVector[startIndex + 1]);
+#else
+ printf("Line %d: output vector mismatch at index %zu - expected %d got %d\n", lineNumber, startIndex + 1, regExpTest->expectVector[startIndex + 1], outVector[startIndex + 1]);
+#endif
+ }
}
}
}
@@ -500,8 +524,8 @@ static void parseArguments(int argc, char** argv, CommandLine& options)
int realMain(int argc, char** argv)
{
- VM* vm = VM::create(LargeHeap).leakRef();
- APIEntryShim shim(vm);
+ VM* vm = &VM::create(LargeHeap).leakRef();
+ JSLockHolder locker(vm);
CommandLine options;
parseArguments(argc, argv, options);
@@ -511,3 +535,10 @@ int realMain(int argc, char** argv)
return success ? 0 : 3;
}
+
+#if OS(WINDOWS)
+extern "C" __declspec(dllexport) int WINAPI dllLauncherEntryPoint(int argc, const char* argv[])
+{
+ return main(argc, const_cast<char**>(argv));
+}
+#endif