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, |
930 NativesFlag natives) { | 931 NativesFlag natives) { |
931 Isolate* isolate = source->GetIsolate(); | 932 Isolate* isolate = source->GetIsolate(); |
932 int source_length = source->length(); | 933 int source_length = source->length(); |
933 isolate->counters()->total_load_size()->Increment(source_length); | 934 isolate->counters()->total_load_size()->Increment(source_length); |
934 isolate->counters()->total_compile_size()->Increment(source_length); | 935 isolate->counters()->total_compile_size()->Increment(source_length); |
935 | 936 |
936 CompilationCache* compilation_cache = isolate->compilation_cache(); | 937 CompilationCache* compilation_cache = isolate->compilation_cache(); |
937 | 938 |
938 // Do a lookup in the compilation cache but not for extensions. | 939 // Do a lookup in the compilation cache but not for extensions. |
939 Handle<SharedFunctionInfo> result; | 940 Handle<SharedFunctionInfo> result; |
(...skipping 21 matching lines...) Expand all Loading... |
961 if (natives == NATIVES_CODE) { | 962 if (natives == NATIVES_CODE) { |
962 script->set_type(Smi::FromInt(Script::TYPE_NATIVE)); | 963 script->set_type(Smi::FromInt(Script::TYPE_NATIVE)); |
963 } | 964 } |
964 if (!script_name.is_null()) { | 965 if (!script_name.is_null()) { |
965 script->set_name(*script_name); | 966 script->set_name(*script_name); |
966 script->set_line_offset(Smi::FromInt(line_offset)); | 967 script->set_line_offset(Smi::FromInt(line_offset)); |
967 script->set_column_offset(Smi::FromInt(column_offset)); | 968 script->set_column_offset(Smi::FromInt(column_offset)); |
968 } | 969 } |
969 script->set_is_shared_cross_origin(is_shared_cross_origin); | 970 script->set_is_shared_cross_origin(is_shared_cross_origin); |
970 | 971 |
| 972 script->set_data(script_data.is_null() ? isolate->heap()->undefined_value() |
| 973 : *script_data); |
| 974 |
971 // Compile the function and add it to the cache. | 975 // Compile the function and add it to the cache. |
972 CompilationInfoWithZone info(script); | 976 CompilationInfoWithZone info(script); |
973 info.MarkAsGlobal(); | 977 info.MarkAsGlobal(); |
974 info.SetExtension(extension); | 978 info.SetExtension(extension); |
975 info.SetPreParseData(pre_data); | 979 info.SetPreParseData(pre_data); |
976 info.SetContext(context); | 980 info.SetContext(context); |
977 if (FLAG_use_strict) { | 981 if (FLAG_use_strict) { |
978 info.SetLanguageMode(FLAG_harmony_scoping ? EXTENDED_MODE : STRICT_MODE); | 982 info.SetLanguageMode(FLAG_harmony_scoping ? EXTENDED_MODE : STRICT_MODE); |
979 } | 983 } |
980 result = CompileToplevel(&info); | 984 result = CompileToplevel(&info); |
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1307 AllowHandleDereference allow_deref; | 1311 AllowHandleDereference allow_deref; |
1308 bool tracing_on = info()->IsStub() | 1312 bool tracing_on = info()->IsStub() |
1309 ? FLAG_trace_hydrogen_stubs | 1313 ? FLAG_trace_hydrogen_stubs |
1310 : (FLAG_trace_hydrogen && | 1314 : (FLAG_trace_hydrogen && |
1311 info()->closure()->PassesFilter(FLAG_trace_hydrogen_filter)); | 1315 info()->closure()->PassesFilter(FLAG_trace_hydrogen_filter)); |
1312 return (tracing_on && | 1316 return (tracing_on && |
1313 OS::StrChr(const_cast<char*>(FLAG_trace_phase), name_[0]) != NULL); | 1317 OS::StrChr(const_cast<char*>(FLAG_trace_phase), name_[0]) != NULL); |
1314 } | 1318 } |
1315 | 1319 |
1316 } } // namespace v8::internal | 1320 } } // namespace v8::internal |
OLD | NEW |