OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/full-codegen/full-codegen.h" | 5 #include "src/full-codegen/full-codegen.h" |
6 | 6 |
7 #include "src/ast/ast-numbering.h" | 7 #include "src/ast/ast-numbering.h" |
8 #include "src/ast/ast.h" | 8 #include "src/ast/ast.h" |
9 #include "src/ast/prettyprinter.h" | 9 #include "src/ast/prettyprinter.h" |
10 #include "src/ast/scopes.h" | 10 #include "src/ast/scopes.h" |
11 #include "src/code-factory.h" | 11 #include "src/code-factory.h" |
12 #include "src/codegen.h" | 12 #include "src/codegen.h" |
| 13 #include "src/compilation-info.h" |
13 #include "src/compiler.h" | 14 #include "src/compiler.h" |
14 #include "src/debug/debug.h" | 15 #include "src/debug/debug.h" |
15 #include "src/debug/liveedit.h" | 16 #include "src/debug/liveedit.h" |
16 #include "src/frames-inl.h" | 17 #include "src/frames-inl.h" |
17 #include "src/globals.h" | 18 #include "src/globals.h" |
18 #include "src/isolate-inl.h" | 19 #include "src/isolate-inl.h" |
19 #include "src/macro-assembler.h" | 20 #include "src/macro-assembler.h" |
20 #include "src/snapshot/snapshot.h" | 21 #include "src/snapshot/snapshot.h" |
21 #include "src/tracing/trace-event.h" | 22 #include "src/tracing/trace-event.h" |
22 | 23 |
(...skipping 13 matching lines...) Expand all Loading... |
36 | 37 |
37 CompilationJob::Status ExecuteJobImpl() final { | 38 CompilationJob::Status ExecuteJobImpl() final { |
38 DCHECK(ThreadId::Current().Equals(isolate()->thread_id())); | 39 DCHECK(ThreadId::Current().Equals(isolate()->thread_id())); |
39 return FullCodeGenerator::MakeCode(info(), stack_limit()) ? SUCCEEDED | 40 return FullCodeGenerator::MakeCode(info(), stack_limit()) ? SUCCEEDED |
40 : FAILED; | 41 : FAILED; |
41 } | 42 } |
42 | 43 |
43 CompilationJob::Status FinalizeJobImpl() final { return SUCCEEDED; } | 44 CompilationJob::Status FinalizeJobImpl() final { return SUCCEEDED; } |
44 }; | 45 }; |
45 | 46 |
| 47 FullCodeGenerator::FullCodeGenerator(MacroAssembler* masm, |
| 48 CompilationInfo* info, |
| 49 uintptr_t stack_limit) |
| 50 : masm_(masm), |
| 51 info_(info), |
| 52 isolate_(info->isolate()), |
| 53 zone_(info->zone()), |
| 54 scope_(info->scope()), |
| 55 nesting_stack_(NULL), |
| 56 loop_depth_(0), |
| 57 operand_stack_depth_(0), |
| 58 globals_(NULL), |
| 59 context_(NULL), |
| 60 bailout_entries_(info->HasDeoptimizationSupport() |
| 61 ? info->literal()->ast_node_count() |
| 62 : 0, |
| 63 info->zone()), |
| 64 back_edges_(2, info->zone()), |
| 65 handler_table_(info->zone()), |
| 66 source_position_table_builder_(info->zone(), |
| 67 info->SourcePositionRecordingMode()), |
| 68 ic_total_count_(0) { |
| 69 DCHECK(!info->IsStub()); |
| 70 Initialize(stack_limit); |
| 71 } |
| 72 |
46 // static | 73 // static |
47 CompilationJob* FullCodeGenerator::NewCompilationJob(CompilationInfo* info) { | 74 CompilationJob* FullCodeGenerator::NewCompilationJob(CompilationInfo* info) { |
48 return new FullCodegenCompilationJob(info); | 75 return new FullCodegenCompilationJob(info); |
49 } | 76 } |
50 | 77 |
51 // static | 78 // static |
| 79 bool FullCodeGenerator::MakeCode(CompilationInfo* info) { |
| 80 return MakeCode(info, info->isolate()->stack_guard()->real_climit()); |
| 81 } |
| 82 |
| 83 // static |
52 bool FullCodeGenerator::MakeCode(CompilationInfo* info, uintptr_t stack_limit) { | 84 bool FullCodeGenerator::MakeCode(CompilationInfo* info, uintptr_t stack_limit) { |
53 Isolate* isolate = info->isolate(); | 85 Isolate* isolate = info->isolate(); |
54 | 86 |
55 DCHECK(!FLAG_minimal); | 87 DCHECK(!FLAG_minimal); |
56 RuntimeCallTimerScope runtimeTimer(isolate, | 88 RuntimeCallTimerScope runtimeTimer(isolate, |
57 &RuntimeCallStats::CompileFullCode); | 89 &RuntimeCallStats::CompileFullCode); |
58 TimerEventScope<TimerEventCompileFullCode> timer(info->isolate()); | 90 TimerEventScope<TimerEventCompileFullCode> timer(info->isolate()); |
59 TRACE_EVENT_RUNTIME_CALL_STATS_TRACING_SCOPED( | 91 TRACE_EVENT_RUNTIME_CALL_STATS_TRACING_SCOPED( |
60 isolate, &tracing::TraceEventStatsTable::CompileFullCode); | 92 isolate, &tracing::TraceEventStatsTable::CompileFullCode); |
61 | 93 |
(...skipping 1896 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1958 } | 1990 } |
1959 | 1991 |
1960 // Check that we always have valid source position. | 1992 // Check that we always have valid source position. |
1961 DCHECK(var->initializer_position() != kNoSourcePosition); | 1993 DCHECK(var->initializer_position() != kNoSourcePosition); |
1962 DCHECK(proxy->position() != kNoSourcePosition); | 1994 DCHECK(proxy->position() != kNoSourcePosition); |
1963 | 1995 |
1964 return var->scope()->is_nonlinear() || | 1996 return var->scope()->is_nonlinear() || |
1965 var->initializer_position() >= proxy->position(); | 1997 var->initializer_position() >= proxy->position(); |
1966 } | 1998 } |
1967 | 1999 |
| 2000 Handle<Script> FullCodeGenerator::script() { return info_->script(); } |
| 2001 |
| 2002 LanguageMode FullCodeGenerator::language_mode() { |
| 2003 return scope()->language_mode(); |
| 2004 } |
| 2005 |
| 2006 bool FullCodeGenerator::has_simple_parameters() { |
| 2007 return info_->has_simple_parameters(); |
| 2008 } |
| 2009 |
| 2010 FunctionLiteral* FullCodeGenerator::literal() const { return info_->literal(); } |
1968 | 2011 |
1969 #undef __ | 2012 #undef __ |
1970 | 2013 |
1971 | 2014 |
1972 } // namespace internal | 2015 } // namespace internal |
1973 } // namespace v8 | 2016 } // namespace v8 |
OLD | NEW |