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 "v8.h" | 5 #include "v8.h" |
6 | 6 |
7 #include "disassembler.h" | 7 #include "disassembler.h" |
8 #include "disasm.h" | 8 #include "disasm.h" |
9 #include "jsregexp.h" | 9 #include "jsregexp.h" |
10 #include "objects-visiting.h" | 10 #include "objects-visiting.h" |
11 | 11 |
12 namespace v8 { | 12 namespace v8 { |
13 namespace internal { | 13 namespace internal { |
14 | 14 |
15 #ifdef OBJECT_PRINT | 15 #ifdef OBJECT_PRINT |
16 | 16 |
17 void MaybeObject::Print() { | 17 void Object::Print() { |
18 Print(stdout); | 18 Print(stdout); |
19 } | 19 } |
20 | 20 |
21 | 21 |
22 void MaybeObject::Print(FILE* out) { | 22 void Object::Print(FILE* out) { |
23 Object* this_as_object; | 23 if (IsSmi()) { |
24 if (ToObject(&this_as_object)) { | 24 Smi::cast(this)->SmiPrint(out); |
25 if (this_as_object->IsSmi()) { | |
26 Smi::cast(this_as_object)->SmiPrint(out); | |
27 } else { | |
28 HeapObject::cast(this_as_object)->HeapObjectPrint(out); | |
29 } | |
30 } else { | 25 } else { |
31 Failure::cast(this)->FailurePrint(out); | 26 HeapObject::cast(this)->HeapObjectPrint(out); |
32 } | 27 } |
33 Flush(out); | 28 Flush(out); |
34 } | 29 } |
35 | 30 |
36 | 31 |
37 void MaybeObject::PrintLn() { | 32 void Object::PrintLn() { |
38 PrintLn(stdout); | 33 PrintLn(stdout); |
39 } | 34 } |
40 | 35 |
41 | 36 |
42 void MaybeObject::PrintLn(FILE* out) { | 37 void Object::PrintLn(FILE* out) { |
43 Print(out); | 38 Print(out); |
44 PrintF(out, "\n"); | 39 PrintF(out, "\n"); |
45 } | 40 } |
46 | 41 |
47 | 42 |
48 void HeapObject::PrintHeader(FILE* out, const char* id) { | 43 void HeapObject::PrintHeader(FILE* out, const char* id) { |
49 PrintF(out, "%p: [%s]\n", reinterpret_cast<void*>(this), id); | 44 PrintF(out, "%p: [%s]\n", reinterpret_cast<void*>(this), id); |
50 } | 45 } |
51 | 46 |
52 | 47 |
(...skipping 1197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1250 } | 1245 } |
1251 } | 1246 } |
1252 PrintF(out, "\n"); | 1247 PrintF(out, "\n"); |
1253 } | 1248 } |
1254 | 1249 |
1255 | 1250 |
1256 #endif // OBJECT_PRINT | 1251 #endif // OBJECT_PRINT |
1257 | 1252 |
1258 | 1253 |
1259 } } // namespace v8::internal | 1254 } } // namespace v8::internal |
OLD | NEW |