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

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

Issue 12646003: Add parser support for generators. (Closed) Base URL: git://github.com/v8/v8.git@bleeding_edge
Patch Set: Fix bad initialization list in last preparser commit 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
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 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 1285 matching lines...) Expand 10 before | Expand all | Expand 10 after
1530 } 1536 }
1531 1537
1532 1538
1533 void FullCodeGenerator::VisitSharedFunctionInfoLiteral( 1539 void FullCodeGenerator::VisitSharedFunctionInfoLiteral(
1534 SharedFunctionInfoLiteral* expr) { 1540 SharedFunctionInfoLiteral* expr) {
1535 Comment cmnt(masm_, "[ SharedFunctionInfoLiteral"); 1541 Comment cmnt(masm_, "[ SharedFunctionInfoLiteral");
1536 EmitNewClosure(expr->shared_function_info(), false); 1542 EmitNewClosure(expr->shared_function_info(), false);
1537 } 1543 }
1538 1544
1539 1545
1546 void FullCodeGenerator::VisitYield(Yield* expr) {
1547 if (expr->is_delegating_yield())
1548 UNIMPLEMENTED();
1549
1550 Comment cmnt(masm_, "[ Yield");
1551 VisitForAccumulatorValue(expr->expression());
1552 // TODO(wingo): Assert that the operand stack depth is 0, at least while
1553 // general yield expressions are unimplemented.
1554
1555 // TODO(wingo): What follows is as in VisitReturnStatement. Replace it with a
1556 // call to a builtin that will resume the generator.
1557 NestedStatement* current = nesting_stack_;
1558 int stack_depth = 0;
1559 int context_length = 0;
1560 while (current != NULL) {
1561 current = current->Exit(&stack_depth, &context_length);
1562 }
1563 __ Drop(stack_depth);
1564 EmitReturnSequence();
1565 }
1566
1567
1540 void FullCodeGenerator::VisitThrow(Throw* expr) { 1568 void FullCodeGenerator::VisitThrow(Throw* expr) {
1541 Comment cmnt(masm_, "[ Throw"); 1569 Comment cmnt(masm_, "[ Throw");
1542 VisitForStackValue(expr->exception()); 1570 VisitForStackValue(expr->exception());
1543 __ CallRuntime(Runtime::kThrow, 1); 1571 __ CallRuntime(Runtime::kThrow, 1);
1544 // Never returns here. 1572 // Never returns here.
1545 } 1573 }
1546 1574
1547 1575
1548 FullCodeGenerator::NestedStatement* FullCodeGenerator::TryCatch::Exit( 1576 FullCodeGenerator::NestedStatement* FullCodeGenerator::TryCatch::Exit(
1549 int* stack_depth, 1577 int* stack_depth,
(...skipping 25 matching lines...) Expand all
1575 } 1603 }
1576 1604
1577 return false; 1605 return false;
1578 } 1606 }
1579 1607
1580 1608
1581 #undef __ 1609 #undef __
1582 1610
1583 1611
1584 } } // namespace v8::internal 1612 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698