OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 if (prop != NULL || (proxy != NULL && proxy->var()->IsUnallocated())) { | 225 if (prop != NULL || (proxy != NULL && proxy->var()->IsUnallocated())) { |
226 is_breakable_ = true; | 226 is_breakable_ = true; |
227 return; | 227 return; |
228 } | 228 } |
229 | 229 |
230 // Otherwise the assignment is breakable if the assigned value is. | 230 // Otherwise the assignment is breakable if the assigned value is. |
231 Visit(expr->value()); | 231 Visit(expr->value()); |
232 } | 232 } |
233 | 233 |
234 | 234 |
| 235 void BreakableStatementChecker::VisitYield(Yield* expr) { |
| 236 // Yield is breakable if the expression is. |
| 237 Visit(expr->expression()); |
| 238 } |
| 239 |
| 240 |
235 void BreakableStatementChecker::VisitThrow(Throw* expr) { | 241 void BreakableStatementChecker::VisitThrow(Throw* expr) { |
236 // Throw is breakable if the expression is. | 242 // Throw is breakable if the expression is. |
237 Visit(expr->exception()); | 243 Visit(expr->exception()); |
238 } | 244 } |
239 | 245 |
240 | 246 |
241 void BreakableStatementChecker::VisitProperty(Property* expr) { | 247 void BreakableStatementChecker::VisitProperty(Property* expr) { |
242 // Property load is breakable. | 248 // Property load is breakable. |
243 is_breakable_ = true; | 249 is_breakable_ = true; |
244 } | 250 } |
(...skipping 1286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1531 } | 1537 } |
1532 | 1538 |
1533 | 1539 |
1534 void FullCodeGenerator::VisitSharedFunctionInfoLiteral( | 1540 void FullCodeGenerator::VisitSharedFunctionInfoLiteral( |
1535 SharedFunctionInfoLiteral* expr) { | 1541 SharedFunctionInfoLiteral* expr) { |
1536 Comment cmnt(masm_, "[ SharedFunctionInfoLiteral"); | 1542 Comment cmnt(masm_, "[ SharedFunctionInfoLiteral"); |
1537 EmitNewClosure(expr->shared_function_info(), false); | 1543 EmitNewClosure(expr->shared_function_info(), false); |
1538 } | 1544 } |
1539 | 1545 |
1540 | 1546 |
| 1547 void FullCodeGenerator::VisitYield(Yield* expr) { |
| 1548 if (expr->is_delegating_yield()) |
| 1549 UNIMPLEMENTED(); |
| 1550 |
| 1551 Comment cmnt(masm_, "[ Yield"); |
| 1552 VisitForAccumulatorValue(expr->expression()); |
| 1553 // Unfortunately, it seems that the full-codegen doesn't maintain a stack |
| 1554 // depth counter. Otherwise we should assert that the operand stack depth |
| 1555 // is 0, at least while general yield expressions are unimplemented. |
| 1556 |
| 1557 // What follows is as in VisitReturnStatement. |
| 1558 NestedStatement* current = nesting_stack_; |
| 1559 int stack_depth = 0; |
| 1560 int context_length = 0; |
| 1561 while (current != NULL) { |
| 1562 current = current->Exit(&stack_depth, &context_length); |
| 1563 } |
| 1564 __ Drop(stack_depth); |
| 1565 EmitReturnSequence(); |
| 1566 } |
| 1567 |
| 1568 |
1541 void FullCodeGenerator::VisitThrow(Throw* expr) { | 1569 void FullCodeGenerator::VisitThrow(Throw* expr) { |
1542 Comment cmnt(masm_, "[ Throw"); | 1570 Comment cmnt(masm_, "[ Throw"); |
1543 VisitForStackValue(expr->exception()); | 1571 VisitForStackValue(expr->exception()); |
1544 __ CallRuntime(Runtime::kThrow, 1); | 1572 __ CallRuntime(Runtime::kThrow, 1); |
1545 // Never returns here. | 1573 // Never returns here. |
1546 } | 1574 } |
1547 | 1575 |
1548 | 1576 |
1549 FullCodeGenerator::NestedStatement* FullCodeGenerator::TryCatch::Exit( | 1577 FullCodeGenerator::NestedStatement* FullCodeGenerator::TryCatch::Exit( |
1550 int* stack_depth, | 1578 int* stack_depth, |
(...skipping 25 matching lines...) Expand all Loading... |
1576 } | 1604 } |
1577 | 1605 |
1578 return false; | 1606 return false; |
1579 } | 1607 } |
1580 | 1608 |
1581 | 1609 |
1582 #undef __ | 1610 #undef __ |
1583 | 1611 |
1584 | 1612 |
1585 } } // namespace v8::internal | 1613 } } // namespace v8::internal |
OLD | NEW |