| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 virtual bool IsContinueTarget(Statement* target) { | 184 virtual bool IsContinueTarget(Statement* target) { |
| 185 return statement() == target; | 185 return statement() == target; |
| 186 } | 186 } |
| 187 | 187 |
| 188 Label* continue_label() { return &continue_label_; } | 188 Label* continue_label() { return &continue_label_; } |
| 189 | 189 |
| 190 private: | 190 private: |
| 191 Label continue_label_; | 191 Label continue_label_; |
| 192 }; | 192 }; |
| 193 | 193 |
| 194 // A nested block statement. |
| 195 class NestedBlock : public Breakable { |
| 196 public: |
| 197 NestedBlock(FullCodeGenerator* codegen, Block* block) |
| 198 : Breakable(codegen, block) { |
| 199 } |
| 200 virtual ~NestedBlock() {} |
| 201 |
| 202 virtual NestedStatement* Exit(int* stack_depth, int* context_length) { |
| 203 if (statement()->AsBlock()->block_scope() != NULL) { |
| 204 ++(*context_length); |
| 205 } |
| 206 return previous_; |
| 207 }; |
| 208 }; |
| 209 |
| 194 // The try block of a try/catch statement. | 210 // The try block of a try/catch statement. |
| 195 class TryCatch : public NestedStatement { | 211 class TryCatch : public NestedStatement { |
| 196 public: | 212 public: |
| 197 explicit TryCatch(FullCodeGenerator* codegen) : NestedStatement(codegen) { | 213 explicit TryCatch(FullCodeGenerator* codegen) : NestedStatement(codegen) { |
| 198 } | 214 } |
| 199 virtual ~TryCatch() {} | 215 virtual ~TryCatch() {} |
| 200 | 216 |
| 201 virtual NestedStatement* Exit(int* stack_depth, int* context_length); | 217 virtual NestedStatement* Exit(int* stack_depth, int* context_length); |
| 202 }; | 218 }; |
| 203 | 219 |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 281 // Type of a member function that generates inline code for a native function. | 297 // Type of a member function that generates inline code for a native function. |
| 282 typedef void (FullCodeGenerator::*InlineFunctionGenerator) | 298 typedef void (FullCodeGenerator::*InlineFunctionGenerator) |
| 283 (ZoneList<Expression*>*); | 299 (ZoneList<Expression*>*); |
| 284 | 300 |
| 285 static const InlineFunctionGenerator kInlineFunctionGenerators[]; | 301 static const InlineFunctionGenerator kInlineFunctionGenerators[]; |
| 286 | 302 |
| 287 // A platform-specific utility to overwrite the accumulator register | 303 // A platform-specific utility to overwrite the accumulator register |
| 288 // with a GC-safe value. | 304 // with a GC-safe value. |
| 289 void ClearAccumulator(); | 305 void ClearAccumulator(); |
| 290 | 306 |
| 291 // Compute the frame pointer relative offset for a given local or | |
| 292 // parameter slot. | |
| 293 int SlotOffset(Slot* slot); | |
| 294 | |
| 295 // Determine whether or not to inline the smi case for the given | 307 // Determine whether or not to inline the smi case for the given |
| 296 // operation. | 308 // operation. |
| 297 bool ShouldInlineSmiCase(Token::Value op); | 309 bool ShouldInlineSmiCase(Token::Value op); |
| 298 | 310 |
| 299 // Helper function to convert a pure value into a test context. The value | 311 // Helper function to convert a pure value into a test context. The value |
| 300 // is expected on the stack or the accumulator, depending on the platform. | 312 // is expected on the stack or the accumulator, depending on the platform. |
| 301 // See the platform-specific implementation for details. | 313 // See the platform-specific implementation for details. |
| 302 void DoTest(Expression* condition, | 314 void DoTest(Expression* condition, |
| 303 Label* if_true, | 315 Label* if_true, |
| 304 Label* if_false, | 316 Label* if_false, |
| 305 Label* fall_through); | 317 Label* fall_through); |
| 306 void DoTest(const TestContext* context); | 318 void DoTest(const TestContext* context); |
| 307 | 319 |
| 308 // Helper function to split control flow and avoid a branch to the | 320 // Helper function to split control flow and avoid a branch to the |
| 309 // fall-through label if it is set up. | 321 // fall-through label if it is set up. |
| 310 #ifdef V8_TARGET_ARCH_MIPS | 322 #ifdef V8_TARGET_ARCH_MIPS |
| 311 void Split(Condition cc, | 323 void Split(Condition cc, |
| 312 Register lhs, | 324 Register lhs, |
| 313 const Operand& rhs, | 325 const Operand& rhs, |
| 314 Label* if_true, | 326 Label* if_true, |
| 315 Label* if_false, | 327 Label* if_false, |
| 316 Label* fall_through); | 328 Label* fall_through); |
| 317 #else // All non-mips arch. | 329 #else // All non-mips arch. |
| 318 void Split(Condition cc, | 330 void Split(Condition cc, |
| 319 Label* if_true, | 331 Label* if_true, |
| 320 Label* if_false, | 332 Label* if_false, |
| 321 Label* fall_through); | 333 Label* fall_through); |
| 322 #endif // V8_TARGET_ARCH_MIPS | 334 #endif // V8_TARGET_ARCH_MIPS |
| 323 | 335 |
| 324 void Move(Slot* dst, Register source, Register scratch1, Register scratch2); | 336 // Load the value of a known (PARAMETER, LOCAL, or CONTEXT) variable into |
| 325 void Move(Register dst, Slot* source); | 337 // a register. Emits a context chain walk if if necessary (so does |
| 338 // SetVar) so avoid calling both on the same variable. |
| 339 void GetVar(Register destination, Variable* var); |
| 326 | 340 |
| 327 // Return an operand used to read/write to a known (ie, non-LOOKUP) slot. | 341 // Assign to a known (PARAMETER, LOCAL, or CONTEXT) variable. If it's in |
| 328 // May emit code to traverse the context chain, destroying the scratch | 342 // the context, the write barrier will be emitted and source, scratch0, |
| 329 // register. | 343 // scratch1 will be clobbered. Emits a context chain walk if if necessary |
| 330 MemOperand EmitSlotSearch(Slot* slot, Register scratch); | 344 // (so does GetVar) so avoid calling both on the same variable. |
| 345 void SetVar(Variable* var, |
| 346 Register source, |
| 347 Register scratch0, |
| 348 Register scratch1); |
| 349 |
| 350 // An operand used to read/write a stack-allocated (PARAMETER or LOCAL) |
| 351 // variable. Writing does not need the write barrier. |
| 352 MemOperand StackOperand(Variable* var); |
| 353 |
| 354 // An operand used to read/write a known (PARAMETER, LOCAL, or CONTEXT) |
| 355 // variable. May emit code to traverse the context chain, loading the |
| 356 // found context into the scratch register. Writing to this operand will |
| 357 // need the write barrier if location is CONTEXT. |
| 358 MemOperand VarOperand(Variable* var, Register scratch); |
| 331 | 359 |
| 332 // Forward the bailout responsibility for the given expression to | 360 // Forward the bailout responsibility for the given expression to |
| 333 // the next child visited (which must be in a test context). | 361 // the next child visited (which must be in a test context). |
| 334 void ForwardBailoutToChild(Expression* expr); | 362 void ForwardBailoutToChild(Expression* expr); |
| 335 | 363 |
| 336 void VisitForEffect(Expression* expr) { | 364 void VisitForEffect(Expression* expr) { |
| 337 EffectContext context(this); | 365 EffectContext context(this); |
| 338 VisitInCurrentContext(expr); | 366 VisitInCurrentContext(expr); |
| 339 } | 367 } |
| 340 | 368 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 351 void VisitForControl(Expression* expr, | 379 void VisitForControl(Expression* expr, |
| 352 Label* if_true, | 380 Label* if_true, |
| 353 Label* if_false, | 381 Label* if_false, |
| 354 Label* fall_through) { | 382 Label* fall_through) { |
| 355 TestContext context(this, expr, if_true, if_false, fall_through); | 383 TestContext context(this, expr, if_true, if_false, fall_through); |
| 356 VisitInCurrentContext(expr); | 384 VisitInCurrentContext(expr); |
| 357 } | 385 } |
| 358 | 386 |
| 359 void VisitDeclarations(ZoneList<Declaration*>* declarations); | 387 void VisitDeclarations(ZoneList<Declaration*>* declarations); |
| 360 void DeclareGlobals(Handle<FixedArray> pairs); | 388 void DeclareGlobals(Handle<FixedArray> pairs); |
| 389 int DeclareGlobalsFlags(); |
| 361 | 390 |
| 362 // Try to perform a comparison as a fast inlined literal compare if | 391 // Try to perform a comparison as a fast inlined literal compare if |
| 363 // the operands allow it. Returns true if the compare operations | 392 // the operands allow it. Returns true if the compare operations |
| 364 // has been matched and all code generated; false otherwise. | 393 // has been matched and all code generated; false otherwise. |
| 365 bool TryLiteralCompare(CompareOperation* compare, | 394 bool TryLiteralCompare(CompareOperation* compare, |
| 366 Label* if_true, | 395 Label* if_true, |
| 367 Label* if_false, | 396 Label* if_false, |
| 368 Label* fall_through); | 397 Label* fall_through); |
| 369 | 398 |
| 370 // Platform-specific code for comparing the type of a value with | 399 // Platform-specific code for comparing the type of a value with |
| (...skipping 24 matching lines...) Expand all Loading... |
| 395 // canonical JS true value so we will insert a (dead) test against true at | 424 // canonical JS true value so we will insert a (dead) test against true at |
| 396 // the actual bailout target from the optimized code. If not | 425 // the actual bailout target from the optimized code. If not |
| 397 // should_normalize, the true and false labels are ignored. | 426 // should_normalize, the true and false labels are ignored. |
| 398 void PrepareForBailoutBeforeSplit(State state, | 427 void PrepareForBailoutBeforeSplit(State state, |
| 399 bool should_normalize, | 428 bool should_normalize, |
| 400 Label* if_true, | 429 Label* if_true, |
| 401 Label* if_false); | 430 Label* if_false); |
| 402 | 431 |
| 403 // Platform-specific code for a variable, constant, or function | 432 // Platform-specific code for a variable, constant, or function |
| 404 // declaration. Functions have an initial value. | 433 // declaration. Functions have an initial value. |
| 405 void EmitDeclaration(Variable* variable, | 434 void EmitDeclaration(VariableProxy* proxy, |
| 406 Variable::Mode mode, | 435 Variable::Mode mode, |
| 407 FunctionLiteral* function); | 436 FunctionLiteral* function, |
| 437 int* global_count); |
| 408 | 438 |
| 409 // Platform-specific code for checking the stack limit at the back edge of | 439 // Platform-specific code for checking the stack limit at the back edge of |
| 410 // a loop. | 440 // a loop. |
| 411 void EmitStackCheck(IterationStatement* stmt); | 441 void EmitStackCheck(IterationStatement* stmt); |
| 412 // Record the OSR AST id corresponding to a stack check in the code. | 442 // Record the OSR AST id corresponding to a stack check in the code. |
| 413 void RecordStackCheck(int osr_ast_id); | 443 void RecordStackCheck(int osr_ast_id); |
| 414 // Emit a table of stack check ids and pcs into the code stream. Return | 444 // Emit a table of stack check ids and pcs into the code stream. Return |
| 415 // the offset of the start of the table. | 445 // the offset of the start of the table. |
| 416 unsigned EmitStackCheckTable(); | 446 unsigned EmitStackCheckTable(); |
| 417 | 447 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 428 | 458 |
| 429 void EmitInlineRuntimeCall(CallRuntime* expr); | 459 void EmitInlineRuntimeCall(CallRuntime* expr); |
| 430 | 460 |
| 431 #define EMIT_INLINE_RUNTIME_CALL(name, x, y) \ | 461 #define EMIT_INLINE_RUNTIME_CALL(name, x, y) \ |
| 432 void Emit##name(ZoneList<Expression*>* arguments); | 462 void Emit##name(ZoneList<Expression*>* arguments); |
| 433 INLINE_FUNCTION_LIST(EMIT_INLINE_RUNTIME_CALL) | 463 INLINE_FUNCTION_LIST(EMIT_INLINE_RUNTIME_CALL) |
| 434 INLINE_RUNTIME_FUNCTION_LIST(EMIT_INLINE_RUNTIME_CALL) | 464 INLINE_RUNTIME_FUNCTION_LIST(EMIT_INLINE_RUNTIME_CALL) |
| 435 #undef EMIT_INLINE_RUNTIME_CALL | 465 #undef EMIT_INLINE_RUNTIME_CALL |
| 436 | 466 |
| 437 // Platform-specific code for loading variables. | 467 // Platform-specific code for loading variables. |
| 438 void EmitLoadGlobalSlotCheckExtensions(Slot* slot, | 468 void EmitLoadGlobalCheckExtensions(Variable* var, |
| 439 TypeofState typeof_state, | 469 TypeofState typeof_state, |
| 440 Label* slow); | 470 Label* slow); |
| 441 MemOperand ContextSlotOperandCheckExtensions(Slot* slot, Label* slow); | 471 MemOperand ContextSlotOperandCheckExtensions(Variable* var, Label* slow); |
| 442 void EmitDynamicLoadFromSlotFastCase(Slot* slot, | 472 void EmitDynamicLookupFastCase(Variable* var, |
| 443 TypeofState typeof_state, | 473 TypeofState typeof_state, |
| 444 Label* slow, | 474 Label* slow, |
| 445 Label* done); | 475 Label* done); |
| 446 void EmitVariableLoad(VariableProxy* proxy); | 476 void EmitVariableLoad(VariableProxy* proxy); |
| 447 | 477 |
| 448 enum ResolveEvalFlag { | 478 enum ResolveEvalFlag { |
| 449 SKIP_CONTEXT_LOOKUP, | 479 SKIP_CONTEXT_LOOKUP, |
| 450 PERFORM_CONTEXT_LOOKUP | 480 PERFORM_CONTEXT_LOOKUP |
| 451 }; | 481 }; |
| 452 | 482 |
| 453 // Expects the arguments and the function already pushed. | 483 // Expects the arguments and the function already pushed. |
| 454 void EmitResolvePossiblyDirectEval(ResolveEvalFlag flag, int arg_count); | 484 void EmitResolvePossiblyDirectEval(ResolveEvalFlag flag, int arg_count); |
| 455 | 485 |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 548 #endif // V8_TARGET_ARCH_IA32 | 578 #endif // V8_TARGET_ARCH_IA32 |
| 549 | 579 |
| 550 MacroAssembler* masm() { return masm_; } | 580 MacroAssembler* masm() { return masm_; } |
| 551 | 581 |
| 552 class ExpressionContext; | 582 class ExpressionContext; |
| 553 const ExpressionContext* context() { return context_; } | 583 const ExpressionContext* context() { return context_; } |
| 554 void set_new_context(const ExpressionContext* context) { context_ = context; } | 584 void set_new_context(const ExpressionContext* context) { context_ = context; } |
| 555 | 585 |
| 556 Handle<Script> script() { return info_->script(); } | 586 Handle<Script> script() { return info_->script(); } |
| 557 bool is_eval() { return info_->is_eval(); } | 587 bool is_eval() { return info_->is_eval(); } |
| 588 bool is_native() { return info_->is_native(); } |
| 558 bool is_strict_mode() { return function()->strict_mode(); } | 589 bool is_strict_mode() { return function()->strict_mode(); } |
| 559 StrictModeFlag strict_mode_flag() { | 590 StrictModeFlag strict_mode_flag() { |
| 560 return is_strict_mode() ? kStrictMode : kNonStrictMode; | 591 return is_strict_mode() ? kStrictMode : kNonStrictMode; |
| 561 } | 592 } |
| 562 FunctionLiteral* function() { return info_->function(); } | 593 FunctionLiteral* function() { return info_->function(); } |
| 563 Scope* scope() { return scope_; } | 594 Scope* scope() { return scope_; } |
| 564 | 595 |
| 565 static Register result_register(); | 596 static Register result_register(); |
| 566 static Register context_register(); | 597 static Register context_register(); |
| 567 | 598 |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 611 codegen()->verify_stack_height(); | 642 codegen()->verify_stack_height(); |
| 612 } | 643 } |
| 613 } | 644 } |
| 614 | 645 |
| 615 Isolate* isolate() const { return codegen_->isolate(); } | 646 Isolate* isolate() const { return codegen_->isolate(); } |
| 616 | 647 |
| 617 // Convert constant control flow (true or false) to the result expected for | 648 // Convert constant control flow (true or false) to the result expected for |
| 618 // this expression context. | 649 // this expression context. |
| 619 virtual void Plug(bool flag) const = 0; | 650 virtual void Plug(bool flag) const = 0; |
| 620 | 651 |
| 621 // Emit code to convert a pure value (in a register, slot, as a literal, | 652 // Emit code to convert a pure value (in a register, known variable |
| 622 // or on top of the stack) into the result expected according to this | 653 // location, as a literal, or on top of the stack) into the result |
| 623 // expression context. | 654 // expected according to this expression context. |
| 624 virtual void Plug(Register reg) const = 0; | 655 virtual void Plug(Register reg) const = 0; |
| 625 virtual void Plug(Slot* slot) const = 0; | 656 virtual void Plug(Variable* var) const = 0; |
| 626 virtual void Plug(Handle<Object> lit) const = 0; | 657 virtual void Plug(Handle<Object> lit) const = 0; |
| 627 virtual void Plug(Heap::RootListIndex index) const = 0; | 658 virtual void Plug(Heap::RootListIndex index) const = 0; |
| 628 virtual void PlugTOS() const = 0; | 659 virtual void PlugTOS() const = 0; |
| 629 | 660 |
| 630 // Emit code to convert pure control flow to a pair of unbound labels into | 661 // Emit code to convert pure control flow to a pair of unbound labels into |
| 631 // the result expected according to this expression context. The | 662 // the result expected according to this expression context. The |
| 632 // implementation will bind both labels unless it's a TestContext, which | 663 // implementation will bind both labels unless it's a TestContext, which |
| 633 // won't bind them at this point. | 664 // won't bind them at this point. |
| 634 virtual void Plug(Label* materialize_true, | 665 virtual void Plug(Label* materialize_true, |
| 635 Label* materialize_false) const = 0; | 666 Label* materialize_false) const = 0; |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 673 class AccumulatorValueContext : public ExpressionContext { | 704 class AccumulatorValueContext : public ExpressionContext { |
| 674 public: | 705 public: |
| 675 explicit AccumulatorValueContext(FullCodeGenerator* codegen) | 706 explicit AccumulatorValueContext(FullCodeGenerator* codegen) |
| 676 : ExpressionContext(codegen) { | 707 : ExpressionContext(codegen) { |
| 677 expected_stack_height_ = codegen->stack_height(); | 708 expected_stack_height_ = codegen->stack_height(); |
| 678 } | 709 } |
| 679 | 710 |
| 680 virtual void Plug(bool flag) const; | 711 virtual void Plug(bool flag) const; |
| 681 virtual void Plug(Register reg) const; | 712 virtual void Plug(Register reg) const; |
| 682 virtual void Plug(Label* materialize_true, Label* materialize_false) const; | 713 virtual void Plug(Label* materialize_true, Label* materialize_false) const; |
| 683 virtual void Plug(Slot* slot) const; | 714 virtual void Plug(Variable* var) const; |
| 684 virtual void Plug(Handle<Object> lit) const; | 715 virtual void Plug(Handle<Object> lit) const; |
| 685 virtual void Plug(Heap::RootListIndex) const; | 716 virtual void Plug(Heap::RootListIndex) const; |
| 686 virtual void PlugTOS() const; | 717 virtual void PlugTOS() const; |
| 687 virtual void DropAndPlug(int count, Register reg) const; | 718 virtual void DropAndPlug(int count, Register reg) const; |
| 688 virtual void PrepareTest(Label* materialize_true, | 719 virtual void PrepareTest(Label* materialize_true, |
| 689 Label* materialize_false, | 720 Label* materialize_false, |
| 690 Label** if_true, | 721 Label** if_true, |
| 691 Label** if_false, | 722 Label** if_false, |
| 692 Label** fall_through) const; | 723 Label** fall_through) const; |
| 693 virtual bool IsAccumulatorValue() const { return true; } | 724 virtual bool IsAccumulatorValue() const { return true; } |
| 694 }; | 725 }; |
| 695 | 726 |
| 696 class StackValueContext : public ExpressionContext { | 727 class StackValueContext : public ExpressionContext { |
| 697 public: | 728 public: |
| 698 explicit StackValueContext(FullCodeGenerator* codegen) | 729 explicit StackValueContext(FullCodeGenerator* codegen) |
| 699 : ExpressionContext(codegen) { | 730 : ExpressionContext(codegen) { |
| 700 expected_stack_height_ = codegen->stack_height() + 1; | 731 expected_stack_height_ = codegen->stack_height() + 1; |
| 701 } | 732 } |
| 702 | 733 |
| 703 virtual void Plug(bool flag) const; | 734 virtual void Plug(bool flag) const; |
| 704 virtual void Plug(Register reg) const; | 735 virtual void Plug(Register reg) const; |
| 705 virtual void Plug(Label* materialize_true, Label* materialize_false) const; | 736 virtual void Plug(Label* materialize_true, Label* materialize_false) const; |
| 706 virtual void Plug(Slot* slot) const; | 737 virtual void Plug(Variable* var) const; |
| 707 virtual void Plug(Handle<Object> lit) const; | 738 virtual void Plug(Handle<Object> lit) const; |
| 708 virtual void Plug(Heap::RootListIndex) const; | 739 virtual void Plug(Heap::RootListIndex) const; |
| 709 virtual void PlugTOS() const; | 740 virtual void PlugTOS() const; |
| 710 virtual void DropAndPlug(int count, Register reg) const; | 741 virtual void DropAndPlug(int count, Register reg) const; |
| 711 virtual void PrepareTest(Label* materialize_true, | 742 virtual void PrepareTest(Label* materialize_true, |
| 712 Label* materialize_false, | 743 Label* materialize_false, |
| 713 Label** if_true, | 744 Label** if_true, |
| 714 Label** if_false, | 745 Label** if_false, |
| 715 Label** fall_through) const; | 746 Label** fall_through) const; |
| 716 virtual bool IsStackValue() const { return true; } | 747 virtual bool IsStackValue() const { return true; } |
| (...skipping 20 matching lines...) Expand all Loading... |
| 737 } | 768 } |
| 738 | 769 |
| 739 Expression* condition() const { return condition_; } | 770 Expression* condition() const { return condition_; } |
| 740 Label* true_label() const { return true_label_; } | 771 Label* true_label() const { return true_label_; } |
| 741 Label* false_label() const { return false_label_; } | 772 Label* false_label() const { return false_label_; } |
| 742 Label* fall_through() const { return fall_through_; } | 773 Label* fall_through() const { return fall_through_; } |
| 743 | 774 |
| 744 virtual void Plug(bool flag) const; | 775 virtual void Plug(bool flag) const; |
| 745 virtual void Plug(Register reg) const; | 776 virtual void Plug(Register reg) const; |
| 746 virtual void Plug(Label* materialize_true, Label* materialize_false) const; | 777 virtual void Plug(Label* materialize_true, Label* materialize_false) const; |
| 747 virtual void Plug(Slot* slot) const; | 778 virtual void Plug(Variable* var) const; |
| 748 virtual void Plug(Handle<Object> lit) const; | 779 virtual void Plug(Handle<Object> lit) const; |
| 749 virtual void Plug(Heap::RootListIndex) const; | 780 virtual void Plug(Heap::RootListIndex) const; |
| 750 virtual void PlugTOS() const; | 781 virtual void PlugTOS() const; |
| 751 virtual void DropAndPlug(int count, Register reg) const; | 782 virtual void DropAndPlug(int count, Register reg) const; |
| 752 virtual void PrepareTest(Label* materialize_true, | 783 virtual void PrepareTest(Label* materialize_true, |
| 753 Label* materialize_false, | 784 Label* materialize_false, |
| 754 Label** if_true, | 785 Label** if_true, |
| 755 Label** if_false, | 786 Label** if_false, |
| 756 Label** fall_through) const; | 787 Label** fall_through) const; |
| 757 virtual bool IsTest() const { return true; } | 788 virtual bool IsTest() const { return true; } |
| 758 | 789 |
| 759 private: | 790 private: |
| 760 Expression* condition_; | 791 Expression* condition_; |
| 761 Label* true_label_; | 792 Label* true_label_; |
| 762 Label* false_label_; | 793 Label* false_label_; |
| 763 Label* fall_through_; | 794 Label* fall_through_; |
| 764 }; | 795 }; |
| 765 | 796 |
| 766 class EffectContext : public ExpressionContext { | 797 class EffectContext : public ExpressionContext { |
| 767 public: | 798 public: |
| 768 explicit EffectContext(FullCodeGenerator* codegen) | 799 explicit EffectContext(FullCodeGenerator* codegen) |
| 769 : ExpressionContext(codegen) { | 800 : ExpressionContext(codegen) { |
| 770 expected_stack_height_ = codegen->stack_height(); | 801 expected_stack_height_ = codegen->stack_height(); |
| 771 } | 802 } |
| 772 | 803 |
| 773 | 804 |
| 774 virtual void Plug(bool flag) const; | 805 virtual void Plug(bool flag) const; |
| 775 virtual void Plug(Register reg) const; | 806 virtual void Plug(Register reg) const; |
| 776 virtual void Plug(Label* materialize_true, Label* materialize_false) const; | 807 virtual void Plug(Label* materialize_true, Label* materialize_false) const; |
| 777 virtual void Plug(Slot* slot) const; | 808 virtual void Plug(Variable* var) const; |
| 778 virtual void Plug(Handle<Object> lit) const; | 809 virtual void Plug(Handle<Object> lit) const; |
| 779 virtual void Plug(Heap::RootListIndex) const; | 810 virtual void Plug(Heap::RootListIndex) const; |
| 780 virtual void PlugTOS() const; | 811 virtual void PlugTOS() const; |
| 781 virtual void DropAndPlug(int count, Register reg) const; | 812 virtual void DropAndPlug(int count, Register reg) const; |
| 782 virtual void PrepareTest(Label* materialize_true, | 813 virtual void PrepareTest(Label* materialize_true, |
| 783 Label* materialize_false, | 814 Label* materialize_false, |
| 784 Label** if_true, | 815 Label** if_true, |
| 785 Label** if_false, | 816 Label** if_false, |
| 786 Label** fall_through) const; | 817 Label** fall_through) const; |
| 787 virtual bool IsEffect() const { return true; } | 818 virtual bool IsEffect() const { return true; } |
| (...skipping 14 matching lines...) Expand all Loading... |
| 802 | 833 |
| 803 friend class NestedStatement; | 834 friend class NestedStatement; |
| 804 | 835 |
| 805 DISALLOW_COPY_AND_ASSIGN(FullCodeGenerator); | 836 DISALLOW_COPY_AND_ASSIGN(FullCodeGenerator); |
| 806 }; | 837 }; |
| 807 | 838 |
| 808 | 839 |
| 809 } } // namespace v8::internal | 840 } } // namespace v8::internal |
| 810 | 841 |
| 811 #endif // V8_FULL_CODEGEN_H_ | 842 #endif // V8_FULL_CODEGEN_H_ |
| OLD | NEW |