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 // 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/parsing/parser.h" | 5 #include "src/parsing/parser.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "src/api.h" | 9 #include "src/api.h" |
| 10 #include "src/ast/ast-expression-rewriter.h" | 10 #include "src/ast/ast-expression-rewriter.h" |
| (...skipping 3133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3144 SkipLazyFunctionBody(&materialized_literal_count, | 3144 SkipLazyFunctionBody(&materialized_literal_count, |
| 3145 &expected_property_count, may_abort, CHECK_OK); | 3145 &expected_property_count, may_abort, CHECK_OK); |
| 3146 | 3146 |
| 3147 materialized_literal_count += formals.materialized_literals_count + | 3147 materialized_literal_count += formals.materialized_literals_count + |
| 3148 function_state.materialized_literal_count(); | 3148 function_state.materialized_literal_count(); |
| 3149 | 3149 |
| 3150 if (result == kLazyParsingAborted) { | 3150 if (result == kLazyParsingAborted) { |
| 3151 bookmark.Reset(); | 3151 bookmark.Reset(); |
| 3152 // Trigger eager (re-)parsing, just below this block. | 3152 // Trigger eager (re-)parsing, just below this block. |
| 3153 is_lazily_parsed = false; | 3153 is_lazily_parsed = false; |
| 3154 this->scope()->set_is_lazily_parsed(false); | |
| 3154 | 3155 |
| 3155 // This is probably an initialization function. Inform the compiler it | 3156 // This is probably an initialization function. Inform the compiler it |
| 3156 // should also eager-compile this function, and that we expect it to be | 3157 // should also eager-compile this function, and that we expect it to be |
| 3157 // used once. | 3158 // used once. |
| 3158 eager_compile_hint = FunctionLiteral::kShouldEagerCompile; | 3159 eager_compile_hint = FunctionLiteral::kShouldEagerCompile; |
| 3159 should_be_used_once_hint = true; | 3160 should_be_used_once_hint = true; |
| 3160 } | 3161 } |
| 3161 } | 3162 } |
| 3162 if (!is_lazily_parsed) { | 3163 if (!is_lazily_parsed) { |
| 3163 body = ParseEagerFunctionBody(function_name, pos, formals, kind, | 3164 body = ParseEagerFunctionBody(function_name, pos, formals, kind, |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3255 language_mode(), CHECK_OK); | 3256 language_mode(), CHECK_OK); |
| 3256 } | 3257 } |
| 3257 | 3258 |
| 3258 Parser::LazyParsingResult Parser::SkipLazyFunctionBody( | 3259 Parser::LazyParsingResult Parser::SkipLazyFunctionBody( |
| 3259 int* materialized_literal_count, int* expected_property_count, | 3260 int* materialized_literal_count, int* expected_property_count, |
| 3260 bool may_abort, bool* ok) { | 3261 bool may_abort, bool* ok) { |
| 3261 if (produce_cached_parse_data()) CHECK(log_); | 3262 if (produce_cached_parse_data()) CHECK(log_); |
| 3262 | 3263 |
| 3263 int function_block_pos = position(); | 3264 int function_block_pos = position(); |
| 3264 DeclarationScope* scope = this->scope()->AsDeclarationScope(); | 3265 DeclarationScope* scope = this->scope()->AsDeclarationScope(); |
| 3265 DCHECK(scope->is_function_scope()); | 3266 DCHECK(scope->is_function_scope()); |
|
jochen (gone - plz use gerrit)
2016/09/16 13:16:12
Marja raised the concern that the this->scope() mi
| |
| 3267 scope->set_is_lazily_parsed(true); | |
| 3266 if (consume_cached_parse_data() && !cached_parse_data_->rejected()) { | 3268 if (consume_cached_parse_data() && !cached_parse_data_->rejected()) { |
| 3267 // If we have cached data, we use it to skip parsing the function body. The | 3269 // If we have cached data, we use it to skip parsing the function body. The |
| 3268 // data contains the information we need to construct the lazy function. | 3270 // data contains the information we need to construct the lazy function. |
| 3269 FunctionEntry entry = | 3271 FunctionEntry entry = |
| 3270 cached_parse_data_->GetFunctionEntry(function_block_pos); | 3272 cached_parse_data_->GetFunctionEntry(function_block_pos); |
| 3271 // Check that cached data is valid. If not, mark it as invalid (the embedder | 3273 // Check that cached data is valid. If not, mark it as invalid (the embedder |
| 3272 // handles it). Note that end position greater than end of stream is safe, | 3274 // handles it). Note that end position greater than end of stream is safe, |
| 3273 // and hard to check. | 3275 // and hard to check. |
| 3274 if (entry.is_valid() && entry.end_pos() > function_block_pos) { | 3276 if (entry.is_valid() && entry.end_pos() > function_block_pos) { |
| 3275 scanner()->SeekForward(entry.end_pos() - 1); | 3277 scanner()->SeekForward(entry.end_pos() - 1); |
| (...skipping 2636 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5912 node->Print(Isolate::Current()); | 5914 node->Print(Isolate::Current()); |
| 5913 } | 5915 } |
| 5914 #endif // DEBUG | 5916 #endif // DEBUG |
| 5915 | 5917 |
| 5916 #undef CHECK_OK | 5918 #undef CHECK_OK |
| 5917 #undef CHECK_OK_VOID | 5919 #undef CHECK_OK_VOID |
| 5918 #undef CHECK_FAILED | 5920 #undef CHECK_FAILED |
| 5919 | 5921 |
| 5920 } // namespace internal | 5922 } // namespace internal |
| 5921 } // namespace v8 | 5923 } // namespace v8 |
| OLD | NEW |