Commit ef85ba46 authored by ager@chromium.org's avatar ager@chromium.org

First round of size reduction for JumpTargets. Reduce their size by

two words: there is no reason to keep a pointer to the current code
generator and macro assembler in the JumpTarget.
Review URL: http://codereview.chromium.org/113458

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@1987 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 13a96b3a
This diff is collapsed.
This diff is collapsed.
......@@ -47,8 +47,7 @@ CodeGenerator* CodeGeneratorScope::top_ = NULL;
DeferredCode::DeferredCode(CodeGenerator* generator)
: generator_(generator),
masm_(generator->masm()),
enter_(generator),
exit_(generator, JumpTarget::BIDIRECTIONAL),
exit_(JumpTarget::BIDIRECTIONAL),
statement_position_(masm_->current_statement_position()),
position_(masm_->current_position()) {
generator->AddDeferred(this);
......
This diff is collapsed.
This diff is collapsed.
......@@ -631,7 +631,7 @@ void MacroAssembler::NegativeZeroTest(CodeGenerator* cgen,
Register result,
Register op,
JumpTarget* then_target) {
JumpTarget ok(cgen);
JumpTarget ok;
test(result, Operand(result));
ok.Branch(not_zero, taken);
test(op, Operand(op));
......
......@@ -30,6 +30,10 @@
namespace v8 { namespace internal {
CodeGenerator* JumpTarget::cgen() {
return CodeGeneratorScope::Current();
}
void JumpTarget::InitializeEntryElement(int index, FrameElement* target) {
entry_frame_->elements_[index].clear_copied();
if (target->is_register()) {
......
This diff is collapsed.
......@@ -56,31 +56,34 @@ class JumpTarget : public ZoneObject { // Shadows are dynamically allocated.
// Forward-only jump targets can only be reached by forward CFG edges.
enum Directionality { FORWARD_ONLY, BIDIRECTIONAL };
// Construct a jump target with a given code generator used to generate
// code and to provide access to a current frame.
explicit JumpTarget(CodeGenerator* cgen,
Directionality direction = FORWARD_ONLY);
// Construct a jump target used to generate code and to provide
// access to a current frame.
explicit JumpTarget(Directionality direction)
: direction_(direction),
reaching_frames_(0),
merge_labels_(0),
entry_frame_(NULL) {
}
// Construct a jump target without a code generator. A code
// generator must be supplied before using the jump target as a
// label. This is useful, eg, when break targets are embedded in
// AST nodes.
JumpTarget();
// Construct a jump target.
JumpTarget()
: direction_(FORWARD_ONLY),
reaching_frames_(0),
merge_labels_(0),
entry_frame_(NULL) {
}
virtual ~JumpTarget() {}
// Supply a code generator and directionality to an already
// constructed jump target. This function expects to be given a
// non-null code generator, and to be called only when the code
// generator is not yet set.
virtual void Initialize(CodeGenerator* cgen,
Directionality direction = FORWARD_ONLY);
// Set the direction of the jump target.
virtual void set_direction(Directionality direction) {
direction_ = direction;
}
// Treat the jump target as a fresh one. The state is reset.
void Unuse();
// Accessors.
CodeGenerator* code_generator() const { return cgen_; }
inline CodeGenerator* cgen();
Label* entry_label() { return &entry_label_; }
......@@ -163,12 +166,6 @@ class JumpTarget : public ZoneObject { // Shadows are dynamically allocated.
}
protected:
// The code generator gives access to its current frame.
CodeGenerator* cgen_;
// Used to emit code.
MacroAssembler* masm_;
// Directionality flag set at initialization time.
Directionality direction_;
......@@ -224,20 +221,13 @@ class JumpTarget : public ZoneObject { // Shadows are dynamically allocated.
class BreakTarget : public JumpTarget {
public:
// Construct a break target without a code generator. A code
// generator must be supplied before using the break target as a
// label. This is useful, eg, when break targets are embedded in AST
// nodes.
// Construct a break target.
BreakTarget() {}
virtual ~BreakTarget() {}
// Supply a code generator, expected expression stack height, and
// directionality to an already constructed break target. This
// function expects to be given a non-null code generator, and to be
// called only when the code generator is not yet set.
virtual void Initialize(CodeGenerator* cgen,
Directionality direction = FORWARD_ONLY);
// Set the direction of the break target.
virtual void set_direction(Directionality direction);
// Copy the state of this break target to the destination. The
// lists of forward-reaching frames and merge-point labels are
......
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