Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(281)

Unified Diff: src/ia32/codegen-ia32.cc

Issue 113455: Clean up the Result class. Reduce the size of Result from four words... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/ia32/codegen-ia32.cc
===================================================================
--- src/ia32/codegen-ia32.cc (revision 1960)
+++ src/ia32/codegen-ia32.cc (working copy)
@@ -281,7 +281,7 @@
ASSERT(!function_return_is_shadowed_);
CodeForReturnPosition(fun);
frame_->PrepareForReturn();
- Result undefined(Factory::undefined_value(), this);
+ Result undefined(Factory::undefined_value());
if (function_return_.is_bound()) {
function_return_.Jump(&undefined);
} else {
@@ -296,7 +296,7 @@
// control does not flow off the end of the body so we did not
// compile an artificial return statement just above, and (b) there
// are return statements in the body but (c) they are all shadowed.
- Result return_value(this);
+ Result return_value;
// Though this is a (possibly) backward block, the frames can
// only differ on their top element.
function_return_.Bind(&return_value, 1);
@@ -388,7 +388,7 @@
JumpTarget* slow) {
ASSERT(slot->type() == Slot::CONTEXT);
ASSERT(tmp.is_register());
- Result context(esi, this);
+ Result context(esi);
for (Scope* s = scope(); s != slot->var()->scope(); s = s->outer_scope()) {
if (s->num_heap_slots() > 0) {
@@ -803,8 +803,8 @@
void DeferredInlineBinaryOperation::Generate() {
- Result left(generator());
- Result right(generator());
+ Result left;
Kevin Millikin (Chromium) 2009/05/15 10:50:49 A separate cleanup, since we have it now, is to us
+ Result right;
enter()->Bind(&left, &right);
generator()->frame()->Push(&left);
generator()->frame()->Push(&right);
@@ -859,7 +859,7 @@
if (left_is_string || right_is_string) {
frame_->Push(&left);
frame_->Push(&right);
- Result answer(this);
+ Result answer;
if (left_is_string) {
if (right_is_string) {
// TODO(lrn): if (left.is_constant() && right.is_constant())
@@ -1045,7 +1045,7 @@
void DeferredInlineSmiOperation::Generate() {
- Result left(generator());
+ Result left;
enter()->Bind(&left);
generator()->frame()->Push(&left);
generator()->frame()->Push(value_);
@@ -1078,7 +1078,7 @@
void DeferredInlineSmiOperationReversed::Generate() {
- Result right(generator());
+ Result right;
enter()->Bind(&right);
generator()->frame()->Push(value_);
generator()->frame()->Push(&right);
@@ -1109,7 +1109,7 @@
void DeferredInlineSmiAdd::Generate() {
// Undo the optimistic add operation and call the shared stub.
- Result left(generator()); // Initially left + value_.
+ Result left; // Initially left + value_.
enter()->Bind(&left);
left.ToRegister();
generator()->frame()->Spill(left.reg());
@@ -1143,7 +1143,7 @@
void DeferredInlineSmiAddReversed::Generate() {
// Undo the optimistic add operation and call the shared stub.
- Result right(generator()); // Initially value_ + right.
+ Result right; // Initially value_ + right.
enter()->Bind(&right);
right.ToRegister();
generator()->frame()->Spill(right.reg());
@@ -1177,7 +1177,7 @@
void DeferredInlineSmiSub::Generate() {
// Undo the optimistic sub operation and call the shared stub.
- Result left(generator()); // Initially left - value_.
+ Result left; // Initially left - value_.
enter()->Bind(&left);
left.ToRegister();
generator()->frame()->Spill(left.reg());
@@ -1211,7 +1211,7 @@
void DeferredInlineSmiSubReversed::Generate() {
// Call the shared stub.
- Result right(generator());
+ Result right;
enter()->Bind(&right);
generator()->frame()->Push(value_);
generator()->frame()->Push(&right);
@@ -1235,7 +1235,7 @@
// TODO(199): Optimize some special cases of operations involving a
// smi literal (multiply by 2, shift by 0, etc.).
if (IsUnsafeSmi(value)) {
- Result unsafe_operand(value, this);
+ Result unsafe_operand(value);
if (reversed) {
LikelySmiBinaryOperation(op, &unsafe_operand, operand,
overwrite_mode);
@@ -1275,7 +1275,7 @@
case Token::SUB: {
DeferredCode* deferred = NULL;
- Result answer(this); // Only allocate a new register if reversed.
+ Result answer; // Only allocate a new register if reversed.
if (reversed) {
answer = allocator()->Allocate();
ASSERT(answer.is_valid());
@@ -1304,7 +1304,7 @@
case Token::SAR: {
if (reversed) {
- Result constant_operand(value, this);
+ Result constant_operand(value);
LikelySmiBinaryOperation(op, &constant_operand, operand,
overwrite_mode);
} else {
@@ -1330,7 +1330,7 @@
case Token::SHR: {
if (reversed) {
- Result constant_operand(value, this);
+ Result constant_operand(value);
LikelySmiBinaryOperation(op, &constant_operand, operand,
overwrite_mode);
} else {
@@ -1365,7 +1365,7 @@
case Token::SHL: {
if (reversed) {
- Result constant_operand(value, this);
+ Result constant_operand(value);
LikelySmiBinaryOperation(op, &constant_operand, operand,
overwrite_mode);
} else {
@@ -1435,7 +1435,7 @@
}
default: {
- Result constant_operand(value, this);
+ Result constant_operand(value);
if (reversed) {
LikelySmiBinaryOperation(op, &constant_operand, operand,
overwrite_mode);
@@ -1484,8 +1484,8 @@
// Strict only makes sense for equality comparisons.
ASSERT(!strict || cc == equal);
- Result left_side(this);
- Result right_side(this);
+ Result left_side;
+ Result right_side;
// Implement '>' and '<=' by reversal to obtain ECMA-262 conversion order.
if (cc == greater || cc == less_equal) {
cc = ReverseCondition(cc);
@@ -1769,7 +1769,7 @@
frame_->Push(pairs);
// Duplicate the context register.
- Result context(esi, this);
+ Result context(esi);
frame_->Push(&context);
frame_->Push(Smi::FromInt(is_eval() ? 1 : 0));
@@ -1793,7 +1793,7 @@
// during variable resolution and must have mode DYNAMIC.
ASSERT(var->is_dynamic());
// For now, just do a runtime call. Duplicate the context register.
- Result context(esi, this);
+ Result context(esi);
frame_->Push(&context);
frame_->Push(var->name());
// Declaration nodes are always introduced in one of two modes.
@@ -2032,7 +2032,7 @@
Comment cmnt(masm_, "[ WithEnterStatement");
CodeForStatementPosition(node);
Load(node->expression());
- Result context(this);
+ Result context;
if (node->is_catch_block()) {
context = frame_->CallRuntime(Runtime::kPushCatchContext, 1);
} else {
@@ -2941,7 +2941,7 @@
// Generate unlink code for the (formerly) shadowing targets that
// have been jumped to. Deallocate each shadow target.
- Result return_value(this);
+ Result return_value;
for (int i = 0; i < shadows.length(); i++) {
if (shadows[i]->is_linked()) {
// Unlink from try chain; be careful not to destroy the TOS if
@@ -3073,7 +3073,7 @@
// on the virtual frame. We must preserve it until it is
// pushed.
if (i == kReturnShadowIndex) {
- Result return_value(this);
+ Result return_value;
shadows[i]->Bind(&return_value);
return_value.ToRegister(eax);
} else {
@@ -3256,7 +3256,7 @@
JumpTarget slow(this);
JumpTarget done(this);
- Result value(this);
+ Result value;
// Generate fast-case code for variables that might be shadowed by
// eval-introduced variables. Eval is used a lot without
@@ -3356,7 +3356,7 @@
JumpTarget* slow) {
// Check that no extension objects have been created by calls to
// eval from the current scope to the global scope.
- Result context(esi, this);
+ Result context(esi);
Result tmp = allocator_->Allocate();
ASSERT(tmp.is_valid()); // All non-reserved registers were available.
@@ -3431,7 +3431,7 @@
frame_->Push(esi);
frame_->Push(slot->var()->name());
- Result value(this);
+ Result value;
if (init_state == CONST_INIT) {
// Same as the case for a normal store, but ignores attribute
// (e.g. READ_ONLY) of context slot so that we can initialize const
@@ -3574,7 +3574,7 @@
void DeferredRegExpLiteral::Generate() {
- Result literals(generator());
+ Result literals;
enter()->Bind(&literals);
// Since the entry is undefined we call the runtime system to
// compute the literal.
@@ -3651,7 +3651,7 @@
void DeferredObjectLiteral::Generate() {
- Result literals(generator());
+ Result literals;
enter()->Bind(&literals);
// Since the entry is undefined we call the runtime system to
// compute the literal.
@@ -3789,7 +3789,7 @@
void DeferredArrayLiteral::Generate() {
- Result literals(generator());
+ Result literals;
enter()->Bind(&literals);
// Since the entry is undefined we call the runtime system to
// compute the literal.
@@ -4438,7 +4438,7 @@
ASSERT(args->length() == 0);
// ArgumentsAccessStub takes the parameter count as an input argument
// in register eax. Create a constant result for it.
- Result count(Handle<Smi>(Smi::FromInt(scope_->num_parameters())), this);
+ Result count(Handle<Smi>(Smi::FromInt(scope_->num_parameters())));
// Call the shared stub to get to the arguments.length.
ArgumentsAccessStub stub(ArgumentsAccessStub::READ_LENGTH);
Result result = frame_->CallStub(&stub, &count);
@@ -4521,7 +4521,7 @@
Load(args->at(0));
Result key = frame_->Pop();
// Explicitly create a constant result.
- Result count(Handle<Smi>(Smi::FromInt(scope_->num_parameters())), this);
+ Result count(Handle<Smi>(Smi::FromInt(scope_->num_parameters())));
// Call the shared stub to get to arguments[key].
ArgumentsAccessStub stub(ArgumentsAccessStub::READ_ELEMENT);
Result result = frame_->CallStub(&stub, &key, &count);
@@ -4771,7 +4771,7 @@
void DeferredCountOperation::Generate() {
CodeGenerator* cgen = generator();
- Result value(cgen);
+ Result value;
enter()->Bind(&value);
VirtualFrame* frame = cgen->frame();
// Undo the optimistic smi operation.
@@ -5269,7 +5269,7 @@
void DeferredReferenceGetNamedValue::Generate() {
CodeGenerator* cgen = generator();
- Result receiver(cgen);
+ Result receiver;
enter()->Bind(&receiver);
cgen->frame()->Push(&receiver);
@@ -5311,8 +5311,8 @@
void DeferredReferenceGetKeyedValue::Generate() {
CodeGenerator* cgen = generator();
- Result receiver(cgen);
- Result key(cgen);
+ Result receiver;
+ Result key;
enter()->Bind(&receiver, &key);
cgen->frame()->Push(&receiver); // First IC argument.
cgen->frame()->Push(&key); // Second IC argument.

Powered by Google App Engine
This is Rietveld 408576698