OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 909 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
920 | 920 |
921 | 921 |
922 Handle<SharedFunctionInfo> Compiler::CompileScript(Handle<String> source, | 922 Handle<SharedFunctionInfo> Compiler::CompileScript(Handle<String> source, |
923 Handle<Object> script_name, | 923 Handle<Object> script_name, |
924 int line_offset, | 924 int line_offset, |
925 int column_offset, | 925 int column_offset, |
926 bool is_shared_cross_origin, | 926 bool is_shared_cross_origin, |
927 Handle<Context> context, | 927 Handle<Context> context, |
928 v8::Extension* extension, | 928 v8::Extension* extension, |
929 ScriptDataImpl* pre_data, | 929 ScriptDataImpl* pre_data, |
930 Handle<Object> script_data, | |
931 NativesFlag natives) { | 930 NativesFlag natives) { |
932 Isolate* isolate = source->GetIsolate(); | 931 Isolate* isolate = source->GetIsolate(); |
933 int source_length = source->length(); | 932 int source_length = source->length(); |
934 isolate->counters()->total_load_size()->Increment(source_length); | 933 isolate->counters()->total_load_size()->Increment(source_length); |
935 isolate->counters()->total_compile_size()->Increment(source_length); | 934 isolate->counters()->total_compile_size()->Increment(source_length); |
936 | 935 |
937 CompilationCache* compilation_cache = isolate->compilation_cache(); | 936 CompilationCache* compilation_cache = isolate->compilation_cache(); |
938 | 937 |
939 // Do a lookup in the compilation cache but not for extensions. | 938 // Do a lookup in the compilation cache but not for extensions. |
940 Handle<SharedFunctionInfo> result; | 939 Handle<SharedFunctionInfo> result; |
(...skipping 21 matching lines...) Expand all Loading... |
962 if (natives == NATIVES_CODE) { | 961 if (natives == NATIVES_CODE) { |
963 script->set_type(Smi::FromInt(Script::TYPE_NATIVE)); | 962 script->set_type(Smi::FromInt(Script::TYPE_NATIVE)); |
964 } | 963 } |
965 if (!script_name.is_null()) { | 964 if (!script_name.is_null()) { |
966 script->set_name(*script_name); | 965 script->set_name(*script_name); |
967 script->set_line_offset(Smi::FromInt(line_offset)); | 966 script->set_line_offset(Smi::FromInt(line_offset)); |
968 script->set_column_offset(Smi::FromInt(column_offset)); | 967 script->set_column_offset(Smi::FromInt(column_offset)); |
969 } | 968 } |
970 script->set_is_shared_cross_origin(is_shared_cross_origin); | 969 script->set_is_shared_cross_origin(is_shared_cross_origin); |
971 | 970 |
972 script->set_data(script_data.is_null() ? isolate->heap()->undefined_value() | |
973 : *script_data); | |
974 | |
975 // Compile the function and add it to the cache. | 971 // Compile the function and add it to the cache. |
976 CompilationInfoWithZone info(script); | 972 CompilationInfoWithZone info(script); |
977 info.MarkAsGlobal(); | 973 info.MarkAsGlobal(); |
978 info.SetExtension(extension); | 974 info.SetExtension(extension); |
979 info.SetPreParseData(pre_data); | 975 info.SetPreParseData(pre_data); |
980 info.SetContext(context); | 976 info.SetContext(context); |
981 if (FLAG_use_strict) { | 977 if (FLAG_use_strict) { |
982 info.SetLanguageMode(FLAG_harmony_scoping ? EXTENDED_MODE : STRICT_MODE); | 978 info.SetLanguageMode(FLAG_harmony_scoping ? EXTENDED_MODE : STRICT_MODE); |
983 } | 979 } |
984 result = CompileToplevel(&info); | 980 result = CompileToplevel(&info); |
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1311 AllowHandleDereference allow_deref; | 1307 AllowHandleDereference allow_deref; |
1312 bool tracing_on = info()->IsStub() | 1308 bool tracing_on = info()->IsStub() |
1313 ? FLAG_trace_hydrogen_stubs | 1309 ? FLAG_trace_hydrogen_stubs |
1314 : (FLAG_trace_hydrogen && | 1310 : (FLAG_trace_hydrogen && |
1315 info()->closure()->PassesFilter(FLAG_trace_hydrogen_filter)); | 1311 info()->closure()->PassesFilter(FLAG_trace_hydrogen_filter)); |
1316 return (tracing_on && | 1312 return (tracing_on && |
1317 OS::StrChr(const_cast<char*>(FLAG_trace_phase), name_[0]) != NULL); | 1313 OS::StrChr(const_cast<char*>(FLAG_trace_phase), name_[0]) != NULL); |
1318 } | 1314 } |
1319 | 1315 |
1320 } } // namespace v8::internal | 1316 } } // namespace v8::internal |
OLD | NEW |