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 1006 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1017 } | 1017 } |
1018 | 1018 |
1019 if (result.is_null()) isolate->ReportPendingMessages(); | 1019 if (result.is_null()) isolate->ReportPendingMessages(); |
1020 } else if (result->ic_age() != isolate->heap()->global_ic_age()) { | 1020 } else if (result->ic_age() != isolate->heap()->global_ic_age()) { |
1021 result->ResetForNewContext(isolate->heap()->global_ic_age()); | 1021 result->ResetForNewContext(isolate->heap()->global_ic_age()); |
1022 } | 1022 } |
1023 return result; | 1023 return result; |
1024 } | 1024 } |
1025 | 1025 |
1026 | 1026 |
1027 Handle<SharedFunctionInfo> Compiler::BuildFunctionInfo(FunctionLiteral* literal, | 1027 Handle<SharedFunctionInfo> Compiler::BuildFunctionInfo( |
1028 Handle<Script> script) { | 1028 FunctionLiteral* literal, Handle<Script> script, |
| 1029 CompilationInfo* outer_info) { |
1029 // Precondition: code has been parsed and scopes have been analyzed. | 1030 // Precondition: code has been parsed and scopes have been analyzed. |
1030 CompilationInfoWithZone info(script); | 1031 CompilationInfoWithZone info(script); |
1031 info.SetFunction(literal); | 1032 info.SetFunction(literal); |
1032 info.PrepareForCompilation(literal->scope()); | 1033 info.PrepareForCompilation(literal->scope()); |
1033 info.SetStrictMode(literal->scope()->strict_mode()); | 1034 info.SetStrictMode(literal->scope()->strict_mode()); |
| 1035 if (outer_info->will_serialize()) info.PrepareForSerializing(); |
1034 | 1036 |
1035 Isolate* isolate = info.isolate(); | 1037 Isolate* isolate = info.isolate(); |
1036 Factory* factory = isolate->factory(); | 1038 Factory* factory = isolate->factory(); |
1037 LiveEditFunctionTracker live_edit_tracker(isolate, literal); | 1039 LiveEditFunctionTracker live_edit_tracker(isolate, literal); |
1038 // Determine if the function can be lazily compiled. This is necessary to | 1040 // Determine if the function can be lazily compiled. This is necessary to |
1039 // allow some of our builtin JS files to be lazily compiled. These | 1041 // allow some of our builtin JS files to be lazily compiled. These |
1040 // builtins cannot be handled lazily by the parser, since we have to know | 1042 // builtins cannot be handled lazily by the parser, since we have to know |
1041 // if a function uses the special natives syntax, which is something the | 1043 // if a function uses the special natives syntax, which is something the |
1042 // parser records. | 1044 // parser records. |
1043 // If the debugger requests compilation for break points, we cannot be | 1045 // If the debugger requests compilation for break points, we cannot be |
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1342 AllowHandleDereference allow_deref; | 1344 AllowHandleDereference allow_deref; |
1343 bool tracing_on = info()->IsStub() | 1345 bool tracing_on = info()->IsStub() |
1344 ? FLAG_trace_hydrogen_stubs | 1346 ? FLAG_trace_hydrogen_stubs |
1345 : (FLAG_trace_hydrogen && | 1347 : (FLAG_trace_hydrogen && |
1346 info()->closure()->PassesFilter(FLAG_trace_hydrogen_filter)); | 1348 info()->closure()->PassesFilter(FLAG_trace_hydrogen_filter)); |
1347 return (tracing_on && | 1349 return (tracing_on && |
1348 base::OS::StrChr(const_cast<char*>(FLAG_trace_phase), name_[0]) != NULL); | 1350 base::OS::StrChr(const_cast<char*>(FLAG_trace_phase), name_[0]) != NULL); |
1349 } | 1351 } |
1350 | 1352 |
1351 } } // namespace v8::internal | 1353 } } // namespace v8::internal |
OLD | NEW |