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

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

Issue 3166033: Improve the code generated by the full codegen by keeping... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 10 years, 4 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/arm/full-codegen-arm.cc ('k') | src/full-codegen.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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 66
67 class FullCodeGenerator: public AstVisitor { 67 class FullCodeGenerator: public AstVisitor {
68 public: 68 public:
69 explicit FullCodeGenerator(MacroAssembler* masm) 69 explicit FullCodeGenerator(MacroAssembler* masm)
70 : masm_(masm), 70 : masm_(masm),
71 info_(NULL), 71 info_(NULL),
72 nesting_stack_(NULL), 72 nesting_stack_(NULL),
73 loop_depth_(0), 73 loop_depth_(0),
74 location_(kStack), 74 location_(kStack),
75 true_label_(NULL), 75 true_label_(NULL),
76 false_label_(NULL) { 76 false_label_(NULL),
77 fall_through_(NULL) {
77 } 78 }
78 79
79 static Handle<Code> MakeCode(CompilationInfo* info); 80 static Handle<Code> MakeCode(CompilationInfo* info);
80 81
81 void Generate(CompilationInfo* info); 82 void Generate(CompilationInfo* info);
82 83
83 private: 84 private:
84 class Breakable; 85 class Breakable;
85 class Iteration; 86 class Iteration;
86 class TryCatch; 87 class TryCatch;
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 252
252 // Emit code to discard count elements from the top of stack, then convert 253 // Emit code to discard count elements from the top of stack, then convert
253 // a pure value into the result expected according to an expression 254 // a pure value into the result expected according to an expression
254 // context. 255 // context.
255 void DropAndApply(int count, Expression::Context context, Register reg); 256 void DropAndApply(int count, Expression::Context context, Register reg);
256 257
257 // Set up branch labels for a test expression. 258 // Set up branch labels for a test expression.
258 void PrepareTest(Label* materialize_true, 259 void PrepareTest(Label* materialize_true,
259 Label* materialize_false, 260 Label* materialize_false,
260 Label** if_true, 261 Label** if_true,
261 Label** if_false); 262 Label** if_false,
263 Label** fall_through);
262 264
263 // Emit code to convert pure control flow to a pair of labels into the 265 // Emit code to convert pure control flow to a pair of labels into the
264 // result expected according to an expression context. 266 // result expected according to an expression context.
265 void Apply(Expression::Context context, 267 void Apply(Expression::Context context,
266 Label* materialize_true, 268 Label* materialize_true,
267 Label* materialize_false); 269 Label* materialize_false);
268 270
269 // Emit code to convert constant control flow (true or false) into 271 // Emit code to convert constant control flow (true or false) into
270 // the result expected according to an expression context. 272 // the result expected according to an expression context.
271 void Apply(Expression::Context context, bool flag); 273 void Apply(Expression::Context context, bool flag);
(...skipping 28 matching lines...) Expand all
300 void VisitForValue(Expression* expr, Location where) { 302 void VisitForValue(Expression* expr, Location where) {
301 Expression::Context saved_context = context_; 303 Expression::Context saved_context = context_;
302 Location saved_location = location_; 304 Location saved_location = location_;
303 context_ = Expression::kValue; 305 context_ = Expression::kValue;
304 location_ = where; 306 location_ = where;
305 Visit(expr); 307 Visit(expr);
306 context_ = saved_context; 308 context_ = saved_context;
307 location_ = saved_location; 309 location_ = saved_location;
308 } 310 }
309 311
310 void VisitForControl(Expression* expr, Label* if_true, Label* if_false) { 312 void VisitForControl(Expression* expr,
313 Label* if_true,
314 Label* if_false,
315 Label* fall_through) {
311 Expression::Context saved_context = context_; 316 Expression::Context saved_context = context_;
312 Label* saved_true = true_label_; 317 Label* saved_true = true_label_;
313 Label* saved_false = false_label_; 318 Label* saved_false = false_label_;
319 Label* saved_fall_through = fall_through_;
314 context_ = Expression::kTest; 320 context_ = Expression::kTest;
315 true_label_ = if_true; 321 true_label_ = if_true;
316 false_label_ = if_false; 322 false_label_ = if_false;
323 fall_through_ = fall_through;
317 Visit(expr); 324 Visit(expr);
318 context_ = saved_context; 325 context_ = saved_context;
319 true_label_ = saved_true; 326 true_label_ = saved_true;
320 false_label_ = saved_false; 327 false_label_ = saved_false;
328 fall_through_ = saved_fall_through;
321 } 329 }
322 330
323 void VisitDeclarations(ZoneList<Declaration*>* declarations); 331 void VisitDeclarations(ZoneList<Declaration*>* declarations);
324 void DeclareGlobals(Handle<FixedArray> pairs); 332 void DeclareGlobals(Handle<FixedArray> pairs);
325 333
326 // Try to perform a comparison as a fast inlined literal compare if 334 // Try to perform a comparison as a fast inlined literal compare if
327 // the operands allow it. Returns true if the compare operations 335 // the operands allow it. Returns true if the compare operations
328 // has been matched and all code generated; false otherwise. 336 // has been matched and all code generated; false otherwise.
329 bool TryLiteralCompare(Token::Value op, 337 bool TryLiteralCompare(Token::Value op,
330 Expression* left, 338 Expression* left,
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
452 CompilationInfo* info_; 460 CompilationInfo* info_;
453 461
454 Label return_label_; 462 Label return_label_;
455 NestedStatement* nesting_stack_; 463 NestedStatement* nesting_stack_;
456 int loop_depth_; 464 int loop_depth_;
457 465
458 Expression::Context context_; 466 Expression::Context context_;
459 Location location_; 467 Location location_;
460 Label* true_label_; 468 Label* true_label_;
461 Label* false_label_; 469 Label* false_label_;
470 Label* fall_through_;
462 471
463 friend class NestedStatement; 472 friend class NestedStatement;
464 473
465 DISALLOW_COPY_AND_ASSIGN(FullCodeGenerator); 474 DISALLOW_COPY_AND_ASSIGN(FullCodeGenerator);
466 }; 475 };
467 476
468 477
469 } } // namespace v8::internal 478 } } // namespace v8::internal
470 479
471 #endif // V8_FULL_CODEGEN_H_ 480 #endif // V8_FULL_CODEGEN_H_
OLDNEW
« no previous file with comments | « src/arm/full-codegen-arm.cc ('k') | src/full-codegen.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698