From 07174d858e834c629952db99fe9e022bea78a52c Mon Sep 17 00:00:00 2001 From: "msaboff@apple.com" Date: Fri, 6 Jan 2012 22:15:31 +0000 Subject: [PATCH] Default HashTraits for Opcode don't work for Opcode = 0 https://bugs.webkit.org/show_bug.cgi?id=75595 Reviewed by Oliver Hunt. Removed the populating of the m_opcodeIDTable table in the case where the OpcodeID and Opcode are the same (m_enabled is false). Instead we just cast the one type to the other. * interpreter/Interpreter.cpp: (JSC::Interpreter::initialize): (JSC::Interpreter::isOpcode): * interpreter/Interpreter.h: (JSC::Interpreter::getOpcodeID): git-svn-id: http://svn.webkit.org/repository/webkit/trunk@104338 268f45cc-cd09-0410-ab3c-d52691b4dbfc --- Source/JavaScriptCore/ChangeLog | 17 +++++++++++++++++ .../JavaScriptCore/interpreter/Interpreter.cpp | 3 ++- Source/JavaScriptCore/interpreter/Interpreter.h | 8 +++----- 3 files changed, 22 insertions(+), 6 deletions(-) diff --git a/Source/JavaScriptCore/ChangeLog b/Source/JavaScriptCore/ChangeLog index 597e14932e3..0fded74097d 100644 --- a/Source/JavaScriptCore/ChangeLog +++ b/Source/JavaScriptCore/ChangeLog @@ -1,3 +1,20 @@ +2012-01-05 Michael Saboff + + Default HashTraits for Opcode don't work for Opcode = 0 + https://bugs.webkit.org/show_bug.cgi?id=75595 + + Reviewed by Oliver Hunt. + + Removed the populating of the m_opcodeIDTable table in the + case where the OpcodeID and Opcode are the same (m_enabled is false). + Instead we just cast the one type to the other. + + * interpreter/Interpreter.cpp: + (JSC::Interpreter::initialize): + (JSC::Interpreter::isOpcode): + * interpreter/Interpreter.h: + (JSC::Interpreter::getOpcodeID): + 2012-01-06 Sam Weinig Add a DecayArray type trait as a first step towards merging OwnPtr and OwnArrayPtr diff --git a/Source/JavaScriptCore/interpreter/Interpreter.cpp b/Source/JavaScriptCore/interpreter/Interpreter.cpp index 38befcd4f7e..0fa70de9824 100644 --- a/Source/JavaScriptCore/interpreter/Interpreter.cpp +++ b/Source/JavaScriptCore/interpreter/Interpreter.cpp @@ -556,7 +556,6 @@ void Interpreter::initialize(bool canUseJIT) for (int i = 0; i < numOpcodeIDs; ++i) { Opcode opcode = bitwise_cast(static_cast(i)); m_opcodeTable[i] = opcode; - m_opcodeIDTable.add(opcode, static_cast(i)); } } else { privateExecute(InitializeAndReturn, 0, 0); @@ -669,6 +668,8 @@ void Interpreter::dumpRegisters(CallFrame* callFrame) bool Interpreter::isOpcode(Opcode opcode) { #if ENABLE(COMPUTED_GOTO_INTERPRETER) + if (!m_enabled) + return opcode >= 0 && static_cast(bitwise_cast(opcode)) <= op_end; return opcode != HashTraits::emptyValue() && !HashTraits::isDeletedValue(opcode) && m_opcodeIDTable.contains(opcode); diff --git a/Source/JavaScriptCore/interpreter/Interpreter.h b/Source/JavaScriptCore/interpreter/Interpreter.h index 368fa27f2a2..6dfd331f8fc 100644 --- a/Source/JavaScriptCore/interpreter/Interpreter.h +++ b/Source/JavaScriptCore/interpreter/Interpreter.h @@ -114,11 +114,9 @@ namespace JSC { ASSERT(m_initialized); #if ENABLE(COMPUTED_GOTO_INTERPRETER) ASSERT(isOpcode(opcode)); - if (!m_enabled) { - OpcodeID result = static_cast(bitwise_cast(opcode)); - ASSERT(result == m_opcodeIDTable.get(opcode)); - return result; - } + if (!m_enabled) + return static_cast(bitwise_cast(opcode)); + return m_opcodeIDTable.get(opcode); #else return opcode; -- GitLab