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/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/compiler.h" | 7 #include "src/compiler.h" |
8 | 8 |
9 #include "src/ast-numbering.h" | 9 #include "src/ast-numbering.h" |
10 #include "src/bootstrapper.h" | 10 #include "src/bootstrapper.h" |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 Initialize(isolate, BASE, zone); | 137 Initialize(isolate, BASE, zone); |
138 } | 138 } |
139 | 139 |
140 | 140 |
141 void CompilationInfo::Initialize(Isolate* isolate, | 141 void CompilationInfo::Initialize(Isolate* isolate, |
142 Mode mode, | 142 Mode mode, |
143 Zone* zone) { | 143 Zone* zone) { |
144 isolate_ = isolate; | 144 isolate_ = isolate; |
145 function_ = NULL; | 145 function_ = NULL; |
146 scope_ = NULL; | 146 scope_ = NULL; |
147 global_scope_ = NULL; | 147 script_scope_ = NULL; |
148 extension_ = NULL; | 148 extension_ = NULL; |
149 cached_data_ = NULL; | 149 cached_data_ = NULL; |
150 compile_options_ = ScriptCompiler::kNoCompileOptions; | 150 compile_options_ = ScriptCompiler::kNoCompileOptions; |
151 zone_ = zone; | 151 zone_ = zone; |
152 deferred_handles_ = NULL; | 152 deferred_handles_ = NULL; |
153 code_stub_ = NULL; | 153 code_stub_ = NULL; |
154 prologue_offset_ = Code::kPrologueOffsetNotSet; | 154 prologue_offset_ = Code::kPrologueOffsetNotSet; |
155 opt_count_ = shared_info().is_null() ? 0 : shared_info()->opt_count(); | 155 opt_count_ = shared_info().is_null() ? 0 : shared_info()->opt_count(); |
156 no_frame_ranges_ = isolate->cpu_profiler()->is_profiling() | 156 no_frame_ranges_ = isolate->cpu_profiler()->is_profiling() |
157 ? new List<OffsetRange>(2) : NULL; | 157 ? new List<OffsetRange>(2) : NULL; |
(...skipping 1078 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1236 info.SetContext(context); | 1236 info.SetContext(context); |
1237 if (FLAG_serialize_toplevel && | 1237 if (FLAG_serialize_toplevel && |
1238 compile_options == ScriptCompiler::kProduceCodeCache) { | 1238 compile_options == ScriptCompiler::kProduceCodeCache) { |
1239 info.PrepareForSerializing(); | 1239 info.PrepareForSerializing(); |
1240 } | 1240 } |
1241 if (FLAG_use_strict) info.SetStrictMode(STRICT); | 1241 if (FLAG_use_strict) info.SetStrictMode(STRICT); |
1242 | 1242 |
1243 result = CompileToplevel(&info); | 1243 result = CompileToplevel(&info); |
1244 if (extension == NULL && !result.is_null() && !result->dont_cache()) { | 1244 if (extension == NULL && !result.is_null() && !result->dont_cache()) { |
1245 compilation_cache->PutScript(source, context, result); | 1245 compilation_cache->PutScript(source, context, result); |
1246 // TODO(yangguo): Issue 3628 | 1246 if (FLAG_serialize_toplevel && |
1247 // With block scoping, top-level variables may resolve to a global, | |
1248 // context, which makes the code context-dependent. | |
1249 if (FLAG_serialize_toplevel && !FLAG_harmony_scoping && | |
1250 compile_options == ScriptCompiler::kProduceCodeCache) { | 1247 compile_options == ScriptCompiler::kProduceCodeCache) { |
1251 HistogramTimerScope histogram_timer( | 1248 HistogramTimerScope histogram_timer( |
1252 isolate->counters()->compile_serialize()); | 1249 isolate->counters()->compile_serialize()); |
1253 *cached_data = CodeSerializer::Serialize(isolate, result, source); | 1250 *cached_data = CodeSerializer::Serialize(isolate, result, source); |
1254 if (FLAG_profile_deserialization) { | 1251 if (FLAG_profile_deserialization) { |
1255 PrintF("[Compiling and serializing took %0.3f ms]\n", | 1252 PrintF("[Compiling and serializing took %0.3f ms]\n", |
1256 timer.Elapsed().InMillisecondsF()); | 1253 timer.Elapsed().InMillisecondsF()); |
1257 } | 1254 } |
1258 } | 1255 } |
1259 } | 1256 } |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1473 AllowHandleDereference allow_deref; | 1470 AllowHandleDereference allow_deref; |
1474 bool tracing_on = info()->IsStub() | 1471 bool tracing_on = info()->IsStub() |
1475 ? FLAG_trace_hydrogen_stubs | 1472 ? FLAG_trace_hydrogen_stubs |
1476 : (FLAG_trace_hydrogen && | 1473 : (FLAG_trace_hydrogen && |
1477 info()->closure()->PassesFilter(FLAG_trace_hydrogen_filter)); | 1474 info()->closure()->PassesFilter(FLAG_trace_hydrogen_filter)); |
1478 return (tracing_on && | 1475 return (tracing_on && |
1479 base::OS::StrChr(const_cast<char*>(FLAG_trace_phase), name_[0]) != NULL); | 1476 base::OS::StrChr(const_cast<char*>(FLAG_trace_phase), name_[0]) != NULL); |
1480 } | 1477 } |
1481 | 1478 |
1482 } } // namespace v8::internal | 1479 } } // namespace v8::internal |
OLD | NEW |