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

Side by Side Diff: src/parser.cc

Issue 14582007: Implement yield* (delegating yield) (Closed) Base URL: git://github.com/v8/v8.git@master
Patch Set: Fix asm nits; rework test suite to test yield* on everything Created 7 years, 7 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/ia32/full-codegen-ia32.cc ('k') | src/v8natives.js » ('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 3095 matching lines...) Expand 10 before | Expand all | Expand 10 after
3106 Expression* Parser::ParseYieldExpression(bool* ok) { 3106 Expression* Parser::ParseYieldExpression(bool* ok) {
3107 // YieldExpression :: 3107 // YieldExpression ::
3108 // 'yield' '*'? AssignmentExpression 3108 // 'yield' '*'? AssignmentExpression
3109 int position = scanner().peek_location().beg_pos; 3109 int position = scanner().peek_location().beg_pos;
3110 Expect(Token::YIELD, CHECK_OK); 3110 Expect(Token::YIELD, CHECK_OK);
3111 Yield::Kind kind = 3111 Yield::Kind kind =
3112 Check(Token::MUL) ? Yield::DELEGATING : Yield::SUSPEND; 3112 Check(Token::MUL) ? Yield::DELEGATING : Yield::SUSPEND;
3113 Expression* generator_object = factory()->NewVariableProxy( 3113 Expression* generator_object = factory()->NewVariableProxy(
3114 current_function_state_->generator_object_variable()); 3114 current_function_state_->generator_object_variable());
3115 Expression* expression = ParseAssignmentExpression(false, CHECK_OK); 3115 Expression* expression = ParseAssignmentExpression(false, CHECK_OK);
3116 return factory()->NewYield(generator_object, expression, kind, position); 3116 Yield* yield =
3117 factory()->NewYield(generator_object, expression, kind, position);
3118 if (kind == Yield::DELEGATING) {
3119 yield->set_index(current_function_state_->NextHandlerIndex());
3120 }
3121 return yield;
3117 } 3122 }
3118 3123
3119 3124
3120 // Precedence = 3 3125 // Precedence = 3
3121 Expression* Parser::ParseConditionalExpression(bool accept_IN, bool* ok) { 3126 Expression* Parser::ParseConditionalExpression(bool accept_IN, bool* ok) {
3122 // ConditionalExpression :: 3127 // ConditionalExpression ::
3123 // LogicalOrExpression 3128 // LogicalOrExpression
3124 // LogicalOrExpression '?' AssignmentExpression ':' AssignmentExpression 3129 // LogicalOrExpression '?' AssignmentExpression ':' AssignmentExpression
3125 3130
3126 // We start using the binary expression parser for prec >= 4 only! 3131 // We start using the binary expression parser for prec >= 4 only!
(...skipping 2909 matching lines...) Expand 10 before | Expand all | Expand 10 after
6036 ASSERT(info()->isolate()->has_pending_exception()); 6041 ASSERT(info()->isolate()->has_pending_exception());
6037 } else { 6042 } else {
6038 result = ParseProgram(); 6043 result = ParseProgram();
6039 } 6044 }
6040 } 6045 }
6041 info()->SetFunction(result); 6046 info()->SetFunction(result);
6042 return (result != NULL); 6047 return (result != NULL);
6043 } 6048 }
6044 6049
6045 } } // namespace v8::internal 6050 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/ia32/full-codegen-ia32.cc ('k') | src/v8natives.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698