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

Side by Side Diff: src/ia32/codegen-ia32.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/ia32/code-stubs-ia32.cc ('k') | src/ia32/debug-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 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 728 matching lines...) Expand 10 before | Expand all | Expand 10 after
739 : LAZY_ARGUMENTS_ALLOCATION; 739 : LAZY_ARGUMENTS_ALLOCATION;
740 } 740 }
741 741
742 742
743 Result CodeGenerator::StoreArgumentsObject(bool initial) { 743 Result CodeGenerator::StoreArgumentsObject(bool initial) {
744 ArgumentsAllocationMode mode = ArgumentsMode(); 744 ArgumentsAllocationMode mode = ArgumentsMode();
745 ASSERT(mode != NO_ARGUMENTS_ALLOCATION); 745 ASSERT(mode != NO_ARGUMENTS_ALLOCATION);
746 746
747 Comment cmnt(masm_, "[ store arguments object"); 747 Comment cmnt(masm_, "[ store arguments object");
748 if (mode == LAZY_ARGUMENTS_ALLOCATION && initial) { 748 if (mode == LAZY_ARGUMENTS_ALLOCATION && initial) {
749 // When using lazy arguments allocation, we store the hole value 749 // When using lazy arguments allocation, we store the arguments marker value
750 // as a sentinel indicating that the arguments object hasn't been 750 // as a sentinel indicating that the arguments object hasn't been
751 // allocated yet. 751 // allocated yet.
752 frame_->Push(FACTORY->the_hole_value()); 752 frame_->Push(FACTORY->arguments_marker());
753 } else { 753 } else {
754 ArgumentsAccessStub stub(ArgumentsAccessStub::NEW_OBJECT); 754 ArgumentsAccessStub stub(ArgumentsAccessStub::NEW_OBJECT);
755 frame_->PushFunction(); 755 frame_->PushFunction();
756 frame_->PushReceiverSlotAddress(); 756 frame_->PushReceiverSlotAddress();
757 frame_->Push(Smi::FromInt(scope()->num_parameters())); 757 frame_->Push(Smi::FromInt(scope()->num_parameters()));
758 Result result = frame_->CallStub(&stub, 3); 758 Result result = frame_->CallStub(&stub, 3);
759 frame_->Push(&result); 759 frame_->Push(&result);
760 } 760 }
761 761
762 Variable* arguments = scope()->arguments(); 762 Variable* arguments = scope()->arguments();
763 Variable* shadow = scope()->arguments_shadow(); 763 Variable* shadow = scope()->arguments_shadow();
764 ASSERT(arguments != NULL && arguments->AsSlot() != NULL); 764 ASSERT(arguments != NULL && arguments->AsSlot() != NULL);
765 ASSERT(shadow != NULL && shadow->AsSlot() != NULL); 765 ASSERT(shadow != NULL && shadow->AsSlot() != NULL);
766 JumpTarget done; 766 JumpTarget done;
767 bool skip_arguments = false; 767 bool skip_arguments = false;
768 if (mode == LAZY_ARGUMENTS_ALLOCATION && !initial) { 768 if (mode == LAZY_ARGUMENTS_ALLOCATION && !initial) {
769 // We have to skip storing into the arguments slot if it has 769 // We have to skip storing into the arguments slot if it has
770 // already been written to. This can happen if the a function 770 // already been written to. This can happen if the a function
771 // has a local variable named 'arguments'. 771 // has a local variable named 'arguments'.
772 LoadFromSlot(arguments->AsSlot(), NOT_INSIDE_TYPEOF); 772 LoadFromSlot(arguments->AsSlot(), NOT_INSIDE_TYPEOF);
773 Result probe = frame_->Pop(); 773 Result probe = frame_->Pop();
774 if (probe.is_constant()) { 774 if (probe.is_constant()) {
775 // We have to skip updating the arguments object if it has 775 // We have to skip updating the arguments object if it has
776 // been assigned a proper value. 776 // been assigned a proper value.
777 skip_arguments = !probe.handle()->IsTheHole(); 777 skip_arguments = !probe.handle()->IsArgumentsMarker();
778 } else { 778 } else {
779 __ cmp(Operand(probe.reg()), Immediate(FACTORY->the_hole_value())); 779 __ cmp(Operand(probe.reg()), Immediate(FACTORY->arguments_marker()));
780 probe.Unuse(); 780 probe.Unuse();
781 done.Branch(not_equal); 781 done.Branch(not_equal);
782 } 782 }
783 } 783 }
784 if (!skip_arguments) { 784 if (!skip_arguments) {
785 StoreToSlot(arguments->AsSlot(), NOT_CONST_INIT); 785 StoreToSlot(arguments->AsSlot(), NOT_CONST_INIT);
786 if (mode == LAZY_ARGUMENTS_ALLOCATION) done.Bind(); 786 if (mode == LAZY_ARGUMENTS_ALLOCATION) done.Bind();
787 } 787 }
788 StoreToSlot(shadow->AsSlot(), NOT_CONST_INIT); 788 StoreToSlot(shadow->AsSlot(), NOT_CONST_INIT);
789 return frame_->Pop(); 789 return frame_->Pop();
(...skipping 2501 matching lines...) Expand 10 before | Expand all | Expand 10 after
3291 // Check if the arguments object has been lazily allocated 3291 // Check if the arguments object has been lazily allocated
3292 // already. If so, just use that instead of copying the arguments 3292 // already. If so, just use that instead of copying the arguments
3293 // from the stack. This also deals with cases where a local variable 3293 // from the stack. This also deals with cases where a local variable
3294 // named 'arguments' has been introduced. 3294 // named 'arguments' has been introduced.
3295 frame_->Dup(); 3295 frame_->Dup();
3296 Result probe = frame_->Pop(); 3296 Result probe = frame_->Pop();
3297 { VirtualFrame::SpilledScope spilled_scope; 3297 { VirtualFrame::SpilledScope spilled_scope;
3298 Label slow, done; 3298 Label slow, done;
3299 bool try_lazy = true; 3299 bool try_lazy = true;
3300 if (probe.is_constant()) { 3300 if (probe.is_constant()) {
3301 try_lazy = probe.handle()->IsTheHole(); 3301 try_lazy = probe.handle()->IsArgumentsMarker();
3302 } else { 3302 } else {
3303 __ cmp(Operand(probe.reg()), Immediate(FACTORY->the_hole_value())); 3303 __ cmp(Operand(probe.reg()), Immediate(FACTORY->arguments_marker()));
3304 probe.Unuse(); 3304 probe.Unuse();
3305 __ j(not_equal, &slow); 3305 __ j(not_equal, &slow);
3306 } 3306 }
3307 3307
3308 if (try_lazy) { 3308 if (try_lazy) {
3309 Label build_args; 3309 Label build_args;
3310 // Get rid of the arguments object probe. 3310 // Get rid of the arguments object probe.
3311 frame_->Drop(); // Can be called on a spilled frame. 3311 frame_->Drop(); // Can be called on a spilled frame.
3312 // Stack now has 3 elements on it. 3312 // Stack now has 3 elements on it.
3313 // Contents of stack at this point: 3313 // Contents of stack at this point:
(...skipping 1752 matching lines...) Expand 10 before | Expand all | Expand 10 after
5066 // Bail out quickly if we're not using lazy arguments allocation. 5066 // Bail out quickly if we're not using lazy arguments allocation.
5067 if (ArgumentsMode() != LAZY_ARGUMENTS_ALLOCATION) return; 5067 if (ArgumentsMode() != LAZY_ARGUMENTS_ALLOCATION) return;
5068 5068
5069 // ... or if the slot isn't a non-parameter arguments slot. 5069 // ... or if the slot isn't a non-parameter arguments slot.
5070 if (slot->type() == Slot::PARAMETER || !slot->is_arguments()) return; 5070 if (slot->type() == Slot::PARAMETER || !slot->is_arguments()) return;
5071 5071
5072 // If the loaded value is a constant, we know if the arguments 5072 // If the loaded value is a constant, we know if the arguments
5073 // object has been lazily loaded yet. 5073 // object has been lazily loaded yet.
5074 Result result = frame()->Pop(); 5074 Result result = frame()->Pop();
5075 if (result.is_constant()) { 5075 if (result.is_constant()) {
5076 if (result.handle()->IsTheHole()) { 5076 if (result.handle()->IsArgumentsMarker()) {
5077 result = StoreArgumentsObject(false); 5077 result = StoreArgumentsObject(false);
5078 } 5078 }
5079 frame()->Push(&result); 5079 frame()->Push(&result);
5080 return; 5080 return;
5081 } 5081 }
5082 ASSERT(result.is_register()); 5082 ASSERT(result.is_register());
5083 // The loaded value is in a register. If it is the sentinel that 5083 // The loaded value is in a register. If it is the sentinel that
5084 // indicates that we haven't loaded the arguments object yet, we 5084 // indicates that we haven't loaded the arguments object yet, we
5085 // need to do it now. 5085 // need to do it now.
5086 JumpTarget exit; 5086 JumpTarget exit;
5087 __ cmp(Operand(result.reg()), Immediate(FACTORY->the_hole_value())); 5087 __ cmp(Operand(result.reg()), Immediate(FACTORY->arguments_marker()));
5088 frame()->Push(&result); 5088 frame()->Push(&result);
5089 exit.Branch(not_equal); 5089 exit.Branch(not_equal);
5090 5090
5091 result = StoreArgumentsObject(false); 5091 result = StoreArgumentsObject(false);
5092 frame()->SetElementAt(0, &result); 5092 frame()->SetElementAt(0, &result);
5093 result.Unuse(); 5093 result.Unuse();
5094 exit.Bind(); 5094 exit.Bind();
5095 return; 5095 return;
5096 } 5096 }
5097 5097
(...skipping 5139 matching lines...) Expand 10 before | Expand all | Expand 10 after
10237 memcpy(chunk->GetStartAddress(), desc.buffer, desc.instr_size); 10237 memcpy(chunk->GetStartAddress(), desc.buffer, desc.instr_size);
10238 CPU::FlushICache(chunk->GetStartAddress(), desc.instr_size); 10238 CPU::FlushICache(chunk->GetStartAddress(), desc.instr_size);
10239 return FUNCTION_CAST<MemCopyFunction>(chunk->GetStartAddress()); 10239 return FUNCTION_CAST<MemCopyFunction>(chunk->GetStartAddress());
10240 } 10240 }
10241 10241
10242 #undef __ 10242 #undef __
10243 10243
10244 } } // namespace v8::internal 10244 } } // namespace v8::internal
10245 10245
10246 #endif // V8_TARGET_ARCH_IA32 10246 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/ia32/code-stubs-ia32.cc ('k') | src/ia32/debug-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698