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/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/bootstrapper.h" | 7 #include "src/bootstrapper.h" |
8 #include "src/codegen.h" | 8 #include "src/codegen.h" |
9 #include "src/compiler.h" | 9 #include "src/compiler.h" |
10 #include "src/cpu-profiler.h" | 10 #include "src/cpu-profiler.h" |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 FunctionLiteral* function = info->function(); | 173 FunctionLiteral* function = info->function(); |
174 bool print_source = code->kind() == Code::OPTIMIZED_FUNCTION || | 174 bool print_source = code->kind() == Code::OPTIMIZED_FUNCTION || |
175 code->kind() == Code::FUNCTION; | 175 code->kind() == Code::FUNCTION; |
176 | 176 |
177 CodeTracer::Scope tracing_scope(info->isolate()->GetCodeTracer()); | 177 CodeTracer::Scope tracing_scope(info->isolate()->GetCodeTracer()); |
178 OFStream os(tracing_scope.file()); | 178 OFStream os(tracing_scope.file()); |
179 if (print_source) { | 179 if (print_source) { |
180 Handle<Script> script = info->script(); | 180 Handle<Script> script = info->script(); |
181 if (!script->IsUndefined() && !script->source()->IsUndefined()) { | 181 if (!script->IsUndefined() && !script->source()->IsUndefined()) { |
182 os << "--- Raw source ---\n"; | 182 os << "--- Raw source ---\n"; |
183 ConsStringIteratorOp op; | |
184 StringCharacterStream stream(String::cast(script->source()), | 183 StringCharacterStream stream(String::cast(script->source()), |
185 &op, | |
186 function->start_position()); | 184 function->start_position()); |
187 // fun->end_position() points to the last character in the stream. We | 185 // fun->end_position() points to the last character in the stream. We |
188 // need to compensate by adding one to calculate the length. | 186 // need to compensate by adding one to calculate the length. |
189 int source_len = | 187 int source_len = |
190 function->end_position() - function->start_position() + 1; | 188 function->end_position() - function->start_position() + 1; |
191 for (int i = 0; i < source_len; i++) { | 189 for (int i = 0; i < source_len; i++) { |
192 if (stream.HasMore()) { | 190 if (stream.HasMore()) { |
193 os << AsReversiblyEscapedUC16(stream.GetNext()); | 191 os << AsReversiblyEscapedUC16(stream.GetNext()); |
194 } | 192 } |
195 } | 193 } |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 masm->positions_recorder()->RecordStatementPosition(pos); | 227 masm->positions_recorder()->RecordStatementPosition(pos); |
230 masm->positions_recorder()->RecordPosition(pos); | 228 masm->positions_recorder()->RecordPosition(pos); |
231 if (right_here) { | 229 if (right_here) { |
232 return masm->positions_recorder()->WriteRecordedPositions(); | 230 return masm->positions_recorder()->WriteRecordedPositions(); |
233 } | 231 } |
234 } | 232 } |
235 return false; | 233 return false; |
236 } | 234 } |
237 | 235 |
238 } } // namespace v8::internal | 236 } } // namespace v8::internal |
OLD | NEW |