Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5)

Side by Side Diff: src/parsing/parser.cc

Issue 2253913002: Move asm_module_ and asm_function_ down to DeclarationScope (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/ast/scopes.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1317 matching lines...) Expand 10 before | Expand all | Expand 10 after
1328 // eval code will be used within the eval code, so lazy parsing is 1328 // eval code will be used within the eval code, so lazy parsing is
1329 // probably not a win. 1329 // probably not a win.
1330 if (this->scope()->is_eval_scope()) mode_ = PARSE_EAGERLY; 1330 if (this->scope()->is_eval_scope()) mode_ = PARSE_EAGERLY;
1331 } else if (literal->raw_value()->AsString() == 1331 } else if (literal->raw_value()->AsString() ==
1332 ast_value_factory()->use_asm_string() && 1332 ast_value_factory()->use_asm_string() &&
1333 token_loc.end_pos - token_loc.beg_pos == 1333 token_loc.end_pos - token_loc.beg_pos ==
1334 ast_value_factory()->use_asm_string()->length() + 2) { 1334 ast_value_factory()->use_asm_string()->length() + 2) {
1335 // Store the usage count; The actual use counter on the isolate is 1335 // Store the usage count; The actual use counter on the isolate is
1336 // incremented after parsing is done. 1336 // incremented after parsing is done.
1337 ++use_counts_[v8::Isolate::kUseAsm]; 1337 ++use_counts_[v8::Isolate::kUseAsm];
1338 this->scope()->SetAsmModule(); 1338 DCHECK(this->scope()->is_function_scope());
titzer 2016/08/19 09:38:55 Is it possible that some yahoo would do "use asm"
Toon Verwaest 2016/08/19 11:04:45 As far as I know directives are only processed at
1339 this->scope()->AsDeclarationScope()->set_asm_module();
1339 } else { 1340 } else {
1340 // Should not change mode, but will increment UseCounter 1341 // Should not change mode, but will increment UseCounter
1341 // if appropriate. Ditto usages below. 1342 // if appropriate. Ditto usages below.
1342 RaiseLanguageMode(SLOPPY); 1343 RaiseLanguageMode(SLOPPY);
1343 } 1344 }
1344 } else { 1345 } else {
1345 // End of the directive prologue. 1346 // End of the directive prologue.
1346 directive_prologue = false; 1347 directive_prologue = false;
1347 RaiseLanguageMode(SLOPPY); 1348 RaiseLanguageMode(SLOPPY);
1348 } 1349 }
(...skipping 2975 matching lines...) Expand 10 before | Expand all | Expand 10 after
4324 // FunctionExpression; even without enclosing parentheses it might be 4325 // FunctionExpression; even without enclosing parentheses it might be
4325 // immediately invoked. 4326 // immediately invoked.
4326 // - The function literal shouldn't be hinted to eagerly compile. 4327 // - The function literal shouldn't be hinted to eagerly compile.
4327 // - For asm.js functions the body needs to be available when module 4328 // - For asm.js functions the body needs to be available when module
4328 // validation is active, because we examine the entire module at once. 4329 // validation is active, because we examine the entire module at once.
4329 bool use_temp_zone = 4330 bool use_temp_zone =
4330 !is_lazily_parsed && FLAG_lazy && !allow_natives() && 4331 !is_lazily_parsed && FLAG_lazy && !allow_natives() &&
4331 extension_ == NULL && allow_lazy() && 4332 extension_ == NULL && allow_lazy() &&
4332 function_type == FunctionLiteral::kDeclaration && 4333 function_type == FunctionLiteral::kDeclaration &&
4333 eager_compile_hint != FunctionLiteral::kShouldEagerCompile && 4334 eager_compile_hint != FunctionLiteral::kShouldEagerCompile &&
4334 !(FLAG_validate_asm && scope()->asm_module()); 4335 !(FLAG_validate_asm && scope()->IsAsmModule());
4335 4336
4336 DeclarationScope* main_scope = nullptr; 4337 DeclarationScope* main_scope = nullptr;
4337 if (use_temp_zone) { 4338 if (use_temp_zone) {
4338 // This Scope lives in the main Zone; we'll migrate data into it later. 4339 // This Scope lives in the main Zone; we'll migrate data into it later.
4339 main_scope = NewFunctionScope(kind); 4340 main_scope = NewFunctionScope(kind);
4340 } 4341 }
4341 4342
4342 ZoneList<Statement*>* body = nullptr; 4343 ZoneList<Statement*>* body = nullptr;
4343 int arity = -1; 4344 int arity = -1;
4344 int materialized_literal_count = -1; 4345 int materialized_literal_count = -1;
(...skipping 2742 matching lines...) Expand 10 before | Expand all | Expand 10 after
7087 node->Print(Isolate::Current()); 7088 node->Print(Isolate::Current());
7088 } 7089 }
7089 #endif // DEBUG 7090 #endif // DEBUG
7090 7091
7091 #undef CHECK_OK 7092 #undef CHECK_OK
7092 #undef CHECK_OK_VOID 7093 #undef CHECK_OK_VOID
7093 #undef CHECK_FAILED 7094 #undef CHECK_FAILED
7094 7095
7095 } // namespace internal 7096 } // namespace internal
7096 } // namespace v8 7097 } // namespace v8
OLDNEW
« no previous file with comments | « src/ast/scopes.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698