| OLD | NEW |
| 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 429 void LoadTypeofExpression(Expression* x); | 429 void LoadTypeofExpression(Expression* x); |
| 430 | 430 |
| 431 // Translate the value on top of the frame into control flow to the | 431 // Translate the value on top of the frame into control flow to the |
| 432 // control destination. | 432 // control destination. |
| 433 void ToBoolean(ControlDestination* destination); | 433 void ToBoolean(ControlDestination* destination); |
| 434 | 434 |
| 435 void GenericBinaryOperation(Token::Value op, | 435 void GenericBinaryOperation(Token::Value op, |
| 436 StaticType* type, | 436 StaticType* type, |
| 437 const OverwriteMode overwrite_mode = NO_OVERWRITE); | 437 const OverwriteMode overwrite_mode = NO_OVERWRITE); |
| 438 | 438 |
| 439 // If possible, combine two constant smi values using op to produce |
| 440 // a smi result, and push it on the virtual frame, all at compile time. |
| 441 // Returns true if it succeeds. Otherwise it has no effect. |
| 442 bool FoldConstantSmis(Token::Value op, int left, int right); |
| 443 |
| 444 // Emit code to perform a binary operation on |
| 445 // a constant smi and a likely smi. Consumes the Result *operand. |
| 446 void ConstantSmiBinaryOperation(Token::Value op, |
| 447 Result* operand, |
| 448 Handle<Object> constant_operand, |
| 449 StaticType* type, |
| 450 bool reversed, |
| 451 OverwriteMode overwrite_mode); |
| 452 |
| 453 // Emit code to perform a binary operation on two likely smis. |
| 454 // The code to handle smi arguments is produced inline. |
| 455 // Consumes the Results *left and *right. |
| 456 void LikelySmiBinaryOperation(Token::Value op, |
| 457 Result* left, |
| 458 Result* right, |
| 459 OverwriteMode overwrite_mode); |
| 460 |
| 439 void Comparison(Condition cc, | 461 void Comparison(Condition cc, |
| 440 bool strict, | 462 bool strict, |
| 441 ControlDestination* destination); | 463 ControlDestination* destination); |
| 442 | 464 |
| 443 // To prevent long attacker-controlled byte sequences, integer constants | 465 // To prevent long attacker-controlled byte sequences, integer constants |
| 444 // from the JavaScript source are loaded in two parts if they are larger | 466 // from the JavaScript source are loaded in two parts if they are larger |
| 445 // than 16 bits. | 467 // than 16 bits. |
| 446 static const int kMaxSmiInlinedBits = 16; | 468 static const int kMaxSmiInlinedBits = 16; |
| 447 bool IsUnsafeSmi(Handle<Object> value); | 469 bool IsUnsafeSmi(Handle<Object> value); |
| 448 // Load an integer constant x into a register target using | 470 // Load an integer constant x into a register target using |
| 449 // at most 16 bits of user-controlled data per assembly operation. | 471 // at most 16 bits of user-controlled data per assembly operation. |
| 450 void LoadUnsafeSmi(Register target, Handle<Object> value); | 472 void LoadUnsafeSmi(Register target, Handle<Object> value); |
| 451 | 473 |
| 452 bool IsInlineSmi(Literal* literal); | |
| 453 void SmiOperation(Token::Value op, | |
| 454 StaticType* type, | |
| 455 Handle<Object> value, | |
| 456 bool reversed, | |
| 457 OverwriteMode overwrite_mode); | |
| 458 | |
| 459 void CallWithArguments(ZoneList<Expression*>* arguments, int position); | 474 void CallWithArguments(ZoneList<Expression*>* arguments, int position); |
| 460 | 475 |
| 461 void CheckStack(); | 476 void CheckStack(); |
| 462 | 477 |
| 463 bool CheckForInlineRuntimeCall(CallRuntime* node); | 478 bool CheckForInlineRuntimeCall(CallRuntime* node); |
| 464 Handle<JSFunction> BuildBoilerplate(FunctionLiteral* node); | 479 Handle<JSFunction> BuildBoilerplate(FunctionLiteral* node); |
| 465 void ProcessDeclarations(ZoneList<Declaration*>* declarations); | 480 void ProcessDeclarations(ZoneList<Declaration*>* declarations); |
| 466 | 481 |
| 467 Handle<Code> ComputeCallInitialize(int argc); | 482 Handle<Code> ComputeCallInitialize(int argc); |
| 468 Handle<Code> ComputeCallInitializeInLoop(int argc); | 483 Handle<Code> ComputeCallInitializeInLoop(int argc); |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 555 void CodeForStatementPosition(Node* node); | 570 void CodeForStatementPosition(Node* node); |
| 556 void CodeForSourcePosition(int pos); | 571 void CodeForSourcePosition(int pos); |
| 557 | 572 |
| 558 #ifdef DEBUG | 573 #ifdef DEBUG |
| 559 // True if the registers are valid for entry to a block. There should be | 574 // True if the registers are valid for entry to a block. There should be |
| 560 // no frame-external references to eax, ebx, ecx, edx, or edi. | 575 // no frame-external references to eax, ebx, ecx, edx, or edi. |
| 561 bool HasValidEntryRegisters(); | 576 bool HasValidEntryRegisters(); |
| 562 #endif | 577 #endif |
| 563 | 578 |
| 564 bool is_eval_; // Tells whether code is generated for eval. | 579 bool is_eval_; // Tells whether code is generated for eval. |
| 565 | |
| 566 Handle<Script> script_; | 580 Handle<Script> script_; |
| 567 List<DeferredCode*> deferred_; | 581 List<DeferredCode*> deferred_; |
| 568 | 582 |
| 569 // Assembler | 583 // Assembler |
| 570 MacroAssembler* masm_; // to generate code | 584 MacroAssembler* masm_; // to generate code |
| 571 | 585 |
| 572 // Code generation state | 586 // Code generation state |
| 573 Scope* scope_; | 587 Scope* scope_; |
| 574 VirtualFrame* frame_; | 588 VirtualFrame* frame_; |
| 575 RegisterAllocator* allocator_; | 589 RegisterAllocator* allocator_; |
| (...skipping 20 matching lines...) Expand all Loading... |
| 596 friend class Reference; | 610 friend class Reference; |
| 597 friend class Result; | 611 friend class Result; |
| 598 | 612 |
| 599 DISALLOW_COPY_AND_ASSIGN(CodeGenerator); | 613 DISALLOW_COPY_AND_ASSIGN(CodeGenerator); |
| 600 }; | 614 }; |
| 601 | 615 |
| 602 | 616 |
| 603 } } // namespace v8::internal | 617 } } // namespace v8::internal |
| 604 | 618 |
| 605 #endif // V8_CODEGEN_IA32_H_ | 619 #endif // V8_CODEGEN_IA32_H_ |
| OLD | NEW |