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

Side by Side Diff: src/ia32/lithium-codegen-ia32.cc

Issue 6534022: Optimize functions needing a local context.... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 9 years, 10 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/deoptimizer-ia32.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 info_->function()->name()->IsEqualTo(CStrVector(FLAG_stop_at))) { 130 info_->function()->name()->IsEqualTo(CStrVector(FLAG_stop_at))) {
131 __ int3(); 131 __ int3();
132 } 132 }
133 #endif 133 #endif
134 134
135 __ push(ebp); // Caller's frame pointer. 135 __ push(ebp); // Caller's frame pointer.
136 __ mov(ebp, esp); 136 __ mov(ebp, esp);
137 __ push(esi); // Callee's context. 137 __ push(esi); // Callee's context.
138 __ push(edi); // Callee's JS function. 138 __ push(edi); // Callee's JS function.
139 139
140 // Possibly allocate a local context.
141 int heap_slots = scope()->num_heap_slots() - Context::MIN_CONTEXT_SLOTS;
Vyacheslav Egorov (Chromium) 2011/02/18 10:23:49 Drive by question: this code is basically shared w
rossberg 2011/02/21 16:40:42 According to Kevin, there unfortunately is no good
142 if (heap_slots > 0) {
143 Comment(";;; Allocate local context");
144 // Argument to NewContext is the function, which is still in edi.
145 __ push(edi);
146 if (heap_slots <= FastNewContextStub::kMaximumSlots) {
147 FastNewContextStub stub(heap_slots);
148 __ CallStub(&stub);
Mads Ager (chromium) 2011/02/17 15:49:07 Is there a reason for not using CallCode here whic
rossberg 2011/02/21 16:40:42 Yes: that function needs an explicit LInstruction,
149 } else {
150 __ CallRuntime(Runtime::kNewContext, 1);
Mads Ager (chromium) 2011/02/17 15:49:07 Ditto, is there a reason for not using CallRuntime
rossberg 2011/02/21 16:40:42 Same here.
151 }
152 safepoints_.DefineSafepoint(masm(), Safepoint::kSimple, 0,
Mads Ager (chromium) 2011/02/17 15:49:07 If you cannot use the function above, could you us
rossberg 2011/02/21 16:40:42 Same problem, we'd need an LPointerMap to use that
153 Safepoint::kNoDeoptimizationIndex);
154 // Context is returned in both eax and esi. It replaces the context
155 // passed to us. It's saved in the stack and kept live in esi.
156 __ mov(Operand(ebp, StandardFrameConstants::kContextOffset), esi);
157
158 // Copy parameters into context if necessary.
159 int num_parameters = scope()->num_parameters();
160 for (int i = 0; i < num_parameters; i++) {
161 Slot* slot = scope()->parameter(i)->AsSlot();
162 if (slot != NULL && slot->type() == Slot::CONTEXT) {
163 int parameter_offset = StandardFrameConstants::kCallerSPOffset +
164 (num_parameters - 1 - i) * kPointerSize;
165 // Load parameter from stack.
166 __ mov(eax, Operand(ebp, parameter_offset));
167 // Store it in the context.
168 int context_offset = Context::SlotOffset(slot->index());
169 __ mov(Operand(esi, context_offset), eax);
170 // Update the write barrier. This clobbers all involved
171 // registers, so we have use a third register to avoid
Mads Ager (chromium) 2011/02/17 15:49:07 we have use -> we have to use
rossberg 2011/02/21 16:40:42 Done.
172 // clobbering esi.
173 __ mov(ecx, esi);
174 __ RecordWrite(ecx, context_offset, eax, ebx);
175 }
176 }
177 Comment(";;; End allocate local context");
178 }
179
140 // Reserve space for the stack slots needed by the code. 180 // Reserve space for the stack slots needed by the code.
141 int slots = StackSlotCount(); 181 int slots = StackSlotCount();
142 if (slots > 0) { 182 if (slots > 0) {
143 if (FLAG_debug_code) { 183 if (FLAG_debug_code) {
144 __ mov(Operand(eax), Immediate(slots)); 184 __ mov(Operand(eax), Immediate(slots));
145 Label loop; 185 Label loop;
146 __ bind(&loop); 186 __ bind(&loop);
147 __ push(Immediate(kSlotsZapValue)); 187 __ push(Immediate(kSlotsZapValue));
148 __ dec(eax); 188 __ dec(eax);
149 __ j(not_zero, &loop); 189 __ j(not_zero, &loop);
(...skipping 3654 matching lines...) Expand 10 before | Expand all | Expand 10 after
3804 ASSERT(osr_pc_offset_ == -1); 3844 ASSERT(osr_pc_offset_ == -1);
3805 osr_pc_offset_ = masm()->pc_offset(); 3845 osr_pc_offset_ = masm()->pc_offset();
3806 } 3846 }
3807 3847
3808 3848
3809 #undef __ 3849 #undef __
3810 3850
3811 } } // namespace v8::internal 3851 } } // namespace v8::internal
3812 3852
3813 #endif // V8_TARGET_ARCH_IA32 3853 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/ia32/deoptimizer-ia32.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698