OLD | NEW |
1 // Copyright 2009 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 |
11 // with the distribution. | 11 // with the distribution. |
(...skipping 741 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
753 Comment cmnt(masm_, "[ WithExitStatement"); | 753 Comment cmnt(masm_, "[ WithExitStatement"); |
754 SetStatementPosition(stmt); | 754 SetStatementPosition(stmt); |
755 | 755 |
756 // Pop context. | 756 // Pop context. |
757 LoadContextField(context_register(), Context::PREVIOUS_INDEX); | 757 LoadContextField(context_register(), Context::PREVIOUS_INDEX); |
758 // Update local stack frame context field. | 758 // Update local stack frame context field. |
759 StoreToFrameField(StandardFrameConstants::kContextOffset, context_register()); | 759 StoreToFrameField(StandardFrameConstants::kContextOffset, context_register()); |
760 } | 760 } |
761 | 761 |
762 | 762 |
763 void FullCodeGenerator::VisitSwitchStatement(SwitchStatement* stmt) { | |
764 UNREACHABLE(); | |
765 } | |
766 | |
767 | |
768 void FullCodeGenerator::VisitDoWhileStatement(DoWhileStatement* stmt) { | 763 void FullCodeGenerator::VisitDoWhileStatement(DoWhileStatement* stmt) { |
769 Comment cmnt(masm_, "[ DoWhileStatement"); | 764 Comment cmnt(masm_, "[ DoWhileStatement"); |
770 SetStatementPosition(stmt); | 765 SetStatementPosition(stmt); |
771 Label body, stack_limit_hit, stack_check_success; | 766 Label body, stack_limit_hit, stack_check_success; |
772 | 767 |
773 Iteration loop_statement(this, stmt); | 768 Iteration loop_statement(this, stmt); |
774 increment_loop_depth(); | 769 increment_loop_depth(); |
775 | 770 |
776 __ bind(&body); | 771 __ bind(&body); |
777 Visit(stmt->body()); | 772 Visit(stmt->body()); |
(...skipping 25 matching lines...) Expand all Loading... |
803 Iteration loop_statement(this, stmt); | 798 Iteration loop_statement(this, stmt); |
804 increment_loop_depth(); | 799 increment_loop_depth(); |
805 | 800 |
806 // Emit the test at the bottom of the loop. | 801 // Emit the test at the bottom of the loop. |
807 __ jmp(loop_statement.continue_target()); | 802 __ jmp(loop_statement.continue_target()); |
808 | 803 |
809 __ bind(&body); | 804 __ bind(&body); |
810 Visit(stmt->body()); | 805 Visit(stmt->body()); |
811 | 806 |
812 __ bind(loop_statement.continue_target()); | 807 __ bind(loop_statement.continue_target()); |
| 808 |
813 // Check stack before looping. | 809 // Check stack before looping. |
814 __ StackLimitCheck(&stack_limit_hit); | 810 __ StackLimitCheck(&stack_limit_hit); |
815 __ bind(&stack_check_success); | 811 __ bind(&stack_check_success); |
816 | 812 |
817 VisitForControl(stmt->cond(), &body, loop_statement.break_target()); | 813 VisitForControl(stmt->cond(), &body, loop_statement.break_target()); |
818 | 814 |
819 __ bind(&stack_limit_hit); | 815 __ bind(&stack_limit_hit); |
820 StackCheckStub stack_stub; | 816 StackCheckStub stack_stub; |
821 __ CallStub(&stack_stub); | 817 __ CallStub(&stack_stub); |
822 __ jmp(&stack_check_success); | 818 __ jmp(&stack_check_success); |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
865 __ bind(&stack_limit_hit); | 861 __ bind(&stack_limit_hit); |
866 StackCheckStub stack_stub; | 862 StackCheckStub stack_stub; |
867 __ CallStub(&stack_stub); | 863 __ CallStub(&stack_stub); |
868 __ jmp(&stack_check_success); | 864 __ jmp(&stack_check_success); |
869 | 865 |
870 __ bind(loop_statement.break_target()); | 866 __ bind(loop_statement.break_target()); |
871 decrement_loop_depth(); | 867 decrement_loop_depth(); |
872 } | 868 } |
873 | 869 |
874 | 870 |
875 void FullCodeGenerator::VisitForInStatement(ForInStatement* stmt) { | |
876 UNREACHABLE(); | |
877 } | |
878 | |
879 | |
880 void FullCodeGenerator::VisitTryCatchStatement(TryCatchStatement* stmt) { | 871 void FullCodeGenerator::VisitTryCatchStatement(TryCatchStatement* stmt) { |
881 Comment cmnt(masm_, "[ TryCatchStatement"); | 872 Comment cmnt(masm_, "[ TryCatchStatement"); |
882 SetStatementPosition(stmt); | 873 SetStatementPosition(stmt); |
883 // The try block adds a handler to the exception handler chain | 874 // The try block adds a handler to the exception handler chain |
884 // before entering, and removes it again when exiting normally. | 875 // before entering, and removes it again when exiting normally. |
885 // If an exception is thrown during execution of the try block, | 876 // If an exception is thrown during execution of the try block, |
886 // control is passed to the handler, which also consumes the handler. | 877 // control is passed to the handler, which also consumes the handler. |
887 // At this point, the exception is in a register, and store it in | 878 // At this point, the exception is in a register, and store it in |
888 // the temporary local variable (prints as ".catch-var") before | 879 // the temporary local variable (prints as ".catch-var") before |
889 // executing the catch block. The catch block has been rewritten | 880 // executing the catch block. The catch block has been rewritten |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
988 #ifdef ENABLE_DEBUGGER_SUPPORT | 979 #ifdef ENABLE_DEBUGGER_SUPPORT |
989 Comment cmnt(masm_, "[ DebuggerStatement"); | 980 Comment cmnt(masm_, "[ DebuggerStatement"); |
990 SetStatementPosition(stmt); | 981 SetStatementPosition(stmt); |
991 | 982 |
992 __ DebugBreak(); | 983 __ DebugBreak(); |
993 // Ignore the return value. | 984 // Ignore the return value. |
994 #endif | 985 #endif |
995 } | 986 } |
996 | 987 |
997 | 988 |
998 void FullCodeGenerator::VisitSharedFunctionInfoLiteral( | |
999 SharedFunctionInfoLiteral* expr) { | |
1000 UNREACHABLE(); | |
1001 } | |
1002 | |
1003 | |
1004 void FullCodeGenerator::VisitConditional(Conditional* expr) { | 989 void FullCodeGenerator::VisitConditional(Conditional* expr) { |
1005 Comment cmnt(masm_, "[ Conditional"); | 990 Comment cmnt(masm_, "[ Conditional"); |
1006 Label true_case, false_case, done; | 991 Label true_case, false_case, done; |
1007 VisitForControl(expr->condition(), &true_case, &false_case); | 992 VisitForControl(expr->condition(), &true_case, &false_case); |
1008 | 993 |
1009 __ bind(&true_case); | 994 __ bind(&true_case); |
1010 Visit(expr->then_expression()); | 995 Visit(expr->then_expression()); |
1011 // If control flow falls through Visit, jump to done. | 996 // If control flow falls through Visit, jump to done. |
1012 if (context_ == Expression::kEffect || context_ == Expression::kValue) { | 997 if (context_ == Expression::kEffect || context_ == Expression::kValue) { |
1013 __ jmp(&done); | 998 __ jmp(&done); |
(...skipping 13 matching lines...) Expand all Loading... |
1027 UNREACHABLE(); | 1012 UNREACHABLE(); |
1028 } | 1013 } |
1029 | 1014 |
1030 | 1015 |
1031 void FullCodeGenerator::VisitLiteral(Literal* expr) { | 1016 void FullCodeGenerator::VisitLiteral(Literal* expr) { |
1032 Comment cmnt(masm_, "[ Literal"); | 1017 Comment cmnt(masm_, "[ Literal"); |
1033 Apply(context_, expr); | 1018 Apply(context_, expr); |
1034 } | 1019 } |
1035 | 1020 |
1036 | 1021 |
| 1022 void FullCodeGenerator::VisitFunctionLiteral(FunctionLiteral* expr) { |
| 1023 Comment cmnt(masm_, "[ FunctionLiteral"); |
| 1024 |
| 1025 // Build the function boilerplate and instantiate it. |
| 1026 Handle<SharedFunctionInfo> function_info = |
| 1027 Compiler::BuildFunctionInfo(expr, script(), this); |
| 1028 if (HasStackOverflow()) return; |
| 1029 EmitNewClosure(function_info); |
| 1030 } |
| 1031 |
| 1032 |
| 1033 void FullCodeGenerator::VisitSharedFunctionInfoLiteral( |
| 1034 SharedFunctionInfoLiteral* expr) { |
| 1035 Comment cmnt(masm_, "[ SharedFunctionInfoLiteral"); |
| 1036 EmitNewClosure(expr->shared_function_info()); |
| 1037 } |
| 1038 |
| 1039 |
1037 void FullCodeGenerator::VisitCatchExtensionObject(CatchExtensionObject* expr) { | 1040 void FullCodeGenerator::VisitCatchExtensionObject(CatchExtensionObject* expr) { |
1038 // Call runtime routine to allocate the catch extension object and | 1041 // Call runtime routine to allocate the catch extension object and |
1039 // assign the exception value to the catch variable. | 1042 // assign the exception value to the catch variable. |
1040 Comment cmnt(masm_, "[ CatchExtensionObject"); | 1043 Comment cmnt(masm_, "[ CatchExtensionObject"); |
1041 VisitForValue(expr->key(), kStack); | 1044 VisitForValue(expr->key(), kStack); |
1042 VisitForValue(expr->value(), kStack); | 1045 VisitForValue(expr->value(), kStack); |
1043 // Create catch extension object. | 1046 // Create catch extension object. |
1044 __ CallRuntime(Runtime::kCreateCatchExtensionObject, 2); | 1047 __ CallRuntime(Runtime::kCreateCatchExtensionObject, 2); |
1045 Apply(context_, result_register()); | 1048 Apply(context_, result_register()); |
1046 } | 1049 } |
(...skipping 20 matching lines...) Expand all Loading... |
1067 // The macros used here must preserve the result register. | 1070 // The macros used here must preserve the result register. |
1068 __ Drop(stack_depth); | 1071 __ Drop(stack_depth); |
1069 __ PopTryHandler(); | 1072 __ PopTryHandler(); |
1070 return 0; | 1073 return 0; |
1071 } | 1074 } |
1072 | 1075 |
1073 #undef __ | 1076 #undef __ |
1074 | 1077 |
1075 | 1078 |
1076 } } // namespace v8::internal | 1079 } } // namespace v8::internal |
OLD | NEW |