blob: dd232093bd39a1561139afde4dade96c22b9ffb7 [file] [log] [blame]
ager@chromium.org9258b6b2008-09-11 09:11:10 +00001// Copyright 2006-2008 the V8 project authors. All rights reserved.
christian.plesner.hansen43d26ec2008-07-03 15:10:15 +00002// Redistribution and use in source and binary forms, with or without
3// modification, are permitted provided that the following conditions are
4// met:
5//
6// * Redistributions of source code must retain the above copyright
7// notice, this list of conditions and the following disclaimer.
8// * Redistributions in binary form must reproduce the above
9// copyright notice, this list of conditions and the following
10// disclaimer in the documentation and/or other materials provided
11// with the distribution.
12// * Neither the name of Google Inc. nor the names of its
13// contributors may be used to endorse or promote products derived
14// from this software without specific prior written permission.
15//
16// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
28#include "v8.h"
29
kasperl@chromium.org71affb52009-05-26 05:44:31 +000030namespace v8 {
31namespace internal {
christian.plesner.hansen43d26ec2008-07-03 15:10:15 +000032
33
whesse@chromium.org023421e2010-12-21 12:19:12 +000034#ifdef OBJECT_PRINT
35void LookupResult::Print(FILE* out) {
ager@chromium.org5c838252010-02-19 08:53:10 +000036 if (!IsFound()) {
whesse@chromium.org023421e2010-12-21 12:19:12 +000037 PrintF(out, "Not Found\n");
christian.plesner.hansen43d26ec2008-07-03 15:10:15 +000038 return;
39 }
40
whesse@chromium.org023421e2010-12-21 12:19:12 +000041 PrintF(out, "LookupResult:\n");
42 PrintF(out, " -cacheable = %s\n", IsCacheable() ? "true" : "false");
43 PrintF(out, " -attributes = %x\n", GetAttributes());
christian.plesner.hansen43d26ec2008-07-03 15:10:15 +000044 switch (type()) {
45 case NORMAL:
whesse@chromium.org023421e2010-12-21 12:19:12 +000046 PrintF(out, " -type = normal\n");
47 PrintF(out, " -entry = %d", GetDictionaryEntry());
christian.plesner.hansen43d26ec2008-07-03 15:10:15 +000048 break;
49 case MAP_TRANSITION:
whesse@chromium.org023421e2010-12-21 12:19:12 +000050 PrintF(out, " -type = map transition\n");
51 PrintF(out, " -map:\n");
52 GetTransitionMap()->Print(out);
53 PrintF(out, "\n");
christian.plesner.hansen43d26ec2008-07-03 15:10:15 +000054 break;
fschneider@chromium.org7979bbb2011-03-28 10:47:03 +000055 case EXTERNAL_ARRAY_TRANSITION:
56 PrintF(out, " -type = external array transition\n");
57 PrintF(out, " -map:\n");
58 GetTransitionMap()->Print(out);
59 PrintF(out, "\n");
60 break;
christian.plesner.hansen43d26ec2008-07-03 15:10:15 +000061 case CONSTANT_FUNCTION:
whesse@chromium.org023421e2010-12-21 12:19:12 +000062 PrintF(out, " -type = constant function\n");
63 PrintF(out, " -function:\n");
64 GetConstantFunction()->Print(out);
65 PrintF(out, "\n");
christian.plesner.hansen43d26ec2008-07-03 15:10:15 +000066 break;
67 case FIELD:
whesse@chromium.org023421e2010-12-21 12:19:12 +000068 PrintF(out, " -type = field\n");
69 PrintF(out, " -index = %d", GetFieldIndex());
70 PrintF(out, "\n");
christian.plesner.hansen43d26ec2008-07-03 15:10:15 +000071 break;
72 case CALLBACKS:
whesse@chromium.org023421e2010-12-21 12:19:12 +000073 PrintF(out, " -type = call backs\n");
74 PrintF(out, " -callback object:\n");
75 GetCallbackObject()->Print(out);
christian.plesner.hansen43d26ec2008-07-03 15:10:15 +000076 break;
kmillikin@chromium.orgc53e10d2011-05-18 09:12:58 +000077 case HANDLER:
78 PrintF(out, " -type = lookup proxy\n");
79 break;
christian.plesner.hansen43d26ec2008-07-03 15:10:15 +000080 case INTERCEPTOR:
whesse@chromium.org023421e2010-12-21 12:19:12 +000081 PrintF(out, " -type = lookup interceptor\n");
christian.plesner.hansen43d26ec2008-07-03 15:10:15 +000082 break;
83 case CONSTANT_TRANSITION:
whesse@chromium.org023421e2010-12-21 12:19:12 +000084 PrintF(out, " -type = constant property transition\n");
christian.plesner.hansen43d26ec2008-07-03 15:10:15 +000085 break;
mads.s.ager@gmail.com9a4089a2008-09-01 08:55:01 +000086 case NULL_DESCRIPTOR:
whesse@chromium.org023421e2010-12-21 12:19:12 +000087 PrintF(out, " =type = null descriptor\n");
mads.s.ager@gmail.com9a4089a2008-09-01 08:55:01 +000088 break;
christian.plesner.hansen43d26ec2008-07-03 15:10:15 +000089 }
90}
91
92
whesse@chromium.org023421e2010-12-21 12:19:12 +000093void Descriptor::Print(FILE* out) {
94 PrintF(out, "Descriptor ");
95 GetKey()->ShortPrint(out);
96 PrintF(out, " @ ");
97 GetValue()->ShortPrint(out);
98 PrintF(out, " %d\n", GetDetails().index());
christian.plesner.hansen43d26ec2008-07-03 15:10:15 +000099}
100
101
102#endif
103
104
105} } // namespace v8::internal