| OLD | NEW |
| 1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 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/parse-info.h" | 5 #include "src/parsing/parse-info.h" |
| 6 | 6 |
| 7 #include "src/api.h" | |
| 8 #include "src/ast/ast-value-factory.h" | 7 #include "src/ast/ast-value-factory.h" |
| 9 #include "src/ast/ast.h" | 8 #include "src/ast/ast.h" |
| 10 #include "src/heap/heap-inl.h" | 9 #include "src/heap/heap-inl.h" |
| 11 #include "src/objects-inl.h" | 10 #include "src/objects-inl.h" |
| 12 #include "src/objects/scope-info.h" | 11 #include "src/objects/scope-info.h" |
| 13 #include "src/zone/zone.h" | 12 #include "src/zone/zone.h" |
| 14 | 13 |
| 15 namespace v8 { | 14 namespace v8 { |
| 16 namespace internal { | 15 namespace internal { |
| 17 | 16 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 30 hash_seed_(0), | 29 hash_seed_(0), |
| 31 compiler_hints_(0), | 30 compiler_hints_(0), |
| 32 start_position_(0), | 31 start_position_(0), |
| 33 end_position_(0), | 32 end_position_(0), |
| 34 function_literal_id_(FunctionLiteral::kIdTypeInvalid), | 33 function_literal_id_(FunctionLiteral::kIdTypeInvalid), |
| 35 max_function_literal_id_(FunctionLiteral::kIdTypeInvalid), | 34 max_function_literal_id_(FunctionLiteral::kIdTypeInvalid), |
| 36 isolate_(nullptr), | 35 isolate_(nullptr), |
| 37 cached_data_(nullptr), | 36 cached_data_(nullptr), |
| 38 ast_value_factory_(nullptr), | 37 ast_value_factory_(nullptr), |
| 39 function_name_(nullptr), | 38 function_name_(nullptr), |
| 40 literal_(nullptr), | 39 literal_(nullptr) {} |
| 41 deferred_handles_(nullptr) {} | |
| 42 | 40 |
| 43 ParseInfo::ParseInfo(Handle<SharedFunctionInfo> shared) | 41 ParseInfo::ParseInfo(Handle<SharedFunctionInfo> shared) |
| 44 : ParseInfo(shared->GetIsolate()->allocator()) { | 42 : ParseInfo(shared->GetIsolate()->allocator()) { |
| 45 isolate_ = shared->GetIsolate(); | 43 isolate_ = shared->GetIsolate(); |
| 46 | 44 |
| 47 set_toplevel(shared->is_toplevel()); | 45 set_toplevel(shared->is_toplevel()); |
| 48 set_allow_lazy_parsing(FLAG_lazy_inner_functions); | 46 set_allow_lazy_parsing(FLAG_lazy_inner_functions); |
| 49 set_hash_seed(isolate_->heap()->HashSeed()); | 47 set_hash_seed(isolate_->heap()->HashSeed()); |
| 50 set_is_named_expression(shared->is_named_expression()); | 48 set_is_named_expression(shared->is_named_expression()); |
| 51 set_calls_eval(shared->scope_info()->CallsEval()); | 49 set_calls_eval(shared->scope_info()->CallsEval()); |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 DeclarationScope* ParseInfo::scope() const { return literal()->scope(); } | 101 DeclarationScope* ParseInfo::scope() const { return literal()->scope(); } |
| 104 | 102 |
| 105 bool ParseInfo::is_declaration() const { | 103 bool ParseInfo::is_declaration() const { |
| 106 return (compiler_hints_ & (1 << SharedFunctionInfo::kIsDeclaration)) != 0; | 104 return (compiler_hints_ & (1 << SharedFunctionInfo::kIsDeclaration)) != 0; |
| 107 } | 105 } |
| 108 | 106 |
| 109 FunctionKind ParseInfo::function_kind() const { | 107 FunctionKind ParseInfo::function_kind() const { |
| 110 return SharedFunctionInfo::FunctionKindBits::decode(compiler_hints_); | 108 return SharedFunctionInfo::FunctionKindBits::decode(compiler_hints_); |
| 111 } | 109 } |
| 112 | 110 |
| 113 void ParseInfo::set_deferred_handles( | |
| 114 std::shared_ptr<DeferredHandles> deferred_handles) { | |
| 115 DCHECK(deferred_handles_.get() == nullptr); | |
| 116 deferred_handles_.swap(deferred_handles); | |
| 117 } | |
| 118 | |
| 119 void ParseInfo::set_deferred_handles(DeferredHandles* deferred_handles) { | |
| 120 DCHECK(deferred_handles_.get() == nullptr); | |
| 121 deferred_handles_.reset(deferred_handles); | |
| 122 } | |
| 123 | |
| 124 #ifdef DEBUG | 111 #ifdef DEBUG |
| 125 bool ParseInfo::script_is_native() const { | 112 bool ParseInfo::script_is_native() const { |
| 126 return script_->type() == Script::TYPE_NATIVE; | 113 return script_->type() == Script::TYPE_NATIVE; |
| 127 } | 114 } |
| 128 #endif // DEBUG | 115 #endif // DEBUG |
| 129 | 116 |
| 130 } // namespace internal | 117 } // namespace internal |
| 131 } // namespace v8 | 118 } // namespace v8 |
| OLD | NEW |