OLD | NEW |
1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 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 1110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1121 | 1121 |
1122 | 1122 |
1123 void FullCodeGenerator::VisitConditional(Conditional* expr) { | 1123 void FullCodeGenerator::VisitConditional(Conditional* expr) { |
1124 Comment cmnt(masm_, "[ Conditional"); | 1124 Comment cmnt(masm_, "[ Conditional"); |
1125 Label true_case, false_case, done; | 1125 Label true_case, false_case, done; |
1126 VisitForControl(expr->condition(), &true_case, &false_case, &true_case); | 1126 VisitForControl(expr->condition(), &true_case, &false_case, &true_case); |
1127 | 1127 |
1128 __ bind(&true_case); | 1128 __ bind(&true_case); |
1129 SetExpressionPosition(expr->then_expression(), | 1129 SetExpressionPosition(expr->then_expression(), |
1130 expr->then_expression_position()); | 1130 expr->then_expression_position()); |
1131 Visit(expr->then_expression()); | 1131 if (context()->IsTest()) { |
1132 // If control flow falls through Visit, jump to done. | 1132 const TestContext* for_test = TestContext::cast(context()); |
1133 if (!context()->IsTest()) { | 1133 VisitForControl(expr->then_expression(), |
| 1134 for_test->true_label(), |
| 1135 for_test->false_label(), |
| 1136 NULL); |
| 1137 } else { |
| 1138 Visit(expr->then_expression()); |
1134 __ jmp(&done); | 1139 __ jmp(&done); |
1135 } | 1140 } |
1136 | 1141 |
1137 __ bind(&false_case); | 1142 __ bind(&false_case); |
1138 SetExpressionPosition(expr->else_expression(), | 1143 SetExpressionPosition(expr->else_expression(), |
1139 expr->else_expression_position()); | 1144 expr->else_expression_position()); |
1140 Visit(expr->else_expression()); | 1145 Visit(expr->else_expression()); |
1141 // If control flow falls through Visit, merge it with true case here. | 1146 // If control flow falls through Visit, merge it with true case here. |
1142 if (!context()->IsTest()) { | 1147 if (!context()->IsTest()) { |
1143 __ bind(&done); | 1148 __ bind(&done); |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1224 ASSERT(args->length() == 1); | 1229 ASSERT(args->length() == 1); |
1225 VisitForStackValue(args->at(0)); | 1230 VisitForStackValue(args->at(0)); |
1226 __ CallRuntime(Runtime::kRegExpCloneResult, 1); | 1231 __ CallRuntime(Runtime::kRegExpCloneResult, 1); |
1227 context()->Plug(result_register()); | 1232 context()->Plug(result_register()); |
1228 } | 1233 } |
1229 | 1234 |
1230 #undef __ | 1235 #undef __ |
1231 | 1236 |
1232 | 1237 |
1233 } } // namespace v8::internal | 1238 } } // namespace v8::internal |
OLD | NEW |