 Chromium Code Reviews
 Chromium Code Reviews Issue 981203003:
  Stack allocate lexical locals + hoist stack slots  (Closed) 
  Base URL: https://chromium.googlesource.com/v8/v8.git@master
    
  
    Issue 981203003:
  Stack allocate lexical locals + hoist stack slots  (Closed) 
  Base URL: https://chromium.googlesource.com/v8/v8.git@master| OLD | NEW | 
|---|---|
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. | 
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be | 
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. | 
| 4 | 4 | 
| 5 #include "src/v8.h" | 5 #include "src/v8.h" | 
| 6 | 6 | 
| 7 #include "src/api.h" | 7 #include "src/api.h" | 
| 8 #include "src/ast.h" | 8 #include "src/ast.h" | 
| 9 #include "src/bailout-reason.h" | 9 #include "src/bailout-reason.h" | 
| 10 #include "src/base/platform/platform.h" | 10 #include "src/base/platform/platform.h" | 
| (...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 512 } | 512 } | 
| 513 } | 513 } | 
| 514 | 514 | 
| 515 | 515 | 
| 516 void ParserTraits::CheckPossibleEvalCall(Expression* expression, | 516 void ParserTraits::CheckPossibleEvalCall(Expression* expression, | 
| 517 Scope* scope) { | 517 Scope* scope) { | 
| 518 VariableProxy* callee = expression->AsVariableProxy(); | 518 VariableProxy* callee = expression->AsVariableProxy(); | 
| 519 if (callee != NULL && | 519 if (callee != NULL && | 
| 520 callee->raw_name() == parser_->ast_value_factory()->eval_string()) { | 520 callee->raw_name() == parser_->ast_value_factory()->eval_string()) { | 
| 521 scope->DeclarationScope()->RecordEvalCall(); | 521 scope->DeclarationScope()->RecordEvalCall(); | 
| 522 scope->RecordEvalCall(); | |
| 522 } | 523 } | 
| 523 } | 524 } | 
| 524 | 525 | 
| 525 | 526 | 
| 526 Expression* ParserTraits::MarkExpressionAsAssigned(Expression* expression) { | 527 Expression* ParserTraits::MarkExpressionAsAssigned(Expression* expression) { | 
| 527 VariableProxy* proxy = | 528 VariableProxy* proxy = | 
| 528 expression != NULL ? expression->AsVariableProxy() : NULL; | 529 expression != NULL ? expression->AsVariableProxy() : NULL; | 
| 529 if (proxy != NULL) proxy->set_is_assigned(); | 530 if (proxy != NULL) proxy->set_is_assigned(); | 
| 530 return expression; | 531 return expression; | 
| 531 } | 532 } | 
| (...skipping 2760 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3292 Statement* clear_first = NULL; | 3293 Statement* clear_first = NULL; | 
| 3293 // Make statement: first = 0. | 3294 // Make statement: first = 0. | 
| 3294 { | 3295 { | 
| 3295 VariableProxy* first_proxy = factory()->NewVariableProxy(first); | 3296 VariableProxy* first_proxy = factory()->NewVariableProxy(first); | 
| 3296 Expression* const0 = factory()->NewSmiLiteral(0, RelocInfo::kNoPosition); | 3297 Expression* const0 = factory()->NewSmiLiteral(0, RelocInfo::kNoPosition); | 
| 3297 Assignment* assignment = factory()->NewAssignment( | 3298 Assignment* assignment = factory()->NewAssignment( | 
| 3298 Token::ASSIGN, first_proxy, const0, RelocInfo::kNoPosition); | 3299 Token::ASSIGN, first_proxy, const0, RelocInfo::kNoPosition); | 
| 3299 clear_first = | 3300 clear_first = | 
| 3300 factory()->NewExpressionStatement(assignment, RelocInfo::kNoPosition); | 3301 factory()->NewExpressionStatement(assignment, RelocInfo::kNoPosition); | 
| 3301 } | 3302 } | 
| 3302 Statement* clear_first_or_next = | 3303 Statement* clear_first_or_next = factory()->NewIfStatement( | 
| 3303 factory()->NewIfStatement(compare, clear_first, next, next->position()); | 3304 compare, clear_first, next, RelocInfo::kNoPosition); | 
| 3304 inner_block->AddStatement(clear_first_or_next, zone()); | 3305 inner_block->AddStatement(clear_first_or_next, zone()); | 
| 3305 } | 3306 } | 
| 3306 | 3307 | 
| 3307 Variable* flag = scope_->DeclarationScope()->NewTemporary(temp_name); | 3308 Variable* flag = scope_->DeclarationScope()->NewTemporary(temp_name); | 
| 3308 // Make statement: flag = 1. | 3309 // Make statement: flag = 1. | 
| 3309 { | 3310 { | 
| 3310 VariableProxy* flag_proxy = factory()->NewVariableProxy(flag); | 3311 VariableProxy* flag_proxy = factory()->NewVariableProxy(flag); | 
| 3311 Expression* const1 = factory()->NewSmiLiteral(1, RelocInfo::kNoPosition); | 3312 Expression* const1 = factory()->NewSmiLiteral(1, RelocInfo::kNoPosition); | 
| 3312 Assignment* assignment = factory()->NewAssignment( | 3313 Assignment* assignment = factory()->NewAssignment( | 
| 3313 Token::ASSIGN, flag_proxy, const1, RelocInfo::kNoPosition); | 3314 Token::ASSIGN, flag_proxy, const1, RelocInfo::kNoPosition); | 
| (...skipping 734 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4048 // that it will be compiled lazily. | 4049 // that it will be compiled lazily. | 
| 4049 | 4050 | 
| 4050 // To make this additional case work, both Parser and PreParser implement a | 4051 // To make this additional case work, both Parser and PreParser implement a | 
| 4051 // logic where only top-level functions will be parsed lazily. | 4052 // logic where only top-level functions will be parsed lazily. | 
| 4052 bool is_lazily_parsed = (mode() == PARSE_LAZILY && | 4053 bool is_lazily_parsed = (mode() == PARSE_LAZILY && | 
| 4053 scope_->AllowsLazyCompilation() && | 4054 scope_->AllowsLazyCompilation() && | 
| 4054 !parenthesized_function_); | 4055 !parenthesized_function_); | 
| 4055 parenthesized_function_ = false; // The bit was set for this function only. | 4056 parenthesized_function_ = false; // The bit was set for this function only. | 
| 4056 | 4057 | 
| 4057 if (is_lazily_parsed) { | 4058 if (is_lazily_parsed) { | 
| 4059 for (Scope* s = scope_->outer_scope(); | |
| 4060 s != nullptr && s->is_block_scope(); s = s->outer_scope()) { | |
| 4061 s->ForceContextAllocation(); | |
| 
Dmitry Lomov (no reviews)
2015/04/17 14:22:17
This does not seem correct; will fix (catch/with s
 | |
| 4062 } | |
| 4058 SkipLazyFunctionBody(function_name, &materialized_literal_count, | 4063 SkipLazyFunctionBody(function_name, &materialized_literal_count, | 
| 4059 &expected_property_count, CHECK_OK); | 4064 &expected_property_count, CHECK_OK); | 
| 4060 } else { | 4065 } else { | 
| 4061 body = ParseEagerFunctionBody(function_name, pos, fvar, fvar_init_op, | 4066 body = ParseEagerFunctionBody(function_name, pos, fvar, fvar_init_op, | 
| 4062 kind, CHECK_OK); | 4067 kind, CHECK_OK); | 
| 4063 materialized_literal_count = function_state.materialized_literal_count(); | 4068 materialized_literal_count = function_state.materialized_literal_count(); | 
| 4064 expected_property_count = function_state.expected_property_count(); | 4069 expected_property_count = function_state.expected_property_count(); | 
| 4065 handler_count = function_state.handler_count(); | 4070 handler_count = function_state.handler_count(); | 
| 4066 } | 4071 } | 
| 4067 | 4072 | 
| (...skipping 1727 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5795 | 5800 | 
| 5796 Expression* Parser::SpreadCallNew(Expression* function, | 5801 Expression* Parser::SpreadCallNew(Expression* function, | 
| 5797 ZoneList<v8::internal::Expression*>* args, | 5802 ZoneList<v8::internal::Expression*>* args, | 
| 5798 int pos) { | 5803 int pos) { | 
| 5799 args->InsertAt(0, function, zone()); | 5804 args->InsertAt(0, function, zone()); | 
| 5800 | 5805 | 
| 5801 return factory()->NewCallRuntime( | 5806 return factory()->NewCallRuntime( | 
| 5802 ast_value_factory()->reflect_construct_string(), NULL, args, pos); | 5807 ast_value_factory()->reflect_construct_string(), NULL, args, pos); | 
| 5803 } | 5808 } | 
| 5804 } } // namespace v8::internal | 5809 } } // namespace v8::internal | 
| OLD | NEW |