| Index: src/codegen.cc
|
| diff --git a/src/codegen.cc b/src/codegen.cc
|
| index 6d4a5fefd891908a615f20f9cf8fdb717b4d3347..938bbc21aa8292a13b1c7344d4e305463b93fc8a 100644
|
| --- a/src/codegen.cc
|
| +++ b/src/codegen.cc
|
| @@ -136,6 +136,16 @@ void CodeGenerator::MakeCodePrologue(CompilationInfo* info) {
|
| print_source = FLAG_print_source;
|
| print_ast = FLAG_print_ast;
|
| print_json_ast = FLAG_print_json_ast;
|
| + Vector<const char> filter = CStrVector(FLAG_hydrogen_filter);
|
| + if (print_source && !filter.is_empty()) {
|
| + print_source = info->function()->name()->IsEqualTo(filter);
|
| + }
|
| + if (print_ast && !filter.is_empty()) {
|
| + print_ast = info->function()->name()->IsEqualTo(filter);
|
| + }
|
| + if (print_json_ast && !filter.is_empty()) {
|
| + print_json_ast = info->function()->name()->IsEqualTo(filter);
|
| + }
|
| ftype = "user-defined";
|
| }
|
|
|
| @@ -171,14 +181,24 @@ Handle<Code> CodeGenerator::MakeCodeEpilogue(MacroAssembler* masm,
|
| masm->GetCode(&desc);
|
| Handle<Code> code = FACTORY->NewCode(desc, flags, masm->CodeObject());
|
|
|
| + if (!code.is_null()) {
|
| + COUNTERS->total_compiled_code_size()->Increment(code->instruction_size());
|
| + }
|
| + return code;
|
| +}
|
| +
|
| +
|
| +void CodeGenerator::PrintCode(Handle<Code> code, CompilationInfo* info) {
|
| #ifdef ENABLE_DISASSEMBLER
|
| bool print_code = Isolate::Current()->bootstrapper()->IsActive()
|
| ? FLAG_print_builtin_code
|
| - : FLAG_print_code;
|
| - if (print_code) {
|
| + : (FLAG_print_code || (info->IsOptimizing() && FLAG_print_opt_code));
|
| + Vector<const char> filter = CStrVector(FLAG_hydrogen_filter);
|
| + FunctionLiteral* function = info->function();
|
| + bool match = filter.is_empty() || function->debug_name()->IsEqualTo(filter);
|
| + if (print_code && match) {
|
| // Print the source code if available.
|
| Handle<Script> script = info->script();
|
| - FunctionLiteral* function = info->function();
|
| if (!script->IsUndefined() && !script->source()->IsUndefined()) {
|
| PrintF("--- Raw source ---\n");
|
| StringInputBuffer stream(String::cast(script->source()));
|
| @@ -196,22 +216,22 @@ Handle<Code> CodeGenerator::MakeCodeEpilogue(MacroAssembler* masm,
|
| code->Disassemble(*function->name()->ToCString());
|
| }
|
| #endif // ENABLE_DISASSEMBLER
|
| -
|
| - if (!code.is_null()) {
|
| - COUNTERS->total_compiled_code_size()->Increment(code->instruction_size());
|
| - }
|
| - return code;
|
| }
|
|
|
|
|
| // Generate the code. Compile the AST and assemble all the pieces into a
|
| // Code object.
|
| bool CodeGenerator::MakeCode(CompilationInfo* info) {
|
| + // When using Crankshaft the classic backend should never be used.
|
| + ASSERT(!V8::UseCrankshaft());
|
| Handle<Script> script = info->script();
|
| if (!script->IsUndefined() && !script->source()->IsUndefined()) {
|
| int len = String::cast(script->source())->length();
|
| COUNTERS->total_old_codegen_source_size()->Increment(len);
|
| }
|
| + if (FLAG_trace_codegen) {
|
| + PrintF("Classic Compiler - ");
|
| + }
|
| MakeCodePrologue(info);
|
| // Generate code.
|
| const int kInitialBufferSize = 4 * KB;
|
| @@ -227,6 +247,9 @@ bool CodeGenerator::MakeCode(CompilationInfo* info) {
|
| InLoopFlag in_loop = info->is_in_loop() ? IN_LOOP : NOT_IN_LOOP;
|
| Code::Flags flags = Code::ComputeFlags(Code::FUNCTION, in_loop);
|
| Handle<Code> code = MakeCodeEpilogue(cgen.masm(), flags, info);
|
| + // There is no stack check table in code generated by the classic backend.
|
| + code->SetNoStackCheckTable();
|
| + CodeGenerator::PrintCode(code, info);
|
| info->SetCode(code); // May be an empty handle.
|
| return !code.is_null();
|
| }
|
| @@ -441,10 +464,11 @@ void ArgumentsAccessStub::Generate(MacroAssembler* masm) {
|
|
|
| int CEntryStub::MinorKey() {
|
| ASSERT(result_size_ == 1 || result_size_ == 2);
|
| + int result = save_doubles_ ? 1 : 0;
|
| #ifdef _WIN64
|
| - return result_size_ == 1 ? 0 : 1;
|
| + return result | ((result_size_ == 1) ? 0 : 2);
|
| #else
|
| - return 0;
|
| + return result;
|
| #endif
|
| }
|
|
|
|
|