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 528 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
539 | 539 |
540 static bool DebuggerWantsEagerCompilation(CompilationInfo* info, | 540 static bool DebuggerWantsEagerCompilation(CompilationInfo* info, |
541 bool allow_lazy_without_ctx = false) { | 541 bool allow_lazy_without_ctx = false) { |
542 return LiveEditFunctionTracker::IsActive(info->isolate()) || | 542 return LiveEditFunctionTracker::IsActive(info->isolate()) || |
543 (info->isolate()->DebuggerHasBreakPoints() && !allow_lazy_without_ctx); | 543 (info->isolate()->DebuggerHasBreakPoints() && !allow_lazy_without_ctx); |
544 } | 544 } |
545 | 545 |
546 | 546 |
547 static Handle<SharedFunctionInfo> MakeFunctionInfo(CompilationInfo* info) { | 547 static Handle<SharedFunctionInfo> MakeFunctionInfo(CompilationInfo* info) { |
548 Isolate* isolate = info->isolate(); | 548 Isolate* isolate = info->isolate(); |
549 ZoneScope zone_scope(info->zone(), DELETE_ON_EXIT); | |
550 PostponeInterruptsScope postpone(isolate); | 549 PostponeInterruptsScope postpone(isolate); |
551 | 550 |
552 ASSERT(!isolate->native_context().is_null()); | 551 ASSERT(!isolate->native_context().is_null()); |
553 Handle<Script> script = info->script(); | 552 Handle<Script> script = info->script(); |
554 // TODO(svenpanne) Obscure place for this, perhaps move to OnBeforeCompile? | 553 // TODO(svenpanne) Obscure place for this, perhaps move to OnBeforeCompile? |
555 FixedArray* array = isolate->native_context()->embedder_data(); | 554 FixedArray* array = isolate->native_context()->embedder_data(); |
556 script->set_context_data(array->get(0)); | 555 script->set_context_data(array->get(0)); |
557 | 556 |
558 #ifdef ENABLE_DEBUGGER_SUPPORT | 557 #ifdef ENABLE_DEBUGGER_SUPPORT |
559 if (info->is_eval()) { | 558 if (info->is_eval()) { |
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
903 return true; | 902 return true; |
904 } | 903 } |
905 } | 904 } |
906 return false; | 905 return false; |
907 } | 906 } |
908 | 907 |
909 | 908 |
910 bool Compiler::CompileLazy(CompilationInfo* info) { | 909 bool Compiler::CompileLazy(CompilationInfo* info) { |
911 Isolate* isolate = info->isolate(); | 910 Isolate* isolate = info->isolate(); |
912 | 911 |
913 ZoneScope zone_scope(info->zone(), DELETE_ON_EXIT); | |
914 | |
915 // The VM is in the COMPILER state until exiting this function. | 912 // The VM is in the COMPILER state until exiting this function. |
916 VMState<COMPILER> state(isolate); | 913 VMState<COMPILER> state(isolate); |
917 | 914 |
918 PostponeInterruptsScope postpone(isolate); | 915 PostponeInterruptsScope postpone(isolate); |
919 | 916 |
920 Handle<SharedFunctionInfo> shared = info->shared_info(); | 917 Handle<SharedFunctionInfo> shared = info->shared_info(); |
921 int compiled_size = shared->end_position() - shared->start_position(); | 918 int compiled_size = shared->end_position() - shared->start_position(); |
922 isolate->counters()->total_compile_size()->Increment(compiled_size); | 919 isolate->counters()->total_compile_size()->Increment(compiled_size); |
923 | 920 |
924 if (InstallCodeFromOptimizedCodeMap(info)) return true; | 921 if (InstallCodeFromOptimizedCodeMap(info)) return true; |
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1221 GDBJIT(AddCode(Handle<String>(shared->DebugName()), | 1218 GDBJIT(AddCode(Handle<String>(shared->DebugName()), |
1222 Handle<Script>(info->script()), | 1219 Handle<Script>(info->script()), |
1223 Handle<Code>(info->code()), | 1220 Handle<Code>(info->code()), |
1224 info)); | 1221 info)); |
1225 } | 1222 } |
1226 | 1223 |
1227 | 1224 |
1228 CompilationPhase::CompilationPhase(const char* name, | 1225 CompilationPhase::CompilationPhase(const char* name, |
1229 Isolate* isolate, | 1226 Isolate* isolate, |
1230 Zone* zone) | 1227 Zone* zone) |
1231 : name_(name), isolate_(isolate), zone_scope_(zone, DELETE_ON_EXIT) { | 1228 : name_(name), isolate_(isolate), zone_(zone) { |
1232 if (FLAG_hydrogen_stats) { | 1229 if (FLAG_hydrogen_stats) { |
1233 start_allocation_size_ = zone->allocation_size(); | 1230 start_allocation_size_ = zone->allocation_size(); |
1234 start_ticks_ = OS::Ticks(); | 1231 start_ticks_ = OS::Ticks(); |
1235 } | 1232 } |
1236 } | 1233 } |
1237 | 1234 |
1238 | 1235 |
1239 CompilationPhase::~CompilationPhase() { | 1236 CompilationPhase::~CompilationPhase() { |
1240 if (FLAG_hydrogen_stats) { | 1237 if (FLAG_hydrogen_stats) { |
1241 unsigned size = zone()->allocation_size() - start_allocation_size_; | 1238 unsigned size = zone()->allocation_size() - start_allocation_size_; |
1242 int64_t ticks = OS::Ticks() - start_ticks_; | 1239 int64_t ticks = OS::Ticks() - start_ticks_; |
1243 isolate_->GetHStatistics()->SaveTiming(name_, ticks, size); | 1240 isolate_->GetHStatistics()->SaveTiming(name_, ticks, size); |
1244 } | 1241 } |
1245 } | 1242 } |
1246 | 1243 |
1247 | 1244 |
1248 bool CompilationPhase::ShouldProduceTraceOutput() const { | 1245 bool CompilationPhase::ShouldProduceTraceOutput() const { |
1249 // Produce trace output if flag is set so that the first letter of the | 1246 // Produce trace output if flag is set so that the first letter of the |
1250 // phase name matches the command line parameter FLAG_trace_phase. | 1247 // phase name matches the command line parameter FLAG_trace_phase. |
1251 return (FLAG_trace_hydrogen && | 1248 return (FLAG_trace_hydrogen && |
1252 OS::StrChr(const_cast<char*>(FLAG_trace_phase), name_[0]) != NULL); | 1249 OS::StrChr(const_cast<char*>(FLAG_trace_phase), name_[0]) != NULL); |
1253 } | 1250 } |
1254 | 1251 |
1255 } } // namespace v8::internal | 1252 } } // namespace v8::internal |
OLD | NEW |