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 1299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1310 // eval code will be used within the eval code, so lazy parsing is | 1310 // eval code will be used within the eval code, so lazy parsing is |
1311 // probably not a win. | 1311 // probably not a win. |
1312 if (this->scope()->is_eval_scope()) mode_ = PARSE_EAGERLY; | 1312 if (this->scope()->is_eval_scope()) mode_ = PARSE_EAGERLY; |
1313 } else if (literal->raw_value()->AsString() == | 1313 } else if (literal->raw_value()->AsString() == |
1314 ast_value_factory()->use_asm_string() && | 1314 ast_value_factory()->use_asm_string() && |
1315 token_loc.end_pos - token_loc.beg_pos == | 1315 token_loc.end_pos - token_loc.beg_pos == |
1316 ast_value_factory()->use_asm_string()->length() + 2) { | 1316 ast_value_factory()->use_asm_string()->length() + 2) { |
1317 // Store the usage count; The actual use counter on the isolate is | 1317 // Store the usage count; The actual use counter on the isolate is |
1318 // incremented after parsing is done. | 1318 // incremented after parsing is done. |
1319 ++use_counts_[v8::Isolate::kUseAsm]; | 1319 ++use_counts_[v8::Isolate::kUseAsm]; |
1320 this->scope()->SetAsmModule(); | 1320 DCHECK(this->scope()->is_declaration_scope()); |
| 1321 this->scope()->AsDeclarationScope()->set_asm_module(); |
1321 } else { | 1322 } else { |
1322 // Should not change mode, but will increment UseCounter | 1323 // Should not change mode, but will increment UseCounter |
1323 // if appropriate. Ditto usages below. | 1324 // if appropriate. Ditto usages below. |
1324 RaiseLanguageMode(SLOPPY); | 1325 RaiseLanguageMode(SLOPPY); |
1325 } | 1326 } |
1326 } else { | 1327 } else { |
1327 // End of the directive prologue. | 1328 // End of the directive prologue. |
1328 directive_prologue = false; | 1329 directive_prologue = false; |
1329 RaiseLanguageMode(SLOPPY); | 1330 RaiseLanguageMode(SLOPPY); |
1330 } | 1331 } |
(...skipping 2969 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4300 // FunctionExpression; even without enclosing parentheses it might be | 4301 // FunctionExpression; even without enclosing parentheses it might be |
4301 // immediately invoked. | 4302 // immediately invoked. |
4302 // - The function literal shouldn't be hinted to eagerly compile. | 4303 // - The function literal shouldn't be hinted to eagerly compile. |
4303 // - For asm.js functions the body needs to be available when module | 4304 // - For asm.js functions the body needs to be available when module |
4304 // validation is active, because we examine the entire module at once. | 4305 // validation is active, because we examine the entire module at once. |
4305 bool use_temp_zone = | 4306 bool use_temp_zone = |
4306 !is_lazily_parsed && FLAG_lazy && !allow_natives() && | 4307 !is_lazily_parsed && FLAG_lazy && !allow_natives() && |
4307 extension_ == NULL && allow_lazy() && | 4308 extension_ == NULL && allow_lazy() && |
4308 function_type == FunctionLiteral::kDeclaration && | 4309 function_type == FunctionLiteral::kDeclaration && |
4309 eager_compile_hint != FunctionLiteral::kShouldEagerCompile && | 4310 eager_compile_hint != FunctionLiteral::kShouldEagerCompile && |
4310 !(FLAG_validate_asm && scope()->asm_module()); | 4311 !(FLAG_validate_asm && scope()->IsAsmModule()); |
4311 | 4312 |
4312 DeclarationScope* main_scope = nullptr; | 4313 DeclarationScope* main_scope = nullptr; |
4313 if (use_temp_zone) { | 4314 if (use_temp_zone) { |
4314 // This Scope lives in the main Zone; we'll migrate data into it later. | 4315 // This Scope lives in the main Zone; we'll migrate data into it later. |
4315 main_scope = NewFunctionScope(kind); | 4316 main_scope = NewFunctionScope(kind); |
4316 } | 4317 } |
4317 | 4318 |
4318 ZoneList<Statement*>* body = nullptr; | 4319 ZoneList<Statement*>* body = nullptr; |
4319 int arity = -1; | 4320 int arity = -1; |
4320 int materialized_literal_count = -1; | 4321 int materialized_literal_count = -1; |
(...skipping 2700 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7021 node->Print(Isolate::Current()); | 7022 node->Print(Isolate::Current()); |
7022 } | 7023 } |
7023 #endif // DEBUG | 7024 #endif // DEBUG |
7024 | 7025 |
7025 #undef CHECK_OK | 7026 #undef CHECK_OK |
7026 #undef CHECK_OK_VOID | 7027 #undef CHECK_OK_VOID |
7027 #undef CHECK_FAILED | 7028 #undef CHECK_FAILED |
7028 | 7029 |
7029 } // namespace internal | 7030 } // namespace internal |
7030 } // namespace v8 | 7031 } // namespace v8 |
OLD | NEW |