// Copyright 2016 the V8 project authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "src/parsing/parse-info.h" #include "src/api.h" #include "src/ast/ast-source-ranges.h" #include "src/ast/ast-value-factory.h" #include "src/ast/ast.h" #include "src/heap/heap-inl.h" #include "src/objects-inl.h" #include "src/objects/scope-info.h" #include "src/zone/zone.h" namespace v8 { namespace internal { ParseInfo::ParseInfo(AccountingAllocator* zone_allocator) : zone_(std::make_shared(zone_allocator, ZONE_NAME)), flags_(0), extension_(nullptr), script_scope_(nullptr), unicode_cache_(nullptr), stack_limit_(0), hash_seed_(0), function_flags_(0), start_position_(0), end_position_(0), parameters_end_pos_(kNoSourcePosition), function_literal_id_(FunctionLiteral::kIdTypeInvalid), max_function_literal_id_(FunctionLiteral::kIdTypeInvalid), character_stream_(nullptr), ast_value_factory_(nullptr), ast_string_constants_(nullptr), function_name_(nullptr), runtime_call_stats_(nullptr), source_range_map_(nullptr), literal_(nullptr) {} ParseInfo::ParseInfo(Handle shared) : ParseInfo(shared->GetIsolate()->allocator()) { Isolate* isolate = shared->GetIsolate(); InitFromIsolate(isolate); // Do not support re-parsing top-level function of a wrapped script. // TODO(yangguo): consider whether we need a top-level function in a // wrapped script at all. DCHECK_IMPLIES(is_toplevel(), !Script::cast(shared->script())->is_wrapped()); set_toplevel(shared->is_toplevel()); set_wrapped_as_function(shared->is_wrapped()); set_allow_lazy_parsing(FLAG_lazy_inner_functions); set_is_named_expression(shared->is_named_expression()); set_function_flags(shared->flags()); set_start_position(shared->StartPosition()); set_end_position(shared->EndPosition()); function_literal_id_ = shared->function_literal_id(); set_language_mode(shared->language_mode()); set_asm_wasm_broken(shared->is_asm_wasm_broken()); Handle