The code generator doesn't need to put the argument count in eax for
call ICs. Refactor CallRuntime on ARM to match the structure of IA32. Update some comments. Review URL: http://codereview.chromium.org/42598 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@1607 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
parent
4d8ea7143f
commit
7c35a5d820
@ -3456,18 +3456,7 @@ void CodeGenerator::VisitCallRuntime(CallRuntime* node) {
|
|||||||
Comment cmnt(masm_, "[ CallRuntime");
|
Comment cmnt(masm_, "[ CallRuntime");
|
||||||
Runtime::Function* function = node->function();
|
Runtime::Function* function = node->function();
|
||||||
|
|
||||||
if (function != NULL) {
|
if (function == NULL) {
|
||||||
// Push the arguments ("left-to-right").
|
|
||||||
int arg_count = args->length();
|
|
||||||
for (int i = 0; i < arg_count; i++) {
|
|
||||||
LoadAndSpill(args->at(i));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Call the C runtime function.
|
|
||||||
frame_->CallRuntime(function, arg_count);
|
|
||||||
frame_->EmitPush(r0);
|
|
||||||
|
|
||||||
} else {
|
|
||||||
// Prepare stack for calling JS runtime function.
|
// Prepare stack for calling JS runtime function.
|
||||||
__ mov(r0, Operand(node->name()));
|
__ mov(r0, Operand(node->name()));
|
||||||
frame_->EmitPush(r0);
|
frame_->EmitPush(r0);
|
||||||
@ -3475,18 +3464,25 @@ void CodeGenerator::VisitCallRuntime(CallRuntime* node) {
|
|||||||
__ ldr(r1, GlobalObject());
|
__ ldr(r1, GlobalObject());
|
||||||
__ ldr(r0, FieldMemOperand(r1, GlobalObject::kBuiltinsOffset));
|
__ ldr(r0, FieldMemOperand(r1, GlobalObject::kBuiltinsOffset));
|
||||||
frame_->EmitPush(r0);
|
frame_->EmitPush(r0);
|
||||||
|
}
|
||||||
|
|
||||||
int arg_count = args->length();
|
// Push the arguments ("left-to-right").
|
||||||
for (int i = 0; i < arg_count; i++) {
|
int arg_count = args->length();
|
||||||
LoadAndSpill(args->at(i));
|
for (int i = 0; i < arg_count; i++) {
|
||||||
}
|
LoadAndSpill(args->at(i));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (function == NULL) {
|
||||||
// Call the JS runtime function.
|
// Call the JS runtime function.
|
||||||
Handle<Code> stub = ComputeCallInitialize(args->length());
|
Handle<Code> stub = ComputeCallInitialize(arg_count);
|
||||||
frame_->CallCodeObject(stub, RelocInfo::CODE_TARGET, arg_count + 1);
|
frame_->CallCodeObject(stub, RelocInfo::CODE_TARGET, arg_count + 1);
|
||||||
__ ldr(cp, frame_->Context());
|
__ ldr(cp, frame_->Context());
|
||||||
frame_->Drop();
|
frame_->Drop();
|
||||||
frame_->EmitPush(r0);
|
frame_->EmitPush(r0);
|
||||||
|
} else {
|
||||||
|
// Call the C runtime function.
|
||||||
|
frame_->CallRuntime(function, arg_count);
|
||||||
|
frame_->EmitPush(r0);
|
||||||
}
|
}
|
||||||
ASSERT(frame_->height() == original_height + 1);
|
ASSERT(frame_->height() == original_height + 1);
|
||||||
}
|
}
|
||||||
|
@ -4454,12 +4454,8 @@ void CodeGenerator::VisitCallRuntime(CallRuntime* node) {
|
|||||||
if (function == NULL) {
|
if (function == NULL) {
|
||||||
// Call the JS runtime function.
|
// Call the JS runtime function.
|
||||||
Handle<Code> stub = ComputeCallInitialize(arg_count);
|
Handle<Code> stub = ComputeCallInitialize(arg_count);
|
||||||
|
Result answer =
|
||||||
Result num_args = allocator()->Allocate(eax);
|
frame_->CallCodeObject(stub, RelocInfo::CODE_TARGET, arg_count + 1);
|
||||||
ASSERT(num_args.is_valid());
|
|
||||||
__ Set(num_args.reg(), Immediate(args->length()));
|
|
||||||
Result answer = frame_->CallCodeObject(stub, RelocInfo::CODE_TARGET,
|
|
||||||
&num_args, arg_count + 1);
|
|
||||||
frame_->RestoreContextRegister();
|
frame_->RestoreContextRegister();
|
||||||
frame_->SetElementAt(0, &answer);
|
frame_->SetElementAt(0, &answer);
|
||||||
} else {
|
} else {
|
||||||
|
@ -784,10 +784,6 @@ Result VirtualFrame::CallCodeObject(Handle<Code> code,
|
|||||||
int dropped_args) {
|
int dropped_args) {
|
||||||
int spilled_args = 0;
|
int spilled_args = 0;
|
||||||
switch (code->kind()) {
|
switch (code->kind()) {
|
||||||
case Code::CALL_IC:
|
|
||||||
ASSERT(arg->reg().is(eax));
|
|
||||||
spilled_args = dropped_args + 1;
|
|
||||||
break;
|
|
||||||
case Code::LOAD_IC:
|
case Code::LOAD_IC:
|
||||||
ASSERT(arg->reg().is(ecx));
|
ASSERT(arg->reg().is(ecx));
|
||||||
ASSERT(dropped_args == 0);
|
ASSERT(dropped_args == 0);
|
||||||
|
@ -179,12 +179,10 @@ void VirtualFrame::Spill(Register target) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Spill any register if possible, making its external reference count zero.
|
// If there are any registers referenced only by the frame, spill one.
|
||||||
Register VirtualFrame::SpillAnyRegister() {
|
Register VirtualFrame::SpillAnyRegister() {
|
||||||
// Find the leftmost (ordered by register code), least
|
// Find the leftmost (ordered by register code) register whose only
|
||||||
// internally-referenced register whose internal reference count matches
|
// reference is in the frame.
|
||||||
// its external reference count (so that spilling it from the frame frees
|
|
||||||
// it for use).
|
|
||||||
for (int i = 0; i < kNumRegisters; i++) {
|
for (int i = 0; i < kNumRegisters; i++) {
|
||||||
if (is_used(i) && cgen_->allocator()->count(i) == 1) {
|
if (is_used(i) && cgen_->allocator()->count(i) == 1) {
|
||||||
Register result = { i };
|
Register result = { i };
|
||||||
|
Loading…
Reference in New Issue
Block a user