| 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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 PrettyPrinter(info->isolate()).PrintProgram(info->literal())); | 110 PrettyPrinter(info->isolate()).PrintProgram(info->literal())); |
| 111 } | 111 } |
| 112 | 112 |
| 113 if (info->parse_info() && print_ast) { | 113 if (info->parse_info() && print_ast) { |
| 114 PrintF("--- AST ---\n%s\n", | 114 PrintF("--- AST ---\n%s\n", |
| 115 AstPrinter(info->isolate()).PrintProgram(info->literal())); | 115 AstPrinter(info->isolate()).PrintProgram(info->literal())); |
| 116 } | 116 } |
| 117 #endif // DEBUG | 117 #endif // DEBUG |
| 118 } | 118 } |
| 119 | 119 |
| 120 | |
| 121 Handle<Code> CodeGenerator::MakeCodeEpilogue(MacroAssembler* masm, | 120 Handle<Code> CodeGenerator::MakeCodeEpilogue(MacroAssembler* masm, |
| 122 CompilationInfo* info) { | 121 CompilationInfo* info, |
| 122 Handle<Object> self_reference) { |
| 123 Isolate* isolate = info->isolate(); | 123 Isolate* isolate = info->isolate(); |
| 124 | 124 |
| 125 // Allocate and install the code. | 125 // Allocate and install the code. |
| 126 CodeDesc desc; | 126 CodeDesc desc; |
| 127 Code::Flags flags = info->code_flags(); | 127 Code::Flags flags = info->code_flags(); |
| 128 bool is_crankshafted = | 128 bool is_crankshafted = |
| 129 Code::ExtractKindFromFlags(flags) == Code::OPTIMIZED_FUNCTION || | 129 Code::ExtractKindFromFlags(flags) == Code::OPTIMIZED_FUNCTION || |
| 130 info->IsStub(); | 130 info->IsStub(); |
| 131 masm->GetCode(&desc); | 131 masm->GetCode(&desc); |
| 132 Handle<Code> code = | 132 Handle<Code> code = isolate->factory()->NewCode( |
| 133 isolate->factory()->NewCode(desc, flags, masm->CodeObject(), | 133 desc, flags, self_reference, false, is_crankshafted, |
| 134 false, is_crankshafted, | 134 info->prologue_offset(), info->is_debug() && !is_crankshafted); |
| 135 info->prologue_offset(), | |
| 136 info->is_debug() && !is_crankshafted); | |
| 137 isolate->counters()->total_compiled_code_size()->Increment( | 135 isolate->counters()->total_compiled_code_size()->Increment( |
| 138 code->instruction_size()); | 136 code->instruction_size()); |
| 139 isolate->heap()->IncrementCodeGeneratedBytes(is_crankshafted, | 137 isolate->heap()->IncrementCodeGeneratedBytes(is_crankshafted, |
| 140 code->instruction_size()); | 138 code->instruction_size()); |
| 141 return code; | 139 return code; |
| 142 } | 140 } |
| 143 | 141 |
| 144 | 142 |
| 145 void CodeGenerator::PrintCode(Handle<Code> code, CompilationInfo* info) { | 143 void CodeGenerator::PrintCode(Handle<Code> code, CompilationInfo* info) { |
| 146 #ifdef ENABLE_DISASSEMBLER | 144 #ifdef ENABLE_DISASSEMBLER |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 os << "source_position = " << shared->start_position() << "\n"; | 192 os << "source_position = " << shared->start_position() << "\n"; |
| 195 } | 193 } |
| 196 code->Disassemble(debug_name.get(), os); | 194 code->Disassemble(debug_name.get(), os); |
| 197 os << "--- End code ---\n"; | 195 os << "--- End code ---\n"; |
| 198 } | 196 } |
| 199 #endif // ENABLE_DISASSEMBLER | 197 #endif // ENABLE_DISASSEMBLER |
| 200 } | 198 } |
| 201 | 199 |
| 202 } // namespace internal | 200 } // namespace internal |
| 203 } // namespace v8 | 201 } // namespace v8 |
| OLD | NEW |