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

Unified Diff: src/arm/fast-codegen-arm.cc

Issue 337060: Factor out a commonly used code sequence to DropAndMove(Location, Register) (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 11 years, 2 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
« no previous file with comments | « no previous file | src/fast-codegen.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/arm/fast-codegen-arm.cc
===================================================================
--- src/arm/fast-codegen-arm.cc (revision 3152)
+++ src/arm/fast-codegen-arm.cc (working copy)
@@ -153,6 +153,18 @@
}
+void FastCodeGenerator::DropAndMove(Location destination, Register source) {
+ switch (destination.type()) {
+ case Location::NOWHERE:
+ __ pop();
+ break;
+ case Location::TEMP:
+ __ str(source, MemOperand(sp));
+ break;
+ }
+}
+
+
void FastCodeGenerator::DeclareGlobals(Handle<FixedArray> pairs) {
// Call the runtime to declare the globals.
// The context is the first argument.
@@ -219,16 +231,7 @@
__ mov(r2, Operand(expr->name()));
Handle<Code> ic(Builtins::builtin(Builtins::LoadIC_Initialize));
__ Call(ic, RelocInfo::CODE_TARGET_CONTEXT);
- switch (expr->location().type()) {
- case Location::NOWHERE:
- __ pop();
- break;
- case Location::TEMP:
- // Replace the global object with the result.
- __ str(r0, MemOperand(sp));
- break;
- }
-
+ DropAndMove(expr->location(), r0);
} else {
Comment cmnt(masm_, "Stack slot");
Move(expr->location(), rewrite->AsSlot());
@@ -456,15 +459,7 @@
Handle<Code> ic(Builtins::builtin(Builtins::StoreIC_Initialize));
__ Call(ic, RelocInfo::CODE_TARGET);
// Overwrite the global object on the stack with the result if needed.
- switch (expr->location().type()) {
- case Location::NOWHERE:
- __ pop();
- break;
- case Location::TEMP:
- __ str(r0, MemOperand(sp));
- break;
- }
-
+ DropAndMove(expr->location(), r0);
} else {
// Local or parameter assignment.
@@ -561,14 +556,7 @@
__ Call(ic, RelocInfo::CODE_TARGET_CONTEXT);
// Restore context register.
__ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
- switch (expr->location().type()) {
- case Location::NOWHERE:
- __ pop();
- break;
- case Location::TEMP:
- __ str(r0, MemOperand(sp));
- break;
- }
+ DropAndMove(expr->location(), r0);
}
@@ -607,14 +595,7 @@
__ Call(construct_builtin, RelocInfo::CONSTRUCT_CALL);
// Replace function on TOS with result in r0, or pop it.
- switch (node->location().type()) {
- case Location::TEMP:
- __ str(r0, MemOperand(sp, 0));
- break;
- case Location::NOWHERE:
- __ pop();
- break;
- }
+ DropAndMove(node->location(), r0);
}
« no previous file with comments | « no previous file | src/fast-codegen.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698