Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2012 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 |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 117 } | 117 } |
| 118 return code; | 118 return code; |
| 119 } | 119 } |
| 120 | 120 |
| 121 | 121 |
| 122 void CodeGenerator::PrintCode(Handle<Code> code, CompilationInfo* info) { | 122 void CodeGenerator::PrintCode(Handle<Code> code, CompilationInfo* info) { |
| 123 #ifdef ENABLE_DISASSEMBLER | 123 #ifdef ENABLE_DISASSEMBLER |
| 124 bool print_code = Isolate::Current()->bootstrapper()->IsActive() | 124 bool print_code = Isolate::Current()->bootstrapper()->IsActive() |
| 125 ? FLAG_print_builtin_code | 125 ? FLAG_print_builtin_code |
| 126 : (FLAG_print_code || (info->IsOptimizing() && FLAG_print_opt_code)); | 126 : (FLAG_print_code || (info->IsOptimizing() && FLAG_print_opt_code)); |
| 127 Vector<const char> filter = CStrVector(FLAG_hydrogen_filter); | 127 if (print_code) { |
|
Sven Panne
2012/03/14 09:12:07
If we remove the flag here, it should probably be
| |
| 128 FunctionLiteral* function = info->function(); | |
| 129 bool match = filter.is_empty() || function->debug_name()->IsEqualTo(filter); | |
| 130 if (print_code && match) { | |
| 131 // Print the source code if available. | 128 // Print the source code if available. |
| 129 FunctionLiteral* function = info->function(); | |
| 132 Handle<Script> script = info->script(); | 130 Handle<Script> script = info->script(); |
| 133 if (!script->IsUndefined() && !script->source()->IsUndefined()) { | 131 if (!script->IsUndefined() && !script->source()->IsUndefined()) { |
| 134 PrintF("--- Raw source ---\n"); | 132 PrintF("--- Raw source ---\n"); |
| 135 StringInputBuffer stream(String::cast(script->source())); | 133 StringInputBuffer stream(String::cast(script->source())); |
| 136 stream.Seek(function->start_position()); | 134 stream.Seek(function->start_position()); |
| 137 // fun->end_position() points to the last character in the stream. We | 135 // fun->end_position() points to the last character in the stream. We |
| 138 // need to compensate by adding one to calculate the length. | 136 // need to compensate by adding one to calculate the length. |
| 139 int source_len = | 137 int source_len = |
| 140 function->end_position() - function->start_position() + 1; | 138 function->end_position() - function->start_position() + 1; |
| 141 for (int i = 0; i < source_len; i++) { | 139 for (int i = 0; i < source_len; i++) { |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 211 ASSERT(result_size_ == 1 || result_size_ == 2); | 209 ASSERT(result_size_ == 1 || result_size_ == 2); |
| 212 #ifdef _WIN64 | 210 #ifdef _WIN64 |
| 213 return result | ((result_size_ == 1) ? 0 : 2); | 211 return result | ((result_size_ == 1) ? 0 : 2); |
| 214 #else | 212 #else |
| 215 return result; | 213 return result; |
| 216 #endif | 214 #endif |
| 217 } | 215 } |
| 218 | 216 |
| 219 | 217 |
| 220 } } // namespace v8::internal | 218 } } // namespace v8::internal |
| OLD | NEW |