V8 Project
code-stubs.h
Go to the documentation of this file.
1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef V8_CODE_STUBS_H_
6 #define V8_CODE_STUBS_H_
7 
8 #include "src/allocation.h"
9 #include "src/assembler.h"
10 #include "src/codegen.h"
11 #include "src/globals.h"
12 #include "src/ic/ic-state.h"
14 #include "src/macro-assembler.h"
15 #include "src/ostreams.h"
16 
17 namespace v8 {
18 namespace internal {
19 
20 // List of code stubs used on all platforms.
21 #define CODE_STUB_LIST_ALL_PLATFORMS(V) \
22  /* PlatformCodeStubs */ \
23  V(ArgumentsAccess) \
24  V(ArrayConstructor) \
25  V(BinaryOpICWithAllocationSite) \
26  V(CallApiFunction) \
27  V(CallApiGetter) \
28  V(CallConstruct) \
29  V(CallFunction) \
30  V(CallIC) \
31  V(CallIC_Array) \
32  V(CEntry) \
33  V(CompareIC) \
34  V(DoubleToI) \
35  V(FunctionPrototype) \
36  V(Instanceof) \
37  V(InternalArrayConstructor) \
38  V(JSEntry) \
39  V(KeyedLoadICTrampoline) \
40  V(LoadICTrampoline) \
41  V(LoadIndexedInterceptor) \
42  V(MathPow) \
43  V(ProfileEntryHook) \
44  V(RecordWrite) \
45  V(RegExpExec) \
46  V(StoreArrayLiteralElement) \
47  V(StoreBufferOverflow) \
48  V(StoreElement) \
49  V(StringCompare) \
50  V(StubFailureTrampoline) \
51  V(SubString) \
52  /* HydrogenCodeStubs */ \
53  V(ArrayNArgumentsConstructor) \
54  V(ArrayNoArgumentConstructor) \
55  V(ArraySingleArgumentConstructor) \
56  V(BinaryOpIC) \
57  V(BinaryOpWithAllocationSite) \
58  V(CompareNilIC) \
59  V(CreateAllocationSite) \
60  V(ElementsTransitionAndStore) \
61  V(FastCloneShallowArray) \
62  V(FastCloneShallowObject) \
63  V(FastNewClosure) \
64  V(FastNewContext) \
65  V(InternalArrayNArgumentsConstructor) \
66  V(InternalArrayNoArgumentConstructor) \
67  V(InternalArraySingleArgumentConstructor) \
68  V(KeyedLoadGeneric) \
69  V(LoadDictionaryElement) \
70  V(LoadFastElement) \
71  V(MegamorphicLoad) \
72  V(NameDictionaryLookup) \
73  V(NumberToString) \
74  V(RegExpConstructResult) \
75  V(StoreFastElement) \
76  V(StringAdd) \
77  V(ToBoolean) \
78  V(ToNumber) \
79  V(TransitionElementsKind) \
80  V(VectorKeyedLoad) \
81  V(VectorLoad) \
82  /* IC Handler stubs */ \
83  V(LoadConstant) \
84  V(LoadField) \
85  V(KeyedLoadSloppyArguments) \
86  V(StoreField) \
87  V(StoreGlobal) \
88  V(StringLength)
89 
90 // List of code stubs only used on ARM 32 bits platforms.
91 #if V8_TARGET_ARCH_ARM
92 #define CODE_STUB_LIST_ARM(V) \
93  V(DirectCEntry) \
94  V(WriteInt32ToHeapNumber)
95 
96 #else
97 #define CODE_STUB_LIST_ARM(V)
98 #endif
99 
100 // List of code stubs only used on ARM 64 bits platforms.
101 #if V8_TARGET_ARCH_ARM64
102 #define CODE_STUB_LIST_ARM64(V) \
103  V(DirectCEntry) \
104  V(RestoreRegistersState) \
105  V(StoreRegistersState)
106 
107 #else
108 #define CODE_STUB_LIST_ARM64(V)
109 #endif
110 
111 // List of code stubs only used on MIPS platforms.
112 #if V8_TARGET_ARCH_MIPS
113 #define CODE_STUB_LIST_MIPS(V) \
114  V(DirectCEntry) \
115  V(RestoreRegistersState) \
116  V(StoreRegistersState) \
117  V(WriteInt32ToHeapNumber)
118 #elif V8_TARGET_ARCH_MIPS64
119 #define CODE_STUB_LIST_MIPS(V) \
120  V(DirectCEntry) \
121  V(RestoreRegistersState) \
122  V(StoreRegistersState) \
123  V(WriteInt32ToHeapNumber)
124 #else
125 #define CODE_STUB_LIST_MIPS(V)
126 #endif
127 
128 // Combined list of code stubs.
129 #define CODE_STUB_LIST(V) \
130  CODE_STUB_LIST_ALL_PLATFORMS(V) \
131  CODE_STUB_LIST_ARM(V) \
132  CODE_STUB_LIST_ARM64(V) \
133  CODE_STUB_LIST_MIPS(V)
134 
135 // Stub is base classes of all stubs.
136 class CodeStub BASE_EMBEDDED {
137  public:
138  enum Major {
139  // TODO(mvstanton): eliminate the NoCache key by getting rid
140  // of the non-monomorphic-cache.
141  NoCache = 0, // marker for stubs that do custom caching]
142 #define DEF_ENUM(name) name,
144 #undef DEF_ENUM
145  NUMBER_OF_IDS
146  };
147 
148  // Retrieve the code for the stub. Generate the code if needed.
150 
151  // Retrieve the code for the stub, make and return a copy of the code.
153 
155  return static_cast<Major>(MajorKeyBits::decode(key));
156  }
158  return MinorKeyBits::decode(key);
159  }
160 
161  // Gets the major key from a code object that is a code stub or binary op IC.
162  static Major GetMajorKey(Code* code_stub) {
163  return MajorKeyFromKey(code_stub->stub_key());
164  }
165 
166  static uint32_t NoCacheKey() { return MajorKeyBits::encode(NoCache); }
167 
168  static const char* MajorName(Major major_key, bool allow_unknown_keys);
169 
170  explicit CodeStub(Isolate* isolate) : minor_key_(0), isolate_(isolate) {}
171  virtual ~CodeStub() {}
172 
173  static void GenerateStubsAheadOfTime(Isolate* isolate);
174  static void GenerateFPStubs(Isolate* isolate);
175 
176  // Some stubs put untagged junk on the stack that cannot be scanned by the
177  // GC. This means that we must be statically sure that no GC can occur while
178  // they are running. If that is the case they should override this to return
179  // true, which will cause an assertion if we try to call something that can
180  // GC or if we try to put a stack frame on top of the junk, which would not
181  // result in a traversable stack.
182  virtual bool SometimesSetsUpAFrame() { return true; }
183 
184  // Lookup the code in the (possibly custom) cache.
185  bool FindCodeInCache(Code** code_out);
186 
188 
189  virtual void InitializeDescriptor(CodeStubDescriptor* descriptor) {}
190 
191  static void InitializeDescriptor(Isolate* isolate, uint32_t key,
192  CodeStubDescriptor* desc);
193 
194  static MaybeHandle<Code> GetCode(Isolate* isolate, uint32_t key);
195 
196  // Returns information for computing the number key.
197  virtual Major MajorKey() const = 0;
198  uint32_t MinorKey() const { return minor_key_; }
199 
200  virtual InlineCacheState GetICState() const { return UNINITIALIZED; }
201  virtual ExtraICState GetExtraICState() const { return kNoExtraICState; }
203  return Code::NORMAL;
204  }
205 
206  friend OStream& operator<<(OStream& os, const CodeStub& s) {
207  s.PrintName(os);
208  return os;
209  }
210 
211  Isolate* isolate() const { return isolate_; }
212 
213  protected:
214  CodeStub(uint32_t key, Isolate* isolate)
215  : minor_key_(MinorKeyFromKey(key)), isolate_(isolate) {}
216 
217  // Generates the assembler code for the stub.
218  virtual Handle<Code> GenerateCode() = 0;
219 
220  // Returns whether the code generated for this stub needs to be allocated as
221  // a fixed (non-moveable) code object.
222  virtual bool NeedsImmovableCode() { return false; }
223 
224  virtual void PrintName(OStream& os) const; // NOLINT
225  virtual void PrintBaseName(OStream& os) const; // NOLINT
226  virtual void PrintState(OStream& os) const { ; } // NOLINT
227 
228  // Computes the key based on major and minor.
230  DCHECK(static_cast<int>(MajorKey()) < NUMBER_OF_IDS);
231  return MinorKeyBits::encode(MinorKey()) | MajorKeyBits::encode(MajorKey());
232  }
233 
235 
236  private:
237  // Perform bookkeeping required after code generation when stub code is
238  // initially generated.
240 
241  // Finish the code object after it has been generated.
242  virtual void FinishCode(Handle<Code> code) { }
243 
244  // Activate newly generated stub. Is called after
245  // registering stub in the stub cache.
246  virtual void Activate(Code* code) { }
247 
248  // BinaryOpStub needs to override this.
249  virtual Code::Kind GetCodeKind() const;
250 
251  // Add the code to a specialized cache, specific to an individual
252  // stub type. Please note, this method must add the code object to a
253  // roots object, otherwise we will remove the code during GC.
254  virtual void AddToSpecialCache(Handle<Code> new_object) { }
255 
256  // Find code in a specialized cache, work is delegated to the specific stub.
257  virtual bool FindCodeInSpecialCache(Code** code_out) {
258  return false;
259  }
260 
261  // If a stub uses a special cache override this.
262  virtual bool UseSpecialCache() { return false; }
263 
264  // We use this dispatch to statically instantiate the correct code stub for
265  // the given stub key and call the passed function with that code stub.
266  typedef void (*DispatchedCall)(CodeStub* stub, void** value_out);
267  static void Dispatch(Isolate* isolate, uint32_t key, void** value_out,
268  DispatchedCall call);
269 
270  static void GetCodeDispatchCall(CodeStub* stub, void** value_out);
271 
272  STATIC_ASSERT(NUMBER_OF_IDS < (1 << kStubMajorKeyBits));
273  class MajorKeyBits: public BitField<uint32_t, 0, kStubMajorKeyBits> {};
274  class MinorKeyBits: public BitField<uint32_t,
275  kStubMajorKeyBits, kStubMinorKeyBits> {}; // NOLINT
276 
277  friend class BreakPointIterator;
278 
279  Isolate* isolate_;
280 };
281 
282 
283 #define DEFINE_CODE_STUB_BASE(NAME, SUPER) \
284  public: \
285  NAME(uint32_t key, Isolate* isolate) : SUPER(key, isolate) {} \
286  \
287  private: \
288  DISALLOW_COPY_AND_ASSIGN(NAME)
289 
290 
291 #define DEFINE_CODE_STUB(NAME, SUPER) \
292  protected: \
293  virtual inline Major MajorKey() const OVERRIDE { \
294  return NAME; \
295  }; \
296  DEFINE_CODE_STUB_BASE(NAME##Stub, SUPER)
297 
298 
299 #define DEFINE_PLATFORM_CODE_STUB(NAME, SUPER) \
300  private: \
301  virtual void Generate(MacroAssembler* masm) OVERRIDE; \
302  DEFINE_CODE_STUB(NAME, SUPER)
303 
304 
305 #define DEFINE_HYDROGEN_CODE_STUB(NAME, SUPER) \
306  public: \
307  virtual void InitializeDescriptor(CodeStubDescriptor* descriptor) OVERRIDE; \
308  virtual Handle<Code> GenerateCode() OVERRIDE; \
309  DEFINE_CODE_STUB(NAME, SUPER)
310 
311 #define DEFINE_HANDLER_CODE_STUB(NAME, SUPER) \
312  public: \
313  virtual Handle<Code> GenerateCode() OVERRIDE; \
314  DEFINE_CODE_STUB(NAME, SUPER)
315 
316 #define DEFINE_CALL_INTERFACE_DESCRIPTOR(NAME) \
317  public: \
318  virtual CallInterfaceDescriptor GetCallInterfaceDescriptor() OVERRIDE { \
319  return NAME##Descriptor(isolate()); \
320  }
321 
322 // There are some code stubs we just can't describe right now with a
323 // CallInterfaceDescriptor. Isolate behavior for those cases with this macro.
324 // An attempt to retrieve a descriptor will fail.
325 #define DEFINE_NULL_CALL_INTERFACE_DESCRIPTOR() \
326  public: \
327  virtual CallInterfaceDescriptor GetCallInterfaceDescriptor() OVERRIDE { \
328  UNREACHABLE(); \
329  return CallInterfaceDescriptor(); \
330  }
331 
332 
333 class PlatformCodeStub : public CodeStub {
334  public:
335  // Retrieve the code for the stub. Generate the code if needed.
337 
338  virtual Code::Kind GetCodeKind() const { return Code::STUB; }
339 
340  protected:
341  explicit PlatformCodeStub(Isolate* isolate) : CodeStub(isolate) {}
342 
343  // Generates the assembler code for the stub.
344  virtual void Generate(MacroAssembler* masm) = 0;
345 
347 };
348 
349 
352 
353 
355  public:
356  explicit CodeStubDescriptor(CodeStub* stub);
357 
358  CodeStubDescriptor(Isolate* isolate, uint32_t stub_key);
359 
368 
369  void SetMissHandler(ExternalReference handler) {
370  miss_handler_ = handler;
371  has_miss_handler_ = true;
372  // Our miss handler infrastructure doesn't currently support
373  // variable stack parameter counts.
375  }
376 
379 
382  }
383 
386  }
387 
388  ExternalReference miss_handler() const {
390  return miss_handler_;
391  }
392 
393  bool has_miss_handler() const {
394  return has_miss_handler_;
395  }
396 
397  bool IsEnvironmentParameterCountRegister(int index) const {
400  }
401 
405  params += 1;
406  }
407  return params;
408  }
409 
414 
415  private:
418  // If hint_stack_parameter_count_ > 0, the code stub can optimize the
419  // return sequence. Default value is -1, which means it is ignored.
422 
425 
426  ExternalReference miss_handler_;
428 };
429 
430 
431 class HydrogenCodeStub : public CodeStub {
432  public:
436  };
437 
438  virtual Code::Kind GetCodeKind() const { return Code::STUB; }
439 
440  template<class SubClass>
442  SubClass::GenerateAheadOfTime(isolate);
443  return SubClass().GetCode(isolate);
444  }
445 
446  // Retrieve the code for the stub. Generate the code if needed.
447  virtual Handle<Code> GenerateCode() = 0;
448 
449  bool IsUninitialized() const { return IsMissBits::decode(minor_key_); }
450 
451  Handle<Code> GenerateLightweightMissCode(ExternalReference miss);
452 
453  template<class StateType>
454  void TraceTransition(StateType from, StateType to);
455 
456  protected:
457  explicit HydrogenCodeStub(Isolate* isolate,
459  : CodeStub(isolate) {
460  minor_key_ = IsMissBits::encode(state == UNINITIALIZED);
461  }
462 
464  minor_key_ = SubMinorKeyBits::update(minor_key_, key);
465  }
466 
467  uint32_t sub_minor_key() const { return SubMinorKeyBits::decode(minor_key_); }
468 
469  static const int kSubMinorKeyBits = kStubMinorKeyBits - 1;
470 
471  private:
472  class IsMissBits : public BitField<bool, kSubMinorKeyBits, 1> {};
473  class SubMinorKeyBits : public BitField<int, 0, kSubMinorKeyBits> {};
474 
475  void GenerateLightweightMiss(MacroAssembler* masm, ExternalReference miss);
476 
478 };
479 
480 
481 // Helper interface to prepare to/restore after making runtime calls.
483  public:
484  virtual ~RuntimeCallHelper() {}
485 
486  virtual void BeforeCall(MacroAssembler* masm) const = 0;
487 
488  virtual void AfterCall(MacroAssembler* masm) const = 0;
489 
490  protected:
492 
493  private:
495 };
496 
497 
498 } } // namespace v8::internal
499 
500 #if V8_TARGET_ARCH_IA32
502 #elif V8_TARGET_ARCH_X64
503 #include "src/x64/code-stubs-x64.h"
504 #elif V8_TARGET_ARCH_ARM64
506 #elif V8_TARGET_ARCH_ARM
507 #include "src/arm/code-stubs-arm.h"
508 #elif V8_TARGET_ARCH_MIPS
510 #elif V8_TARGET_ARCH_MIPS64
512 #elif V8_TARGET_ARCH_X87
513 #include "src/x87/code-stubs-x87.h"
514 #else
515 #error Unsupported target architecture.
516 #endif
517 
518 namespace v8 {
519 namespace internal {
520 
521 
522 // RuntimeCallHelper implementation used in stubs: enters/leaves a
523 // newly created internal frame before/after the runtime call.
525  public:
527 
528  virtual void BeforeCall(MacroAssembler* masm) const;
529 
530  virtual void AfterCall(MacroAssembler* masm) const;
531 };
532 
533 
534 // Trivial RuntimeCallHelper implementation.
536  public:
538 
539  virtual void BeforeCall(MacroAssembler* masm) const {}
540 
541  virtual void AfterCall(MacroAssembler* masm) const {}
542 };
543 
544 
546  public:
547  explicit ToNumberStub(Isolate* isolate) : HydrogenCodeStub(isolate) { }
548 
551 };
552 
553 
554 class NumberToStringStub FINAL : public HydrogenCodeStub {
555  public:
556  explicit NumberToStringStub(Isolate* isolate) : HydrogenCodeStub(isolate) {}
557 
558  // Parameters accessed via CodeStubGraphBuilder::GetParameter()
559  static const int kNumber = 0;
560 
563 };
564 
565 
567  public:
570  : HydrogenCodeStub(isolate) {
574  }
575 
578  }
579 
580  FunctionKind kind() const {
582  }
583  bool is_arrow() const { return IsArrowFunction(kind()); }
584  bool is_generator() const { return IsGeneratorFunction(kind()); }
585  bool is_concise_method() const { return IsConciseMethod(kind()); }
586 
587  private:
588  class StrictModeBits : public BitField<StrictMode, 0, 1> {};
589  class FunctionKindBits : public BitField<FunctionKind, 1, 3> {};
590 
593 };
594 
595 
596 class FastNewContextStub FINAL : public HydrogenCodeStub {
597  public:
598  static const int kMaximumSlots = 64;
599 
600  FastNewContextStub(Isolate* isolate, int slots) : HydrogenCodeStub(isolate) {
601  DCHECK(slots > 0 && slots <= kMaximumSlots);
602  set_sub_minor_key(SlotsBits::encode(slots));
603  }
604 
605  int slots() const { return SlotsBits::decode(sub_minor_key()); }
606 
607  // Parameters accessed via CodeStubGraphBuilder::GetParameter()
608  static const int kFunction = 0;
609 
610  private:
611  class SlotsBits : public BitField<int, 0, 8> {};
612 
615 };
616 
617 
619  public:
622  : HydrogenCodeStub(isolate) {
624  }
625 
628  }
629 
630  private:
631  class AllocationSiteModeBits: public BitField<AllocationSiteMode, 0, 1> {};
632 
633  DEFINE_CALL_INTERFACE_DESCRIPTOR(FastCloneShallowArray);
635 };
636 
637 
639  public:
640  // Maximum number of properties in copied object.
641  static const int kMaximumClonedProperties = 6;
642 
644  : HydrogenCodeStub(isolate) {
645  DCHECK_GE(length, 0);
648  }
649 
650  int length() const { return LengthBits::decode(sub_minor_key()); }
651 
652  private:
653  class LengthBits : public BitField<int, 0, 4> {};
654 
655  DEFINE_CALL_INTERFACE_DESCRIPTOR(FastCloneShallowObject);
656  DEFINE_HYDROGEN_CODE_STUB(FastCloneShallowObject, HydrogenCodeStub);
657 };
658 
659 
661  public:
663  : HydrogenCodeStub(isolate) { }
664 
665  static void GenerateAheadOfTime(Isolate* isolate);
666 
667  DEFINE_CALL_INTERFACE_DESCRIPTOR(CreateAllocationSite);
669 };
670 
671 
673  public:
674  enum Flags {
675  kNoFlags = 0,
678  kReturnTrueFalseObject = 1 << 2
679  };
680 
682  minor_key_ = FlagBits::encode(flags);
683  }
684 
685  static Register left() { return InstanceofDescriptor::left(); }
687 
689  if (HasArgsInRegisters()) {
690  return InstanceofDescriptor(isolate());
691  }
692  return ContextOnlyDescriptor(isolate());
693  }
694 
695  private:
696  Flags flags() const { return FlagBits::decode(minor_key_); }
697 
698  bool HasArgsInRegisters() const { return (flags() & kArgsInRegisters) != 0; }
699 
700  bool HasCallSiteInlineCheck() const {
701  return (flags() & kCallSiteInlineCheck) != 0;
702  }
703 
704  bool ReturnTrueFalseObject() const {
705  return (flags() & kReturnTrueFalseObject) != 0;
706  }
707 
708  virtual void PrintName(OStream& os) const OVERRIDE; // NOLINT
709 
710  class FlagBits : public BitField<Flags, 0, 3> {};
711 
713 };
714 
715 
720 };
721 
722 
724  public:
726 
728 
729  explicit ArrayConstructorStub(Isolate* isolate);
730 
731  private:
733  return ArgumentCountBits::decode(minor_key_);
734  }
735 
738 
739  virtual void PrintName(OStream& os) const OVERRIDE; // NOLINT
740 
741  class ArgumentCountBits : public BitField<ArgumentCountKey, 0, 2> {};
742 
745 };
746 
747 
749  public:
750  explicit InternalArrayConstructorStub(Isolate* isolate);
751 
752  private:
754 
755  DEFINE_CALL_INTERFACE_DESCRIPTOR(InternalArrayConstructor);
756  DEFINE_PLATFORM_CODE_STUB(InternalArrayConstructor, PlatformCodeStub);
757 };
758 
759 
761  public:
763 
765  : PlatformCodeStub(isolate) {
767  }
768 
770  if (exponent_type() == TAGGED) {
771  return MathPowTaggedDescriptor(isolate());
772  } else if (exponent_type() == INTEGER) {
773  return MathPowIntegerDescriptor(isolate());
774  }
775  // A CallInterfaceDescriptor doesn't specify double registers (yet).
776  return ContextOnlyDescriptor(isolate());
777  }
778 
779  private:
781  return ExponentTypeBits::decode(minor_key_);
782  }
783 
784  class ExponentTypeBits : public BitField<ExponentType, 0, 2> {};
785 
787 };
788 
789 
791  public:
792  CallICStub(Isolate* isolate, const CallICState& state)
793  : PlatformCodeStub(isolate) {
794  minor_key_ = state.GetExtraICState();
795  }
796 
797  static int ExtractArgcFromMinorKey(int minor_key) {
798  CallICState state(static_cast<ExtraICState>(minor_key));
799  return state.arg_count();
800  }
801 
802  virtual Code::Kind GetCodeKind() const OVERRIDE { return Code::CALL_IC; }
803 
804  virtual InlineCacheState GetICState() const OVERRIDE { return DEFAULT; }
805 
807  return static_cast<ExtraICState>(minor_key_);
808  }
809 
810  protected:
811  bool CallAsMethod() const {
812  return state().call_type() == CallICState::METHOD;
813  }
814 
815  int arg_count() const { return state().arg_count(); }
816 
817  CallICState state() const {
818  return CallICState(static_cast<ExtraICState>(minor_key_));
819  }
820 
821  // Code generation helpers.
823 
824  private:
825  virtual void PrintState(OStream& os) const OVERRIDE; // NOLINT
826 
827  DEFINE_CALL_INTERFACE_DESCRIPTOR(CallFunctionWithFeedback);
829 };
830 
831 
833  public:
834  CallIC_ArrayStub(Isolate* isolate, const CallICState& state_in)
835  : CallICStub(isolate, state_in) {}
836 
838  return MONOMORPHIC;
839  }
840 
841  private:
842  virtual void PrintState(OStream& os) const OVERRIDE; // NOLINT
843 
845 };
846 
847 
848 // TODO(verwaest): Translate to hydrogen code stub.
850  public:
851  explicit FunctionPrototypeStub(Isolate* isolate)
852  : PlatformCodeStub(isolate) {}
853 
854  virtual Code::Kind GetCodeKind() const { return Code::HANDLER; }
855 
856  // TODO(mvstanton): only the receiver register is accessed. When this is
857  // translated to a hydrogen code stub, a new CallInterfaceDescriptor
858  // should be created that just uses that register for more efficient code.
861 };
862 
863 
864 // TODO(mvstanton): Translate to hydrogen code stub.
866  public:
868  : PlatformCodeStub(isolate) {}
869 
870  virtual Code::Kind GetCodeKind() const { return Code::HANDLER; }
871  virtual Code::StubType GetStubType() { return Code::FAST; }
872 
874  DEFINE_PLATFORM_CODE_STUB(LoadIndexedInterceptor, PlatformCodeStub);
875 };
876 
877 
879  public:
880  virtual Code::Kind GetCodeKind() const { return Code::HANDLER; }
881  virtual ExtraICState GetExtraICState() const { return kind(); }
882  virtual InlineCacheState GetICState() const { return MONOMORPHIC; }
883 
884  virtual void InitializeDescriptor(CodeStubDescriptor* descriptor) OVERRIDE;
885 
887 
888  protected:
889  explicit HandlerStub(Isolate* isolate) : HydrogenCodeStub(isolate) {}
890 
891  virtual Code::Kind kind() const = 0;
892 
894 };
895 
896 
897 class LoadFieldStub: public HandlerStub {
898  public:
899  LoadFieldStub(Isolate* isolate, FieldIndex index) : HandlerStub(isolate) {
900  int property_index_key = index.GetFieldAccessStubKey();
901  set_sub_minor_key(LoadFieldByIndexBits::encode(property_index_key));
902  }
903 
904  FieldIndex index() const {
905  int property_index_key = LoadFieldByIndexBits::decode(sub_minor_key());
906  return FieldIndex::FromFieldAccessStubKey(property_index_key);
907  }
908 
909  protected:
910  virtual Code::Kind kind() const { return Code::LOAD_IC; }
911  virtual Code::StubType GetStubType() { return Code::FAST; }
912 
913  private:
914  class LoadFieldByIndexBits : public BitField<int, 0, 13> {};
915 
917 };
918 
919 
921  public:
923  : HandlerStub(isolate) {}
924 
925  protected:
926  virtual Code::Kind kind() const { return Code::KEYED_LOAD_IC; }
927  virtual Code::StubType GetStubType() { return Code::FAST; }
928 
929  private:
930  DEFINE_HANDLER_CODE_STUB(KeyedLoadSloppyArguments, HandlerStub);
931 };
932 
933 
935  public:
937  : HandlerStub(isolate) {
939  }
940 
941  int constant_index() const {
943  }
944 
945  protected:
946  virtual Code::Kind kind() const { return Code::LOAD_IC; }
947  virtual Code::StubType GetStubType() { return Code::FAST; }
948 
949  private:
950  class ConstantIndexBits : public BitField<int, 0, kSubMinorKeyBits> {};
951 
953 };
954 
955 
957  public:
958  explicit StringLengthStub(Isolate* isolate) : HandlerStub(isolate) {}
959 
960  protected:
961  virtual Code::Kind kind() const { return Code::LOAD_IC; }
962  virtual Code::StubType GetStubType() { return Code::FAST; }
963 
965 };
966 
967 
968 class StoreFieldStub : public HandlerStub {
969  public:
970  StoreFieldStub(Isolate* isolate, FieldIndex index,
972  : HandlerStub(isolate) {
973  int property_index_key = index.GetFieldAccessStubKey();
974  uint8_t repr = PropertyDetails::EncodeRepresentation(representation);
977  }
978 
979  FieldIndex index() const {
980  int property_index_key = StoreFieldByIndexBits::decode(sub_minor_key());
981  return FieldIndex::FromFieldAccessStubKey(property_index_key);
982  }
983 
985  uint8_t repr = RepresentationBits::decode(sub_minor_key());
986  return PropertyDetails::DecodeRepresentation(repr);
987  }
988 
989  protected:
990  virtual Code::Kind kind() const { return Code::STORE_IC; }
991  virtual Code::StubType GetStubType() { return Code::FAST; }
992 
993  private:
994  class StoreFieldByIndexBits : public BitField<int, 0, 13> {};
995  class RepresentationBits : public BitField<uint8_t, 13, 4> {};
996 
998 };
999 
1000 
1002  public:
1004  : HandlerStub(isolate) {
1007  }
1008 
1010  return isolate->factory()->uninitialized_value();
1011  }
1012 
1014  Handle<PropertyCell> cell) {
1015  if (check_global()) {
1017  pattern.Add(Handle<Map>(global_placeholder(isolate())->map()), global);
1018  pattern.Add(isolate()->factory()->meta_map(), Handle<Map>(global->map()));
1019  pattern.Add(isolate()->factory()->global_property_cell_map(), cell);
1020  return CodeStub::GetCodeCopy(pattern);
1021  } else {
1023  pattern.Add(isolate()->factory()->global_property_cell_map(), cell);
1024  return CodeStub::GetCodeCopy(pattern);
1025  }
1026  }
1027 
1028  virtual Code::Kind kind() const { return Code::STORE_IC; }
1029 
1031 
1033 
1034  void set_is_constant(bool value) {
1036  }
1037 
1039  return Representation::FromKind(
1041  }
1042 
1045  }
1046 
1047  private:
1048  class IsConstantBits: public BitField<bool, 0, 1> {};
1049  class RepresentationBits: public BitField<Representation::Kind, 1, 8> {};
1050  class CheckGlobalBits: public BitField<bool, 9, 1> {};
1051 
1053 };
1054 
1055 
1057  public:
1059  bool is_store,
1060  bool call_data_undefined,
1061  int argc) : PlatformCodeStub(isolate) {
1062  minor_key_ = IsStoreBits::encode(is_store) |
1065  DCHECK(!is_store || argc == 1);
1066  }
1067 
1068  private:
1069  bool is_store() const { return IsStoreBits::decode(minor_key_); }
1070  bool call_data_undefined() const {
1071  return CallDataUndefinedBits::decode(minor_key_);
1072  }
1073  int argc() const { return ArgumentBits::decode(minor_key_); }
1074 
1075  class IsStoreBits: public BitField<bool, 0, 1> {};
1076  class CallDataUndefinedBits: public BitField<bool, 1, 1> {};
1077  class ArgumentBits: public BitField<int, 2, Code::kArgumentsBits> {};
1079 
1082 };
1083 
1084 
1086  public:
1087  explicit CallApiGetterStub(Isolate* isolate) : PlatformCodeStub(isolate) {}
1088 
1091 };
1092 
1093 
1095  public:
1098  : HydrogenCodeStub(isolate, UNINITIALIZED) {
1099  BinaryOpICState state(isolate, op, mode);
1100  set_sub_minor_key(state.GetExtraICState());
1101  }
1102 
1103  BinaryOpICStub(Isolate* isolate, const BinaryOpICState& state)
1104  : HydrogenCodeStub(isolate) {
1105  set_sub_minor_key(state.GetExtraICState());
1106  }
1107 
1108  static void GenerateAheadOfTime(Isolate* isolate);
1109 
1110  virtual Code::Kind GetCodeKind() const OVERRIDE {
1111  return Code::BINARY_OP_IC;
1112  }
1113 
1115  return state().GetICState();
1116  }
1117 
1119  return static_cast<ExtraICState>(sub_minor_key());
1120  }
1121 
1122  BinaryOpICState state() const {
1123  return BinaryOpICState(isolate(), GetExtraICState());
1124  }
1125 
1126  virtual void PrintState(OStream& os) const FINAL OVERRIDE; // NOLINT
1127 
1128  // Parameters accessed via CodeStubGraphBuilder::GetParameter()
1129  static const int kLeft = 0;
1130  static const int kRight = 1;
1131 
1132  private:
1133  static void GenerateAheadOfTime(Isolate* isolate,
1134  const BinaryOpICState& state);
1135 
1138 };
1139 
1140 
1141 // TODO(bmeurer): Merge this into the BinaryOpICStub once we have proper tail
1142 // call support for stubs in Hydrogen.
1143 class BinaryOpICWithAllocationSiteStub FINAL : public PlatformCodeStub {
1144  public:
1146  const BinaryOpICState& state)
1147  : PlatformCodeStub(isolate) {
1148  minor_key_ = state.GetExtraICState();
1149  }
1150 
1151  static void GenerateAheadOfTime(Isolate* isolate);
1152 
1155  pattern.Add(isolate()->factory()->undefined_map(), allocation_site);
1156  return CodeStub::GetCodeCopy(pattern);
1157  }
1158 
1159  virtual Code::Kind GetCodeKind() const OVERRIDE {
1160  return Code::BINARY_OP_IC;
1161  }
1162 
1164  return state().GetICState();
1165  }
1166 
1168  return static_cast<ExtraICState>(minor_key_);
1169  }
1170 
1171  virtual void PrintState(OStream& os) const OVERRIDE; // NOLINT
1172 
1173  private:
1174  BinaryOpICState state() const {
1175  return BinaryOpICState(isolate(), static_cast<ExtraICState>(minor_key_));
1176  }
1177 
1178  static void GenerateAheadOfTime(Isolate* isolate,
1179  const BinaryOpICState& state);
1180 
1181  DEFINE_CALL_INTERFACE_DESCRIPTOR(BinaryOpWithAllocationSite);
1182  DEFINE_PLATFORM_CODE_STUB(BinaryOpICWithAllocationSite, PlatformCodeStub);
1183 };
1184 
1185 
1186 class BinaryOpWithAllocationSiteStub FINAL : public BinaryOpICStub {
1187  public:
1189  Token::Value op,
1191  : BinaryOpICStub(isolate, op, mode) {}
1192 
1193  BinaryOpWithAllocationSiteStub(Isolate* isolate, const BinaryOpICState& state)
1194  : BinaryOpICStub(isolate, state) {}
1195 
1197  return Code::STUB;
1198  }
1199 
1200  // Parameters accessed via CodeStubGraphBuilder::GetParameter()
1201  static const int kAllocationSite = 0;
1202  static const int kLeft = 1;
1203  static const int kRight = 2;
1204 
1205  DEFINE_CALL_INTERFACE_DESCRIPTOR(BinaryOpWithAllocationSite);
1206  DEFINE_HYDROGEN_CODE_STUB(BinaryOpWithAllocationSite, BinaryOpICStub);
1207 };
1208 
1209 
1211  // Omit both parameter checks.
1213  // Check left parameter.
1215  // Check right parameter.
1217  // Check both parameters.
1219 };
1220 
1221 
1222 class StringAddStub FINAL : public HydrogenCodeStub {
1223  public:
1225  PretenureFlag pretenure_flag)
1226  : HydrogenCodeStub(isolate) {
1227  set_sub_minor_key(StringAddFlagsBits::encode(flags) |
1228  PretenureFlagBits::encode(pretenure_flag));
1229  }
1230 
1232  return StringAddFlagsBits::decode(sub_minor_key());
1233  }
1234 
1236  return PretenureFlagBits::decode(sub_minor_key());
1237  }
1238 
1239  // Parameters accessed via CodeStubGraphBuilder::GetParameter()
1240  static const int kLeft = 0;
1241  static const int kRight = 1;
1242 
1243  private:
1244  class StringAddFlagsBits: public BitField<StringAddFlags, 0, 2> {};
1245  class PretenureFlagBits: public BitField<PretenureFlag, 2, 1> {};
1246 
1247  virtual void PrintBaseName(OStream& os) const OVERRIDE; // NOLINT
1248 
1251 };
1252 
1253 
1255  public:
1258  : PlatformCodeStub(isolate) {
1262  }
1263 
1265 
1266  virtual InlineCacheState GetICState() const;
1267 
1268  Token::Value op() const {
1269  return static_cast<Token::Value>(Token::EQ + OpBits::decode(minor_key_));
1270  }
1271 
1273  return LeftStateBits::decode(minor_key_);
1274  }
1276  return RightStateBits::decode(minor_key_);
1277  }
1278  CompareICState::State state() const { return StateBits::decode(minor_key_); }
1279 
1280  private:
1281  virtual Code::Kind GetCodeKind() const { return Code::COMPARE_IC; }
1282 
1292 
1293  bool strict() const { return op() == Token::EQ_STRICT; }
1294  Condition GetCondition() const;
1295 
1296  virtual void AddToSpecialCache(Handle<Code> new_object);
1297  virtual bool FindCodeInSpecialCache(Code** code_out);
1298  virtual bool UseSpecialCache() {
1299  return state() == CompareICState::KNOWN_OBJECT;
1300  }
1301 
1302  class OpBits : public BitField<int, 0, 3> {};
1303  class LeftStateBits : public BitField<CompareICState::State, 3, 4> {};
1304  class RightStateBits : public BitField<CompareICState::State, 7, 4> {};
1305  class StateBits : public BitField<CompareICState::State, 11, 4> {};
1306 
1308 
1311 };
1312 
1313 
1315  public:
1316  Type* GetType(Zone* zone, Handle<Map> map = Handle<Map>());
1318 
1321  }
1322 
1324  InitializationState init_state = INITIALIZED)
1325  : HydrogenCodeStub(isolate, init_state) {
1326  set_sub_minor_key(ic_state);
1327  }
1328 
1330  NilValue nil) {
1331  return CompareNilICStub(isolate, nil, UNINITIALIZED).GetCode();
1332  }
1333 
1334  virtual InlineCacheState GetICState() const {
1335  State state = this->state();
1336  if (state.Contains(GENERIC)) {
1337  return MEGAMORPHIC;
1338  } else if (state.Contains(MONOMORPHIC_MAP)) {
1339  return MONOMORPHIC;
1340  } else {
1341  return PREMONOMORPHIC;
1342  }
1343  }
1344 
1345  virtual Code::Kind GetCodeKind() const { return Code::COMPARE_NIL_IC; }
1346 
1347  virtual ExtraICState GetExtraICState() const { return sub_minor_key(); }
1348 
1349  void UpdateStatus(Handle<Object> object);
1350 
1351  bool IsMonomorphic() const { return state().Contains(MONOMORPHIC_MAP); }
1352 
1354 
1355  void ClearState() {
1357  }
1358 
1359  virtual void PrintState(OStream& os) const OVERRIDE; // NOLINT
1360  virtual void PrintBaseName(OStream& os) const OVERRIDE; // NOLINT
1361 
1362  private:
1364  InitializationState init_state)
1365  : HydrogenCodeStub(isolate, init_state) {
1367  }
1368 
1375  };
1376 
1377  // At most 6 different types can be distinguished, because the Code object
1378  // only has room for a single byte to hold a set and there are two more
1379  // boolean flags we need to store. :-P
1381 
1382  class State : public EnumSet<CompareNilType, byte> {
1383  public:
1385  explicit State(byte bits) : EnumSet<CompareNilType, byte>(bits) { }
1386  };
1387  friend OStream& operator<<(OStream& os, const State& s);
1388 
1390 
1391  class NilValueBits : public BitField<NilValue, 0, 1> {};
1392  class TypesBits : public BitField<byte, 1, NUMBER_OF_TYPES> {};
1393 
1394  friend class CompareNilIC;
1395 
1398 };
1399 
1400 
1402 
1403 
1405  public:
1406  CEntryStub(Isolate* isolate, int result_size,
1408  : PlatformCodeStub(isolate) {
1410  DCHECK(result_size == 1 || result_size == 2);
1411 #ifdef _WIN64
1412  minor_key_ = ResultSizeBits::update(minor_key_, result_size);
1413 #endif // _WIN64
1414  }
1415 
1416  // The version of this stub that doesn't save doubles is generated ahead of
1417  // time, so it's OK to call it from other stubs that can't cope with GC during
1418  // their code generation. On machines that always have gp registers (x64) we
1419  // can generate both variants ahead of time.
1420  static void GenerateAheadOfTime(Isolate* isolate);
1421 
1422  private:
1423  bool save_doubles() const { return SaveDoublesBits::decode(minor_key_); }
1424 #ifdef _WIN64
1425  int result_size() const { return ResultSizeBits::decode(minor_key_); }
1426 #endif // _WIN64
1427 
1429 
1430  class SaveDoublesBits : public BitField<bool, 0, 1> {};
1431  class ResultSizeBits : public BitField<int, 1, 3> {};
1432 
1435 };
1436 
1437 
1439  public:
1441  : PlatformCodeStub(isolate) {
1442  DCHECK(type == StackFrame::ENTRY || type == StackFrame::ENTRY_CONSTRUCT);
1443  minor_key_ = StackFrameTypeBits::encode(type);
1444  }
1445 
1446  private:
1447  virtual void FinishCode(Handle<Code> code);
1448 
1449  virtual void PrintName(OStream& os) const OVERRIDE { // NOLINT
1450  os << (type() == StackFrame::ENTRY ? "JSEntryStub"
1451  : "JSConstructEntryStub");
1452  }
1453 
1455  return StackFrameTypeBits::decode(minor_key_);
1456  }
1457 
1458  class StackFrameTypeBits : public BitField<StackFrame::Type, 0, 5> {};
1459 
1461 
1464 };
1465 
1466 
1468  public:
1469  enum Type {
1473  NEW_STRICT
1474  };
1475 
1477  minor_key_ = TypeBits::encode(type);
1478  }
1479 
1481  if (type() == READ_ELEMENT) {
1482  return ArgumentsAccessReadDescriptor(isolate());
1483  }
1484  return ContextOnlyDescriptor(isolate());
1485  }
1486 
1487  private:
1488  Type type() const { return TypeBits::decode(minor_key_); }
1489 
1494 
1495  virtual void PrintName(OStream& os) const OVERRIDE; // NOLINT
1496 
1497  class TypeBits : public BitField<Type, 0, 2> {};
1498 
1500 };
1501 
1502 
1504  public:
1505  explicit RegExpExecStub(Isolate* isolate) : PlatformCodeStub(isolate) { }
1506 
1509 };
1510 
1511 
1512 class RegExpConstructResultStub FINAL : public HydrogenCodeStub {
1513  public:
1515  : HydrogenCodeStub(isolate) { }
1516 
1517  // Parameters accessed via CodeStubGraphBuilder::GetParameter()
1518  static const int kLength = 0;
1519  static const int kIndex = 1;
1520  static const int kInput = 2;
1521 
1522  DEFINE_CALL_INTERFACE_DESCRIPTOR(RegExpConstructResult);
1524 };
1525 
1526 
1528  public:
1530  : PlatformCodeStub(isolate) {
1531  DCHECK(argc >= 0 && argc <= Code::kMaxArguments);
1532  minor_key_ = ArgcBits::encode(argc) | FlagBits::encode(flags);
1533  }
1534 
1535  static int ExtractArgcFromMinorKey(int minor_key) {
1536  return ArgcBits::decode(minor_key);
1537  }
1538 
1539  private:
1540  int argc() const { return ArgcBits::decode(minor_key_); }
1541  int flags() const { return FlagBits::decode(minor_key_); }
1542 
1543  bool CallAsMethod() const {
1544  return flags() == CALL_AS_METHOD || flags() == WRAP_AND_CALL;
1545  }
1546 
1547  bool NeedsChecks() const { return flags() != WRAP_AND_CALL; }
1548 
1549  virtual void PrintName(OStream& os) const OVERRIDE; // NOLINT
1550 
1551  // Minor key encoding in 32 bits with Bitfield <Type, shift, size>.
1552  class FlagBits : public BitField<CallFunctionFlags, 0, 2> {};
1553  class ArgcBits : public BitField<unsigned, 2, Code::kArgumentsBits> {};
1555 
1558 };
1559 
1560 
1562  public:
1564  : PlatformCodeStub(isolate) {
1565  minor_key_ = FlagBits::encode(flags);
1566  }
1567 
1568  virtual void FinishCode(Handle<Code> code) {
1569  code->set_has_function_cache(RecordCallTarget());
1570  }
1571 
1572  private:
1573  CallConstructorFlags flags() const { return FlagBits::decode(minor_key_); }
1574 
1575  bool RecordCallTarget() const {
1576  return (flags() & RECORD_CONSTRUCTOR_TARGET) != 0;
1577  }
1578 
1579  virtual void PrintName(OStream& os) const OVERRIDE; // NOLINT
1580 
1581  class FlagBits : public BitField<CallConstructorFlags, 0, 1> {};
1582 
1585 };
1586 
1587 
1589  // Accepts smis or heap numbers.
1591 
1592  // Accepts smis or heap numbers that are valid array indices
1593  // (ECMA-262 15.4). Invalid indices are reported as being out of
1594  // range.
1596 };
1597 
1598 
1599 // Generates code implementing String.prototype.charCodeAt.
1600 //
1601 // Only supports the case when the receiver is a string and the index
1602 // is a number (smi or heap number) that is a valid index into the
1603 // string. Additional index constraints are specified by the
1604 // flags. Otherwise, bails out to the provided labels.
1605 //
1606 // Register usage: |object| may be changed to another string in a way
1607 // that doesn't affect charCodeAt/charAt semantics, |index| is
1608 // preserved, |scratch| and |result| are clobbered.
1610  public:
1612  Register index,
1613  Register result,
1614  Label* receiver_not_string,
1615  Label* index_not_number,
1616  Label* index_out_of_range,
1617  StringIndexFlags index_flags)
1618  : object_(object),
1619  index_(index),
1620  result_(result),
1621  receiver_not_string_(receiver_not_string),
1622  index_not_number_(index_not_number),
1623  index_out_of_range_(index_out_of_range),
1624  index_flags_(index_flags) {
1625  DCHECK(!result_.is(object_));
1626  DCHECK(!result_.is(index_));
1627  }
1628 
1629  // Generates the fast case code. On the fallthrough path |result|
1630  // register contains the result.
1632 
1633  // Generates the slow case code. Must not be naturally
1634  // reachable. Expected to be put after a ret instruction (e.g., in
1635  // deferred code). Always jumps back to the fast case.
1637  const RuntimeCallHelper& call_helper);
1638 
1639  // Skip handling slow case and directly jump to bailout.
1640  void SkipSlow(MacroAssembler* masm, Label* bailout) {
1641  masm->bind(&index_not_smi_);
1642  masm->bind(&call_runtime_);
1643  masm->jmp(bailout);
1644  }
1645 
1646  private:
1650 
1654 
1656 
1660  Label exit_;
1661 
1663 };
1664 
1665 
1666 // Generates code for creating a one-char string from a char code.
1668  public:
1670  Register result)
1671  : code_(code),
1672  result_(result) {
1673  DCHECK(!code_.is(result_));
1674  }
1675 
1676  // Generates the fast case code. On the fallthrough path |result|
1677  // register contains the result.
1679 
1680  // Generates the slow case code. Must not be naturally
1681  // reachable. Expected to be put after a ret instruction (e.g., in
1682  // deferred code). Always jumps back to the fast case.
1684  const RuntimeCallHelper& call_helper);
1685 
1686  // Skip handling slow case and directly jump to bailout.
1687  void SkipSlow(MacroAssembler* masm, Label* bailout) {
1688  masm->bind(&slow_case_);
1689  masm->jmp(bailout);
1690  }
1691 
1692  private:
1695 
1696  Label slow_case_;
1697  Label exit_;
1698 
1700 };
1701 
1702 
1703 // Generates code implementing String.prototype.charAt.
1704 //
1705 // Only supports the case when the receiver is a string and the index
1706 // is a number (smi or heap number) that is a valid index into the
1707 // string. Additional index constraints are specified by the
1708 // flags. Otherwise, bails out to the provided labels.
1709 //
1710 // Register usage: |object| may be changed to another string in a way
1711 // that doesn't affect charCodeAt/charAt semantics, |index| is
1712 // preserved, |scratch1|, |scratch2|, and |result| are clobbered.
1714  public:
1716  Register index,
1717  Register scratch,
1718  Register result,
1719  Label* receiver_not_string,
1720  Label* index_not_number,
1721  Label* index_out_of_range,
1722  StringIndexFlags index_flags)
1723  : char_code_at_generator_(object,
1724  index,
1725  scratch,
1726  receiver_not_string,
1727  index_not_number,
1728  index_out_of_range,
1729  index_flags),
1730  char_from_code_generator_(scratch, result) {}
1731 
1732  // Generates the fast case code. On the fallthrough path |result|
1733  // register contains the result.
1737  }
1738 
1739  // Generates the slow case code. Must not be naturally
1740  // reachable. Expected to be put after a ret instruction (e.g., in
1741  // deferred code). Always jumps back to the fast case.
1743  const RuntimeCallHelper& call_helper) {
1744  char_code_at_generator_.GenerateSlow(masm, call_helper);
1745  char_from_code_generator_.GenerateSlow(masm, call_helper);
1746  }
1747 
1748  // Skip handling slow case and directly jump to bailout.
1749  void SkipSlow(MacroAssembler* masm, Label* bailout) {
1750  char_code_at_generator_.SkipSlow(masm, bailout);
1751  char_from_code_generator_.SkipSlow(masm, bailout);
1752  }
1753 
1754  private:
1757 
1759 };
1760 
1761 
1763  public:
1765  : HydrogenCodeStub(isolate) {}
1766 
1769 };
1770 
1771 
1773  public:
1774  explicit KeyedLoadGenericStub(Isolate* isolate) : HydrogenCodeStub(isolate) {}
1775 
1776  virtual Code::Kind GetCodeKind() const { return Code::KEYED_LOAD_IC; }
1777  virtual InlineCacheState GetICState() const { return GENERIC; }
1778 
1781 };
1782 
1783 
1785  public:
1786  LoadICTrampolineStub(Isolate* isolate, const LoadICState& state)
1787  : PlatformCodeStub(isolate) {
1788  minor_key_ = state.GetExtraICState();
1789  }
1790 
1791  virtual Code::Kind GetCodeKind() const OVERRIDE { return Code::LOAD_IC; }
1792 
1794  return GENERIC;
1795  }
1796 
1798  return static_cast<ExtraICState>(minor_key_);
1799  }
1800 
1801  private:
1802  LoadICState state() const {
1803  return LoadICState(static_cast<ExtraICState>(minor_key_));
1804  }
1805 
1806  DEFINE_CALL_INTERFACE_DESCRIPTOR(VectorLoadICTrampoline);
1808 };
1809 
1810 
1812  public:
1814  : LoadICTrampolineStub(isolate, LoadICState(0)) {}
1815 
1816  virtual Code::Kind GetCodeKind() const OVERRIDE {
1817  return Code::KEYED_LOAD_IC;
1818  }
1819 
1821 };
1822 
1823 
1825  public:
1826  MegamorphicLoadStub(Isolate* isolate, const LoadICState& state)
1827  : HydrogenCodeStub(isolate) {
1828  set_sub_minor_key(state.GetExtraICState());
1829  }
1830 
1831  virtual Code::Kind GetCodeKind() const OVERRIDE { return Code::LOAD_IC; }
1832 
1834  return MEGAMORPHIC;
1835  }
1836 
1838  return static_cast<ExtraICState>(sub_minor_key());
1839  }
1840 
1843 };
1844 
1845 
1847  public:
1848  explicit VectorLoadStub(Isolate* isolate, const LoadICState& state)
1849  : HydrogenCodeStub(isolate) {
1850  set_sub_minor_key(state.GetExtraICState());
1851  }
1852 
1853  virtual Code::Kind GetCodeKind() const OVERRIDE { return Code::LOAD_IC; }
1854 
1856  return GENERIC;
1857  }
1858 
1860  return static_cast<ExtraICState>(sub_minor_key());
1861  }
1862 
1863  private:
1864  LoadICState state() const { return LoadICState(GetExtraICState()); }
1865 
1868 };
1869 
1870 
1872  public:
1873  explicit VectorKeyedLoadStub(Isolate* isolate)
1874  : VectorLoadStub(isolate, LoadICState(0)) {}
1875 
1876  virtual Code::Kind GetCodeKind() const OVERRIDE {
1877  return Code::KEYED_LOAD_IC;
1878  }
1879 
1882 };
1883 
1884 
1886  public:
1888  int offset, bool is_truncating, bool skip_fastpath = false)
1889  : PlatformCodeStub(isolate) {
1890  minor_key_ = SourceRegisterBits::encode(source.code()) |
1896  }
1897 
1898  virtual bool SometimesSetsUpAFrame() { return false; }
1899 
1900  private:
1901  Register source() const {
1902  return Register::from_code(SourceRegisterBits::decode(minor_key_));
1903  }
1906  }
1907  bool is_truncating() const { return IsTruncatingBits::decode(minor_key_); }
1908  bool skip_fastpath() const { return SkipFastPathBits::decode(minor_key_); }
1909  int offset() const { return OffsetBits::decode(minor_key_); }
1910 
1911  static const int kBitsPerRegisterNumber = 6;
1914  public BitField<int, 0, kBitsPerRegisterNumber> {}; // NOLINT
1916  public BitField<int, kBitsPerRegisterNumber,
1917  kBitsPerRegisterNumber> {}; // NOLINT
1919  public BitField<bool, 2 * kBitsPerRegisterNumber, 1> {}; // NOLINT
1920  class OffsetBits:
1921  public BitField<int, 2 * kBitsPerRegisterNumber + 1, 3> {}; // NOLINT
1923  public BitField<int, 2 * kBitsPerRegisterNumber + 4, 1> {}; // NOLINT
1924  class SSE3Bits:
1925  public BitField<int, 2 * kBitsPerRegisterNumber + 5, 1> {}; // NOLINT
1926 
1929 };
1930 
1931 
1933  public:
1936  : HydrogenCodeStub(isolate) {
1939  }
1940 
1942 
1945  }
1946 
1947  private:
1948  class ElementsKindBits: public BitField<ElementsKind, 0, 8> {};
1949  class IsJSArrayBits: public BitField<bool, 8, 1> {};
1950 
1953 };
1954 
1955 
1957  public:
1960  : HydrogenCodeStub(isolate) {
1964  }
1965 
1967 
1970  }
1971 
1974  }
1975 
1976  private:
1977  class ElementsKindBits: public BitField<ElementsKind, 0, 8> {};
1978  class StoreModeBits: public BitField<KeyedAccessStoreMode, 8, 4> {};
1979  class IsJSArrayBits: public BitField<bool, 12, 1> {};
1980 
1983 };
1984 
1985 
1987  public:
1991  bool is_js_array) : HydrogenCodeStub(isolate) {
1995  }
1996 
1999  }
2000 
2002 
2004 
2005  private:
2006  class FromKindBits: public BitField<ElementsKind, 8, 8> {};
2007  class ToKindBits: public BitField<ElementsKind, 0, 8> {};
2008  class IsJSArrayBits: public BitField<bool, 16, 1> {};
2009 
2010  DEFINE_CALL_INTERFACE_DESCRIPTOR(TransitionElementsKind);
2012 };
2013 
2014 
2016  public:
2018  ElementsKind kind,
2020  : HydrogenCodeStub(isolate) {
2021  // It only makes sense to override local allocation site behavior
2022  // if there is a difference between the global allocation site policy
2023  // for an ElementsKind and the desired usage of the stub.
2028  }
2029 
2032  }
2033 
2036  }
2037 
2038  static void GenerateStubsAheadOfTime(Isolate* isolate);
2039 
2040  // Parameters accessed via CodeStubGraphBuilder::GetParameter()
2041  static const int kConstructor = 0;
2042  static const int kAllocationSite = 1;
2043 
2044  protected:
2045  OStream& BasePrintName(OStream& os, const char* name) const; // NOLINT
2046 
2047  private:
2048  // Ensure data fits within available bits.
2050 
2051  class ElementsKindBits: public BitField<ElementsKind, 0, 8> {};
2053  BitField<AllocationSiteOverrideMode, 8, 1> {}; // NOLINT
2054 
2056 };
2057 
2058 
2060  public:
2062  Isolate* isolate,
2063  ElementsKind kind,
2065  : ArrayConstructorStubBase(isolate, kind, override_mode) {
2066  }
2067 
2068  private:
2069  virtual void PrintName(OStream& os) const OVERRIDE { // NOLINT
2070  BasePrintName(os, "ArrayNoArgumentConstructorStub");
2071  }
2072 
2073  DEFINE_CALL_INTERFACE_DESCRIPTOR(ArrayConstructorConstantArgCount);
2074  DEFINE_HYDROGEN_CODE_STUB(ArrayNoArgumentConstructor,
2076 };
2077 
2078 
2080  public:
2082  Isolate* isolate,
2083  ElementsKind kind,
2085  : ArrayConstructorStubBase(isolate, kind, override_mode) {
2086  }
2087 
2088  private:
2089  virtual void PrintName(OStream& os) const { // NOLINT
2090  BasePrintName(os, "ArraySingleArgumentConstructorStub");
2091  }
2092 
2094  DEFINE_HYDROGEN_CODE_STUB(ArraySingleArgumentConstructor,
2096 };
2097 
2098 
2100  public:
2102  Isolate* isolate,
2103  ElementsKind kind,
2105  : ArrayConstructorStubBase(isolate, kind, override_mode) {
2106  }
2107 
2108  private:
2109  virtual void PrintName(OStream& os) const { // NOLINT
2110  BasePrintName(os, "ArrayNArgumentsConstructorStub");
2111  }
2112 
2114  DEFINE_HYDROGEN_CODE_STUB(ArrayNArgumentsConstructor,
2116 };
2117 
2118 
2120  public:
2122  : HydrogenCodeStub(isolate) {
2124  }
2125 
2126  static void GenerateStubsAheadOfTime(Isolate* isolate);
2127 
2128  // Parameters accessed via CodeStubGraphBuilder::GetParameter()
2129  static const int kConstructor = 0;
2130 
2133  }
2134 
2135  private:
2136  class ElementsKindBits : public BitField<ElementsKind, 0, 8> {};
2137 
2139 };
2140 
2141 
2144  public:
2146  ElementsKind kind)
2147  : InternalArrayConstructorStubBase(isolate, kind) { }
2148 
2149  DEFINE_CALL_INTERFACE_DESCRIPTOR(InternalArrayConstructorConstantArgCount);
2150  DEFINE_HYDROGEN_CODE_STUB(InternalArrayNoArgumentConstructor,
2152 };
2153 
2154 
2157  public:
2159  ElementsKind kind)
2160  : InternalArrayConstructorStubBase(isolate, kind) { }
2161 
2162  DEFINE_CALL_INTERFACE_DESCRIPTOR(InternalArrayConstructor);
2163  DEFINE_HYDROGEN_CODE_STUB(InternalArraySingleArgumentConstructor,
2165 };
2166 
2167 
2170  public:
2172  : InternalArrayConstructorStubBase(isolate, kind) { }
2173 
2174  DEFINE_CALL_INTERFACE_DESCRIPTOR(InternalArrayConstructor);
2175  DEFINE_HYDROGEN_CODE_STUB(InternalArrayNArgumentsConstructor,
2177 };
2178 
2179 
2181  public:
2183  : PlatformCodeStub(isolate) {
2185  }
2186 
2187  private:
2189  return ElementsKindBits::decode(minor_key_);
2190  }
2191 
2192  class ElementsKindBits : public BitField<ElementsKind, 0, 8> {};
2193 
2196 };
2197 
2198 
2200  public:
2201  enum Type {
2211  };
2212 
2213  enum ResultMode {
2214  RESULT_AS_SMI, // For Smi(1) on truthy value, Smi(0) otherwise.
2215  RESULT_AS_ODDBALL, // For {true} on truthy value, {false} otherwise.
2216  RESULT_AS_INVERSE_ODDBALL // For {false} on truthy value, {true} otherwise.
2217  };
2218 
2219  // At most 8 different types can be distinguished, because the Code object
2220  // only has room for a single byte to hold a set of these types. :-P
2222 
2223  class Types : public EnumSet<Type, byte> {
2224  public:
2225  Types() : EnumSet<Type, byte>(0) {}
2226  explicit Types(byte bits) : EnumSet<Type, byte>(bits) {}
2227 
2228  byte ToByte() const { return ToIntegral(); }
2229  bool UpdateStatus(Handle<Object> object);
2230  bool NeedsMap() const;
2231  bool CanBeUndetectable() const;
2232  bool IsGeneric() const { return ToIntegral() == Generic().ToIntegral(); }
2233 
2234  static Types Generic() { return Types((1 << NUMBER_OF_TYPES) - 1); }
2235  };
2236 
2238  : HydrogenCodeStub(isolate) {
2241  }
2242 
2244  : HydrogenCodeStub(isolate) {
2245  set_sub_minor_key(TypesBits::encode(static_cast<byte>(state)) |
2247  }
2248 
2249  bool UpdateStatus(Handle<Object> object);
2252 
2253  virtual Code::Kind GetCodeKind() const { return Code::TO_BOOLEAN_IC; }
2254  virtual void PrintState(OStream& os) const OVERRIDE; // NOLINT
2255 
2256  virtual bool SometimesSetsUpAFrame() { return false; }
2257 
2259  return ToBooleanStub(isolate, UNINITIALIZED).GetCode();
2260  }
2261 
2262  virtual ExtraICState GetExtraICState() const { return types().ToIntegral(); }
2263 
2264  virtual InlineCacheState GetICState() const {
2265  if (types().IsEmpty()) {
2267  } else {
2268  return MONOMORPHIC;
2269  }
2270  }
2271 
2272  private:
2274  : HydrogenCodeStub(isolate, init_state) {
2276  }
2277 
2278  class TypesBits : public BitField<byte, 0, NUMBER_OF_TYPES> {};
2279  class ResultModeBits : public BitField<ResultMode, NUMBER_OF_TYPES, 2> {};
2280 
2283 };
2284 
2285 
2287 
2288 
2290  public:
2294  : HydrogenCodeStub(isolate) {
2298  }
2299 
2302  bool is_jsarray() const { return IsJSArrayBits::decode(sub_minor_key()); }
2305  }
2306 
2307  // Parameters accessed via CodeStubGraphBuilder::GetParameter()
2314  };
2315 
2316  static const Register ValueRegister() {
2318  }
2319  static const Register MapRegister() {
2321  }
2322  static const Register KeyRegister() {
2324  }
2325  static const Register ObjectRegister() {
2327  }
2328 
2329  private:
2330  class FromBits : public BitField<ElementsKind, 0, 8> {};
2331  class ToBits : public BitField<ElementsKind, 8, 8> {};
2332  class IsJSArrayBits : public BitField<bool, 16, 1> {};
2333  class StoreModeBits : public BitField<KeyedAccessStoreMode, 17, 4> {};
2334 
2335  DEFINE_CALL_INTERFACE_DESCRIPTOR(ElementTransitionAndStore);
2336  DEFINE_HYDROGEN_CODE_STUB(ElementsTransitionAndStore, HydrogenCodeStub);
2337 };
2338 
2339 
2341  public:
2343  : PlatformCodeStub(isolate) { }
2344 
2345  DEFINE_CALL_INTERFACE_DESCRIPTOR(StoreArrayLiteralElement);
2346  DEFINE_PLATFORM_CODE_STUB(StoreArrayLiteralElement, PlatformCodeStub);
2347 };
2348 
2349 
2351  public:
2353  : PlatformCodeStub(isolate) {
2355  }
2356 
2357  static void GenerateAheadOfTime(Isolate* isolate);
2358 
2359  private:
2361  return FunctionModeField::decode(minor_key_);
2362  }
2363 
2364  class FunctionModeField : public BitField<StubFunctionMode, 0, 1> {};
2365 
2368 };
2369 
2370 
2372  public:
2373  explicit ProfileEntryHookStub(Isolate* isolate) : PlatformCodeStub(isolate) {}
2374 
2375  // The profile entry hook function is not allowed to cause a GC.
2376  virtual bool SometimesSetsUpAFrame() { return false; }
2377 
2378  // Generates a call to the entry hook if it's enabled.
2380 
2381  private:
2382  static void EntryHookTrampoline(intptr_t function,
2383  intptr_t stack_pointer,
2384  Isolate* isolate);
2385 
2386  // ProfileEntryHookStub is called at the start of a function, so it has the
2387  // same register set.
2388  DEFINE_CALL_INTERFACE_DESCRIPTOR(CallFunction)
2390 };
2391 
2392 
2394  public:
2396  : PlatformCodeStub(isolate) {
2397  minor_key_ = SaveDoublesBits::encode(save_fp == kSaveFPRegs);
2398  }
2399 
2401  virtual bool SometimesSetsUpAFrame() { return false; }
2402 
2403  private:
2404  bool save_doubles() const { return SaveDoublesBits::decode(minor_key_); }
2405 
2406  class SaveDoublesBits : public BitField<bool, 0, 1> {};
2407 
2410 };
2411 
2412 
2414  public:
2415  explicit SubStringStub(Isolate* isolate) : PlatformCodeStub(isolate) {}
2416 
2419 };
2420 
2421 
2423  public:
2424  explicit StringCompareStub(Isolate* isolate) : PlatformCodeStub(isolate) {}
2425 
2428 };
2429 
2430 
2431 #undef DEFINE_CALL_INTERFACE_DESCRIPTOR
2432 #undef DEFINE_PLATFORM_CODE_STUB
2433 #undef DEFINE_HANDLER_CODE_STUB
2434 #undef DEFINE_HYDROGEN_CODE_STUB
2435 #undef DEFINE_CODE_STUB
2436 #undef DEFINE_CODE_STUB_BASE
2437 } } // namespace v8::internal
2438 
2439 #endif // V8_CODE_STUBS_H_
#define BASE_EMBEDDED
Definition: allocation.h:45
static AllocationSiteMode GetMode(ElementsKind boilerplate_elements_kind)
Definition: objects-inl.h:1591
DEFINE_PLATFORM_CODE_STUB(ArgumentsAccess, PlatformCodeStub)
virtual CallInterfaceDescriptor GetCallInterfaceDescriptor() OVERRIDE
Definition: code-stubs.h:1480
void GenerateReadElement(MacroAssembler *masm)
void GenerateNewSloppySlow(MacroAssembler *masm)
virtual void PrintName(OStream &os) const OVERRIDE
Definition: code-stubs.cc:775
void GenerateNewStrict(MacroAssembler *masm)
void GenerateNewSloppyFast(MacroAssembler *masm)
ArgumentsAccessStub(Isolate *isolate, Type type)
Definition: code-stubs.h:1476
STATIC_ASSERT(LAST_ALLOCATION_SITE_OVERRIDE_MODE==1)
static void GenerateStubsAheadOfTime(Isolate *isolate)
AllocationSiteOverrideMode override_mode() const
Definition: code-stubs.h:2034
ArrayConstructorStubBase(Isolate *isolate, ElementsKind kind, AllocationSiteOverrideMode override_mode)
Definition: code-stubs.h:2017
OStream & BasePrintName(OStream &os, const char *name) const
Definition: code-stubs.cc:826
DEFINE_CODE_STUB_BASE(ArrayConstructorStubBase, HydrogenCodeStub)
DEFINE_CALL_INTERFACE_DESCRIPTOR(ArrayConstructor)
void GenerateDispatchToArrayStub(MacroAssembler *masm, AllocationSiteOverrideMode mode)
ArrayConstructorStub(Isolate *isolate, int argument_count)
Definition: code-stubs.cc:941
DEFINE_PLATFORM_CODE_STUB(ArrayConstructor, PlatformCodeStub)
ArgumentCountKey argument_count() const
Definition: code-stubs.h:732
virtual void PrintName(OStream &os) const OVERRIDE
Definition: code-stubs.cc:806
ArrayNArgumentsConstructorStub(Isolate *isolate, ElementsKind kind, AllocationSiteOverrideMode override_mode=DONT_OVERRIDE)
Definition: code-stubs.h:2101
DEFINE_HYDROGEN_CODE_STUB(ArrayNArgumentsConstructor, ArrayConstructorStubBase)
virtual void PrintName(OStream &os) const
Definition: code-stubs.h:2109
DEFINE_HYDROGEN_CODE_STUB(ArrayNoArgumentConstructor, ArrayConstructorStubBase)
ArrayNoArgumentConstructorStub(Isolate *isolate, ElementsKind kind, AllocationSiteOverrideMode override_mode=DONT_OVERRIDE)
Definition: code-stubs.h:2061
virtual void PrintName(OStream &os) const OVERRIDE
Definition: code-stubs.h:2069
DEFINE_CALL_INTERFACE_DESCRIPTOR(ArrayConstructorConstantArgCount)
ArraySingleArgumentConstructorStub(Isolate *isolate, ElementsKind kind, AllocationSiteOverrideMode override_mode=DONT_OVERRIDE)
Definition: code-stubs.h:2081
virtual void PrintName(OStream &os) const
Definition: code-stubs.h:2089
DEFINE_HYDROGEN_CODE_STUB(ArraySingleArgumentConstructor, ArrayConstructorStubBase)
static uint32_t NoCacheKey()
Definition: code-stubs.h:166
virtual bool NeedsImmovableCode()
Definition: code-stubs.h:222
virtual Major MajorKey() const =0
virtual CallInterfaceDescriptor GetCallInterfaceDescriptor()=0
virtual Code::StubType GetStubType()
Definition: code-stubs.h:202
Isolate * isolate() const
Definition: code-stubs.h:211
static void GetCodeDispatchCall(CodeStub *stub, void **value_out)
virtual void Activate(Code *code)
Definition: code-stubs.h:246
CodeStub(uint32_t key, Isolate *isolate)
Definition: code-stubs.h:214
virtual void PrintName(OStream &os) const
CodeStub(Isolate *isolate)
Definition: code-stubs.h:170
Handle< Code > GetCodeCopy(const Code::FindAndReplacePattern &pattern)
virtual bool FindCodeInSpecialCache(Code **code_out)
Definition: code-stubs.h:257
bool FindCodeInCache(Code **code_out)
static void GenerateFPStubs(Isolate *isolate)
static void GenerateStubsAheadOfTime(Isolate *isolate)
void RecordCodeGeneration(Handle< Code > code)
STATIC_ASSERT(NUMBER_OF_IDS<(1<< kStubMajorKeyBits))
static Major GetMajorKey(Code *code_stub)
Definition: code-stubs.h:162
static const char * MajorName(Major major_key, bool allow_unknown_keys)
static Major MajorKeyFromKey(uint32_t key)
Definition: code-stubs.h:154
virtual void AddToSpecialCache(Handle< Code > new_object)
Definition: code-stubs.h:254
friend OStream & operator<<(OStream &os, const CodeStub &s)
Definition: code-stubs.h:206
virtual InlineCacheState GetICState() const
Definition: code-stubs.h:200
static void Dispatch(Isolate *isolate, uint32_t key, void **value_out, DispatchedCall call)
static void InitializeDescriptor(Isolate *isolate, uint32_t key, CodeStubDescriptor *desc)
virtual Handle< Code > GenerateCode()=0
virtual bool UseSpecialCache()
Definition: code-stubs.h:262
virtual void FinishCode(Handle< Code > code)
Definition: code-stubs.h:242
static uint32_t MinorKeyFromKey(uint32_t key)
Definition: code-stubs.h:157
virtual void InitializeDescriptor(CodeStubDescriptor *descriptor)
Definition: code-stubs.h:189
virtual void PrintState(OStream &os) const
Definition: code-stubs.h:226
virtual Code::Kind GetCodeKind() const
Handle< Code > GetCode()
static MaybeHandle< Code > GetCode(Isolate *isolate, uint32_t key)
virtual void PrintBaseName(OStream &os) const
virtual bool SometimesSetsUpAFrame()
Definition: code-stubs.h:182
virtual ExtraICState GetExtraICState() const
Definition: code-stubs.h:201
uint32_t MinorKey() const
Definition: code-stubs.h:198
BinaryOpICStub(Isolate *isolate, const BinaryOpICState &state)
Definition: code-stubs.h:1103
BinaryOpICStub(Isolate *isolate, Token::Value op, OverwriteMode mode=NO_OVERWRITE)
Definition: code-stubs.h:1096
DEFINE_HYDROGEN_CODE_STUB(BinaryOpIC, HydrogenCodeStub)
DEFINE_CALL_INTERFACE_DESCRIPTOR(BinaryOp)
static void GenerateAheadOfTime(Isolate *isolate)
Definition: code-stubs.cc:266
virtual ExtraICState GetExtraICState() const FINAL OVERRIDE
Definition: code-stubs.h:1118
virtual Code::Kind GetCodeKind() const OVERRIDE
Definition: code-stubs.h:1110
virtual InlineCacheState GetICState() const FINAL OVERRIDE
Definition: code-stubs.h:1114
BinaryOpICState state() const
Definition: code-stubs.h:1122
virtual void PrintState(OStream &os) const FINAL OVERRIDE
Definition: code-stubs.cc:282
static U update(U previous, T value)
Definition: utils.h:223
static U encode(T value)
Definition: utils.h:217
static T decode(U value)
Definition: utils.h:228
bool save_doubles() const
Definition: code-stubs.h:1423
static void GenerateAheadOfTime(Isolate *isolate)
DEFINE_PLATFORM_CODE_STUB(CEntry, PlatformCodeStub)
CEntryStub(Isolate *isolate, int result_size, SaveFPRegsMode save_doubles=kDontSaveFPRegs)
Definition: code-stubs.h:1406
DEFINE_PLATFORM_CODE_STUB(CallApiFunction, PlatformCodeStub)
STATIC_ASSERT(Code::kArgumentsBits+2<=kStubMinorKeyBits)
CallApiFunctionStub(Isolate *isolate, bool is_store, bool call_data_undefined, int argc)
Definition: code-stubs.h:1058
DEFINE_CALL_INTERFACE_DESCRIPTOR(ApiFunction)
DEFINE_PLATFORM_CODE_STUB(CallApiGetter, PlatformCodeStub)
CallApiGetterStub(Isolate *isolate)
Definition: code-stubs.h:1087
virtual void FinishCode(Handle< Code > code)
Definition: code-stubs.h:1568
CallConstructorFlags flags() const
Definition: code-stubs.h:1573
CallConstructStub(Isolate *isolate, CallConstructorFlags flags)
Definition: code-stubs.h:1563
DEFINE_PLATFORM_CODE_STUB(CallConstruct, PlatformCodeStub)
DEFINE_CALL_INTERFACE_DESCRIPTOR(CallConstruct)
virtual void PrintName(OStream &os) const OVERRIDE
Definition: code-stubs.cc:800
STATIC_ASSERT(Code::kArgumentsBits+2<=kStubMinorKeyBits)
DEFINE_CALL_INTERFACE_DESCRIPTOR(CallFunction)
DEFINE_PLATFORM_CODE_STUB(CallFunction, PlatformCodeStub)
CallFunctionStub(Isolate *isolate, int argc, CallFunctionFlags flags)
Definition: code-stubs.h:1529
virtual void PrintName(OStream &os) const OVERRIDE
Definition: code-stubs.cc:795
static int ExtractArgcFromMinorKey(int minor_key)
Definition: code-stubs.h:1535
CallICState state() const
Definition: code-stubs.h:817
bool CallAsMethod() const
Definition: code-stubs.h:811
virtual void PrintState(OStream &os) const OVERRIDE
Definition: code-stubs.cc:547
DEFINE_CALL_INTERFACE_DESCRIPTOR(CallFunctionWithFeedback)
CallICStub(Isolate *isolate, const CallICState &state)
Definition: code-stubs.h:792
virtual ExtraICState GetExtraICState() const FINAL OVERRIDE
Definition: code-stubs.h:806
void GenerateMiss(MacroAssembler *masm)
static int ExtractArgcFromMinorKey(int minor_key)
Definition: code-stubs.h:797
DEFINE_PLATFORM_CODE_STUB(CallIC, PlatformCodeStub)
virtual Code::Kind GetCodeKind() const OVERRIDE
Definition: code-stubs.h:802
virtual InlineCacheState GetICState() const OVERRIDE
Definition: code-stubs.h:804
virtual InlineCacheState GetICState() const FINAL OVERRIDE
Definition: code-stubs.h:837
CallIC_ArrayStub(Isolate *isolate, const CallICState &state_in)
Definition: code-stubs.h:834
virtual void PrintState(OStream &os) const OVERRIDE
Definition: code-stubs.cc:542
DEFINE_PLATFORM_CODE_STUB(CallIC_Array, CallICStub)
Register GetEnvironmentParameterRegister(int index) const
Representation GetEnvironmentParameterRepresentation(int index) const
StubFunctionMode function_mode_
Definition: code-stubs.h:421
CallInterfaceDescriptor call_descriptor_
Definition: code-stubs.h:416
Address deoptimization_handler() const
Definition: code-stubs.h:413
void set_call_descriptor(CallInterfaceDescriptor d)
Definition: code-stubs.h:377
CodeStubDescriptor(CodeStub *stub)
Definition: code-stubs.cc:20
ExternalReference miss_handler_
Definition: code-stubs.h:426
int GetEnvironmentParameterCount() const
Definition: code-stubs.h:380
CallInterfaceDescriptor call_descriptor() const
Definition: code-stubs.h:378
void SetMissHandler(ExternalReference handler)
Definition: code-stubs.h:369
void Initialize(Address deoptimization_handler=NULL, int hint_stack_parameter_count=-1, StubFunctionMode function_mode=NOT_JS_FUNCTION_STUB_MODE)
Definition: code-stubs.cc:45
HandlerArgumentsMode handler_arguments_mode_
Definition: code-stubs.h:424
Representation GetEnvironmentParameterRepresentation(int index) const
Definition: code-stubs.h:384
StubFunctionMode function_mode() const
Definition: code-stubs.h:412
Register stack_parameter_count() const
Definition: code-stubs.h:411
ExternalReference miss_handler() const
Definition: code-stubs.h:388
bool IsEnvironmentParameterCountRegister(int index) const
Definition: code-stubs.h:397
void Add(Handle< Map > map_to_find, Handle< Object > obj_to_replace)
Definition: objects-inl.h:5052
static const int kMaxArguments
Definition: objects.h:5445
uint32_t stub_key()
Definition: objects-inl.h:6159
static const int kArgumentsBits
Definition: objects.h:5444
Condition GetCondition() const
Definition: code-stubs.cc:354
virtual InlineCacheState GetICState() const
Definition: code-stubs.cc:333
DEFINE_CALL_INTERFACE_DESCRIPTOR(BinaryOp)
virtual Code::Kind GetCodeKind() const
Definition: code-stubs.h:1281
void GenerateInternalizedStrings(MacroAssembler *masm)
void GenerateStrings(MacroAssembler *masm)
void set_known_map(Handle< Map > map)
Definition: code-stubs.h:1264
CompareICState::State state() const
Definition: code-stubs.h:1278
Token::Value op() const
Definition: code-stubs.h:1268
void GenerateMiss(MacroAssembler *masm)
CompareICState::State left() const
Definition: code-stubs.h:1272
void GenerateGeneric(MacroAssembler *masm)
CompareICState::State right() const
Definition: code-stubs.h:1275
void GenerateObjects(MacroAssembler *masm)
CompareICStub(Isolate *isolate, Token::Value op, CompareICState::State left, CompareICState::State right, CompareICState::State state)
Definition: code-stubs.h:1256
virtual void AddToSpecialCache(Handle< Code > new_object)
Definition: code-stubs.cc:359
DEFINE_PLATFORM_CODE_STUB(CompareIC, PlatformCodeStub)
virtual bool FindCodeInSpecialCache(Code **code_out)
Definition: code-stubs.cc:371
void GenerateNumbers(MacroAssembler *masm)
void GenerateUniqueNames(MacroAssembler *masm)
void GenerateKnownObjects(MacroAssembler *masm)
void GenerateSmis(MacroAssembler *masm)
virtual bool UseSpecialCache()
Definition: code-stubs.h:1298
CompareNilICStub(Isolate *isolate, ExtraICState ic_state, InitializationState init_state=INITIALIZED)
Definition: code-stubs.h:1323
virtual void PrintState(OStream &os) const OVERRIDE
Definition: code-stubs.cc:476
DEFINE_CALL_INTERFACE_DESCRIPTOR(CompareNil)
friend OStream & operator<<(OStream &os, const State &s)
Definition: code-stubs.cc:501
void UpdateStatus(Handle< Object > object)
Definition: code-stubs.cc:433
Type * GetInputType(Zone *zone, Handle< Map > map)
Definition: code-stubs.cc:534
virtual InlineCacheState GetICState() const
Definition: code-stubs.h:1334
STATIC_ASSERT(NUMBER_OF_TYPES<=6)
static Handle< Code > GetUninitialized(Isolate *isolate, NilValue nil)
Definition: code-stubs.h:1329
CompareNilICStub(Isolate *isolate, NilValue nil, InitializationState init_state)
Definition: code-stubs.h:1363
DEFINE_HYDROGEN_CODE_STUB(CompareNilIC, HydrogenCodeStub)
virtual void PrintBaseName(OStream &os) const OVERRIDE
Definition: code-stubs.cc:470
virtual Code::Kind GetCodeKind() const
Definition: code-stubs.h:1345
Type * GetType(Zone *zone, Handle< Map > map=Handle< Map >())
Definition: code-stubs.cc:513
virtual ExtraICState GetExtraICState() const
Definition: code-stubs.h:1347
CompareNilICStub(Isolate *isolate, NilValue nil)
Definition: code-stubs.h:1319
static bool IsSupported(CpuFeature f)
Definition: assembler.h:184
CreateAllocationSiteStub(Isolate *isolate)
Definition: code-stubs.h:662
DEFINE_HYDROGEN_CODE_STUB(CreateAllocationSite, HydrogenCodeStub)
static void GenerateAheadOfTime(Isolate *isolate)
Definition: code-stubs.cc:725
DEFINE_CALL_INTERFACE_DESCRIPTOR(CreateAllocationSite)
DEFINE_PLATFORM_CODE_STUB(DoubleToI, PlatformCodeStub)
static const int kBitsPerRegisterNumber
Definition: code-stubs.h:1911
Register source() const
Definition: code-stubs.h:1901
STATIC_ASSERT((1L<< kBitsPerRegisterNumber) >=Register::kNumRegisters)
Register destination() const
Definition: code-stubs.h:1904
virtual bool SometimesSetsUpAFrame()
Definition: code-stubs.h:1898
DoubleToIStub(Isolate *isolate, Register source, Register destination, int offset, bool is_truncating, bool skip_fastpath=false)
Definition: code-stubs.h:1887
DEFINE_HYDROGEN_CODE_STUB(ElementsTransitionAndStore, HydrogenCodeStub)
DEFINE_CALL_INTERFACE_DESCRIPTOR(ElementTransitionAndStore)
ElementsTransitionAndStoreStub(Isolate *isolate, ElementsKind from_kind, ElementsKind to_kind, bool is_jsarray, KeyedAccessStoreMode store_mode)
Definition: code-stubs.h:2291
KeyedAccessStoreMode store_mode() const
Definition: code-stubs.h:2303
bool Contains(E element) const
Definition: utils.h:851
Source to read snapshot and builtins files from.
Definition: lithium-arm.h:372
DEFINE_CALL_INTERFACE_DESCRIPTOR(StringAdd)
DEFINE_HYDROGEN_CODE_STUB(NumberToString, HydrogenCodeStub)
static void GenerateAheadOfTime(Isolate *isolate, const BinaryOpICState &state)
virtual Code::Kind GetCodeKind() const FINAL OVERRIDE
Definition: code-stubs.h:1196
DEFINE_HYDROGEN_CODE_STUB(RegExpConstructResult, HydrogenCodeStub)
virtual Code::Kind GetCodeKind() const OVERRIDE
Definition: code-stubs.h:1159
DEFINE_CALL_INTERFACE_DESCRIPTOR(FastNewContext)
BinaryOpICState state() const
Definition: code-stubs.h:1174
virtual void PrintState(OStream &os) const OVERRIDE
Handle< Code > GetCodeCopyFromTemplate(Handle< AllocationSite > allocation_site)
Definition: code-stubs.h:1153
DEFINE_PLATFORM_CODE_STUB(BinaryOpICWithAllocationSite, PlatformCodeStub)
DEFINE_HYDROGEN_CODE_STUB(BinaryOpWithAllocationSite, BinaryOpICStub)
virtual InlineCacheState GetICState() const OVERRIDE
Definition: code-stubs.h:1163
BinaryOpWithAllocationSiteStub(Isolate *isolate, Token::Value op, OverwriteMode mode)
Definition: code-stubs.h:1188
static void GenerateAheadOfTime(Isolate *isolate)
StringAddFlags flags() const
Definition: code-stubs.h:1231
DEFINE_CALL_INTERFACE_DESCRIPTOR(NumberToString)
DEFINE_CALL_INTERFACE_DESCRIPTOR(RegExpConstructResult)
int slots() const
Definition: code-stubs.h:605
NumberToStringStub(Isolate *isolate)
Definition: code-stubs.h:556
DEFINE_CALL_INTERFACE_DESCRIPTOR(BinaryOpWithAllocationSite)
BinaryOpWithAllocationSiteStub(Isolate *isolate, const BinaryOpICState &state)
Definition: code-stubs.h:1193
StringAddStub(Isolate *isolate, StringAddFlags flags, PretenureFlag pretenure_flag)
Definition: code-stubs.h:1224
DEFINE_HYDROGEN_CODE_STUB(StringAdd, HydrogenCodeStub)
virtual ExtraICState GetExtraICState() const OVERRIDE
Definition: code-stubs.h:1167
FastNewContextStub(Isolate *isolate, int slots)
Definition: code-stubs.h:600
virtual void PrintBaseName(OStream &os) const OVERRIDE
BinaryOpICWithAllocationSiteStub(Isolate *isolate, const BinaryOpICState &state)
Definition: code-stubs.h:1145
DEFINE_HYDROGEN_CODE_STUB(FastNewContext, HydrogenCodeStub)
PretenureFlag pretenure_flag() const
Definition: code-stubs.h:1235
RegExpConstructResultStub(Isolate *isolate)
Definition: code-stubs.h:1514
FastCloneShallowArrayStub(Isolate *isolate, AllocationSiteMode allocation_site_mode)
Definition: code-stubs.h:620
DEFINE_HYDROGEN_CODE_STUB(FastCloneShallowArray, HydrogenCodeStub)
DEFINE_CALL_INTERFACE_DESCRIPTOR(FastCloneShallowArray)
AllocationSiteMode allocation_site_mode() const
Definition: code-stubs.h:626
FastCloneShallowObjectStub(Isolate *isolate, int length)
Definition: code-stubs.h:643
DEFINE_CALL_INTERFACE_DESCRIPTOR(FastCloneShallowObject)
DEFINE_HYDROGEN_CODE_STUB(FastCloneShallowObject, HydrogenCodeStub)
FunctionKind kind() const
Definition: code-stubs.h:580
FastNewClosureStub(Isolate *isolate, StrictMode strict_mode, FunctionKind kind)
Definition: code-stubs.h:568
DEFINE_HYDROGEN_CODE_STUB(FastNewClosure, HydrogenCodeStub)
StrictMode strict_mode() const
Definition: code-stubs.h:576
DEFINE_CALL_INTERFACE_DESCRIPTOR(FastNewClosure)
virtual Code::Kind GetCodeKind() const
Definition: code-stubs.h:854
DEFINE_PLATFORM_CODE_STUB(FunctionPrototype, PlatformCodeStub)
FunctionPrototypeStub(Isolate *isolate)
Definition: code-stubs.h:851
virtual void InitializeDescriptor(CodeStubDescriptor *descriptor) OVERRIDE
Definition: code-stubs.cc:586
virtual CallInterfaceDescriptor GetCallInterfaceDescriptor() OVERRIDE
Definition: code-stubs.cc:595
virtual InlineCacheState GetICState() const
Definition: code-stubs.h:882
virtual Code::Kind GetCodeKind() const
Definition: code-stubs.h:880
virtual ExtraICState GetExtraICState() const
Definition: code-stubs.h:881
DEFINE_CODE_STUB_BASE(HandlerStub, HydrogenCodeStub)
virtual Code::Kind kind() const =0
static Handle< Code > GetUninitialized(Isolate *isolate)
Definition: code-stubs.h:441
void TraceTransition(StateType from, StateType to)
Definition: code-stubs.cc:458
virtual Handle< Code > GenerateCode()=0
virtual Code::Kind GetCodeKind() const
Definition: code-stubs.h:438
HydrogenCodeStub(Isolate *isolate, InitializationState state=INITIALIZED)
Definition: code-stubs.h:457
void GenerateLightweightMiss(MacroAssembler *masm, ExternalReference miss)
void set_sub_minor_key(uint32_t key)
Definition: code-stubs.h:463
DEFINE_CODE_STUB_BASE(HydrogenCodeStub, CodeStub)
Handle< Code > GenerateLightweightMissCode(ExternalReference miss)
static const int kSubMinorKeyBits
Definition: code-stubs.h:469
uint32_t sub_minor_key() const
Definition: code-stubs.h:467
static const Register left()
static const Register right()
DEFINE_PLATFORM_CODE_STUB(Instanceof, PlatformCodeStub)
InstanceofStub(Isolate *isolate, Flags flags)
Definition: code-stubs.h:681
virtual CallInterfaceDescriptor GetCallInterfaceDescriptor() OVERRIDE
Definition: code-stubs.h:688
virtual void PrintName(OStream &os) const OVERRIDE
Definition: code-stubs.cc:552
bool HasCallSiteInlineCheck() const
Definition: code-stubs.h:700
static Register right()
Definition: code-stubs.h:686
bool HasArgsInRegisters() const
Definition: code-stubs.h:698
static Register left()
Definition: code-stubs.h:685
bool ReturnTrueFalseObject() const
Definition: code-stubs.h:704
InternalArrayConstructorStubBase(Isolate *isolate, ElementsKind kind)
Definition: code-stubs.h:2121
static void GenerateStubsAheadOfTime(Isolate *isolate)
DEFINE_CODE_STUB_BASE(InternalArrayConstructorStubBase, HydrogenCodeStub)
DEFINE_CALL_INTERFACE_DESCRIPTOR(InternalArrayConstructor)
DEFINE_PLATFORM_CODE_STUB(InternalArrayConstructor, PlatformCodeStub)
void GenerateCase(MacroAssembler *masm, ElementsKind kind)
DEFINE_CALL_INTERFACE_DESCRIPTOR(InternalArrayConstructor)
DEFINE_HYDROGEN_CODE_STUB(InternalArrayNArgumentsConstructor, InternalArrayConstructorStubBase)
InternalArrayNArgumentsConstructorStub(Isolate *isolate, ElementsKind kind)
Definition: code-stubs.h:2171
DEFINE_CALL_INTERFACE_DESCRIPTOR(InternalArrayConstructorConstantArgCount)
InternalArrayNoArgumentConstructorStub(Isolate *isolate, ElementsKind kind)
Definition: code-stubs.h:2145
DEFINE_HYDROGEN_CODE_STUB(InternalArrayNoArgumentConstructor, InternalArrayConstructorStubBase)
DEFINE_HYDROGEN_CODE_STUB(InternalArraySingleArgumentConstructor, InternalArrayConstructorStubBase)
InternalArraySingleArgumentConstructorStub(Isolate *isolate, ElementsKind kind)
Definition: code-stubs.h:2158
Factory * factory()
Definition: isolate.h:982
JSEntryStub(Isolate *isolate, StackFrame::Type type)
Definition: code-stubs.h:1440
virtual void FinishCode(Handle< Code > code)
Definition: code-stubs.cc:560
DEFINE_PLATFORM_CODE_STUB(JSEntry, PlatformCodeStub)
StackFrame::Type type() const
Definition: code-stubs.h:1454
virtual void PrintName(OStream &os) const OVERRIDE
Definition: code-stubs.h:1449
KeyedLoadGenericStub(Isolate *isolate)
Definition: code-stubs.h:1774
DEFINE_HYDROGEN_CODE_STUB(KeyedLoadGeneric, HydrogenCodeStub)
virtual InlineCacheState GetICState() const
Definition: code-stubs.h:1777
virtual Code::Kind GetCodeKind() const
Definition: code-stubs.h:1776
virtual Code::Kind GetCodeKind() const OVERRIDE
Definition: code-stubs.h:1816
DEFINE_PLATFORM_CODE_STUB(KeyedLoadICTrampoline, LoadICTrampolineStub)
virtual Code::StubType GetStubType()
Definition: code-stubs.h:927
DEFINE_HANDLER_CODE_STUB(KeyedLoadSloppyArguments, HandlerStub)
virtual Code::Kind kind() const
Definition: code-stubs.h:926
LoadConstantStub(Isolate *isolate, int constant_index)
Definition: code-stubs.h:936
virtual Code::Kind kind() const
Definition: code-stubs.h:946
virtual Code::StubType GetStubType()
Definition: code-stubs.h:947
DEFINE_HANDLER_CODE_STUB(LoadConstant, HandlerStub)
DEFINE_HYDROGEN_CODE_STUB(LoadDictionaryElement, HydrogenCodeStub)
ElementsKind elements_kind() const
Definition: code-stubs.h:1943
LoadFastElementStub(Isolate *isolate, bool is_js_array, ElementsKind elements_kind)
Definition: code-stubs.h:1934
DEFINE_HYDROGEN_CODE_STUB(LoadFastElement, HydrogenCodeStub)
virtual Code::StubType GetStubType()
Definition: code-stubs.h:911
DEFINE_HANDLER_CODE_STUB(LoadField, HandlerStub)
LoadFieldStub(Isolate *isolate, FieldIndex index)
Definition: code-stubs.h:899
FieldIndex index() const
Definition: code-stubs.h:904
virtual Code::Kind kind() const
Definition: code-stubs.h:910
virtual Code::Kind GetCodeKind() const OVERRIDE
Definition: code-stubs.h:1791
LoadICTrampolineStub(Isolate *isolate, const LoadICState &state)
Definition: code-stubs.h:1786
DEFINE_PLATFORM_CODE_STUB(LoadICTrampoline, PlatformCodeStub)
virtual ExtraICState GetExtraICState() const FINAL OVERRIDE
Definition: code-stubs.h:1797
virtual InlineCacheState GetICState() const FINAL OVERRIDE
Definition: code-stubs.h:1793
DEFINE_CALL_INTERFACE_DESCRIPTOR(VectorLoadICTrampoline)
LoadIndexedInterceptorStub(Isolate *isolate)
Definition: code-stubs.h:867
virtual Code::StubType GetStubType()
Definition: code-stubs.h:871
DEFINE_PLATFORM_CODE_STUB(LoadIndexedInterceptor, PlatformCodeStub)
virtual Code::Kind GetCodeKind() const
Definition: code-stubs.h:870
virtual CallInterfaceDescriptor GetCallInterfaceDescriptor() OVERRIDE
Definition: code-stubs.h:769
MathPowStub(Isolate *isolate, ExponentType exponent_type)
Definition: code-stubs.h:764
DEFINE_PLATFORM_CODE_STUB(MathPow, PlatformCodeStub)
ExponentType exponent_type() const
Definition: code-stubs.h:780
virtual ExtraICState GetExtraICState() const FINAL OVERRIDE
Definition: code-stubs.h:1837
MegamorphicLoadStub(Isolate *isolate, const LoadICState &state)
Definition: code-stubs.h:1826
virtual InlineCacheState GetICState() const FINAL OVERRIDE
Definition: code-stubs.h:1833
virtual Code::Kind GetCodeKind() const OVERRIDE
Definition: code-stubs.h:1831
DEFINE_HYDROGEN_CODE_STUB(MegamorphicLoad, HydrogenCodeStub)
virtual void BeforeCall(MacroAssembler *masm) const
Definition: code-stubs.h:539
virtual void AfterCall(MacroAssembler *masm) const
Definition: code-stubs.h:541
DEFINE_CODE_STUB_BASE(PlatformCodeStub, CodeStub)
virtual Handle< Code > GenerateCode() OVERRIDE
Definition: code-stubs.cc:100
virtual Code::Kind GetCodeKind() const
Definition: code-stubs.h:338
PlatformCodeStub(Isolate *isolate)
Definition: code-stubs.h:341
virtual void Generate(MacroAssembler *masm)=0
DEFINE_PLATFORM_CODE_STUB(ProfileEntryHook, PlatformCodeStub)
ProfileEntryHookStub(Isolate *isolate)
Definition: code-stubs.h:2373
static void MaybeCallEntryHook(MacroAssembler *masm)
static void EntryHookTrampoline(intptr_t function, intptr_t stack_pointer, Isolate *isolate)
Definition: code-stubs.cc:925
RegExpExecStub(Isolate *isolate)
Definition: code-stubs.h:1505
DEFINE_CALL_INTERFACE_DESCRIPTOR(ContextOnly)
DEFINE_PLATFORM_CODE_STUB(RegExpExec, PlatformCodeStub)
static Representation FromKind(Kind kind)
virtual void BeforeCall(MacroAssembler *masm) const =0
virtual void AfterCall(MacroAssembler *masm) const =0
DISALLOW_COPY_AND_ASSIGN(RuntimeCallHelper)
DEFINE_PLATFORM_CODE_STUB(StoreArrayLiteralElement, PlatformCodeStub)
DEFINE_CALL_INTERFACE_DESCRIPTOR(StoreArrayLiteralElement)
static void GenerateFixedRegStubsAheadOfTime(Isolate *isolate)
StoreBufferOverflowStub(Isolate *isolate, SaveFPRegsMode save_fp)
Definition: code-stubs.h:2395
DEFINE_PLATFORM_CODE_STUB(StoreBufferOverflow, PlatformCodeStub)
static const Register ReceiverRegister()
static const Register NameRegister()
static const Register ValueRegister()
ElementsKind elements_kind() const
Definition: code-stubs.h:2188
DEFINE_PLATFORM_CODE_STUB(StoreElement, PlatformCodeStub)
StoreElementStub(Isolate *isolate, ElementsKind elements_kind)
Definition: code-stubs.h:2182
DEFINE_HYDROGEN_CODE_STUB(StoreFastElement, HydrogenCodeStub)
StoreFastElementStub(Isolate *isolate, bool is_js_array, ElementsKind elements_kind, KeyedAccessStoreMode mode)
Definition: code-stubs.h:1958
KeyedAccessStoreMode store_mode() const
Definition: code-stubs.h:1972
ElementsKind elements_kind() const
Definition: code-stubs.h:1968
virtual Code::StubType GetStubType()
Definition: code-stubs.h:991
virtual Code::Kind kind() const
Definition: code-stubs.h:990
FieldIndex index() const
Definition: code-stubs.h:979
DEFINE_HANDLER_CODE_STUB(StoreField, HandlerStub)
StoreFieldStub(Isolate *isolate, FieldIndex index, Representation representation)
Definition: code-stubs.h:970
Representation representation()
Definition: code-stubs.h:984
virtual Code::Kind kind() const
Definition: code-stubs.h:1028
static Handle< HeapObject > global_placeholder(Isolate *isolate)
Definition: code-stubs.h:1009
Representation representation()
Definition: code-stubs.h:1038
StoreGlobalStub(Isolate *isolate, bool is_constant, bool check_global)
Definition: code-stubs.h:1003
void set_representation(Representation r)
Definition: code-stubs.h:1043
void set_is_constant(bool value)
Definition: code-stubs.h:1034
DEFINE_HANDLER_CODE_STUB(StoreGlobal, HandlerStub)
Handle< Code > GetCodeCopyFromTemplate(Handle< GlobalObject > global, Handle< PropertyCell > cell)
Definition: code-stubs.h:1013
DISALLOW_COPY_AND_ASSIGN(StringCharAtGenerator)
StringCharFromCodeGenerator char_from_code_generator_
Definition: code-stubs.h:1756
void SkipSlow(MacroAssembler *masm, Label *bailout)
Definition: code-stubs.h:1749
StringCharAtGenerator(Register object, Register index, Register scratch, Register result, Label *receiver_not_string, Label *index_not_number, Label *index_out_of_range, StringIndexFlags index_flags)
Definition: code-stubs.h:1715
void GenerateSlow(MacroAssembler *masm, const RuntimeCallHelper &call_helper)
Definition: code-stubs.h:1742
void GenerateFast(MacroAssembler *masm)
Definition: code-stubs.h:1734
StringCharCodeAtGenerator char_code_at_generator_
Definition: code-stubs.h:1755
StringCharCodeAtGenerator(Register object, Register index, Register result, Label *receiver_not_string, Label *index_not_number, Label *index_out_of_range, StringIndexFlags index_flags)
Definition: code-stubs.h:1611
void GenerateFast(MacroAssembler *masm)
DISALLOW_COPY_AND_ASSIGN(StringCharCodeAtGenerator)
void SkipSlow(MacroAssembler *masm, Label *bailout)
Definition: code-stubs.h:1640
void GenerateSlow(MacroAssembler *masm, const RuntimeCallHelper &call_helper)
void GenerateFast(MacroAssembler *masm)
void SkipSlow(MacroAssembler *masm, Label *bailout)
Definition: code-stubs.h:1687
DISALLOW_COPY_AND_ASSIGN(StringCharFromCodeGenerator)
StringCharFromCodeGenerator(Register code, Register result)
Definition: code-stubs.h:1669
void GenerateSlow(MacroAssembler *masm, const RuntimeCallHelper &call_helper)
DEFINE_CALL_INTERFACE_DESCRIPTOR(ContextOnly)
StringCompareStub(Isolate *isolate)
Definition: code-stubs.h:2424
DEFINE_PLATFORM_CODE_STUB(StringCompare, PlatformCodeStub)
StringLengthStub(Isolate *isolate)
Definition: code-stubs.h:958
virtual Code::Kind kind() const
Definition: code-stubs.h:961
virtual Code::StubType GetStubType()
Definition: code-stubs.h:962
DEFINE_HANDLER_CODE_STUB(StringLength, HandlerStub)
StubFailureTrampolineStub(Isolate *isolate, StubFunctionMode function_mode)
Definition: code-stubs.h:2352
StubFunctionMode function_mode() const
Definition: code-stubs.h:2360
static void GenerateAheadOfTime(Isolate *isolate)
Definition: code-stubs.cc:917
DEFINE_PLATFORM_CODE_STUB(StubFailureTrampoline, PlatformCodeStub)
virtual void AfterCall(MacroAssembler *masm) const
virtual void BeforeCall(MacroAssembler *masm) const
DEFINE_CALL_INTERFACE_DESCRIPTOR(ContextOnly)
DEFINE_PLATFORM_CODE_STUB(SubString, PlatformCodeStub)
SubStringStub(Isolate *isolate)
Definition: code-stubs.h:2415
bool UpdateStatus(Handle< Object > object)
Definition: code-stubs.cc:867
ResultMode mode() const
Definition: code-stubs.h:2251
virtual InlineCacheState GetICState() const
Definition: code-stubs.h:2264
STATIC_ASSERT(NUMBER_OF_TYPES<=8)
virtual void PrintState(OStream &os) const OVERRIDE
Definition: code-stubs.cc:846
virtual bool SometimesSetsUpAFrame()
Definition: code-stubs.h:2256
virtual ExtraICState GetExtraICState() const
Definition: code-stubs.h:2262
ToBooleanStub(Isolate *isolate, InitializationState init_state)
Definition: code-stubs.h:2273
static Handle< Code > GetUninitialized(Isolate *isolate)
Definition: code-stubs.h:2258
DEFINE_HYDROGEN_CODE_STUB(ToBoolean, HydrogenCodeStub)
ToBooleanStub(Isolate *isolate, ExtraICState state)
Definition: code-stubs.h:2243
DEFINE_CALL_INTERFACE_DESCRIPTOR(ToBoolean)
ToBooleanStub(Isolate *isolate, ResultMode mode, Types types=Types())
Definition: code-stubs.h:2237
virtual Code::Kind GetCodeKind() const
Definition: code-stubs.h:2253
bool UpdateStatus(Handle< Object > object)
Definition: code-stubs.cc:836
DEFINE_HYDROGEN_CODE_STUB(ToNumber, HydrogenCodeStub)
ToNumberStub(Isolate *isolate)
Definition: code-stubs.h:547
DEFINE_CALL_INTERFACE_DESCRIPTOR(ToNumber)
static bool IsCompareOp(Value op)
Definition: token.h:202
DEFINE_HYDROGEN_CODE_STUB(TransitionElementsKind, HydrogenCodeStub)
DEFINE_CALL_INTERFACE_DESCRIPTOR(TransitionElementsKind)
TransitionElementsKindStub(Isolate *isolate, ElementsKind from_kind, ElementsKind to_kind, bool is_js_array)
Definition: code-stubs.h:1988
VectorKeyedLoadStub(Isolate *isolate)
Definition: code-stubs.h:1873
DEFINE_CALL_INTERFACE_DESCRIPTOR(VectorLoadIC)
DEFINE_HYDROGEN_CODE_STUB(VectorKeyedLoad, VectorLoadStub)
virtual Code::Kind GetCodeKind() const OVERRIDE
Definition: code-stubs.h:1876
LoadICState state() const
Definition: code-stubs.h:1864
VectorLoadStub(Isolate *isolate, const LoadICState &state)
Definition: code-stubs.h:1848
DEFINE_HYDROGEN_CODE_STUB(VectorLoad, HydrogenCodeStub)
DEFINE_CALL_INTERFACE_DESCRIPTOR(VectorLoadIC)
virtual ExtraICState GetExtraICState() const FINAL OVERRIDE
Definition: code-stubs.h:1859
virtual Code::Kind GetCodeKind() const OVERRIDE
Definition: code-stubs.h:1853
virtual InlineCacheState GetICState() const FINAL OVERRIDE
Definition: code-stubs.h:1855
#define CODE_STUB_LIST(V)
Definition: code-stubs.h:129
#define DEFINE_CALL_INTERFACE_DESCRIPTOR(NAME)
Definition: code-stubs.h:316
#define DEF_ENUM(name)
Definition: code-stubs.h:142
#define OVERRIDE
#define FINAL
enable harmony numeric enable harmony object literal extensions Optimize object Array DOM strings and string trace pretenuring decisions of HAllocate instructions Enables optimizations which favor memory size over execution speed maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining trace the tracking of allocation sites deoptimize every n garbage collections perform array bounds checks elimination analyze liveness of environment slots and zap dead values flushes the cache of optimized code for closures on every GC allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms do not emit check maps for constant values that have a leaf map
enable harmony numeric enable harmony object literal extensions Optimize object Array DOM strings and string trace pretenuring decisions of HAllocate instructions Enables optimizations which favor memory size over execution speed maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining trace the tracking of allocation sites deoptimize every n garbage collections perform array bounds checks elimination analyze liveness of environment slots and zap dead values flushes the cache of optimized code for closures on every GC allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms do not emit check maps for constant values that have a leaf deoptimize the optimized code if the layout of the maps changes enable context specialization in TurboFan execution budget before interrupt is triggered max percentage of megamorphic generic ICs to allow optimization enable use of SAHF instruction if enable use of VFP3 instructions if available enable use of NEON instructions if enable use of SDIV and UDIV instructions if enable use of MLS instructions if enable loading bit constant by means of movw movt instruction enable unaligned accesses for enable use of d16 d31 registers on ARM this requires VFP3 force all emitted branches to be in long enable alignment of csp to bytes on platforms which prefer the register to always be expose gc extension under the specified name show built in functions in stack traces use random jit cookie to mask large constants minimum length for automatic enable preparsing CPU profiler sampling interval in microseconds trace out of bounds accesses to external arrays default size of stack region v8 is allowed to maximum length of function source code printed in a stack trace min size of a semi the new space consists of two semi spaces print one trace line following each garbage collection do not print trace line after scavenger collection print cumulative GC statistics in only print modified registers Trace simulator debug messages Implied by trace sim abort randomize hashes to avoid predictable hash Fixed seed to use to hash property Print the time it takes to deserialize the snapshot A filename with extra code to be included in the A file to write the raw snapshot bytes to(mksnapshot only)") DEFINE_STRING(raw_context_file
enable harmony numeric enable harmony object literal extensions Optimize object Array DOM strings and string trace pretenuring decisions of HAllocate instructions Enables optimizations which favor memory size over execution speed maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining trace the tracking of allocation sites deoptimize every n garbage collections perform array bounds checks elimination analyze liveness of environment slots and zap dead values flushes the cache of optimized code for closures on every GC allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms do not emit check maps for constant values that have a leaf deoptimize the optimized code if the layout of the maps changes enable context specialization in TurboFan execution budget before interrupt is triggered max percentage of megamorphic generic ICs to allow optimization enable use of SAHF instruction if enable use of VFP3 instructions if available enable use of NEON instructions if enable use of SDIV and UDIV instructions if enable use of MLS instructions if enable loading bit constant by means of movw movt instruction enable unaligned accesses for enable use of d16 d31 registers on ARM this requires VFP3 force all emitted branches to be in long enable alignment of csp to bytes on platforms which prefer the register to always be expose gc extension under the specified name show built in functions in stack traces use random jit cookie to mask large constants minimum length for automatic enable preparsing CPU profiler sampling interval in microseconds trace out of bounds accesses to external arrays default size of stack region v8 is allowed to maximum length of function source code printed in a stack trace min size of a semi the new space consists of two semi spaces print one trace line following each garbage collection do not print trace line after scavenger collection print cumulative GC statistics in name
enable harmony numeric enable harmony object literal extensions Optimize object Array DOM strings and string trace pretenuring decisions of HAllocate instructions Enables optimizations which favor memory size over execution speed maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining trace the tracking of allocation sites deoptimize every n garbage collections perform array bounds checks elimination analyze liveness of environment slots and zap dead values flushes the cache of optimized code for closures on every GC allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms do not emit check maps for constant values that have a leaf deoptimize the optimized code if the layout of the maps changes enable context specialization in TurboFan execution budget before interrupt is triggered max percentage of megamorphic generic ICs to allow optimization enable use of SAHF instruction if enable use of VFP3 instructions if available enable use of NEON instructions if enable use of SDIV and UDIV instructions if enable use of MLS instructions if enable loading bit constant by means of movw movt instruction enable unaligned accesses for enable use of d16 d31 registers on ARM this requires VFP3 force all emitted branches to be in long mode(MIPS only)") DEFINE_BOOL(enable_always_align_csp
enable harmony numeric enable harmony object literal extensions Optimize object Array DOM strings and string trace pretenuring decisions of HAllocate instructions Enables optimizations which favor memory size over execution speed maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining trace the tracking of allocation sites deoptimize every n garbage collections perform array bounds checks elimination analyze liveness of environment slots and zap dead values flushes the cache of optimized code for closures on every GC allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms do not emit check maps for constant values that have a leaf deoptimize the optimized code if the layout of the maps changes enable context specialization in TurboFan execution budget before interrupt is triggered max percentage of megamorphic generic ICs to allow optimization enable use of SAHF instruction if enable use of VFP3 instructions if available enable use of NEON instructions if enable use of SDIV and UDIV instructions if enable use of MLS instructions if enable loading bit constant by means of movw movt instruction enable unaligned accesses for enable use of d16 d31 registers on ARM this requires VFP3 force all emitted branches to be in long enable alignment of csp to bytes on platforms which prefer the register to always be NULL
#define DCHECK_LE(v1, v2)
Definition: logging.h:210
#define DCHECK_GE(v1, v2)
Definition: logging.h:208
#define DCHECK(condition)
Definition: logging.h:205
int StringLength(const char *string)
Definition: api.cc:5368
bool IsValidFunctionKind(FunctionKind kind)
Definition: globals.h:784
@ STRING_ADD_CHECK_LEFT
Definition: code-stubs.h:1214
@ STRING_ADD_CHECK_NONE
Definition: code-stubs.h:1212
@ STRING_ADD_CHECK_BOTH
Definition: code-stubs.h:1218
@ STRING_ADD_CHECK_RIGHT
Definition: code-stubs.h:1216
bool IsArrowFunction(FunctionKind kind)
Definition: globals.h:793
@ TRACK_ALLOCATION_SITE
Definition: objects.h:8085
TypeImpl< ZoneTypeConfig > Type
static const ExtraICState kNoExtraICState
Definition: objects.h:306
bool IsGeneratorFunction(FunctionKind kind)
Definition: globals.h:799
bool IsConciseMethod(FunctionKind kind)
Definition: globals.h:805
KeyedAccessStoreMode
Definition: objects.h:153
@ JS_FUNCTION_STUB_MODE
Definition: code-stubs.h:350
@ NOT_JS_FUNCTION_STUB_MODE
Definition: code-stubs.h:350
int ToNumber(Register reg)
@ NO_OVERWRITE
Definition: ic-state.h:58
const int kStubMinorKeyBits
Definition: objects.h:314
OStream & operator<<(OStream &os, const BasicBlockProfiler &p)
AllocationSiteOverrideMode
Definition: code-stubs.h:716
@ LAST_ALLOCATION_SITE_OVERRIDE_MODE
Definition: code-stubs.h:719
@ DISABLE_ALLOCATION_SITES
Definition: code-stubs.h:718
byte * Address
Definition: globals.h:101
NilValue
Definition: v8.h:97
const int kStubMajorKeyBits
Definition: objects.h:313
CallConstructorFlags
Definition: globals.h:477
@ RECORD_CONSTRUCTOR_TARGET
Definition: globals.h:480
@ DONT_PASS_ARGUMENTS
Definition: code-stubs.h:351
@ WRAP_AND_CALL
Definition: globals.h:473
@ CALL_AS_METHOD
Definition: globals.h:470
@ STRING_INDEX_IS_NUMBER
Definition: code-stubs.h:1590
@ STRING_INDEX_IS_ARRAY_INDEX
Definition: code-stubs.h:1595
@ UNINITIALIZED
Definition: globals.h:446
@ PREMONOMORPHIC
Definition: globals.h:448
uint8_t byte
Definition: globals.h:100
Debugger support for the V8 JavaScript engine.
Definition: accessors.cc:20
static const int kNumRegisters
Definition: assembler-arm.h:95
static Register from_code(int code)
bool is(Register reg) const