Make non-templatized versions of LIR printing functions.

This avoid duplicating the code for each template instance.

Also remove dead code from different places in our code base.

Removed some verification code from release builds.
Review URL: http://codereview.chromium.org/8387070

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@9860 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
fschneider@chromium.org 2011-11-02 08:32:40 +00:00
parent acf8fd28bd
commit f3f16dc17a
11 changed files with 19 additions and 94 deletions

View File

@ -58,10 +58,8 @@ namespace internal {
V(FastNewContext) \
V(FastNewBlockContext) \
V(FastCloneShallowArray) \
V(RevertToNumber) \
V(ToBoolean) \
V(ToNumber) \
V(CounterOp) \
V(ArgumentsAccess) \
V(RegExpConstructResult) \
V(NumberToString) \

View File

@ -39,12 +39,6 @@ namespace internal {
Allocator HashMap::DefaultAllocator;
HashMap::HashMap() {
allocator_ = NULL;
match_ = NULL;
}
HashMap::HashMap(MatchFun match,
Allocator* allocator,
uint32_t initial_capacity) {

View File

@ -50,11 +50,6 @@ class HashMap {
typedef bool (*MatchFun) (void* key1, void* key2);
// Dummy constructor. This constructor doesn't set up the hash
// map properly so don't use it unless you have good reason (e.g.,
// you know that the HashMap will never be used).
HashMap();
// initial_capacity is the size of the initial hash map;
// it must be a power of 2 (and thus must not be 0).
explicit HashMap(MatchFun match,

View File

@ -126,7 +126,9 @@ void Range::AddConstant(int32_t value) {
bool may_overflow = false; // Overflow is ignored here.
lower_ = AddWithoutOverflow(lower_, value, &may_overflow);
upper_ = AddWithoutOverflow(upper_, value, &may_overflow);
#ifdef DEBUG
Verify();
#endif
}
@ -173,7 +175,9 @@ bool Range::AddAndCheckOverflow(Range* other) {
lower_ = AddWithoutOverflow(lower_, other->lower(), &may_overflow);
upper_ = AddWithoutOverflow(upper_, other->upper(), &may_overflow);
KeepOrder();
#ifdef DEBUG
Verify();
#endif
return may_overflow;
}
@ -183,7 +187,9 @@ bool Range::SubAndCheckOverflow(Range* other) {
lower_ = SubWithoutOverflow(lower_, other->upper(), &may_overflow);
upper_ = SubWithoutOverflow(upper_, other->lower(), &may_overflow);
KeepOrder();
#ifdef DEBUG
Verify();
#endif
return may_overflow;
}
@ -197,9 +203,11 @@ void Range::KeepOrder() {
}
#ifdef DEBUG
void Range::Verify() const {
ASSERT(lower_ <= upper_);
}
#endif
bool Range::MulAndCheckOverflow(Range* other) {
@ -210,7 +218,9 @@ bool Range::MulAndCheckOverflow(Range* other) {
int v4 = MulWithoutOverflow(upper_, other->upper(), &may_overflow);
lower_ = Min(Min(v1, v2), Min(v3, v4));
upper_ = Max(Max(v1, v2), Max(v3, v4));
#ifdef DEBUG
Verify();
#endif
return may_overflow;
}
@ -234,25 +244,6 @@ const char* HType::ToString() {
}
const char* HType::ToShortString() {
switch (type_) {
case kTagged: return "t";
case kTaggedPrimitive: return "p";
case kTaggedNumber: return "n";
case kSmi: return "m";
case kHeapNumber: return "h";
case kString: return "s";
case kBoolean: return "b";
case kNonPrimitive: return "r";
case kJSArray: return "a";
case kJSObject: return "o";
case kUninitialized: return "z";
}
UNREACHABLE();
return "Unreachable code";
}
HType HType::TypeFromValue(Handle<Object> value) {
HType result = HType::Tagged();
if (value->IsSmi()) {

View File

@ -245,7 +245,9 @@ class Range: public ZoneObject {
return lower_ >= Smi::kMinValue && upper_ <= Smi::kMaxValue;
}
void KeepOrder();
#ifdef DEBUG
void Verify() const;
#endif
void StackUpon(Range* other) {
Intersect(other);
@ -405,7 +407,6 @@ class HType {
static HType TypeFromValue(Handle<Object> value);
const char* ToString();
const char* ToShortString();
private:
enum Type {

View File

@ -628,26 +628,6 @@ void Assembler::movzx_w(Register dst, const Operand& src) {
}
void Assembler::cmov(Condition cc, Register dst, int32_t imm32) {
ASSERT(CpuFeatures::IsEnabled(CMOV));
EnsureSpace ensure_space(this);
UNIMPLEMENTED();
USE(cc);
USE(dst);
USE(imm32);
}
void Assembler::cmov(Condition cc, Register dst, Handle<Object> handle) {
ASSERT(CpuFeatures::IsEnabled(CMOV));
EnsureSpace ensure_space(this);
UNIMPLEMENTED();
USE(cc);
USE(dst);
USE(handle);
}
void Assembler::cmov(Condition cc, Register dst, const Operand& src) {
ASSERT(CpuFeatures::IsEnabled(CMOV));
EnsureSpace ensure_space(this);

View File

@ -713,8 +713,6 @@ class Assembler : public AssemblerBase {
void movzx_w(Register dst, const Operand& src);
// Conditional moves
void cmov(Condition cc, Register dst, int32_t imm32);
void cmov(Condition cc, Register dst, Handle<Object> handle);
void cmov(Condition cc, Register dst, Register src) {
cmov(cc, dst, Operand(src));
}

View File

@ -110,22 +110,17 @@ void LInstruction::PrintTo(StringStream* stream) {
}
template<int R, int I, int T>
void LTemplateInstruction<R, I, T>::PrintDataTo(StringStream* stream) {
void LInstruction::PrintDataTo(StringStream* stream) {
stream->Add("= ");
for (int i = 0; i < inputs_.length(); i++) {
for (int i = 0; i < InputCount(); i++) {
if (i > 0) stream->Add(" ");
inputs_[i]->PrintTo(stream);
InputAt(i)->PrintTo(stream);
}
}
template<int R, int I, int T>
void LTemplateInstruction<R, I, T>::PrintOutputOperandTo(StringStream* stream) {
for (int i = 0; i < results_.length(); i++) {
if (i > 0) stream->Add(" ");
results_[i]->PrintTo(stream);
}
void LInstruction::PrintOutputOperandTo(StringStream* stream) {
if (HasResult()) result()->PrintTo(stream);
}

View File

@ -192,8 +192,8 @@ class LInstruction: public ZoneObject {
virtual void CompileToNative(LCodeGen* generator) = 0;
virtual const char* Mnemonic() const = 0;
virtual void PrintTo(StringStream* stream);
virtual void PrintDataTo(StringStream* stream) = 0;
virtual void PrintOutputOperandTo(StringStream* stream) = 0;
virtual void PrintDataTo(StringStream* stream);
virtual void PrintOutputOperandTo(StringStream* stream);
enum Opcode {
// Declare a unique enum value for each instruction.
@ -289,9 +289,6 @@ class LTemplateInstruction: public LInstruction {
int TempCount() { return T; }
LOperand* TempAt(int i) { return temps_[i]; }
virtual void PrintDataTo(StringStream* stream);
virtual void PrintOutputOperandTo(StringStream* stream);
protected:
EmbeddedContainer<LOperand*, R> results_;
EmbeddedContainer<LOperand*, I> inputs_;

View File

@ -76,9 +76,6 @@ static bool Match(void* key1, void* key2) {
}
// Dummy constructor
VariableMap::VariableMap(bool gotta_love_static_overloading) : HashMap() {}
VariableMap::VariableMap() : HashMap(Match, &LocalsMapAllocator, 8) {}
VariableMap::~VariableMap() {}
@ -112,21 +109,6 @@ Variable* VariableMap::Lookup(Handle<String> name) {
// ----------------------------------------------------------------------------
// Implementation of Scope
// Dummy constructor
Scope::Scope(ScopeType type)
: isolate_(Isolate::Current()),
inner_scopes_(0),
variables_(false),
temps_(0),
params_(0),
unresolved_(0),
decls_(0),
already_resolved_(false) {
SetDefaults(type, NULL, Handle<SerializedScopeInfo>::null());
}
Scope::Scope(Scope* outer_scope, ScopeType type)
: isolate_(Isolate::Current()),
inner_scopes_(4),

View File

@ -42,10 +42,6 @@ class VariableMap: public HashMap {
public:
VariableMap();
// Dummy constructor. This constructor doesn't set up the map
// properly so don't use it unless you have a good reason.
explicit VariableMap(bool gotta_love_static_overloading);
virtual ~VariableMap();
Variable* Declare(Scope* scope,
@ -373,8 +369,6 @@ class Scope: public ZoneObject {
protected:
friend class ParserFactory;
explicit Scope(ScopeType type);
Isolate* const isolate_;
// Scope tree.