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/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 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
286 default: UNREACHABLE(); | 286 default: UNREACHABLE(); |
287 } | 287 } |
288 return Token::ILLEGAL; | 288 return Token::ILLEGAL; |
289 } | 289 } |
290 | 290 |
291 bool FunctionLiteral::ShouldEagerCompile() const { | 291 bool FunctionLiteral::ShouldEagerCompile() const { |
292 return scope()->ShouldEagerCompile(); | 292 return scope()->ShouldEagerCompile(); |
293 } | 293 } |
294 | 294 |
295 void FunctionLiteral::SetShouldEagerCompile() { | 295 void FunctionLiteral::SetShouldEagerCompile() { |
| 296 if (body_ == nullptr) return; |
296 scope()->SetShouldEagerCompile(); | 297 scope()->SetShouldEagerCompile(); |
297 } | 298 } |
298 | 299 |
299 bool FunctionLiteral::AllowsLazyCompilation() { | 300 bool FunctionLiteral::AllowsLazyCompilation() { |
300 return scope()->AllowsLazyCompilation(); | 301 return scope()->AllowsLazyCompilation(); |
301 } | 302 } |
302 | 303 |
303 | 304 |
304 int FunctionLiteral::start_position() const { | 305 int FunctionLiteral::start_position() const { |
305 return scope()->start_position(); | 306 return scope()->start_position(); |
(...skipping 654 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
960 // static | 961 // static |
961 bool Literal::Match(void* literal1, void* literal2) { | 962 bool Literal::Match(void* literal1, void* literal2) { |
962 const AstValue* x = static_cast<Literal*>(literal1)->raw_value(); | 963 const AstValue* x = static_cast<Literal*>(literal1)->raw_value(); |
963 const AstValue* y = static_cast<Literal*>(literal2)->raw_value(); | 964 const AstValue* y = static_cast<Literal*>(literal2)->raw_value(); |
964 return (x->IsString() && y->IsString() && x->AsString() == y->AsString()) || | 965 return (x->IsString() && y->IsString() && x->AsString() == y->AsString()) || |
965 (x->IsNumber() && y->IsNumber() && x->AsNumber() == y->AsNumber()); | 966 (x->IsNumber() && y->IsNumber() && x->AsNumber() == y->AsNumber()); |
966 } | 967 } |
967 | 968 |
968 } // namespace internal | 969 } // namespace internal |
969 } // namespace v8 | 970 } // namespace v8 |
OLD | NEW |