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
ic.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_IC_H_
29 #define V8_IC_H_
30 
31 #include "macro-assembler.h"
32 #include "type-info.h"
33 
34 namespace v8 {
35 namespace internal {
36 
37 
38 // IC_UTIL_LIST defines all utility functions called from generated
39 // inline caching code. The argument for the macro, ICU, is the function name.
40 #define IC_UTIL_LIST(ICU) \
41  ICU(LoadIC_Miss) \
42  ICU(KeyedLoadIC_Miss) \
43  ICU(KeyedLoadIC_MissForceGeneric) \
44  ICU(CallIC_Miss) \
45  ICU(KeyedCallIC_Miss) \
46  ICU(StoreIC_Miss) \
47  ICU(StoreIC_ArrayLength) \
48  ICU(SharedStoreIC_ExtendStorage) \
49  ICU(KeyedStoreIC_Miss) \
50  ICU(KeyedStoreIC_MissForceGeneric) \
51  ICU(KeyedStoreIC_Slow) \
52  /* Utilities for IC stubs. */ \
53  ICU(LoadCallbackProperty) \
54  ICU(StoreCallbackProperty) \
55  ICU(LoadPropertyWithInterceptorOnly) \
56  ICU(LoadPropertyWithInterceptorForLoad) \
57  ICU(LoadPropertyWithInterceptorForCall) \
58  ICU(KeyedLoadPropertyWithInterceptor) \
59  ICU(StoreInterceptorProperty) \
60  ICU(UnaryOp_Patch) \
61  ICU(BinaryOp_Patch) \
62  ICU(CompareIC_Miss) \
63  ICU(ToBoolean_Patch)
64 //
65 // IC is the base class for LoadIC, StoreIC, CallIC, KeyedLoadIC,
66 // and KeyedStoreIC.
67 //
68 class IC {
69  public:
70  // The ids for utility called from the generated code.
71  enum UtilityId {
72  #define CONST_NAME(name) k##name,
74  #undef CONST_NAME
76  };
77 
78  // Looks up the address of the named utility.
80 
81  // Alias the inline cache state type to make the IC code more readable.
83 
84  // The IC code is either invoked with no extra frames on the stack
85  // or with a single extra frame for supporting calls.
86  enum FrameDepth {
89  };
90 
91  // Construct the IC structure with the given number of extra
92  // JavaScript frames on the stack.
93  IC(FrameDepth depth, Isolate* isolate);
94  virtual ~IC() {}
95 
96  // Get the call-site target; used for determining the state.
97  Code* target() const { return GetTargetAtAddress(address()); }
98  inline Address address() const;
99 
100  virtual bool IsGeneric() const { return false; }
101 
102  // Compute the current IC state based on the target stub, receiver and name.
103  static State StateFrom(Code* target, Object* receiver, Object* name);
104 
105  // Clear the inline cache to initial state.
106  static void Clear(Address address);
107 
108  // Computes the reloc info for this IC. This is a fairly expensive
109  // operation as it has to search through the heap to find the code
110  // object that contains this IC site.
111  RelocInfo::Mode ComputeMode();
112 
113  // Returns if this IC is for contextual (no explicit receiver)
114  // access to properties.
115  bool IsContextual(Handle<Object> receiver) {
116  if (receiver->IsGlobalObject()) {
117  return SlowIsContextual();
118  } else {
120  return false;
121  }
122  }
123 
125  return ComputeMode() == RelocInfo::CODE_TARGET_CONTEXT;
126  }
127 
128  // Determines which map must be used for keeping the code stub.
129  // These methods should not be called with undefined or null.
130  static inline InlineCacheHolderFlag GetCodeCacheForObject(Object* object,
131  JSObject* holder);
133  JSObject* holder);
134  static inline JSObject* GetCodeCacheHolder(Object* object,
135  InlineCacheHolderFlag holder);
136 
137  protected:
138  Address fp() const { return fp_; }
139  Address pc() const { return *pc_address_; }
140  Isolate* isolate() const { return isolate_; }
141 
142 #ifdef ENABLE_DEBUGGER_SUPPORT
143  // Computes the address in the original code when the code running is
144  // containing break points (calls to DebugBreakXXX builtins).
145  Address OriginalCodeAddress() const;
146 #endif
147 
148  // Set the call-site target.
149  void set_target(Code* code) { SetTargetAtAddress(address(), code); }
150 
151 #ifdef DEBUG
152  char TransitionMarkFromState(IC::State state);
153 
154  void TraceIC(const char* type,
156  State old_state,
157  Code* new_target);
158 #endif
159 
160  Failure* TypeError(const char* type,
161  Handle<Object> object,
162  Handle<Object> key);
164 
165  // Access the target code for the given IC address.
166  static inline Code* GetTargetAtAddress(Address address);
167  static inline void SetTargetAtAddress(Address address, Code* target);
168  static void PostPatching(Address address, Code* target, Code* old_target);
169 
170  private:
171  // Frame pointer for the frame that uses (calls) the IC.
172  Address fp_;
173 
174  // All access to the program counter of an IC structure is indirect
175  // to make the code GC safe. This feature is crucial since
176  // GetProperty and SetProperty are called and they in turn might
177  // invoke the garbage collector.
178  Address* pc_address_;
179 
180  Isolate* isolate_;
181 
182  DISALLOW_IMPLICIT_CONSTRUCTORS(IC);
183 };
184 
185 
186 // An IC_Utility encapsulates IC::UtilityId. It exists mainly because you
187 // cannot make forward declarations to an enum.
188 class IC_Utility {
189  public:
191  : address_(IC::AddressFromUtilityId(id)), id_(id) {}
192 
193  Address address() const { return address_; }
194 
195  IC::UtilityId id() const { return id_; }
196  private:
197  Address address_;
198  IC::UtilityId id_;
199 };
200 
201 
202 class CallICBase: public IC {
203  public:
204  class Contextual: public BitField<bool, 0, 1> {};
205  class StringStubState: public BitField<StringStubFeedback, 1, 1> {};
206 
207  // Returns a JSFunction or a Failure.
208  MUST_USE_RESULT MaybeObject* LoadFunction(State state,
209  Code::ExtraICState extra_ic_state,
210  Handle<Object> object,
212 
213  protected:
215  : IC(EXTRA_CALL_FRAME, isolate), kind_(kind) {}
216 
217  bool TryUpdateExtraICState(LookupResult* lookup,
218  Handle<Object> object,
219  Code::ExtraICState* extra_ic_state);
220 
221  // Compute a monomorphic stub if possible, otherwise return a null handle.
222  Handle<Code> ComputeMonomorphicStub(LookupResult* lookup,
223  State state,
224  Code::ExtraICState extra_state,
225  Handle<Object> object,
227 
228  // Update the inline cache and the global stub cache based on the lookup
229  // result.
230  void UpdateCaches(LookupResult* lookup,
231  State state,
232  Code::ExtraICState extra_ic_state,
233  Handle<Object> object,
235 
236  // Returns a JSFunction if the object can be called as a function, and
237  // patches the stack to be ready for the call. Otherwise, it returns the
238  // undefined value.
240 
242 
243  static void Clear(Address address, Code* target);
244 
245  // Platform-specific code generation functions used by both call and
246  // keyed call.
247  static void GenerateMiss(MacroAssembler* masm,
248  int argc,
249  IC::UtilityId id,
250  Code::ExtraICState extra_state);
251 
252  static void GenerateNormal(MacroAssembler* masm, int argc);
253 
255  int argc,
256  Code::Kind kind,
257  Code::ExtraICState extra_state);
258 
260 
261  friend class IC;
262 };
263 
264 
265 class CallIC: public CallICBase {
266  public:
267  explicit CallIC(Isolate* isolate) : CallICBase(Code::CALL_IC, isolate) {
268  ASSERT(target()->is_call_stub());
269  }
270 
271  // Code generator routines.
273  int argc,
274  Code::ExtraICState extra_state) {
275  GenerateMiss(masm, argc, extra_state);
276  }
277 
278  static void GenerateMiss(MacroAssembler* masm,
279  int argc,
280  Code::ExtraICState extra_state) {
281  CallICBase::GenerateMiss(masm, argc, IC::kCallIC_Miss, extra_state);
282  }
283 
284  static void GenerateMegamorphic(MacroAssembler* masm,
285  int argc,
286  Code::ExtraICState extra_ic_state);
287 
288  static void GenerateNormal(MacroAssembler* masm, int argc) {
289  CallICBase::GenerateNormal(masm, argc);
290  GenerateMiss(masm, argc, Code::kNoExtraICState);
291  }
292 };
293 
294 
295 class KeyedCallIC: public CallICBase {
296  public:
298  : CallICBase(Code::KEYED_CALL_IC, isolate) {
299  ASSERT(target()->is_keyed_call_stub());
300  }
301 
302  MUST_USE_RESULT MaybeObject* LoadFunction(State state,
303  Handle<Object> object,
304  Handle<Object> key);
305 
306  // Code generator routines.
307  static void GenerateInitialize(MacroAssembler* masm, int argc) {
308  GenerateMiss(masm, argc);
309  }
310 
311  static void GenerateMiss(MacroAssembler* masm, int argc) {
312  CallICBase::GenerateMiss(masm, argc, IC::kKeyedCallIC_Miss,
314  }
315 
316  static void GenerateMegamorphic(MacroAssembler* masm, int argc);
317  static void GenerateNormal(MacroAssembler* masm, int argc);
318  static void GenerateNonStrictArguments(MacroAssembler* masm, int argc);
319 };
320 
321 
322 class LoadIC: public IC {
323  public:
324  explicit LoadIC(Isolate* isolate) : IC(NO_EXTRA_FRAME, isolate) {
325  ASSERT(target()->is_load_stub());
326  }
327 
328  MUST_USE_RESULT MaybeObject* Load(State state,
329  Handle<Object> object,
331 
332  // Code generator routines.
333  static void GenerateInitialize(MacroAssembler* masm) { GenerateMiss(masm); }
335  GenerateMiss(masm);
336  }
337  static void GenerateMiss(MacroAssembler* masm);
338  static void GenerateMegamorphic(MacroAssembler* masm);
339  static void GenerateNormal(MacroAssembler* masm);
340 
341  // Specialized code generator routines.
342  static void GenerateArrayLength(MacroAssembler* masm);
343  static void GenerateStringLength(MacroAssembler* masm,
344  bool support_wrappers);
345  static void GenerateFunctionPrototype(MacroAssembler* masm);
346 
347  private:
348  // Update the inline cache and the global stub cache based on the
349  // lookup result.
350  void UpdateCaches(LookupResult* lookup,
351  State state,
352  Handle<Object> object,
354 
355  // Stub accessors.
356  Handle<Code> megamorphic_stub() {
357  return isolate()->builtins()->LoadIC_Megamorphic();
358  }
359  static Code* initialize_stub() {
360  return Isolate::Current()->builtins()->builtin(
361  Builtins::kLoadIC_Initialize);
362  }
363  Handle<Code> pre_monomorphic_stub() {
364  return isolate()->builtins()->LoadIC_PreMonomorphic();
365  }
366 
367  static void Clear(Address address, Code* target);
368 
369  friend class IC;
370 };
371 
372 
373 class KeyedIC: public IC {
374  public:
375  enum StubKind {
391  };
392 
404 
405  explicit KeyedIC(Isolate* isolate) : IC(NO_EXTRA_FRAME, isolate) {}
406  virtual ~KeyedIC() {}
407 
409  StubKind stub_kind) {
410  return (stub_kind >= STORE_AND_GROW_NO_TRANSITION)
413  }
414 
415  static inline StubKind GetGrowStubKind(StubKind stub_kind) {
416  ASSERT(stub_kind != LOAD);
417  if (stub_kind < STORE_AND_GROW_NO_TRANSITION) {
418  stub_kind = static_cast<StubKind>(static_cast<int>(stub_kind) +
419  kGrowICDelta);
420  }
421  return stub_kind;
422  }
423 
425  bool is_js_array,
426  ElementsKind elements_kind,
427  KeyedAccessGrowMode grow_mode) = 0;
428 
429  protected:
431  return Handle<Code>::null();
432  }
433 
434  virtual Code::Kind kind() const = 0;
435 
437  StubKind stub_kind,
438  StrictModeFlag strict_mode,
439  Handle<Code> default_stub);
440 
442  MapHandleList* receiver_maps,
443  StrictModeFlag strict_mode,
444  KeyedAccessGrowMode grow_mode) = 0;
445 
447  Handle<Map> receiver_map,
448  StrictModeFlag strict_mode,
449  KeyedAccessGrowMode grow_mode);
450 
451  private:
452  void GetReceiverMapsForStub(Handle<Code> stub, MapHandleList* result);
453 
454  Handle<Code> ComputeMonomorphicStub(Handle<Map> receiver_map,
455  StubKind stub_kind,
456  StrictModeFlag strict_mode,
457  Handle<Code> default_stub);
458 
459  Handle<Map> ComputeTransitionedMap(Handle<JSObject> receiver,
460  StubKind stub_kind);
461 
462  static bool IsTransitionStubKind(StubKind stub_kind) {
463  return stub_kind > STORE_NO_TRANSITION &&
464  stub_kind != STORE_AND_GROW_NO_TRANSITION;
465  }
466 
467  static bool IsGrowStubKind(StubKind stub_kind) {
468  return stub_kind >= STORE_AND_GROW_NO_TRANSITION;
469  }
470 
471  static StubKind GetNoTransitionStubKind(StubKind stub_kind) {
472  if (!IsTransitionStubKind(stub_kind)) return stub_kind;
473  if (IsGrowStubKind(stub_kind)) return STORE_AND_GROW_NO_TRANSITION;
474  return STORE_NO_TRANSITION;
475  }
476 };
477 
478 
479 class KeyedLoadIC: public KeyedIC {
480  public:
481  explicit KeyedLoadIC(Isolate* isolate) : KeyedIC(isolate) {
482  ASSERT(target()->is_keyed_load_stub());
483  }
484 
485  MUST_USE_RESULT MaybeObject* Load(State state,
486  Handle<Object> object,
487  Handle<Object> key,
488  bool force_generic_stub);
489 
490  // Code generator routines.
491  static void GenerateMiss(MacroAssembler* masm, bool force_generic);
492  static void GenerateRuntimeGetProperty(MacroAssembler* masm);
493  static void GenerateInitialize(MacroAssembler* masm) {
494  GenerateMiss(masm, false);
495  }
497  GenerateMiss(masm, false);
498  }
499  static void GenerateGeneric(MacroAssembler* masm);
500  static void GenerateString(MacroAssembler* masm);
501  static void GenerateIndexedInterceptor(MacroAssembler* masm);
502  static void GenerateNonStrictArguments(MacroAssembler* masm);
503 
504  // Bit mask to be tested against bit field for the cases when
505  // generic stub should go into slow case.
506  // Access check is necessary explicitly since generic stub does not perform
507  // map checks.
508  static const int kSlowCaseBitFieldMask =
510 
512  bool is_js_array,
513  ElementsKind elements_kind,
514  KeyedAccessGrowMode grow_mode);
515 
516  virtual bool IsGeneric() const {
517  return target() == *generic_stub();
518  }
519 
520  protected:
521  virtual Code::Kind kind() const { return Code::KEYED_LOAD_IC; }
522 
523  virtual Handle<Code> ComputePolymorphicStub(MapHandleList* receiver_maps,
524  StrictModeFlag strict_mode,
525  KeyedAccessGrowMode grow_mode);
526 
528  return isolate()->builtins()->KeyedLoadIC_String();
529  }
530 
531  private:
532  // Update the inline cache.
533  void UpdateCaches(LookupResult* lookup,
534  State state,
535  Handle<Object> object,
537 
538  // Stub accessors.
539  static Code* initialize_stub() {
540  return Isolate::Current()->builtins()->builtin(
541  Builtins::kKeyedLoadIC_Initialize);
542  }
543  Handle<Code> megamorphic_stub() {
544  return isolate()->builtins()->KeyedLoadIC_Generic();
545  }
546  Handle<Code> generic_stub() const {
547  return isolate()->builtins()->KeyedLoadIC_Generic();
548  }
549  Handle<Code> pre_monomorphic_stub() {
550  return isolate()->builtins()->KeyedLoadIC_PreMonomorphic();
551  }
552  Handle<Code> indexed_interceptor_stub() {
553  return isolate()->builtins()->KeyedLoadIC_IndexedInterceptor();
554  }
555  Handle<Code> non_strict_arguments_stub() {
556  return isolate()->builtins()->KeyedLoadIC_NonStrictArguments();
557  }
558 
559  static void Clear(Address address, Code* target);
560 
561  friend class IC;
562 };
563 
564 
565 class StoreIC: public IC {
566  public:
567  explicit StoreIC(Isolate* isolate) : IC(NO_EXTRA_FRAME, isolate) {
568  ASSERT(target()->is_store_stub());
569  }
570 
571  MUST_USE_RESULT MaybeObject* Store(State state,
572  StrictModeFlag strict_mode,
573  Handle<Object> object,
575  Handle<Object> value);
576 
577  // Code generators for stub routines. Only called once at startup.
578  static void GenerateInitialize(MacroAssembler* masm) { GenerateMiss(masm); }
579  static void GenerateMiss(MacroAssembler* masm);
580  static void GenerateMegamorphic(MacroAssembler* masm,
581  StrictModeFlag strict_mode);
582  static void GenerateArrayLength(MacroAssembler* masm);
583  static void GenerateNormal(MacroAssembler* masm);
584  static void GenerateGlobalProxy(MacroAssembler* masm,
585  StrictModeFlag strict_mode);
586 
587  private:
588  // Update the inline cache and the global stub cache based on the
589  // lookup result.
590  void UpdateCaches(LookupResult* lookup,
591  State state,
592  StrictModeFlag strict_mode,
593  Handle<JSObject> receiver,
595  Handle<Object> value);
596 
597  void set_target(Code* code) {
598  // Strict mode must be preserved across IC patching.
601  IC::set_target(code);
602  }
603 
604  // Stub accessors.
605  Code* megamorphic_stub() {
606  return isolate()->builtins()->builtin(
607  Builtins::kStoreIC_Megamorphic);
608  }
609  Code* megamorphic_stub_strict() {
610  return isolate()->builtins()->builtin(
611  Builtins::kStoreIC_Megamorphic_Strict);
612  }
613  static Code* initialize_stub() {
614  return Isolate::Current()->builtins()->builtin(
615  Builtins::kStoreIC_Initialize);
616  }
617  static Code* initialize_stub_strict() {
618  return Isolate::Current()->builtins()->builtin(
619  Builtins::kStoreIC_Initialize_Strict);
620  }
621  Handle<Code> global_proxy_stub() {
622  return isolate()->builtins()->StoreIC_GlobalProxy();
623  }
624  Handle<Code> global_proxy_stub_strict() {
625  return isolate()->builtins()->StoreIC_GlobalProxy_Strict();
626  }
627 
628  static void Clear(Address address, Code* target);
629 
630  friend class IC;
631 };
632 
633 
634 class KeyedStoreIC: public KeyedIC {
635  public:
636  explicit KeyedStoreIC(Isolate* isolate) : KeyedIC(isolate) {
637  ASSERT(target()->is_keyed_store_stub());
638  }
639 
640  MUST_USE_RESULT MaybeObject* Store(State state,
641  StrictModeFlag strict_mode,
642  Handle<Object> object,
644  Handle<Object> value,
645  bool force_generic);
646 
647  // Code generators for stub routines. Only called once at startup.
648  static void GenerateInitialize(MacroAssembler* masm) {
649  GenerateMiss(masm, false);
650  }
651  static void GenerateMiss(MacroAssembler* masm, bool force_generic);
652  static void GenerateSlow(MacroAssembler* masm);
653  static void GenerateRuntimeSetProperty(MacroAssembler* masm,
654  StrictModeFlag strict_mode);
655  static void GenerateGeneric(MacroAssembler* masm, StrictModeFlag strict_mode);
656  static void GenerateNonStrictArguments(MacroAssembler* masm);
659 
661  bool is_js_array,
662  ElementsKind elements_kind,
663  KeyedAccessGrowMode grow_mode);
664 
665  virtual bool IsGeneric() const {
666  return target() == *generic_stub() ||
667  target() == *generic_stub_strict();
668  }
669 
670  protected:
671  virtual Code::Kind kind() const { return Code::KEYED_STORE_IC; }
672 
673  virtual Handle<Code> ComputePolymorphicStub(MapHandleList* receiver_maps,
674  StrictModeFlag strict_mode,
675  KeyedAccessGrowMode grow_mode);
676 
677  private:
678  // Update the inline cache.
679  void UpdateCaches(LookupResult* lookup,
680  State state,
681  StrictModeFlag strict_mode,
682  Handle<JSObject> receiver,
684  Handle<Object> value);
685 
686  void set_target(Code* code) {
687  // Strict mode must be preserved across IC patching.
690  IC::set_target(code);
691  }
692 
693  // Stub accessors.
694  static Code* initialize_stub() {
695  return Isolate::Current()->builtins()->builtin(
696  Builtins::kKeyedStoreIC_Initialize);
697  }
698  static Code* initialize_stub_strict() {
699  return Isolate::Current()->builtins()->builtin(
700  Builtins::kKeyedStoreIC_Initialize_Strict);
701  }
702  Handle<Code> megamorphic_stub() {
703  return isolate()->builtins()->KeyedStoreIC_Generic();
704  }
705  Handle<Code> megamorphic_stub_strict() {
706  return isolate()->builtins()->KeyedStoreIC_Generic_Strict();
707  }
708  Handle<Code> generic_stub() const {
709  return isolate()->builtins()->KeyedStoreIC_Generic();
710  }
711  Handle<Code> generic_stub_strict() const {
712  return isolate()->builtins()->KeyedStoreIC_Generic_Strict();
713  }
714  Handle<Code> non_strict_arguments_stub() {
715  return isolate()->builtins()->KeyedStoreIC_NonStrictArguments();
716  }
717 
718  static void Clear(Address address, Code* target);
719 
720  StubKind GetStubKind(Handle<JSObject> receiver,
721  Handle<Object> key,
722  Handle<Object> value);
723 
724  friend class IC;
725 };
726 
727 
728 class UnaryOpIC: public IC {
729  public:
730  // sorted: increasingly more unspecific (ignoring UNINITIALIZED)
731  // TODO(svenpanne) Using enums+switch is an antipattern, use a class instead.
732  enum TypeInfo {
737  };
738 
739  explicit UnaryOpIC(Isolate* isolate) : IC(NO_EXTRA_FRAME, isolate) { }
740 
741  void patch(Code* code);
742 
743  static const char* GetName(TypeInfo type_info);
744 
745  static State ToState(TypeInfo type_info);
746 
747  static TypeInfo GetTypeInfo(Handle<Object> operand);
748 
749  static TypeInfo ComputeNewType(TypeInfo type, TypeInfo previous);
750 };
751 
752 
753 // Type Recording BinaryOpIC, that records the types of the inputs and outputs.
754 class BinaryOpIC: public IC {
755  public:
756  enum TypeInfo {
762  BOTH_STRING, // Only used for addition operation.
763  STRING, // Only used for addition operation. At least one string operand.
765  };
766 
767  explicit BinaryOpIC(Isolate* isolate) : IC(NO_EXTRA_FRAME, isolate) { }
768 
769  void patch(Code* code);
770 
771  static const char* GetName(TypeInfo type_info);
772 
773  static State ToState(TypeInfo type_info);
774 
776 
777  static TypeInfo JoinTypes(TypeInfo x, TypeInfo y);
778 };
779 
780 
781 class CompareIC: public IC {
782  public:
783  enum State {
792  };
793 
795  : IC(EXTRA_CALL_FRAME, isolate), op_(op) { }
796 
797  // Update the inline cache for the given operands.
799 
800  // Factory method for getting an uninitialized compare stub.
802 
803  // Helper function for computing the condition for a compare operation.
805 
806  // Helper function for determining the state of a compare IC.
807  static State ComputeState(Code* target);
808 
809  // Helper function for determining the operation a compare IC is for.
811 
812  static const char* GetStateName(State state);
813 
814  private:
815  State TargetState(State state, bool has_inlined_smi_code,
817 
818  bool strict() const { return op_ == Token::EQ_STRICT; }
819  Condition GetCondition() const { return ComputeCondition(op_); }
820  State GetState() { return ComputeState(target()); }
821 
822  static Code* GetRawUninitialized(Token::Value op);
823 
824  static void Clear(Address address, Code* target);
825 
826  Token::Value op_;
827 
828  friend class IC;
829 };
830 
831 
832 class ToBooleanIC: public IC {
833  public:
834  explicit ToBooleanIC(Isolate* isolate) : IC(NO_EXTRA_FRAME, isolate) { }
835 
836  void patch(Code* code);
837 };
838 
839 
840 // Helper for BinaryOpIC and CompareIC.
843 
844 } } // namespace v8::internal
845 
846 #endif // V8_IC_H_
byte * Address
Definition: globals.h:172
void patch(Code *code)
Definition: ic.cc:2663
virtual Handle< Code > string_stub()
Definition: ic.h:527
static TypeInfo GetTypeInfo(Handle< Object > operand)
Definition: ic.cc:2245
static void GenerateTransitionElementsDoubleToObject(MacroAssembler *masm)
CallIC(Isolate *isolate)
Definition: ic.h:267
static void GenerateRuntimeGetProperty(MacroAssembler *masm)
Code * builtin(Name name)
Definition: builtins.h:312
void UpdateCaches(LookupResult *lookup, State state, Code::ExtraICState extra_ic_state, Handle< Object > object, Handle< String > name)
Definition: ic.cc:692
virtual Code::Kind kind() const
Definition: ic.h:671
virtual Code::Kind kind() const =0
bool SlowIsContextual()
Definition: ic.h:124
Code * target() const
Definition: ic.h:97
static void GenerateNormal(MacroAssembler *masm, int argc)
virtual bool IsGeneric() const
Definition: ic.h:100
static void GenerateGeneric(MacroAssembler *masm, StrictModeFlag strict_mode)
IC_Utility(IC::UtilityId id)
Definition: ic.h:190
static const char * GetName(TypeInfo type_info)
Definition: ic.cc:2220
virtual Handle< Code > GetElementStubWithoutMapCheck(bool is_js_array, ElementsKind elements_kind, KeyedAccessGrowMode grow_mode)
Definition: ic.cc:1739
static void GenerateMiss(MacroAssembler *masm, int argc, IC::UtilityId id, Code::ExtraICState extra_state)
MUST_USE_RESULT MaybeObject * LoadFunction(State state, Handle< Object > object, Handle< Object > key)
Definition: ic.cc:764
void patch(Code *code)
Definition: ic.cc:2215
virtual ~IC()
Definition: ic.h:94
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
MUST_USE_RESULT MaybeObject * Load(State state, Handle< Object > object, Handle< String > name)
Definition: ic.cc:812
CompareIC(Isolate *isolate, Token::Value op)
Definition: ic.h:794
static void GenerateGlobalProxy(MacroAssembler *masm, StrictModeFlag strict_mode)
static const int kGrowICDelta
Definition: ic.h:393
static void GenerateMegamorphic(MacroAssembler *masm, StrictModeFlag strict_mode)
static void GenerateStringLength(MacroAssembler *masm, bool support_wrappers)
Builtins * builtins()
Definition: isolate.h:909
static const int kIsAccessCheckNeeded
Definition: objects.h:5007
Address address() const
Definition: ic-inl.h:41
static void GenerateMegamorphic(MacroAssembler *masm)
Failure * TypeError(const char *type, Handle< Object > object, Handle< Object > key)
Definition: ic.cc:280
#define ASSERT(condition)
Definition: checks.h:270
virtual ~KeyedIC()
Definition: ic.h:406
static State StateFrom(Code *target, Object *receiver, Object *name)
Definition: ic.cc:227
static StubKind GetGrowStubKind(StubKind stub_kind)
Definition: ic.h:415
Address address() const
Definition: ic.h:193
static TypeInfo GetTypeInfo(Handle< Object > left, Handle< Object > right)
Definition: ic.cc:2334
Code::Kind kind_
Definition: ic.h:259
static const char * GetName(TypeInfo type_info)
Definition: ic.cc:2285
Isolate * isolate() const
Definition: ic.h:140
static const ExtraICState kNoExtraICState
Definition: objects.h:4199
KeyedCallIC(Isolate *isolate)
Definition: ic.h:297
MUST_USE_RESULT MaybeObject * Store(State state, StrictModeFlag strict_mode, Handle< Object > object, Handle< String > name, Handle< Object > value)
Definition: ic.cc:1334
static State ToState(TypeInfo type_info)
Definition: ic.cc:2300
void ReceiverToObjectIfRequired(Handle< Object > callee, Handle< Object > object)
Definition: ic.cc:483
void PatchInlinedSmiCode(Address address, InlinedSmiCheck check)
static void GenerateArrayLength(MacroAssembler *masm)
static void GenerateInitialize(MacroAssembler *masm, int argc, Code::ExtraICState extra_state)
Definition: ic.h:272
static const int kHasIndexedInterceptor
Definition: objects.h:5004
void UpdateCaches(Handle< Object > x, Handle< Object > y)
KeyedIC(Isolate *isolate)
Definition: ic.h:405
static Condition ComputeCondition(Token::Value op)
static void PostPatching(Address address, Code *target, Code *old_target)
Definition: ic.cc:309
Address pc() const
Definition: ic.h:139
static void GenerateInitialize(MacroAssembler *masm)
Definition: ic.h:493
static KeyedAccessGrowMode GetGrowModeFromStubKind(StubKind stub_kind)
Definition: ic.h:408
#define MUST_USE_RESULT
Definition: globals.h:360
Address fp() const
Definition: ic.h:138
IC(FrameDepth depth, Isolate *isolate)
Definition: ic.cc:112
static StrictModeFlag GetStrictMode(ExtraICState extra_ic_state)
Definition: objects.h:4377
static void GeneratePreMonomorphic(MacroAssembler *masm)
Definition: ic.h:334
static void GenerateGeneric(MacroAssembler *masm)
static Code * GetTargetAtAddress(Address address)
Definition: ic-inl.h:69
static void GenerateInitialize(MacroAssembler *masm)
Definition: ic.h:333
KeyedLoadIC(Isolate *isolate)
Definition: ic.h:481
static void GenerateMiss(MacroAssembler *masm)
static void GenerateNormal(MacroAssembler *masm, int argc)
Definition: ic.h:288
UnaryOpIC(Isolate *isolate)
Definition: ic.h:739
ToBooleanIC(Isolate *isolate)
Definition: ic.h:834
MUST_USE_RESULT MaybeObject * LoadFunction(State state, Code::ExtraICState extra_ic_state, Handle< Object > object, Handle< String > name)
Definition: ic.cc:509
StoreIC(Isolate *isolate)
Definition: ic.h:567
static void Clear(Address address, Code *target)
Definition: ic.cc:367
static State ToState(TypeInfo type_info)
Definition: ic.cc:2231
virtual bool IsGeneric() const
Definition: ic.h:516
IC::UtilityId id() const
Definition: ic.h:195
Definition: v8.h:104
virtual Handle< Code > GetElementStubWithoutMapCheck(bool is_js_array, ElementsKind elements_kind, KeyedAccessGrowMode grow_mode)
Definition: ic.cc:1048
STATIC_ASSERT(kGrowICDelta==STORE_AND_GROW_TRANSITION_SMI_TO_OBJECT-STORE_TRANSITION_SMI_TO_OBJECT)
static void GenerateMegamorphic(MacroAssembler *masm, int argc)
virtual Handle< Code > ComputePolymorphicStub(MapHandleList *receiver_maps, StrictModeFlag strict_mode, KeyedAccessGrowMode grow_mode)
Definition: ic.cc:1057
static TypeInfo ComputeNewType(TypeInfo type, TypeInfo previous)
Definition: ic.cc:2258
Handle< Object > TryCallAsFunction(Handle< Object > object)
Definition: ic.cc:466
static void GenerateSlow(MacroAssembler *masm)
static void GenerateMiss(MacroAssembler *masm, int argc, Code::ExtraICState extra_state)
Definition: ic.h:278
InlineCacheState State
Definition: ic.h:82
static void GenerateRuntimeSetProperty(MacroAssembler *masm, StrictModeFlag strict_mode)
MUST_USE_RESULT MaybeObject * Load(State state, Handle< Object > object, Handle< Object > key, bool force_generic_stub)
Definition: ic.cc:1098
static const int kSlowCaseBitFieldMask
Definition: ic.h:508
static void GenerateNormal(MacroAssembler *masm, int argc)
#define IC_UTIL_LIST(ICU)
Definition: ic.h:40
InlinedSmiCheck
Definition: ic.h:841
ExtraICState extra_ic_state()
Definition: objects-inl.h:3037
static void GenerateMonomorphicCacheProbe(MacroAssembler *masm, int argc, Code::Kind kind, Code::ExtraICState extra_state)
static void GenerateString(MacroAssembler *masm)
static Token::Value ComputeOperation(Code *target)
Definition: ic.cc:2558
static Handle< T > null()
Definition: handles.h:86
virtual Handle< Code > ComputePolymorphicStub(MapHandleList *receiver_maps, StrictModeFlag strict_mode, KeyedAccessGrowMode grow_mode)
Definition: ic.cc:1747
CallICBase(Code::Kind kind, Isolate *isolate)
Definition: ic.h:214
LoadIC(Isolate *isolate)
Definition: ic.h:324
static JSObject * GetCodeCacheHolder(Object *object, InlineCacheHolderFlag holder)
Definition: ic-inl.h:127
static void SetTargetAtAddress(Address address, Code *target)
Definition: ic-inl.h:80
virtual Handle< Code > ComputePolymorphicStub(MapHandleList *receiver_maps, StrictModeFlag strict_mode, KeyedAccessGrowMode grow_mode)=0
static void GenerateNonStrictArguments(MacroAssembler *masm)
static State ComputeState(Code *target)
Definition: ic.cc:2550
virtual Handle< Code > string_stub()
Definition: ic.h:430
static void GenerateMegamorphic(MacroAssembler *masm, int argc, Code::ExtraICState extra_ic_state)
Handle< Code > ComputeMonomorphicStub(LookupResult *lookup, State state, Code::ExtraICState extra_state, Handle< Object > object, Handle< String > name)
Definition: ic.cc:638
Handle< Code > ComputeStub(Handle< JSObject > receiver, StubKind stub_kind, StrictModeFlag strict_mode, Handle< Code > default_stub)
Definition: ic.cc:1577
static void GenerateNormal(MacroAssembler *masm)
static void GenerateFunctionPrototype(MacroAssembler *masm)
static void GenerateIndexedInterceptor(MacroAssembler *masm)
bool TryUpdateExtraICState(LookupResult *lookup, Handle< Object > object, Code::ExtraICState *extra_ic_state)
Definition: ic.cc:594
static void GenerateInitialize(MacroAssembler *masm)
Definition: ic.h:578
void set_target(Code *code)
Definition: ic.h:149
virtual Handle< Code > GetElementStubWithoutMapCheck(bool is_js_array, ElementsKind elements_kind, KeyedAccessGrowMode grow_mode)=0
static TypeInfo JoinTypes(TypeInfo x, TypeInfo y)
Definition: ic.cc:2319
KeyedStoreIC(Isolate *isolate)
Definition: ic.h:636
static void GenerateNonStrictArguments(MacroAssembler *masm)
BinaryOpIC(Isolate *isolate)
Definition: ic.h:767
static void GenerateMiss(MacroAssembler *masm, bool force_generic)
virtual Code::Kind kind() const
Definition: ic.h:521
static void GenerateMiss(MacroAssembler *masm)
static void GenerateTransitionElementsSmiToDouble(MacroAssembler *masm)
static void GenerateNonStrictArguments(MacroAssembler *masm, int argc)
static void GenerateArrayLength(MacroAssembler *masm)
static const char * GetStateName(State state)
Definition: ic.cc:2564
KeyedAccessGrowMode
Definition: objects.h:141
MUST_USE_RESULT MaybeObject * Store(State state, StrictModeFlag strict_mode, Handle< Object > object, Handle< Object > name, Handle< Object > value, bool force_generic)
Definition: ic.cc:1850
#define CONST_NAME(name)
Definition: ic.h:72
void patch(Code *code)
Definition: ic.cc:2280
RelocInfo::Mode ComputeMode()
Definition: ic.cc:267
static Address AddressFromUtilityId(UtilityId id)
Definition: ic.cc:2676
static Handle< Code > GetUninitialized(Token::Value op)
Definition: ic.cc:2544
void check(i::Vector< const char > string)
static InlineCacheHolderFlag GetCodeCacheForObject(Object *object, JSObject *holder)
Definition: ic-inl.h:99
bool IsContextual(Handle< Object > receiver)
Definition: ic.h:115
static void GenerateInitialize(MacroAssembler *masm)
Definition: ic.h:648
Failure * ReferenceError(const char *type, Handle< String > name)
Definition: ic.cc:291
static void GeneratePreMonomorphic(MacroAssembler *masm)
Definition: ic.h:496
static void GenerateMiss(MacroAssembler *masm, int argc)
Definition: ic.h:311
FlagType type() const
Definition: flags.cc:1358
Handle< Code > ComputeMonomorphicStubWithoutMapCheck(Handle< Map > receiver_map, StrictModeFlag strict_mode, KeyedAccessGrowMode grow_mode)
Definition: ic.cc:1672
static void Clear(Address address)
Definition: ic.cc:340
virtual bool IsGeneric() const
Definition: ic.h:665
static void GenerateNormal(MacroAssembler *masm)
static void GenerateInitialize(MacroAssembler *masm, int argc)
Definition: ic.h:307
static void GenerateMiss(MacroAssembler *masm, bool force_generic)