v8  3.25.30(node0.11.13)
V8 is Google's open source JavaScript engine
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
type-info.h
Go to the documentation of this file.
1 // Copyright 2012 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 #ifndef V8_TYPE_INFO_H_
29 #define V8_TYPE_INFO_H_
30 
31 #include "allocation.h"
32 #include "globals.h"
33 #include "types.h"
34 #include "zone-inl.h"
35 
36 namespace v8 {
37 namespace internal {
38 
39 // Forward declarations.
40 class ICStub;
41 class SmallMapList;
42 
43 
45  public:
47  Handle<Context> native_context,
48  Zone* zone);
49 
53  bool CallIsMonomorphic(int slot);
56  bool CallNewIsMonomorphic(int slot);
57 
58  // TODO(1571) We can't use ForInStatement::ForInType as the return value due
59  // to various cycles in our headers.
60  // TODO(rossberg): once all oracle access is removed from ast.cc, it should
61  // be possible.
62  byte ForInType(int feedback_vector_slot);
63 
65 
68  SmallMapList* receiver_types,
69  bool* is_prototype);
71  SmallMapList* receiver_types,
72  bool* is_string);
74  Handle<String> name,
75  SmallMapList* receiver_types);
77  SmallMapList* receiver_types,
78  KeyedAccessStoreMode* store_mode);
80  SmallMapList* receiver_types);
81 
83  SmallMapList* types);
84 
85  static bool CanRetainOtherContext(Map* map, Context* native_context);
86  static bool CanRetainOtherContext(JSFunction* function,
87  Context* native_context);
88 
92 
93  bool LoadIsBuiltin(TypeFeedbackId id, Builtins::Name builtin_id);
94  bool LoadIsStub(TypeFeedbackId id, ICStub* stub);
95 
96  // TODO(1571) We can't use ToBooleanStub::Types as the return value because
97  // of various cycles in our headers. Death to tons of implementations in
98  // headers!! :-P
100 
101  // Get type information for arithmetic operations and compares.
102  void BinaryType(TypeFeedbackId id,
103  Type** left,
104  Type** right,
105  Type** result,
106  Maybe<int>* fixed_right_arg,
107  Handle<AllocationSite>* allocation_site,
108  Token::Value operation);
109 
110  void CompareType(TypeFeedbackId id,
111  Type** left,
112  Type** right,
113  Type** combined);
114 
116 
117  Zone* zone() const { return zone_; }
118  Isolate* isolate() const { return zone_->isolate(); }
119 
120  private:
122  Handle<String> name,
124  SmallMapList* types);
125 
126  void SetInfo(TypeFeedbackId id, Object* target);
127 
128  void BuildDictionary(Handle<Code> code);
129  void GetRelocInfos(Handle<Code> code, ZoneList<RelocInfo>* infos);
130  void CreateDictionary(Handle<Code> code, ZoneList<RelocInfo>* infos);
131  void RelocateRelocInfos(ZoneList<RelocInfo>* infos,
132  Code* old_code,
133  Code* new_code);
134  void ProcessRelocInfos(ZoneList<RelocInfo>* infos);
135 
136  // Returns an element from the backing store. Returns undefined if
137  // there is no information.
138  Handle<Object> GetInfo(TypeFeedbackId id);
139 
140  // Returns an element from the type feedback vector. Returns undefined
141  // if there is no information.
142  Handle<Object> GetInfo(int slot);
143 
144  private:
145  Handle<Context> native_context_;
146  Zone* zone_;
148  Handle<FixedArray> feedback_vector_;
149 
150  DISALLOW_COPY_AND_ASSIGN(TypeFeedbackOracle);
151 };
152 
153 } } // namespace v8::internal
154 
155 #endif // V8_TYPE_INFO_H_
bool CallNewIsMonomorphic(int slot)
Definition: type-info.cc:129
byte ToBooleanTypes(TypeFeedbackId id)
Definition: type-info.cc:413
Handle< AllocationSite > GetCallNewAllocationSite(int slot)
Definition: type-info.cc:180
Type * CountType(TypeFeedbackId id)
Definition: type-info.cc:275
enable upcoming ES6 features enable harmony block scoping enable harmony enable harmony proxies enable harmony generators enable harmony numeric enable harmony string enable harmony math functions harmony_scoping harmony_symbols harmony_collections harmony_iteration harmony_strings harmony_scoping harmony_maths tracks arrays with only smi values Optimize object Array DOM strings and string pretenure call new trace pretenuring decisions of HAllocate instructions track fields with only smi values track fields with heap values track_fields track_fields Enables optimizations which favor memory size over execution speed use string slices optimization filter maximum number of GVN fix point iterations use function inlining use allocation folding eliminate write barriers targeting allocations in optimized code maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining crankshaft harvests type feedback from stub cache trace check elimination phase hydrogen tracing filter trace hydrogen to given file name trace inlining decisions trace store elimination trace all use positions trace global value numbering trace hydrogen escape analysis trace the tracking of allocation sites trace map generalization environment for every instruction deoptimize every n garbage collections put a break point before deoptimizing deoptimize uncommon cases use on stack replacement trace array bounds check elimination perform array index dehoisting use load elimination use store elimination use constant folding eliminate unreachable code number of stress runs when picking a function to watch for shared function not JSFunction itself flushes the cache of optimized code for closures on every GC functions with arguments object maximum number of escape analysis fix point iterations allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms concurrent on stack replacement do not emit check maps for constant values that have a leaf map
Definition: flags.cc:350
static bool CanRetainOtherContext(Map *map, Context *native_context)
Definition: type-info.cc:358
void AssignmentReceiverTypes(TypeFeedbackId id, Handle< String > name, SmallMapList *receiver_types)
Definition: type-info.cc:310
KeyedAccessStoreMode
Definition: objects.h:164
uint32_t Flags
Definition: objects.h:5184
void CollectReceiverTypes(TypeFeedbackId id, SmallMapList *types)
Definition: type-info.cc:389
Isolate * isolate()
Definition: zone.h:90
uint8_t byte
Definition: globals.h:185
bool LoadIsBuiltin(TypeFeedbackId id, Builtins::Name builtin_id)
Definition: type-info.cc:189
Handle< JSFunction > GetCallNewTarget(int slot)
Definition: type-info.cc:169
void CompareType(TypeFeedbackId id, Type **left, Type **right, Type **combined)
Definition: type-info.cc:205
enable upcoming ES6 features enable harmony block scoping enable harmony enable harmony proxies enable harmony generators enable harmony numeric enable harmony string enable harmony math functions harmony_scoping harmony_symbols harmony_collections harmony_iteration harmony_strings harmony_scoping harmony_maths tracks arrays with only smi values Optimize object Array DOM strings and string pretenure call new trace pretenuring decisions of HAllocate instructions track fields with only smi values track fields with heap values track_fields track_fields Enables optimizations which favor memory size over execution speed use string slices optimization filter maximum number of GVN fix point iterations use function inlining use allocation folding eliminate write barriers targeting allocations in optimized code maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining crankshaft harvests type feedback from stub cache trace check elimination phase hydrogen tracing filter trace hydrogen to given file name trace inlining decisions trace store elimination trace all use positions trace global value numbering trace hydrogen escape analysis trace the tracking of allocation sites trace map generalization environment for every instruction deoptimize every n garbage collections put a break point before deoptimizing deoptimize uncommon cases use on stack replacement trace array bounds check elimination perform array index dehoisting use load elimination use store elimination use constant folding eliminate unreachable code number of stress runs when picking a function to watch for shared function not JSFunction itself flushes the cache of optimized code for closures on every GC functions with arguments object maximum number of escape analysis fix point iterations allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms concurrent on stack replacement do not emit check maps for constant values that have a leaf deoptimize the optimized code if the layout of the maps changes number of stack frames inspected by the profiler percentage of ICs that must have type info to allow optimization extra verbose compilation tracing generate extra emit comments in code disassembly enable use of SSE3 instructions if available enable use of CMOV instruction if available enable use of VFP3 instructions if available enable use of NEON instructions if enable use of SDIV and UDIV instructions if enable loading bit constant by means of movw movt instruction enable unaligned accesses for enable use of d16 d31 registers on ARM this requires VFP3 force all emitted branches to be in long expose natives in global object expose freeBuffer extension expose gc extension under the specified name expose externalize string extension number of stack frames to capture disable builtin natives files print name of functions for which code is generated use random jit cookie to mask large constants trace lazy optimization use adaptive optimizations always try to OSR functions trace optimize function deoptimization minimum length for automatic enable preparsing maximum number of optimization attempts before giving up cache prototype transitions trace debugging JSON request response trace out of bounds accesses to external arrays trace_js_array_abuse automatically set the debug break flag when debugger commands are in the queue abort by crashing maximum length of function source code printed in a stack trace max size of the new max size of the old max size of executable always perform global GCs print one trace line following each garbage collection do not print trace line after scavenger collection print statistics of the maximum memory committed for the heap in only print modified registers Don t break for ASM_UNIMPLEMENTED_BREAK macros print stack trace when an illegal exception is thrown randomize hashes to avoid predictable hash Fixed seed to use to hash property Print the time it takes to deserialize the snapshot testing_bool_flag testing_int_flag string flag tmp file in which to serialize heap Print the time it takes to lazily compile hydrogen code stubs concurrent_recompilation concurrent_sweeping Print usage including flags
Definition: flags.cc:665
void PropertyReceiverTypes(TypeFeedbackId id, Handle< String > name, SmallMapList *receiver_types, bool *is_prototype)
Definition: type-info.cc:285
void CountReceiverTypes(TypeFeedbackId id, SmallMapList *receiver_types)
Definition: type-info.cc:327
enable upcoming ES6 features enable harmony block scoping enable harmony enable harmony proxies enable harmony generators enable harmony numeric enable harmony string enable harmony math functions harmony_scoping harmony_symbols harmony_collections harmony_iteration harmony_strings harmony_scoping harmony_maths tracks arrays with only smi values Optimize object Array DOM strings and string pretenure call new trace pretenuring decisions of HAllocate instructions track fields with only smi values track fields with heap values track_fields track_fields Enables optimizations which favor memory size over execution speed use string slices optimization filter maximum number of GVN fix point iterations use function inlining use allocation folding eliminate write barriers targeting allocations in optimized code maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining crankshaft harvests type feedback from stub cache trace check elimination phase hydrogen tracing filter trace hydrogen to given file name trace inlining decisions trace store elimination trace all use positions trace global value numbering trace hydrogen escape analysis trace the tracking of allocation sites trace map generalization environment for every instruction deoptimize every n garbage collections put a break point before deoptimizing deoptimize uncommon cases use on stack replacement trace array bounds check elimination perform array index dehoisting use load elimination use store elimination use constant folding eliminate unreachable code number of stress runs when picking a function to watch for shared function not JSFunction itself flushes the cache of optimized code for closures on every GC functions with arguments object maximum number of escape analysis fix point iterations allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms concurrent on stack replacement do not emit check maps for constant values that have a leaf deoptimize the optimized code if the layout of the maps changes number of stack frames inspected by the profiler percentage of ICs that must have type info to allow optimization extra verbose compilation tracing generate extra code(assertions) for debugging") DEFINE_bool(code_comments
byte ForInType(int feedback_vector_slot)
Definition: type-info.cc:137
bool LoadIsStub(TypeFeedbackId id, ICStub *stub)
Definition: type-info.cc:195
TypeFeedbackOracle(Handle< Code > code, Handle< Context > native_context, Zone *zone)
Definition: type-info.cc:45
bool LoadIsUninitialized(TypeFeedbackId id)
Definition: type-info.cc:92
void KeyedPropertyReceiverTypes(TypeFeedbackId id, SmallMapList *receiver_types, bool *is_string)
Definition: type-info.cc:298
bool StoreIsUninitialized(TypeFeedbackId id)
Definition: type-info.cc:102
Handle< JSFunction > GetCallTarget(int slot)
Definition: type-info.cc:158
bool KeyedArrayCallIsHoley(TypeFeedbackId id)
void KeyedAssignmentReceiverTypes(TypeFeedbackId id, SmallMapList *receiver_types, KeyedAccessStoreMode *store_mode)
Definition: type-info.cc:318
KeyedAccessStoreMode GetStoreMode(TypeFeedbackId id)
Definition: type-info.cc:145
void BinaryType(TypeFeedbackId id, Type **left, Type **right, Type **result, Maybe< int > *fixed_right_arg, Handle< AllocationSite > *allocation_site, Token::Value operation)
Definition: type-info.cc:238
enable upcoming ES6 features enable harmony block scoping enable harmony enable harmony proxies enable harmony generators enable harmony numeric enable harmony string enable harmony math functions harmony_scoping harmony_symbols harmony_collections harmony_iteration harmony_strings harmony_scoping harmony_maths tracks arrays with only smi values Optimize object Array DOM strings and string pretenure call new trace pretenuring decisions of HAllocate instructions track fields with only smi values track fields with heap values track_fields track_fields Enables optimizations which favor memory size over execution speed use string slices optimization filter maximum number of GVN fix point iterations use function inlining use allocation folding eliminate write barriers targeting allocations in optimized code maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining crankshaft harvests type feedback from stub cache trace check elimination phase hydrogen tracing filter trace hydrogen to given file name trace inlining decisions trace store elimination trace all use positions trace global value numbering trace hydrogen escape analysis trace the tracking of allocation sites trace map generalization environment for every instruction deoptimize every n garbage collections put a break point before deoptimizing deoptimize uncommon cases use on stack replacement trace array bounds check elimination perform array index dehoisting use load elimination use store elimination use constant folding eliminate unreachable code number of stress runs when picking a function to watch for shared function not JSFunction itself flushes the cache of optimized code for closures on every GC functions with arguments object maximum number of escape analysis fix point iterations allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms concurrent on stack replacement do not emit check maps for constant values that have a leaf deoptimize the optimized code if the layout of the maps changes number of stack frames inspected by the profiler percentage of ICs that must have type info to allow optimization extra verbose compilation tracing generate extra emit comments in code disassembly enable use of SSE3 instructions if available enable use of CMOV instruction if available enable use of VFP3 instructions if available enable use of NEON instructions if enable use of SDIV and UDIV instructions if enable loading bit constant by means of movw movt instruction enable unaligned accesses for enable use of d16 d31 registers on ARM this requires VFP3 force all emitted branches to be in long expose natives in global object expose freeBuffer extension expose gc extension under the specified name expose externalize string extension number of stack frames to capture disable builtin natives files print name of functions for which code is generated use random jit cookie to mask large constants trace lazy optimization use adaptive optimizations always try to OSR functions trace optimize function deoptimization minimum length for automatic enable preparsing maximum number of optimization attempts before giving up cache prototype transitions trace debugging JSON request response trace out of bounds accesses to external arrays trace_js_array_abuse automatically set the debug break flag when debugger commands are in the queue abort by crashing maximum length of function source code printed in a stack trace max size of the new max size of the old max size of executable always perform global GCs print one trace line following each garbage collection do not print trace line after scavenger collection print statistics of the maximum memory committed for the heap in name
Definition: flags.cc:505
bool StoreIsKeyedPolymorphic(TypeFeedbackId id)
Definition: type-info.cc:110
Isolate * isolate() const
Definition: type-info.h:118