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.h" | 10 #include "src/ast/ast.h" |
(...skipping 4281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4292 int materialized_literal_count = -1; | 4292 int materialized_literal_count = -1; |
4293 int expected_property_count = -1; | 4293 int expected_property_count = -1; |
4294 DuplicateFinder duplicate_finder(scanner()->unicode_cache()); | 4294 DuplicateFinder duplicate_finder(scanner()->unicode_cache()); |
4295 bool should_be_used_once_hint = false; | 4295 bool should_be_used_once_hint = false; |
4296 bool has_duplicate_parameters; | 4296 bool has_duplicate_parameters; |
4297 FunctionLiteral::EagerCompileHint eager_compile_hint; | 4297 FunctionLiteral::EagerCompileHint eager_compile_hint; |
4298 | 4298 |
4299 // Parse function. | 4299 // Parse function. |
4300 { | 4300 { |
4301 FunctionState function_state(&function_state_, &scope_state_, scope, kind); | 4301 FunctionState function_state(&function_state_, &scope_state_, scope, kind); |
| 4302 #ifdef DEBUG |
4302 this->scope()->SetScopeName(function_name); | 4303 this->scope()->SetScopeName(function_name); |
| 4304 #endif |
4303 ExpressionClassifier formals_classifier(this, &duplicate_finder); | 4305 ExpressionClassifier formals_classifier(this, &duplicate_finder); |
4304 | 4306 |
4305 eager_compile_hint = function_state_->this_function_is_parenthesized() | 4307 eager_compile_hint = function_state_->this_function_is_parenthesized() |
4306 ? FunctionLiteral::kShouldEagerCompile | 4308 ? FunctionLiteral::kShouldEagerCompile |
4307 : FunctionLiteral::kShouldLazyCompile; | 4309 : FunctionLiteral::kShouldLazyCompile; |
4308 | 4310 |
4309 if (is_generator) { | 4311 if (is_generator) { |
4310 // For generators, allocating variables in contexts is currently a win | 4312 // For generators, allocating variables in contexts is currently a win |
4311 // because it minimizes the work needed to suspend and resume an | 4313 // because it minimizes the work needed to suspend and resume an |
4312 // activation. The machine code produced for generators (by full-codegen) | 4314 // activation. The machine code produced for generators (by full-codegen) |
(...skipping 691 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5004 return nullptr; | 5006 return nullptr; |
5005 } | 5007 } |
5006 if (IsEvalOrArguments(name)) { | 5008 if (IsEvalOrArguments(name)) { |
5007 ReportMessageAt(class_name_location, MessageTemplate::kStrictEvalArguments); | 5009 ReportMessageAt(class_name_location, MessageTemplate::kStrictEvalArguments); |
5008 *ok = false; | 5010 *ok = false; |
5009 return nullptr; | 5011 return nullptr; |
5010 } | 5012 } |
5011 | 5013 |
5012 BlockState block_state(&scope_state_); | 5014 BlockState block_state(&scope_state_); |
5013 RaiseLanguageMode(STRICT); | 5015 RaiseLanguageMode(STRICT); |
| 5016 #ifdef DEBUG |
5014 scope()->SetScopeName(name); | 5017 scope()->SetScopeName(name); |
| 5018 #endif |
5015 | 5019 |
5016 VariableProxy* proxy = nullptr; | 5020 VariableProxy* proxy = nullptr; |
5017 if (name != nullptr) { | 5021 if (name != nullptr) { |
5018 proxy = NewUnresolved(name, CONST); | 5022 proxy = NewUnresolved(name, CONST); |
5019 // TODO(verwaest): declare via block_state. | 5023 // TODO(verwaest): declare via block_state. |
5020 Declaration* declaration = factory()->NewVariableDeclaration( | 5024 Declaration* declaration = factory()->NewVariableDeclaration( |
5021 proxy, CONST, block_state.scope(), pos); | 5025 proxy, CONST, block_state.scope(), pos); |
5022 Declare(declaration, DeclarationDescriptor::NORMAL, true, CHECK_OK); | 5026 Declare(declaration, DeclarationDescriptor::NORMAL, true, CHECK_OK); |
5023 } | 5027 } |
5024 | 5028 |
(...skipping 2063 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7088 node->Print(Isolate::Current()); | 7092 node->Print(Isolate::Current()); |
7089 } | 7093 } |
7090 #endif // DEBUG | 7094 #endif // DEBUG |
7091 | 7095 |
7092 #undef CHECK_OK | 7096 #undef CHECK_OK |
7093 #undef CHECK_OK_VOID | 7097 #undef CHECK_OK_VOID |
7094 #undef CHECK_FAILED | 7098 #undef CHECK_FAILED |
7095 | 7099 |
7096 } // namespace internal | 7100 } // namespace internal |
7097 } // namespace v8 | 7101 } // namespace v8 |
OLD | NEW |