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

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

Issue 3110034: Optimize 'typeof <expr> == <string literal>' in the full codegen. (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/ia32/full-codegen-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 305 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 false_label_ = if_false; 316 false_label_ = if_false;
317 Visit(expr); 317 Visit(expr);
318 context_ = saved_context; 318 context_ = saved_context;
319 true_label_ = saved_true; 319 true_label_ = saved_true;
320 false_label_ = saved_false; 320 false_label_ = saved_false;
321 } 321 }
322 322
323 void VisitDeclarations(ZoneList<Declaration*>* declarations); 323 void VisitDeclarations(ZoneList<Declaration*>* declarations);
324 void DeclareGlobals(Handle<FixedArray> pairs); 324 void DeclareGlobals(Handle<FixedArray> pairs);
325 325
326 // Try to perform a comparison as a fast inlined literal compare if
327 // the operands allow it. Returns true if the compare operations
328 // has been matched and all code generated; false otherwise.
329 bool TryLiteralCompare(Token::Value op,
330 Expression* left,
331 Expression* right,
332 Label* if_true,
333 Label* if_false,
334 Label* fall_through);
335
326 // Platform-specific code for a variable, constant, or function 336 // Platform-specific code for a variable, constant, or function
327 // declaration. Functions have an initial value. 337 // declaration. Functions have an initial value.
328 void EmitDeclaration(Variable* variable, 338 void EmitDeclaration(Variable* variable,
329 Variable::Mode mode, 339 Variable::Mode mode,
330 FunctionLiteral* function); 340 FunctionLiteral* function);
331 341
332 // Platform-specific return sequence 342 // Platform-specific return sequence
333 void EmitReturnSequence(); 343 void EmitReturnSequence();
334 344
335 // Platform-specific code sequences for calls 345 // Platform-specific code sequences for calls
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
379 389
380 // Complete a named property assignment. The receiver is expected on top 390 // Complete a named property assignment. The receiver is expected on top
381 // of the stack and the right-hand-side value in the accumulator. 391 // of the stack and the right-hand-side value in the accumulator.
382 void EmitNamedPropertyAssignment(Assignment* expr); 392 void EmitNamedPropertyAssignment(Assignment* expr);
383 393
384 // Complete a keyed property assignment. The receiver and key are 394 // Complete a keyed property assignment. The receiver and key are
385 // expected on top of the stack and the right-hand-side value in the 395 // expected on top of the stack and the right-hand-side value in the
386 // accumulator. 396 // accumulator.
387 void EmitKeyedPropertyAssignment(Assignment* expr); 397 void EmitKeyedPropertyAssignment(Assignment* expr);
388 398
389 // Helper for compare operations. Expects the null-value in a register.
390 void EmitNullCompare(bool strict,
391 Register obj,
392 Register null_const,
393 Label* if_true,
394 Label* if_false,
395 Register scratch);
396
397 void SetFunctionPosition(FunctionLiteral* fun); 399 void SetFunctionPosition(FunctionLiteral* fun);
398 void SetReturnPosition(FunctionLiteral* fun); 400 void SetReturnPosition(FunctionLiteral* fun);
399 void SetStatementPosition(Statement* stmt); 401 void SetStatementPosition(Statement* stmt);
400 void SetExpressionPosition(Expression* expr, int pos); 402 void SetExpressionPosition(Expression* expr, int pos);
401 void SetStatementPosition(int pos); 403 void SetStatementPosition(int pos);
402 void SetSourcePosition(int pos); 404 void SetSourcePosition(int pos);
403 405
404 // Non-local control flow support. 406 // Non-local control flow support.
405 void EnterFinallyBlock(); 407 void EnterFinallyBlock();
406 void ExitFinallyBlock(); 408 void ExitFinallyBlock();
(...skipping 23 matching lines...) Expand all
430 // Load a value from the current context. Indices are defined as an enum 432 // Load a value from the current context. Indices are defined as an enum
431 // in v8::internal::Context. 433 // in v8::internal::Context.
432 void LoadContextField(Register dst, int context_index); 434 void LoadContextField(Register dst, int context_index);
433 435
434 // AST node visit functions. 436 // AST node visit functions.
435 #define DECLARE_VISIT(type) virtual void Visit##type(type* node); 437 #define DECLARE_VISIT(type) virtual void Visit##type(type* node);
436 AST_NODE_LIST(DECLARE_VISIT) 438 AST_NODE_LIST(DECLARE_VISIT)
437 #undef DECLARE_VISIT 439 #undef DECLARE_VISIT
438 // Handles the shortcutted logical binary operations in VisitBinaryOperation. 440 // Handles the shortcutted logical binary operations in VisitBinaryOperation.
439 void EmitLogicalOperation(BinaryOperation* expr); 441 void EmitLogicalOperation(BinaryOperation* expr);
442
443 void VisitForTypeofValue(Expression* expr, Location where);
444
440 void VisitLogicalForValue(Expression* expr, 445 void VisitLogicalForValue(Expression* expr,
441 Token::Value op, 446 Token::Value op,
442 Location where, 447 Location where,
443 Label* done); 448 Label* done);
444 449
445 450
446 MacroAssembler* masm_; 451 MacroAssembler* masm_;
447 CompilationInfo* info_; 452 CompilationInfo* info_;
448 453
449 Label return_label_; 454 Label return_label_;
450 NestedStatement* nesting_stack_; 455 NestedStatement* nesting_stack_;
451 int loop_depth_; 456 int loop_depth_;
452 457
453 Expression::Context context_; 458 Expression::Context context_;
454 Location location_; 459 Location location_;
455 Label* true_label_; 460 Label* true_label_;
456 Label* false_label_; 461 Label* false_label_;
457 462
458 friend class NestedStatement; 463 friend class NestedStatement;
459 464
460 DISALLOW_COPY_AND_ASSIGN(FullCodeGenerator); 465 DISALLOW_COPY_AND_ASSIGN(FullCodeGenerator);
461 }; 466 };
462 467
463 468
464 } } // namespace v8::internal 469 } } // namespace v8::internal
465 470
466 #endif // V8_FULL_CODEGEN_H_ 471 #endif // V8_FULL_CODEGEN_H_
OLDNEW
« no previous file with comments | « src/arm/full-codegen-arm.cc ('k') | src/ia32/full-codegen-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698