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