Chromium Code Reviews

Side by Side Diff: src/ast/ast.cc

Issue 2399833002: Teach Scopes whether they will end up being lazily compiled or not (Closed)
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff |
« no previous file with comments | « src/ast/ast.h ('k') | src/ast/scopes.h » ('j') | src/ast/scopes.h » ('J')
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/ast/ast.h" 5 #include "src/ast/ast.h"
6 6
7 #include <cmath> // For isfinite. 7 #include <cmath> // For isfinite.
8 8
9 #include "src/ast/compile-time-value.h" 9 #include "src/ast/compile-time-value.h"
10 #include "src/ast/prettyprinter.h" 10 #include "src/ast/prettyprinter.h"
(...skipping 270 matching lines...)
281 case Token::ASSIGN_ADD: return Token::ADD; 281 case Token::ASSIGN_ADD: return Token::ADD;
282 case Token::ASSIGN_SUB: return Token::SUB; 282 case Token::ASSIGN_SUB: return Token::SUB;
283 case Token::ASSIGN_MUL: return Token::MUL; 283 case Token::ASSIGN_MUL: return Token::MUL;
284 case Token::ASSIGN_DIV: return Token::DIV; 284 case Token::ASSIGN_DIV: return Token::DIV;
285 case Token::ASSIGN_MOD: return Token::MOD; 285 case Token::ASSIGN_MOD: return Token::MOD;
286 default: UNREACHABLE(); 286 default: UNREACHABLE();
287 } 287 }
288 return Token::ILLEGAL; 288 return Token::ILLEGAL;
289 } 289 }
290 290
291 void FunctionLiteral::set_should_eager_compile() {
292 scope()->SetShouldCompileLazily(false);
marja 2016/10/06 11:53:06 FunctionLiteral::set_should_eagerly_compile but Sc
293 bit_field_ = ShouldEagerCompile::update(bit_field_, true);
294 }
291 295
292 bool FunctionLiteral::AllowsLazyCompilation() { 296 bool FunctionLiteral::AllowsLazyCompilation() {
293 return scope()->AllowsLazyCompilation(); 297 return scope()->AllowsLazyCompilation();
294 } 298 }
295 299
296 300
297 bool FunctionLiteral::AllowsLazyCompilationWithoutContext() { 301 bool FunctionLiteral::AllowsLazyCompilationWithoutContext() {
298 return scope()->AllowsLazyCompilationWithoutContext(); 302 return scope()->AllowsLazyCompilationWithoutContext();
299 } 303 }
300 304
(...skipping 657 matching lines...)
958 // static 962 // static
959 bool Literal::Match(void* literal1, void* literal2) { 963 bool Literal::Match(void* literal1, void* literal2) {
960 const AstValue* x = static_cast<Literal*>(literal1)->raw_value(); 964 const AstValue* x = static_cast<Literal*>(literal1)->raw_value();
961 const AstValue* y = static_cast<Literal*>(literal2)->raw_value(); 965 const AstValue* y = static_cast<Literal*>(literal2)->raw_value();
962 return (x->IsString() && y->IsString() && x->AsString() == y->AsString()) || 966 return (x->IsString() && y->IsString() && x->AsString() == y->AsString()) ||
963 (x->IsNumber() && y->IsNumber() && x->AsNumber() == y->AsNumber()); 967 (x->IsNumber() && y->IsNumber() && x->AsNumber() == y->AsNumber());
964 } 968 }
965 969
966 } // namespace internal 970 } // namespace internal
967 } // namespace v8 971 } // namespace v8
OLDNEW
« no previous file with comments | « src/ast/ast.h ('k') | src/ast/scopes.h » ('j') | src/ast/scopes.h » ('J')

Powered by Google App Engine