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)); | |
726 } | 722 } |
727 | 723 |
728 | 724 |
729 static bool CompileUnoptimizedCode(CompilationInfo* info) { | 725 static bool CompileUnoptimizedCode(CompilationInfo* info) { |
730 DCHECK(AllowCompilation::IsAllowed(info->isolate())); | 726 DCHECK(AllowCompilation::IsAllowed(info->isolate())); |
731 if (!Compiler::Analyze(info) || !FullCodeGenerator::MakeCode(info)) { | 727 if (!Compiler::Analyze(info) || !FullCodeGenerator::MakeCode(info)) { |
732 Isolate* isolate = info->isolate(); | 728 Isolate* isolate = info->isolate(); |
733 if (!isolate->has_pending_exception()) isolate->StackOverflow(); | 729 if (!isolate->has_pending_exception()) isolate->StackOverflow(); |
734 return false; | 730 return false; |
735 } | 731 } |
(...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1176 | 1172 |
1177 Handle<String> script_name = script->name()->IsString() | 1173 Handle<String> script_name = script->name()->IsString() |
1178 ? Handle<String>(String::cast(script->name())) | 1174 ? Handle<String>(String::cast(script->name())) |
1179 : isolate->factory()->empty_string(); | 1175 : isolate->factory()->empty_string(); |
1180 Logger::LogEventsAndTags log_tag = info->is_eval() | 1176 Logger::LogEventsAndTags log_tag = info->is_eval() |
1181 ? Logger::EVAL_TAG | 1177 ? Logger::EVAL_TAG |
1182 : Logger::ToNativeByScript(Logger::SCRIPT_TAG, *script); | 1178 : Logger::ToNativeByScript(Logger::SCRIPT_TAG, *script); |
1183 | 1179 |
1184 PROFILE(isolate, CodeCreateEvent( | 1180 PROFILE(isolate, CodeCreateEvent( |
1185 log_tag, *info->code(), *result, info, *script_name)); | 1181 log_tag, *info->code(), *result, info, *script_name)); |
1186 GDBJIT(AddCode(script_name, script, info->code(), info)); | |
1187 | 1182 |
1188 // Hint to the runtime system used when allocating space for initial | 1183 // Hint to the runtime system used when allocating space for initial |
1189 // property space by setting the expected number of properties for | 1184 // property space by setting the expected number of properties for |
1190 // the instances of the function. | 1185 // the instances of the function. |
1191 SetExpectedNofPropertiesFromEstimate(result, | 1186 SetExpectedNofPropertiesFromEstimate(result, |
1192 lit->expected_property_count()); | 1187 lit->expected_property_count()); |
1193 | 1188 |
1194 if (!script.is_null()) | 1189 if (!script.is_null()) |
1195 script->set_compilation_state(Script::COMPILATION_STATE_COMPILED); | 1190 script->set_compilation_state(Script::COMPILATION_STATE_COMPILED); |
1196 | 1191 |
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1606 } | 1601 } |
1607 | 1602 |
1608 | 1603 |
1609 #if DEBUG | 1604 #if DEBUG |
1610 void CompilationInfo::PrintAstForTesting() { | 1605 void CompilationInfo::PrintAstForTesting() { |
1611 PrintF("--- Source from AST ---\n%s\n", | 1606 PrintF("--- Source from AST ---\n%s\n", |
1612 PrettyPrinter(isolate(), zone()).PrintProgram(function())); | 1607 PrettyPrinter(isolate(), zone()).PrintProgram(function())); |
1613 } | 1608 } |
1614 #endif | 1609 #endif |
1615 } } // namespace v8::internal | 1610 } } // namespace v8::internal |
OLD | NEW |