| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| 11 // with the distribution. | 11 // with the distribution. |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 | 55 |
| 56 #endif // DEBUG | 56 #endif // DEBUG |
| 57 | 57 |
| 58 #undef __ | 58 #undef __ |
| 59 | 59 |
| 60 | 60 |
| 61 void CodeGenerator::MakeCodePrologue(CompilationInfo* info) { | 61 void CodeGenerator::MakeCodePrologue(CompilationInfo* info) { |
| 62 #ifdef DEBUG | 62 #ifdef DEBUG |
| 63 bool print_source = false; | 63 bool print_source = false; |
| 64 bool print_ast = false; | 64 bool print_ast = false; |
| 65 bool print_json_ast = false; | |
| 66 const char* ftype; | 65 const char* ftype; |
| 67 | 66 |
| 68 if (Isolate::Current()->bootstrapper()->IsActive()) { | 67 if (Isolate::Current()->bootstrapper()->IsActive()) { |
| 69 print_source = FLAG_print_builtin_source; | 68 print_source = FLAG_print_builtin_source; |
| 70 print_ast = FLAG_print_builtin_ast; | 69 print_ast = FLAG_print_builtin_ast; |
| 71 print_json_ast = FLAG_print_builtin_json_ast; | |
| 72 ftype = "builtin"; | 70 ftype = "builtin"; |
| 73 } else { | 71 } else { |
| 74 print_source = FLAG_print_source; | 72 print_source = FLAG_print_source; |
| 75 print_ast = FLAG_print_ast; | 73 print_ast = FLAG_print_ast; |
| 76 print_json_ast = FLAG_print_json_ast; | |
| 77 Vector<const char> filter = CStrVector(FLAG_hydrogen_filter); | 74 Vector<const char> filter = CStrVector(FLAG_hydrogen_filter); |
| 78 if (print_source && !filter.is_empty()) { | 75 if (print_source && !filter.is_empty()) { |
| 79 print_source = info->function()->name()->IsEqualTo(filter); | 76 print_source = info->function()->name()->IsEqualTo(filter); |
| 80 } | 77 } |
| 81 if (print_ast && !filter.is_empty()) { | 78 if (print_ast && !filter.is_empty()) { |
| 82 print_ast = info->function()->name()->IsEqualTo(filter); | 79 print_ast = info->function()->name()->IsEqualTo(filter); |
| 83 } | 80 } |
| 84 if (print_json_ast && !filter.is_empty()) { | |
| 85 print_json_ast = info->function()->name()->IsEqualTo(filter); | |
| 86 } | |
| 87 ftype = "user-defined"; | 81 ftype = "user-defined"; |
| 88 } | 82 } |
| 89 | 83 |
| 90 if (FLAG_trace_codegen || print_source || print_ast) { | 84 if (FLAG_trace_codegen || print_source || print_ast) { |
| 91 PrintF("*** Generate code for %s function: ", ftype); | 85 PrintF("*** Generate code for %s function: ", ftype); |
| 92 info->function()->name()->ShortPrint(); | 86 info->function()->name()->ShortPrint(); |
| 93 PrintF(" ***\n"); | 87 PrintF(" ***\n"); |
| 94 } | 88 } |
| 95 | 89 |
| 96 if (print_source) { | 90 if (print_source) { |
| 97 PrintF("--- Source from AST ---\n%s\n", | 91 PrintF("--- Source from AST ---\n%s\n", |
| 98 PrettyPrinter().PrintProgram(info->function())); | 92 PrettyPrinter().PrintProgram(info->function())); |
| 99 } | 93 } |
| 100 | 94 |
| 101 if (print_ast) { | 95 if (print_ast) { |
| 102 PrintF("--- AST ---\n%s\n", | 96 PrintF("--- AST ---\n%s\n", |
| 103 AstPrinter().PrintProgram(info->function())); | 97 AstPrinter().PrintProgram(info->function())); |
| 104 } | 98 } |
| 105 | |
| 106 if (print_json_ast) { | |
| 107 JsonAstBuilder builder; | |
| 108 PrintF("%s", builder.BuildProgram(info->function())); | |
| 109 } | |
| 110 #endif // DEBUG | 99 #endif // DEBUG |
| 111 } | 100 } |
| 112 | 101 |
| 113 | 102 |
| 114 Handle<Code> CodeGenerator::MakeCodeEpilogue(MacroAssembler* masm, | 103 Handle<Code> CodeGenerator::MakeCodeEpilogue(MacroAssembler* masm, |
| 115 Code::Flags flags, | 104 Code::Flags flags, |
| 116 CompilationInfo* info) { | 105 CompilationInfo* info) { |
| 117 Isolate* isolate = info->isolate(); | 106 Isolate* isolate = info->isolate(); |
| 118 | 107 |
| 119 // Allocate and install the code. | 108 // Allocate and install the code. |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 ASSERT(result_size_ == 1 || result_size_ == 2); | 211 ASSERT(result_size_ == 1 || result_size_ == 2); |
| 223 #ifdef _WIN64 | 212 #ifdef _WIN64 |
| 224 return result | ((result_size_ == 1) ? 0 : 2); | 213 return result | ((result_size_ == 1) ? 0 : 2); |
| 225 #else | 214 #else |
| 226 return result; | 215 return result; |
| 227 #endif | 216 #endif |
| 228 } | 217 } |
| 229 | 218 |
| 230 | 219 |
| 231 } } // namespace v8::internal | 220 } } // namespace v8::internal |
| OLD | NEW |