Chromium Code Reviews| 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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 96 function_ = NULL; | 96 function_ = NULL; |
| 97 scope_ = NULL; | 97 scope_ = NULL; |
| 98 global_scope_ = NULL; | 98 global_scope_ = NULL; |
| 99 extension_ = NULL; | 99 extension_ = NULL; |
| 100 pre_parse_data_ = NULL; | 100 pre_parse_data_ = NULL; |
| 101 zone_ = zone; | 101 zone_ = zone; |
| 102 deferred_handles_ = NULL; | 102 deferred_handles_ = NULL; |
| 103 code_stub_ = NULL; | 103 code_stub_ = NULL; |
| 104 prologue_offset_ = kPrologueOffsetNotSet; | 104 prologue_offset_ = kPrologueOffsetNotSet; |
| 105 opt_count_ = shared_info().is_null() ? 0 : shared_info()->opt_count(); | 105 opt_count_ = shared_info().is_null() ? 0 : shared_info()->opt_count(); |
| 106 no_frame_ranges_ = isolate->cpu_profiler()->is_profiling() ? | |
|
Jakob Kummerow
2013/05/14 12:38:51
nit: putting the '?' on the second line is prefera
yurys
2013/05/14 22:51:19
Done.
| |
| 107 new List<OffsetRange>(2) : NULL; | |
| 106 if (mode == STUB) { | 108 if (mode == STUB) { |
| 107 mode_ = STUB; | 109 mode_ = STUB; |
| 108 return; | 110 return; |
| 109 } | 111 } |
| 110 mode_ = V8::UseCrankshaft() ? mode : NONOPT; | 112 mode_ = V8::UseCrankshaft() ? mode : NONOPT; |
| 111 if (script_->type()->value() == Script::TYPE_NATIVE) { | 113 if (script_->type()->value() == Script::TYPE_NATIVE) { |
| 112 MarkAsNative(); | 114 MarkAsNative(); |
| 113 } | 115 } |
| 114 if (!shared_info_.is_null()) { | 116 if (!shared_info_.is_null()) { |
| 115 ASSERT(language_mode() == CLASSIC_MODE); | 117 ASSERT(language_mode() == CLASSIC_MODE); |
| 116 SetLanguageMode(shared_info_->language_mode()); | 118 SetLanguageMode(shared_info_->language_mode()); |
| 117 } | 119 } |
| 118 set_bailout_reason("unknown"); | 120 set_bailout_reason("unknown"); |
| 119 } | 121 } |
| 120 | 122 |
| 121 | 123 |
| 122 CompilationInfo::~CompilationInfo() { | 124 CompilationInfo::~CompilationInfo() { |
| 123 delete deferred_handles_; | 125 delete deferred_handles_; |
| 126 delete no_frame_ranges_; | |
| 124 } | 127 } |
| 125 | 128 |
| 126 | 129 |
| 127 int CompilationInfo::num_parameters() const { | 130 int CompilationInfo::num_parameters() const { |
| 128 ASSERT(!IsStub()); | 131 ASSERT(!IsStub()); |
| 129 return scope()->num_parameters(); | 132 return scope()->num_parameters(); |
| 130 } | 133 } |
| 131 | 134 |
| 132 | 135 |
| 133 int CompilationInfo::num_heap_slots() const { | 136 int CompilationInfo::num_heap_slots() const { |
| (...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 566 ASSERT_EQ(RelocInfo::kNoPosition, lit->function_token_position()); | 569 ASSERT_EQ(RelocInfo::kNoPosition, lit->function_token_position()); |
| 567 Compiler::SetFunctionInfo(result, lit, true, script); | 570 Compiler::SetFunctionInfo(result, lit, true, script); |
| 568 | 571 |
| 569 if (script->name()->IsString()) { | 572 if (script->name()->IsString()) { |
| 570 PROFILE(isolate, CodeCreateEvent( | 573 PROFILE(isolate, CodeCreateEvent( |
| 571 info->is_eval() | 574 info->is_eval() |
| 572 ? Logger::EVAL_TAG | 575 ? Logger::EVAL_TAG |
| 573 : Logger::ToNativeByScript(Logger::SCRIPT_TAG, *script), | 576 : Logger::ToNativeByScript(Logger::SCRIPT_TAG, *script), |
| 574 *info->code(), | 577 *info->code(), |
| 575 *result, | 578 *result, |
| 579 info, | |
| 576 String::cast(script->name()))); | 580 String::cast(script->name()))); |
| 577 GDBJIT(AddCode(Handle<String>(String::cast(script->name())), | 581 GDBJIT(AddCode(Handle<String>(String::cast(script->name())), |
| 578 script, | 582 script, |
| 579 info->code(), | 583 info->code(), |
| 580 info)); | 584 info)); |
| 581 } else { | 585 } else { |
| 582 PROFILE(isolate, CodeCreateEvent( | 586 PROFILE(isolate, CodeCreateEvent( |
| 583 info->is_eval() | 587 info->is_eval() |
| 584 ? Logger::EVAL_TAG | 588 ? Logger::EVAL_TAG |
| 585 : Logger::ToNativeByScript(Logger::SCRIPT_TAG, *script), | 589 : Logger::ToNativeByScript(Logger::SCRIPT_TAG, *script), |
| 586 *info->code(), | 590 *info->code(), |
| 587 *result, | 591 *result, |
| 592 info, | |
| 588 isolate->heap()->empty_string())); | 593 isolate->heap()->empty_string())); |
| 589 GDBJIT(AddCode(Handle<String>(), script, info->code(), info)); | 594 GDBJIT(AddCode(Handle<String>(), script, info->code(), info)); |
| 590 } | 595 } |
| 591 | 596 |
| 592 // Hint to the runtime system used when allocating space for initial | 597 // Hint to the runtime system used when allocating space for initial |
| 593 // property space by setting the expected number of properties for | 598 // property space by setting the expected number of properties for |
| 594 // the instances of the function. | 599 // the instances of the function. |
| 595 SetExpectedNofPropertiesFromEstimate(result, lit->expected_property_count()); | 600 SetExpectedNofPropertiesFromEstimate(result, lit->expected_property_count()); |
| 596 | 601 |
| 597 script->set_compilation_state( | 602 script->set_compilation_state( |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 805 static void InstallCodeCommon(CompilationInfo* info) { | 810 static void InstallCodeCommon(CompilationInfo* info) { |
| 806 Handle<SharedFunctionInfo> shared = info->shared_info(); | 811 Handle<SharedFunctionInfo> shared = info->shared_info(); |
| 807 Handle<Code> code = info->code(); | 812 Handle<Code> code = info->code(); |
| 808 ASSERT(!code.is_null()); | 813 ASSERT(!code.is_null()); |
| 809 | 814 |
| 810 // Set optimizable to false if this is disallowed by the shared | 815 // Set optimizable to false if this is disallowed by the shared |
| 811 // function info, e.g., we might have flushed the code and must | 816 // function info, e.g., we might have flushed the code and must |
| 812 // reset this bit when lazy compiling the code again. | 817 // reset this bit when lazy compiling the code again. |
| 813 if (shared->optimization_disabled()) code->set_optimizable(false); | 818 if (shared->optimization_disabled()) code->set_optimizable(false); |
| 814 | 819 |
| 820 if (shared->code() == *code) { | |
| 821 // Do not send compilation event for the same code twice. | |
| 822 return; | |
| 823 } | |
| 815 Compiler::RecordFunctionCompilation(Logger::LAZY_COMPILE_TAG, info, shared); | 824 Compiler::RecordFunctionCompilation(Logger::LAZY_COMPILE_TAG, info, shared); |
| 816 } | 825 } |
| 817 | 826 |
| 818 | 827 |
| 819 static void InsertCodeIntoOptimizedCodeMap(CompilationInfo* info) { | 828 static void InsertCodeIntoOptimizedCodeMap(CompilationInfo* info) { |
| 820 Handle<Code> code = info->code(); | 829 Handle<Code> code = info->code(); |
| 821 if (FLAG_cache_optimized_code && | 830 if (FLAG_cache_optimized_code && |
| 822 info->osr_ast_id().IsNone() && | 831 info->osr_ast_id().IsNone() && |
| 823 code->kind() == Code::OPTIMIZED_FUNCTION) { | 832 code->kind() == Code::OPTIMIZED_FUNCTION) { |
| 824 Handle<JSFunction> function = info->closure(); | 833 Handle<JSFunction> function = info->closure(); |
| (...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1149 Handle<Code> code = info->code(); | 1158 Handle<Code> code = info->code(); |
| 1150 if (*code == info->isolate()->builtins()->builtin(Builtins::kLazyCompile)) | 1159 if (*code == info->isolate()->builtins()->builtin(Builtins::kLazyCompile)) |
| 1151 return; | 1160 return; |
| 1152 if (script->name()->IsString()) { | 1161 if (script->name()->IsString()) { |
| 1153 int line_num = GetScriptLineNumber(script, shared->start_position()) + 1; | 1162 int line_num = GetScriptLineNumber(script, shared->start_position()) + 1; |
| 1154 USE(line_num); | 1163 USE(line_num); |
| 1155 PROFILE(info->isolate(), | 1164 PROFILE(info->isolate(), |
| 1156 CodeCreateEvent(Logger::ToNativeByScript(tag, *script), | 1165 CodeCreateEvent(Logger::ToNativeByScript(tag, *script), |
| 1157 *code, | 1166 *code, |
| 1158 *shared, | 1167 *shared, |
| 1168 info, | |
| 1159 String::cast(script->name()), | 1169 String::cast(script->name()), |
| 1160 line_num)); | 1170 line_num)); |
| 1161 } else { | 1171 } else { |
| 1162 PROFILE(info->isolate(), | 1172 PROFILE(info->isolate(), |
| 1163 CodeCreateEvent(Logger::ToNativeByScript(tag, *script), | 1173 CodeCreateEvent(Logger::ToNativeByScript(tag, *script), |
| 1164 *code, | 1174 *code, |
| 1165 *shared, | 1175 *shared, |
| 1176 info, | |
| 1166 shared->DebugName())); | 1177 shared->DebugName())); |
| 1167 } | 1178 } |
| 1168 } | 1179 } |
| 1169 | 1180 |
| 1170 GDBJIT(AddCode(Handle<String>(shared->DebugName()), | 1181 GDBJIT(AddCode(Handle<String>(shared->DebugName()), |
| 1171 Handle<Script>(info->script()), | 1182 Handle<Script>(info->script()), |
| 1172 Handle<Code>(info->code()), | 1183 Handle<Code>(info->code()), |
| 1173 info)); | 1184 info)); |
| 1174 } | 1185 } |
| 1175 | 1186 |
| 1176 } } // namespace v8::internal | 1187 } } // namespace v8::internal |
| OLD | NEW |