Reland: [Parse] ParseInfo owns the parsing Zone.
Moves ownership of the parsing Zone to ParseInfo with a shared_ptr. This is
in preperation for enabling background compilation jobs for inner functions
share the AST in the outer-function's parse zone memory (read-only), with the
and zone being released when all compilation jobs have completed.
BUG=v8:5203,v8:5215
Review-Url: https://codereview.chromium.org/2632123006
Cr-Original-Commit-Position: refs/heads/master@{#42993}
Committed: 14fb337200
Review-Url: https://codereview.chromium.org/2632123006
Cr-Commit-Position: refs/heads/master@{#42996}
This commit is contained in:
parent
6159c5779d
commit
9e7d5a6065
@ -142,27 +142,27 @@ class AsmWasmBuilderImpl final : public AstVisitor<AsmWasmBuilderImpl> {
|
||||
DCHECK_EQ(kModuleScope, scope_);
|
||||
DCHECK_NULL(current_function_builder_);
|
||||
FunctionLiteral* old_func = decl->fun();
|
||||
Zone zone(isolate_->allocator(), ZONE_NAME);
|
||||
DeclarationScope* new_func_scope = nullptr;
|
||||
std::unique_ptr<ParseInfo> info;
|
||||
if (decl->fun()->body() == nullptr) {
|
||||
// TODO(titzer/bradnelson): Reuse SharedFunctionInfos used here when
|
||||
// compiling the wasm module.
|
||||
Handle<SharedFunctionInfo> shared =
|
||||
Compiler::GetSharedFunctionInfo(decl->fun(), script_, info_);
|
||||
shared->set_is_toplevel(false);
|
||||
ParseInfo info(&zone, script_);
|
||||
info.set_shared_info(shared);
|
||||
info.set_toplevel(false);
|
||||
info.set_language_mode(decl->fun()->scope()->language_mode());
|
||||
info.set_allow_lazy_parsing(false);
|
||||
info.set_function_literal_id(shared->function_literal_id());
|
||||
info.set_ast_value_factory(ast_value_factory_);
|
||||
info.set_ast_value_factory_owned(false);
|
||||
info.reset(new ParseInfo(script_));
|
||||
info->set_shared_info(shared);
|
||||
info->set_toplevel(false);
|
||||
info->set_language_mode(decl->fun()->scope()->language_mode());
|
||||
info->set_allow_lazy_parsing(false);
|
||||
info->set_function_literal_id(shared->function_literal_id());
|
||||
info->set_ast_value_factory(ast_value_factory_);
|
||||
info->set_ast_value_factory_owned(false);
|
||||
// Create fresh function scope to use to parse the function in.
|
||||
new_func_scope = new (info.zone()) DeclarationScope(
|
||||
info.zone(), decl->fun()->scope()->outer_scope(), FUNCTION_SCOPE);
|
||||
info.set_asm_function_scope(new_func_scope);
|
||||
if (!Compiler::ParseAndAnalyze(&info)) {
|
||||
new_func_scope = new (info->zone()) DeclarationScope(
|
||||
info->zone(), decl->fun()->scope()->outer_scope(), FUNCTION_SCOPE);
|
||||
info->set_asm_function_scope(new_func_scope);
|
||||
if (!Compiler::ParseAndAnalyze(info.get())) {
|
||||
decl->fun()->scope()->outer_scope()->RemoveInnerScope(new_func_scope);
|
||||
if (isolate_->has_pending_exception()) {
|
||||
isolate_->clear_pending_exception();
|
||||
@ -171,7 +171,7 @@ class AsmWasmBuilderImpl final : public AstVisitor<AsmWasmBuilderImpl> {
|
||||
typer_failed_ = true;
|
||||
return;
|
||||
}
|
||||
FunctionLiteral* func = info.literal();
|
||||
FunctionLiteral* func = info->literal();
|
||||
DCHECK_NOT_NULL(func);
|
||||
decl->set_fun(func);
|
||||
}
|
||||
|
@ -13,7 +13,6 @@ namespace internal {
|
||||
void StreamedSource::Release() {
|
||||
parser.reset();
|
||||
info.reset();
|
||||
zone.reset();
|
||||
}
|
||||
|
||||
BackgroundParsingTask::BackgroundParsingTask(
|
||||
@ -29,10 +28,8 @@ BackgroundParsingTask::BackgroundParsingTask(
|
||||
|
||||
// Prepare the data for the internalization phase and compilation phase, which
|
||||
// will happen in the main thread after parsing.
|
||||
Zone* zone = new Zone(isolate->allocator(), ZONE_NAME);
|
||||
ParseInfo* info = new ParseInfo(zone);
|
||||
ParseInfo* info = new ParseInfo(isolate->allocator());
|
||||
info->set_toplevel();
|
||||
source->zone.reset(zone);
|
||||
source->info.reset(info);
|
||||
info->set_isolate(isolate);
|
||||
info->set_source_stream(source->source_stream.get());
|
||||
|
@ -38,7 +38,6 @@ struct StreamedSource {
|
||||
// between parsing and compilation. These need to be initialized before the
|
||||
// compilation starts.
|
||||
UnicodeCache unicode_cache;
|
||||
std::unique_ptr<Zone> zone;
|
||||
std::unique_ptr<ParseInfo> info;
|
||||
std::unique_ptr<Parser> parser;
|
||||
|
||||
|
@ -95,9 +95,8 @@ CompilerDispatcherJob::CompilerDispatcherJob(Isolate* isolate,
|
||||
shared_(Handle<SharedFunctionInfo>::cast(
|
||||
isolate_->global_handles()->Create(*shared))),
|
||||
max_stack_size_(max_stack_size),
|
||||
zone_(new Zone(isolate->allocator(), ZONE_NAME)),
|
||||
parse_info_(new ParseInfo(
|
||||
zone_.get(), Handle<Script>(Script::cast(shared->script())))),
|
||||
parse_info_(
|
||||
new ParseInfo(Handle<Script>(Script::cast(shared->script())))),
|
||||
compile_info_(
|
||||
new CompilationInfo(parse_info_.get(), Handle<JSFunction>::null())),
|
||||
trace_compiler_dispatcher_jobs_(FLAG_trace_compiler_dispatcher_jobs) {
|
||||
@ -134,11 +133,11 @@ void CompilerDispatcherJob::PrepareToParseOnMainThread() {
|
||||
}
|
||||
HandleScope scope(isolate_);
|
||||
unicode_cache_.reset(new UnicodeCache());
|
||||
zone_.reset(new Zone(isolate_->allocator(), ZONE_NAME));
|
||||
Handle<Script> script(Script::cast(shared_->script()), isolate_);
|
||||
DCHECK(script->type() != Script::TYPE_NATIVE);
|
||||
|
||||
Handle<String> source(String::cast(script->source()), isolate_);
|
||||
parse_info_.reset(new ParseInfo(isolate_->allocator()));
|
||||
if (source->IsExternalTwoByteString() || source->IsExternalOneByteString()) {
|
||||
character_stream_.reset(ScannerStream::For(
|
||||
source, shared_->start_position(), shared_->end_position()));
|
||||
@ -169,7 +168,7 @@ void CompilerDispatcherJob::PrepareToParseOnMainThread() {
|
||||
offset = shared_->start_position();
|
||||
|
||||
int byte_len = length * (source->IsOneByteRepresentation() ? 1 : 2);
|
||||
data = zone_->New(byte_len);
|
||||
data = parse_info_->zone()->New(byte_len);
|
||||
|
||||
DisallowHeapAllocation no_allocation;
|
||||
String::FlatContent content = source->GetFlatContent();
|
||||
@ -207,7 +206,6 @@ void CompilerDispatcherJob::PrepareToParseOnMainThread() {
|
||||
ScannerStream::For(wrapper_, shared_->start_position() - offset,
|
||||
shared_->end_position() - offset));
|
||||
}
|
||||
parse_info_.reset(new ParseInfo(zone_.get()));
|
||||
parse_info_->set_isolate(isolate_);
|
||||
parse_info_->set_character_stream(character_stream_.get());
|
||||
parse_info_->set_hash_seed(isolate_->heap()->HashSeed());
|
||||
@ -393,7 +391,6 @@ bool CompilerDispatcherJob::FinalizeCompilingOnMainThread() {
|
||||
return false;
|
||||
}
|
||||
|
||||
zone_.reset();
|
||||
compile_job_.reset();
|
||||
compile_info_.reset();
|
||||
handles_from_parsing_.reset();
|
||||
@ -417,7 +414,6 @@ void CompilerDispatcherJob::ResetOnMainThread() {
|
||||
character_stream_.reset();
|
||||
handles_from_parsing_.reset();
|
||||
parse_info_.reset();
|
||||
zone_.reset();
|
||||
|
||||
if (!source_.is_null()) {
|
||||
i::GlobalHandles::Destroy(Handle<Object>::cast(source_).location());
|
||||
|
@ -109,7 +109,6 @@ class V8_EXPORT_PRIVATE CompilerDispatcherJob {
|
||||
|
||||
// Members required for parsing.
|
||||
std::unique_ptr<UnicodeCache> unicode_cache_;
|
||||
std::unique_ptr<Zone> zone_;
|
||||
std::unique_ptr<Utf16CharacterStream> character_stream_;
|
||||
std::unique_ptr<ParseInfo> parse_info_;
|
||||
std::unique_ptr<Parser> parser_;
|
||||
|
@ -537,8 +537,7 @@ bool CompileUnoptimizedInnerFunctions(
|
||||
continue;
|
||||
} else {
|
||||
// Otherwise generate unoptimized code now.
|
||||
Zone zone(isolate->allocator(), ZONE_NAME);
|
||||
ParseInfo parse_info(&zone, script);
|
||||
ParseInfo parse_info(script);
|
||||
CompilationInfo info(&parse_info, Handle<JSFunction>::null());
|
||||
|
||||
parse_info.set_literal(literal);
|
||||
@ -925,8 +924,7 @@ MaybeHandle<Code> GetBaselineCode(Handle<JSFunction> function) {
|
||||
Isolate* isolate = function->GetIsolate();
|
||||
VMState<COMPILER> state(isolate);
|
||||
PostponeInterruptsScope postpone(isolate);
|
||||
Zone zone(isolate->allocator(), ZONE_NAME);
|
||||
ParseInfo parse_info(&zone, handle(function->shared()));
|
||||
ParseInfo parse_info(handle(function->shared()));
|
||||
CompilationInfo info(&parse_info, function);
|
||||
|
||||
DCHECK(function->shared()->is_compiled());
|
||||
@ -1059,8 +1057,7 @@ MaybeHandle<Code> GetLazyCode(Handle<JSFunction> function) {
|
||||
return entry;
|
||||
}
|
||||
|
||||
Zone zone(isolate->allocator(), ZONE_NAME);
|
||||
ParseInfo parse_info(&zone, handle(function->shared()));
|
||||
ParseInfo parse_info(handle(function->shared()));
|
||||
CompilationInfo info(&parse_info, function);
|
||||
Handle<Code> result;
|
||||
ASSIGN_RETURN_ON_EXCEPTION(isolate, result, GetUnoptimizedCode(&info), Code);
|
||||
@ -1241,8 +1238,7 @@ bool Compiler::CompileOptimized(Handle<JSFunction> function,
|
||||
code = isolate->builtins()->InterpreterEntryTrampoline();
|
||||
function->shared()->ReplaceCode(*code);
|
||||
} else {
|
||||
Zone zone(isolate->allocator(), ZONE_NAME);
|
||||
ParseInfo parse_info(&zone, handle(function->shared()));
|
||||
ParseInfo parse_info(handle(function->shared()));
|
||||
CompilationInfo info(&parse_info, function);
|
||||
if (!GetUnoptimizedCode(&info).ToHandle(&code)) {
|
||||
return false;
|
||||
@ -1266,8 +1262,7 @@ bool Compiler::CompileDebugCode(Handle<SharedFunctionInfo> shared) {
|
||||
DCHECK(AllowCompilation::IsAllowed(isolate));
|
||||
|
||||
// Start a compilation.
|
||||
Zone zone(isolate->allocator(), ZONE_NAME);
|
||||
ParseInfo parse_info(&zone, shared);
|
||||
ParseInfo parse_info(shared);
|
||||
CompilationInfo info(&parse_info, Handle<JSFunction>::null());
|
||||
info.MarkAsDebug();
|
||||
if (GetUnoptimizedCode(&info).is_null()) {
|
||||
@ -1294,8 +1289,7 @@ MaybeHandle<JSArray> Compiler::CompileForLiveEdit(Handle<Script> script) {
|
||||
script->set_shared_function_infos(isolate->heap()->empty_fixed_array());
|
||||
|
||||
// Start a compilation.
|
||||
Zone zone(isolate->allocator(), ZONE_NAME);
|
||||
ParseInfo parse_info(&zone, script);
|
||||
ParseInfo parse_info(script);
|
||||
CompilationInfo info(&parse_info, Handle<JSFunction>::null());
|
||||
info.MarkAsDebug();
|
||||
|
||||
@ -1306,7 +1300,7 @@ MaybeHandle<JSArray> Compiler::CompileForLiveEdit(Handle<Script> script) {
|
||||
// Check postconditions on success.
|
||||
DCHECK(!isolate->has_pending_exception());
|
||||
infos = LiveEditFunctionTracker::Collect(parse_info.literal(), script,
|
||||
&zone, isolate);
|
||||
parse_info.zone(), isolate);
|
||||
}
|
||||
|
||||
// Restore the original function info list in order to remain side-effect
|
||||
@ -1436,8 +1430,7 @@ MaybeHandle<JSFunction> Compiler::GetFunctionFromEval(
|
||||
script->set_compilation_type(Script::COMPILATION_TYPE_EVAL);
|
||||
Script::SetEvalOrigin(script, outer_info, eval_position);
|
||||
|
||||
Zone zone(isolate->allocator(), ZONE_NAME);
|
||||
ParseInfo parse_info(&zone, script);
|
||||
ParseInfo parse_info(script);
|
||||
CompilationInfo info(&parse_info, Handle<JSFunction>::null());
|
||||
parse_info.set_eval();
|
||||
parse_info.set_language_mode(language_mode);
|
||||
@ -1646,8 +1639,7 @@ Handle<SharedFunctionInfo> Compiler::GetSharedFunctionInfoForScript(
|
||||
}
|
||||
|
||||
// Compile the function and add it to the cache.
|
||||
Zone zone(isolate->allocator(), ZONE_NAME);
|
||||
ParseInfo parse_info(&zone, script);
|
||||
ParseInfo parse_info(script);
|
||||
CompilationInfo info(&parse_info, Handle<JSFunction>::null());
|
||||
if (resource_options.IsModule()) parse_info.set_module();
|
||||
if (compile_options != ScriptCompiler::kNoCompileOptions) {
|
||||
|
@ -549,8 +549,7 @@ Reduction JSInliner::ReduceJSCall(Node* node) {
|
||||
}
|
||||
}
|
||||
|
||||
Zone zone(info_->isolate()->allocator(), ZONE_NAME);
|
||||
ParseInfo parse_info(&zone, shared_info);
|
||||
ParseInfo parse_info(shared_info);
|
||||
CompilationInfo info(&parse_info, Handle<JSFunction>::null());
|
||||
if (info_->is_deoptimization_enabled()) info.MarkAsDeoptimizationEnabled();
|
||||
info.MarkAsOptimizeFromBytecode();
|
||||
@ -591,8 +590,8 @@ Reduction JSInliner::ReduceJSCall(Node* node) {
|
||||
// Run the BytecodeGraphBuilder to create the subgraph.
|
||||
Graph::SubgraphScope scope(graph());
|
||||
BytecodeGraphBuilder graph_builder(
|
||||
&zone, shared_info, feedback_vector, BailoutId::None(), jsgraph(),
|
||||
call.frequency(), source_positions_, inlining_id);
|
||||
parse_info.zone(), shared_info, feedback_vector, BailoutId::None(),
|
||||
jsgraph(), call.frequency(), source_positions_, inlining_id);
|
||||
graph_builder.CreateGraph(false);
|
||||
|
||||
// Extract the inlinee start/end nodes.
|
||||
|
@ -549,9 +549,8 @@ class PipelineCompilationJob final : public CompilationJob {
|
||||
// Note that the CompilationInfo is not initialized at the time we pass it
|
||||
// to the CompilationJob constructor, but it is not dereferenced there.
|
||||
: CompilationJob(isolate, &info_, "TurboFan"),
|
||||
zone_(isolate->allocator(), ZONE_NAME),
|
||||
parse_info_(handle(function->shared())),
|
||||
zone_stats_(isolate->allocator()),
|
||||
parse_info_(&zone_, handle(function->shared())),
|
||||
info_(&parse_info_, function),
|
||||
pipeline_statistics_(CreatePipelineStatistics(info(), &zone_stats_)),
|
||||
data_(&zone_stats_, info(), pipeline_statistics_.get()),
|
||||
@ -564,9 +563,8 @@ class PipelineCompilationJob final : public CompilationJob {
|
||||
Status FinalizeJobImpl() final;
|
||||
|
||||
private:
|
||||
Zone zone_;
|
||||
ZoneStats zone_stats_;
|
||||
ParseInfo parse_info_;
|
||||
ZoneStats zone_stats_;
|
||||
CompilationInfo info_;
|
||||
std::unique_ptr<PipelineStatistics> pipeline_statistics_;
|
||||
PipelineData data_;
|
||||
@ -603,7 +601,8 @@ PipelineCompilationJob::Status PipelineCompilationJob::PrepareJobImpl() {
|
||||
info()->MarkAsInliningEnabled();
|
||||
}
|
||||
|
||||
linkage_ = new (&zone_) Linkage(Linkage::ComputeIncoming(&zone_, info()));
|
||||
linkage_ = new (info()->zone())
|
||||
Linkage(Linkage::ComputeIncoming(info()->zone(), info()));
|
||||
|
||||
if (!pipeline_.CreateGraph()) {
|
||||
if (isolate()->has_pending_exception()) return FAILED; // Stack overflowed.
|
||||
|
@ -8041,7 +8041,7 @@ bool HOptimizedGraphBuilder::TryInline(Handle<JSFunction> target,
|
||||
// Use the same AstValueFactory for creating strings in the sub-compilation
|
||||
// step, but don't transfer ownership to target_info.
|
||||
Handle<SharedFunctionInfo> target_shared(target->shared());
|
||||
ParseInfo parse_info(zone(), target_shared);
|
||||
ParseInfo parse_info(target_shared, top_info()->parse_info()->zone_shared());
|
||||
parse_info.set_ast_value_factory(
|
||||
top_info()->parse_info()->ast_value_factory());
|
||||
parse_info.set_ast_value_factory_owned(false);
|
||||
|
@ -37,8 +37,7 @@ class HCompilationJob final : public CompilationJob {
|
||||
public:
|
||||
explicit HCompilationJob(Handle<JSFunction> function)
|
||||
: CompilationJob(function->GetIsolate(), &info_, "Crankshaft"),
|
||||
zone_(function->GetIsolate()->allocator(), ZONE_NAME),
|
||||
parse_info_(&zone_, handle(function->shared())),
|
||||
parse_info_(handle(function->shared())),
|
||||
info_(&parse_info_, function),
|
||||
graph_(nullptr),
|
||||
chunk_(nullptr) {}
|
||||
@ -49,7 +48,6 @@ class HCompilationJob final : public CompilationJob {
|
||||
virtual Status FinalizeJobImpl();
|
||||
|
||||
private:
|
||||
Zone zone_;
|
||||
ParseInfo parse_info_;
|
||||
CompilationInfo info_;
|
||||
HGraph* graph_;
|
||||
|
@ -87,12 +87,11 @@ ScopeIterator::ScopeIterator(Isolate* isolate, FrameInspector* frame_inspector,
|
||||
|
||||
// Reparse the code and analyze the scopes.
|
||||
// Check whether we are in global, eval or function code.
|
||||
Zone zone(isolate->allocator(), ZONE_NAME);
|
||||
std::unique_ptr<ParseInfo> info;
|
||||
if (scope_info->scope_type() != FUNCTION_SCOPE) {
|
||||
// Global or eval code.
|
||||
Handle<Script> script(Script::cast(shared_info->script()));
|
||||
info.reset(new ParseInfo(&zone, script));
|
||||
info.reset(new ParseInfo(script));
|
||||
if (scope_info->scope_type() == EVAL_SCOPE) {
|
||||
info->set_eval();
|
||||
if (!function->context()->IsNativeContext()) {
|
||||
@ -108,7 +107,7 @@ ScopeIterator::ScopeIterator(Isolate* isolate, FrameInspector* frame_inspector,
|
||||
}
|
||||
} else {
|
||||
// Inner function.
|
||||
info.reset(new ParseInfo(&zone, shared_info));
|
||||
info.reset(new ParseInfo(shared_info));
|
||||
}
|
||||
if (parsing::ParseAny(info.get()) && Rewriter::Rewrite(info.get())) {
|
||||
DeclarationScope* scope = info->literal()->scope();
|
||||
|
@ -9,12 +9,13 @@
|
||||
#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(Zone* zone)
|
||||
: zone_(zone),
|
||||
ParseInfo::ParseInfo(AccountingAllocator* zone_allocator)
|
||||
: zone_(std::make_shared<Zone>(zone_allocator, ZONE_NAME)),
|
||||
flags_(0),
|
||||
source_stream_(nullptr),
|
||||
source_stream_encoding_(ScriptCompiler::StreamedSource::ONE_BYTE),
|
||||
@ -37,8 +38,8 @@ ParseInfo::ParseInfo(Zone* zone)
|
||||
function_name_(nullptr),
|
||||
literal_(nullptr) {}
|
||||
|
||||
ParseInfo::ParseInfo(Zone* zone, Handle<SharedFunctionInfo> shared)
|
||||
: ParseInfo(zone) {
|
||||
ParseInfo::ParseInfo(Handle<SharedFunctionInfo> shared)
|
||||
: ParseInfo(shared->GetIsolate()->allocator()) {
|
||||
isolate_ = shared->GetIsolate();
|
||||
|
||||
set_toplevel(shared->is_toplevel());
|
||||
@ -68,7 +69,14 @@ ParseInfo::ParseInfo(Zone* zone, Handle<SharedFunctionInfo> shared)
|
||||
}
|
||||
}
|
||||
|
||||
ParseInfo::ParseInfo(Zone* zone, Handle<Script> script) : ParseInfo(zone) {
|
||||
ParseInfo::ParseInfo(Handle<SharedFunctionInfo> shared,
|
||||
std::shared_ptr<Zone> zone)
|
||||
: ParseInfo(shared) {
|
||||
zone_.swap(zone);
|
||||
}
|
||||
|
||||
ParseInfo::ParseInfo(Handle<Script> script)
|
||||
: ParseInfo(script->GetIsolate()->allocator()) {
|
||||
isolate_ = script->GetIsolate();
|
||||
|
||||
set_allow_lazy_parsing();
|
||||
|
@ -5,6 +5,8 @@
|
||||
#ifndef V8_PARSING_PARSE_INFO_H_
|
||||
#define V8_PARSING_PARSE_INFO_H_
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "include/v8.h"
|
||||
#include "src/globals.h"
|
||||
#include "src/handles.h"
|
||||
@ -16,6 +18,7 @@ class Extension;
|
||||
|
||||
namespace internal {
|
||||
|
||||
class AccountingAllocator;
|
||||
class AstRawString;
|
||||
class AstValueFactory;
|
||||
class DeclarationScope;
|
||||
@ -29,13 +32,18 @@ class Zone;
|
||||
// A container for the inputs, configuration options, and outputs of parsing.
|
||||
class V8_EXPORT_PRIVATE ParseInfo {
|
||||
public:
|
||||
explicit ParseInfo(Zone* zone);
|
||||
ParseInfo(Zone* zone, Handle<Script> script);
|
||||
ParseInfo(Zone* zone, Handle<SharedFunctionInfo> shared);
|
||||
explicit ParseInfo(AccountingAllocator* zone_allocator);
|
||||
ParseInfo(Handle<Script> script);
|
||||
ParseInfo(Handle<SharedFunctionInfo> shared);
|
||||
|
||||
// TODO(rmcilroy): Remove once Hydrogen no longer needs this.
|
||||
ParseInfo(Handle<SharedFunctionInfo> shared, std::shared_ptr<Zone> zone);
|
||||
|
||||
~ParseInfo();
|
||||
|
||||
Zone* zone() const { return zone_; }
|
||||
Zone* zone() const { return zone_.get(); }
|
||||
|
||||
std::shared_ptr<Zone> zone_shared() const { return zone_; }
|
||||
|
||||
// Convenience accessor methods for flags.
|
||||
#define FLAG_ACCESSOR(flag, getter, setter) \
|
||||
@ -226,7 +234,7 @@ class V8_EXPORT_PRIVATE ParseInfo {
|
||||
};
|
||||
|
||||
//------------- Inputs to parsing and scope analysis -----------------------
|
||||
Zone* zone_;
|
||||
std::shared_ptr<Zone> zone_;
|
||||
unsigned flags_;
|
||||
ScriptCompiler::ExternalSourceStream* source_stream_;
|
||||
ScriptCompiler::StreamedSource::Encoding source_stream_encoding_;
|
||||
|
@ -352,8 +352,7 @@ bool ComputeLocation(Isolate* isolate, MessageLocation* target) {
|
||||
Handle<String> RenderCallSite(Isolate* isolate, Handle<Object> object) {
|
||||
MessageLocation location;
|
||||
if (ComputeLocation(isolate, &location)) {
|
||||
Zone zone(isolate->allocator(), ZONE_NAME);
|
||||
std::unique_ptr<ParseInfo> info(new ParseInfo(&zone, location.shared()));
|
||||
std::unique_ptr<ParseInfo> info(new ParseInfo(location.shared()));
|
||||
if (parsing::ParseAny(info.get())) {
|
||||
CallPrinter printer(isolate, location.shared()->IsUserJavaScript());
|
||||
Handle<String> str = printer.Print(info->literal(), location.start_pos());
|
||||
|
@ -45,33 +45,32 @@ class AsmTyperHarnessBuilder {
|
||||
: source_(source),
|
||||
validation_type_(type),
|
||||
handles_(),
|
||||
zone_(handles_.main_zone()),
|
||||
isolate_(CcTest::i_isolate()),
|
||||
ast_value_factory_(zone_, isolate_->ast_string_constants(),
|
||||
isolate_->heap()->HashSeed()),
|
||||
factory_(isolate_->factory()),
|
||||
source_code_(
|
||||
factory_->NewStringFromUtf8(CStrVector(source)).ToHandleChecked()),
|
||||
script_(factory_->NewScript(source_code_)) {
|
||||
ParseInfo info(zone_, script_);
|
||||
info.set_allow_lazy_parsing(false);
|
||||
info.set_toplevel(true);
|
||||
info.set_ast_value_factory(&ast_value_factory_);
|
||||
info.set_ast_value_factory_owned(false);
|
||||
Parser parser(&info);
|
||||
script_(factory_->NewScript(source_code_)),
|
||||
info_(script_),
|
||||
ast_value_factory_(info_.zone(), isolate_->ast_string_constants(),
|
||||
isolate_->heap()->HashSeed()) {
|
||||
info_.set_allow_lazy_parsing(false);
|
||||
info_.set_toplevel(true);
|
||||
info_.set_ast_value_factory(&ast_value_factory_);
|
||||
info_.set_ast_value_factory_owned(false);
|
||||
Parser parser(&info_);
|
||||
|
||||
if (!Compiler::ParseAndAnalyze(&info)) {
|
||||
if (!Compiler::ParseAndAnalyze(&info_)) {
|
||||
std::cerr << "Failed to parse:\n" << source_ << "\n";
|
||||
CHECK(false);
|
||||
}
|
||||
|
||||
outer_scope_ = info.script_scope();
|
||||
module_ = info.scope()
|
||||
outer_scope_ = info_.script_scope();
|
||||
module_ = info_.scope()
|
||||
->declarations()
|
||||
->AtForTest(0)
|
||||
->AsFunctionDeclaration()
|
||||
->fun();
|
||||
typer_.reset(new AsmTyper(isolate_, zone_, script_, module_));
|
||||
typer_.reset(new AsmTyper(isolate_, zone(), script_, module_));
|
||||
|
||||
if (validation_type_ == ValidateStatement ||
|
||||
validation_type_ == ValidateExpression) {
|
||||
@ -104,7 +103,7 @@ class AsmTyperHarnessBuilder {
|
||||
if (var->IsUnallocated()) {
|
||||
var->AllocateTo(VariableLocation::LOCAL, -1);
|
||||
}
|
||||
auto* var_info = new (zone_) AsmTyper::VariableInfo(type);
|
||||
auto* var_info = new (zone()) AsmTyper::VariableInfo(type);
|
||||
var_info->set_mutability(AsmTyper::VariableInfo::kLocal);
|
||||
CHECK(typer_->AddLocal(var, var_info));
|
||||
return this;
|
||||
@ -116,7 +115,7 @@ class AsmTyperHarnessBuilder {
|
||||
var->AllocateTo(VariableLocation::MODULE, -1);
|
||||
}
|
||||
if (type != nullptr) {
|
||||
auto* var_info = new (zone_) AsmTyper::VariableInfo(type);
|
||||
auto* var_info = new (zone()) AsmTyper::VariableInfo(type);
|
||||
var_info->set_mutability(AsmTyper::VariableInfo::kMutableGlobal);
|
||||
CHECK(typer_->AddGlobal(var, var_info));
|
||||
}
|
||||
@ -125,12 +124,12 @@ class AsmTyperHarnessBuilder {
|
||||
|
||||
AsmTyperHarnessBuilder* WithGlobal(
|
||||
VariableName var_name, std::function<AsmType*(Zone*)> type_creator) {
|
||||
return WithGlobal(var_name, type_creator(zone_));
|
||||
return WithGlobal(var_name, type_creator(zone()));
|
||||
}
|
||||
|
||||
AsmTyperHarnessBuilder* WithUndefinedGlobal(
|
||||
VariableName var_name, std::function<AsmType*(Zone*)> type_creator) {
|
||||
auto* type = type_creator(zone_);
|
||||
auto* type = type_creator(zone());
|
||||
CHECK(type->AsFunctionType() != nullptr ||
|
||||
type->AsFunctionTableType() != nullptr);
|
||||
WithGlobal(var_name, type);
|
||||
@ -157,7 +156,8 @@ class AsmTyperHarnessBuilder {
|
||||
CHECK(false);
|
||||
case AsmTyper::kFFI:
|
||||
stdlib_map = nullptr;
|
||||
var_info = new (zone_) AsmTyper::VariableInfo(AsmType::FFIType(zone_));
|
||||
var_info =
|
||||
new (zone()) AsmTyper::VariableInfo(AsmType::FFIType(zone()));
|
||||
var_info->set_mutability(AsmTyper::VariableInfo::kImmutableGlobal);
|
||||
break;
|
||||
case AsmTyper::kInfinity:
|
||||
@ -176,7 +176,7 @@ class AsmTyperHarnessBuilder {
|
||||
}
|
||||
|
||||
CHECK(var_info != nullptr);
|
||||
var_info = var_info->Clone(zone_);
|
||||
var_info = var_info->Clone(zone());
|
||||
}
|
||||
|
||||
CHECK(typer_->AddGlobal(var, var_info));
|
||||
@ -193,7 +193,7 @@ class AsmTyperHarnessBuilder {
|
||||
AsmTyperHarnessBuilder* WithStdlib(VariableName var_name) {
|
||||
auto* var = DeclareVariable(var_name);
|
||||
auto* var_info =
|
||||
AsmTyper::VariableInfo::ForSpecialSymbol(zone_, AsmTyper::kStdlib);
|
||||
AsmTyper::VariableInfo::ForSpecialSymbol(zone(), AsmTyper::kStdlib);
|
||||
CHECK(typer_->AddGlobal(var, var_info));
|
||||
return this;
|
||||
}
|
||||
@ -201,7 +201,7 @@ class AsmTyperHarnessBuilder {
|
||||
AsmTyperHarnessBuilder* WithHeap(VariableName var_name) {
|
||||
auto* var = DeclareVariable(var_name);
|
||||
auto* var_info =
|
||||
AsmTyper::VariableInfo::ForSpecialSymbol(zone_, AsmTyper::kHeap);
|
||||
AsmTyper::VariableInfo::ForSpecialSymbol(zone(), AsmTyper::kHeap);
|
||||
CHECK(typer_->AddGlobal(var, var_info));
|
||||
return this;
|
||||
}
|
||||
@ -209,7 +209,7 @@ class AsmTyperHarnessBuilder {
|
||||
AsmTyperHarnessBuilder* WithFFI(VariableName var_name) {
|
||||
auto* var = DeclareVariable(var_name);
|
||||
auto* var_info =
|
||||
AsmTyper::VariableInfo::ForSpecialSymbol(zone_, AsmTyper::kFFI);
|
||||
AsmTyper::VariableInfo::ForSpecialSymbol(zone(), AsmTyper::kFFI);
|
||||
CHECK(typer_->AddGlobal(var, var_info));
|
||||
return this;
|
||||
}
|
||||
@ -305,7 +305,7 @@ class AsmTyperHarnessBuilder {
|
||||
}
|
||||
|
||||
bool ValidateAllStatements(FunctionDeclaration* fun_decl) {
|
||||
AsmTyper::FlattenedStatements iter(zone_, fun_decl->fun()->body());
|
||||
AsmTyper::FlattenedStatements iter(zone(), fun_decl->fun()->body());
|
||||
while (auto* curr = iter.Next()) {
|
||||
if (typer_->ValidateStatement(curr) == AsmType::None()) {
|
||||
return false;
|
||||
@ -315,7 +315,7 @@ class AsmTyperHarnessBuilder {
|
||||
}
|
||||
|
||||
AsmType* ValidateExpressionStatment(FunctionDeclaration* fun_decl) {
|
||||
AsmTyper::FlattenedStatements iter(zone_, fun_decl->fun()->body());
|
||||
AsmTyper::FlattenedStatements iter(zone(), fun_decl->fun()->body());
|
||||
AsmType* ret = AsmType::None();
|
||||
bool last_was_expression_statement = false;
|
||||
while (auto* curr = iter.Next()) {
|
||||
@ -337,15 +337,17 @@ class AsmTyperHarnessBuilder {
|
||||
return ret;
|
||||
}
|
||||
|
||||
Zone* zone() { return info_.zone(); }
|
||||
|
||||
std::string source_;
|
||||
ValidationType validation_type_;
|
||||
HandleAndZoneScope handles_;
|
||||
Zone* zone_;
|
||||
Isolate* isolate_;
|
||||
AstValueFactory ast_value_factory_;
|
||||
Factory* factory_;
|
||||
Handle<String> source_code_;
|
||||
Handle<Script> script_;
|
||||
ParseInfo info_;
|
||||
AstValueFactory ast_value_factory_;
|
||||
|
||||
DeclarationScope* outer_scope_;
|
||||
FunctionLiteral* module_;
|
||||
|
@ -155,8 +155,7 @@ Handle<JSFunction> FunctionTester::ForMachineGraph(Graph* graph,
|
||||
}
|
||||
|
||||
Handle<JSFunction> FunctionTester::Compile(Handle<JSFunction> function) {
|
||||
Zone zone(function->GetIsolate()->allocator(), ZONE_NAME);
|
||||
ParseInfo parse_info(&zone, handle(function->shared()));
|
||||
ParseInfo parse_info(handle(function->shared()));
|
||||
CompilationInfo info(&parse_info, function);
|
||||
|
||||
info.SetOptimizing();
|
||||
@ -185,8 +184,7 @@ Handle<JSFunction> FunctionTester::Compile(Handle<JSFunction> function) {
|
||||
// Compile the given machine graph instead of the source of the function
|
||||
// and replace the JSFunction's code with the result.
|
||||
Handle<JSFunction> FunctionTester::CompileGraph(Graph* graph) {
|
||||
Zone zone(function->GetIsolate()->allocator(), ZONE_NAME);
|
||||
ParseInfo parse_info(&zone, handle(function->shared()));
|
||||
ParseInfo parse_info(handle(function->shared()));
|
||||
CompilationInfo info(&parse_info, function);
|
||||
|
||||
CHECK(parsing::ParseFunction(info.parse_info()));
|
||||
|
@ -43,7 +43,7 @@ static Handle<JSFunction> Compile(const char* source) {
|
||||
TEST(TestLinkageCreate) {
|
||||
HandleAndZoneScope handles;
|
||||
Handle<JSFunction> function = Compile("a + b");
|
||||
ParseInfo parse_info(handles.main_zone(), handle(function->shared()));
|
||||
ParseInfo parse_info(handle(function->shared()));
|
||||
CompilationInfo info(&parse_info, function);
|
||||
CallDescriptor* descriptor = Linkage::ComputeIncoming(info.zone(), &info);
|
||||
CHECK(descriptor);
|
||||
@ -59,7 +59,7 @@ TEST(TestLinkageJSFunctionIncoming) {
|
||||
Handle<JSFunction> function =
|
||||
Handle<JSFunction>::cast(v8::Utils::OpenHandle(
|
||||
*v8::Local<v8::Function>::Cast(CompileRun(sources[i]))));
|
||||
ParseInfo parse_info(handles.main_zone(), handle(function->shared()));
|
||||
ParseInfo parse_info(handle(function->shared()));
|
||||
CompilationInfo info(&parse_info, function);
|
||||
CallDescriptor* descriptor = Linkage::ComputeIncoming(info.zone(), &info);
|
||||
CHECK(descriptor);
|
||||
@ -75,7 +75,7 @@ TEST(TestLinkageJSFunctionIncoming) {
|
||||
TEST(TestLinkageJSCall) {
|
||||
HandleAndZoneScope handles;
|
||||
Handle<JSFunction> function = Compile("a + c");
|
||||
ParseInfo parse_info(handles.main_zone(), handle(function->shared()));
|
||||
ParseInfo parse_info(handle(function->shared()));
|
||||
CompilationInfo info(&parse_info, function);
|
||||
|
||||
for (int i = 0; i < 32; i++) {
|
||||
|
@ -33,7 +33,7 @@ struct TestHelper : public HandleAndZoneScope {
|
||||
|
||||
void CheckLoopAssignedCount(int expected, const char* var_name) {
|
||||
// TODO(titzer): don't scope analyze every single time.
|
||||
ParseInfo parse_info(main_zone(), handle(function->shared()));
|
||||
ParseInfo parse_info(handle(function->shared()));
|
||||
CompilationInfo info(&parse_info, function);
|
||||
|
||||
CHECK(parsing::ParseFunction(&parse_info));
|
||||
|
@ -74,9 +74,9 @@ class BytecodeGraphCallable {
|
||||
|
||||
class BytecodeGraphTester {
|
||||
public:
|
||||
BytecodeGraphTester(Isolate* isolate, Zone* zone, const char* script,
|
||||
BytecodeGraphTester(Isolate* isolate, const char* script,
|
||||
const char* filter = kFunctionName)
|
||||
: isolate_(isolate), zone_(zone), script_(script) {
|
||||
: isolate_(isolate), script_(script) {
|
||||
i::FLAG_ignition = true;
|
||||
i::FLAG_always_opt = false;
|
||||
i::FLAG_allow_natives_syntax = true;
|
||||
@ -108,7 +108,6 @@ class BytecodeGraphTester {
|
||||
|
||||
private:
|
||||
Isolate* isolate_;
|
||||
Zone* zone_;
|
||||
const char* script_;
|
||||
|
||||
Handle<JSFunction> GetFunction(const char* functionName) {
|
||||
@ -123,7 +122,7 @@ class BytecodeGraphTester {
|
||||
|
||||
// TODO(mstarzinger): We should be able to prime CompilationInfo without
|
||||
// having to instantiate a ParseInfo first. Fix this!
|
||||
ParseInfo parse_info(zone_, handle(function->shared()));
|
||||
ParseInfo parse_info(handle(function->shared()));
|
||||
|
||||
CompilationInfo compilation_info(&parse_info, function);
|
||||
compilation_info.SetOptimizing();
|
||||
@ -187,7 +186,6 @@ struct ExpectedSnippet {
|
||||
TEST(BytecodeGraphBuilderReturnStatements) {
|
||||
HandleAndZoneScope scope;
|
||||
Isolate* isolate = scope.main_isolate();
|
||||
Zone* zone = scope.main_zone();
|
||||
Factory* factory = isolate->factory();
|
||||
|
||||
ExpectedSnippet<0> snippets[] = {
|
||||
@ -212,7 +210,7 @@ TEST(BytecodeGraphBuilderReturnStatements) {
|
||||
SNPrintF(script, "function %s() { %s }\n%s();", kFunctionName,
|
||||
snippets[i].code_snippet, kFunctionName);
|
||||
|
||||
BytecodeGraphTester tester(isolate, zone, script.start());
|
||||
BytecodeGraphTester tester(isolate, script.start());
|
||||
auto callable = tester.GetCallable<>();
|
||||
Handle<Object> return_value = callable().ToHandleChecked();
|
||||
CHECK(return_value->SameValue(*snippets[i].return_value()));
|
||||
@ -223,7 +221,6 @@ TEST(BytecodeGraphBuilderReturnStatements) {
|
||||
TEST(BytecodeGraphBuilderPrimitiveExpressions) {
|
||||
HandleAndZoneScope scope;
|
||||
Isolate* isolate = scope.main_isolate();
|
||||
Zone* zone = scope.main_zone();
|
||||
Factory* factory = isolate->factory();
|
||||
|
||||
ExpectedSnippet<0> snippets[] = {
|
||||
@ -239,7 +236,7 @@ TEST(BytecodeGraphBuilderPrimitiveExpressions) {
|
||||
SNPrintF(script, "function %s() { %s }\n%s();", kFunctionName,
|
||||
snippets[i].code_snippet, kFunctionName);
|
||||
|
||||
BytecodeGraphTester tester(isolate, zone, script.start());
|
||||
BytecodeGraphTester tester(isolate, script.start());
|
||||
auto callable = tester.GetCallable<>();
|
||||
Handle<Object> return_value = callable().ToHandleChecked();
|
||||
CHECK(return_value->SameValue(*snippets[i].return_value()));
|
||||
@ -250,7 +247,6 @@ TEST(BytecodeGraphBuilderPrimitiveExpressions) {
|
||||
TEST(BytecodeGraphBuilderTwoParameterTests) {
|
||||
HandleAndZoneScope scope;
|
||||
Isolate* isolate = scope.main_isolate();
|
||||
Zone* zone = scope.main_zone();
|
||||
Factory* factory = isolate->factory();
|
||||
|
||||
ExpectedSnippet<2> snippets[] = {
|
||||
@ -297,7 +293,7 @@ TEST(BytecodeGraphBuilderTwoParameterTests) {
|
||||
SNPrintF(script, "function %s(p1, p2) { %s }\n%s(0, 0);", kFunctionName,
|
||||
snippets[i].code_snippet, kFunctionName);
|
||||
|
||||
BytecodeGraphTester tester(isolate, zone, script.start());
|
||||
BytecodeGraphTester tester(isolate, script.start());
|
||||
auto callable = tester.GetCallable<Handle<Object>, Handle<Object>>();
|
||||
Handle<Object> return_value =
|
||||
callable(snippets[i].parameter(0), snippets[i].parameter(1))
|
||||
@ -310,7 +306,6 @@ TEST(BytecodeGraphBuilderTwoParameterTests) {
|
||||
TEST(BytecodeGraphBuilderNamedLoad) {
|
||||
HandleAndZoneScope scope;
|
||||
Isolate* isolate = scope.main_isolate();
|
||||
Zone* zone = scope.main_zone();
|
||||
Factory* factory = isolate->factory();
|
||||
|
||||
ExpectedSnippet<1> snippets[] = {
|
||||
@ -341,7 +336,7 @@ TEST(BytecodeGraphBuilderNamedLoad) {
|
||||
SNPrintF(script, "function %s(p1) { %s };\n%s(0);", kFunctionName,
|
||||
snippets[i].code_snippet, kFunctionName);
|
||||
|
||||
BytecodeGraphTester tester(isolate, zone, script.start());
|
||||
BytecodeGraphTester tester(isolate, script.start());
|
||||
auto callable = tester.GetCallable<Handle<Object>>();
|
||||
Handle<Object> return_value =
|
||||
callable(snippets[i].parameter(0)).ToHandleChecked();
|
||||
@ -353,7 +348,6 @@ TEST(BytecodeGraphBuilderNamedLoad) {
|
||||
TEST(BytecodeGraphBuilderKeyedLoad) {
|
||||
HandleAndZoneScope scope;
|
||||
Isolate* isolate = scope.main_isolate();
|
||||
Zone* zone = scope.main_zone();
|
||||
Factory* factory = isolate->factory();
|
||||
|
||||
ExpectedSnippet<2> snippets[] = {
|
||||
@ -397,7 +391,7 @@ TEST(BytecodeGraphBuilderKeyedLoad) {
|
||||
SNPrintF(script, "function %s(p1, p2) { %s };\n%s(0);", kFunctionName,
|
||||
snippets[i].code_snippet, kFunctionName);
|
||||
|
||||
BytecodeGraphTester tester(isolate, zone, script.start());
|
||||
BytecodeGraphTester tester(isolate, script.start());
|
||||
auto callable = tester.GetCallable<Handle<Object>, Handle<Object>>();
|
||||
Handle<Object> return_value =
|
||||
callable(snippets[i].parameter(0), snippets[i].parameter(1))
|
||||
@ -409,7 +403,6 @@ TEST(BytecodeGraphBuilderKeyedLoad) {
|
||||
void TestBytecodeGraphBuilderNamedStore(size_t shard) {
|
||||
HandleAndZoneScope scope;
|
||||
Isolate* isolate = scope.main_isolate();
|
||||
Zone* zone = scope.main_zone();
|
||||
Factory* factory = isolate->factory();
|
||||
|
||||
ExpectedSnippet<1> snippets[] = {
|
||||
@ -447,7 +440,7 @@ void TestBytecodeGraphBuilderNamedStore(size_t shard) {
|
||||
SNPrintF(script, "function %s(p1) { %s };\n%s({});", kFunctionName,
|
||||
snippets[i].code_snippet, kFunctionName);
|
||||
|
||||
BytecodeGraphTester tester(isolate, zone, script.start());
|
||||
BytecodeGraphTester tester(isolate, script.start());
|
||||
auto callable = tester.GetCallable<Handle<Object>>();
|
||||
Handle<Object> return_value =
|
||||
callable(snippets[i].parameter(0)).ToHandleChecked();
|
||||
@ -460,7 +453,6 @@ SHARD_TEST_BY_2(BytecodeGraphBuilderNamedStore)
|
||||
void TestBytecodeGraphBuilderKeyedStore(size_t shard) {
|
||||
HandleAndZoneScope scope;
|
||||
Isolate* isolate = scope.main_isolate();
|
||||
Zone* zone = scope.main_zone();
|
||||
Factory* factory = isolate->factory();
|
||||
|
||||
ExpectedSnippet<2> snippets[] = {
|
||||
@ -506,7 +498,7 @@ void TestBytecodeGraphBuilderKeyedStore(size_t shard) {
|
||||
SNPrintF(script, "function %s(p1, p2) { %s };\n%s({});", kFunctionName,
|
||||
snippets[i].code_snippet, kFunctionName);
|
||||
|
||||
BytecodeGraphTester tester(isolate, zone, script.start());
|
||||
BytecodeGraphTester tester(isolate, script.start());
|
||||
auto callable = tester.GetCallable<Handle<Object>>();
|
||||
Handle<Object> return_value =
|
||||
callable(snippets[i].parameter(0)).ToHandleChecked();
|
||||
@ -519,7 +511,6 @@ SHARD_TEST_BY_2(BytecodeGraphBuilderKeyedStore)
|
||||
TEST(BytecodeGraphBuilderPropertyCall) {
|
||||
HandleAndZoneScope scope;
|
||||
Isolate* isolate = scope.main_isolate();
|
||||
Zone* zone = scope.main_zone();
|
||||
Factory* factory = isolate->factory();
|
||||
|
||||
ExpectedSnippet<1> snippets[] = {
|
||||
@ -541,7 +532,7 @@ TEST(BytecodeGraphBuilderPropertyCall) {
|
||||
SNPrintF(script, "function %s(p1) { %s };\n%s({func() {}});", kFunctionName,
|
||||
snippets[i].code_snippet, kFunctionName);
|
||||
|
||||
BytecodeGraphTester tester(isolate, zone, script.start());
|
||||
BytecodeGraphTester tester(isolate, script.start());
|
||||
auto callable = tester.GetCallable<Handle<Object>>();
|
||||
Handle<Object> return_value =
|
||||
callable(snippets[i].parameter(0)).ToHandleChecked();
|
||||
@ -553,7 +544,6 @@ TEST(BytecodeGraphBuilderPropertyCall) {
|
||||
TEST(BytecodeGraphBuilderCallNew) {
|
||||
HandleAndZoneScope scope;
|
||||
Isolate* isolate = scope.main_isolate();
|
||||
Zone* zone = scope.main_zone();
|
||||
Factory* factory = isolate->factory();
|
||||
|
||||
ExpectedSnippet<0> snippets[] = {
|
||||
@ -580,7 +570,7 @@ TEST(BytecodeGraphBuilderCallNew) {
|
||||
};
|
||||
|
||||
for (size_t i = 0; i < arraysize(snippets); i++) {
|
||||
BytecodeGraphTester tester(isolate, zone, snippets[i].code_snippet);
|
||||
BytecodeGraphTester tester(isolate, snippets[i].code_snippet);
|
||||
auto callable = tester.GetCallable<>();
|
||||
Handle<Object> return_value = callable().ToHandleChecked();
|
||||
CHECK(return_value->SameValue(*snippets[i].return_value()));
|
||||
@ -591,7 +581,6 @@ TEST(BytecodeGraphBuilderCallNew) {
|
||||
TEST(BytecodeGraphBuilderCreateClosure) {
|
||||
HandleAndZoneScope scope;
|
||||
Isolate* isolate = scope.main_isolate();
|
||||
Zone* zone = scope.main_zone();
|
||||
Factory* factory = isolate->factory();
|
||||
|
||||
ExpectedSnippet<0> snippets[] = {
|
||||
@ -618,7 +607,7 @@ TEST(BytecodeGraphBuilderCreateClosure) {
|
||||
};
|
||||
|
||||
for (size_t i = 0; i < arraysize(snippets); i++) {
|
||||
BytecodeGraphTester tester(isolate, zone, snippets[i].code_snippet);
|
||||
BytecodeGraphTester tester(isolate, snippets[i].code_snippet);
|
||||
auto callable = tester.GetCallable<>();
|
||||
Handle<Object> return_value = callable().ToHandleChecked();
|
||||
CHECK(return_value->SameValue(*snippets[i].return_value()));
|
||||
@ -629,7 +618,6 @@ TEST(BytecodeGraphBuilderCreateClosure) {
|
||||
TEST(BytecodeGraphBuilderCallRuntime) {
|
||||
HandleAndZoneScope scope;
|
||||
Isolate* isolate = scope.main_isolate();
|
||||
Zone* zone = scope.main_zone();
|
||||
Factory* factory = isolate->factory();
|
||||
|
||||
ExpectedSnippet<1> snippets[] = {
|
||||
@ -645,7 +633,7 @@ TEST(BytecodeGraphBuilderCallRuntime) {
|
||||
};
|
||||
|
||||
for (size_t i = 0; i < arraysize(snippets); i++) {
|
||||
BytecodeGraphTester tester(isolate, zone, snippets[i].code_snippet);
|
||||
BytecodeGraphTester tester(isolate, snippets[i].code_snippet);
|
||||
auto callable = tester.GetCallable<Handle<Object>>();
|
||||
Handle<Object> return_value =
|
||||
callable(snippets[i].parameter(0)).ToHandleChecked();
|
||||
@ -656,7 +644,6 @@ TEST(BytecodeGraphBuilderCallRuntime) {
|
||||
TEST(BytecodeGraphBuilderInvokeIntrinsic) {
|
||||
HandleAndZoneScope scope;
|
||||
Isolate* isolate = scope.main_isolate();
|
||||
Zone* zone = scope.main_zone();
|
||||
Factory* factory = isolate->factory();
|
||||
|
||||
ExpectedSnippet<1> snippets[] = {
|
||||
@ -667,7 +654,7 @@ TEST(BytecodeGraphBuilderInvokeIntrinsic) {
|
||||
};
|
||||
|
||||
for (size_t i = 0; i < arraysize(snippets); i++) {
|
||||
BytecodeGraphTester tester(isolate, zone, snippets[i].code_snippet);
|
||||
BytecodeGraphTester tester(isolate, snippets[i].code_snippet);
|
||||
auto callable = tester.GetCallable<Handle<Object>>();
|
||||
Handle<Object> return_value =
|
||||
callable(snippets[i].parameter(0)).ToHandleChecked();
|
||||
@ -678,7 +665,6 @@ TEST(BytecodeGraphBuilderInvokeIntrinsic) {
|
||||
void TestBytecodeGraphBuilderGlobals(size_t shard) {
|
||||
HandleAndZoneScope scope;
|
||||
Isolate* isolate = scope.main_isolate();
|
||||
Zone* zone = scope.main_zone();
|
||||
Factory* factory = isolate->factory();
|
||||
|
||||
ExpectedSnippet<0> snippets[] = {
|
||||
@ -717,7 +703,7 @@ void TestBytecodeGraphBuilderGlobals(size_t shard) {
|
||||
|
||||
for (size_t i = 0; i < arraysize(snippets); i++) {
|
||||
if ((i % 2) != shard) continue;
|
||||
BytecodeGraphTester tester(isolate, zone, snippets[i].code_snippet);
|
||||
BytecodeGraphTester tester(isolate, snippets[i].code_snippet);
|
||||
auto callable = tester.GetCallable<>();
|
||||
Handle<Object> return_value = callable().ToHandleChecked();
|
||||
CHECK(return_value->SameValue(*snippets[i].return_value()));
|
||||
@ -734,7 +720,6 @@ TEST(BytecodeGraphBuilderToObject) {
|
||||
TEST(BytecodeGraphBuilderToName) {
|
||||
HandleAndZoneScope scope;
|
||||
Isolate* isolate = scope.main_isolate();
|
||||
Zone* zone = scope.main_zone();
|
||||
Factory* factory = isolate->factory();
|
||||
|
||||
ExpectedSnippet<0> snippets[] = {
|
||||
@ -767,7 +752,7 @@ TEST(BytecodeGraphBuilderToName) {
|
||||
SNPrintF(script, "function %s() { %s }\n%s({});", kFunctionName,
|
||||
snippets[i].code_snippet, kFunctionName);
|
||||
|
||||
BytecodeGraphTester tester(isolate, zone, script.start());
|
||||
BytecodeGraphTester tester(isolate, script.start());
|
||||
auto callable = tester.GetCallable<>();
|
||||
Handle<Object> return_value = callable().ToHandleChecked();
|
||||
CHECK(return_value->SameValue(*snippets[i].return_value()));
|
||||
@ -778,7 +763,6 @@ TEST(BytecodeGraphBuilderToName) {
|
||||
TEST(BytecodeGraphBuilderLogicalNot) {
|
||||
HandleAndZoneScope scope;
|
||||
Isolate* isolate = scope.main_isolate();
|
||||
Zone* zone = scope.main_zone();
|
||||
Factory* factory = isolate->factory();
|
||||
|
||||
ExpectedSnippet<1> snippets[] = {
|
||||
@ -798,7 +782,7 @@ TEST(BytecodeGraphBuilderLogicalNot) {
|
||||
SNPrintF(script, "function %s(p1) { %s }\n%s({});", kFunctionName,
|
||||
snippets[i].code_snippet, kFunctionName);
|
||||
|
||||
BytecodeGraphTester tester(isolate, zone, script.start());
|
||||
BytecodeGraphTester tester(isolate, script.start());
|
||||
auto callable = tester.GetCallable<Handle<Object>>();
|
||||
Handle<Object> return_value =
|
||||
callable(snippets[i].parameter(0)).ToHandleChecked();
|
||||
@ -810,7 +794,6 @@ TEST(BytecodeGraphBuilderLogicalNot) {
|
||||
TEST(BytecodeGraphBuilderTypeOf) {
|
||||
HandleAndZoneScope scope;
|
||||
Isolate* isolate = scope.main_isolate();
|
||||
Zone* zone = scope.main_zone();
|
||||
Factory* factory = isolate->factory();
|
||||
|
||||
ExpectedSnippet<1> snippets[] = {
|
||||
@ -835,7 +818,7 @@ TEST(BytecodeGraphBuilderTypeOf) {
|
||||
SNPrintF(script, "function %s(p1) { %s }\n%s({});", kFunctionName,
|
||||
snippets[i].code_snippet, kFunctionName);
|
||||
|
||||
BytecodeGraphTester tester(isolate, zone, script.start());
|
||||
BytecodeGraphTester tester(isolate, script.start());
|
||||
auto callable = tester.GetCallable<Handle<Object>>();
|
||||
Handle<Object> return_value =
|
||||
callable(snippets[i].parameter(0)).ToHandleChecked();
|
||||
@ -847,7 +830,6 @@ TEST(BytecodeGraphBuilderTypeOf) {
|
||||
TEST(BytecodeGraphBuilderCountOperation) {
|
||||
HandleAndZoneScope scope;
|
||||
Isolate* isolate = scope.main_isolate();
|
||||
Zone* zone = scope.main_zone();
|
||||
Factory* factory = isolate->factory();
|
||||
|
||||
ExpectedSnippet<1> snippets[] = {
|
||||
@ -889,7 +871,7 @@ TEST(BytecodeGraphBuilderCountOperation) {
|
||||
SNPrintF(script, "function %s(p1) { %s }\n%s({});", kFunctionName,
|
||||
snippets[i].code_snippet, kFunctionName);
|
||||
|
||||
BytecodeGraphTester tester(isolate, zone, script.start());
|
||||
BytecodeGraphTester tester(isolate, script.start());
|
||||
auto callable = tester.GetCallable<Handle<Object>>();
|
||||
Handle<Object> return_value =
|
||||
callable(snippets[i].parameter(0)).ToHandleChecked();
|
||||
@ -901,7 +883,6 @@ TEST(BytecodeGraphBuilderCountOperation) {
|
||||
TEST(BytecodeGraphBuilderDelete) {
|
||||
HandleAndZoneScope scope;
|
||||
Isolate* isolate = scope.main_isolate();
|
||||
Zone* zone = scope.main_zone();
|
||||
Factory* factory = isolate->factory();
|
||||
|
||||
ExpectedSnippet<1> snippets[] = {
|
||||
@ -928,7 +909,7 @@ TEST(BytecodeGraphBuilderDelete) {
|
||||
SNPrintF(script, "function %s(p1) { %s }\n%s({});", kFunctionName,
|
||||
snippets[i].code_snippet, kFunctionName);
|
||||
|
||||
BytecodeGraphTester tester(isolate, zone, script.start());
|
||||
BytecodeGraphTester tester(isolate, script.start());
|
||||
auto callable = tester.GetCallable<Handle<Object>>();
|
||||
Handle<Object> return_value =
|
||||
callable(snippets[i].parameter(0)).ToHandleChecked();
|
||||
@ -940,7 +921,6 @@ TEST(BytecodeGraphBuilderDelete) {
|
||||
TEST(BytecodeGraphBuilderDeleteGlobal) {
|
||||
HandleAndZoneScope scope;
|
||||
Isolate* isolate = scope.main_isolate();
|
||||
Zone* zone = scope.main_zone();
|
||||
Factory* factory = isolate->factory();
|
||||
|
||||
ExpectedSnippet<0> snippets[] = {
|
||||
@ -981,7 +961,7 @@ TEST(BytecodeGraphBuilderDeleteGlobal) {
|
||||
ScopedVector<char> script(1024);
|
||||
SNPrintF(script, "%s %s({});", snippets[i].code_snippet, kFunctionName);
|
||||
|
||||
BytecodeGraphTester tester(isolate, zone, script.start());
|
||||
BytecodeGraphTester tester(isolate, script.start());
|
||||
auto callable = tester.GetCallable<>();
|
||||
Handle<Object> return_value = callable().ToHandleChecked();
|
||||
CHECK(return_value->SameValue(*snippets[i].return_value()));
|
||||
@ -992,7 +972,6 @@ TEST(BytecodeGraphBuilderDeleteGlobal) {
|
||||
TEST(BytecodeGraphBuilderDeleteLookupSlot) {
|
||||
HandleAndZoneScope scope;
|
||||
Isolate* isolate = scope.main_isolate();
|
||||
Zone* zone = scope.main_zone();
|
||||
Factory* factory = isolate->factory();
|
||||
|
||||
// TODO(mythria): Add more tests when we have support for LdaLookupSlot.
|
||||
@ -1018,7 +997,7 @@ TEST(BytecodeGraphBuilderDeleteLookupSlot) {
|
||||
SNPrintF(script, "%s %s %s", function_prologue, snippets[i].code_snippet,
|
||||
function_epilogue);
|
||||
|
||||
BytecodeGraphTester tester(isolate, zone, script.start(), "t");
|
||||
BytecodeGraphTester tester(isolate, script.start(), "t");
|
||||
auto callable = tester.GetCallable<>();
|
||||
Handle<Object> return_value = callable().ToHandleChecked();
|
||||
CHECK(return_value->SameValue(*snippets[i].return_value()));
|
||||
@ -1029,7 +1008,6 @@ TEST(BytecodeGraphBuilderDeleteLookupSlot) {
|
||||
TEST(BytecodeGraphBuilderLookupSlot) {
|
||||
HandleAndZoneScope scope;
|
||||
Isolate* isolate = scope.main_isolate();
|
||||
Zone* zone = scope.main_zone();
|
||||
Factory* factory = isolate->factory();
|
||||
|
||||
const char* function_prologue = "var f;"
|
||||
@ -1059,7 +1037,7 @@ TEST(BytecodeGraphBuilderLookupSlot) {
|
||||
SNPrintF(script, "%s %s %s", function_prologue, snippets[i].code_snippet,
|
||||
function_epilogue);
|
||||
|
||||
BytecodeGraphTester tester(isolate, zone, script.start(), "t");
|
||||
BytecodeGraphTester tester(isolate, script.start(), "t");
|
||||
auto callable = tester.GetCallable<>();
|
||||
Handle<Object> return_value = callable().ToHandleChecked();
|
||||
CHECK(return_value->SameValue(*snippets[i].return_value()));
|
||||
@ -1069,7 +1047,6 @@ TEST(BytecodeGraphBuilderLookupSlot) {
|
||||
TEST(BytecodeGraphBuilderLookupContextSlot) {
|
||||
HandleAndZoneScope scope;
|
||||
Isolate* isolate = scope.main_isolate();
|
||||
Zone* zone = scope.main_zone();
|
||||
Factory* factory = isolate->factory();
|
||||
|
||||
// Testing with eval called in the current context.
|
||||
@ -1087,7 +1064,7 @@ TEST(BytecodeGraphBuilderLookupContextSlot) {
|
||||
inner_eval_prologue, inner_eval_snippets[i].code_snippet,
|
||||
inner_eval_epilogue, kFunctionName);
|
||||
|
||||
BytecodeGraphTester tester(isolate, zone, script.start());
|
||||
BytecodeGraphTester tester(isolate, script.start());
|
||||
auto callable = tester.GetCallable<>();
|
||||
Handle<Object> return_value = callable().ToHandleChecked();
|
||||
CHECK(return_value->SameValue(*inner_eval_snippets[i].return_value()));
|
||||
@ -1109,7 +1086,7 @@ TEST(BytecodeGraphBuilderLookupContextSlot) {
|
||||
outer_eval_prologue, outer_eval_snippets[i].code_snippet,
|
||||
outer_eval_epilogue, kFunctionName);
|
||||
|
||||
BytecodeGraphTester tester(isolate, zone, script.start());
|
||||
BytecodeGraphTester tester(isolate, script.start());
|
||||
auto callable = tester.GetCallable<>();
|
||||
Handle<Object> return_value = callable().ToHandleChecked();
|
||||
CHECK(return_value->SameValue(*outer_eval_snippets[i].return_value()));
|
||||
@ -1119,7 +1096,6 @@ TEST(BytecodeGraphBuilderLookupContextSlot) {
|
||||
TEST(BytecodeGraphBuilderLookupGlobalSlot) {
|
||||
HandleAndZoneScope scope;
|
||||
Isolate* isolate = scope.main_isolate();
|
||||
Zone* zone = scope.main_zone();
|
||||
Factory* factory = isolate->factory();
|
||||
|
||||
// Testing with eval called in the current context.
|
||||
@ -1137,7 +1113,7 @@ TEST(BytecodeGraphBuilderLookupGlobalSlot) {
|
||||
inner_eval_prologue, inner_eval_snippets[i].code_snippet,
|
||||
inner_eval_epilogue, kFunctionName);
|
||||
|
||||
BytecodeGraphTester tester(isolate, zone, script.start());
|
||||
BytecodeGraphTester tester(isolate, script.start());
|
||||
auto callable = tester.GetCallable<>();
|
||||
Handle<Object> return_value = callable().ToHandleChecked();
|
||||
CHECK(return_value->SameValue(*inner_eval_snippets[i].return_value()));
|
||||
@ -1159,7 +1135,7 @@ TEST(BytecodeGraphBuilderLookupGlobalSlot) {
|
||||
outer_eval_prologue, outer_eval_snippets[i].code_snippet,
|
||||
outer_eval_epilogue, kFunctionName);
|
||||
|
||||
BytecodeGraphTester tester(isolate, zone, script.start());
|
||||
BytecodeGraphTester tester(isolate, script.start());
|
||||
auto callable = tester.GetCallable<>();
|
||||
Handle<Object> return_value = callable().ToHandleChecked();
|
||||
CHECK(return_value->SameValue(*outer_eval_snippets[i].return_value()));
|
||||
@ -1169,7 +1145,6 @@ TEST(BytecodeGraphBuilderLookupGlobalSlot) {
|
||||
TEST(BytecodeGraphBuilderLookupSlotWide) {
|
||||
HandleAndZoneScope scope;
|
||||
Isolate* isolate = scope.main_isolate();
|
||||
Zone* zone = scope.main_zone();
|
||||
Factory* factory = isolate->factory();
|
||||
|
||||
const char* function_prologue =
|
||||
@ -1201,7 +1176,7 @@ TEST(BytecodeGraphBuilderLookupSlotWide) {
|
||||
SNPrintF(script, "%s %s %s", function_prologue, snippets[i].code_snippet,
|
||||
function_epilogue);
|
||||
|
||||
BytecodeGraphTester tester(isolate, zone, script.start(), "t");
|
||||
BytecodeGraphTester tester(isolate, script.start(), "t");
|
||||
auto callable = tester.GetCallable<>();
|
||||
Handle<Object> return_value = callable().ToHandleChecked();
|
||||
CHECK(return_value->SameValue(*snippets[i].return_value()));
|
||||
@ -1212,7 +1187,6 @@ TEST(BytecodeGraphBuilderLookupSlotWide) {
|
||||
TEST(BytecodeGraphBuilderCallLookupSlot) {
|
||||
HandleAndZoneScope scope;
|
||||
Isolate* isolate = scope.main_isolate();
|
||||
Zone* zone = scope.main_zone();
|
||||
|
||||
ExpectedSnippet<0> snippets[] = {
|
||||
{"g = function(){ return 2 }; eval(''); return g();",
|
||||
@ -1230,7 +1204,7 @@ TEST(BytecodeGraphBuilderCallLookupSlot) {
|
||||
ScopedVector<char> script(1024);
|
||||
SNPrintF(script, "function %s() { %s }\n%s();", kFunctionName,
|
||||
snippets[i].code_snippet, kFunctionName);
|
||||
BytecodeGraphTester tester(isolate, zone, script.start());
|
||||
BytecodeGraphTester tester(isolate, script.start());
|
||||
auto callable = tester.GetCallable<>();
|
||||
Handle<Object> return_value = callable().ToHandleChecked();
|
||||
CHECK(return_value->SameValue(*snippets[i].return_value()));
|
||||
@ -1241,7 +1215,6 @@ TEST(BytecodeGraphBuilderCallLookupSlot) {
|
||||
TEST(BytecodeGraphBuilderEval) {
|
||||
HandleAndZoneScope scope;
|
||||
Isolate* isolate = scope.main_isolate();
|
||||
Zone* zone = scope.main_zone();
|
||||
Factory* factory = isolate->factory();
|
||||
|
||||
ExpectedSnippet<0> snippets[] = {
|
||||
@ -1282,7 +1255,7 @@ TEST(BytecodeGraphBuilderEval) {
|
||||
ScopedVector<char> script(1024);
|
||||
SNPrintF(script, "function %s() { %s }\n%s();", kFunctionName,
|
||||
snippets[i].code_snippet, kFunctionName);
|
||||
BytecodeGraphTester tester(isolate, zone, script.start());
|
||||
BytecodeGraphTester tester(isolate, script.start());
|
||||
auto callable = tester.GetCallable<>();
|
||||
Handle<Object> return_value = callable().ToHandleChecked();
|
||||
CHECK(return_value->SameValue(*snippets[i].return_value()));
|
||||
@ -1293,7 +1266,6 @@ TEST(BytecodeGraphBuilderEval) {
|
||||
TEST(BytecodeGraphBuilderEvalParams) {
|
||||
HandleAndZoneScope scope;
|
||||
Isolate* isolate = scope.main_isolate();
|
||||
Zone* zone = scope.main_zone();
|
||||
|
||||
ExpectedSnippet<1> snippets[] = {
|
||||
{"var x = 10; return eval('x + p1;');",
|
||||
@ -1310,7 +1282,7 @@ TEST(BytecodeGraphBuilderEvalParams) {
|
||||
ScopedVector<char> script(1024);
|
||||
SNPrintF(script, "function %s(p1) { %s }\n%s(0);", kFunctionName,
|
||||
snippets[i].code_snippet, kFunctionName);
|
||||
BytecodeGraphTester tester(isolate, zone, script.start());
|
||||
BytecodeGraphTester tester(isolate, script.start());
|
||||
auto callable = tester.GetCallable<Handle<Object>>();
|
||||
Handle<Object> return_value =
|
||||
callable(snippets[i].parameter(0)).ToHandleChecked();
|
||||
@ -1322,7 +1294,6 @@ TEST(BytecodeGraphBuilderEvalParams) {
|
||||
TEST(BytecodeGraphBuilderEvalGlobal) {
|
||||
HandleAndZoneScope scope;
|
||||
Isolate* isolate = scope.main_isolate();
|
||||
Zone* zone = scope.main_zone();
|
||||
Factory* factory = isolate->factory();
|
||||
|
||||
ExpectedSnippet<0> snippets[] = {
|
||||
@ -1338,7 +1309,7 @@ TEST(BytecodeGraphBuilderEvalGlobal) {
|
||||
};
|
||||
|
||||
for (size_t i = 0; i < arraysize(snippets); i++) {
|
||||
BytecodeGraphTester tester(isolate, zone, snippets[i].code_snippet);
|
||||
BytecodeGraphTester tester(isolate, snippets[i].code_snippet);
|
||||
auto callable = tester.GetCallable<>();
|
||||
Handle<Object> return_value = callable().ToHandleChecked();
|
||||
CHECK(return_value->SameValue(*snippets[i].return_value()));
|
||||
@ -1400,7 +1371,6 @@ const char* get_code_snippet(Token::Value opcode) {
|
||||
TEST(BytecodeGraphBuilderCompare) {
|
||||
HandleAndZoneScope scope;
|
||||
Isolate* isolate = scope.main_isolate();
|
||||
Zone* zone = scope.main_zone();
|
||||
Factory* factory = isolate->factory();
|
||||
Handle<Object> lhs_values[] = {
|
||||
factory->NewNumberFromInt(10), factory->NewHeapNumber(3.45),
|
||||
@ -1419,7 +1389,7 @@ TEST(BytecodeGraphBuilderCompare) {
|
||||
SNPrintF(script, "function %s(p1, p2) { %s }\n%s({}, {});", kFunctionName,
|
||||
get_code_snippet(kCompareOperators[i]), kFunctionName);
|
||||
|
||||
BytecodeGraphTester tester(isolate, zone, script.start());
|
||||
BytecodeGraphTester tester(isolate, script.start());
|
||||
auto callable = tester.GetCallable<Handle<Object>, Handle<Object>>();
|
||||
for (size_t j = 0; j < arraysize(lhs_values); j++) {
|
||||
for (size_t k = 0; k < arraysize(rhs_values); k++) {
|
||||
@ -1437,7 +1407,6 @@ TEST(BytecodeGraphBuilderCompare) {
|
||||
TEST(BytecodeGraphBuilderTestIn) {
|
||||
HandleAndZoneScope scope;
|
||||
Isolate* isolate = scope.main_isolate();
|
||||
Zone* zone = scope.main_zone();
|
||||
Factory* factory = isolate->factory();
|
||||
|
||||
ExpectedSnippet<2> snippets[] = {
|
||||
@ -1473,7 +1442,7 @@ TEST(BytecodeGraphBuilderTestIn) {
|
||||
SNPrintF(script, "function %s(p1, p2) { %s }\n%s({}, {});", kFunctionName,
|
||||
snippets[i].code_snippet, kFunctionName);
|
||||
|
||||
BytecodeGraphTester tester(isolate, zone, script.start());
|
||||
BytecodeGraphTester tester(isolate, script.start());
|
||||
auto callable = tester.GetCallable<Handle<Object>, Handle<Object>>();
|
||||
Handle<Object> return_value =
|
||||
callable(snippets[i].parameter(0), snippets[i].parameter(1))
|
||||
@ -1486,7 +1455,6 @@ TEST(BytecodeGraphBuilderTestIn) {
|
||||
TEST(BytecodeGraphBuilderTestInstanceOf) {
|
||||
HandleAndZoneScope scope;
|
||||
Isolate* isolate = scope.main_isolate();
|
||||
Zone* zone = scope.main_zone();
|
||||
Factory* factory = isolate->factory();
|
||||
|
||||
ExpectedSnippet<1> snippets[] = {
|
||||
@ -1505,7 +1473,7 @@ TEST(BytecodeGraphBuilderTestInstanceOf) {
|
||||
SNPrintF(script, "function %s(p1) { %s }\n%s({});", kFunctionName,
|
||||
snippets[i].code_snippet, kFunctionName);
|
||||
|
||||
BytecodeGraphTester tester(isolate, zone, script.start());
|
||||
BytecodeGraphTester tester(isolate, script.start());
|
||||
auto callable = tester.GetCallable<Handle<Object>>();
|
||||
Handle<Object> return_value =
|
||||
callable(snippets[i].parameter(0)).ToHandleChecked();
|
||||
@ -1516,7 +1484,6 @@ TEST(BytecodeGraphBuilderTestInstanceOf) {
|
||||
TEST(BytecodeGraphBuilderTryCatch) {
|
||||
HandleAndZoneScope scope;
|
||||
Isolate* isolate = scope.main_isolate();
|
||||
Zone* zone = scope.main_zone();
|
||||
|
||||
ExpectedSnippet<0> snippets[] = {
|
||||
{"var a = 1; try { a = 2 } catch(e) { a = 3 }; return a;",
|
||||
@ -1535,7 +1502,7 @@ TEST(BytecodeGraphBuilderTryCatch) {
|
||||
SNPrintF(script, "function %s() { %s }\n%s();", kFunctionName,
|
||||
snippets[i].code_snippet, kFunctionName);
|
||||
|
||||
BytecodeGraphTester tester(isolate, zone, script.start());
|
||||
BytecodeGraphTester tester(isolate, script.start());
|
||||
auto callable = tester.GetCallable<>();
|
||||
Handle<Object> return_value = callable().ToHandleChecked();
|
||||
CHECK(return_value->SameValue(*snippets[i].return_value()));
|
||||
@ -1545,7 +1512,6 @@ TEST(BytecodeGraphBuilderTryCatch) {
|
||||
TEST(BytecodeGraphBuilderTryFinally1) {
|
||||
HandleAndZoneScope scope;
|
||||
Isolate* isolate = scope.main_isolate();
|
||||
Zone* zone = scope.main_zone();
|
||||
|
||||
ExpectedSnippet<0> snippets[] = {
|
||||
{"var a = 1; try { a = a + 1; } finally { a = a + 2; }; return a;",
|
||||
@ -1573,7 +1539,7 @@ TEST(BytecodeGraphBuilderTryFinally1) {
|
||||
SNPrintF(script, "function %s() { %s }\n%s();", kFunctionName,
|
||||
snippets[i].code_snippet, kFunctionName);
|
||||
|
||||
BytecodeGraphTester tester(isolate, zone, script.start());
|
||||
BytecodeGraphTester tester(isolate, script.start());
|
||||
auto callable = tester.GetCallable<>();
|
||||
Handle<Object> return_value = callable().ToHandleChecked();
|
||||
CHECK(return_value->SameValue(*snippets[i].return_value()));
|
||||
@ -1583,7 +1549,6 @@ TEST(BytecodeGraphBuilderTryFinally1) {
|
||||
TEST(BytecodeGraphBuilderTryFinally2) {
|
||||
HandleAndZoneScope scope;
|
||||
Isolate* isolate = scope.main_isolate();
|
||||
Zone* zone = scope.main_zone();
|
||||
|
||||
ExpectedSnippet<0, const char*> snippets[] = {
|
||||
{"var a = 1; try { a = 2; throw 23; } finally { a = 3 }; return a;",
|
||||
@ -1597,7 +1562,7 @@ TEST(BytecodeGraphBuilderTryFinally2) {
|
||||
SNPrintF(script, "function %s() { %s }\n%s();", kFunctionName,
|
||||
snippets[i].code_snippet, kFunctionName);
|
||||
|
||||
BytecodeGraphTester tester(isolate, zone, script.start());
|
||||
BytecodeGraphTester tester(isolate, script.start());
|
||||
v8::Local<v8::String> message = tester.CheckThrowsReturnMessage()->Get();
|
||||
v8::Local<v8::String> expected_string = v8_str(snippets[i].return_value());
|
||||
CHECK(
|
||||
@ -1609,7 +1574,6 @@ TEST(BytecodeGraphBuilderTryFinally2) {
|
||||
TEST(BytecodeGraphBuilderThrow) {
|
||||
HandleAndZoneScope scope;
|
||||
Isolate* isolate = scope.main_isolate();
|
||||
Zone* zone = scope.main_zone();
|
||||
|
||||
// TODO(mythria): Add more tests when real try-catch and deoptimization
|
||||
// information are supported.
|
||||
@ -1626,7 +1590,7 @@ TEST(BytecodeGraphBuilderThrow) {
|
||||
SNPrintF(script, "function %s() { %s }\n%s();", kFunctionName,
|
||||
snippets[i].code_snippet, kFunctionName);
|
||||
|
||||
BytecodeGraphTester tester(isolate, zone, script.start());
|
||||
BytecodeGraphTester tester(isolate, script.start());
|
||||
v8::Local<v8::String> message = tester.CheckThrowsReturnMessage()->Get();
|
||||
v8::Local<v8::String> expected_string = v8_str(snippets[i].return_value());
|
||||
CHECK(
|
||||
@ -1639,7 +1603,6 @@ TEST(BytecodeGraphBuilderThrow) {
|
||||
TEST(BytecodeGraphBuilderContext) {
|
||||
HandleAndZoneScope scope;
|
||||
Isolate* isolate = scope.main_isolate();
|
||||
Zone* zone = scope.main_zone();
|
||||
Factory* factory = isolate->factory();
|
||||
|
||||
ExpectedSnippet<0> snippets[] = {
|
||||
@ -1687,7 +1650,7 @@ TEST(BytecodeGraphBuilderContext) {
|
||||
ScopedVector<char> script(1024);
|
||||
SNPrintF(script, "%s", snippets[i].code_snippet);
|
||||
|
||||
BytecodeGraphTester tester(isolate, zone, script.start(), "f");
|
||||
BytecodeGraphTester tester(isolate, script.start(), "f");
|
||||
auto callable = tester.GetCallable<>("f");
|
||||
Handle<Object> return_value = callable().ToHandleChecked();
|
||||
CHECK(return_value->SameValue(*snippets[i].return_value()));
|
||||
@ -1698,7 +1661,6 @@ TEST(BytecodeGraphBuilderContext) {
|
||||
TEST(BytecodeGraphBuilderLoadContext) {
|
||||
HandleAndZoneScope scope;
|
||||
Isolate* isolate = scope.main_isolate();
|
||||
Zone* zone = scope.main_zone();
|
||||
Factory* factory = isolate->factory();
|
||||
|
||||
ExpectedSnippet<1> snippets[] = {
|
||||
@ -1752,7 +1714,7 @@ TEST(BytecodeGraphBuilderLoadContext) {
|
||||
ScopedVector<char> script(1024);
|
||||
SNPrintF(script, "%s", snippets[i].code_snippet);
|
||||
|
||||
BytecodeGraphTester tester(isolate, zone, script.start(), "*");
|
||||
BytecodeGraphTester tester(isolate, script.start(), "*");
|
||||
auto callable = tester.GetCallable<Handle<Object>>("f");
|
||||
Handle<Object> return_value =
|
||||
callable(snippets[i].parameter(0)).ToHandleChecked();
|
||||
@ -1764,7 +1726,6 @@ TEST(BytecodeGraphBuilderLoadContext) {
|
||||
TEST(BytecodeGraphBuilderCreateArgumentsNoParameters) {
|
||||
HandleAndZoneScope scope;
|
||||
Isolate* isolate = scope.main_isolate();
|
||||
Zone* zone = scope.main_zone();
|
||||
Factory* factory = isolate->factory();
|
||||
|
||||
ExpectedSnippet<0> snippets[] = {
|
||||
@ -1784,7 +1745,7 @@ TEST(BytecodeGraphBuilderCreateArgumentsNoParameters) {
|
||||
ScopedVector<char> script(1024);
|
||||
SNPrintF(script, "%s\n%s();", snippets[i].code_snippet, kFunctionName);
|
||||
|
||||
BytecodeGraphTester tester(isolate, zone, script.start());
|
||||
BytecodeGraphTester tester(isolate, script.start());
|
||||
auto callable = tester.GetCallable<>();
|
||||
Handle<Object> return_value = callable().ToHandleChecked();
|
||||
CHECK(return_value->SameValue(*snippets[i].return_value()));
|
||||
@ -1795,7 +1756,6 @@ TEST(BytecodeGraphBuilderCreateArgumentsNoParameters) {
|
||||
TEST(BytecodeGraphBuilderCreateArguments) {
|
||||
HandleAndZoneScope scope;
|
||||
Isolate* isolate = scope.main_isolate();
|
||||
Zone* zone = scope.main_zone();
|
||||
Factory* factory = isolate->factory();
|
||||
|
||||
ExpectedSnippet<3> snippets[] = {
|
||||
@ -1827,7 +1787,7 @@ TEST(BytecodeGraphBuilderCreateArguments) {
|
||||
ScopedVector<char> script(1024);
|
||||
SNPrintF(script, "%s\n%s();", snippets[i].code_snippet, kFunctionName);
|
||||
|
||||
BytecodeGraphTester tester(isolate, zone, script.start());
|
||||
BytecodeGraphTester tester(isolate, script.start());
|
||||
auto callable =
|
||||
tester.GetCallable<Handle<Object>, Handle<Object>, Handle<Object>>();
|
||||
Handle<Object> return_value =
|
||||
@ -1841,7 +1801,6 @@ TEST(BytecodeGraphBuilderCreateArguments) {
|
||||
TEST(BytecodeGraphBuilderCreateRestArguments) {
|
||||
HandleAndZoneScope scope;
|
||||
Isolate* isolate = scope.main_isolate();
|
||||
Zone* zone = scope.main_zone();
|
||||
Factory* factory = isolate->factory();
|
||||
|
||||
ExpectedSnippet<3> snippets[] = {
|
||||
@ -1870,7 +1829,7 @@ TEST(BytecodeGraphBuilderCreateRestArguments) {
|
||||
ScopedVector<char> script(1024);
|
||||
SNPrintF(script, "%s\n%s();", snippets[i].code_snippet, kFunctionName);
|
||||
|
||||
BytecodeGraphTester tester(isolate, zone, script.start());
|
||||
BytecodeGraphTester tester(isolate, script.start());
|
||||
auto callable =
|
||||
tester.GetCallable<Handle<Object>, Handle<Object>, Handle<Object>>();
|
||||
Handle<Object> return_value =
|
||||
@ -1884,7 +1843,6 @@ TEST(BytecodeGraphBuilderCreateRestArguments) {
|
||||
TEST(BytecodeGraphBuilderRegExpLiterals) {
|
||||
HandleAndZoneScope scope;
|
||||
Isolate* isolate = scope.main_isolate();
|
||||
Zone* zone = scope.main_zone();
|
||||
Factory* factory = isolate->factory();
|
||||
|
||||
ExpectedSnippet<0> snippets[] = {
|
||||
@ -1909,7 +1867,7 @@ TEST(BytecodeGraphBuilderRegExpLiterals) {
|
||||
SNPrintF(script, "function %s() { %s }\n%s();", kFunctionName,
|
||||
snippets[i].code_snippet, kFunctionName);
|
||||
|
||||
BytecodeGraphTester tester(isolate, zone, script.start());
|
||||
BytecodeGraphTester tester(isolate, script.start());
|
||||
auto callable = tester.GetCallable<>();
|
||||
Handle<Object> return_value = callable().ToHandleChecked();
|
||||
CHECK(return_value->SameValue(*snippets[i].return_value()));
|
||||
@ -1920,7 +1878,6 @@ TEST(BytecodeGraphBuilderRegExpLiterals) {
|
||||
TEST(BytecodeGraphBuilderArrayLiterals) {
|
||||
HandleAndZoneScope scope;
|
||||
Isolate* isolate = scope.main_isolate();
|
||||
Zone* zone = scope.main_zone();
|
||||
Factory* factory = isolate->factory();
|
||||
|
||||
ExpectedSnippet<0> snippets[] = {
|
||||
@ -1949,7 +1906,7 @@ TEST(BytecodeGraphBuilderArrayLiterals) {
|
||||
SNPrintF(script, "function %s() { %s }\n%s();", kFunctionName,
|
||||
snippets[i].code_snippet, kFunctionName);
|
||||
|
||||
BytecodeGraphTester tester(isolate, zone, script.start());
|
||||
BytecodeGraphTester tester(isolate, script.start());
|
||||
auto callable = tester.GetCallable<>();
|
||||
Handle<Object> return_value = callable().ToHandleChecked();
|
||||
CHECK(return_value->SameValue(*snippets[i].return_value()));
|
||||
@ -1960,7 +1917,6 @@ TEST(BytecodeGraphBuilderArrayLiterals) {
|
||||
TEST(BytecodeGraphBuilderObjectLiterals) {
|
||||
HandleAndZoneScope scope;
|
||||
Isolate* isolate = scope.main_isolate();
|
||||
Zone* zone = scope.main_zone();
|
||||
Factory* factory = isolate->factory();
|
||||
|
||||
ExpectedSnippet<0> snippets[] = {
|
||||
@ -2013,7 +1969,7 @@ TEST(BytecodeGraphBuilderObjectLiterals) {
|
||||
ScopedVector<char> script(4096);
|
||||
SNPrintF(script, "function %s() { %s }\n%s();", kFunctionName,
|
||||
snippets[i].code_snippet, kFunctionName);
|
||||
BytecodeGraphTester tester(isolate, zone, script.start());
|
||||
BytecodeGraphTester tester(isolate, script.start());
|
||||
auto callable = tester.GetCallable<>();
|
||||
Handle<Object> return_value = callable().ToHandleChecked();
|
||||
CHECK(return_value->SameValue(*snippets[i].return_value()));
|
||||
@ -2024,7 +1980,6 @@ TEST(BytecodeGraphBuilderObjectLiterals) {
|
||||
TEST(BytecodeGraphBuilderIf) {
|
||||
HandleAndZoneScope scope;
|
||||
Isolate* isolate = scope.main_isolate();
|
||||
Zone* zone = scope.main_zone();
|
||||
Factory* factory = isolate->factory();
|
||||
|
||||
ExpectedSnippet<1> snippets[] = {
|
||||
@ -2122,7 +2077,7 @@ TEST(BytecodeGraphBuilderIf) {
|
||||
SNPrintF(script, "function %s(p1) { %s };\n%s(0);", kFunctionName,
|
||||
snippets[i].code_snippet, kFunctionName);
|
||||
|
||||
BytecodeGraphTester tester(isolate, zone, script.start());
|
||||
BytecodeGraphTester tester(isolate, script.start());
|
||||
auto callable = tester.GetCallable<Handle<Object>>();
|
||||
Handle<Object> return_value =
|
||||
callable(snippets[i].parameter(0)).ToHandleChecked();
|
||||
@ -2134,7 +2089,6 @@ TEST(BytecodeGraphBuilderIf) {
|
||||
TEST(BytecodeGraphBuilderConditionalOperator) {
|
||||
HandleAndZoneScope scope;
|
||||
Isolate* isolate = scope.main_isolate();
|
||||
Zone* zone = scope.main_zone();
|
||||
Factory* factory = isolate->factory();
|
||||
|
||||
ExpectedSnippet<1> snippets[] = {
|
||||
@ -2153,7 +2107,7 @@ TEST(BytecodeGraphBuilderConditionalOperator) {
|
||||
SNPrintF(script, "function %s(p1) { %s };\n%s(0);", kFunctionName,
|
||||
snippets[i].code_snippet, kFunctionName);
|
||||
|
||||
BytecodeGraphTester tester(isolate, zone, script.start());
|
||||
BytecodeGraphTester tester(isolate, script.start());
|
||||
auto callable = tester.GetCallable<Handle<Object>>();
|
||||
Handle<Object> return_value =
|
||||
callable(snippets[i].parameter(0)).ToHandleChecked();
|
||||
@ -2165,7 +2119,6 @@ TEST(BytecodeGraphBuilderConditionalOperator) {
|
||||
TEST(BytecodeGraphBuilderSwitch) {
|
||||
HandleAndZoneScope scope;
|
||||
Isolate* isolate = scope.main_isolate();
|
||||
Zone* zone = scope.main_zone();
|
||||
Factory* factory = isolate->factory();
|
||||
|
||||
const char* switch_code =
|
||||
@ -2201,7 +2154,7 @@ TEST(BytecodeGraphBuilderSwitch) {
|
||||
SNPrintF(script, "function %s(p1) { %s };\n%s(0);", kFunctionName,
|
||||
snippets[i].code_snippet, kFunctionName);
|
||||
|
||||
BytecodeGraphTester tester(isolate, zone, script.start());
|
||||
BytecodeGraphTester tester(isolate, script.start());
|
||||
auto callable = tester.GetCallable<Handle<Object>>();
|
||||
Handle<Object> return_value =
|
||||
callable(snippets[i].parameter(0)).ToHandleChecked();
|
||||
@ -2212,7 +2165,6 @@ TEST(BytecodeGraphBuilderSwitch) {
|
||||
TEST(BytecodeGraphBuilderSwitchMerge) {
|
||||
HandleAndZoneScope scope;
|
||||
Isolate* isolate = scope.main_isolate();
|
||||
Zone* zone = scope.main_zone();
|
||||
Factory* factory = isolate->factory();
|
||||
|
||||
const char* switch_code =
|
||||
@ -2250,7 +2202,7 @@ TEST(BytecodeGraphBuilderSwitchMerge) {
|
||||
SNPrintF(script, "function %s(p1) { %s };\n%s(0);", kFunctionName,
|
||||
snippets[i].code_snippet, kFunctionName);
|
||||
|
||||
BytecodeGraphTester tester(isolate, zone, script.start());
|
||||
BytecodeGraphTester tester(isolate, script.start());
|
||||
auto callable = tester.GetCallable<Handle<Object>>();
|
||||
Handle<Object> return_value =
|
||||
callable(snippets[i].parameter(0)).ToHandleChecked();
|
||||
@ -2261,7 +2213,6 @@ TEST(BytecodeGraphBuilderSwitchMerge) {
|
||||
TEST(BytecodeGraphBuilderNestedSwitch) {
|
||||
HandleAndZoneScope scope;
|
||||
Isolate* isolate = scope.main_isolate();
|
||||
Zone* zone = scope.main_zone();
|
||||
Factory* factory = isolate->factory();
|
||||
|
||||
const char* switch_code =
|
||||
@ -2309,7 +2260,7 @@ TEST(BytecodeGraphBuilderNestedSwitch) {
|
||||
SNPrintF(script, "function %s(p1, p2) { %s };\n%s(0, 0);", kFunctionName,
|
||||
snippets[i].code_snippet, kFunctionName);
|
||||
|
||||
BytecodeGraphTester tester(isolate, zone, script.start());
|
||||
BytecodeGraphTester tester(isolate, script.start());
|
||||
auto callable = tester.GetCallable<Handle<Object>, Handle<Object>>();
|
||||
Handle<Object> return_value =
|
||||
callable(snippets[i].parameter(0), snippets[i].parameter(1))
|
||||
@ -2322,7 +2273,6 @@ TEST(BytecodeGraphBuilderNestedSwitch) {
|
||||
TEST(BytecodeGraphBuilderBreakableBlocks) {
|
||||
HandleAndZoneScope scope;
|
||||
Isolate* isolate = scope.main_isolate();
|
||||
Zone* zone = scope.main_zone();
|
||||
Factory* factory = isolate->factory();
|
||||
|
||||
ExpectedSnippet<0> snippets[] = {
|
||||
@ -2352,7 +2302,7 @@ TEST(BytecodeGraphBuilderBreakableBlocks) {
|
||||
SNPrintF(script, "function %s() { %s }\n%s();", kFunctionName,
|
||||
snippets[i].code_snippet, kFunctionName);
|
||||
|
||||
BytecodeGraphTester tester(isolate, zone, script.start());
|
||||
BytecodeGraphTester tester(isolate, script.start());
|
||||
auto callable = tester.GetCallable<>();
|
||||
Handle<Object> return_value = callable().ToHandleChecked();
|
||||
CHECK(return_value->SameValue(*snippets[i].return_value()));
|
||||
@ -2363,7 +2313,6 @@ TEST(BytecodeGraphBuilderBreakableBlocks) {
|
||||
TEST(BytecodeGraphBuilderWhile) {
|
||||
HandleAndZoneScope scope;
|
||||
Isolate* isolate = scope.main_isolate();
|
||||
Zone* zone = scope.main_zone();
|
||||
Factory* factory = isolate->factory();
|
||||
|
||||
ExpectedSnippet<0> snippets[] = {
|
||||
@ -2401,7 +2350,7 @@ TEST(BytecodeGraphBuilderWhile) {
|
||||
SNPrintF(script, "function %s() { %s }\n%s();", kFunctionName,
|
||||
snippets[i].code_snippet, kFunctionName);
|
||||
|
||||
BytecodeGraphTester tester(isolate, zone, script.start());
|
||||
BytecodeGraphTester tester(isolate, script.start());
|
||||
auto callable = tester.GetCallable<>();
|
||||
Handle<Object> return_value = callable().ToHandleChecked();
|
||||
CHECK(return_value->SameValue(*snippets[i].return_value()));
|
||||
@ -2412,7 +2361,6 @@ TEST(BytecodeGraphBuilderWhile) {
|
||||
TEST(BytecodeGraphBuilderDo) {
|
||||
HandleAndZoneScope scope;
|
||||
Isolate* isolate = scope.main_isolate();
|
||||
Zone* zone = scope.main_zone();
|
||||
Factory* factory = isolate->factory();
|
||||
|
||||
ExpectedSnippet<0> snippets[] = {
|
||||
@ -2450,7 +2398,7 @@ TEST(BytecodeGraphBuilderDo) {
|
||||
SNPrintF(script, "function %s() { %s }\n%s();", kFunctionName,
|
||||
snippets[i].code_snippet, kFunctionName);
|
||||
|
||||
BytecodeGraphTester tester(isolate, zone, script.start());
|
||||
BytecodeGraphTester tester(isolate, script.start());
|
||||
auto callable = tester.GetCallable<>();
|
||||
Handle<Object> return_value = callable().ToHandleChecked();
|
||||
CHECK(return_value->SameValue(*snippets[i].return_value()));
|
||||
@ -2461,7 +2409,6 @@ TEST(BytecodeGraphBuilderDo) {
|
||||
TEST(BytecodeGraphBuilderFor) {
|
||||
HandleAndZoneScope scope;
|
||||
Isolate* isolate = scope.main_isolate();
|
||||
Zone* zone = scope.main_zone();
|
||||
Factory* factory = isolate->factory();
|
||||
|
||||
ExpectedSnippet<0> snippets[] = {
|
||||
@ -2544,7 +2491,7 @@ TEST(BytecodeGraphBuilderFor) {
|
||||
SNPrintF(script, "function %s() { %s }\n%s();", kFunctionName,
|
||||
snippets[i].code_snippet, kFunctionName);
|
||||
|
||||
BytecodeGraphTester tester(isolate, zone, script.start());
|
||||
BytecodeGraphTester tester(isolate, script.start());
|
||||
auto callable = tester.GetCallable<>();
|
||||
Handle<Object> return_value = callable().ToHandleChecked();
|
||||
CHECK(return_value->SameValue(*snippets[i].return_value()));
|
||||
@ -2555,7 +2502,6 @@ TEST(BytecodeGraphBuilderFor) {
|
||||
TEST(BytecodeGraphBuilderForIn) {
|
||||
HandleAndZoneScope scope;
|
||||
Isolate* isolate = scope.main_isolate();
|
||||
Zone* zone = scope.main_zone();
|
||||
Factory* factory = isolate->factory();
|
||||
ExpectedSnippet<0> snippets[] = {
|
||||
{"var sum = 0;\n"
|
||||
@ -2616,7 +2562,7 @@ TEST(BytecodeGraphBuilderForIn) {
|
||||
SNPrintF(script, "function %s() { %s }\n%s();", kFunctionName,
|
||||
snippets[i].code_snippet, kFunctionName);
|
||||
|
||||
BytecodeGraphTester tester(isolate, zone, script.start());
|
||||
BytecodeGraphTester tester(isolate, script.start());
|
||||
auto callable = tester.GetCallable<>();
|
||||
Handle<Object> return_value = callable().ToHandleChecked();
|
||||
CHECK(return_value->SameValue(*snippets[i].return_value()));
|
||||
@ -2627,7 +2573,6 @@ TEST(BytecodeGraphBuilderForIn) {
|
||||
TEST(BytecodeGraphBuilderForOf) {
|
||||
HandleAndZoneScope scope;
|
||||
Isolate* isolate = scope.main_isolate();
|
||||
Zone* zone = scope.main_zone();
|
||||
Factory* factory = isolate->factory();
|
||||
ExpectedSnippet<0> snippets[] = {
|
||||
{" var r = 0;\n"
|
||||
@ -2709,7 +2654,7 @@ TEST(BytecodeGraphBuilderForOf) {
|
||||
SNPrintF(script, "function %s() { %s }\n%s();", kFunctionName,
|
||||
snippets[i].code_snippet, kFunctionName);
|
||||
|
||||
BytecodeGraphTester tester(isolate, zone, script.start());
|
||||
BytecodeGraphTester tester(isolate, script.start());
|
||||
auto callable = tester.GetCallable<>();
|
||||
Handle<Object> return_value = callable().ToHandleChecked();
|
||||
CHECK(return_value->SameValue(*snippets[i].return_value()));
|
||||
@ -2745,8 +2690,7 @@ void TestJumpWithConstantsAndWideConstants(size_t shard) {
|
||||
HandleAndZoneScope scope;
|
||||
auto isolate = scope.main_isolate();
|
||||
auto factory = isolate->factory();
|
||||
auto zone = scope.main_zone();
|
||||
BytecodeGraphTester tester(isolate, zone, script.c_str());
|
||||
BytecodeGraphTester tester(isolate, script.c_str());
|
||||
auto callable = tester.GetCallable<Handle<Object>>();
|
||||
for (int a = 0; a < 3; a++) {
|
||||
Handle<Object> return_val =
|
||||
@ -2764,7 +2708,6 @@ TEST(BytecodeGraphBuilderDoExpressions) {
|
||||
FLAG_harmony_do_expressions = true;
|
||||
HandleAndZoneScope scope;
|
||||
Isolate* isolate = scope.main_isolate();
|
||||
Zone* zone = scope.main_zone();
|
||||
Factory* factory = isolate->factory();
|
||||
ExpectedSnippet<0> snippets[] = {
|
||||
{"var a = do {}; return a;", {factory->undefined_value()}},
|
||||
@ -2782,7 +2725,7 @@ TEST(BytecodeGraphBuilderDoExpressions) {
|
||||
SNPrintF(script, "function %s() { %s }\n%s();", kFunctionName,
|
||||
snippets[i].code_snippet, kFunctionName);
|
||||
|
||||
BytecodeGraphTester tester(isolate, zone, script.start());
|
||||
BytecodeGraphTester tester(isolate, script.start());
|
||||
auto callable = tester.GetCallable<>();
|
||||
Handle<Object> return_value = callable().ToHandleChecked();
|
||||
CHECK(return_value->SameValue(*snippets[i].return_value()));
|
||||
@ -2794,7 +2737,6 @@ TEST(BytecodeGraphBuilderDoExpressions) {
|
||||
TEST(BytecodeGraphBuilderWithStatement) {
|
||||
HandleAndZoneScope scope;
|
||||
Isolate* isolate = scope.main_isolate();
|
||||
Zone* zone = scope.main_zone();
|
||||
|
||||
ExpectedSnippet<0> snippets[] = {
|
||||
{"with({x:42}) return x;", {handle(Smi::FromInt(42), isolate)}},
|
||||
@ -2821,7 +2763,7 @@ TEST(BytecodeGraphBuilderWithStatement) {
|
||||
SNPrintF(script, "function %s() { %s }\n%s();", kFunctionName,
|
||||
snippets[i].code_snippet, kFunctionName);
|
||||
|
||||
BytecodeGraphTester tester(isolate, zone, script.start());
|
||||
BytecodeGraphTester tester(isolate, script.start());
|
||||
auto callable = tester.GetCallable<>();
|
||||
Handle<Object> return_value = callable().ToHandleChecked();
|
||||
CHECK(return_value->SameValue(*snippets[i].return_value()));
|
||||
@ -2831,7 +2773,6 @@ TEST(BytecodeGraphBuilderWithStatement) {
|
||||
TEST(BytecodeGraphBuilderConstDeclaration) {
|
||||
HandleAndZoneScope scope;
|
||||
Isolate* isolate = scope.main_isolate();
|
||||
Zone* zone = scope.main_zone();
|
||||
Factory* factory = isolate->factory();
|
||||
|
||||
ExpectedSnippet<0> snippets[] = {
|
||||
@ -2868,7 +2809,7 @@ TEST(BytecodeGraphBuilderConstDeclaration) {
|
||||
SNPrintF(script, "function %s() { %s }\n%s();", kFunctionName,
|
||||
snippets[i].code_snippet, kFunctionName);
|
||||
|
||||
BytecodeGraphTester tester(isolate, zone, script.start());
|
||||
BytecodeGraphTester tester(isolate, script.start());
|
||||
auto callable = tester.GetCallable<>();
|
||||
Handle<Object> return_value = callable().ToHandleChecked();
|
||||
CHECK(return_value->SameValue(*snippets[i].return_value()));
|
||||
@ -2880,7 +2821,7 @@ TEST(BytecodeGraphBuilderConstDeclaration) {
|
||||
SNPrintF(script, "function %s() {'use strict'; %s }\n%s();", kFunctionName,
|
||||
snippets[i].code_snippet, kFunctionName);
|
||||
|
||||
BytecodeGraphTester tester(isolate, zone, script.start());
|
||||
BytecodeGraphTester tester(isolate, script.start());
|
||||
auto callable = tester.GetCallable<>();
|
||||
Handle<Object> return_value = callable().ToHandleChecked();
|
||||
CHECK(return_value->SameValue(*snippets[i].return_value()));
|
||||
@ -2890,7 +2831,6 @@ TEST(BytecodeGraphBuilderConstDeclaration) {
|
||||
TEST(BytecodeGraphBuilderConstDeclarationLookupSlots) {
|
||||
HandleAndZoneScope scope;
|
||||
Isolate* isolate = scope.main_isolate();
|
||||
Zone* zone = scope.main_zone();
|
||||
Factory* factory = isolate->factory();
|
||||
|
||||
ExpectedSnippet<0> snippets[] = {
|
||||
@ -2910,7 +2850,7 @@ TEST(BytecodeGraphBuilderConstDeclarationLookupSlots) {
|
||||
SNPrintF(script, "function %s() { %s }\n%s();", kFunctionName,
|
||||
snippets[i].code_snippet, kFunctionName);
|
||||
|
||||
BytecodeGraphTester tester(isolate, zone, script.start());
|
||||
BytecodeGraphTester tester(isolate, script.start());
|
||||
auto callable = tester.GetCallable<>();
|
||||
Handle<Object> return_value = callable().ToHandleChecked();
|
||||
CHECK(return_value->SameValue(*snippets[i].return_value()));
|
||||
@ -2922,7 +2862,7 @@ TEST(BytecodeGraphBuilderConstDeclarationLookupSlots) {
|
||||
SNPrintF(script, "function %s() {'use strict'; %s }\n%s();", kFunctionName,
|
||||
snippets[i].code_snippet, kFunctionName);
|
||||
|
||||
BytecodeGraphTester tester(isolate, zone, script.start());
|
||||
BytecodeGraphTester tester(isolate, script.start());
|
||||
auto callable = tester.GetCallable<>();
|
||||
Handle<Object> return_value = callable().ToHandleChecked();
|
||||
CHECK(return_value->SameValue(*snippets[i].return_value()));
|
||||
@ -2932,7 +2872,6 @@ TEST(BytecodeGraphBuilderConstDeclarationLookupSlots) {
|
||||
TEST(BytecodeGraphBuilderConstInLookupContextChain) {
|
||||
HandleAndZoneScope scope;
|
||||
Isolate* isolate = scope.main_isolate();
|
||||
Zone* zone = scope.main_zone();
|
||||
|
||||
const char* prologue =
|
||||
"function OuterMost() {\n"
|
||||
@ -2970,7 +2909,7 @@ TEST(BytecodeGraphBuilderConstInLookupContextChain) {
|
||||
SNPrintF(script, "%s %s %s", prologue, const_decl[i].code_snippet,
|
||||
epilogue);
|
||||
|
||||
BytecodeGraphTester tester(isolate, zone, script.start(), "*");
|
||||
BytecodeGraphTester tester(isolate, script.start(), "*");
|
||||
auto callable = tester.GetCallable<>();
|
||||
Handle<Object> return_value = callable().ToHandleChecked();
|
||||
CHECK(return_value->SameValue(*const_decl[i].return_value()));
|
||||
@ -2980,7 +2919,6 @@ TEST(BytecodeGraphBuilderConstInLookupContextChain) {
|
||||
TEST(BytecodeGraphBuilderIllegalConstDeclaration) {
|
||||
HandleAndZoneScope scope;
|
||||
Isolate* isolate = scope.main_isolate();
|
||||
Zone* zone = scope.main_zone();
|
||||
|
||||
ExpectedSnippet<0, const char*> illegal_const_decl[] = {
|
||||
{"const x = x = 10 + 3; return x;",
|
||||
@ -3003,7 +2941,7 @@ TEST(BytecodeGraphBuilderIllegalConstDeclaration) {
|
||||
SNPrintF(script, "function %s() { %s }\n%s();", kFunctionName,
|
||||
illegal_const_decl[i].code_snippet, kFunctionName);
|
||||
|
||||
BytecodeGraphTester tester(isolate, zone, script.start());
|
||||
BytecodeGraphTester tester(isolate, script.start());
|
||||
v8::Local<v8::String> message = tester.CheckThrowsReturnMessage()->Get();
|
||||
v8::Local<v8::String> expected_string =
|
||||
v8_str(illegal_const_decl[i].return_value());
|
||||
@ -3018,7 +2956,7 @@ TEST(BytecodeGraphBuilderIllegalConstDeclaration) {
|
||||
SNPrintF(script, "function %s() {'use strict'; %s }\n%s();", kFunctionName,
|
||||
illegal_const_decl[i].code_snippet, kFunctionName);
|
||||
|
||||
BytecodeGraphTester tester(isolate, zone, script.start());
|
||||
BytecodeGraphTester tester(isolate, script.start());
|
||||
v8::Local<v8::String> message = tester.CheckThrowsReturnMessage()->Get();
|
||||
v8::Local<v8::String> expected_string =
|
||||
v8_str(illegal_const_decl[i].return_value());
|
||||
@ -3036,7 +2974,6 @@ static void DebugEventCounter(const v8::Debug::EventDetails& event_details) {
|
||||
TEST(BytecodeGraphBuilderDebuggerStatement) {
|
||||
HandleAndZoneScope scope;
|
||||
Isolate* isolate = scope.main_isolate();
|
||||
Zone* zone = scope.main_zone();
|
||||
|
||||
v8::Debug::SetDebugEventListener(CcTest::isolate(), DebugEventCounter);
|
||||
|
||||
@ -3047,7 +2984,7 @@ TEST(BytecodeGraphBuilderDebuggerStatement) {
|
||||
"f();",
|
||||
{isolate->factory()->undefined_value()}};
|
||||
|
||||
BytecodeGraphTester tester(isolate, zone, snippet.code_snippet);
|
||||
BytecodeGraphTester tester(isolate, snippet.code_snippet);
|
||||
auto callable = tester.GetCallable<>();
|
||||
Handle<Object> return_value = callable().ToHandleChecked();
|
||||
|
||||
|
@ -324,8 +324,7 @@ TEST(PreParserScopeAnalysis) {
|
||||
printf("\n");
|
||||
|
||||
i::Handle<i::Script> script = factory->NewScript(source);
|
||||
i::Zone zone(CcTest::i_isolate()->allocator(), ZONE_NAME);
|
||||
i::ParseInfo lazy_info(&zone, script);
|
||||
i::ParseInfo lazy_info(script);
|
||||
|
||||
// No need to run scope analysis; preparser scope data is produced when
|
||||
// parsing.
|
||||
@ -350,7 +349,7 @@ TEST(PreParserScopeAnalysis) {
|
||||
printf("\n");
|
||||
|
||||
script = factory->NewScript(source);
|
||||
i::ParseInfo eager_info(&zone, script);
|
||||
i::ParseInfo eager_info(script);
|
||||
eager_info.set_allow_lazy_parsing(false);
|
||||
|
||||
CHECK(i::parsing::ParseProgram(&eager_info));
|
||||
|
@ -804,8 +804,7 @@ TEST(ScopeUsesArgumentsSuperThis) {
|
||||
factory->NewStringFromUtf8(i::CStrVector(program.start()))
|
||||
.ToHandleChecked();
|
||||
i::Handle<i::Script> script = factory->NewScript(source);
|
||||
i::Zone zone(CcTest::i_isolate()->allocator(), ZONE_NAME);
|
||||
i::ParseInfo info(&zone, script);
|
||||
i::ParseInfo info(script);
|
||||
// The information we're checking is only produced when eager parsing.
|
||||
info.set_allow_lazy_parsing(false);
|
||||
CHECK(i::parsing::ParseProgram(&info));
|
||||
@ -861,7 +860,7 @@ static void CheckParsesToNumber(const char* source, bool with_dot) {
|
||||
|
||||
i::Handle<i::Script> script = factory->NewScript(source_code);
|
||||
|
||||
i::ParseInfo info(handles.main_zone(), script);
|
||||
i::ParseInfo info(script);
|
||||
i::Parser parser(&info);
|
||||
info.set_allow_lazy_parsing(false);
|
||||
info.set_toplevel(true);
|
||||
@ -1159,8 +1158,7 @@ TEST(ScopePositions) {
|
||||
i::CStrVector(program.start())).ToHandleChecked();
|
||||
CHECK_EQ(source->length(), kProgramSize);
|
||||
i::Handle<i::Script> script = factory->NewScript(source);
|
||||
i::Zone zone(CcTest::i_isolate()->allocator(), ZONE_NAME);
|
||||
i::ParseInfo info(&zone, script);
|
||||
i::ParseInfo info(script);
|
||||
info.set_language_mode(source_data[i].language_mode);
|
||||
i::parsing::ParseProgram(&info);
|
||||
CHECK_NOT_NULL(info.literal());
|
||||
@ -1206,8 +1204,7 @@ TEST(DiscardFunctionBody) {
|
||||
i::Handle<i::String> source_code =
|
||||
factory->NewStringFromUtf8(i::CStrVector(source)).ToHandleChecked();
|
||||
i::Handle<i::Script> script = factory->NewScript(source_code);
|
||||
i::Zone zone(CcTest::i_isolate()->allocator(), ZONE_NAME);
|
||||
i::ParseInfo info(&zone, script);
|
||||
i::ParseInfo info(script);
|
||||
i::parsing::ParseProgram(&info);
|
||||
function = info.literal();
|
||||
CHECK_NOT_NULL(function);
|
||||
@ -1337,8 +1334,7 @@ void TestParserSyncWithFlags(i::Handle<i::String> source,
|
||||
i::FunctionLiteral* function;
|
||||
{
|
||||
i::Handle<i::Script> script = factory->NewScript(source);
|
||||
i::Zone zone(CcTest::i_isolate()->allocator(), ZONE_NAME);
|
||||
i::ParseInfo info(&zone, script);
|
||||
i::ParseInfo info(script);
|
||||
info.set_allow_lazy_parsing(flags.Contains(kAllowLazy));
|
||||
SetGlobalFlags(flags);
|
||||
if (is_module) info.set_module();
|
||||
@ -2465,8 +2461,7 @@ TEST(DontRegressPreParserDataSizes) {
|
||||
i::Handle<i::String> source =
|
||||
factory->NewStringFromUtf8(i::CStrVector(program)).ToHandleChecked();
|
||||
i::Handle<i::Script> script = factory->NewScript(source);
|
||||
i::Zone zone(CcTest::i_isolate()->allocator(), ZONE_NAME);
|
||||
i::ParseInfo info(&zone, script);
|
||||
i::ParseInfo info(script);
|
||||
i::ScriptData* sd = NULL;
|
||||
info.set_cached_data(&sd);
|
||||
info.set_compile_options(v8::ScriptCompiler::kProduceParserCache);
|
||||
@ -3353,7 +3348,6 @@ TEST(InnerAssignment) {
|
||||
i::SNPrintF(program, "%s%s%s%s%s", prefix, outer, midfix, inner,
|
||||
suffix);
|
||||
|
||||
i::Zone zone(isolate->allocator(), ZONE_NAME);
|
||||
std::unique_ptr<i::ParseInfo> info;
|
||||
if (lazy) {
|
||||
printf("%s\n", program.start());
|
||||
@ -3361,7 +3355,7 @@ TEST(InnerAssignment) {
|
||||
i::Handle<i::Object> o = v8::Utils::OpenHandle(*v);
|
||||
i::Handle<i::JSFunction> f = i::Handle<i::JSFunction>::cast(o);
|
||||
i::Handle<i::SharedFunctionInfo> shared = i::handle(f->shared());
|
||||
info = std::unique_ptr<i::ParseInfo>(new i::ParseInfo(&zone, shared));
|
||||
info = std::unique_ptr<i::ParseInfo>(new i::ParseInfo(shared));
|
||||
CHECK(i::parsing::ParseFunction(info.get()));
|
||||
} else {
|
||||
i::Handle<i::String> source =
|
||||
@ -3369,7 +3363,7 @@ TEST(InnerAssignment) {
|
||||
source->PrintOn(stdout);
|
||||
printf("\n");
|
||||
i::Handle<i::Script> script = factory->NewScript(source);
|
||||
info = std::unique_ptr<i::ParseInfo>(new i::ParseInfo(&zone, script));
|
||||
info = std::unique_ptr<i::ParseInfo>(new i::ParseInfo(script));
|
||||
info->set_allow_lazy_parsing(false);
|
||||
CHECK(i::parsing::ParseProgram(info.get()));
|
||||
}
|
||||
@ -3468,14 +3462,13 @@ TEST(MaybeAssignedParameters) {
|
||||
i::ScopedVector<char> program(Utf8LengthHelper(source) +
|
||||
Utf8LengthHelper(suffix) + 1);
|
||||
i::SNPrintF(program, "%s%s", source, suffix);
|
||||
i::Zone zone(isolate->allocator(), ZONE_NAME);
|
||||
std::unique_ptr<i::ParseInfo> info;
|
||||
printf("%s\n", program.start());
|
||||
v8::Local<v8::Value> v = CompileRun(program.start());
|
||||
i::Handle<i::Object> o = v8::Utils::OpenHandle(*v);
|
||||
i::Handle<i::JSFunction> f = i::Handle<i::JSFunction>::cast(o);
|
||||
i::Handle<i::SharedFunctionInfo> shared = i::handle(f->shared());
|
||||
info = std::unique_ptr<i::ParseInfo>(new i::ParseInfo(&zone, shared));
|
||||
info = std::unique_ptr<i::ParseInfo>(new i::ParseInfo(shared));
|
||||
info->set_allow_lazy_parsing(allow_lazy);
|
||||
CHECK(i::parsing::ParseFunction(info.get()));
|
||||
CHECK(i::Compiler::Analyze(info.get()));
|
||||
@ -3501,8 +3494,8 @@ struct Input {
|
||||
std::vector<unsigned> location; // "Directions" to the relevant scope.
|
||||
};
|
||||
|
||||
static void TestMaybeAssigned(i::Zone* zone, Input input, const char* variable,
|
||||
bool module, bool allow_lazy_parsing) {
|
||||
static void TestMaybeAssigned(Input input, const char* variable, bool module,
|
||||
bool allow_lazy_parsing) {
|
||||
i::Factory* factory = CcTest::i_isolate()->factory();
|
||||
i::Handle<i::String> string =
|
||||
factory->InternalizeUtf8String(input.source.c_str());
|
||||
@ -3511,7 +3504,7 @@ static void TestMaybeAssigned(i::Zone* zone, Input input, const char* variable,
|
||||
i::Handle<i::Script> script = factory->NewScript(string);
|
||||
|
||||
std::unique_ptr<i::ParseInfo> info;
|
||||
info = std::unique_ptr<i::ParseInfo>(new i::ParseInfo(zone, script));
|
||||
info = std::unique_ptr<i::ParseInfo>(new i::ParseInfo(script));
|
||||
info->set_module(module);
|
||||
info->set_allow_lazy_parsing(allow_lazy_parsing);
|
||||
|
||||
@ -3560,7 +3553,6 @@ TEST(MaybeAssignedInsideLoop) {
|
||||
i::Isolate* isolate = CcTest::i_isolate();
|
||||
i::HandleScope scope(isolate);
|
||||
LocalContext env;
|
||||
i::Zone zone(isolate->allocator(), ZONE_NAME);
|
||||
|
||||
std::vector<unsigned> top; // Can't use {} in initializers below.
|
||||
|
||||
@ -3838,9 +3830,9 @@ TEST(MaybeAssignedInsideLoop) {
|
||||
for (unsigned module = 0; module <= 1; ++module) {
|
||||
for (unsigned allow_lazy_parsing = 0; allow_lazy_parsing <= 1;
|
||||
++allow_lazy_parsing) {
|
||||
TestMaybeAssigned(&zone, input, "foo", module, allow_lazy_parsing);
|
||||
TestMaybeAssigned(input, "foo", module, allow_lazy_parsing);
|
||||
}
|
||||
TestMaybeAssigned(&zone, wrap(input), "foo", module, false);
|
||||
TestMaybeAssigned(wrap(input), "foo", module, false);
|
||||
}
|
||||
}
|
||||
|
||||
@ -3848,9 +3840,9 @@ TEST(MaybeAssignedInsideLoop) {
|
||||
Input input = script_only_tests[i];
|
||||
for (unsigned allow_lazy_parsing = 0; allow_lazy_parsing <= 1;
|
||||
++allow_lazy_parsing) {
|
||||
TestMaybeAssigned(&zone, input, "foo", false, allow_lazy_parsing);
|
||||
TestMaybeAssigned(input, "foo", false, allow_lazy_parsing);
|
||||
}
|
||||
TestMaybeAssigned(&zone, wrap(input), "foo", false, false);
|
||||
TestMaybeAssigned(wrap(input), "foo", false, false);
|
||||
}
|
||||
}
|
||||
|
||||
@ -3882,7 +3874,6 @@ TEST(MaybeAssignedTopLevel) {
|
||||
i::ScopedVector<char> program(Utf8LengthHelper(prefix) +
|
||||
Utf8LengthHelper(source) + 1);
|
||||
i::SNPrintF(program, "%s%s", prefix, source);
|
||||
i::Zone zone(isolate->allocator(), ZONE_NAME);
|
||||
|
||||
i::Handle<i::String> string =
|
||||
factory->InternalizeUtf8String(program.start());
|
||||
@ -3893,7 +3884,7 @@ TEST(MaybeAssignedTopLevel) {
|
||||
for (unsigned allow_lazy = 0; allow_lazy < 2; ++allow_lazy) {
|
||||
for (unsigned module = 0; module < 2; ++module) {
|
||||
std::unique_ptr<i::ParseInfo> info;
|
||||
info = std::unique_ptr<i::ParseInfo>(new i::ParseInfo(&zone, script));
|
||||
info = std::unique_ptr<i::ParseInfo>(new i::ParseInfo(script));
|
||||
info->set_module(module);
|
||||
info->set_allow_lazy_parsing(allow_lazy);
|
||||
|
||||
@ -6346,8 +6337,7 @@ TEST(BasicImportExportParsing) {
|
||||
// Show that parsing as a module works
|
||||
{
|
||||
i::Handle<i::Script> script = factory->NewScript(source);
|
||||
i::Zone zone(CcTest::i_isolate()->allocator(), ZONE_NAME);
|
||||
i::ParseInfo info(&zone, script);
|
||||
i::ParseInfo info(script);
|
||||
info.set_module();
|
||||
if (!i::parsing::ParseProgram(&info)) {
|
||||
i::Handle<i::JSObject> exception_handle(
|
||||
@ -6371,8 +6361,7 @@ TEST(BasicImportExportParsing) {
|
||||
// And that parsing a script does not.
|
||||
{
|
||||
i::Handle<i::Script> script = factory->NewScript(source);
|
||||
i::Zone zone(CcTest::i_isolate()->allocator(), ZONE_NAME);
|
||||
i::ParseInfo info(&zone, script);
|
||||
i::ParseInfo info(script);
|
||||
CHECK(!i::parsing::ParseProgram(&info));
|
||||
isolate->clear_pending_exception();
|
||||
}
|
||||
@ -6462,8 +6451,7 @@ TEST(ImportExportParsingErrors) {
|
||||
factory->NewStringFromAsciiChecked(kErrorSources[i]);
|
||||
|
||||
i::Handle<i::Script> script = factory->NewScript(source);
|
||||
i::Zone zone(CcTest::i_isolate()->allocator(), ZONE_NAME);
|
||||
i::ParseInfo info(&zone, script);
|
||||
i::ParseInfo info(script);
|
||||
info.set_module();
|
||||
CHECK(!i::parsing::ParseProgram(&info));
|
||||
isolate->clear_pending_exception();
|
||||
@ -6499,8 +6487,7 @@ TEST(ModuleTopLevelFunctionDecl) {
|
||||
factory->NewStringFromAsciiChecked(kErrorSources[i]);
|
||||
|
||||
i::Handle<i::Script> script = factory->NewScript(source);
|
||||
i::Zone zone(CcTest::i_isolate()->allocator(), ZONE_NAME);
|
||||
i::ParseInfo info(&zone, script);
|
||||
i::ParseInfo info(script);
|
||||
info.set_module();
|
||||
CHECK(!i::parsing::ParseProgram(&info));
|
||||
isolate->clear_pending_exception();
|
||||
@ -6697,8 +6684,7 @@ TEST(ModuleParsingInternals) {
|
||||
"export {foob};";
|
||||
i::Handle<i::String> source = factory->NewStringFromAsciiChecked(kSource);
|
||||
i::Handle<i::Script> script = factory->NewScript(source);
|
||||
i::Zone zone(CcTest::i_isolate()->allocator(), ZONE_NAME);
|
||||
i::ParseInfo info(&zone, script);
|
||||
i::ParseInfo info(script);
|
||||
info.set_module();
|
||||
CHECK(i::parsing::ParseProgram(&info));
|
||||
CHECK(i::Compiler::Analyze(&info));
|
||||
@ -6957,8 +6943,7 @@ void TestLanguageMode(const char* source,
|
||||
|
||||
i::Handle<i::Script> script =
|
||||
factory->NewScript(factory->NewStringFromAsciiChecked(source));
|
||||
i::Zone zone(CcTest::i_isolate()->allocator(), ZONE_NAME);
|
||||
i::ParseInfo info(&zone, script);
|
||||
i::ParseInfo info(script);
|
||||
i::parsing::ParseProgram(&info);
|
||||
CHECK(info.literal() != NULL);
|
||||
CHECK_EQ(expected_language_mode, info.literal()->language_mode());
|
||||
@ -9432,8 +9417,7 @@ TEST(NoPessimisticContextAllocation) {
|
||||
printf("\n");
|
||||
|
||||
i::Handle<i::Script> script = factory->NewScript(source);
|
||||
i::Zone zone(isolate->allocator(), ZONE_NAME);
|
||||
i::ParseInfo info(&zone, script);
|
||||
i::ParseInfo info(script);
|
||||
|
||||
CHECK(i::parsing::ParseProgram(&info));
|
||||
CHECK(i::Compiler::Analyze(&info));
|
||||
|
@ -35,8 +35,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
|
||||
|
||||
v8::internal::Handle<v8::internal::Script> script =
|
||||
factory->NewScript(source.ToHandleChecked());
|
||||
v8::internal::Zone zone(i_isolate->allocator(), ZONE_NAME);
|
||||
v8::internal::ParseInfo info(&zone, script);
|
||||
v8::internal::ParseInfo info(script);
|
||||
v8::internal::parsing::ParseProgram(&info);
|
||||
isolate->RequestGarbageCollectionForTesting(
|
||||
v8::Isolate::kFullGarbageCollection);
|
||||
|
@ -14,7 +14,6 @@
|
||||
#include "src/objects-inl.h"
|
||||
#include "src/parsing/parse-info.h"
|
||||
#include "src/v8.h"
|
||||
#include "src/zone/zone.h"
|
||||
#include "test/unittests/compiler-dispatcher/compiler-dispatcher-helper.h"
|
||||
#include "test/unittests/test-utils.h"
|
||||
#include "testing/gtest/include/gtest/gtest.h"
|
||||
@ -815,8 +814,7 @@ TEST_F(CompilerDispatcherTest, EnqueueParsed) {
|
||||
Handle<JSFunction> f = Handle<JSFunction>::cast(RunJS(isolate(), script));
|
||||
Handle<SharedFunctionInfo> shared(f->shared(), i_isolate());
|
||||
|
||||
Zone zone(i_isolate()->allocator(), ZONE_NAME);
|
||||
ParseInfo parse_info(&zone, shared);
|
||||
ParseInfo parse_info(shared);
|
||||
ASSERT_TRUE(Compiler::ParseAndAnalyze(&parse_info));
|
||||
|
||||
ASSERT_FALSE(dispatcher.IsEnqueued(shared));
|
||||
@ -841,8 +839,7 @@ TEST_F(CompilerDispatcherTest, EnqueueAndStepParsed) {
|
||||
Handle<JSFunction> f = Handle<JSFunction>::cast(RunJS(isolate(), script));
|
||||
Handle<SharedFunctionInfo> shared(f->shared(), i_isolate());
|
||||
|
||||
Zone zone(i_isolate()->allocator(), ZONE_NAME);
|
||||
ParseInfo parse_info(&zone, shared);
|
||||
ParseInfo parse_info(shared);
|
||||
ASSERT_TRUE(Compiler::ParseAndAnalyze(&parse_info));
|
||||
|
||||
ASSERT_FALSE(dispatcher.IsEnqueued(shared));
|
||||
@ -878,8 +875,7 @@ TEST_F(CompilerDispatcherTest, FinishAllNow) {
|
||||
ASSERT_FALSE(shared2->is_compiled());
|
||||
|
||||
// Enqueue shared1 as already parsed.
|
||||
Zone zone(i_isolate()->allocator(), ZONE_NAME);
|
||||
ParseInfo parse_info(&zone, shared1);
|
||||
ParseInfo parse_info(shared1);
|
||||
ASSERT_TRUE(Compiler::ParseAndAnalyze(&parse_info));
|
||||
ASSERT_TRUE(dispatcher.Enqueue(shared1, parse_info.literal()));
|
||||
|
||||
|
@ -12,7 +12,6 @@
|
||||
#include "src/isolate.h"
|
||||
#include "src/objects-inl.h"
|
||||
#include "src/parsing/parse-info.h"
|
||||
#include "src/zone/zone.h"
|
||||
#include "test/unittests/compiler-dispatcher/compiler-dispatcher-helper.h"
|
||||
#include "test/unittests/test-utils.h"
|
||||
#include "testing/gtest/include/gtest/gtest.h"
|
||||
@ -29,8 +28,7 @@ class BlockingCompilationJob : public CompilationJob {
|
||||
BlockingCompilationJob(Isolate* isolate, Handle<JSFunction> function)
|
||||
: CompilationJob(isolate, &info_, "BlockingCompilationJob",
|
||||
State::kReadyToExecute),
|
||||
zone_(isolate->allocator(), ZONE_NAME),
|
||||
parse_info_(&zone_, handle(function->shared())),
|
||||
parse_info_(handle(function->shared())),
|
||||
info_(&parse_info_, function),
|
||||
blocking_(false),
|
||||
semaphore_(0) {}
|
||||
@ -55,7 +53,6 @@ class BlockingCompilationJob : public CompilationJob {
|
||||
Status FinalizeJobImpl() override { return SUCCEEDED; }
|
||||
|
||||
private:
|
||||
Zone zone_;
|
||||
ParseInfo parse_info_;
|
||||
CompilationInfo info_;
|
||||
base::AtomicValue<bool> blocking_;
|
||||
|
@ -94,8 +94,7 @@ std::pair<v8::base::TimeDelta, v8::base::TimeDelta> RunBaselineParser(
|
||||
i::ScriptData* cached_data_impl = NULL;
|
||||
// First round of parsing (produce data to cache).
|
||||
{
|
||||
Zone zone(reinterpret_cast<i::Isolate*>(isolate)->allocator(), ZONE_NAME);
|
||||
ParseInfo info(&zone, script);
|
||||
ParseInfo info(script);
|
||||
info.set_cached_data(&cached_data_impl);
|
||||
info.set_compile_options(v8::ScriptCompiler::kProduceParserCache);
|
||||
v8::base::ElapsedTimer timer;
|
||||
@ -109,8 +108,7 @@ std::pair<v8::base::TimeDelta, v8::base::TimeDelta> RunBaselineParser(
|
||||
}
|
||||
// Second round of parsing (consume cached data).
|
||||
{
|
||||
Zone zone(reinterpret_cast<i::Isolate*>(isolate)->allocator(), ZONE_NAME);
|
||||
ParseInfo info(&zone, script);
|
||||
ParseInfo info(script);
|
||||
info.set_cached_data(&cached_data_impl);
|
||||
info.set_compile_options(v8::ScriptCompiler::kConsumeParserCache);
|
||||
v8::base::ElapsedTimer timer;
|
||||
|
Loading…
Reference in New Issue
Block a user