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/full-codegen/full-codegen.h" | 5 #include "src/full-codegen/full-codegen.h" |
6 | 6 |
7 #include "src/ast/ast-numbering.h" | 7 #include "src/ast/ast-numbering.h" |
8 #include "src/ast/ast.h" | 8 #include "src/ast/ast.h" |
9 #include "src/ast/prettyprinter.h" | 9 #include "src/ast/prettyprinter.h" |
10 #include "src/ast/scopeinfo.h" | 10 #include "src/ast/scopeinfo.h" |
(...skipping 28 matching lines...) Expand all Loading... |
39 int len = String::cast(script->source())->length(); | 39 int len = String::cast(script->source())->length(); |
40 isolate->counters()->total_full_codegen_source_size()->Increment(len); | 40 isolate->counters()->total_full_codegen_source_size()->Increment(len); |
41 } | 41 } |
42 CodeGenerator::MakeCodePrologue(info, "full"); | 42 CodeGenerator::MakeCodePrologue(info, "full"); |
43 const int kInitialBufferSize = 4 * KB; | 43 const int kInitialBufferSize = 4 * KB; |
44 MacroAssembler masm(info->isolate(), NULL, kInitialBufferSize, | 44 MacroAssembler masm(info->isolate(), NULL, kInitialBufferSize, |
45 CodeObjectRequired::kYes); | 45 CodeObjectRequired::kYes); |
46 if (info->will_serialize()) masm.enable_serializer(); | 46 if (info->will_serialize()) masm.enable_serializer(); |
47 | 47 |
48 FullCodeGenerator cgen(&masm, info); | 48 FullCodeGenerator cgen(&masm, info); |
49 LOG_CODE_EVENT(isolate, CodeStartLinePosInfoRecordEvent( | |
50 &cgen.source_position_table_builder_)); | |
51 cgen.Generate(); | 49 cgen.Generate(); |
52 if (cgen.HasStackOverflow()) { | 50 if (cgen.HasStackOverflow()) { |
53 DCHECK(!isolate->has_pending_exception()); | 51 DCHECK(!isolate->has_pending_exception()); |
54 return false; | 52 return false; |
55 } | 53 } |
56 unsigned table_offset = cgen.EmitBackEdgeTable(); | 54 unsigned table_offset = cgen.EmitBackEdgeTable(); |
57 | 55 |
58 Handle<Code> code = CodeGenerator::MakeCodeEpilogue(&masm, info); | 56 Handle<Code> code = CodeGenerator::MakeCodeEpilogue(&masm, info); |
59 cgen.PopulateDeoptimizationData(code); | 57 cgen.PopulateDeoptimizationData(code); |
60 cgen.PopulateTypeFeedbackInfo(code); | 58 cgen.PopulateTypeFeedbackInfo(code); |
61 cgen.PopulateHandlerTable(code); | 59 cgen.PopulateHandlerTable(code); |
62 code->set_has_deoptimization_support(info->HasDeoptimizationSupport()); | 60 code->set_has_deoptimization_support(info->HasDeoptimizationSupport()); |
63 code->set_has_reloc_info_for_serialization(info->will_serialize()); | 61 code->set_has_reloc_info_for_serialization(info->will_serialize()); |
64 code->set_allow_osr_at_loop_nesting_level(0); | 62 code->set_allow_osr_at_loop_nesting_level(0); |
65 code->set_profiler_ticks(0); | 63 code->set_profiler_ticks(0); |
66 code->set_back_edge_table_offset(table_offset); | 64 code->set_back_edge_table_offset(table_offset); |
67 Handle<ByteArray> source_positions = | 65 Handle<ByteArray> source_positions = |
68 cgen.source_position_table_builder_.ToSourcePositionTable(); | 66 cgen.source_position_table_builder_.ToSourcePositionTable(); |
69 code->set_source_position_table(*source_positions); | 67 code->set_source_position_table(*source_positions); |
| 68 cgen.source_position_table_builder_.EndJitLogging(AbstractCode::cast(*code)); |
70 CodeGenerator::PrintCode(code, info); | 69 CodeGenerator::PrintCode(code, info); |
71 info->SetCode(code); | 70 info->SetCode(code); |
72 void* line_info = cgen.source_position_table_builder_.DetachJITHandlerData(); | |
73 LOG_CODE_EVENT(isolate, CodeEndLinePosInfoRecordEvent( | |
74 AbstractCode::cast(*code), line_info)); | |
75 | 71 |
76 #ifdef DEBUG | 72 #ifdef DEBUG |
77 // Check that no context-specific object has been embedded. | 73 // Check that no context-specific object has been embedded. |
78 code->VerifyEmbeddedObjects(Code::kNoContextSpecificPointers); | 74 code->VerifyEmbeddedObjects(Code::kNoContextSpecificPointers); |
79 #endif // DEBUG | 75 #endif // DEBUG |
80 return true; | 76 return true; |
81 } | 77 } |
82 | 78 |
83 | 79 |
84 unsigned FullCodeGenerator::EmitBackEdgeTable() { | 80 unsigned FullCodeGenerator::EmitBackEdgeTable() { |
(...skipping 1885 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1970 return var->scope()->is_nonlinear() || | 1966 return var->scope()->is_nonlinear() || |
1971 var->initializer_position() >= proxy->position(); | 1967 var->initializer_position() >= proxy->position(); |
1972 } | 1968 } |
1973 | 1969 |
1974 | 1970 |
1975 #undef __ | 1971 #undef __ |
1976 | 1972 |
1977 | 1973 |
1978 } // namespace internal | 1974 } // namespace internal |
1979 } // namespace v8 | 1975 } // namespace v8 |
OLD | NEW |