| 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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 if (print_code) { | 127 if (print_code) { |
| 128 // Print the source code if available. | 128 // Print the source code if available. |
| 129 FunctionLiteral* function = info->function(); | 129 FunctionLiteral* function = info->function(); |
| 130 if (code->kind() != Code::COMPILED_STUB) { | 130 if (code->kind() != Code::COMPILED_STUB) { |
| 131 Handle<Script> script = info->script(); | 131 Handle<Script> script = info->script(); |
| 132 if (!script->IsUndefined() && !script->source()->IsUndefined()) { | 132 if (!script->IsUndefined() && !script->source()->IsUndefined()) { |
| 133 PrintF("--- Raw source ---\n"); | 133 PrintF("--- Raw source ---\n"); |
| 134 ConsStringIteratorOp op; | 134 StringInputBuffer stream(String::cast(script->source())); |
| 135 StringCharacterStream stream(String::cast(script->source()), | 135 stream.Seek(function->start_position()); |
| 136 &op, | |
| 137 function->start_position()); | |
| 138 // fun->end_position() points to the last character in the stream. We | 136 // fun->end_position() points to the last character in the stream. We |
| 139 // need to compensate by adding one to calculate the length. | 137 // need to compensate by adding one to calculate the length. |
| 140 int source_len = | 138 int source_len = |
| 141 function->end_position() - function->start_position() + 1; | 139 function->end_position() - function->start_position() + 1; |
| 142 for (int i = 0; i < source_len; i++) { | 140 for (int i = 0; i < source_len; i++) { |
| 143 if (stream.HasMore()) PrintF("%c", stream.GetNext()); | 141 if (stream.has_more()) PrintF("%c", stream.GetNext()); |
| 144 } | 142 } |
| 145 PrintF("\n\n"); | 143 PrintF("\n\n"); |
| 146 } | 144 } |
| 147 } | 145 } |
| 148 if (info->IsOptimizing()) { | 146 if (info->IsOptimizing()) { |
| 149 if (FLAG_print_unopt_code) { | 147 if (FLAG_print_unopt_code) { |
| 150 PrintF("--- Unoptimized code ---\n"); | 148 PrintF("--- Unoptimized code ---\n"); |
| 151 info->closure()->shared()->code()->Disassemble( | 149 info->closure()->shared()->code()->Disassemble( |
| 152 *function->debug_name()->ToCString()); | 150 *function->debug_name()->ToCString()); |
| 153 } | 151 } |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 ASSERT(result_size_ == 1 || result_size_ == 2); | 216 ASSERT(result_size_ == 1 || result_size_ == 2); |
| 219 #ifdef _WIN64 | 217 #ifdef _WIN64 |
| 220 return result | ((result_size_ == 1) ? 0 : 2); | 218 return result | ((result_size_ == 1) ? 0 : 2); |
| 221 #else | 219 #else |
| 222 return result; | 220 return result; |
| 223 #endif | 221 #endif |
| 224 } | 222 } |
| 225 | 223 |
| 226 | 224 |
| 227 } } // namespace v8::internal | 225 } } // namespace v8::internal |
| OLD | NEW |