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

Side by Side Diff: src/fast-codegen.h

Issue 546006: Some cleanup of the toplevel code generator:... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 10 years, 11 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
OLDNEW
1 // Copyright 2009 the V8 project authors. All rights reserved. 1 // Copyright 2009 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 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 } 205 }
206 private: 206 private:
207 // TODO(lrn): Check that this value is correct when implementing 207 // TODO(lrn): Check that this value is correct when implementing
208 // for-in. 208 // for-in.
209 static const int kForInStackElementCount = 5; 209 static const int kForInStackElementCount = 5;
210 DISALLOW_COPY_AND_ASSIGN(ForIn); 210 DISALLOW_COPY_AND_ASSIGN(ForIn);
211 }; 211 };
212 212
213 213
214 int SlotOffset(Slot* slot); 214 int SlotOffset(Slot* slot);
215 void Move(Expression::Context destination, Register source); 215
216 void MoveTOS(Expression::Context destination); 216 // Emit code to complete the evaluation of an expression based on its
217 void Move(Expression::Context destination, Slot* source, Register scratch); 217 // expression context and given its value is in a register, non-lookup
218 void Move(Expression::Context destination, Literal* source); 218 // slot, or a literal.
219 void Apply(Expression::Context context, Register reg);
220 void Apply(Expression::Context context, Slot* slot, Register scratch);
221 void Apply(Expression::Context context, Literal* lit);
222
223 // Emit code to complete the evaluation of an expression based on its
224 // expression context and given its value is on top of the stack.
225 void ApplyTOS(Expression::Context context);
226
227 // Emit code to discard count elements from the top of stack, then
228 // complete the evaluation of an expression based on its expression
229 // context and given its value is in a register.
230 void DropAndApply(int count, Expression::Context context, Register reg);
231
219 void Move(Slot* dst, Register source, Register scratch1, Register scratch2); 232 void Move(Slot* dst, Register source, Register scratch1, Register scratch2);
220 void Move(Register dst, Slot* source); 233 void Move(Register dst, Slot* source);
221 234
222 // Return an operand used to read/write to a known (ie, non-LOOKUP) slot. 235 // Return an operand used to read/write to a known (ie, non-LOOKUP) slot.
223 // May emit code to traverse the context chain, destroying the scratch 236 // May emit code to traverse the context chain, destroying the scratch
224 // register. 237 // register.
225 MemOperand EmitSlotSearch(Slot* slot, Register scratch); 238 MemOperand EmitSlotSearch(Slot* slot, Register scratch);
226 239
227 // Drop the TOS, and store source to destination.
228 // If destination is TOS, just overwrite TOS with source.
229 void DropAndMove(Expression::Context destination,
230 Register source,
231 int drop_count = 1);
232
233 // Test the JavaScript value in source as if in a test context, compile 240 // Test the JavaScript value in source as if in a test context, compile
234 // control flow to a pair of labels. 241 // control flow to a pair of labels.
235 void TestAndBranch(Register source, Label* true_label, Label* false_label); 242 void TestAndBranch(Register source, Label* true_label, Label* false_label);
236 243
237 void VisitDeclarations(ZoneList<Declaration*>* declarations); 244 void VisitDeclarations(ZoneList<Declaration*>* declarations);
238 void DeclareGlobals(Handle<FixedArray> pairs); 245 void DeclareGlobals(Handle<FixedArray> pairs);
239 246
240 // Platform-specific return sequence 247 // Platform-specific return sequence
241 void EmitReturnSequence(int position); 248 void EmitReturnSequence(int position);
242 249
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
322 329
323 friend class NestedStatement; 330 friend class NestedStatement;
324 331
325 DISALLOW_COPY_AND_ASSIGN(FastCodeGenerator); 332 DISALLOW_COPY_AND_ASSIGN(FastCodeGenerator);
326 }; 333 };
327 334
328 335
329 } } // namespace v8::internal 336 } } // namespace v8::internal
330 337
331 #endif // V8_FAST_CODEGEN_H_ 338 #endif // V8_FAST_CODEGEN_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698