Chromium Code Reviews| 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 2824 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2835 // | 2835 // |
| 2836 // <let x' be a temporary variable> | 2836 // <let x' be a temporary variable> |
| 2837 // for (x' in e) { | 2837 // for (x' in e) { |
| 2838 // let x; | 2838 // let x; |
| 2839 // x = x'; | 2839 // x = x'; |
| 2840 // b; | 2840 // b; |
| 2841 // } | 2841 // } |
| 2842 | 2842 |
| 2843 // TODO(keuchel): Move the temporary variable to the block scope, after | 2843 // TODO(keuchel): Move the temporary variable to the block scope, after |
| 2844 // implementing stack allocated block scoped variables. | 2844 // implementing stack allocated block scoped variables. |
| 2845 Variable* temp = top_scope_->DeclarationScope()->NewTemporary(name); | 2845 Factory* heap_factory = isolate()->factory(); |
| 2846 Handle<String> dot = | |
| 2847 heap_factory->NewStringFromAscii(CStrVector(".for.")); | |
|
Michael Starzinger
2012/10/05 12:31:38
You could move this symbol into the root-set by ad
rossberg
2012/10/05 12:47:04
Done.
| |
| 2848 Handle<String> tempstr = heap_factory->NewConsString(dot, name); | |
| 2849 Handle<String> tempname = heap_factory->LookupSymbol(tempstr); | |
| 2850 Variable* temp = top_scope_->DeclarationScope()->NewTemporary(tempname); | |
| 2846 VariableProxy* temp_proxy = factory()->NewVariableProxy(temp); | 2851 VariableProxy* temp_proxy = factory()->NewVariableProxy(temp); |
| 2847 ForInStatement* loop = factory()->NewForInStatement(labels); | 2852 ForInStatement* loop = factory()->NewForInStatement(labels); |
| 2848 Target target(&this->target_stack_, loop); | 2853 Target target(&this->target_stack_, loop); |
| 2849 | 2854 |
| 2850 // The expression does not see the loop variable. | 2855 // The expression does not see the loop variable. |
| 2851 Expect(Token::IN, CHECK_OK); | 2856 Expect(Token::IN, CHECK_OK); |
| 2852 top_scope_ = saved_scope; | 2857 top_scope_ = saved_scope; |
| 2853 Expression* enumerable = ParseExpression(true, CHECK_OK); | 2858 Expression* enumerable = ParseExpression(true, CHECK_OK); |
| 2854 top_scope_ = for_scope; | 2859 top_scope_ = for_scope; |
| 2855 Expect(Token::RPAREN, CHECK_OK); | 2860 Expect(Token::RPAREN, CHECK_OK); |
| (...skipping 3120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5976 ASSERT(info->isolate()->has_pending_exception()); | 5981 ASSERT(info->isolate()->has_pending_exception()); |
| 5977 } else { | 5982 } else { |
| 5978 result = parser.ParseProgram(); | 5983 result = parser.ParseProgram(); |
| 5979 } | 5984 } |
| 5980 } | 5985 } |
| 5981 info->SetFunction(result); | 5986 info->SetFunction(result); |
| 5982 return (result != NULL); | 5987 return (result != NULL); |
| 5983 } | 5988 } |
| 5984 | 5989 |
| 5985 } } // namespace v8::internal | 5990 } } // namespace v8::internal |
| OLD | NEW |