// Copyright 2012 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/v8.h" #include "src/api.h" #include "src/ast.h" #include "src/ast-literal-reindexer.h" #include "src/bailout-reason.h" #include "src/base/platform/platform.h" #include "src/bootstrapper.h" #include "src/char-predicates-inl.h" #include "src/codegen.h" #include "src/compiler.h" #include "src/messages.h" #include "src/parser.h" #include "src/preparser.h" #include "src/runtime/runtime.h" #include "src/scanner-character-streams.h" #include "src/scopeinfo.h" #include "src/string-stream.h" namespace v8 { namespace internal { ScriptData::ScriptData(const byte* data, int length) : owns_data_(false), rejected_(false), data_(data), length_(length) { if (!IsAligned(reinterpret_cast(data), kPointerAlignment)) { byte* copy = NewArray(length); DCHECK(IsAligned(reinterpret_cast(copy), kPointerAlignment)); CopyBytes(copy, data, length); data_ = copy; AcquireDataOwnership(); } } ParseInfo::ParseInfo(Zone* zone) : zone_(zone), flags_(0), source_stream_(nullptr), source_stream_encoding_(ScriptCompiler::StreamedSource::ONE_BYTE), extension_(nullptr), compile_options_(ScriptCompiler::kNoCompileOptions), script_scope_(nullptr), unicode_cache_(nullptr), stack_limit_(0), hash_seed_(0), cached_data_(nullptr), ast_value_factory_(nullptr), literal_(nullptr), scope_(nullptr) {} ParseInfo::ParseInfo(Zone* zone, Handle function) : ParseInfo(zone, Handle(function->shared())) { set_closure(function); set_context(Handle(function->context())); } ParseInfo::ParseInfo(Zone* zone, Handle shared) : ParseInfo(zone) { isolate_ = shared->GetIsolate(); set_lazy(); set_hash_seed(isolate_->heap()->HashSeed()); set_stack_limit(isolate_->stack_guard()->real_climit()); set_unicode_cache(isolate_->unicode_cache()); set_language_mode(shared->language_mode()); set_shared_info(shared); Handle