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/bootstrapper.h" | 9 #include "src/bootstrapper.h" |
10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
(...skipping 1203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1214 info.SetContext(context); | 1214 info.SetContext(context); |
1215 if (FLAG_serialize_toplevel && | 1215 if (FLAG_serialize_toplevel && |
1216 compile_options == ScriptCompiler::kProduceCodeCache) { | 1216 compile_options == ScriptCompiler::kProduceCodeCache) { |
1217 info.PrepareForSerializing(); | 1217 info.PrepareForSerializing(); |
1218 } | 1218 } |
1219 if (FLAG_use_strict) info.SetStrictMode(STRICT); | 1219 if (FLAG_use_strict) info.SetStrictMode(STRICT); |
1220 | 1220 |
1221 result = CompileToplevel(&info); | 1221 result = CompileToplevel(&info); |
1222 if (extension == NULL && !result.is_null() && !result->dont_cache()) { | 1222 if (extension == NULL && !result.is_null() && !result->dont_cache()) { |
1223 compilation_cache->PutScript(source, context, result); | 1223 compilation_cache->PutScript(source, context, result); |
1224 if (FLAG_serialize_toplevel && | 1224 // TODO(yangguo): Issue 3628 |
| 1225 // With block scoping, top-level variables may resolve to a global, |
| 1226 // context, which makes the code context-dependent. |
| 1227 if (FLAG_serialize_toplevel && !FLAG_harmony_scoping && |
1225 compile_options == ScriptCompiler::kProduceCodeCache) { | 1228 compile_options == ScriptCompiler::kProduceCodeCache) { |
1226 HistogramTimerScope histogram_timer( | 1229 HistogramTimerScope histogram_timer( |
1227 isolate->counters()->compile_serialize()); | 1230 isolate->counters()->compile_serialize()); |
1228 *cached_data = CodeSerializer::Serialize(isolate, result, source); | 1231 *cached_data = CodeSerializer::Serialize(isolate, result, source); |
1229 if (FLAG_profile_deserialization) { | 1232 if (FLAG_profile_deserialization) { |
1230 PrintF("[Compiling and serializing %d bytes took %0.3f ms]\n", | 1233 PrintF("[Compiling and serializing %d bytes took %0.3f ms]\n", |
1231 (*cached_data)->length(), timer.Elapsed().InMillisecondsF()); | 1234 (*cached_data)->length(), timer.Elapsed().InMillisecondsF()); |
1232 } | 1235 } |
1233 } | 1236 } |
1234 } | 1237 } |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1446 AllowHandleDereference allow_deref; | 1449 AllowHandleDereference allow_deref; |
1447 bool tracing_on = info()->IsStub() | 1450 bool tracing_on = info()->IsStub() |
1448 ? FLAG_trace_hydrogen_stubs | 1451 ? FLAG_trace_hydrogen_stubs |
1449 : (FLAG_trace_hydrogen && | 1452 : (FLAG_trace_hydrogen && |
1450 info()->closure()->PassesFilter(FLAG_trace_hydrogen_filter)); | 1453 info()->closure()->PassesFilter(FLAG_trace_hydrogen_filter)); |
1451 return (tracing_on && | 1454 return (tracing_on && |
1452 base::OS::StrChr(const_cast<char*>(FLAG_trace_phase), name_[0]) != NULL); | 1455 base::OS::StrChr(const_cast<char*>(FLAG_trace_phase), name_[0]) != NULL); |
1453 } | 1456 } |
1454 | 1457 |
1455 } } // namespace v8::internal | 1458 } } // namespace v8::internal |
OLD | NEW |