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

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

Issue 6577036: [Isolates] Merge from bleeding_edge to isolates, revisions 6100-6300. (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/isolates/
Patch Set: '' Created 9 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 | « src/x64/code-stubs-x64.cc ('k') | src/x64/debug-x64.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 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 609 matching lines...) Expand 10 before | Expand all | Expand 10 after
620 : LAZY_ARGUMENTS_ALLOCATION; 620 : LAZY_ARGUMENTS_ALLOCATION;
621 } 621 }
622 622
623 623
624 Result CodeGenerator::StoreArgumentsObject(bool initial) { 624 Result CodeGenerator::StoreArgumentsObject(bool initial) {
625 ArgumentsAllocationMode mode = ArgumentsMode(); 625 ArgumentsAllocationMode mode = ArgumentsMode();
626 ASSERT(mode != NO_ARGUMENTS_ALLOCATION); 626 ASSERT(mode != NO_ARGUMENTS_ALLOCATION);
627 627
628 Comment cmnt(masm_, "[ store arguments object"); 628 Comment cmnt(masm_, "[ store arguments object");
629 if (mode == LAZY_ARGUMENTS_ALLOCATION && initial) { 629 if (mode == LAZY_ARGUMENTS_ALLOCATION && initial) {
630 // When using lazy arguments allocation, we store the hole value 630 // When using lazy arguments allocation, we store the arguments marker value
631 // as a sentinel indicating that the arguments object hasn't been 631 // as a sentinel indicating that the arguments object hasn't been
632 // allocated yet. 632 // allocated yet.
633 frame_->Push(FACTORY->the_hole_value()); 633 frame_->Push(FACTORY->arguments_marker());
634 } else { 634 } else {
635 ArgumentsAccessStub stub(ArgumentsAccessStub::NEW_OBJECT); 635 ArgumentsAccessStub stub(ArgumentsAccessStub::NEW_OBJECT);
636 frame_->PushFunction(); 636 frame_->PushFunction();
637 frame_->PushReceiverSlotAddress(); 637 frame_->PushReceiverSlotAddress();
638 frame_->Push(Smi::FromInt(scope()->num_parameters())); 638 frame_->Push(Smi::FromInt(scope()->num_parameters()));
639 Result result = frame_->CallStub(&stub, 3); 639 Result result = frame_->CallStub(&stub, 3);
640 frame_->Push(&result); 640 frame_->Push(&result);
641 } 641 }
642 642
643 Variable* arguments = scope()->arguments(); 643 Variable* arguments = scope()->arguments();
644 Variable* shadow = scope()->arguments_shadow(); 644 Variable* shadow = scope()->arguments_shadow();
645 ASSERT(arguments != NULL && arguments->AsSlot() != NULL); 645 ASSERT(arguments != NULL && arguments->AsSlot() != NULL);
646 ASSERT(shadow != NULL && shadow->AsSlot() != NULL); 646 ASSERT(shadow != NULL && shadow->AsSlot() != NULL);
647 JumpTarget done; 647 JumpTarget done;
648 bool skip_arguments = false; 648 bool skip_arguments = false;
649 if (mode == LAZY_ARGUMENTS_ALLOCATION && !initial) { 649 if (mode == LAZY_ARGUMENTS_ALLOCATION && !initial) {
650 // We have to skip storing into the arguments slot if it has 650 // We have to skip storing into the arguments slot if it has
651 // already been written to. This can happen if the a function 651 // already been written to. This can happen if the a function
652 // has a local variable named 'arguments'. 652 // has a local variable named 'arguments'.
653 LoadFromSlot(arguments->AsSlot(), NOT_INSIDE_TYPEOF); 653 LoadFromSlot(arguments->AsSlot(), NOT_INSIDE_TYPEOF);
654 Result probe = frame_->Pop(); 654 Result probe = frame_->Pop();
655 if (probe.is_constant()) { 655 if (probe.is_constant()) {
656 // We have to skip updating the arguments object if it has 656 // We have to skip updating the arguments object if it has
657 // been assigned a proper value. 657 // been assigned a proper value.
658 skip_arguments = !probe.handle()->IsTheHole(); 658 skip_arguments = !probe.handle()->IsArgumentsMarker();
659 } else { 659 } else {
660 __ CompareRoot(probe.reg(), Heap::kTheHoleValueRootIndex); 660 __ CompareRoot(probe.reg(), Heap::kArgumentsMarkerRootIndex);
661 probe.Unuse(); 661 probe.Unuse();
662 done.Branch(not_equal); 662 done.Branch(not_equal);
663 } 663 }
664 } 664 }
665 if (!skip_arguments) { 665 if (!skip_arguments) {
666 StoreToSlot(arguments->AsSlot(), NOT_CONST_INIT); 666 StoreToSlot(arguments->AsSlot(), NOT_CONST_INIT);
667 if (mode == LAZY_ARGUMENTS_ALLOCATION) done.Bind(); 667 if (mode == LAZY_ARGUMENTS_ALLOCATION) done.Bind();
668 } 668 }
669 StoreToSlot(shadow->AsSlot(), NOT_CONST_INIT); 669 StoreToSlot(shadow->AsSlot(), NOT_CONST_INIT);
670 return frame_->Pop(); 670 return frame_->Pop();
(...skipping 1838 matching lines...) Expand 10 before | Expand all | Expand 10 after
2509 // Check if the arguments object has been lazily allocated 2509 // Check if the arguments object has been lazily allocated
2510 // already. If so, just use that instead of copying the arguments 2510 // already. If so, just use that instead of copying the arguments
2511 // from the stack. This also deals with cases where a local variable 2511 // from the stack. This also deals with cases where a local variable
2512 // named 'arguments' has been introduced. 2512 // named 'arguments' has been introduced.
2513 frame_->Dup(); 2513 frame_->Dup();
2514 Result probe = frame_->Pop(); 2514 Result probe = frame_->Pop();
2515 { VirtualFrame::SpilledScope spilled_scope; 2515 { VirtualFrame::SpilledScope spilled_scope;
2516 Label slow, done; 2516 Label slow, done;
2517 bool try_lazy = true; 2517 bool try_lazy = true;
2518 if (probe.is_constant()) { 2518 if (probe.is_constant()) {
2519 try_lazy = probe.handle()->IsTheHole(); 2519 try_lazy = probe.handle()->IsArgumentsMarker();
2520 } else { 2520 } else {
2521 __ CompareRoot(probe.reg(), Heap::kTheHoleValueRootIndex); 2521 __ CompareRoot(probe.reg(), Heap::kArgumentsMarkerRootIndex);
2522 probe.Unuse(); 2522 probe.Unuse();
2523 __ j(not_equal, &slow); 2523 __ j(not_equal, &slow);
2524 } 2524 }
2525 2525
2526 if (try_lazy) { 2526 if (try_lazy) {
2527 Label build_args; 2527 Label build_args;
2528 // Get rid of the arguments object probe. 2528 // Get rid of the arguments object probe.
2529 frame_->Drop(); // Can be called on a spilled frame. 2529 frame_->Drop(); // Can be called on a spilled frame.
2530 // Stack now has 3 elements on it. 2530 // Stack now has 3 elements on it.
2531 // Contents of stack at this point: 2531 // Contents of stack at this point:
(...skipping 1879 matching lines...) Expand 10 before | Expand all | Expand 10 after
4411 4411
4412 // ... or if the slot isn't a non-parameter arguments slot. 4412 // ... or if the slot isn't a non-parameter arguments slot.
4413 if (slot->type() == Slot::PARAMETER || !slot->is_arguments()) return; 4413 if (slot->type() == Slot::PARAMETER || !slot->is_arguments()) return;
4414 4414
4415 // Pop the loaded value from the stack. 4415 // Pop the loaded value from the stack.
4416 Result value = frame_->Pop(); 4416 Result value = frame_->Pop();
4417 4417
4418 // If the loaded value is a constant, we know if the arguments 4418 // If the loaded value is a constant, we know if the arguments
4419 // object has been lazily loaded yet. 4419 // object has been lazily loaded yet.
4420 if (value.is_constant()) { 4420 if (value.is_constant()) {
4421 if (value.handle()->IsTheHole()) { 4421 if (value.handle()->IsArgumentsMarker()) {
4422 Result arguments = StoreArgumentsObject(false); 4422 Result arguments = StoreArgumentsObject(false);
4423 frame_->Push(&arguments); 4423 frame_->Push(&arguments);
4424 } else { 4424 } else {
4425 frame_->Push(&value); 4425 frame_->Push(&value);
4426 } 4426 }
4427 return; 4427 return;
4428 } 4428 }
4429 4429
4430 // The loaded value is in a register. If it is the sentinel that 4430 // The loaded value is in a register. If it is the sentinel that
4431 // indicates that we haven't loaded the arguments object yet, we 4431 // indicates that we haven't loaded the arguments object yet, we
4432 // need to do it now. 4432 // need to do it now.
4433 JumpTarget exit; 4433 JumpTarget exit;
4434 __ CompareRoot(value.reg(), Heap::kTheHoleValueRootIndex); 4434 __ CompareRoot(value.reg(), Heap::kArgumentsMarkerRootIndex);
4435 frame_->Push(&value); 4435 frame_->Push(&value);
4436 exit.Branch(not_equal); 4436 exit.Branch(not_equal);
4437 Result arguments = StoreArgumentsObject(false); 4437 Result arguments = StoreArgumentsObject(false);
4438 frame_->SetElementAt(0, &arguments); 4438 frame_->SetElementAt(0, &arguments);
4439 exit.Bind(); 4439 exit.Bind();
4440 } 4440 }
4441 4441
4442 4442
4443 Result CodeGenerator::LoadFromGlobalSlotCheckExtensions( 4443 Result CodeGenerator::LoadFromGlobalSlotCheckExtensions(
4444 Slot* slot, 4444 Slot* slot,
(...skipping 2362 matching lines...) Expand 10 before | Expand all | Expand 10 after
6807 __ movq(tmp2.reg(), Operand(index2.reg(), 0)); 6807 __ movq(tmp2.reg(), Operand(index2.reg(), 0));
6808 __ movq(Operand(index2.reg(), 0), object.reg()); 6808 __ movq(Operand(index2.reg(), 0), object.reg());
6809 __ movq(Operand(index1.reg(), 0), tmp2.reg()); 6809 __ movq(Operand(index1.reg(), 0), tmp2.reg());
6810 6810
6811 Label done; 6811 Label done;
6812 __ InNewSpace(tmp1.reg(), tmp2.reg(), equal, &done); 6812 __ InNewSpace(tmp1.reg(), tmp2.reg(), equal, &done);
6813 // Possible optimization: do a check that both values are Smis 6813 // Possible optimization: do a check that both values are Smis
6814 // (or them and test against Smi mask.) 6814 // (or them and test against Smi mask.)
6815 6815
6816 __ movq(tmp2.reg(), tmp1.reg()); 6816 __ movq(tmp2.reg(), tmp1.reg());
6817 RecordWriteStub recordWrite1(tmp2.reg(), index1.reg(), object.reg()); 6817 __ RecordWriteHelper(tmp1.reg(), index1.reg(), object.reg());
6818 __ CallStub(&recordWrite1); 6818 __ RecordWriteHelper(tmp2.reg(), index2.reg(), object.reg());
6819
6820 RecordWriteStub recordWrite2(tmp1.reg(), index2.reg(), object.reg());
6821 __ CallStub(&recordWrite2);
6822
6823 __ bind(&done); 6819 __ bind(&done);
6824 6820
6825 deferred->BindExit(); 6821 deferred->BindExit();
6826 frame_->Push(FACTORY->undefined_value()); 6822 frame_->Push(FACTORY->undefined_value());
6827 } 6823 }
6828 6824
6829 6825
6830 void CodeGenerator::GenerateCallFunction(ZoneList<Expression*>* args) { 6826 void CodeGenerator::GenerateCallFunction(ZoneList<Expression*>* args) {
6831 Comment cmnt(masm_, "[ GenerateCallFunction"); 6827 Comment cmnt(masm_, "[ GenerateCallFunction");
6832 6828
(...skipping 1976 matching lines...) Expand 10 before | Expand all | Expand 10 after
8809 masm.GetCode(&desc); 8805 masm.GetCode(&desc);
8810 // Call the function from C++. 8806 // Call the function from C++.
8811 return FUNCTION_CAST<ModuloFunction>(buffer); 8807 return FUNCTION_CAST<ModuloFunction>(buffer);
8812 } 8808 }
8813 8809
8814 #endif 8810 #endif
8815 8811
8816 8812
8817 #undef __ 8813 #undef __
8818 8814
8819 void RecordWriteStub::Generate(MacroAssembler* masm) {
8820 masm->RecordWriteHelper(object_, addr_, scratch_);
8821 masm->ret(0);
8822 }
8823
8824 } } // namespace v8::internal 8815 } } // namespace v8::internal
8825 8816
8826 #endif // V8_TARGET_ARCH_X64 8817 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/x64/code-stubs-x64.cc ('k') | src/x64/debug-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698