| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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/hydrogen.h" | 5 #include "src/hydrogen.h" |
| 6 | 6 |
| 7 #include <sstream> | 7 #include <sstream> |
| 8 | 8 |
| 9 #include "src/v8.h" | 9 #include "src/v8.h" |
| 10 | 10 |
| (...skipping 3493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3504 inlined_functions_.Add(InlinedFunctionInfo(shared), zone()); | 3504 inlined_functions_.Add(InlinedFunctionInfo(shared), zone()); |
| 3505 | 3505 |
| 3506 if (!shared->script()->IsUndefined()) { | 3506 if (!shared->script()->IsUndefined()) { |
| 3507 Handle<Script> script(Script::cast(shared->script())); | 3507 Handle<Script> script(Script::cast(shared->script())); |
| 3508 if (!script->source()->IsUndefined()) { | 3508 if (!script->source()->IsUndefined()) { |
| 3509 CodeTracer::Scope tracing_scopex(isolate()->GetCodeTracer()); | 3509 CodeTracer::Scope tracing_scopex(isolate()->GetCodeTracer()); |
| 3510 OFStream os(tracing_scopex.file()); | 3510 OFStream os(tracing_scopex.file()); |
| 3511 os << "--- FUNCTION SOURCE (" << shared->DebugName()->ToCString().get() | 3511 os << "--- FUNCTION SOURCE (" << shared->DebugName()->ToCString().get() |
| 3512 << ") id{" << info()->optimization_id() << "," << id << "} ---\n"; | 3512 << ") id{" << info()->optimization_id() << "," << id << "} ---\n"; |
| 3513 { | 3513 { |
| 3514 StringCharacterStream stream(String::cast(script->source()), | 3514 DisallowHeapAllocation no_allocation; |
| 3515 shared->start_position()); | 3515 int start = shared->start_position(); |
| 3516 // fun->end_position() points to the last character in the stream. We | 3516 int len = shared->end_position() - start + 1; |
| 3517 // need to compensate by adding one to calculate the length. | 3517 String::SubStringRange source(String::cast(script->source()), start, |
| 3518 int source_len = | 3518 len); |
| 3519 shared->end_position() - shared->start_position() + 1; | 3519 for (const auto& c : source) { |
| 3520 for (int i = 0; i < source_len; i++) { | 3520 os << AsReversiblyEscapedUC16(c); |
| 3521 if (stream.HasMore()) { | |
| 3522 os << AsReversiblyEscapedUC16(stream.GetNext()); | |
| 3523 } | |
| 3524 } | 3521 } |
| 3525 } | 3522 } |
| 3526 | 3523 |
| 3527 os << "\n--- END ---\n"; | 3524 os << "\n--- END ---\n"; |
| 3528 } | 3525 } |
| 3529 } | 3526 } |
| 3530 } | 3527 } |
| 3531 | 3528 |
| 3532 int inline_id = inlining_id_to_function_id_.length(); | 3529 int inline_id = inlining_id_to_function_id_.length(); |
| 3533 inlining_id_to_function_id_.Add(id, zone()); | 3530 inlining_id_to_function_id_.Add(id, zone()); |
| (...skipping 9948 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13482 if (ShouldProduceTraceOutput()) { | 13479 if (ShouldProduceTraceOutput()) { |
| 13483 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 13480 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
| 13484 } | 13481 } |
| 13485 | 13482 |
| 13486 #ifdef DEBUG | 13483 #ifdef DEBUG |
| 13487 graph_->Verify(false); // No full verify. | 13484 graph_->Verify(false); // No full verify. |
| 13488 #endif | 13485 #endif |
| 13489 } | 13486 } |
| 13490 | 13487 |
| 13491 } } // namespace v8::internal | 13488 } } // namespace v8::internal |
| OLD | NEW |