Diff
Modified: trunk/Source/_javascript_Core/ChangeLog (128014 => 128015)
--- trunk/Source/_javascript_Core/ChangeLog 2012-09-10 04:19:34 UTC (rev 128014)
+++ trunk/Source/_javascript_Core/ChangeLog 2012-09-10 04:25:23 UTC (rev 128015)
@@ -1,3 +1,30 @@
+2012-09-09 Mark Lam <[email protected]>
+
+ Fixed a few llint C++ interpreter bugs.
+ https://bugs.webkit.org/show_bug.cgi?id=96127.
+
+ Reviewed by Geoffrey Garen.
+
+ * llint/LLIntCLoop.h:
+ CLoop::execute()'s bootstrapOpcodeId does not need a default
+ value. There is no case when this function is called without
+ that parameter being specified.
+ * llint/LowLevelInterpreter.asm:
+ Moved the dispatchAfterCall() call to where it is needed.
+ For the C_LOOP back-end, it generates unreachable code.
+ * llint/LowLevelInterpreter.cpp:
+ #include <wtf/Assertions.h> because LLIntAssembly.h needs it.
+ (JSC):
+ Fixed bug in SIGN_BIT32() macro.
+ Placate a MSVC warning for t0, and t1 being uninitialized.
+ (JSC::CLoop::execute):
+ The bootstrapOpcodeId arg should always be specified.
+ MSVC doesn't like UNUSED_PARAM() for labels. Switch to using
+ the new UNUSED_LABEL() macro.
+ * offlineasm/cloop.rb:
+ * offlineasm/generate_offset_extractor.rb:
+ Resolved a compiler warning found via MSVC.
+
2012-09-09 Patrick Gansterer <[email protected]>
Add StringBuilder::appendNumber() and use it
Modified: trunk/Source/_javascript_Core/llint/LLIntCLoop.h (128014 => 128015)
--- trunk/Source/_javascript_Core/llint/LLIntCLoop.h 2012-09-10 04:19:34 UTC (rev 128014)
+++ trunk/Source/_javascript_Core/llint/LLIntCLoop.h 2012-09-10 04:25:23 UTC (rev 128015)
@@ -43,7 +43,7 @@
class CLoop {
public:
static void initialize();
- static JSValue execute(CallFrame*, OpcodeID bootstrapOpcodeId = llint_unused, bool isInitializationPass = false);
+ static JSValue execute(CallFrame*, OpcodeID bootstrapOpcodeId, bool isInitializationPass = false);
static void* catchRoutineFor(Instruction* catchPCForInterpreter);
Modified: trunk/Source/_javascript_Core/llint/LowLevelInterpreter.asm (128014 => 128015)
--- trunk/Source/_javascript_Core/llint/LowLevelInterpreter.asm 2012-09-10 04:19:34 UTC (rev 128014)
+++ trunk/Source/_javascript_Core/llint/LowLevelInterpreter.asm 2012-09-10 04:25:23 UTC (rev 128015)
@@ -177,8 +177,8 @@
cloopCallJSFunction callee
else
call callee
+ dispatchAfterCall()
end
- dispatchAfterCall()
end)
end
Modified: trunk/Source/_javascript_Core/llint/LowLevelInterpreter.cpp (128014 => 128015)
--- trunk/Source/_javascript_Core/llint/LowLevelInterpreter.cpp 2012-09-10 04:19:34 UTC (rev 128014)
+++ trunk/Source/_javascript_Core/llint/LowLevelInterpreter.cpp 2012-09-10 04:25:23 UTC (rev 128015)
@@ -36,6 +36,7 @@
#include "LLIntCLoop.h"
#include "LLIntSlowPaths.h"
#include "VMInspector.h"
+#include <wtf/Assertions.h>
#include <wtf/MathExtras.h>
using namespace JSC::LLInt;
@@ -98,6 +99,10 @@
#define OFFLINE_ASM_LOCAL_LABEL(label) label:
+//============================================================================
+// Some utilities:
+//
+
namespace JSC {
namespace LLInt {
@@ -116,11 +121,15 @@
} // namespace LLint
+//============================================================================
+// The llint C++ interpreter loop:
+//
+
JSValue CLoop::execute(CallFrame* callFrame, OpcodeID bootstrapOpcodeId,
bool isInitializationPass)
{
#define CAST reinterpret_cast
- #define SIGN_BIT32(x) (x & 0x80000000)
+ #define SIGN_BIT32(x) ((x) & 0x80000000)
// One-time initialization of our address tables. We have to put this code
// here because our labels are only in scope inside this function. The
@@ -212,6 +221,13 @@
CLoopRegister rRetVPC;
CLoopDoubleRegister d0, d1;
+#if COMPILER(MSVC)
+ // Keep the compiler happy. We don't really need this, but the compiler
+ // will complain. This makes the warning go away.
+ t0.i = 0;
+ t1.i = 0;
+#endif
+
// Instantiate the pseudo JIT stack frame used by the LLINT C Loop backend:
JITStackFrame jitStackFrame;
@@ -252,8 +268,7 @@
JSValue functionReturnValue;
Opcode opcode;
- if (bootstrapOpcodeId != llint_unused)
- opcode = LLInt::getOpcode(bootstrapOpcodeId);
+ opcode = LLInt::getOpcode(bootstrapOpcodeId);
#if ENABLE(OPCODE_STATS)
#define RECORD_OPCODE_STATS(__opcode) \
@@ -395,9 +410,13 @@
// Keep the compiler happy so that it doesn't complain about unused
- // labels for the LLInt trampoline glue:
+ // labels for the LLInt trampoline glue. The labels are automatically
+ // emitted by label macros above, and some of them are referenced by
+ // the llint generated code. Since we can't tell ahead of time which
+ // will be referenced and which will be not, we'll just passify the
+ // compiler on all such labels:
#define LLINT_OPCODE_ENTRY(__opcode, length) \
- UNUSED_PARAM(&&__opcode);
+ UNUSED_LABEL(__opcode);
FOR_EACH_LLINT_NATIVE_HELPER(LLINT_OPCODE_ENTRY)
#undef LLINT_OPCODE_ENTRY
Modified: trunk/Source/_javascript_Core/offlineasm/cloop.rb (128014 => 128015)
--- trunk/Source/_javascript_Core/offlineasm/cloop.rb 2012-09-10 04:19:34 UTC (rev 128014)
+++ trunk/Source/_javascript_Core/offlineasm/cloop.rb 2012-09-10 04:25:23 UTC (rev 128015)
@@ -172,7 +172,7 @@
def pointerExpr
if base.is_a? RegisterID and base.name == "sp"
offsetValue = "#{offset.value}"
- "(assert(#{offsetValue} == offsetof(JITStackFrame, globalData)), &sp->globalData)"
+ "(ASSERT(#{offsetValue} == offsetof(JITStackFrame, globalData)), &sp->globalData)"
elsif offset.value == 0
"#{base.clValue(:int8Ptr)}"
elsif offset.value > 0
@@ -236,7 +236,7 @@
def pointerExpr
if base.is_a? RegisterID and base.name == "sp"
offsetValue = "(#{index.clValue(:int32)} << #{scaleShift}) + #{offset.clValue})"
- "(assert(#{offsetValue} == offsetof(JITStackFrame, globalData)), &sp->globalData)"
+ "(ASSERT(#{offsetValue} == offsetof(JITStackFrame, globalData)), &sp->globalData)"
else
"#{base.clValue(:int8Ptr)} + (#{index.clValue(:int32)} << #{scaleShift}) + #{offset.clValue}"
end
Modified: trunk/Source/_javascript_Core/offlineasm/generate_offset_extractor.rb (128014 => 128015)
--- trunk/Source/_javascript_Core/offlineasm/generate_offset_extractor.rb 2012-09-10 04:19:34 UTC (rev 128014)
+++ trunk/Source/_javascript_Core/offlineasm/generate_offset_extractor.rb 2012-09-10 04:25:23 UTC (rev 128015)
@@ -42,7 +42,7 @@
def emitMagicNumber
OFFSET_MAGIC_NUMBERS.each {
| number |
- $output.puts "#{number},"
+ $output.puts "unsigned(#{number}),"
}
end
@@ -120,7 +120,7 @@
| settings, ast, backend, index |
OFFSET_HEADER_MAGIC_NUMBERS.each {
| number |
- $output.puts "#{number},"
+ $output.puts "unsigned(#{number}),"
}
offsetsList = ast.filter(StructOffset).uniq.sort
Modified: trunk/Source/WTF/ChangeLog (128014 => 128015)
--- trunk/Source/WTF/ChangeLog 2012-09-10 04:19:34 UTC (rev 128014)
+++ trunk/Source/WTF/ChangeLog 2012-09-10 04:25:23 UTC (rev 128015)
@@ -1,3 +1,14 @@
+2012-09-09 Mark Lam <[email protected]>
+
+ Fixed ASSERT() and ASSERT_AT() macros so that they can be used in
+ comma expressions. Also, added UNUSED_LABEL().
+ https://bugs.webkit.org/show_bug.cgi?id=96127.
+
+ Reviewed by Geoffrey Garen.
+
+ * wtf/Assertions.h:
+ * wtf/UnusedParam.h: Added UNUSED_LABEL(). Removed an obsolete comment.
+
2012-09-09 Patrick Gansterer <[email protected]>
Add StringBuilder::appendNumber() and use it
Modified: trunk/Source/WTF/wtf/Assertions.h (128014 => 128015)
--- trunk/Source/WTF/wtf/Assertions.h 2012-09-10 04:19:34 UTC (rev 128014)
+++ trunk/Source/WTF/wtf/Assertions.h 2012-09-10 04:25:23 UTC (rev 128015)
@@ -168,19 +168,18 @@
*/
#ifndef CRASH
#if COMPILER(CLANG)
-#define CRASH() do { \
- WTFReportBacktrace(); \
- WTFInvokeCrashHook(); \
- *(int *)(uintptr_t)0xbbadbeef = 0; \
- __builtin_trap(); \
-} while (0)
+#define CRASH() \
+ (WTFReportBacktrace(), \
+ WTFInvokeCrashHook(), \
+ (*(int *)(uintptr_t)0xbbadbeef = 0), \
+ __builtin_trap())
#else
-#define CRASH() do { \
- WTFReportBacktrace(); \
- WTFInvokeCrashHook(); \
- *(int *)(uintptr_t)0xbbadbeef = 0; \
- ((void(*)())0)(); /* More reliable, but doesn't say BBADBEEF */ \
-} while (0)
+#define CRASH() \
+ (WTFReportBacktrace(), \
+ WTFInvokeCrashHook(), \
+ (*(int *)(uintptr_t)0xbbadbeef = 0), \
+ ((void(*)())0)() /* More reliable, but doesn't say BBADBEEF */ \
+ )
#endif
#endif
@@ -244,19 +243,17 @@
#else
-#define ASSERT(assertion) do \
- if (!(assertion)) { \
- WTFReportAssertionFailure(__FILE__, __LINE__, WTF_PRETTY_FUNCTION, #assertion); \
- CRASH(); \
- } \
-while (0)
+#define ASSERT(assertion) \
+ (!(assertion) ? \
+ (WTFReportAssertionFailure(__FILE__, __LINE__, WTF_PRETTY_FUNCTION, #assertion), \
+ CRASH()) : \
+ (void)0)
-#define ASSERT_AT(assertion, file, line, function) do \
- if (!(assertion)) { \
- WTFReportAssertionFailure(file, line, function, #assertion); \
- CRASH(); \
- } \
-while (0)
+#define ASSERT_AT(assertion, file, line, function) \
+ (!(assertion) ? \
+ (WTFReportAssertionFailure(file, line, function, #assertion), \
+ CRASH()) : \
+ (void)0)
#define ASSERT_NOT_REACHED() do { \
WTFReportAssertionFailure(__FILE__, __LINE__, WTF_PRETTY_FUNCTION, 0); \
Modified: trunk/Source/WTF/wtf/UnusedParam.h (128014 => 128015)
--- trunk/Source/WTF/wtf/UnusedParam.h 2012-09-10 04:19:34 UTC (rev 128014)
+++ trunk/Source/WTF/wtf/UnusedParam.h 2012-09-10 04:25:23 UTC (rev 128015)
@@ -21,9 +21,6 @@
#ifndef WTF_UnusedParam_h
#define WTF_UnusedParam_h
-/* don't use this for C++, it should only be used in plain C files or
- ObjC methods, where leaving off the parameter name is not allowed. */
-
#include <wtf/Platform.h>
#if COMPILER(INTEL) && !OS(WINDOWS) || COMPILER(RVCT)
@@ -34,4 +31,14 @@
#define UNUSED_PARAM(variable) (void)variable
#endif
+/* This is to keep the compiler from complaining when for local labels are
+ declared but not referenced. For example, this can happen with code that
+ works with auto-generated code.
+*/
+#if COMPILER(MSVC)
+#define UNUSED_LABEL(label) if (false) goto label
+#else
+#define UNUSED_LABEL(label) UNUSED_PARAM(&& label)
+#endif
+
#endif /* WTF_UnusedParam_h */