Commit df938367 authored by msaboff@apple.com's avatar msaboff@apple.com

There should be one "invalid" virtual register constant

https://bugs.webkit.org/show_bug.cgi?id=121057

Reviewed by Filip Pizlo.

Unify all references to an invalid virtual register to be the enum InvalidVirtualRegister.
Changed the value of InvalidVirtualRegister to be maximum integer value.

* bytecode/CodeBlock.h:
(JSC::CodeBlock::setArgumentsRegister):
(JSC::CodeBlock::usesArguments):
* bytecode/LazyOperandValueProfile.h:
(JSC::LazyOperandValueProfileKey::LazyOperandValueProfileKey):
(JSC::LazyOperandValueProfileKey::operator!):
(JSC::LazyOperandValueProfileKey::isHashTableDeletedValue):
(JSC::LazyOperandValueProfile::LazyOperandValueProfile):
* bytecode/UnlinkedCodeBlock.cpp:
(JSC::UnlinkedCodeBlock::UnlinkedCodeBlock):
* bytecode/UnlinkedCodeBlock.h:
(JSC::UnlinkedCodeBlock::usesArguments):
(JSC::UnlinkedCodeBlock::usesGlobalObject):
* bytecode/VirtualRegister.h:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@155420 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent e35c9ea9
2013-09-09 Michael Saboff <msaboff@apple.com>
There should be one "invalid" virtual register constant
https://bugs.webkit.org/show_bug.cgi?id=121057
Reviewed by Filip Pizlo.
Unify all references to an invalid virtual register to be the enum InvalidVirtualRegister.
Changed the value of InvalidVirtualRegister to be maximum integer value.
* bytecode/CodeBlock.h:
(JSC::CodeBlock::setArgumentsRegister):
(JSC::CodeBlock::usesArguments):
* bytecode/LazyOperandValueProfile.h:
(JSC::LazyOperandValueProfileKey::LazyOperandValueProfileKey):
(JSC::LazyOperandValueProfileKey::operator!):
(JSC::LazyOperandValueProfileKey::isHashTableDeletedValue):
(JSC::LazyOperandValueProfile::LazyOperandValueProfile):
* bytecode/UnlinkedCodeBlock.cpp:
(JSC::UnlinkedCodeBlock::UnlinkedCodeBlock):
* bytecode/UnlinkedCodeBlock.h:
(JSC::UnlinkedCodeBlock::usesArguments):
(JSC::UnlinkedCodeBlock::usesGlobalObject):
* bytecode/VirtualRegister.h:
2013-09-09 Michael Saboff <msaboff@apple.com>
Change virtual register function arguments from unsigned to int
......
......@@ -324,7 +324,7 @@ public:
void setArgumentsRegister(int argumentsRegister)
{
ASSERT(argumentsRegister != -1);
ASSERT(argumentsRegister != (int)InvalidVirtualRegister);
m_argumentsRegister = argumentsRegister;
ASSERT(usesArguments());
}
......@@ -354,7 +354,7 @@ public:
return InvalidVirtualRegister;
return activationRegister();
}
bool usesArguments() const { return m_argumentsRegister != -1; }
bool usesArguments() const { return m_argumentsRegister != (int)InvalidVirtualRegister; }
bool needsActivation() const
{
......
......@@ -32,6 +32,7 @@
#include "ConcurrentJITLock.h"
#include "ValueProfile.h"
#include "VirtualRegister.h"
#include <wtf/HashMap.h>
#include <wtf/Noncopyable.h>
#include <wtf/OwnPtr.h>
......@@ -45,13 +46,13 @@ class LazyOperandValueProfileKey {
public:
LazyOperandValueProfileKey()
: m_bytecodeOffset(0) // 0 = empty value
, m_operand(-1) // not a valid operand index in our current scheme
, m_operand(InvalidVirtualRegister) // not a valid operand index in our current scheme
{
}
LazyOperandValueProfileKey(WTF::HashTableDeletedValueType)
: m_bytecodeOffset(1) // 1 = deleted value
, m_operand(-1) // not a valid operand index in our current scheme
, m_operand(InvalidVirtualRegister) // not a valid operand index in our current scheme
{
}
......@@ -59,12 +60,12 @@ public:
: m_bytecodeOffset(bytecodeOffset)
, m_operand(operand)
{
ASSERT(operand != -1);
ASSERT(operand != InvalidVirtualRegister);
}
bool operator!() const
{
return m_operand == -1;
return m_operand == InvalidVirtualRegister;
}
bool operator==(const LazyOperandValueProfileKey& other) const
......@@ -91,7 +92,7 @@ public:
bool isHashTableDeletedValue() const
{
return m_operand == -1 && m_bytecodeOffset;
return m_operand == InvalidVirtualRegister && m_bytecodeOffset;
}
private:
unsigned m_bytecodeOffset;
......@@ -128,7 +129,7 @@ namespace JSC {
struct LazyOperandValueProfile : public MinimalValueProfile {
LazyOperandValueProfile()
: MinimalValueProfile()
, m_operand(-1)
, m_operand(InvalidVirtualRegister)
{
}
......
......@@ -194,8 +194,8 @@ UnlinkedCodeBlock::UnlinkedCodeBlock(VM* vm, Structure* structure, CodeType code
, m_numCalleeRegisters(0)
, m_numParameters(0)
, m_vm(vm)
, m_argumentsRegister(-1)
, m_globalObjectRegister(-1)
, m_argumentsRegister((int)InvalidVirtualRegister)
, m_globalObjectRegister((int)InvalidVirtualRegister)
, m_needsFullScopeChain(info.m_needsActivation)
, m_usesEval(info.m_usesEval)
, m_isNumericCompareFunction(false)
......
......@@ -38,6 +38,7 @@
#include "RegExp.h"
#include "SpecialPointer.h"
#include "SymbolTable.h"
#include "VirtualRegister.h"
#include <wtf/Compression.h>
#include <wtf/RefCountedArray.h>
......@@ -257,11 +258,11 @@ public:
void setActivationRegister(int activationRegister) { m_activationRegister = activationRegister; }
void setArgumentsRegister(int argumentsRegister) { m_argumentsRegister = argumentsRegister; }
bool usesArguments() const { return m_argumentsRegister != -1; }
bool usesArguments() const { return m_argumentsRegister != (int)InvalidVirtualRegister; }
int argumentsRegister() const { return m_argumentsRegister; }
bool usesGlobalObject() const { return m_globalObjectRegister != -1; }
bool usesGlobalObject() const { return m_globalObjectRegister != (int)InvalidVirtualRegister; }
void setGlobalObjectRegister(int globalObjectRegister) { m_globalObjectRegister = globalObjectRegister; }
int globalObjectRegister() const { return m_globalObjectRegister; }
......
......@@ -33,7 +33,7 @@ namespace JSC {
// Type for a virtual register number (spill location).
// Using an enum to make this type-checked at compile time, to avert programmer errors.
enum VirtualRegister { InvalidVirtualRegister = -1 };
enum VirtualRegister { InvalidVirtualRegister = 0x7fffffff };
COMPILE_ASSERT(sizeof(VirtualRegister) == sizeof(int), VirtualRegister_is_32bit);
} // namespace JSC
......
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