Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(294)

Side by Side Diff: src/full-codegen.cc

Issue 13704010: Generator objects can suspend (Closed) Base URL: git://github.com/v8/v8.git@master
Patch Set: Use sentinel values for continuations Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/ast.h ('k') | src/ia32/full-codegen-ia32.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1530 matching lines...) Expand 10 before | Expand all | Expand 10 after
1541 } 1541 }
1542 1542
1543 1543
1544 void FullCodeGenerator::VisitSharedFunctionInfoLiteral( 1544 void FullCodeGenerator::VisitSharedFunctionInfoLiteral(
1545 SharedFunctionInfoLiteral* expr) { 1545 SharedFunctionInfoLiteral* expr) {
1546 Comment cmnt(masm_, "[ SharedFunctionInfoLiteral"); 1546 Comment cmnt(masm_, "[ SharedFunctionInfoLiteral");
1547 EmitNewClosure(expr->shared_function_info(), false); 1547 EmitNewClosure(expr->shared_function_info(), false);
1548 } 1548 }
1549 1549
1550 1550
1551 void FullCodeGenerator::VisitYield(Yield* expr) {
1552 if (expr->is_delegating_yield())
1553 UNIMPLEMENTED();
1554
1555 Comment cmnt(masm_, "[ Yield");
1556 // TODO(wingo): Actually update the iterator state.
1557 VisitForEffect(expr->generator_object());
1558 VisitForAccumulatorValue(expr->expression());
1559 // TODO(wingo): Assert that the operand stack depth is 0, at least while
1560 // general yield expressions are unimplemented.
1561
1562 // TODO(wingo): What follows is as in VisitReturnStatement. Replace it with a
1563 // call to a builtin that will resume the generator.
1564 NestedStatement* current = nesting_stack_;
1565 int stack_depth = 0;
1566 int context_length = 0;
1567 while (current != NULL) {
1568 current = current->Exit(&stack_depth, &context_length);
1569 }
1570 __ Drop(stack_depth);
1571 EmitReturnSequence();
1572 }
1573
1574
1575 void FullCodeGenerator::VisitThrow(Throw* expr) { 1551 void FullCodeGenerator::VisitThrow(Throw* expr) {
1576 Comment cmnt(masm_, "[ Throw"); 1552 Comment cmnt(masm_, "[ Throw");
1577 VisitForStackValue(expr->exception()); 1553 VisitForStackValue(expr->exception());
1578 __ CallRuntime(Runtime::kThrow, 1); 1554 __ CallRuntime(Runtime::kThrow, 1);
1579 // Never returns here. 1555 // Never returns here.
1580 } 1556 }
1581 1557
1582 1558
1583 FullCodeGenerator::NestedStatement* FullCodeGenerator::TryCatch::Exit( 1559 FullCodeGenerator::NestedStatement* FullCodeGenerator::TryCatch::Exit(
1584 int* stack_depth, 1560 int* stack_depth,
(...skipping 25 matching lines...) Expand all
1610 } 1586 }
1611 1587
1612 return false; 1588 return false;
1613 } 1589 }
1614 1590
1615 1591
1616 #undef __ 1592 #undef __
1617 1593
1618 1594
1619 } } // namespace v8::internal 1595 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/ast.h ('k') | src/ia32/full-codegen-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698