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/codegen.h" | 5 #include "src/codegen.h" |
6 | 6 |
7 #if defined(V8_OS_AIX) | 7 #if defined(V8_OS_AIX) |
8 #include <fenv.h> // NOLINT(build/c++11) | 8 #include <fenv.h> // NOLINT(build/c++11) |
9 #endif | 9 #endif |
10 #include "src/ast/prettyprinter.h" | 10 #include "src/ast/prettyprinter.h" |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
113 | 113 |
114 if (info->parse_info() && print_ast) { | 114 if (info->parse_info() && print_ast) { |
115 PrintF("--- AST ---\n%s\n", | 115 PrintF("--- AST ---\n%s\n", |
116 AstPrinter(info->isolate()).PrintProgram(info->literal())); | 116 AstPrinter(info->isolate()).PrintProgram(info->literal())); |
117 } | 117 } |
118 #endif // DEBUG | 118 #endif // DEBUG |
119 } | 119 } |
120 | 120 |
121 Handle<Code> CodeGenerator::MakeCodeEpilogue(MacroAssembler* masm, | 121 Handle<Code> CodeGenerator::MakeCodeEpilogue(MacroAssembler* masm, |
122 EhFrameWriter* eh_frame_writer, | 122 EhFrameWriter* eh_frame_writer, |
123 CompilationInfo* info) { | 123 CompilationInfo* info, |
124 bool is_self_ref_available) { | |
Michael Starzinger
2016/07/13 12:42:44
nit: We could pass in the "Handle<Object> self_ref
ahaas
2016/07/13 12:51:54
Done.
| |
124 Isolate* isolate = info->isolate(); | 125 Isolate* isolate = info->isolate(); |
125 | 126 |
126 // Allocate and install the code. | 127 // Allocate and install the code. |
127 CodeDesc desc; | 128 CodeDesc desc; |
128 Code::Flags flags = info->code_flags(); | 129 Code::Flags flags = info->code_flags(); |
129 bool is_crankshafted = | 130 bool is_crankshafted = |
130 Code::ExtractKindFromFlags(flags) == Code::OPTIMIZED_FUNCTION || | 131 Code::ExtractKindFromFlags(flags) == Code::OPTIMIZED_FUNCTION || |
131 info->IsStub(); | 132 info->IsStub(); |
132 masm->GetCode(&desc); | 133 masm->GetCode(&desc); |
133 if (eh_frame_writer) eh_frame_writer->GetEhFrame(&desc); | 134 if (eh_frame_writer) eh_frame_writer->GetEhFrame(&desc); |
134 Handle<Code> code = | 135 Handle<Code> code = isolate->factory()->NewCode( |
135 isolate->factory()->NewCode(desc, flags, masm->CodeObject(), | 136 desc, flags, |
136 false, is_crankshafted, | 137 is_self_ref_available ? masm->CodeObject() : Handle<Object>(), false, |
137 info->prologue_offset(), | 138 is_crankshafted, info->prologue_offset(), |
138 info->is_debug() && !is_crankshafted); | 139 info->is_debug() && !is_crankshafted); |
139 isolate->counters()->total_compiled_code_size()->Increment( | 140 isolate->counters()->total_compiled_code_size()->Increment( |
140 code->instruction_size()); | 141 code->instruction_size()); |
141 isolate->heap()->IncrementCodeGeneratedBytes(is_crankshafted, | 142 isolate->heap()->IncrementCodeGeneratedBytes(is_crankshafted, |
142 code->instruction_size()); | 143 code->instruction_size()); |
143 return code; | 144 return code; |
144 } | 145 } |
145 | 146 |
146 | 147 |
147 void CodeGenerator::PrintCode(Handle<Code> code, CompilationInfo* info) { | 148 void CodeGenerator::PrintCode(Handle<Code> code, CompilationInfo* info) { |
148 #ifdef ENABLE_DISASSEMBLER | 149 #ifdef ENABLE_DISASSEMBLER |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
196 os << "source_position = " << shared->start_position() << "\n"; | 197 os << "source_position = " << shared->start_position() << "\n"; |
197 } | 198 } |
198 code->Disassemble(debug_name.get(), os); | 199 code->Disassemble(debug_name.get(), os); |
199 os << "--- End code ---\n"; | 200 os << "--- End code ---\n"; |
200 } | 201 } |
201 #endif // ENABLE_DISASSEMBLER | 202 #endif // ENABLE_DISASSEMBLER |
202 } | 203 } |
203 | 204 |
204 } // namespace internal | 205 } // namespace internal |
205 } // namespace v8 | 206 } // namespace v8 |
OLD | NEW |