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

Side by Side Diff: src/parser.cc

Issue 15740007: Add for-of Crankshaft support Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebase onto master; fix AstTyper for ForOfStatement Created 7 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « src/ia32/full-codegen-ia32.cc ('k') | src/typing.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 2656 matching lines...) Expand 10 before | Expand all | Expand 10 after
2667 // var result = iterator.next(); 2667 // var result = iterator.next();
2668 { 2668 {
2669 Expression* iterator_proxy = factory()->NewVariableProxy(iterator); 2669 Expression* iterator_proxy = factory()->NewVariableProxy(iterator);
2670 Expression* next_literal = 2670 Expression* next_literal =
2671 factory()->NewLiteral(heap_factory->next_string()); 2671 factory()->NewLiteral(heap_factory->next_string());
2672 Expression* next_property = factory()->NewProperty( 2672 Expression* next_property = factory()->NewProperty(
2673 iterator_proxy, next_literal, RelocInfo::kNoPosition); 2673 iterator_proxy, next_literal, RelocInfo::kNoPosition);
2674 ZoneList<Expression*>* next_arguments = 2674 ZoneList<Expression*>* next_arguments =
2675 new(zone()) ZoneList<Expression*>(0, zone()); 2675 new(zone()) ZoneList<Expression*>(0, zone());
2676 Expression* next_call = factory()->NewCall( 2676 Expression* next_call = factory()->NewCall(
2677 next_property, next_arguments, RelocInfo::kNoPosition); 2677 next_property, next_arguments, top_scope_->start_position());
2678 Expression* result_proxy = factory()->NewVariableProxy(result); 2678 Expression* result_proxy = factory()->NewVariableProxy(result);
2679 next_result = factory()->NewAssignment( 2679 next_result = factory()->NewAssignment(
2680 Token::ASSIGN, result_proxy, next_call, RelocInfo::kNoPosition); 2680 Token::ASSIGN, result_proxy, next_call, RelocInfo::kNoPosition);
2681 } 2681 }
2682 2682
2683 // result.done 2683 // result.done
2684 { 2684 {
2685 Expression* done_literal = 2685 Expression* done_literal =
2686 factory()->NewLiteral(heap_factory->done_string()); 2686 factory()->NewLiteral(heap_factory->done_string());
2687 Expression* result_proxy = factory()->NewVariableProxy(result); 2687 Expression* result_proxy = factory()->NewVariableProxy(result);
2688 result_done = factory()->NewProperty( 2688 result_done = factory()->NewProperty(
2689 result_proxy, done_literal, RelocInfo::kNoPosition); 2689 result_proxy, done_literal, top_scope_->start_position());
2690 } 2690 }
2691 2691
2692 // each = result.value 2692 // each = result.value
2693 { 2693 {
2694 Expression* value_literal = 2694 Expression* value_literal =
2695 factory()->NewLiteral(heap_factory->value_string()); 2695 factory()->NewLiteral(heap_factory->value_string());
2696 Expression* result_proxy = factory()->NewVariableProxy(result); 2696 Expression* result_proxy = factory()->NewVariableProxy(result);
2697 Expression* result_value = factory()->NewProperty( 2697 Expression* result_value = factory()->NewProperty(
2698 result_proxy, value_literal, RelocInfo::kNoPosition); 2698 result_proxy, value_literal, top_scope_->start_position());
2699 assign_each = factory()->NewAssignment( 2699 assign_each = factory()->NewAssignment(
2700 Token::ASSIGN, each, result_value, RelocInfo::kNoPosition); 2700 Token::ASSIGN, each, result_value, RelocInfo::kNoPosition);
2701 } 2701 }
2702 2702
2703 for_of->Initialize(each, subject, body, 2703 for_of->Initialize(each, subject, body,
2704 assign_iterator, next_result, result_done, assign_each); 2704 assign_iterator, next_result, result_done, assign_each);
2705 } else { 2705 } else {
2706 stmt->Initialize(each, subject, body); 2706 stmt->Initialize(each, subject, body);
2707 } 2707 }
2708 } 2708 }
(...skipping 3221 matching lines...) Expand 10 before | Expand all | Expand 10 after
5930 ASSERT(info()->isolate()->has_pending_exception()); 5930 ASSERT(info()->isolate()->has_pending_exception());
5931 } else { 5931 } else {
5932 result = ParseProgram(); 5932 result = ParseProgram();
5933 } 5933 }
5934 } 5934 }
5935 info()->SetFunction(result); 5935 info()->SetFunction(result);
5936 return (result != NULL); 5936 return (result != NULL);
5937 } 5937 }
5938 5938
5939 } } // namespace v8::internal 5939 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/ia32/full-codegen-ia32.cc ('k') | src/typing.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698