OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/compiler.h" | 7 #include "src/compiler.h" |
8 | 8 |
9 #include "src/ast-numbering.h" | 9 #include "src/ast-numbering.h" |
10 #include "src/bootstrapper.h" | 10 #include "src/bootstrapper.h" |
(...skipping 701 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
712 int column_num = | 712 int column_num = |
713 Script::GetColumnNumber(script, shared->start_position()) + 1; | 713 Script::GetColumnNumber(script, shared->start_position()) + 1; |
714 String* script_name = script->name()->IsString() | 714 String* script_name = script->name()->IsString() |
715 ? String::cast(script->name()) | 715 ? String::cast(script->name()) |
716 : info->isolate()->heap()->empty_string(); | 716 : info->isolate()->heap()->empty_string(); |
717 Logger::LogEventsAndTags log_tag = Logger::ToNativeByScript(tag, *script); | 717 Logger::LogEventsAndTags log_tag = Logger::ToNativeByScript(tag, *script); |
718 PROFILE(info->isolate(), | 718 PROFILE(info->isolate(), |
719 CodeCreateEvent(log_tag, *code, *shared, info, script_name, | 719 CodeCreateEvent(log_tag, *code, *shared, info, script_name, |
720 line_num, column_num)); | 720 line_num, column_num)); |
721 } | 721 } |
| 722 |
| 723 GDBJIT(AddCode(Handle<String>(shared->DebugName()), |
| 724 Handle<Script>(info->script()), Handle<Code>(info->code()), |
| 725 info)); |
722 } | 726 } |
723 | 727 |
724 | 728 |
725 static bool CompileUnoptimizedCode(CompilationInfo* info) { | 729 static bool CompileUnoptimizedCode(CompilationInfo* info) { |
726 DCHECK(AllowCompilation::IsAllowed(info->isolate())); | 730 DCHECK(AllowCompilation::IsAllowed(info->isolate())); |
727 if (!Compiler::Analyze(info) || !FullCodeGenerator::MakeCode(info)) { | 731 if (!Compiler::Analyze(info) || !FullCodeGenerator::MakeCode(info)) { |
728 Isolate* isolate = info->isolate(); | 732 Isolate* isolate = info->isolate(); |
729 if (!isolate->has_pending_exception()) isolate->StackOverflow(); | 733 if (!isolate->has_pending_exception()) isolate->StackOverflow(); |
730 return false; | 734 return false; |
731 } | 735 } |
(...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1172 | 1176 |
1173 Handle<String> script_name = script->name()->IsString() | 1177 Handle<String> script_name = script->name()->IsString() |
1174 ? Handle<String>(String::cast(script->name())) | 1178 ? Handle<String>(String::cast(script->name())) |
1175 : isolate->factory()->empty_string(); | 1179 : isolate->factory()->empty_string(); |
1176 Logger::LogEventsAndTags log_tag = info->is_eval() | 1180 Logger::LogEventsAndTags log_tag = info->is_eval() |
1177 ? Logger::EVAL_TAG | 1181 ? Logger::EVAL_TAG |
1178 : Logger::ToNativeByScript(Logger::SCRIPT_TAG, *script); | 1182 : Logger::ToNativeByScript(Logger::SCRIPT_TAG, *script); |
1179 | 1183 |
1180 PROFILE(isolate, CodeCreateEvent( | 1184 PROFILE(isolate, CodeCreateEvent( |
1181 log_tag, *info->code(), *result, info, *script_name)); | 1185 log_tag, *info->code(), *result, info, *script_name)); |
| 1186 GDBJIT(AddCode(script_name, script, info->code(), info)); |
1182 | 1187 |
1183 // Hint to the runtime system used when allocating space for initial | 1188 // Hint to the runtime system used when allocating space for initial |
1184 // property space by setting the expected number of properties for | 1189 // property space by setting the expected number of properties for |
1185 // the instances of the function. | 1190 // the instances of the function. |
1186 SetExpectedNofPropertiesFromEstimate(result, | 1191 SetExpectedNofPropertiesFromEstimate(result, |
1187 lit->expected_property_count()); | 1192 lit->expected_property_count()); |
1188 | 1193 |
1189 if (!script.is_null()) | 1194 if (!script.is_null()) |
1190 script->set_compilation_state(Script::COMPILATION_STATE_COMPILED); | 1195 script->set_compilation_state(Script::COMPILATION_STATE_COMPILED); |
1191 | 1196 |
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1601 } | 1606 } |
1602 | 1607 |
1603 | 1608 |
1604 #if DEBUG | 1609 #if DEBUG |
1605 void CompilationInfo::PrintAstForTesting() { | 1610 void CompilationInfo::PrintAstForTesting() { |
1606 PrintF("--- Source from AST ---\n%s\n", | 1611 PrintF("--- Source from AST ---\n%s\n", |
1607 PrettyPrinter(isolate(), zone()).PrintProgram(function())); | 1612 PrettyPrinter(isolate(), zone()).PrintProgram(function())); |
1608 } | 1613 } |
1609 #endif | 1614 #endif |
1610 } } // namespace v8::internal | 1615 } } // namespace v8::internal |
OLD | NEW |