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

Side by Side Diff: src/disassembler.cc

Issue 435003: Patch for allowing several V8 instances in process:... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 years 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/execution.h » ('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 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 explicit V8NameConverter(Code* code) : code_(code) {} 58 explicit V8NameConverter(Code* code) : code_(code) {}
59 virtual const char* NameOfAddress(byte* pc) const; 59 virtual const char* NameOfAddress(byte* pc) const;
60 virtual const char* NameInCode(byte* addr) const; 60 virtual const char* NameInCode(byte* addr) const;
61 Code* code() const { return code_; } 61 Code* code() const { return code_; }
62 private: 62 private:
63 Code* code_; 63 Code* code_;
64 }; 64 };
65 65
66 66
67 const char* V8NameConverter::NameOfAddress(byte* pc) const { 67 const char* V8NameConverter::NameOfAddress(byte* pc) const {
68 static v8::internal::EmbeddedVector<char, 128> buffer; 68 v8::internal::EmbeddedVector<char, 128> buffer =
69 v8_context()->disassembler_data_->buffer_;
69 70
70 const char* name = Builtins::Lookup(pc); 71 const char* name = Builtins::Lookup(pc);
71 if (name != NULL) { 72 if (name != NULL) {
72 OS::SNPrintF(buffer, "%s (%p)", name, pc); 73 OS::SNPrintF(buffer, "%s (%p)", name, pc);
73 return buffer.start(); 74 return buffer.start();
74 } 75 }
75 76
76 if (code_ != NULL) { 77 if (code_ != NULL) {
77 int offs = static_cast<int>(pc - code_->instruction_start()); 78 int offs = static_cast<int>(pc - code_->instruction_start());
78 // print as code offset, if it seems reasonable 79 // print as code offset, if it seems reasonable
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 301
301 302
302 // Called by Code::CodePrint. 303 // Called by Code::CodePrint.
303 void Disassembler::Decode(FILE* f, Code* code) { 304 void Disassembler::Decode(FILE* f, Code* code) {
304 byte* begin = Code::cast(code)->instruction_start(); 305 byte* begin = Code::cast(code)->instruction_start();
305 byte* end = begin + Code::cast(code)->instruction_size(); 306 byte* end = begin + Code::cast(code)->instruction_size();
306 V8NameConverter v8NameConverter(code); 307 V8NameConverter v8NameConverter(code);
307 DecodeIt(f, v8NameConverter, begin, end); 308 DecodeIt(f, v8NameConverter, begin, end);
308 } 309 }
309 310
311 void Disassembler::PostConstruct() {
312 v8_context()->disassembler_data_ = new disasm::DisassemblerData();
313 }
314
315 void Disassembler::PreDestroy() {
316 delete v8_context()->disassembler_data_;
317 }
318
310 #else // ENABLE_DISASSEMBLER 319 #else // ENABLE_DISASSEMBLER
311 320
312 void Disassembler::Dump(FILE* f, byte* begin, byte* end) {} 321 void Disassembler::Dump(FILE* f, byte* begin, byte* end) {}
313 int Disassembler::Decode(FILE* f, byte* begin, byte* end) { return 0; } 322 int Disassembler::Decode(FILE* f, byte* begin, byte* end) { return 0; }
314 void Disassembler::Decode(FILE* f, Code* code) {} 323 void Disassembler::Decode(FILE* f, Code* code) {}
315 324
316 #endif // ENABLE_DISASSEMBLER 325 #endif // ENABLE_DISASSEMBLER
317 326
318 } } // namespace v8::internal 327 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/disassembler.h ('k') | src/execution.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698