v8
3.11.10(node0.8.26)
V8 is Google's open source JavaScript engine
Main Page
Namespaces
Data Structures
Files
Examples
File List
Globals
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
objects-visiting.cc
Go to the documentation of this file.
1
// Copyright 2011 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
#include "
ic-inl.h
"
31
#include "
objects-visiting.h
"
32
33
namespace
v8 {
34
namespace
internal {
35
36
37
static
inline
bool
IsShortcutCandidate(
int
type
) {
38
return
((type &
kShortcutTypeMask
) ==
kShortcutTypeTag
);
39
}
40
41
42
StaticVisitorBase::VisitorId
StaticVisitorBase::GetVisitorId
(
43
int
instance_type,
44
int
instance_size) {
45
if
(instance_type <
FIRST_NONSTRING_TYPE
) {
46
switch
(instance_type &
kStringRepresentationMask
) {
47
case
kSeqStringTag
:
48
if
((instance_type &
kStringEncodingMask
) ==
kAsciiStringTag
) {
49
return
kVisitSeqAsciiString
;
50
}
else
{
51
return
kVisitSeqTwoByteString
;
52
}
53
54
case
kConsStringTag
:
55
if
(IsShortcutCandidate(instance_type)) {
56
return
kVisitShortcutCandidate
;
57
}
else
{
58
return
kVisitConsString
;
59
}
60
61
case
kSlicedStringTag
:
62
return
kVisitSlicedString
;
63
64
case
kExternalStringTag
:
65
return
GetVisitorIdForSize
(
kVisitDataObject
,
66
kVisitDataObjectGeneric
,
67
instance_size);
68
}
69
UNREACHABLE
();
70
}
71
72
switch
(instance_type) {
73
case
BYTE_ARRAY_TYPE
:
74
return
kVisitByteArray
;
75
76
case
FREE_SPACE_TYPE
:
77
return
kVisitFreeSpace
;
78
79
case
FIXED_ARRAY_TYPE
:
80
return
kVisitFixedArray
;
81
82
case
FIXED_DOUBLE_ARRAY_TYPE
:
83
return
kVisitFixedDoubleArray
;
84
85
case
ODDBALL_TYPE
:
86
return
kVisitOddball
;
87
88
case
MAP_TYPE
:
89
return
kVisitMap
;
90
91
case
CODE_TYPE
:
92
return
kVisitCode
;
93
94
case
JS_GLOBAL_PROPERTY_CELL_TYPE
:
95
return
kVisitPropertyCell
;
96
97
case
JS_SET_TYPE
:
98
return
GetVisitorIdForSize
(
kVisitStruct
,
99
kVisitStructGeneric
,
100
JSSet::kSize
);
101
102
case
JS_MAP_TYPE
:
103
return
GetVisitorIdForSize
(
kVisitStruct
,
104
kVisitStructGeneric
,
105
JSMap::kSize
);
106
107
case
JS_WEAK_MAP_TYPE
:
108
return
kVisitJSWeakMap
;
109
110
case
JS_REGEXP_TYPE
:
111
return
kVisitJSRegExp
;
112
113
case
SHARED_FUNCTION_INFO_TYPE
:
114
return
kVisitSharedFunctionInfo
;
115
116
case
JS_PROXY_TYPE
:
117
return
GetVisitorIdForSize
(
kVisitStruct
,
118
kVisitStructGeneric
,
119
JSProxy::kSize
);
120
121
case
JS_FUNCTION_PROXY_TYPE
:
122
return
GetVisitorIdForSize
(
kVisitStruct
,
123
kVisitStructGeneric
,
124
JSFunctionProxy::kSize
);
125
126
case
FOREIGN_TYPE
:
127
return
GetVisitorIdForSize
(
kVisitDataObject
,
128
kVisitDataObjectGeneric
,
129
Foreign::kSize
);
130
131
case
FILLER_TYPE
:
132
return
kVisitDataObjectGeneric
;
133
134
case
JS_OBJECT_TYPE
:
135
case
JS_CONTEXT_EXTENSION_OBJECT_TYPE
:
136
case
JS_MODULE_TYPE
:
137
case
JS_VALUE_TYPE
:
138
case
JS_DATE_TYPE
:
139
case
JS_ARRAY_TYPE
:
140
case
JS_GLOBAL_PROXY_TYPE
:
141
case
JS_GLOBAL_OBJECT_TYPE
:
142
case
JS_BUILTINS_OBJECT_TYPE
:
143
case
JS_MESSAGE_OBJECT_TYPE
:
144
return
GetVisitorIdForSize
(
kVisitJSObject
,
145
kVisitJSObjectGeneric
,
146
instance_size);
147
148
case
JS_FUNCTION_TYPE
:
149
return
kVisitJSFunction
;
150
151
case
HEAP_NUMBER_TYPE
:
152
case
EXTERNAL_PIXEL_ARRAY_TYPE
:
153
case
EXTERNAL_BYTE_ARRAY_TYPE
:
154
case
EXTERNAL_UNSIGNED_BYTE_ARRAY_TYPE
:
155
case
EXTERNAL_SHORT_ARRAY_TYPE
:
156
case
EXTERNAL_UNSIGNED_SHORT_ARRAY_TYPE
:
157
case
EXTERNAL_INT_ARRAY_TYPE
:
158
case
EXTERNAL_UNSIGNED_INT_ARRAY_TYPE
:
159
case
EXTERNAL_FLOAT_ARRAY_TYPE
:
160
case
EXTERNAL_DOUBLE_ARRAY_TYPE
:
161
return
GetVisitorIdForSize
(
kVisitDataObject
,
162
kVisitDataObjectGeneric
,
163
instance_size);
164
165
#define MAKE_STRUCT_CASE(NAME, Name, name) \
166
case NAME##_TYPE:
167
STRUCT_LIST
(
MAKE_STRUCT_CASE
)
168
#undef MAKE_STRUCT_CASE
169
return
GetVisitorIdForSize
(
kVisitStruct
,
170
kVisitStructGeneric
,
171
instance_size);
172
173
default
:
174
UNREACHABLE
();
175
return
kVisitorIdCount
;
176
}
177
}
178
179
} }
// namespace v8::internal
v8::internal::kShortcutTypeTag
const uint32_t kShortcutTypeTag
Definition:
objects.h:496
v8::internal::JS_WEAK_MAP_TYPE
Definition:
objects.h:607
v8::internal::StaticVisitorBase::kVisitJSObject
Definition:
objects-visiting.h:80
v8::internal::CODE_TYPE
Definition:
objects.h:539
v8::internal::StaticVisitorBase::kVisitOddball
Definition:
objects-visiting.h:104
v8::internal::StaticVisitorBase::kVisitJSObjectGeneric
Definition:
objects-visiting.h:89
v8::internal::StaticVisitorBase::kVisitorIdCount
Definition:
objects-visiting.h:113
v8::internal::StaticVisitorBase::kVisitMap
Definition:
objects-visiting.h:106
v8::internal::JS_FUNCTION_PROXY_TYPE
Definition:
objects.h:593
v8::internal::JS_GLOBAL_OBJECT_TYPE
Definition:
objects.h:601
ic-inl.h
v8::internal::JS_MODULE_TYPE
Definition:
objects.h:600
v8::internal::JS_CONTEXT_EXTENSION_OBJECT_TYPE
Definition:
objects.h:599
v8::internal::StaticVisitorBase::GetVisitorIdForSize
static VisitorId GetVisitorIdForSize(VisitorId base, VisitorId generic, int object_size)
Definition:
objects-visiting.h:130
v8::internal::JS_VALUE_TYPE
Definition:
objects.h:596
v8::internal::kSlicedStringTag
Definition:
objects.h:460
v8::internal::JSProxy::kSize
static const int kSize
Definition:
objects.h:7880
v8::internal::JS_OBJECT_TYPE
Definition:
objects.h:598
v8::internal::FOREIGN_TYPE
Definition:
objects.h:546
v8::internal::FREE_SPACE_TYPE
Definition:
objects.h:548
v8::internal::JS_GLOBAL_PROPERTY_CELL_TYPE
Definition:
objects.h:541
v8::internal::kStringRepresentationMask
const uint32_t kStringRepresentationMask
Definition:
objects.h:455
v8::internal::FIXED_DOUBLE_ARRAY_TYPE
Definition:
objects.h:558
v8::internal::JSMap::kSize
static const int kSize
Definition:
objects.h:7982
v8::internal::JSFunctionProxy::kSize
static const int kSize
Definition:
objects.h:7921
v8::internal::StaticVisitorBase::VisitorId
VisitorId
Definition:
objects-visiting.h:49
v8::internal::JS_MESSAGE_OBJECT_TYPE
Definition:
objects.h:586
v8::internal::StaticVisitorBase::kVisitCode
Definition:
objects-visiting.h:105
v8::internal::JS_MAP_TYPE
Definition:
objects.h:606
MAKE_STRUCT_CASE
#define MAKE_STRUCT_CASE(NAME, Name, name)
UNREACHABLE
#define UNREACHABLE()
Definition:
checks.h:50
v8::internal::StaticVisitorBase::kVisitShortcutCandidate
Definition:
objects-visiting.h:52
v8::internal::JS_BUILTINS_OBJECT_TYPE
Definition:
objects.h:602
objects-visiting.h
v8::internal::JS_SET_TYPE
Definition:
objects.h:605
v8::internal::EXTERNAL_UNSIGNED_SHORT_ARRAY_TYPE
Definition:
objects.h:552
v8::internal::EXTERNAL_UNSIGNED_INT_ARRAY_TYPE
Definition:
objects.h:554
v8::internal::FILLER_TYPE
Definition:
objects.h:559
v8::internal::StaticVisitorBase::kVisitDataObject
Definition:
objects-visiting.h:69
v8.h
v8::internal::MAP_TYPE
Definition:
objects.h:538
v8::internal::StaticVisitorBase::kVisitSeqTwoByteString
Definition:
objects-visiting.h:51
v8::internal::StaticVisitorBase::kVisitSlicedString
Definition:
objects-visiting.h:103
v8::internal::StaticVisitorBase::kVisitStructGeneric
Definition:
objects-visiting.h:100
v8::internal::kShortcutTypeMask
const uint32_t kShortcutTypeMask
Definition:
objects.h:492
v8::internal::StaticVisitorBase::kVisitSharedFunctionInfo
Definition:
objects-visiting.h:108
v8::internal::StaticVisitorBase::kVisitByteArray
Definition:
objects-visiting.h:53
v8::internal::kConsStringTag
Definition:
objects.h:458
v8::internal::JSSet::kSize
static const int kSize
Definition:
objects.h:7955
v8::internal::StaticVisitorBase::kVisitJSRegExp
Definition:
objects-visiting.h:111
v8::internal::StaticVisitorBase::kVisitJSWeakMap
Definition:
objects-visiting.h:110
v8::internal::StaticVisitorBase::kVisitFixedDoubleArray
Definition:
objects-visiting.h:56
STRUCT_LIST
#define STRUCT_LIST(V)
Definition:
objects.h:429
v8::internal::kExternalStringTag
Definition:
objects.h:459
v8::internal::JS_DATE_TYPE
Definition:
objects.h:597
v8::internal::StaticVisitorBase::kVisitSeqAsciiString
Definition:
objects-visiting.h:50
v8::internal::HEAP_NUMBER_TYPE
Definition:
objects.h:545
v8::internal::JS_FUNCTION_TYPE
Definition:
objects.h:611
v8::internal::EXTERNAL_SHORT_ARRAY_TYPE
Definition:
objects.h:551
v8::internal::StaticVisitorBase::kVisitDataObjectGeneric
Definition:
objects-visiting.h:78
v8::internal::StaticVisitorBase::kVisitStruct
Definition:
objects-visiting.h:91
v8::internal::StaticVisitorBase::kVisitPropertyCell
Definition:
objects-visiting.h:107
v8::internal::JS_GLOBAL_PROXY_TYPE
Definition:
objects.h:603
v8::internal::EXTERNAL_UNSIGNED_BYTE_ARRAY_TYPE
Definition:
objects.h:550
v8::internal::StaticVisitorBase::kVisitFixedArray
Definition:
objects-visiting.h:55
v8::internal::StaticVisitorBase::GetVisitorId
static VisitorId GetVisitorId(int instance_type, int instance_size)
Definition:
objects-visiting.cc:42
v8::internal::EXTERNAL_BYTE_ARRAY_TYPE
Definition:
objects.h:549
v8::internal::JS_PROXY_TYPE
Definition:
objects.h:594
v8::internal::JS_REGEXP_TYPE
Definition:
objects.h:609
v8::internal::StaticVisitorBase::kVisitFreeSpace
Definition:
objects-visiting.h:54
v8::internal::kAsciiStringTag
const uint32_t kAsciiStringTag
Definition:
objects.h:451
v8::internal::EXTERNAL_PIXEL_ARRAY_TYPE
Definition:
objects.h:557
v8::internal::FIXED_ARRAY_TYPE
Definition:
objects.h:583
v8::internal::ODDBALL_TYPE
Definition:
objects.h:540
v8::internal::SHARED_FUNCTION_INFO_TYPE
Definition:
objects.h:584
v8::internal::kSeqStringTag
Definition:
objects.h:457
v8::internal::StaticVisitorBase::kVisitJSFunction
Definition:
objects-visiting.h:109
v8::internal::Foreign::kSize
static const int kSize
Definition:
objects.h:8051
v8::internal::EXTERNAL_FLOAT_ARRAY_TYPE
Definition:
objects.h:555
v8::internal::FIRST_NONSTRING_TYPE
Definition:
objects.h:617
v8::internal::JS_ARRAY_TYPE
Definition:
objects.h:604
v8::internal::type
FlagType type() const
Definition:
flags.cc:1358
v8::internal::EXTERNAL_DOUBLE_ARRAY_TYPE
Definition:
objects.h:556
v8::internal::BYTE_ARRAY_TYPE
Definition:
objects.h:547
v8::internal::StaticVisitorBase::kVisitConsString
Definition:
objects-visiting.h:102
v8::internal::EXTERNAL_INT_ARRAY_TYPE
Definition:
objects.h:553
v8::internal::kStringEncodingMask
const uint32_t kStringEncodingMask
Definition:
objects.h:449
src
objects-visiting.cc
Generated on Sat Jun 7 2014 23:32:17 for v8 by
1.8.6