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

Unified Diff: src/codegen-arm.cc

Issue 56151: Rewrite of VisitCountOperation that should speed it up (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 years, 9 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 | « src/builtins.h ('k') | src/codegen-ia32.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/codegen-arm.cc
===================================================================
--- src/codegen-arm.cc (revision 1676)
+++ src/codegen-arm.cc (working copy)
@@ -708,29 +708,6 @@
};
-class InvokeBuiltinStub : public CodeStub {
- public:
- enum Kind { Inc, Dec, ToNumber };
- InvokeBuiltinStub(Kind kind, int argc) : kind_(kind), argc_(argc) { }
-
- private:
- Kind kind_;
- int argc_;
-
- Major MajorKey() { return InvokeBuiltin; }
- int MinorKey() { return (argc_ << 3) | static_cast<int>(kind_); }
- void Generate(MacroAssembler* masm);
-
-#ifdef DEBUG
- void Print() {
- PrintF("InvokeBuiltinStub (kind %d, argc, %d)\n",
- static_cast<int>(kind_),
- argc_);
- }
-#endif
-};
-
-
void CodeGenerator::GenericBinaryOperation(Token::Value op) {
VirtualFrame::SpilledScope spilled_scope(this);
// sp[0] : y
@@ -3696,22 +3673,27 @@
// Slow case: Convert to number.
slow.Bind();
-
- // Postfix: Convert the operand to a number and store it as the result.
+ {
+ // Convert the operand to a number.
+ frame_->EmitPush(r0);
+ Result arg_count = allocator_->Allocate(r0);
+ ASSERT(arg_count.is_valid());
+ __ mov(arg_count.reg(), Operand(0));
+ frame_->InvokeBuiltin(Builtins::TO_NUMBER, CALL_JS, &arg_count, 1);
+ }
if (is_postfix) {
- InvokeBuiltinStub stub(InvokeBuiltinStub::ToNumber, 2);
- frame_->CallStub(&stub, 0);
- // Store to result (on the stack).
+ // Postfix: store to result (on the stack).
__ str(r0, frame_->ElementAt(target.size()));
}
- // Compute the new value by calling the right JavaScript native.
+ // Compute the new value.
+ __ mov(r1, Operand(Smi::FromInt(1)));
+ frame_->EmitPush(r0);
+ frame_->EmitPush(r1);
if (is_increment) {
- InvokeBuiltinStub stub(InvokeBuiltinStub::Inc, 1);
- frame_->CallStub(&stub, 0);
+ frame_->CallRuntime(Runtime::kNumberAdd, 2);
} else {
- InvokeBuiltinStub stub(InvokeBuiltinStub::Dec, 1);
- frame_->CallStub(&stub, 0);
+ frame_->CallRuntime(Runtime::kNumberSub, 2);
}
// Store the new value in the target if not const.
@@ -4718,19 +4700,6 @@
}
-void InvokeBuiltinStub::Generate(MacroAssembler* masm) {
- __ push(r0);
- __ mov(r0, Operand(0)); // set number of arguments
- switch (kind_) {
- case ToNumber: __ InvokeBuiltin(Builtins::TO_NUMBER, JUMP_JS); break;
- case Inc: __ InvokeBuiltin(Builtins::INC, JUMP_JS); break;
- case Dec: __ InvokeBuiltin(Builtins::DEC, JUMP_JS); break;
- default: UNREACHABLE();
- }
- __ StubReturn(argc_);
-}
-
-
void CEntryStub::GenerateThrowTOS(MacroAssembler* masm) {
// r0 holds exception
ASSERT(StackHandlerConstants::kSize == 6 * kPointerSize); // adjust this code
« no previous file with comments | « src/builtins.h ('k') | src/codegen-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698