v8  3.11.10(node0.8.26)
V8 is Google's open source JavaScript engine
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
stub-cache.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_STUB_CACHE_H_
29 #define V8_STUB_CACHE_H_
30 
31 #include "allocation.h"
32 #include "arguments.h"
33 #include "ic-inl.h"
34 #include "macro-assembler.h"
35 #include "objects.h"
36 #include "zone-inl.h"
37 
38 namespace v8 {
39 namespace internal {
40 
41 
42 // The stub cache is used for megamorphic calls and property accesses.
43 // It maps (map, name, type)->Code*
44 
45 // The design of the table uses the inline cache stubs used for
46 // mono-morphic calls. The beauty of this, we do not have to
47 // invalidate the cache whenever a prototype map is changed. The stub
48 // validates the map chain as in the mono-morphic case.
49 
50 class SmallMapList;
51 class StubCache;
52 
53 
55  public:
56  Address address() const { return address_; }
57 
58  private:
59  explicit SCTableReference(Address address) : address_(address) {}
60 
61  Address address_;
62 
63  friend class StubCache;
64 };
65 
66 
67 class StubCache {
68  public:
69  struct Entry {
72  Map* map;
73  };
74 
75  void Initialize();
76 
77 
78  // Computes the right stub matching. Inserts the result in the
79  // cache before returning. This might compile a stub if needed.
81  Handle<JSObject> receiver);
82 
84  Handle<JSObject> receiver,
85  Handle<JSObject> holder,
86  int field_index);
87 
89  Handle<JSObject> receiver,
90  Handle<JSObject> holder,
91  Handle<AccessorInfo> callback);
92 
94  Handle<JSObject> receiver,
95  Handle<JSObject> holder,
96  Handle<JSFunction> getter);
97 
99  Handle<JSObject> receiver,
100  Handle<JSObject> holder,
101  Handle<JSFunction> value);
102 
104  Handle<JSObject> receiver,
105  Handle<JSObject> holder);
106 
108 
110  Handle<JSObject> receiver,
111  Handle<GlobalObject> holder,
113  bool is_dont_delete);
114 
115  // ---
116 
118  Handle<JSObject> receiver,
119  Handle<JSObject> holder,
120  int field_index);
121 
123  Handle<JSObject> receiver,
124  Handle<JSObject> holder,
125  Handle<AccessorInfo> callback);
126 
128  Handle<JSObject> receiver,
129  Handle<JSObject> holder,
130  Handle<JSFunction> value);
131 
133  Handle<JSObject> receiver,
134  Handle<JSObject> holder);
135 
137  Handle<JSArray> receiver);
138 
140  Handle<String> receiver);
141 
143  Handle<JSFunction> receiver);
144 
145  // ---
146 
148  Handle<JSObject> receiver,
149  int field_index,
150  Handle<Map> transition,
151  StrictModeFlag strict_mode);
152 
154 
156  Handle<GlobalObject> receiver,
158  StrictModeFlag strict_mode);
159 
161  Handle<JSObject> receiver,
162  Handle<AccessorInfo> callback,
163  StrictModeFlag strict_mode);
164 
166  Handle<JSObject> receiver,
167  Handle<JSFunction> setter,
168  StrictModeFlag strict_mode);
169 
171  Handle<JSObject> receiver,
172  StrictModeFlag strict_mode);
173 
174  // ---
175 
177  Handle<JSObject> receiver,
178  int field_index,
179  Handle<Map> transition,
180  StrictModeFlag strict_mode);
181 
183  KeyedIC::StubKind stub_kind,
184  StrictModeFlag strict_mode);
185 
186  // ---
187 
189  Code::Kind,
190  Code::ExtraICState extra_state,
192  Handle<Object> object,
193  Handle<JSObject> holder,
194  int index);
195 
197  Code::Kind,
198  Code::ExtraICState extra_state,
200  Handle<Object> object,
201  Handle<JSObject> holder,
202  Handle<JSFunction> function);
203 
205  Code::Kind,
206  Code::ExtraICState extra_state,
208  Handle<Object> object,
209  Handle<JSObject> holder);
210 
212  Code::Kind,
213  Code::ExtraICState extra_state,
215  Handle<JSObject> receiver,
216  Handle<GlobalObject> holder,
218  Handle<JSFunction> function);
219 
220  // ---
221 
222  Handle<Code> ComputeCallInitialize(int argc, RelocInfo::Mode mode);
223 
225 
227  Code::Kind kind,
228  Code::ExtraICState extra_state);
229 
231  Code::Kind kind,
232  Code::ExtraICState state);
233 
235 
237  Code::Kind kind,
238  Code::ExtraICState state);
239 
240  Handle<Code> ComputeCallMiss(int argc,
241  Code::Kind kind,
242  Code::ExtraICState state);
243 
244  // Finds the Code object stored in the Heap::non_monomorphic_cache().
245  Code* FindCallInitialize(int argc, RelocInfo::Mode mode, Code::Kind kind);
246 
247 #ifdef ENABLE_DEBUGGER_SUPPORT
248  Handle<Code> ComputeCallDebugBreak(int argc, Code::Kind kind);
249 
250  Handle<Code> ComputeCallDebugPrepareStepIn(int argc, Code::Kind kind);
251 #endif
252 
253  // Update cache for entry hash(name, map).
254  Code* Set(String* name, Map* map, Code* code);
255 
256  // Clear the lookup table (@ mark compact collection).
257  void Clear();
258 
259  // Collect all maps that match the name and flags.
260  void CollectMatchingMaps(SmallMapList* types,
261  String* name,
263  Handle<Context> global_context);
264 
265  // Generate code for probing the stub cache table.
266  // Arguments extra, extra2 and extra3 may be used to pass additional scratch
267  // registers. Set to no_reg if not needed.
268  void GenerateProbe(MacroAssembler* masm,
270  Register receiver,
271  Register name,
272  Register scratch,
273  Register extra,
274  Register extra2 = no_reg,
275  Register extra3 = no_reg);
276 
277  enum Table {
280  };
281 
282 
284  return SCTableReference(
285  reinterpret_cast<Address>(&first_entry(table)->key));
286  }
287 
288 
290  return SCTableReference(
291  reinterpret_cast<Address>(&first_entry(table)->map));
292  }
293 
294 
296  return SCTableReference(
297  reinterpret_cast<Address>(&first_entry(table)->value));
298  }
299 
300 
302  switch (table) {
303  case StubCache::kPrimary: return StubCache::primary_;
304  case StubCache::kSecondary: return StubCache::secondary_;
305  }
306  UNREACHABLE();
307  return NULL;
308  }
309 
310  Isolate* isolate() { return isolate_; }
311  Heap* heap() { return isolate()->heap(); }
312  Factory* factory() { return isolate()->factory(); }
313  Zone* zone() const { return zone_; }
314 
315  private:
317 
319  RelocInfo::Mode mode,
320  Code::Kind kind);
321 
322  // The stub cache has a primary and secondary level. The two levels have
323  // different hashing algorithms in order to avoid simultaneous collisions
324  // in both caches. Unlike a probing strategy (quadratic or otherwise) the
325  // update strategy on updates is fairly clear and simple: Any existing entry
326  // in the primary cache is moved to the secondary cache, and secondary cache
327  // entries are overwritten.
328 
329  // Hash algorithm for the primary table. This algorithm is replicated in
330  // assembler for every architecture. Returns an index into the table that
331  // is scaled by 1 << kHeapObjectTagSize.
332  static int PrimaryOffset(String* name, Code::Flags flags, Map* map) {
333  // This works well because the heap object tag size and the hash
334  // shift are equal. Shifting down the length field to get the
335  // hash code would effectively throw away two bits of the hash
336  // code.
338  // Compute the hash of the name (use entire hash field).
339  ASSERT(name->HasHashCode());
340  uint32_t field = name->hash_field();
341  // Using only the low bits in 64-bit mode is unlikely to increase the
342  // risk of collision even if the heap is spread over an area larger than
343  // 4Gb (and not at all if it isn't).
344  uint32_t map_low32bits =
345  static_cast<uint32_t>(reinterpret_cast<uintptr_t>(map));
346  // We always set the in_loop bit to zero when generating the lookup code
347  // so do it here too so the hash codes match.
348  uint32_t iflags =
349  (static_cast<uint32_t>(flags) & ~Code::kFlagsNotUsedInLookup);
350  // Base the offset on a simple combination of name, flags, and map.
351  uint32_t key = (map_low32bits + field) ^ iflags;
352  return key & ((kPrimaryTableSize - 1) << kHeapObjectTagSize);
353  }
354 
355  // Hash algorithm for the secondary table. This algorithm is replicated in
356  // assembler for every architecture. Returns an index into the table that
357  // is scaled by 1 << kHeapObjectTagSize.
358  static int SecondaryOffset(String* name, Code::Flags flags, int seed) {
359  // Use the seed from the primary cache in the secondary cache.
360  uint32_t string_low32bits =
361  static_cast<uint32_t>(reinterpret_cast<uintptr_t>(name));
362  // We always set the in_loop bit to zero when generating the lookup code
363  // so do it here too so the hash codes match.
364  uint32_t iflags =
365  (static_cast<uint32_t>(flags) & ~Code::kFlagsNotUsedInLookup);
366  uint32_t key = (seed - string_low32bits) + iflags;
367  return key & ((kSecondaryTableSize - 1) << kHeapObjectTagSize);
368  }
369 
370  // Compute the entry for a given offset in exactly the same way as
371  // we do in generated code. We generate an hash code that already
372  // ends in String::kHashShift 0s. Then we multiply it so it is a multiple
373  // of sizeof(Entry). This makes it easier to avoid making mistakes
374  // in the hashed offset computations.
375  static Entry* entry(Entry* table, int offset) {
376  const int multiplier = sizeof(*table) >> String::kHashShift;
377  return reinterpret_cast<Entry*>(
378  reinterpret_cast<Address>(table) + offset * multiplier);
379  }
380 
381  static const int kPrimaryTableBits = 11;
382  static const int kPrimaryTableSize = (1 << kPrimaryTableBits);
383  static const int kSecondaryTableBits = 9;
384  static const int kSecondaryTableSize = (1 << kSecondaryTableBits);
385 
386  Entry primary_[kPrimaryTableSize];
387  Entry secondary_[kSecondaryTableSize];
388  Isolate* isolate_;
389  Zone* zone_;
390 
391  friend class Isolate;
392  friend class SCTableReference;
393 
395 };
396 
397 
398 // ------------------------------------------------------------------------
399 
400 
401 // Support functions for IC stubs for callbacks.
402 DECLARE_RUNTIME_FUNCTION(MaybeObject*, LoadCallbackProperty);
403 DECLARE_RUNTIME_FUNCTION(MaybeObject*, StoreCallbackProperty);
404 
405 
406 // Support functions for IC stubs for interceptors.
407 DECLARE_RUNTIME_FUNCTION(MaybeObject*, LoadPropertyWithInterceptorOnly);
408 DECLARE_RUNTIME_FUNCTION(MaybeObject*, LoadPropertyWithInterceptorForLoad);
409 DECLARE_RUNTIME_FUNCTION(MaybeObject*, LoadPropertyWithInterceptorForCall);
410 DECLARE_RUNTIME_FUNCTION(MaybeObject*, StoreInterceptorProperty);
411 DECLARE_RUNTIME_FUNCTION(MaybeObject*, CallInterceptorProperty);
412 DECLARE_RUNTIME_FUNCTION(MaybeObject*, KeyedLoadPropertyWithInterceptor);
413 
414 
415 // The stub compilers compile stubs for the stub cache.
416 class StubCompiler BASE_EMBEDDED {
417  public:
418  explicit StubCompiler(Isolate* isolate)
419  : isolate_(isolate), masm_(isolate, NULL, 256), failure_(NULL) { }
420 
421  // Functions to compile either CallIC or KeyedCallIC. The specific kind
422  // is extracted from the code flags.
423  Handle<Code> CompileCallInitialize(Code::Flags flags);
424  Handle<Code> CompileCallPreMonomorphic(Code::Flags flags);
425  Handle<Code> CompileCallNormal(Code::Flags flags);
426  Handle<Code> CompileCallMegamorphic(Code::Flags flags);
427  Handle<Code> CompileCallArguments(Code::Flags flags);
428  Handle<Code> CompileCallMiss(Code::Flags flags);
429 
430 #ifdef ENABLE_DEBUGGER_SUPPORT
431  Handle<Code> CompileCallDebugBreak(Code::Flags flags);
432  Handle<Code> CompileCallDebugPrepareStepIn(Code::Flags flags);
433 #endif
434 
435  // Static functions for generating parts of stubs.
436  static void GenerateLoadGlobalFunctionPrototype(MacroAssembler* masm,
437  int index,
438  Register prototype);
439 
440  // Generates prototype loading code that uses the objects from the
441  // context we were in when this function was called. If the context
442  // has changed, a jump to miss is performed. This ties the generated
443  // code to a particular context and so must not be used in cases
444  // where the generated code is not allowed to have references to
445  // objects from a context.
446  static void GenerateDirectLoadGlobalFunctionPrototype(MacroAssembler* masm,
447  int index,
448  Register prototype,
449  Label* miss);
450 
451  static void GenerateFastPropertyLoad(MacroAssembler* masm,
452  Register dst,
453  Register src,
454  Handle<JSObject> holder,
455  int index);
456 
457  static void GenerateLoadArrayLength(MacroAssembler* masm,
458  Register receiver,
459  Register scratch,
460  Label* miss_label);
461 
462  static void GenerateLoadStringLength(MacroAssembler* masm,
463  Register receiver,
464  Register scratch1,
465  Register scratch2,
466  Label* miss_label,
467  bool support_wrappers);
468 
469  static void GenerateLoadFunctionPrototype(MacroAssembler* masm,
470  Register receiver,
471  Register scratch1,
472  Register scratch2,
473  Label* miss_label);
474 
475  void GenerateStoreField(MacroAssembler* masm,
476  Handle<JSObject> object,
477  int index,
478  Handle<Map> transition,
480  Register receiver_reg,
481  Register name_reg,
482  Register scratch1,
483  Register scratch2,
484  Label* miss_label);
485 
486  static void GenerateLoadMiss(MacroAssembler* masm,
487  Code::Kind kind);
488 
489  static void GenerateKeyedLoadMissForceGeneric(MacroAssembler* masm);
490 
491  // Generates code that verifies that the property holder has not changed
492  // (checking maps of objects in the prototype chain for fast and global
493  // objects or doing negative lookup for slow objects, ensures that the
494  // property cells for global objects are still empty) and checks that the map
495  // of the holder has not changed. If necessary the function also generates
496  // code for security check in case of global object holders. Helps to make
497  // sure that the current IC is still valid.
498  //
499  // The scratch and holder registers are always clobbered, but the object
500  // register is only clobbered if it the same as the holder register. The
501  // function returns a register containing the holder - either object_reg or
502  // holder_reg.
503  // The function can optionally (when save_at_depth !=
504  // kInvalidProtoDepth) save the object at the given depth by moving
505  // it to [esp + kPointerSize].
507  Register object_reg,
508  Handle<JSObject> holder,
509  Register holder_reg,
510  Register scratch1,
511  Register scratch2,
513  Label* miss) {
514  return CheckPrototypes(object, object_reg, holder, holder_reg, scratch1,
515  scratch2, name, kInvalidProtoDepth, miss);
516  }
517 
518  Register CheckPrototypes(Handle<JSObject> object,
519  Register object_reg,
520  Handle<JSObject> holder,
521  Register holder_reg,
522  Register scratch1,
523  Register scratch2,
525  int save_at_depth,
526  Label* miss);
527 
528 
529  protected:
530  Handle<Code> GetCodeWithFlags(Code::Flags flags, const char* name);
531  Handle<Code> GetCodeWithFlags(Code::Flags flags, Handle<String> name);
532 
533  MacroAssembler* masm() { return &masm_; }
534  void set_failure(Failure* failure) { failure_ = failure; }
535 
536  void GenerateLoadField(Handle<JSObject> object,
537  Handle<JSObject> holder,
538  Register receiver,
539  Register scratch1,
540  Register scratch2,
541  Register scratch3,
542  int index,
544  Label* miss);
545 
546  void GenerateLoadCallback(Handle<JSObject> object,
547  Handle<JSObject> holder,
548  Register receiver,
549  Register name_reg,
550  Register scratch1,
551  Register scratch2,
552  Register scratch3,
553  Handle<AccessorInfo> callback,
555  Label* miss);
556 
557  void GenerateLoadConstant(Handle<JSObject> object,
558  Handle<JSObject> holder,
559  Register receiver,
560  Register scratch1,
561  Register scratch2,
562  Register scratch3,
563  Handle<JSFunction> value,
565  Label* miss);
566 
567  void GenerateLoadInterceptor(Handle<JSObject> object,
568  Handle<JSObject> holder,
569  LookupResult* lookup,
570  Register receiver,
571  Register name_reg,
572  Register scratch1,
573  Register scratch2,
574  Register scratch3,
576  Label* miss);
577 
578  static void LookupPostInterceptor(Handle<JSObject> holder,
580  LookupResult* lookup);
581 
582  Isolate* isolate() { return isolate_; }
583  Heap* heap() { return isolate()->heap(); }
584  Factory* factory() { return isolate()->factory(); }
585 
586  private:
587  Isolate* isolate_;
588  MacroAssembler masm_;
589  Failure* failure_;
590 };
591 
592 
593 class LoadStubCompiler: public StubCompiler {
594  public:
595  explicit LoadStubCompiler(Isolate* isolate) : StubCompiler(isolate) { }
596 
598  Handle<JSObject> object,
599  Handle<JSObject> last);
600 
602  Handle<JSObject> holder,
603  int index,
605 
607  Handle<JSObject> object,
608  Handle<JSObject> holder,
609  Handle<AccessorInfo> callback);
610 
612  Handle<JSObject> receiver,
613  Handle<JSObject> holder,
614  Handle<JSFunction> getter);
615 
617  Handle<JSObject> holder,
618  Handle<JSFunction> value,
620 
622  Handle<JSObject> holder,
624 
626  Handle<GlobalObject> holder,
629  bool is_dont_delete);
630 
631  private:
633 };
634 
635 
636 class KeyedLoadStubCompiler: public StubCompiler {
637  public:
638  explicit KeyedLoadStubCompiler(Isolate* isolate) : StubCompiler(isolate) { }
639 
641  Handle<JSObject> object,
642  Handle<JSObject> holder,
643  int index);
644 
646  Handle<JSObject> object,
647  Handle<JSObject> holder,
648  Handle<AccessorInfo> callback);
649 
651  Handle<JSObject> object,
652  Handle<JSObject> holder,
653  Handle<JSFunction> value);
654 
656  Handle<JSObject> holder,
658 
660 
662 
664 
666 
668  CodeHandleList* handler_ics);
669 
670  static void GenerateLoadExternalArray(MacroAssembler* masm,
671  ElementsKind elements_kind);
672 
673  static void GenerateLoadFastElement(MacroAssembler* masm);
674 
676 
678 
679  private:
682  InlineCacheState state = MONOMORPHIC);
683 };
684 
685 
686 class StoreStubCompiler: public StubCompiler {
687  public:
688  StoreStubCompiler(Isolate* isolate, StrictModeFlag strict_mode)
689  : StubCompiler(isolate), strict_mode_(strict_mode) { }
690 
691 
693  int index,
694  Handle<Map> transition,
696 
698  Handle<AccessorInfo> callback,
700 
702  Handle<JSFunction> setter,
704 
707 
711 
712  private:
714 
715  StrictModeFlag strict_mode_;
716 };
717 
718 
719 class KeyedStoreStubCompiler: public StubCompiler {
720  public:
722  StrictModeFlag strict_mode,
723  KeyedAccessGrowMode grow_mode)
724  : StubCompiler(isolate),
725  strict_mode_(strict_mode),
726  grow_mode_(grow_mode) { }
727 
729  int index,
730  Handle<Map> transition,
732 
734 
736  CodeHandleList* handler_stubs,
737  MapHandleList* transitioned_maps);
738 
739  static void GenerateStoreFastElement(MacroAssembler* masm,
740  bool is_js_array,
741  ElementsKind element_kind,
742  KeyedAccessGrowMode grow_mode);
743 
745  bool is_js_array,
746  KeyedAccessGrowMode grow_mode);
747 
748  static void GenerateStoreExternalArray(MacroAssembler* masm,
749  ElementsKind elements_kind);
750 
752 
753  private:
756  InlineCacheState state = MONOMORPHIC);
757 
758  StrictModeFlag strict_mode_;
759  KeyedAccessGrowMode grow_mode_;
760 };
761 
762 
763 // Subset of FUNCTIONS_WITH_ID_LIST with custom constant/global call
764 // IC stubs.
765 #define CUSTOM_CALL_IC_GENERATORS(V) \
766  V(ArrayPush) \
767  V(ArrayPop) \
768  V(StringCharCodeAt) \
769  V(StringCharAt) \
770  V(StringFromCharCode) \
771  V(MathFloor) \
772  V(MathAbs)
773 
774 
775 class CallOptimization;
776 
777 class CallStubCompiler: public StubCompiler {
778  public:
779  CallStubCompiler(Isolate* isolate,
780  int argc,
781  Code::Kind kind,
782  Code::ExtraICState extra_state,
783  InlineCacheHolderFlag cache_holder);
784 
786  Handle<JSObject> holder,
787  int index,
789 
791  Handle<JSObject> holder,
792  Handle<JSFunction> function,
793  Handle<String> name,
794  CheckType check);
795 
797  Handle<JSObject> holder,
798  Handle<String> name);
799 
801  Handle<GlobalObject> holder,
803  Handle<JSFunction> function,
804  Handle<String> name);
805 
806  static bool HasCustomCallGenerator(Handle<JSFunction> function);
807 
808  private:
809  // Compiles a custom call constant/global IC. For constant calls cell is
810  // NULL. Returns an empty handle if there is no custom call code for the
811  // given function.
812  Handle<Code> CompileCustomCall(Handle<Object> object,
813  Handle<JSObject> holder,
815  Handle<JSFunction> function,
816  Handle<String> name);
817 
818 #define DECLARE_CALL_GENERATOR(name) \
819  Handle<Code> Compile##name##Call(Handle<Object> object, \
820  Handle<JSObject> holder, \
821  Handle<JSGlobalPropertyCell> cell, \
822  Handle<JSFunction> function, \
823  Handle<String> fname);
825 #undef DECLARE_CALL_GENERATOR
826 
827  Handle<Code> CompileFastApiCall(const CallOptimization& optimization,
828  Handle<Object> object,
829  Handle<JSObject> holder,
830  Handle<JSGlobalPropertyCell> cell,
831  Handle<JSFunction> function,
832  Handle<String> name);
833 
834  Handle<Code> GetCode(PropertyType type, Handle<String> name);
835  Handle<Code> GetCode(Handle<JSFunction> function);
836 
837  const ParameterCount& arguments() { return arguments_; }
838 
839  void GenerateNameCheck(Handle<String> name, Label* miss);
840 
841  void GenerateGlobalReceiverCheck(Handle<JSObject> object,
842  Handle<JSObject> holder,
843  Handle<String> name,
844  Label* miss);
845 
846  // Generates code to load the function from the cell checking that
847  // it still contains the same function.
848  void GenerateLoadFunctionFromCell(Handle<JSGlobalPropertyCell> cell,
849  Handle<JSFunction> function,
850  Label* miss);
851 
852  // Generates a jump to CallIC miss stub.
853  void GenerateMissBranch();
854 
855  const ParameterCount arguments_;
856  const Code::Kind kind_;
857  const Code::ExtraICState extra_state_;
858  const InlineCacheHolderFlag cache_holder_;
859 };
860 
861 
862 class ConstructStubCompiler: public StubCompiler {
863  public:
864  explicit ConstructStubCompiler(Isolate* isolate) : StubCompiler(isolate) { }
865 
867 
868  private:
869  Handle<Code> GetCode();
870 };
871 
872 
873 // Holds information about possible function call optimizations.
874 class CallOptimization BASE_EMBEDDED {
875  public:
876  explicit CallOptimization(LookupResult* lookup);
877 
878  explicit CallOptimization(Handle<JSFunction> function);
879 
880  bool is_constant_call() const {
881  return !constant_function_.is_null();
882  }
883 
885  ASSERT(is_constant_call());
886  return constant_function_;
887  }
888 
889  bool is_simple_api_call() const {
890  return is_simple_api_call_;
891  }
892 
894  ASSERT(is_simple_api_call());
895  return expected_receiver_type_;
896  }
897 
899  ASSERT(is_simple_api_call());
900  return api_call_info_;
901  }
902 
903  // Returns the depth of the object having the expected type in the
904  // prototype chain between the two arguments.
905  int GetPrototypeDepthOfExpectedType(Handle<JSObject> object,
906  Handle<JSObject> holder) const;
907 
908  private:
909  void Initialize(Handle<JSFunction> function);
910 
911  // Determines whether the given function can be called using the
912  // fast api call builtin.
913  void AnalyzePossibleApiFunction(Handle<JSFunction> function);
914 
915  Handle<JSFunction> constant_function_;
916  bool is_simple_api_call_;
917  Handle<FunctionTemplateInfo> expected_receiver_type_;
918  Handle<CallHandlerInfo> api_call_info_;
919 };
920 
921 
922 } } // namespace v8::internal
923 
924 #endif // V8_STUB_CACHE_H_
byte * Address
Definition: globals.h:172
Handle< Code > CompileLoadFunctionPrototype(Handle< String > name)
Handle< Code > CompileLoadCallback(Handle< String > name, Handle< JSObject > object, Handle< JSObject > holder, Handle< AccessorInfo > callback)
Handle< Code > CompileStoreField(Handle< JSObject > object, int index, Handle< Map > transition, Handle< String > name)
Handle< Code > ComputeLoadNormal()
Definition: stub-cache.cc:232
bool is_simple_api_call() const
Definition: stub-cache.h:889
Handle< Code > ComputeCallGlobal(int argc, Code::Kind, Code::ExtraICState extra_state, Handle< String > name, Handle< JSObject > receiver, Handle< GlobalObject > holder, Handle< JSGlobalPropertyCell > cell, Handle< JSFunction > function)
Definition: stub-cache.cc:693
Handle< Code > CompileLoadNonexistent(Handle< String > name, Handle< JSObject > object, Handle< JSObject > last)
Handle< Code > ComputeKeyedLoadFunctionPrototype(Handle< String > name, Handle< JSFunction > receiver)
Definition: stub-cache.cc:368
Handle< Code > ComputeStoreField(Handle< String > name, Handle< JSObject > receiver, int field_index, Handle< Map > transition, StrictModeFlag strict_mode)
Definition: stub-cache.cc:385
Handle< Code > CompileStoreElement(Handle< Map > receiver_map)
void GenerateProbe(MacroAssembler *masm, Code::Flags flags, Register receiver, Register name, Register scratch, Register extra, Register extra2=no_reg, Register extra3=no_reg)
Code * Set(String *name, Map *map, Code *code)
Definition: stub-cache.cc:59
static void GenerateStoreExternalArray(MacroAssembler *masm, ElementsKind elements_kind)
Handle< Code > ComputeCallMiss(int argc, Code::Kind kind, Code::ExtraICState state)
Definition: stub-cache.cc:854
void set_failure(Failure *failure)
Definition: stub-cache.h:534
value format" "after each garbage collection") DEFINE_bool(print_cumulative_gc_stat, false, "print cumulative GC statistics in name=value format on exit") DEFINE_bool(trace_gc_verbose, false, "print more details following each garbage collection") DEFINE_bool(trace_fragmentation, false, "report fragmentation for old pointer and data pages") DEFINE_bool(collect_maps, true, "garbage collect maps from which no objects can be reached") DEFINE_bool(flush_code, true, "flush code that we expect not to use again before full gc") DEFINE_bool(incremental_marking, true, "use incremental marking") DEFINE_bool(incremental_marking_steps, true, "do incremental marking steps") DEFINE_bool(trace_incremental_marking, false, "trace progress of the incremental marking") DEFINE_bool(use_idle_notification, true, "Use idle notification to reduce memory footprint.") DEFINE_bool(send_idle_notification, false, "Send idle notifcation between stress runs.") DEFINE_bool(use_ic, true, "use inline caching") DEFINE_bool(native_code_counters, false, "generate extra code for manipulating stats counters") DEFINE_bool(always_compact, false, "Perform compaction on every full GC") DEFINE_bool(lazy_sweeping, true, "Use lazy sweeping for old pointer and data spaces") DEFINE_bool(never_compact, false, "Never perform compaction on full GC-testing only") DEFINE_bool(compact_code_space, true, "Compact code space on full non-incremental collections") DEFINE_bool(cleanup_code_caches_at_gc, true, "Flush inline caches prior to mark compact collection and" "flush code caches in maps during mark compact cycle.") DEFINE_int(random_seed, 0, "Default seed for initializing random generator" "(0, the default, means to use system random).") DEFINE_bool(use_verbose_printer, true, "allows verbose printing") DEFINE_bool(allow_natives_syntax, false, "allow natives syntax") DEFINE_bool(trace_sim, false, "Trace simulator execution") DEFINE_bool(check_icache, false, "Check icache flushes in ARM and MIPS simulator") DEFINE_int(stop_sim_at, 0, "Simulator stop after x number of instructions") DEFINE_int(sim_stack_alignment, 8, "Stack alingment in bytes in simulator(4 or 8, 8 is default)") DEFINE_bool(trace_exception, false, "print stack trace when throwing exceptions") DEFINE_bool(preallocate_message_memory, false, "preallocate some memory to build stack traces.") DEFINE_bool(randomize_hashes, true, "randomize hashes to avoid predictable hash collisions" "(with snapshots this option cannot override the baked-in seed)") DEFINE_int(hash_seed, 0, "Fixed seed to use to hash property keys(0 means random)" "(with snapshots this option cannot override the baked-in seed)") DEFINE_bool(preemption, false, "activate a 100ms timer that switches between V8 threads") DEFINE_bool(regexp_optimization, true, "generate optimized regexp code") DEFINE_bool(testing_bool_flag, true, "testing_bool_flag") DEFINE_int(testing_int_flag, 13, "testing_int_flag") DEFINE_float(testing_float_flag, 2.5, "float-flag") DEFINE_string(testing_string_flag, "Hello, world!", "string-flag") DEFINE_int(testing_prng_seed, 42, "Seed used for threading test randomness") DEFINE_string(testing_serialization_file, "/tmp/serdes", "file in which to serialize heap") DEFINE_bool(help, false, "Print usage message, including flags, on console") DEFINE_bool(dump_counters, false, "Dump counters on exit") DEFINE_string(map_counters, "", "Map counters to a file") DEFINE_args(js_arguments, JSARGUMENTS_INIT, "Pass all remaining arguments to the script.Alias for\"--\".") DEFINE_bool(debug_compile_events, true,"Enable debugger compile events") DEFINE_bool(debug_script_collected_events, true,"Enable debugger script collected events") DEFINE_bool(gdbjit, false,"enable GDBJIT interface (disables compacting GC)") DEFINE_bool(gdbjit_full, false,"enable GDBJIT interface for all code objects") DEFINE_bool(gdbjit_dump, false,"dump elf objects with debug info to disk") DEFINE_string(gdbjit_dump_filter,"","dump only objects containing this substring") DEFINE_bool(force_marking_deque_overflows, false,"force overflows of marking deque by reducing it's size ""to 64 words") DEFINE_bool(stress_compaction, false,"stress the GC compactor to flush out bugs (implies ""--force_marking_deque_overflows)")#define FLAG DEFINE_bool(enable_slow_asserts, false,"enable asserts that are slow to execute") DEFINE_bool(trace_codegen, false,"print name of functions for which code is generated") DEFINE_bool(print_source, false,"pretty print source code") DEFINE_bool(print_builtin_source, false,"pretty print source code for builtins") DEFINE_bool(print_ast, false,"print source AST") DEFINE_bool(print_builtin_ast, false,"print source AST for builtins") DEFINE_string(stop_at,"","function name where to insert a breakpoint") DEFINE_bool(print_builtin_scopes, false,"print scopes for builtins") DEFINE_bool(print_scopes, false,"print scopes") DEFINE_bool(trace_contexts, false,"trace contexts operations") DEFINE_bool(gc_greedy, false,"perform GC prior to some allocations") DEFINE_bool(gc_verbose, false,"print stuff during garbage collection") DEFINE_bool(heap_stats, false,"report heap statistics before and after GC") DEFINE_bool(code_stats, false,"report code statistics after GC") DEFINE_bool(verify_heap, false,"verify heap pointers before and after GC") DEFINE_bool(print_handles, false,"report handles after GC") DEFINE_bool(print_global_handles, false,"report global handles after GC") DEFINE_bool(trace_ic, false,"trace inline cache state transitions") DEFINE_bool(print_interfaces, false,"print interfaces") DEFINE_bool(print_interface_details, false,"print interface inference details") DEFINE_int(print_interface_depth, 5,"depth for printing interfaces") DEFINE_bool(trace_normalization, false,"prints when objects are turned into dictionaries.") DEFINE_bool(trace_lazy, false,"trace lazy compilation") DEFINE_bool(collect_heap_spill_statistics, false,"report heap spill statistics along with heap_stats ""(requires heap_stats)") DEFINE_bool(trace_isolates, false,"trace isolate state changes") DEFINE_bool(log_state_changes, false,"Log state changes.") DEFINE_bool(regexp_possessive_quantifier, false,"enable possessive quantifier syntax for testing") DEFINE_bool(trace_regexp_bytecodes, false,"trace regexp bytecode execution") DEFINE_bool(trace_regexp_assembler, false,"trace regexp macro assembler calls.")#define FLAG DEFINE_bool(log, false,"Minimal logging (no API, code, GC, suspect, or handles samples).") DEFINE_bool(log_all, false,"Log all events to the log file.") DEFINE_bool(log_runtime, false,"Activate runtime system %Log call.") DEFINE_bool(log_api, false,"Log API events to the log file.") DEFINE_bool(log_code, false,"Log code events to the log file without profiling.") DEFINE_bool(log_gc, false,"Log heap samples on garbage collection for the hp2ps tool.") DEFINE_bool(log_handles, false,"Log global handle events.") DEFINE_bool(log_snapshot_positions, false,"log positions of (de)serialized objects in the snapshot.") DEFINE_bool(log_suspect, false,"Log suspect operations.") DEFINE_bool(prof, false,"Log statistical profiling information (implies --log-code).") DEFINE_bool(prof_auto, true,"Used with --prof, starts profiling automatically") DEFINE_bool(prof_lazy, false,"Used with --prof, only does sampling and logging"" when profiler is active (implies --noprof_auto).") DEFINE_bool(prof_browser_mode, true,"Used with --prof, turns on browser-compatible mode for profiling.") DEFINE_bool(log_regexp, false,"Log regular expression execution.") DEFINE_bool(sliding_state_window, false,"Update sliding state window counters.") DEFINE_string(logfile,"v8.log","Specify the name of the log file.") DEFINE_bool(ll_prof, false,"Enable low-level linux profiler.")#define FLAG DEFINE_bool(trace_elements_transitions, false,"trace elements transitions") DEFINE_bool(print_code_stubs, false,"print code stubs") DEFINE_bool(test_secondary_stub_cache, false,"test secondary stub cache by disabling the primary one") DEFINE_bool(test_primary_stub_cache, false,"test primary stub cache by disabling the secondary one") DEFINE_bool(print_code, false,"print generated code") DEFINE_bool(print_opt_code, false,"print optimized code") DEFINE_bool(print_unopt_code, false,"print unoptimized code before ""printing optimized code based on it") DEFINE_bool(print_code_verbose, false,"print more information for code") DEFINE_bool(print_builtin_code, false,"print generated code for builtins")#43"/Users/thlorenz/dev/dx/v8-perf/build/v8/src/flags.cc"2#define FLAG_MODE_DEFINE_DEFAULTS#1"/Users/thlorenz/dev/dx/v8-perf/build/v8/src/flag-definitions.h"1#define FLAG_FULL(ftype, ctype, nam, def, cmt)#define FLAG_READONLY(ftype, ctype, nam, def, cmt)#define DEFINE_implication(whenflag, thenflag)#define DEFINE_bool(nam, def, cmt)#define DEFINE_int(nam, def, cmt)#define DEFINE_float(nam, def, cmt)#define DEFINE_string(nam, def, cmt)#define DEFINE_args(nam, def, cmt)#define FLAG DEFINE_bool(use_strict, false,"enforce strict mode") DEFINE_bool(es5_readonly, false,"activate correct semantics for inheriting readonliness") DEFINE_bool(es52_globals, false,"activate new semantics for global var declarations") DEFINE_bool(harmony_typeof, false,"enable harmony semantics for typeof") DEFINE_bool(harmony_scoping, false,"enable harmony block scoping") DEFINE_bool(harmony_modules, false,"enable harmony modules (implies block scoping)") DEFINE_bool(harmony_proxies, false,"enable harmony proxies") DEFINE_bool(harmony_collections, false,"enable harmony collections (sets, maps, and weak maps)") DEFINE_bool(harmony, false,"enable all harmony features (except typeof)") DEFINE_implication(harmony, harmony_scoping) DEFINE_implication(harmony, harmony_modules) DEFINE_implication(harmony, harmony_proxies) DEFINE_implication(harmony, harmony_collections) DEFINE_implication(harmony_modules, harmony_scoping) DEFINE_bool(packed_arrays, false,"optimizes arrays that have no holes") DEFINE_bool(smi_only_arrays, true,"tracks arrays with only smi values") DEFINE_bool(clever_optimizations, true,"Optimize object size, Array shift, DOM strings and string +") DEFINE_bool(unbox_double_arrays, true,"automatically unbox arrays of doubles") DEFINE_bool(string_slices, true,"use string slices") DEFINE_bool(crankshaft, true,"use crankshaft") DEFINE_string(hydrogen_filter,"","optimization filter") DEFINE_bool(use_range, true,"use hydrogen range analysis") DEFINE_bool(eliminate_dead_phis, true,"eliminate dead phis") DEFINE_bool(use_gvn, true,"use hydrogen global value numbering") DEFINE_bool(use_canonicalizing, true,"use hydrogen instruction canonicalizing") DEFINE_bool(use_inlining, true,"use function inlining") DEFINE_int(max_inlined_source_size, 600,"maximum source size in bytes considered for a single inlining") DEFINE_int(max_inlined_nodes, 196,"maximum number of AST nodes considered for a single inlining") DEFINE_int(max_inlined_nodes_cumulative, 196,"maximum cumulative number of AST nodes considered for inlining") DEFINE_bool(loop_invariant_code_motion, true,"loop invariant code motion") DEFINE_bool(collect_megamorphic_maps_from_stub_cache, true,"crankshaft harvests type feedback from stub cache") DEFINE_bool(hydrogen_stats, false,"print statistics for hydrogen") DEFINE_bool(trace_hydrogen, false,"trace generated hydrogen to file") DEFINE_string(trace_phase,"Z","trace generated IR for specified phases") DEFINE_bool(trace_inlining, false,"trace inlining decisions") DEFINE_bool(trace_alloc, false,"trace register allocator") DEFINE_bool(trace_all_uses, false,"trace all use positions") DEFINE_bool(trace_range, false,"trace range analysis") DEFINE_bool(trace_gvn, false,"trace global value numbering") DEFINE_bool(trace_representation, false,"trace representation types") DEFINE_bool(stress_pointer_maps, false,"pointer map for every instruction") DEFINE_bool(stress_environments, false,"environment for every instruction") DEFINE_int(deopt_every_n_times, 0,"deoptimize every n times a deopt point is passed") DEFINE_bool(trap_on_deopt, false,"put a break point before deoptimizing") DEFINE_bool(deoptimize_uncommon_cases, true,"deoptimize uncommon cases") DEFINE_bool(polymorphic_inlining, true,"polymorphic inlining") DEFINE_bool(use_osr, true,"use on-stack replacement") DEFINE_bool(array_bounds_checks_elimination, false,"perform array bounds checks elimination") DEFINE_bool(array_index_dehoisting, false,"perform array index dehoisting") DEFINE_bool(trace_osr, false,"trace on-stack replacement") DEFINE_int(stress_runs, 0,"number of stress runs") DEFINE_bool(optimize_closures, true,"optimize closures") DEFINE_bool(inline_construct, true,"inline constructor calls") DEFINE_bool(inline_arguments, true,"inline functions with arguments object") DEFINE_int(loop_weight, 1,"loop weight for representation inference") DEFINE_bool(optimize_for_in, true,"optimize functions containing for-in loops") DEFINE_bool(experimental_profiler, true,"enable all profiler experiments") DEFINE_bool(watch_ic_patching, false,"profiler considers IC stability") DEFINE_int(frame_count, 1,"number of stack frames inspected by the profiler") DEFINE_bool(self_optimization, false,"primitive functions trigger their own optimization") DEFINE_bool(direct_self_opt, false,"call recompile stub directly when self-optimizing") DEFINE_bool(retry_self_opt, false,"re-try self-optimization if it failed") DEFINE_bool(count_based_interrupts, false,"trigger profiler ticks based on counting instead of timing") DEFINE_bool(interrupt_at_exit, false,"insert an interrupt check at function exit") DEFINE_bool(weighted_back_edges, false,"weight back edges by jump distance for interrupt triggering") DEFINE_int(interrupt_budget, 5900,"execution budget before interrupt is triggered") DEFINE_int(type_info_threshold, 15,"percentage of ICs that must have type info to allow optimization") DEFINE_int(self_opt_count, 130,"call count before self-optimization") DEFINE_implication(experimental_profiler, watch_ic_patching) DEFINE_implication(experimental_profiler, self_optimization) DEFINE_implication(experimental_profiler, retry_self_opt) DEFINE_implication(experimental_profiler, count_based_interrupts) DEFINE_implication(experimental_profiler, interrupt_at_exit) DEFINE_implication(experimental_profiler, weighted_back_edges) DEFINE_bool(trace_opt_verbose, false,"extra verbose compilation tracing") DEFINE_implication(trace_opt_verbose, trace_opt) DEFINE_bool(debug_code, false,"generate extra code (assertions) for debugging") DEFINE_bool(code_comments, false,"emit comments in code disassembly") DEFINE_bool(enable_sse2, true,"enable use of SSE2 instructions if available") DEFINE_bool(enable_sse3, true,"enable use of SSE3 instructions if available") DEFINE_bool(enable_sse4_1, true,"enable use of SSE4.1 instructions if available") DEFINE_bool(enable_cmov, true,"enable use of CMOV instruction if available") DEFINE_bool(enable_rdtsc, true,"enable use of RDTSC instruction if available") DEFINE_bool(enable_sahf, true,"enable use of SAHF instruction if available (X64 only)") DEFINE_bool(enable_vfp3, true,"enable use of VFP3 instructions if available - this implies ""enabling ARMv7 instructions (ARM only)") DEFINE_bool(enable_armv7, true,"enable use of ARMv7 instructions if available (ARM only)") DEFINE_bool(enable_fpu, true,"enable use of MIPS FPU instructions if available (MIPS only)") DEFINE_string(expose_natives_as, NULL,"expose natives in global object") DEFINE_string(expose_debug_as, NULL,"expose debug in global object") DEFINE_bool(expose_gc, false,"expose gc extension") DEFINE_bool(expose_externalize_string, false,"expose externalize string extension") DEFINE_int(stack_trace_limit, 10,"number of stack frames to capture") DEFINE_bool(builtins_in_stack_traces, false,"show built-in functions in stack traces") DEFINE_bool(disable_native_files, false,"disable builtin natives files") DEFINE_bool(inline_new, true,"use fast inline allocation") DEFINE_bool(stack_trace_on_abort, true,"print a stack trace if an assertion failure occurs") DEFINE_bool(trace, false,"trace function calls") DEFINE_bool(mask_constants_with_cookie, true,"use random jit cookie to mask large constants") DEFINE_bool(lazy, true,"use lazy compilation") DEFINE_bool(trace_opt, false,"trace lazy optimization") DEFINE_bool(trace_opt_stats, false,"trace lazy optimization statistics") DEFINE_bool(opt, true,"use adaptive optimizations") DEFINE_bool(always_opt, false,"always try to optimize functions") DEFINE_bool(prepare_always_opt, false,"prepare for turning on always opt") DEFINE_bool(trace_deopt, false,"trace deoptimization") DEFINE_int(min_preparse_length, 1024,"minimum length for automatic enable preparsing") DEFINE_bool(always_full_compiler, false,"try to use the dedicated run-once backend for all code") DEFINE_bool(trace_bailout, false,"print reasons for falling back to using the classic V8 backend") DEFINE_bool(compilation_cache, true,"enable compilation cache") DEFINE_bool(cache_prototype_transitions, true,"cache prototype transitions") DEFINE_bool(trace_debug_json, false,"trace debugging JSON request/response") DEFINE_bool(debugger_auto_break, true,"automatically set the debug break flag when debugger commands are ""in the queue") DEFINE_bool(enable_liveedit, true,"enable liveedit experimental feature") DEFINE_bool(break_on_abort, true,"always cause a debug break before aborting") DEFINE_int(stack_size, kPointerSize *123,"default size of stack region v8 is allowed to use (in kBytes)") DEFINE_int(max_stack_trace_source_length, 300,"maximum length of function source code printed in a stack trace.") DEFINE_bool(always_inline_smi_code, false,"always inline smi code in non-opt code") DEFINE_int(max_new_space_size, 0,"max size of the new generation (in kBytes)") DEFINE_int(max_old_space_size, 0,"max size of the old generation (in Mbytes)") DEFINE_int(max_executable_size, 0,"max size of executable memory (in Mbytes)") DEFINE_bool(gc_global, false,"always perform global GCs") DEFINE_int(gc_interval,-1,"garbage collect after <n> allocations") DEFINE_bool(trace_gc, false,"print one trace line following each garbage collection") DEFINE_bool(trace_gc_nvp, false,"print one detailed trace line in name=value format ""after each garbage collection") DEFINE_bool(print_cumulative_gc_stat, false,"print cumulative GC statistics in name=value format on exit") DEFINE_bool(trace_gc_verbose, false,"print more details following each garbage collection") DEFINE_bool(trace_fragmentation, false,"report fragmentation for old pointer and data pages") DEFINE_bool(collect_maps, true,"garbage collect maps from which no objects can be reached") DEFINE_bool(flush_code, true,"flush code that we expect not to use again before full gc") DEFINE_bool(incremental_marking, true,"use incremental marking") DEFINE_bool(incremental_marking_steps, true,"do incremental marking steps") DEFINE_bool(trace_incremental_marking, false,"trace progress of the incremental marking") DEFINE_bool(use_idle_notification, true,"Use idle notification to reduce memory footprint.") DEFINE_bool(send_idle_notification, false,"Send idle notifcation between stress runs.") DEFINE_bool(use_ic, true,"use inline caching") DEFINE_bool(native_code_counters, false,"generate extra code for manipulating stats counters") DEFINE_bool(always_compact, false,"Perform compaction on every full GC") DEFINE_bool(lazy_sweeping, true,"Use lazy sweeping for old pointer and data spaces") DEFINE_bool(never_compact, false,"Never perform compaction on full GC - testing only") DEFINE_bool(compact_code_space, true,"Compact code space on full non-incremental collections") DEFINE_bool(cleanup_code_caches_at_gc, true,"Flush inline caches prior to mark compact collection and ""flush code caches in maps during mark compact cycle.") DEFINE_int(random_seed, 0,"Default seed for initializing random generator ""(0, the default, means to use system random).") DEFINE_bool(use_verbose_printer, true,"allows verbose printing") DEFINE_bool(allow_natives_syntax, false,"allow natives syntax") DEFINE_bool(trace_sim, false,"Trace simulator execution") DEFINE_bool(check_icache, false,"Check icache flushes in ARM and MIPS simulator") DEFINE_int(stop_sim_at, 0,"Simulator stop after x number of instructions") DEFINE_int(sim_stack_alignment, 8,"Stack alingment in bytes in simulator (4 or 8, 8 is default)") DEFINE_bool(trace_exception, false,"print stack trace when throwing exceptions") DEFINE_bool(preallocate_message_memory, false,"preallocate some memory to build stack traces.") DEFINE_bool(randomize_hashes, true,"randomize hashes to avoid predictable hash collisions ""(with snapshots this option cannot override the baked-in seed)") DEFINE_int(hash_seed, 0,"Fixed seed to use to hash property keys (0 means random)""(with snapshots this option cannot override the baked-in seed)") DEFINE_bool(preemption, false,"activate a 100ms timer that switches between V8 threads") DEFINE_bool(regexp_optimization, true,"generate optimized regexp code") DEFINE_bool(testing_bool_flag, true,"testing_bool_flag") DEFINE_int(testing_int_flag, 13,"testing_int_flag") DEFINE_float(testing_float_flag, 2.5,"float-flag") DEFINE_string(testing_string_flag,"Hello, world!","string-flag") DEFINE_int(testing_prng_seed, 42,"Seed used for threading test randomness") DEFINE_string(testing_serialization_file,"/tmp/serdes","file in which to serialize heap") DEFINE_bool(help, false,"Print usage message, including flags, on console") DEFINE_bool(dump_counters, false,"Dump counters on exit") DEFINE_string(map_counters,"","Map counters to a file") DEFINE_args(js_arguments, JSARGUMENTS_INIT,"Pass all remaining arguments to the script. Alias for \"--\".") DEFINE_bool(debug_compile_events, true,"Enable debugger compile events") DEFINE_bool(debug_script_collected_events, true,"Enable debugger script collected events") DEFINE_bool(gdbjit, false,"enable GDBJIT interface (disables compacting GC)") DEFINE_bool(gdbjit_full, false,"enable GDBJIT interface for all code objects") DEFINE_bool(gdbjit_dump, false,"dump elf objects with debug info to disk") DEFINE_string(gdbjit_dump_filter,"","dump only objects containing this substring") DEFINE_bool(force_marking_deque_overflows, false,"force overflows of marking deque by reducing it's size ""to 64 words") DEFINE_bool(stress_compaction, false,"stress the GC compactor to flush out bugs (implies ""--force_marking_deque_overflows)")#define FLAG DEFINE_bool(enable_slow_asserts, false,"enable asserts that are slow to execute") DEFINE_bool(trace_codegen, false,"print name of functions for which code is generated") DEFINE_bool(print_source, false,"pretty print source code") DEFINE_bool(print_builtin_source, false,"pretty print source code for builtins") DEFINE_bool(print_ast, false,"print source AST") DEFINE_bool(print_builtin_ast, false,"print source AST for builtins") DEFINE_string(stop_at,"","function name where to insert a breakpoint") DEFINE_bool(print_builtin_scopes, false,"print scopes for builtins") DEFINE_bool(print_scopes, false,"print scopes") DEFINE_bool(trace_contexts, false,"trace contexts operations") DEFINE_bool(gc_greedy, false,"perform GC prior to some allocations") DEFINE_bool(gc_verbose, false,"print stuff during garbage collection") DEFINE_bool(heap_stats, false,"report heap statistics before and after GC") DEFINE_bool(code_stats, false,"report code statistics after GC") DEFINE_bool(verify_heap, false,"verify heap pointers before and after GC") DEFINE_bool(print_handles, false,"report handles after GC") DEFINE_bool(print_global_handles, false,"report global handles after GC") DEFINE_bool(trace_ic, false,"trace inline cache state transitions") DEFINE_bool(print_interfaces, false,"print interfaces") DEFINE_bool(print_interface_details, false,"print interface inference details") DEFINE_int(print_interface_depth, 5,"depth for printing interfaces") DEFINE_bool(trace_normalization, false,"prints when objects are turned into dictionaries.") DEFINE_bool(trace_lazy, false,"trace lazy compilation") DEFINE_bool(collect_heap_spill_statistics, false,"report heap spill statistics along with heap_stats ""(requires heap_stats)") DEFINE_bool(trace_isolates, false,"trace isolate state changes") DEFINE_bool(log_state_changes, false,"Log state changes.") DEFINE_bool(regexp_possessive_quantifier, false,"enable possessive quantifier syntax for testing") DEFINE_bool(trace_regexp_bytecodes, false,"trace regexp bytecode execution") DEFINE_bool(trace_regexp_assembler, false,"trace regexp macro assembler calls.")#define FLAG DEFINE_bool(log, false,"Minimal logging (no API, code, GC, suspect, or handles samples).") DEFINE_bool(log_all, false,"Log all events to the log file.") DEFINE_bool(log_runtime, false,"Activate runtime system %Log call.") DEFINE_bool(log_api, false,"Log API events to the log file.") DEFINE_bool(log_code, false,"Log code events to the log file without profiling.") DEFINE_bool(log_gc, false,"Log heap samples on garbage collection for the hp2ps tool.") DEFINE_bool(log_handles, false,"Log global handle events.") DEFINE_bool(log_snapshot_positions, false,"log positions of (de)serialized objects in the snapshot.") DEFINE_bool(log_suspect, false,"Log suspect operations.") DEFINE_bool(prof, false,"Log statistical profiling information (implies --log-code).") DEFINE_bool(prof_auto, true,"Used with --prof, starts profiling automatically") DEFINE_bool(prof_lazy, false,"Used with --prof, only does sampling and logging"" when profiler is active (implies --noprof_auto).") DEFINE_bool(prof_browser_mode, true,"Used with --prof, turns on browser-compatible mode for profiling.") DEFINE_bool(log_regexp, false,"Log regular expression execution.") DEFINE_bool(sliding_state_window, false,"Update sliding state window counters.") DEFINE_string(logfile,"v8.log","Specify the name of the log file.") DEFINE_bool(ll_prof, false,"Enable low-level linux profiler.")#define FLAG DEFINE_bool(trace_elements_transitions, false,"trace elements transitions") DEFINE_bool(print_code_stubs, false,"print code stubs") DEFINE_bool(test_secondary_stub_cache, false,"test secondary stub cache by disabling the primary one") DEFINE_bool(test_primary_stub_cache, false,"test primary stub cache by disabling the secondary one") DEFINE_bool(print_code, false,"print generated code") DEFINE_bool(print_opt_code, false,"print optimized code") DEFINE_bool(print_unopt_code, false,"print unoptimized code before ""printing optimized code based on it") DEFINE_bool(print_code_verbose, false,"print more information for code") DEFINE_bool(print_builtin_code, false,"print generated code for builtins")#47"/Users/thlorenz/dev/dx/v8-perf/build/v8/src/flags.cc"2 namespace{struct Flag{enum FlagType{TYPE_BOOL, TYPE_INT, TYPE_FLOAT, TYPE_STRING, TYPE_ARGS} name
Definition: flags.cc:1349
Handle< Code > CompileStoreViaSetter(Handle< JSObject > receiver, Handle< JSFunction > setter, Handle< String > name)
static void GenerateLoadFastDoubleElement(MacroAssembler *masm)
bool is_constant_call() const
Definition: stub-cache.h:880
Flag flags[]
Definition: flags.cc:1467
String * key
Definition: stub-cache.h:70
Handle< Code > ComputeLoadCallback(Handle< String > name, Handle< JSObject > receiver, Handle< JSObject > holder, Handle< AccessorInfo > callback)
Definition: stub-cache.cc:155
SCTableReference map_reference(StubCache::Table table)
Definition: stub-cache.h:289
Handle< Code > ComputeKeyedLoadOrStoreElement(Handle< Map > receiver_map, KeyedIC::StubKind stub_kind, StrictModeFlag strict_mode)
Definition: stub-cache.cc:406
#define ASSERT(condition)
Definition: checks.h:270
#define CUSTOM_CALL_IC_GENERATORS(V)
Definition: stub-cache.h:765
Handle< Code > ComputeCallMegamorphic(int argc, Code::Kind kind, Code::ExtraICState state)
Definition: stub-cache.cc:835
Handle< Code > CompileStoreCallback(Handle< JSObject > object, Handle< AccessorInfo > callback, Handle< String > name)
Handle< Code > ComputeKeyedLoadInterceptor(Handle< String > name, Handle< JSObject > receiver, Handle< JSObject > holder)
Definition: stub-cache.cc:296
Handle< Code > ComputeKeyedLoadCallback(Handle< String > name, Handle< JSObject > receiver, Handle< JSObject > holder, Handle< AccessorInfo > callback)
Definition: stub-cache.cc:314
#define DECLARE_CALL_GENERATOR(name)
Definition: stub-cache.h:818
Factory * factory()
Definition: isolate.h:977
StubCompiler(Isolate *isolate)
Definition: stub-cache.h:418
CallStubCompiler(Isolate *isolate, int argc, Code::Kind kind, Code::ExtraICState extra_state, InlineCacheHolderFlag cache_holder)
Definition: stub-cache.cc:1415
Handle< Code > CompileLoadField(Handle< JSObject > object, Handle< JSObject > holder, int index, Handle< String > name)
Handle< Code > CompileStoreInterceptor(Handle< JSObject > object, Handle< String > name)
KeyedLoadStubCompiler(Isolate *isolate)
Definition: stub-cache.h:638
unsigned int seed
Definition: test-strings.cc:17
Handle< Code > CompileStoreField(Handle< JSObject > object, int index, Handle< Map > transition, Handle< String > name)
friend class SCTableReference
Definition: stub-cache.h:392
Handle< Code > ComputeKeyedLoadArrayLength(Handle< String > name, Handle< JSArray > receiver)
Definition: stub-cache.cc:335
Handle< Code > ComputeCallInterceptor(int argc, Code::Kind, Code::ExtraICState extra_state, Handle< String > name, Handle< Object > object, Handle< JSObject > holder)
Definition: stub-cache.cc:656
Handle< Code > ComputeCallArguments(int argc, Code::Kind kind)
Definition: stub-cache.cc:818
Handle< Code > ComputeLoadField(Handle< String > name, Handle< JSObject > receiver, Handle< JSObject > holder, int field_index)
Definition: stub-cache.cc:136
Handle< Code > CompileLoadInterceptor(Handle< JSObject > object, Handle< JSObject > holder, Handle< String > name)
Code * value
Definition: stub-cache.h:71
MacroAssembler * masm()
Definition: stub-cache.h:533
#define UNREACHABLE()
Definition: checks.h:50
Handle< Code > ComputeStoreNormal(StrictModeFlag strict_mode)
Definition: stub-cache.cc:474
STATIC_ASSERT((FixedDoubleArray::kHeaderSize &kDoubleAlignmentMask)==0)
Handle< Code > ComputeCallField(int argc, Code::Kind, Code::ExtraICState extra_state, Handle< String > name, Handle< Object > object, Handle< JSObject > holder, int index)
Definition: stub-cache.cc:618
Handle< Code > CompileCallGlobal(Handle< JSObject > object, Handle< GlobalObject > holder, Handle< JSGlobalPropertyCell > cell, Handle< JSFunction > function, Handle< String > name)
Handle< Code > CompileLoadField(Handle< String > name, Handle< JSObject > object, Handle< JSObject > holder, int index)
Handle< Code > CompileStoreGlobal(Handle< GlobalObject > object, Handle< JSGlobalPropertyCell > holder, Handle< String > name)
Handle< Code > CompileLoadViaGetter(Handle< String > name, Handle< JSObject > receiver, Handle< JSObject > holder, Handle< JSFunction > getter)
Handle< Code > CompileLoadConstant(Handle< JSObject > object, Handle< JSObject > holder, Handle< JSFunction > value, Handle< String > name)
Definition: stub-cache.h:69
Handle< Code > CompileLoadConstant(Handle< String > name, Handle< JSObject > object, Handle< JSObject > holder, Handle< JSFunction > value)
StubCache::Entry * first_entry(StubCache::Table table)
Definition: stub-cache.h:301
Handle< Code > CompileCallField(Handle< JSObject > object, Handle< JSObject > holder, int index, Handle< String > name)
Map * map
Definition: stub-cache.h:72
static void GenerateStoreFastElement(MacroAssembler *masm, bool is_js_array, ElementsKind element_kind, KeyedAccessGrowMode grow_mode)
Handle< Code > CompileLoadStringLength(Handle< String > name)
Handle< Code > ComputeKeyedLoadStringLength(Handle< String > name, Handle< String > receiver)
Definition: stub-cache.cc:351
#define DISALLOW_COPY_AND_ASSIGN(TypeName)
Definition: globals.h:321
Handle< Code > CompileLoadGlobal(Handle< JSObject > object, Handle< GlobalObject > holder, Handle< JSGlobalPropertyCell > cell, Handle< String > name, bool is_dont_delete)
void CollectMatchingMaps(SmallMapList *types, String *name, Code::Flags flags, Handle< Context > global_context)
Definition: stub-cache.cc:927
Handle< Code > ComputeStoreGlobal(Handle< String > name, Handle< GlobalObject > receiver, Handle< JSGlobalPropertyCell > cell, StrictModeFlag strict_mode)
Definition: stub-cache.cc:481
#define BASE_EMBEDDED
Definition: allocation.h:68
Handle< Code > ComputeStoreInterceptor(Handle< String > name, Handle< JSObject > receiver, StrictModeFlag strict_mode)
Definition: stub-cache.cc:536
static void GenerateLoadDictionaryElement(MacroAssembler *masm)
static void GenerateLoadExternalArray(MacroAssembler *masm, ElementsKind elements_kind)
Handle< Code > ComputeLoadViaGetter(Handle< String > name, Handle< JSObject > receiver, Handle< JSObject > holder, Handle< JSFunction > getter)
Definition: stub-cache.cc:175
Handle< FunctionTemplateInfo > expected_receiver_type() const
Definition: stub-cache.h:893
SCTableReference key_reference(StubCache::Table table)
Definition: stub-cache.h:283
Register CheckPrototypes(Handle< JSObject > object, Register object_reg, Handle< JSObject > holder, Register holder_reg, Register scratch1, Register scratch2, Handle< String > name, Label *miss)
Definition: stub-cache.h:506
Handle< CallHandlerInfo > api_call_info() const
Definition: stub-cache.h:898
Handle< Code > ComputeKeyedLoadField(Handle< String > name, Handle< JSObject > receiver, Handle< JSObject > holder, int field_index)
Definition: stub-cache.cc:257
Handle< Code > ComputeCallNormal(int argc, Code::Kind kind, Code::ExtraICState state)
Definition: stub-cache.cc:801
Handle< Code > ComputeKeyedStoreField(Handle< String > name, Handle< JSObject > receiver, int field_index, Handle< Map > transition, StrictModeFlag strict_mode)
Definition: stub-cache.cc:552
Handle< Code > CompileCallInterceptor(Handle< JSObject > object, Handle< JSObject > holder, Handle< String > name)
static void GenerateLoadFastElement(MacroAssembler *masm)
ConstructStubCompiler(Isolate *isolate)
Definition: stub-cache.h:864
friend class Isolate
Definition: stub-cache.h:391
static void GenerateStoreFastDoubleElement(MacroAssembler *masm, bool is_js_array, KeyedAccessGrowMode grow_mode)
LoadStubCompiler(Isolate *isolate)
Definition: stub-cache.h:595
activate correct semantics for inheriting readonliness enable harmony semantics for typeof enable harmony enable harmony proxies enable all harmony harmony_scoping harmony_proxies harmony_scoping tracks arrays with only smi values automatically unbox arrays of doubles use crankshaft use hydrogen range analysis use hydrogen global value numbering use function inlining maximum number of AST nodes considered for a single inlining loop invariant code motion print statistics for hydrogen trace generated IR for specified phases trace register allocator trace range analysis trace representation types environment for every instruction put a break point before deoptimizing polymorphic inlining perform array bounds checks elimination trace on stack replacement optimize closures functions with arguments object optimize functions containing for in loops profiler considers IC stability primitive functions trigger their own optimization re try self optimization if it failed insert an interrupt check at function exit execution budget before interrupt is triggered call count before self optimization self_optimization count_based_interrupts weighted_back_edges trace_opt emit comments in code disassembly enable use of SSE3 instructions if available enable use of CMOV instruction if available enable use of SAHF instruction if enable use of VFP3 instructions if available this implies enabling ARMv7 enable use of ARMv7 instructions if enable use of MIPS FPU instructions if NULL
Definition: flags.cc:274
Handle< Code > ComputeKeyedCallInitialize(int argc)
Definition: stub-cache.cc:777
Handle< Code > CompileLoadArrayLength(Handle< String > name)
Handle< Code > CompileCallConstant(Handle< Object > object, Handle< JSObject > holder, Handle< JSFunction > function, Handle< String > name, CheckType check)
const int kHeapObjectTagSize
Definition: v8.h:3849
SCTableReference value_reference(StubCache::Table table)
Definition: stub-cache.h:295
static bool HasCustomCallGenerator(Handle< JSFunction > function)
Definition: stub-cache.cc:1428
Handle< Code > ComputeCallInitialize(int argc, RelocInfo::Mode mode)
Definition: stub-cache.cc:772
DECLARE_RUNTIME_FUNCTION(MaybeObject *, LoadCallbackProperty)
Code * FindCallInitialize(int argc, RelocInfo::Mode mode, Code::Kind kind)
Definition: stub-cache.cc:731
static const int kFlagsNotUsedInLookup
Definition: objects.h:4557
Handle< Code > ComputeCallPreMonomorphic(int argc, Code::Kind kind, Code::ExtraICState extra_state)
Definition: stub-cache.cc:783
const int kInvalidProtoDepth
const Register no_reg
Handle< Code > ComputeLoadNonexistent(Handle< String > name, Handle< JSObject > receiver)
Definition: stub-cache.cc:103
Handle< Code > ComputeLoadConstant(Handle< String > name, Handle< JSObject > receiver, Handle< JSObject > holder, Handle< JSFunction > value)
Definition: stub-cache.cc:194
Handle< Code > CompileLoadCallback(Handle< String > name, Handle< JSObject > object, Handle< JSObject > holder, Handle< AccessorInfo > callback)
Handle< Code > ComputeLoadInterceptor(Handle< String > name, Handle< JSObject > receiver, Handle< JSObject > holder)
Definition: stub-cache.cc:214
static const int kHashShift
Definition: objects.h:7121
Handle< Code > CompileLoadPolymorphic(MapHandleList *receiver_maps, CodeHandleList *handler_ics)
Handle< Code > ComputeCallConstant(int argc, Code::Kind, Code::ExtraICState extra_state, Handle< String > name, Handle< Object > object, Handle< JSObject > holder, Handle< JSFunction > function)
Definition: stub-cache.cc:577
Handle< Code > CompileLoadInterceptor(Handle< JSObject > object, Handle< JSObject > holder, Handle< String > name)
Handle< Code > CompileStorePolymorphic(MapHandleList *receiver_maps, CodeHandleList *handler_stubs, MapHandleList *transitioned_maps)
KeyedAccessGrowMode
Definition: objects.h:141
KeyedStoreStubCompiler(Isolate *isolate, StrictModeFlag strict_mode, KeyedAccessGrowMode grow_mode)
Definition: stub-cache.h:721
Handle< JSFunction > constant_function() const
Definition: stub-cache.h:884
void check(i::Vector< const char > string)
Handle< Code > ComputeKeyedLoadConstant(Handle< String > name, Handle< JSObject > receiver, Handle< JSObject > holder, Handle< JSFunction > value)
Definition: stub-cache.cc:276
Zone * zone() const
Definition: stub-cache.h:313
Handle< Code > CompileLoadElement(Handle< Map > receiver_map)
Handle< Code > CompileConstructStub(Handle< JSFunction > function)
Handle< Code > ComputeLoadGlobal(Handle< String > name, Handle< JSObject > receiver, Handle< GlobalObject > holder, Handle< JSGlobalPropertyCell > cell, bool is_dont_delete)
Definition: stub-cache.cc:237
FlagType type() const
Definition: flags.cc:1358
Handle< Code > ComputeStoreCallback(Handle< String > name, Handle< JSObject > receiver, Handle< AccessorInfo > callback, StrictModeFlag strict_mode)
Definition: stub-cache.cc:499
Address address() const
Definition: stub-cache.h:56
StoreStubCompiler(Isolate *isolate, StrictModeFlag strict_mode)
Definition: stub-cache.h:688
Handle< Code > ComputeStoreViaSetter(Handle< String > name, Handle< JSObject > receiver, Handle< JSFunction > setter, StrictModeFlag strict_mode)
Definition: stub-cache.cc:518
static void GenerateStoreDictionaryElement(MacroAssembler *masm)
Definition: stub-cache.cc:1409