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

Side by Side Diff: src/codegen-arm.cc

Issue 42598: The code generator doesn't need to put the argument count in eax for... (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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | src/codegen-ia32.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2006-2009 the V8 project authors. All rights reserved. 1 // Copyright 2006-2009 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 3438 matching lines...) Expand 10 before | Expand all | Expand 10 after
3449 if (CheckForInlineRuntimeCall(node)) { 3449 if (CheckForInlineRuntimeCall(node)) {
3450 ASSERT((has_cc() && frame_->height() == original_height) || 3450 ASSERT((has_cc() && frame_->height() == original_height) ||
3451 (!has_cc() && frame_->height() == original_height + 1)); 3451 (!has_cc() && frame_->height() == original_height + 1));
3452 return; 3452 return;
3453 } 3453 }
3454 3454
3455 ZoneList<Expression*>* args = node->arguments(); 3455 ZoneList<Expression*>* args = node->arguments();
3456 Comment cmnt(masm_, "[ CallRuntime"); 3456 Comment cmnt(masm_, "[ CallRuntime");
3457 Runtime::Function* function = node->function(); 3457 Runtime::Function* function = node->function();
3458 3458
3459 if (function != NULL) { 3459 if (function == NULL) {
3460 // Push the arguments ("left-to-right").
3461 int arg_count = args->length();
3462 for (int i = 0; i < arg_count; i++) {
3463 LoadAndSpill(args->at(i));
3464 }
3465
3466 // Call the C runtime function.
3467 frame_->CallRuntime(function, arg_count);
3468 frame_->EmitPush(r0);
3469
3470 } else {
3471 // Prepare stack for calling JS runtime function. 3460 // Prepare stack for calling JS runtime function.
3472 __ mov(r0, Operand(node->name())); 3461 __ mov(r0, Operand(node->name()));
3473 frame_->EmitPush(r0); 3462 frame_->EmitPush(r0);
3474 // Push the builtins object found in the current global object. 3463 // Push the builtins object found in the current global object.
3475 __ ldr(r1, GlobalObject()); 3464 __ ldr(r1, GlobalObject());
3476 __ ldr(r0, FieldMemOperand(r1, GlobalObject::kBuiltinsOffset)); 3465 __ ldr(r0, FieldMemOperand(r1, GlobalObject::kBuiltinsOffset));
3477 frame_->EmitPush(r0); 3466 frame_->EmitPush(r0);
3467 }
3478 3468
3479 int arg_count = args->length(); 3469 // Push the arguments ("left-to-right").
3480 for (int i = 0; i < arg_count; i++) { 3470 int arg_count = args->length();
3481 LoadAndSpill(args->at(i)); 3471 for (int i = 0; i < arg_count; i++) {
3482 } 3472 LoadAndSpill(args->at(i));
3473 }
3483 3474
3475 if (function == NULL) {
3484 // Call the JS runtime function. 3476 // Call the JS runtime function.
3485 Handle<Code> stub = ComputeCallInitialize(args->length()); 3477 Handle<Code> stub = ComputeCallInitialize(arg_count);
3486 frame_->CallCodeObject(stub, RelocInfo::CODE_TARGET, arg_count + 1); 3478 frame_->CallCodeObject(stub, RelocInfo::CODE_TARGET, arg_count + 1);
3487 __ ldr(cp, frame_->Context()); 3479 __ ldr(cp, frame_->Context());
3488 frame_->Drop(); 3480 frame_->Drop();
3489 frame_->EmitPush(r0); 3481 frame_->EmitPush(r0);
3482 } else {
3483 // Call the C runtime function.
3484 frame_->CallRuntime(function, arg_count);
3485 frame_->EmitPush(r0);
3490 } 3486 }
3491 ASSERT(frame_->height() == original_height + 1); 3487 ASSERT(frame_->height() == original_height + 1);
3492 } 3488 }
3493 3489
3494 3490
3495 void CodeGenerator::VisitUnaryOperation(UnaryOperation* node) { 3491 void CodeGenerator::VisitUnaryOperation(UnaryOperation* node) {
3496 #ifdef DEBUG 3492 #ifdef DEBUG
3497 int original_height = frame_->height(); 3493 int original_height = frame_->height();
3498 #endif 3494 #endif
3499 VirtualFrame::SpilledScope spilled_scope(this); 3495 VirtualFrame::SpilledScope spilled_scope(this);
(...skipping 1724 matching lines...) Expand 10 before | Expand all | Expand 10 after
5224 __ mov(r2, Operand(0)); 5220 __ mov(r2, Operand(0));
5225 __ GetBuiltinEntry(r3, Builtins::CALL_NON_FUNCTION); 5221 __ GetBuiltinEntry(r3, Builtins::CALL_NON_FUNCTION);
5226 __ Jump(Handle<Code>(Builtins::builtin(Builtins::ArgumentsAdaptorTrampoline)), 5222 __ Jump(Handle<Code>(Builtins::builtin(Builtins::ArgumentsAdaptorTrampoline)),
5227 RelocInfo::CODE_TARGET); 5223 RelocInfo::CODE_TARGET);
5228 } 5224 }
5229 5225
5230 5226
5231 #undef __ 5227 #undef __
5232 5228
5233 } } // namespace v8::internal 5229 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/codegen-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698