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

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

Issue 651031: Begin using a list of bailouts instead of a singleton in the fast code generator. (Closed)
Patch Set: Created 10 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
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 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 118
119 Scope* CodeGenerator::scope() { return info_->function()->scope(); } 119 Scope* CodeGenerator::scope() { return info_->function()->scope(); }
120 120
121 121
122 // Calling conventions: 122 // Calling conventions:
123 // ebp: caller's frame pointer 123 // ebp: caller's frame pointer
124 // esp: stack pointer 124 // esp: stack pointer
125 // edi: called JS function 125 // edi: called JS function
126 // esi: callee's context 126 // esi: callee's context
127 127
128 void CodeGenerator::Generate(CompilationInfo* info, Mode mode) { 128 void CodeGenerator::Generate(CompilationInfo* info) {
129 // Record the position for debugging purposes. 129 // Record the position for debugging purposes.
130 CodeForFunctionPosition(info->function()); 130 CodeForFunctionPosition(info->function());
131 131
132 // Initialize state. 132 // Initialize state.
133 info_ = info; 133 info_ = info;
134 ASSERT(allocator_ == NULL); 134 ASSERT(allocator_ == NULL);
135 RegisterAllocator register_allocator(this); 135 RegisterAllocator register_allocator(this);
136 allocator_ = &register_allocator; 136 allocator_ = &register_allocator;
137 ASSERT(frame_ == NULL); 137 ASSERT(frame_ == NULL);
138 frame_ = new VirtualFrame(); 138 frame_ = new VirtualFrame();
(...skipping 18 matching lines...) Expand all
157 CodeGenState state(this); 157 CodeGenState state(this);
158 158
159 // Entry: 159 // Entry:
160 // Stack: receiver, arguments, return address. 160 // Stack: receiver, arguments, return address.
161 // ebp: caller's frame pointer 161 // ebp: caller's frame pointer
162 // esp: stack pointer 162 // esp: stack pointer
163 // edi: called JS function 163 // edi: called JS function
164 // esi: callee's context 164 // esi: callee's context
165 allocator_->Initialize(); 165 allocator_->Initialize();
166 166
167 if (mode == PRIMARY) { 167 if (info->mode() == CompilationInfo::PRIMARY) {
168 frame_->Enter(); 168 frame_->Enter();
169 169
170 // Allocate space for locals and initialize them. 170 // Allocate space for locals and initialize them.
171 frame_->AllocateStackSlots(); 171 frame_->AllocateStackSlots();
172 172
173 // Allocate the local context if needed. 173 // Allocate the local context if needed.
174 int heap_slots = scope()->num_heap_slots() - Context::MIN_CONTEXT_SLOTS; 174 int heap_slots = scope()->num_heap_slots() - Context::MIN_CONTEXT_SLOTS;
175 if (heap_slots > 0) { 175 if (heap_slots > 0) {
176 Comment cmnt(masm_, "[ allocate local context"); 176 Comment cmnt(masm_, "[ allocate local context");
177 // Allocate local context. 177 // Allocate local context.
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 if (scope()->is_function_scope() && scope()->function() != NULL) { 248 if (scope()->is_function_scope() && scope()->function() != NULL) {
249 frame_->Push(Factory::the_hole_value()); 249 frame_->Push(Factory::the_hole_value());
250 StoreToSlot(scope()->function()->slot(), NOT_CONST_INIT); 250 StoreToSlot(scope()->function()->slot(), NOT_CONST_INIT);
251 } 251 }
252 } else { 252 } else {
253 // When used as the secondary compiler for splitting, ebp, esi, 253 // When used as the secondary compiler for splitting, ebp, esi,
254 // and edi have been pushed on the stack. Adjust the virtual 254 // and edi have been pushed on the stack. Adjust the virtual
255 // frame to match this state. 255 // frame to match this state.
256 frame_->Adjust(3); 256 frame_->Adjust(3);
257 allocator_->Unuse(edi); 257 allocator_->Unuse(edi);
258
259 // Bind all the bailout labels to the beginning of the function.
260 List<CompilationInfo::Bailout*>* bailouts = info->bailouts();
261 for (int i = 0; i < bailouts->length(); i++) {
262 __ bind(bailouts->at(i)->label());
263 }
258 } 264 }
259 265
260 // Initialize the function return target after the locals are set 266 // Initialize the function return target after the locals are set
261 // up, because it needs the expected frame height from the frame. 267 // up, because it needs the expected frame height from the frame.
262 function_return_.set_direction(JumpTarget::BIDIRECTIONAL); 268 function_return_.set_direction(JumpTarget::BIDIRECTIONAL);
263 function_return_is_shadowed_ = false; 269 function_return_is_shadowed_ = false;
264 270
265 // Generate code to 'execute' declarations and initialize functions 271 // Generate code to 'execute' declarations and initialize functions
266 // (source elements). In case of an illegal redeclaration we need to 272 // (source elements). In case of an illegal redeclaration we need to
267 // handle that instead of processing the declarations. 273 // handle that instead of processing the declarations.
(...skipping 10507 matching lines...) Expand 10 before | Expand all | Expand 10 after
10775 10781
10776 // Call the runtime; it returns -1 (less), 0 (equal), or 1 (greater) 10782 // Call the runtime; it returns -1 (less), 0 (equal), or 1 (greater)
10777 // tagged as a small integer. 10783 // tagged as a small integer.
10778 __ bind(&runtime); 10784 __ bind(&runtime);
10779 __ TailCallRuntime(ExternalReference(Runtime::kStringCompare), 2, 1); 10785 __ TailCallRuntime(ExternalReference(Runtime::kStringCompare), 2, 1);
10780 } 10786 }
10781 10787
10782 #undef __ 10788 #undef __
10783 10789
10784 } } // namespace v8::internal 10790 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698