OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 2528 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2539 while (!save_iterator.Done()) { | 2539 while (!save_iterator.Done()) { |
2540 __ ldc1(DoubleRegister::FromAllocationIndex(save_iterator.Current()), | 2540 __ ldc1(DoubleRegister::FromAllocationIndex(save_iterator.Current()), |
2541 MemOperand(sp, count * kDoubleSize)); | 2541 MemOperand(sp, count * kDoubleSize)); |
2542 save_iterator.Advance(); | 2542 save_iterator.Advance(); |
2543 count++; | 2543 count++; |
2544 } | 2544 } |
2545 } | 2545 } |
2546 if (NeedsEagerFrame()) { | 2546 if (NeedsEagerFrame()) { |
2547 __ mov(sp, fp); | 2547 __ mov(sp, fp); |
2548 __ Pop(ra, fp); | 2548 __ Pop(ra, fp); |
| 2549 } |
| 2550 if (instr->has_constant_parameter_count()) { |
| 2551 int parameter_count = ToInteger32(instr->constant_parameter_count()); |
| 2552 int32_t sp_delta = (parameter_count + 1) * kPointerSize; |
| 2553 if (sp_delta != 0) { |
| 2554 __ Addu(sp, sp, Operand(sp_delta)); |
| 2555 } |
| 2556 } else { |
| 2557 Register reg = ToRegister(instr->parameter_count()); |
| 2558 // The argument count parameter is a smi |
| 2559 __ SmiUntag(reg); |
| 2560 __ sll(at, reg, kPointerSizeLog2); |
| 2561 __ Addu(sp, sp, at); |
| 2562 } |
2549 | 2563 |
2550 if (instr->has_constant_parameter_count()) { | |
2551 int parameter_count = ToInteger32(instr->constant_parameter_count()); | |
2552 int32_t sp_delta = (parameter_count + 1) * kPointerSize; | |
2553 if (sp_delta != 0) { | |
2554 __ Addu(sp, sp, Operand(sp_delta)); | |
2555 } | |
2556 } else { | |
2557 Register reg = ToRegister(instr->parameter_count()); | |
2558 __ Addu(reg, reg, Operand(1)); | |
2559 __ sll(at, reg, kPointerSizeLog2); | |
2560 __ Addu(sp, sp, at); | |
2561 } | |
2562 } | |
2563 __ Jump(ra); | 2564 __ Jump(ra); |
2564 } | 2565 } |
2565 | 2566 |
2566 | 2567 |
2567 void LCodeGen::DoLoadGlobalCell(LLoadGlobalCell* instr) { | 2568 void LCodeGen::DoLoadGlobalCell(LLoadGlobalCell* instr) { |
2568 Register result = ToRegister(instr->result()); | 2569 Register result = ToRegister(instr->result()); |
2569 __ li(at, Operand(Handle<Object>(instr->hydrogen()->cell()))); | 2570 __ li(at, Operand(Handle<Object>(instr->hydrogen()->cell()))); |
2570 __ lw(result, FieldMemOperand(at, JSGlobalPropertyCell::kValueOffset)); | 2571 __ lw(result, FieldMemOperand(at, JSGlobalPropertyCell::kValueOffset)); |
2571 if (instr->hydrogen()->RequiresHoleCheck()) { | 2572 if (instr->hydrogen()->RequiresHoleCheck()) { |
2572 __ LoadRoot(at, Heap::kTheHoleValueRootIndex); | 2573 __ LoadRoot(at, Heap::kTheHoleValueRootIndex); |
(...skipping 1310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3883 } | 3884 } |
3884 | 3885 |
3885 | 3886 |
3886 void LCodeGen::DoCallNewArray(LCallNewArray* instr) { | 3887 void LCodeGen::DoCallNewArray(LCallNewArray* instr) { |
3887 ASSERT(ToRegister(instr->constructor()).is(a1)); | 3888 ASSERT(ToRegister(instr->constructor()).is(a1)); |
3888 ASSERT(ToRegister(instr->result()).is(v0)); | 3889 ASSERT(ToRegister(instr->result()).is(v0)); |
3889 ASSERT(FLAG_optimize_constructed_arrays); | 3890 ASSERT(FLAG_optimize_constructed_arrays); |
3890 | 3891 |
3891 __ li(a0, Operand(instr->arity())); | 3892 __ li(a0, Operand(instr->arity())); |
3892 __ li(a2, Operand(instr->hydrogen()->property_cell())); | 3893 __ li(a2, Operand(instr->hydrogen()->property_cell())); |
3893 Handle<Code> array_construct_code = | 3894 Object* cell_value = instr->hydrogen()->property_cell()->value(); |
3894 isolate()->builtins()->ArrayConstructCode(); | 3895 ElementsKind kind = static_cast<ElementsKind>(Smi::cast(cell_value)->value()); |
3895 | 3896 if (instr->arity() == 0) { |
3896 CallCode(array_construct_code, RelocInfo::CONSTRUCT_CALL, instr); | 3897 ArrayNoArgumentConstructorStub stub(kind); |
| 3898 CallCode(stub.GetCode(isolate()), RelocInfo::CONSTRUCT_CALL, instr); |
| 3899 } else if (instr->arity() == 1) { |
| 3900 ArraySingleArgumentConstructorStub stub(kind); |
| 3901 CallCode(stub.GetCode(isolate()), RelocInfo::CONSTRUCT_CALL, instr); |
| 3902 } else { |
| 3903 ArrayNArgumentsConstructorStub stub(kind); |
| 3904 CallCode(stub.GetCode(isolate()), RelocInfo::CONSTRUCT_CALL, instr); |
| 3905 } |
3897 } | 3906 } |
3898 | 3907 |
3899 | 3908 |
3900 void LCodeGen::DoCallRuntime(LCallRuntime* instr) { | 3909 void LCodeGen::DoCallRuntime(LCallRuntime* instr) { |
3901 CallRuntime(instr->function(), instr->arity(), instr); | 3910 CallRuntime(instr->function(), instr->arity(), instr); |
3902 } | 3911 } |
3903 | 3912 |
3904 | 3913 |
3905 void LCodeGen::DoInnerAllocatedObject(LInnerAllocatedObject* instr) { | 3914 void LCodeGen::DoInnerAllocatedObject(LInnerAllocatedObject* instr) { |
3906 Register result = ToRegister(instr->result()); | 3915 Register result = ToRegister(instr->result()); |
(...skipping 1818 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5725 __ Subu(scratch, result, scratch); | 5734 __ Subu(scratch, result, scratch); |
5726 __ lw(result, FieldMemOperand(scratch, | 5735 __ lw(result, FieldMemOperand(scratch, |
5727 FixedArray::kHeaderSize - kPointerSize)); | 5736 FixedArray::kHeaderSize - kPointerSize)); |
5728 __ bind(&done); | 5737 __ bind(&done); |
5729 } | 5738 } |
5730 | 5739 |
5731 | 5740 |
5732 #undef __ | 5741 #undef __ |
5733 | 5742 |
5734 } } // namespace v8::internal | 5743 } } // namespace v8::internal |
OLD | NEW |