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

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

Issue 5699002: RFC: Switch to ast ids (instead of positions) for type feedback. (Closed)
Patch Set: Cleanup Created 10 years 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 423 matching lines...) Expand 10 before | Expand all | Expand 10 after
434 // Load a value from a named property. 434 // Load a value from a named property.
435 // The receiver is left on the stack by the IC. 435 // The receiver is left on the stack by the IC.
436 void EmitNamedPropertyLoad(Property* expr); 436 void EmitNamedPropertyLoad(Property* expr);
437 437
438 // Load a value from a keyed property. 438 // Load a value from a keyed property.
439 // The receiver and the key is left on the stack by the IC. 439 // The receiver and the key is left on the stack by the IC.
440 void EmitKeyedPropertyLoad(Property* expr); 440 void EmitKeyedPropertyLoad(Property* expr);
441 441
442 // Apply the compound assignment operator. Expects the left operand on top 442 // Apply the compound assignment operator. Expects the left operand on top
443 // of the stack and the right one in the accumulator. 443 // of the stack and the right one in the accumulator.
444 void EmitBinaryOp(Token::Value op, 444 void EmitBinaryOp(BinaryOperation* expr,
445 Token::Value op,
445 OverwriteMode mode); 446 OverwriteMode mode);
446 447
447 // Helper functions for generating inlined smi code for certain 448 // Helper functions for generating inlined smi code for certain
448 // binary operations. 449 // binary operations.
449 void EmitInlineSmiBinaryOp(Expression* expr, 450 void EmitInlineSmiBinaryOp(BinaryOperation* expr,
450 Token::Value op, 451 Token::Value op,
451 OverwriteMode mode, 452 OverwriteMode mode,
452 Expression* left, 453 Expression* left,
453 Expression* right, 454 Expression* right,
454 ConstantOperand constant); 455 ConstantOperand constant);
455 456
456 void EmitConstantSmiBinaryOp(Expression* expr, 457 void EmitConstantSmiBinaryOp(BinaryOperation* expr,
457 Token::Value op, 458 Token::Value op,
458 OverwriteMode mode, 459 OverwriteMode mode,
459 bool left_is_constant_smi, 460 bool left_is_constant_smi,
460 Smi* value); 461 Smi* value);
461 462
462 void EmitConstantSmiBitOp(Expression* expr, 463 void EmitConstantSmiBitOp(BinaryOperation* expr,
463 Token::Value op, 464 Token::Value op,
464 OverwriteMode mode, 465 OverwriteMode mode,
465 Smi* value); 466 Smi* value);
466 467
467 void EmitConstantSmiShiftOp(Expression* expr, 468 void EmitConstantSmiShiftOp(BinaryOperation* expr,
468 Token::Value op, 469 Token::Value op,
469 OverwriteMode mode, 470 OverwriteMode mode,
470 Smi* value); 471 Smi* value);
471 472
472 void EmitConstantSmiAdd(Expression* expr, 473 void EmitConstantSmiAdd(BinaryOperation* expr,
473 OverwriteMode mode, 474 OverwriteMode mode,
474 bool left_is_constant_smi, 475 bool left_is_constant_smi,
475 Smi* value); 476 Smi* value);
476 477
477 void EmitConstantSmiSub(Expression* expr, 478 void EmitConstantSmiSub(BinaryOperation* expr,
478 OverwriteMode mode, 479 OverwriteMode mode,
479 bool left_is_constant_smi, 480 bool left_is_constant_smi,
480 Smi* value); 481 Smi* value);
481 482
482 // Assign to the given expression as if via '='. The right-hand-side value 483 // Assign to the given expression as if via '='. The right-hand-side value
483 // is expected in the accumulator. 484 // is expected in the accumulator.
484 void EmitAssignment(Expression* expr); 485 void EmitAssignment(Expression* expr);
485 486
486 // Complete a variable assignment. The right-hand-side value is expected 487 // Complete a variable assignment. The right-hand-side value is expected
487 // in the accumulator. 488 // in the accumulator.
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
524 525
525 Handle<Script> script() { return info_->script(); } 526 Handle<Script> script() { return info_->script(); }
526 bool is_eval() { return info_->is_eval(); } 527 bool is_eval() { return info_->is_eval(); }
527 FunctionLiteral* function() { return info_->function(); } 528 FunctionLiteral* function() { return info_->function(); }
528 Scope* scope() { return info_->scope(); } 529 Scope* scope() { return info_->scope(); }
529 530
530 static Register result_register(); 531 static Register result_register();
531 static Register context_register(); 532 static Register context_register();
532 533
533 // Helper for calling an IC stub. 534 // Helper for calling an IC stub.
534 void EmitCallIC(Handle<Code> ic, RelocInfo::Mode mode); 535 void EmitCallIC(Handle<Code> ic,
536 RelocInfo::Mode mode,
537 AstId id = kNoAstId);
535 538
536 // Set fields in the stack frame. Offsets are the frame pointer relative 539 // Set fields in the stack frame. Offsets are the frame pointer relative
537 // offsets defined in, e.g., StandardFrameConstants. 540 // offsets defined in, e.g., StandardFrameConstants.
538 void StoreToFrameField(int frame_offset, Register value); 541 void StoreToFrameField(int frame_offset, Register value);
539 542
540 // Load a value from the current context. Indices are defined as an enum 543 // Load a value from the current context. Indices are defined as an enum
541 // in v8::internal::Context. 544 // in v8::internal::Context.
542 void LoadContextField(Register dst, int context_index); 545 void LoadContextField(Register dst, int context_index);
543 546
544 // AST node visit functions. 547 // AST node visit functions.
545 #define DECLARE_VISIT(type) virtual void Visit##type(type* node); 548 #define DECLARE_VISIT(type) virtual void Visit##type(type* node);
546 AST_NODE_LIST(DECLARE_VISIT) 549 AST_NODE_LIST(DECLARE_VISIT)
547 #undef DECLARE_VISIT 550 #undef DECLARE_VISIT
548 // Handles the shortcutted logical binary operations in VisitBinaryOperation. 551 // Handles the shortcutted logical binary operations in VisitBinaryOperation.
549 void EmitLogicalOperation(BinaryOperation* expr); 552 void EmitLogicalOperation(BinaryOperation* expr);
550 553
551 void VisitForTypeofValue(Expression* expr); 554 void VisitForTypeofValue(Expression* expr);
552 555
553 struct BailoutEntry { 556 struct BailoutEntry {
554 unsigned id; 557 AstId id;
555 unsigned pc_and_state; 558 unsigned pc_and_state;
556 }; 559 };
557 560
558 561
559 class ExpressionContext BASE_EMBEDDED { 562 class ExpressionContext BASE_EMBEDDED {
560 public: 563 public:
561 explicit ExpressionContext(FullCodeGenerator* codegen) 564 explicit ExpressionContext(FullCodeGenerator* codegen)
562 : masm_(codegen->masm()), old_(codegen->context()), codegen_(codegen) { 565 : masm_(codegen->masm()), old_(codegen->context()), codegen_(codegen) {
563 codegen->set_new_context(this); 566 codegen->set_new_context(this);
564 } 567 }
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
756 759
757 friend class NestedStatement; 760 friend class NestedStatement;
758 761
759 DISALLOW_COPY_AND_ASSIGN(FullCodeGenerator); 762 DISALLOW_COPY_AND_ASSIGN(FullCodeGenerator);
760 }; 763 };
761 764
762 765
763 } } // namespace v8::internal 766 } } // namespace v8::internal
764 767
765 #endif // V8_FULL_CODEGEN_H_ 768 #endif // V8_FULL_CODEGEN_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698