Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(149)

Side by Side Diff: src/disassembler.cc

Issue 618643002: Replace OStream with std::ostream. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fix Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/disassembler.h ('k') | src/flags.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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/code-stubs.h" 7 #include "src/code-stubs.h"
8 #include "src/codegen.h" 8 #include "src/codegen.h"
9 #include "src/debug.h" 9 #include "src/debug.h"
10 #include "src/deoptimizer.h" 10 #include "src/deoptimizer.h"
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 } 52 }
53 53
54 54
55 const char* V8NameConverter::NameInCode(byte* addr) const { 55 const char* V8NameConverter::NameInCode(byte* addr) const {
56 // The V8NameConverter is used for well known code, so we can "safely" 56 // The V8NameConverter is used for well known code, so we can "safely"
57 // dereference pointers in generated code. 57 // dereference pointers in generated code.
58 return (code_ != NULL) ? reinterpret_cast<const char*>(addr) : ""; 58 return (code_ != NULL) ? reinterpret_cast<const char*>(addr) : "";
59 } 59 }
60 60
61 61
62 static void DumpBuffer(OStream* os, StringBuilder* out) { 62 static void DumpBuffer(std::ostream* os, StringBuilder* out) {
63 (*os) << out->Finalize() << endl; 63 (*os) << out->Finalize() << std::endl;
64 out->Reset(); 64 out->Reset();
65 } 65 }
66 66
67 67
68 static const int kOutBufferSize = 2048 + String::kMaxShortPrintLength; 68 static const int kOutBufferSize = 2048 + String::kMaxShortPrintLength;
69 static const int kRelocInfoPosition = 57; 69 static const int kRelocInfoPosition = 57;
70 70
71 static int DecodeIt(Isolate* isolate, OStream* os, 71 static int DecodeIt(Isolate* isolate, std::ostream* os,
72 const V8NameConverter& converter, byte* begin, byte* end) { 72 const V8NameConverter& converter, byte* begin, byte* end) {
73 SealHandleScope shs(isolate); 73 SealHandleScope shs(isolate);
74 DisallowHeapAllocation no_alloc; 74 DisallowHeapAllocation no_alloc;
75 ExternalReferenceEncoder ref_encoder(isolate); 75 ExternalReferenceEncoder ref_encoder(isolate);
76 76
77 v8::internal::EmbeddedVector<char, 128> decode_buffer; 77 v8::internal::EmbeddedVector<char, 128> decode_buffer;
78 v8::internal::EmbeddedVector<char, kOutBufferSize> out_buffer; 78 v8::internal::EmbeddedVector<char, kOutBufferSize> out_buffer;
79 StringBuilder out(out_buffer.start(), out_buffer.length()); 79 StringBuilder out(out_buffer.start(), out_buffer.length());
80 byte* pc = begin; 80 byte* pc = begin;
81 disasm::Disassembler d(converter); 81 disasm::Disassembler d(converter);
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 DumpBuffer(os, &out); 268 DumpBuffer(os, &out);
269 } 269 }
270 } 270 }
271 } 271 }
272 272
273 delete it; 273 delete it;
274 return static_cast<int>(pc - begin); 274 return static_cast<int>(pc - begin);
275 } 275 }
276 276
277 277
278 int Disassembler::Decode(Isolate* isolate, OStream* os, byte* begin, byte* end, 278 int Disassembler::Decode(Isolate* isolate, std::ostream* os, byte* begin,
279 Code* code) { 279 byte* end, Code* code) {
280 V8NameConverter v8NameConverter(code); 280 V8NameConverter v8NameConverter(code);
281 return DecodeIt(isolate, os, v8NameConverter, begin, end); 281 return DecodeIt(isolate, os, v8NameConverter, begin, end);
282 } 282 }
283 283
284 #else // ENABLE_DISASSEMBLER 284 #else // ENABLE_DISASSEMBLER
285 285
286 int Disassembler::Decode(Isolate* isolate, OStream* os, byte* begin, byte* end, 286 int Disassembler::Decode(Isolate* isolate, std::ostream* os, byte* begin,
287 Code* code) { 287 byte* end, Code* code) {
288 return 0; 288 return 0;
289 } 289 }
290 290
291 #endif // ENABLE_DISASSEMBLER 291 #endif // ENABLE_DISASSEMBLER
292 292
293 } } // namespace v8::internal 293 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/disassembler.h ('k') | src/flags.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698