OLD | NEW |
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
589 | 589 |
590 void CodeGenerator::StoreArgumentsObject(bool initial) { | 590 void CodeGenerator::StoreArgumentsObject(bool initial) { |
591 ArgumentsAllocationMode mode = ArgumentsMode(); | 591 ArgumentsAllocationMode mode = ArgumentsMode(); |
592 ASSERT(mode != NO_ARGUMENTS_ALLOCATION); | 592 ASSERT(mode != NO_ARGUMENTS_ALLOCATION); |
593 | 593 |
594 Comment cmnt(masm_, "[ store arguments object"); | 594 Comment cmnt(masm_, "[ store arguments object"); |
595 if (mode == LAZY_ARGUMENTS_ALLOCATION && initial) { | 595 if (mode == LAZY_ARGUMENTS_ALLOCATION && initial) { |
596 // When using lazy arguments allocation, we store the hole value | 596 // When using lazy arguments allocation, we store the hole value |
597 // as a sentinel indicating that the arguments object hasn't been | 597 // as a sentinel indicating that the arguments object hasn't been |
598 // allocated yet. | 598 // allocated yet. |
599 frame_->EmitPushRoot(Heap::kTheHoleValueRootIndex); | 599 frame_->EmitPushRoot(Heap::kArgumentsMarkerRootIndex); |
600 } else { | 600 } else { |
601 frame_->SpillAll(); | 601 frame_->SpillAll(); |
602 ArgumentsAccessStub stub(ArgumentsAccessStub::NEW_OBJECT); | 602 ArgumentsAccessStub stub(ArgumentsAccessStub::NEW_OBJECT); |
603 __ ldr(r2, frame_->Function()); | 603 __ ldr(r2, frame_->Function()); |
604 // The receiver is below the arguments, the return address, and the | 604 // The receiver is below the arguments, the return address, and the |
605 // frame pointer on the stack. | 605 // frame pointer on the stack. |
606 const int kReceiverDisplacement = 2 + scope()->num_parameters(); | 606 const int kReceiverDisplacement = 2 + scope()->num_parameters(); |
607 __ add(r1, fp, Operand(kReceiverDisplacement * kPointerSize)); | 607 __ add(r1, fp, Operand(kReceiverDisplacement * kPointerSize)); |
608 __ mov(r0, Operand(Smi::FromInt(scope()->num_parameters()))); | 608 __ mov(r0, Operand(Smi::FromInt(scope()->num_parameters()))); |
609 frame_->Adjust(3); | 609 frame_->Adjust(3); |
610 __ Push(r2, r1, r0); | 610 __ Push(r2, r1, r0); |
611 frame_->CallStub(&stub, 3); | 611 frame_->CallStub(&stub, 3); |
612 frame_->EmitPush(r0); | 612 frame_->EmitPush(r0); |
613 } | 613 } |
614 | 614 |
615 Variable* arguments = scope()->arguments(); | 615 Variable* arguments = scope()->arguments(); |
616 Variable* shadow = scope()->arguments_shadow(); | 616 Variable* shadow = scope()->arguments_shadow(); |
617 ASSERT(arguments != NULL && arguments->AsSlot() != NULL); | 617 ASSERT(arguments != NULL && arguments->AsSlot() != NULL); |
618 ASSERT(shadow != NULL && shadow->AsSlot() != NULL); | 618 ASSERT(shadow != NULL && shadow->AsSlot() != NULL); |
619 JumpTarget done; | 619 JumpTarget done; |
620 if (mode == LAZY_ARGUMENTS_ALLOCATION && !initial) { | 620 if (mode == LAZY_ARGUMENTS_ALLOCATION && !initial) { |
621 // We have to skip storing into the arguments slot if it has | 621 // We have to skip storing into the arguments slot if it has |
622 // already been written to. This can happen if the a function | 622 // already been written to. This can happen if the a function |
623 // has a local variable named 'arguments'. | 623 // has a local variable named 'arguments'. |
624 LoadFromSlot(scope()->arguments()->AsSlot(), NOT_INSIDE_TYPEOF); | 624 LoadFromSlot(scope()->arguments()->AsSlot(), NOT_INSIDE_TYPEOF); |
625 Register arguments = frame_->PopToRegister(); | 625 Register arguments = frame_->PopToRegister(); |
626 __ LoadRoot(ip, Heap::kTheHoleValueRootIndex); | 626 __ LoadRoot(ip, Heap::kArgumentsMarkerRootIndex); |
627 __ cmp(arguments, ip); | 627 __ cmp(arguments, ip); |
628 done.Branch(ne); | 628 done.Branch(ne); |
629 } | 629 } |
630 StoreToSlot(arguments->AsSlot(), NOT_CONST_INIT); | 630 StoreToSlot(arguments->AsSlot(), NOT_CONST_INIT); |
631 if (mode == LAZY_ARGUMENTS_ALLOCATION) done.Bind(); | 631 if (mode == LAZY_ARGUMENTS_ALLOCATION) done.Bind(); |
632 StoreToSlot(shadow->AsSlot(), NOT_CONST_INIT); | 632 StoreToSlot(shadow->AsSlot(), NOT_CONST_INIT); |
633 } | 633 } |
634 | 634 |
635 | 635 |
636 void CodeGenerator::LoadTypeofExpression(Expression* expr) { | 636 void CodeGenerator::LoadTypeofExpression(Expression* expr) { |
(...skipping 1104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1741 // sp[1]: receiver | 1741 // sp[1]: receiver |
1742 // sp[2]: applicand.apply | 1742 // sp[2]: applicand.apply |
1743 // sp[3]: applicand. | 1743 // sp[3]: applicand. |
1744 | 1744 |
1745 // Check if the arguments object has been lazily allocated | 1745 // Check if the arguments object has been lazily allocated |
1746 // already. If so, just use that instead of copying the arguments | 1746 // already. If so, just use that instead of copying the arguments |
1747 // from the stack. This also deals with cases where a local variable | 1747 // from the stack. This also deals with cases where a local variable |
1748 // named 'arguments' has been introduced. | 1748 // named 'arguments' has been introduced. |
1749 JumpTarget slow; | 1749 JumpTarget slow; |
1750 Label done; | 1750 Label done; |
1751 __ LoadRoot(ip, Heap::kTheHoleValueRootIndex); | 1751 __ LoadRoot(ip, Heap::kArgumentsMarkerRootIndex); |
1752 __ cmp(ip, arguments_reg); | 1752 __ cmp(ip, arguments_reg); |
1753 slow.Branch(ne); | 1753 slow.Branch(ne); |
1754 | 1754 |
1755 Label build_args; | 1755 Label build_args; |
1756 // Get rid of the arguments object probe. | 1756 // Get rid of the arguments object probe. |
1757 frame_->Drop(); | 1757 frame_->Drop(); |
1758 // Stack now has 3 elements on it. | 1758 // Stack now has 3 elements on it. |
1759 // Contents of stack at this point: | 1759 // Contents of stack at this point: |
1760 // sp[0]: receiver - in the receiver_reg register. | 1760 // sp[0]: receiver - in the receiver_reg register. |
1761 // sp[1]: applicand.apply | 1761 // sp[1]: applicand.apply |
(...skipping 1486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3248 // ... or if the slot isn't a non-parameter arguments slot. | 3248 // ... or if the slot isn't a non-parameter arguments slot. |
3249 if (slot->type() == Slot::PARAMETER || !slot->is_arguments()) return; | 3249 if (slot->type() == Slot::PARAMETER || !slot->is_arguments()) return; |
3250 | 3250 |
3251 // Load the loaded value from the stack into a register but leave it on the | 3251 // Load the loaded value from the stack into a register but leave it on the |
3252 // stack. | 3252 // stack. |
3253 Register tos = frame_->Peek(); | 3253 Register tos = frame_->Peek(); |
3254 | 3254 |
3255 // If the loaded value is the sentinel that indicates that we | 3255 // If the loaded value is the sentinel that indicates that we |
3256 // haven't loaded the arguments object yet, we need to do it now. | 3256 // haven't loaded the arguments object yet, we need to do it now. |
3257 JumpTarget exit; | 3257 JumpTarget exit; |
3258 __ LoadRoot(ip, Heap::kTheHoleValueRootIndex); | 3258 __ LoadRoot(ip, Heap::kArgumentsMarkerRootIndex); |
3259 __ cmp(tos, ip); | 3259 __ cmp(tos, ip); |
3260 exit.Branch(ne); | 3260 exit.Branch(ne); |
3261 frame_->Drop(); | 3261 frame_->Drop(); |
3262 StoreArgumentsObject(false); | 3262 StoreArgumentsObject(false); |
3263 exit.Bind(); | 3263 exit.Bind(); |
3264 } | 3264 } |
3265 | 3265 |
3266 | 3266 |
3267 void CodeGenerator::StoreToSlot(Slot* slot, InitState init_state) { | 3267 void CodeGenerator::StoreToSlot(Slot* slot, InitState init_state) { |
3268 ASSERT(slot != NULL); | 3268 ASSERT(slot != NULL); |
(...skipping 4099 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7368 BinaryOpIC::GetName(runtime_operands_type_)); | 7368 BinaryOpIC::GetName(runtime_operands_type_)); |
7369 return name_; | 7369 return name_; |
7370 } | 7370 } |
7371 | 7371 |
7372 | 7372 |
7373 #undef __ | 7373 #undef __ |
7374 | 7374 |
7375 } } // namespace v8::internal | 7375 } } // namespace v8::internal |
7376 | 7376 |
7377 #endif // V8_TARGET_ARCH_ARM | 7377 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |