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