• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2006-2008 the V8 project authors. All rights reserved.
2 // 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 
30 namespace v8 {
31 namespace internal {
32 
33 
34 #ifdef OBJECT_PRINT
Print(FILE * out)35 void LookupResult::Print(FILE* out) {
36   if (!IsFound()) {
37     PrintF(out, "Not Found\n");
38     return;
39   }
40 
41   PrintF(out, "LookupResult:\n");
42   PrintF(out, " -cacheable = %s\n", IsCacheable() ? "true" : "false");
43   PrintF(out, " -attributes = %x\n", GetAttributes());
44   switch (type()) {
45     case NORMAL:
46       PrintF(out, " -type = normal\n");
47       PrintF(out, " -entry = %d", GetDictionaryEntry());
48       break;
49     case MAP_TRANSITION:
50       PrintF(out, " -type = map transition\n");
51       PrintF(out, " -map:\n");
52       GetTransitionMap()->Print(out);
53       PrintF(out, "\n");
54       break;
55     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;
61     case CONSTANT_FUNCTION:
62       PrintF(out, " -type = constant function\n");
63       PrintF(out, " -function:\n");
64       GetConstantFunction()->Print(out);
65       PrintF(out, "\n");
66       break;
67     case FIELD:
68       PrintF(out, " -type = field\n");
69       PrintF(out, " -index = %d", GetFieldIndex());
70       PrintF(out, "\n");
71       break;
72     case CALLBACKS:
73       PrintF(out, " -type = call backs\n");
74       PrintF(out, " -callback object:\n");
75       GetCallbackObject()->Print(out);
76       break;
77     case INTERCEPTOR:
78       PrintF(out, " -type = lookup interceptor\n");
79       break;
80     case CONSTANT_TRANSITION:
81       PrintF(out, " -type = constant property transition\n");
82       break;
83     case NULL_DESCRIPTOR:
84       PrintF(out, " =type = null descriptor\n");
85       break;
86   }
87 }
88 
89 
Print(FILE * out)90 void Descriptor::Print(FILE* out) {
91   PrintF(out, "Descriptor ");
92   GetKey()->ShortPrint(out);
93   PrintF(out, " @ ");
94   GetValue()->ShortPrint(out);
95   PrintF(out, " %d\n", GetDetails().index());
96 }
97 
98 
99 #endif
100 
101 
102 } }  // namespace v8::internal
103