Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(55)

Side by Side Diff: src/code-stubs.h

Issue 185653004: Experimental parser: merge to r19637 (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/parser
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/checks.h ('k') | src/code-stubs.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 27 matching lines...) Expand all
38 namespace internal { 38 namespace internal {
39 39
40 // List of code stubs used on all platforms. 40 // List of code stubs used on all platforms.
41 #define CODE_STUB_LIST_ALL_PLATFORMS(V) \ 41 #define CODE_STUB_LIST_ALL_PLATFORMS(V) \
42 V(CallFunction) \ 42 V(CallFunction) \
43 V(CallConstruct) \ 43 V(CallConstruct) \
44 V(BinaryOpIC) \ 44 V(BinaryOpIC) \
45 V(BinaryOpICWithAllocationSite) \ 45 V(BinaryOpICWithAllocationSite) \
46 V(BinaryOpWithAllocationSite) \ 46 V(BinaryOpWithAllocationSite) \
47 V(StringAdd) \ 47 V(StringAdd) \
48 V(NewStringAdd) \
49 V(SubString) \ 48 V(SubString) \
50 V(StringCompare) \ 49 V(StringCompare) \
51 V(Compare) \ 50 V(Compare) \
52 V(CompareIC) \ 51 V(CompareIC) \
53 V(CompareNilIC) \ 52 V(CompareNilIC) \
54 V(MathPow) \ 53 V(MathPow) \
55 V(StringLength) \ 54 V(StringLength) \
56 V(FunctionPrototype) \ 55 V(FunctionPrototype) \
57 V(StoreArrayLength) \ 56 V(StoreArrayLength) \
58 V(RecordWrite) \ 57 V(RecordWrite) \
59 V(StoreBufferOverflow) \ 58 V(StoreBufferOverflow) \
60 V(RegExpExec) \ 59 V(RegExpExec) \
61 V(Instanceof) \ 60 V(Instanceof) \
62 V(ConvertToDouble) \ 61 V(ConvertToDouble) \
63 V(WriteInt32ToHeapNumber) \ 62 V(WriteInt32ToHeapNumber) \
64 V(StackCheck) \ 63 V(StackCheck) \
65 V(Interrupt) \ 64 V(Interrupt) \
66 V(FastNewClosure) \ 65 V(FastNewClosure) \
67 V(FastNewContext) \ 66 V(FastNewContext) \
68 V(FastNewBlockContext) \
69 V(FastCloneShallowArray) \ 67 V(FastCloneShallowArray) \
70 V(FastCloneShallowObject) \ 68 V(FastCloneShallowObject) \
71 V(CreateAllocationSite) \ 69 V(CreateAllocationSite) \
72 V(ToBoolean) \ 70 V(ToBoolean) \
73 V(ToNumber) \ 71 V(ToNumber) \
74 V(ArgumentsAccess) \ 72 V(ArgumentsAccess) \
75 V(RegExpConstructResult) \ 73 V(RegExpConstructResult) \
76 V(NumberToString) \ 74 V(NumberToString) \
77 V(DoubleToI) \ 75 V(DoubleToI) \
78 V(CEntry) \ 76 V(CEntry) \
79 V(JSEntry) \ 77 V(JSEntry) \
80 V(KeyedLoadElement) \ 78 V(KeyedLoadElement) \
79 V(ArrayPush) \
81 V(ArrayNoArgumentConstructor) \ 80 V(ArrayNoArgumentConstructor) \
82 V(ArraySingleArgumentConstructor) \ 81 V(ArraySingleArgumentConstructor) \
83 V(ArrayNArgumentsConstructor) \ 82 V(ArrayNArgumentsConstructor) \
84 V(InternalArrayNoArgumentConstructor) \ 83 V(InternalArrayNoArgumentConstructor) \
85 V(InternalArraySingleArgumentConstructor) \ 84 V(InternalArraySingleArgumentConstructor) \
86 V(InternalArrayNArgumentsConstructor) \ 85 V(InternalArrayNArgumentsConstructor) \
87 V(KeyedStoreElement) \ 86 V(KeyedStoreElement) \
88 V(DebuggerStatement) \ 87 V(DebuggerStatement) \
89 V(NameDictionaryLookup) \ 88 V(NameDictionaryLookup) \
90 V(ElementsTransitionAndStore) \ 89 V(ElementsTransitionAndStore) \
91 V(TransitionElementsKind) \ 90 V(TransitionElementsKind) \
92 V(StoreArrayLiteralElement) \ 91 V(StoreArrayLiteralElement) \
93 V(StubFailureTrampoline) \ 92 V(StubFailureTrampoline) \
94 V(StubFailureTailCallTrampoline) \
95 V(ArrayConstructor) \ 93 V(ArrayConstructor) \
96 V(InternalArrayConstructor) \ 94 V(InternalArrayConstructor) \
97 V(ProfileEntryHook) \ 95 V(ProfileEntryHook) \
98 V(StoreGlobal) \ 96 V(StoreGlobal) \
97 V(CallApiFunction) \
98 V(CallApiGetter) \
99 /* IC Handler stubs */ \ 99 /* IC Handler stubs */ \
100 V(LoadField) \ 100 V(LoadField) \
101 V(KeyedLoadField) \ 101 V(KeyedLoadField)
102 V(KeyedArrayCall)
103 102
104 // List of code stubs only used on ARM platforms. 103 // List of code stubs only used on ARM platforms.
105 #if V8_TARGET_ARCH_ARM 104 #if defined(V8_TARGET_ARCH_ARM) || defined(V8_TARGET_ARCH_A64)
106 #define CODE_STUB_LIST_ARM(V) \ 105 #define CODE_STUB_LIST_ARM(V) \
107 V(GetProperty) \ 106 V(GetProperty) \
108 V(SetProperty) \ 107 V(SetProperty) \
109 V(InvokeBuiltin) \ 108 V(InvokeBuiltin) \
110 V(DirectCEntry) 109 V(DirectCEntry)
111 #else 110 #else
112 #define CODE_STUB_LIST_ARM(V) 111 #define CODE_STUB_LIST_ARM(V)
113 #endif 112 #endif
114 113
115 // List of code stubs only used on MIPS platforms. 114 // List of code stubs only used on MIPS platforms.
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 // Gets the major key from a code object that is a code stub or binary op IC. 155 // Gets the major key from a code object that is a code stub or binary op IC.
157 static Major GetMajorKey(Code* code_stub) { 156 static Major GetMajorKey(Code* code_stub) {
158 return static_cast<Major>(code_stub->major_key()); 157 return static_cast<Major>(code_stub->major_key());
159 } 158 }
160 159
161 static const char* MajorName(Major major_key, bool allow_unknown_keys); 160 static const char* MajorName(Major major_key, bool allow_unknown_keys);
162 161
163 virtual ~CodeStub() {} 162 virtual ~CodeStub() {}
164 163
165 static void GenerateStubsAheadOfTime(Isolate* isolate); 164 static void GenerateStubsAheadOfTime(Isolate* isolate);
166 static void GenerateStubsRequiringBuiltinsAheadOfTime(Isolate* isolate);
167 static void GenerateFPStubs(Isolate* isolate); 165 static void GenerateFPStubs(Isolate* isolate);
168 166
169 // Some stubs put untagged junk on the stack that cannot be scanned by the 167 // Some stubs put untagged junk on the stack that cannot be scanned by the
170 // GC. This means that we must be statically sure that no GC can occur while 168 // GC. This means that we must be statically sure that no GC can occur while
171 // they are running. If that is the case they should override this to return 169 // they are running. If that is the case they should override this to return
172 // true, which will cause an assertion if we try to call something that can 170 // true, which will cause an assertion if we try to call something that can
173 // GC or if we try to put a stack frame on top of the junk, which would not 171 // GC or if we try to put a stack frame on top of the junk, which would not
174 // result in a traversable stack. 172 // result in a traversable stack.
175 virtual bool SometimesSetsUpAFrame() { return true; } 173 virtual bool SometimesSetsUpAFrame() { return true; }
176 174
177 // Lookup the code in the (possibly custom) cache. 175 // Lookup the code in the (possibly custom) cache.
178 bool FindCodeInCache(Code** code_out, Isolate* isolate); 176 bool FindCodeInCache(Code** code_out, Isolate* isolate);
179 177
180 // Returns information for computing the number key. 178 // Returns information for computing the number key.
181 virtual Major MajorKey() = 0; 179 virtual Major MajorKey() = 0;
182 virtual int MinorKey() = 0; 180 virtual int MinorKey() = 0;
183 181
184 virtual InlineCacheState GetICState() { 182 virtual InlineCacheState GetICState() {
185 return UNINITIALIZED; 183 return UNINITIALIZED;
186 } 184 }
187 virtual ExtraICState GetExtraICState() { 185 virtual ExtraICState GetExtraICState() {
188 return kNoExtraICState; 186 return kNoExtraICState;
189 } 187 }
190 virtual Code::StubType GetStubType() { 188 virtual Code::StubType GetStubType() {
191 return Code::NORMAL; 189 return Code::NORMAL;
192 } 190 }
193 virtual int GetStubFlags() {
194 return -1;
195 }
196 191
197 virtual void PrintName(StringStream* stream); 192 virtual void PrintName(StringStream* stream);
198 193
199 // Returns a name for logging/debugging purposes. 194 // Returns a name for logging/debugging purposes.
200 SmartArrayPointer<const char> GetName(); 195 SmartArrayPointer<const char> GetName();
201 196
202 protected: 197 protected:
203 static bool CanUseFPRegisters(); 198 static bool CanUseFPRegisters();
204 199
205 // Generates the assembler code for the stub. 200 // Generates the assembler code for the stub.
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 262
268 protected: 263 protected:
269 // Generates the assembler code for the stub. 264 // Generates the assembler code for the stub.
270 virtual void Generate(MacroAssembler* masm) = 0; 265 virtual void Generate(MacroAssembler* masm) = 0;
271 }; 266 };
272 267
273 268
274 enum StubFunctionMode { NOT_JS_FUNCTION_STUB_MODE, JS_FUNCTION_STUB_MODE }; 269 enum StubFunctionMode { NOT_JS_FUNCTION_STUB_MODE, JS_FUNCTION_STUB_MODE };
275 enum HandlerArgumentsMode { DONT_PASS_ARGUMENTS, PASS_ARGUMENTS }; 270 enum HandlerArgumentsMode { DONT_PASS_ARGUMENTS, PASS_ARGUMENTS };
276 271
277 enum ContinuationType { NORMAL_CONTINUATION, TAIL_CALL_CONTINUATION };
278
279
280 struct CodeStubInterfaceDescriptor { 272 struct CodeStubInterfaceDescriptor {
281 CodeStubInterfaceDescriptor(); 273 CodeStubInterfaceDescriptor();
282 int register_param_count_; 274 int register_param_count_;
283 275
284 Register stack_parameter_count_; 276 Register stack_parameter_count_;
285 // if hint_stack_parameter_count_ > 0, the code stub can optimize the 277 // if hint_stack_parameter_count_ > 0, the code stub can optimize the
286 // return sequence. Default value is -1, which means it is ignored. 278 // return sequence. Default value is -1, which means it is ignored.
287 int hint_stack_parameter_count_; 279 int hint_stack_parameter_count_;
288 ContinuationType continuation_type_;
289 StubFunctionMode function_mode_; 280 StubFunctionMode function_mode_;
290 Register* register_params_; 281 Register* register_params_;
291 282
292 Address deoptimization_handler_; 283 Address deoptimization_handler_;
293 HandlerArgumentsMode handler_arguments_mode_; 284 HandlerArgumentsMode handler_arguments_mode_;
294 285
295 bool initialized() const { return register_param_count_ >= 0; } 286 bool initialized() const { return register_param_count_ >= 0; }
296 287
297 bool HasTailCallContinuation() const {
298 return continuation_type_ == TAIL_CALL_CONTINUATION;
299 }
300
301 int environment_length() const { 288 int environment_length() const {
302 return register_param_count_; 289 return register_param_count_;
303 } 290 }
304 291
305 void SetMissHandler(ExternalReference handler) { 292 void SetMissHandler(ExternalReference handler) {
306 miss_handler_ = handler; 293 miss_handler_ = handler;
307 has_miss_handler_ = true; 294 has_miss_handler_ = true;
308 // Our miss handler infrastructure doesn't currently support 295 // Our miss handler infrastructure doesn't currently support
309 // variable stack parameter counts. 296 // variable stack parameter counts.
310 ASSERT(!stack_parameter_count_.is_valid()); 297 ASSERT(!stack_parameter_count_.is_valid());
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
439 virtual void AfterCall(MacroAssembler* masm) const = 0; 426 virtual void AfterCall(MacroAssembler* masm) const = 0;
440 427
441 protected: 428 protected:
442 RuntimeCallHelper() {} 429 RuntimeCallHelper() {}
443 430
444 private: 431 private:
445 DISALLOW_COPY_AND_ASSIGN(RuntimeCallHelper); 432 DISALLOW_COPY_AND_ASSIGN(RuntimeCallHelper);
446 }; 433 };
447 434
448 435
449 // TODO(bmeurer): Move to the StringAddStub declaration once we're
450 // done with the translation to a hydrogen code stub.
451 enum StringAddFlags {
452 // Omit both parameter checks.
453 STRING_ADD_CHECK_NONE = 0,
454 // Check left parameter.
455 STRING_ADD_CHECK_LEFT = 1 << 0,
456 // Check right parameter.
457 STRING_ADD_CHECK_RIGHT = 1 << 1,
458 // Check both parameters.
459 STRING_ADD_CHECK_BOTH = STRING_ADD_CHECK_LEFT | STRING_ADD_CHECK_RIGHT
460 };
461
462 } } // namespace v8::internal 436 } } // namespace v8::internal
463 437
464 #if V8_TARGET_ARCH_IA32 438 #if V8_TARGET_ARCH_IA32
465 #include "ia32/code-stubs-ia32.h" 439 #include "ia32/code-stubs-ia32.h"
466 #elif V8_TARGET_ARCH_X64 440 #elif V8_TARGET_ARCH_X64
467 #include "x64/code-stubs-x64.h" 441 #include "x64/code-stubs-x64.h"
442 #elif V8_TARGET_ARCH_A64
443 #include "a64/code-stubs-a64.h"
468 #elif V8_TARGET_ARCH_ARM 444 #elif V8_TARGET_ARCH_ARM
469 #include "arm/code-stubs-arm.h" 445 #include "arm/code-stubs-arm.h"
470 #elif V8_TARGET_ARCH_MIPS 446 #elif V8_TARGET_ARCH_MIPS
471 #include "mips/code-stubs-mips.h" 447 #include "mips/code-stubs-mips.h"
472 #else 448 #else
473 #error Unsupported target architecture. 449 #error Unsupported target architecture.
474 #endif 450 #endif
475 451
476 namespace v8 { 452 namespace v8 {
477 namespace internal { 453 namespace internal {
(...skipping 25 matching lines...) Expand all
503 class ToNumberStub: public HydrogenCodeStub { 479 class ToNumberStub: public HydrogenCodeStub {
504 public: 480 public:
505 ToNumberStub() { } 481 ToNumberStub() { }
506 482
507 virtual Handle<Code> GenerateCode(Isolate* isolate); 483 virtual Handle<Code> GenerateCode(Isolate* isolate);
508 484
509 virtual void InitializeInterfaceDescriptor( 485 virtual void InitializeInterfaceDescriptor(
510 Isolate* isolate, 486 Isolate* isolate,
511 CodeStubInterfaceDescriptor* descriptor); 487 CodeStubInterfaceDescriptor* descriptor);
512 488
489 static void InstallDescriptors(Isolate* isolate) {
490 ToNumberStub stub;
491 stub.InitializeInterfaceDescriptor(
492 isolate,
493 isolate->code_stub_interface_descriptor(CodeStub::ToNumber));
494 }
495
513 private: 496 private:
514 Major MajorKey() { return ToNumber; } 497 Major MajorKey() { return ToNumber; }
515 int NotMissMinorKey() { return 0; } 498 int NotMissMinorKey() { return 0; }
516 }; 499 };
517 500
518 501
519 class NumberToStringStub V8_FINAL : public HydrogenCodeStub { 502 class NumberToStringStub V8_FINAL : public HydrogenCodeStub {
520 public: 503 public:
521 NumberToStringStub() {} 504 NumberToStringStub() {}
522 505
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
562 int NotMissMinorKey() { 545 int NotMissMinorKey() {
563 return StrictModeBits::encode(language_mode_ != CLASSIC_MODE) | 546 return StrictModeBits::encode(language_mode_ != CLASSIC_MODE) |
564 IsGeneratorBits::encode(is_generator_); 547 IsGeneratorBits::encode(is_generator_);
565 } 548 }
566 549
567 LanguageMode language_mode_; 550 LanguageMode language_mode_;
568 bool is_generator_; 551 bool is_generator_;
569 }; 552 };
570 553
571 554
572 class FastNewContextStub : public PlatformCodeStub { 555 class FastNewContextStub V8_FINAL : public HydrogenCodeStub {
573 public: 556 public:
574 static const int kMaximumSlots = 64; 557 static const int kMaximumSlots = 64;
575 558
576 explicit FastNewContextStub(int slots) : slots_(slots) { 559 explicit FastNewContextStub(int slots) : slots_(slots) {
577 ASSERT(slots_ > 0 && slots_ <= kMaximumSlots); 560 ASSERT(slots_ > 0 && slots_ <= kMaximumSlots);
578 } 561 }
579 562
580 void Generate(MacroAssembler* masm); 563 virtual Handle<Code> GenerateCode(Isolate* isolate);
564
565 virtual void InitializeInterfaceDescriptor(
566 Isolate* isolate,
567 CodeStubInterfaceDescriptor* descriptor);
568
569 static void InstallDescriptors(Isolate* isolate);
570
571 int slots() const { return slots_; }
572
573 virtual Major MajorKey() V8_OVERRIDE { return FastNewContext; }
574 virtual int NotMissMinorKey() V8_OVERRIDE { return slots_; }
575
576 // Parameters accessed via CodeStubGraphBuilder::GetParameter()
577 static const int kFunction = 0;
581 578
582 private: 579 private:
583 int slots_; 580 int slots_;
584
585 Major MajorKey() { return FastNewContext; }
586 int MinorKey() { return slots_; }
587 }; 581 };
588 582
589 583
590 class FastNewBlockContextStub : public PlatformCodeStub {
591 public:
592 static const int kMaximumSlots = 64;
593
594 explicit FastNewBlockContextStub(int slots) : slots_(slots) {
595 ASSERT(slots_ > 0 && slots_ <= kMaximumSlots);
596 }
597
598 void Generate(MacroAssembler* masm);
599
600 private:
601 int slots_;
602
603 Major MajorKey() { return FastNewBlockContext; }
604 int MinorKey() { return slots_; }
605 };
606
607 class FastCloneShallowArrayStub : public HydrogenCodeStub { 584 class FastCloneShallowArrayStub : public HydrogenCodeStub {
608 public: 585 public:
609 // Maximum length of copied elements array. 586 // Maximum length of copied elements array.
610 static const int kMaximumClonedLength = 8; 587 static const int kMaximumClonedLength = 8;
611 enum Mode { 588 enum Mode {
612 CLONE_ELEMENTS, 589 CLONE_ELEMENTS,
613 CLONE_DOUBLE_ELEMENTS, 590 CLONE_DOUBLE_ELEMENTS,
614 COPY_ON_WRITE_ELEMENTS, 591 COPY_ON_WRITE_ELEMENTS,
615 CLONE_ANY_ELEMENTS, 592 CLONE_ANY_ELEMENTS,
616 LAST_CLONE_MODE = CLONE_ANY_ELEMENTS 593 LAST_CLONE_MODE = CLONE_ANY_ELEMENTS
(...skipping 30 matching lines...) Expand all
647 UNREACHABLE(); 624 UNREACHABLE();
648 return LAST_ELEMENTS_KIND; 625 return LAST_ELEMENTS_KIND;
649 } 626 }
650 627
651 virtual Handle<Code> GenerateCode(Isolate* isolate); 628 virtual Handle<Code> GenerateCode(Isolate* isolate);
652 629
653 virtual void InitializeInterfaceDescriptor( 630 virtual void InitializeInterfaceDescriptor(
654 Isolate* isolate, 631 Isolate* isolate,
655 CodeStubInterfaceDescriptor* descriptor); 632 CodeStubInterfaceDescriptor* descriptor);
656 633
634 static void InstallDescriptors(Isolate* isolate);
635
657 private: 636 private:
658 Mode mode_; 637 Mode mode_;
659 AllocationSiteMode allocation_site_mode_; 638 AllocationSiteMode allocation_site_mode_;
660 int length_; 639 int length_;
661 640
662 class AllocationSiteModeBits: public BitField<AllocationSiteMode, 0, 1> {}; 641 class AllocationSiteModeBits: public BitField<AllocationSiteMode, 0, 1> {};
663 class ModeBits: public BitField<Mode, 1, 4> {}; 642 class ModeBits: public BitField<Mode, 1, 4> {};
664 class LengthBits: public BitField<int, 5, 4> {}; 643 class LengthBits: public BitField<int, 5, 4> {};
665 // Ensure data fits within available bits. 644 // Ensure data fits within available bits.
666 STATIC_ASSERT(LAST_ALLOCATION_SITE_MODE == 1); 645 STATIC_ASSERT(LAST_ALLOCATION_SITE_MODE == 1);
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
905 884
906 protected: 885 protected:
907 class KindBits: public BitField<Code::Kind, 0, 4> {}; 886 class KindBits: public BitField<Code::Kind, 0, 4> {};
908 virtual Code::Kind kind() const = 0; 887 virtual Code::Kind kind() const = 0;
909 }; 888 };
910 889
911 890
912 class HandlerStub: public HICStub { 891 class HandlerStub: public HICStub {
913 public: 892 public:
914 virtual Code::Kind GetCodeKind() const { return Code::HANDLER; } 893 virtual Code::Kind GetCodeKind() const { return Code::HANDLER; }
915 virtual int GetStubFlags() { return kind(); } 894 virtual ExtraICState GetExtraICState() { return kind(); }
916 895
917 protected: 896 protected:
918 HandlerStub() : HICStub() { } 897 HandlerStub() : HICStub() { }
919 virtual int NotMissMinorKey() { return bit_field_; } 898 virtual int NotMissMinorKey() { return bit_field_; }
920 int bit_field_; 899 int bit_field_;
921 }; 900 };
922 901
923 902
924 class LoadFieldStub: public HandlerStub { 903 class LoadFieldStub: public HandlerStub {
925 public: 904 public:
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
1001 } 980 }
1002 981
1003 virtual Code::Kind kind() const { return Code::STORE_IC; } 982 virtual Code::Kind kind() const { return Code::STORE_IC; }
1004 983
1005 virtual Handle<Code> GenerateCode(Isolate* isolate); 984 virtual Handle<Code> GenerateCode(Isolate* isolate);
1006 985
1007 virtual void InitializeInterfaceDescriptor( 986 virtual void InitializeInterfaceDescriptor(
1008 Isolate* isolate, 987 Isolate* isolate,
1009 CodeStubInterfaceDescriptor* descriptor); 988 CodeStubInterfaceDescriptor* descriptor);
1010 989
1011 virtual ExtraICState GetExtraICState() { return bit_field_; }
1012
1013 bool is_constant() { 990 bool is_constant() {
1014 return IsConstantBits::decode(bit_field_); 991 return IsConstantBits::decode(bit_field_);
1015 } 992 }
1016 void set_is_constant(bool value) { 993 void set_is_constant(bool value) {
1017 bit_field_ = IsConstantBits::update(bit_field_, value); 994 bit_field_ = IsConstantBits::update(bit_field_, value);
1018 } 995 }
1019 996
1020 Representation representation() { 997 Representation representation() {
1021 return Representation::FromKind(RepresentationBits::decode(bit_field_)); 998 return Representation::FromKind(RepresentationBits::decode(bit_field_));
1022 } 999 }
1023 void set_representation(Representation r) { 1000 void set_representation(Representation r) {
1024 bit_field_ = RepresentationBits::update(bit_field_, r.kind()); 1001 bit_field_ = RepresentationBits::update(bit_field_, r.kind());
1025 } 1002 }
1026 1003
1027 private: 1004 private:
1028 virtual int NotMissMinorKey() { return GetExtraICState(); }
1029 Major MajorKey() { return StoreGlobal; } 1005 Major MajorKey() { return StoreGlobal; }
1030 1006
1031 class IsConstantBits: public BitField<bool, 0, 1> {}; 1007 class IsConstantBits: public BitField<bool, 0, 1> {};
1032 class RepresentationBits: public BitField<Representation::Kind, 1, 8> {}; 1008 class RepresentationBits: public BitField<Representation::Kind, 1, 8> {};
1033 1009
1010 DISALLOW_COPY_AND_ASSIGN(StoreGlobalStub);
1011 };
1012
1013
1014 class CallApiFunctionStub : public PlatformCodeStub {
1015 public:
1016 CallApiFunctionStub(bool is_store,
1017 bool call_data_undefined,
1018 int argc) {
1019 bit_field_ =
1020 IsStoreBits::encode(is_store) |
1021 CallDataUndefinedBits::encode(call_data_undefined) |
1022 ArgumentBits::encode(argc);
1023 ASSERT(!is_store || argc == 1);
1024 }
1025
1026 private:
1027 virtual void Generate(MacroAssembler* masm) V8_OVERRIDE;
1028 virtual Major MajorKey() V8_OVERRIDE { return CallApiFunction; }
1029 virtual int MinorKey() V8_OVERRIDE { return bit_field_; }
1030
1031 class IsStoreBits: public BitField<bool, 0, 1> {};
1032 class CallDataUndefinedBits: public BitField<bool, 1, 1> {};
1033 class ArgumentBits: public BitField<int, 2, Code::kArgumentsBits> {};
1034
1034 int bit_field_; 1035 int bit_field_;
1035 1036
1036 DISALLOW_COPY_AND_ASSIGN(StoreGlobalStub); 1037 DISALLOW_COPY_AND_ASSIGN(CallApiFunctionStub);
1038 };
1039
1040
1041 class CallApiGetterStub : public PlatformCodeStub {
1042 public:
1043 CallApiGetterStub() {}
1044
1045 private:
1046 virtual void Generate(MacroAssembler* masm) V8_OVERRIDE;
1047 virtual Major MajorKey() V8_OVERRIDE { return CallApiGetter; }
1048 virtual int MinorKey() V8_OVERRIDE { return 0; }
1049
1050 DISALLOW_COPY_AND_ASSIGN(CallApiGetterStub);
1037 }; 1051 };
1038 1052
1039 1053
1040 class KeyedLoadFieldStub: public LoadFieldStub { 1054 class KeyedLoadFieldStub: public LoadFieldStub {
1041 public: 1055 public:
1042 KeyedLoadFieldStub(bool inobject, int index, Representation representation) 1056 KeyedLoadFieldStub(bool inobject, int index, Representation representation)
1043 : LoadFieldStub() { 1057 : LoadFieldStub() {
1044 Initialize(Code::KEYED_LOAD_IC, inobject, index, representation); 1058 Initialize(Code::KEYED_LOAD_IC, inobject, index, representation);
1045 } 1059 }
1046 1060
1047 virtual void InitializeInterfaceDescriptor( 1061 virtual void InitializeInterfaceDescriptor(
1048 Isolate* isolate,
1049 CodeStubInterfaceDescriptor* descriptor);
1050
1051 virtual Handle<Code> GenerateCode(Isolate* isolate);
1052
1053 private:
1054 virtual CodeStub::Major MajorKey() { return KeyedLoadField; }
1055 };
1056
1057
1058 class KeyedArrayCallStub: public HICStub {
1059 public:
1060 KeyedArrayCallStub(bool holey, int argc) : HICStub(), argc_(argc) {
1061 bit_field_ = HoleyBits::encode(holey);
1062 }
1063
1064 virtual Code::Kind kind() const { return Code::KEYED_CALL_IC; }
1065 virtual ExtraICState GetExtraICState() { return bit_field_; }
1066
1067 ElementsKind elements_kind() {
1068 return HoleyBits::decode(bit_field_) ? FAST_HOLEY_ELEMENTS : FAST_ELEMENTS;
1069 }
1070
1071 int argc() { return argc_; }
1072 virtual int GetStubFlags() { return argc(); }
1073
1074 static bool IsHoley(Handle<Code> code) {
1075 ExtraICState state = code->extra_ic_state();
1076 return HoleyBits::decode(state);
1077 }
1078
1079 virtual void InitializeInterfaceDescriptor(
1080 Isolate* isolate, 1062 Isolate* isolate,
1081 CodeStubInterfaceDescriptor* descriptor); 1063 CodeStubInterfaceDescriptor* descriptor);
1082 1064
1083 virtual Handle<Code> GenerateCode(Isolate* isolate); 1065 virtual Handle<Code> GenerateCode(Isolate* isolate);
1084 1066
1085 private: 1067 private:
1086 virtual int NotMissMinorKey() { 1068 virtual CodeStub::Major MajorKey() { return KeyedLoadField; }
1087 return GetExtraICState() | ArgcBits::encode(argc_);
1088 }
1089
1090 class HoleyBits: public BitField<bool, 0, 1> {};
1091 STATIC_ASSERT(Code::kArgumentsBits <= kStubMinorKeyBits - 1);
1092 class ArgcBits: public BitField<int, 1, Code::kArgumentsBits> {};
1093 virtual CodeStub::Major MajorKey() { return KeyedArrayCall; }
1094 int bit_field_;
1095 int argc_;
1096 }; 1069 };
1097 1070
1098 1071
1099 class BinaryOpICStub : public HydrogenCodeStub { 1072 class BinaryOpICStub : public HydrogenCodeStub {
1100 public: 1073 public:
1101 BinaryOpICStub(Token::Value op, OverwriteMode mode) 1074 BinaryOpICStub(Token::Value op, OverwriteMode mode)
1102 : HydrogenCodeStub(UNINITIALIZED), state_(op, mode) {} 1075 : HydrogenCodeStub(UNINITIALIZED), state_(op, mode) {}
1103 1076
1104 explicit BinaryOpICStub(const BinaryOpIC::State& state) : state_(state) {} 1077 explicit BinaryOpICStub(const BinaryOpIC::State& state) : state_(state) {}
1105 1078
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
1144 private: 1117 private:
1145 static void GenerateAheadOfTime(Isolate* isolate, 1118 static void GenerateAheadOfTime(Isolate* isolate,
1146 const BinaryOpIC::State& state); 1119 const BinaryOpIC::State& state);
1147 1120
1148 BinaryOpIC::State state_; 1121 BinaryOpIC::State state_;
1149 1122
1150 DISALLOW_COPY_AND_ASSIGN(BinaryOpICStub); 1123 DISALLOW_COPY_AND_ASSIGN(BinaryOpICStub);
1151 }; 1124 };
1152 1125
1153 1126
1127 class ArrayPushStub: public PlatformCodeStub {
1128 public:
1129 ArrayPushStub(ElementsKind kind, int argc) {
1130 bit_field_ = ElementsKindBits::encode(kind) | ArgcBits::encode(argc);
1131 }
1132
1133 void Generate(MacroAssembler* masm);
1134
1135 private:
1136 int arguments_count() { return ArgcBits::decode(bit_field_); }
1137 ElementsKind elements_kind() {
1138 return ElementsKindBits::decode(bit_field_);
1139 }
1140
1141 virtual CodeStub::Major MajorKey() { return ArrayPush; }
1142 virtual int MinorKey() { return bit_field_; }
1143
1144 class ElementsKindBits: public BitField<ElementsKind, 0, 3> {};
1145 class ArgcBits: public BitField<int, 3, Code::kArgumentsBits> {};
1146
1147 int bit_field_;
1148 };
1149
1150
1154 // TODO(bmeurer): Merge this into the BinaryOpICStub once we have proper tail 1151 // TODO(bmeurer): Merge this into the BinaryOpICStub once we have proper tail
1155 // call support for stubs in Hydrogen. 1152 // call support for stubs in Hydrogen.
1156 class BinaryOpICWithAllocationSiteStub V8_FINAL : public PlatformCodeStub { 1153 class BinaryOpICWithAllocationSiteStub V8_FINAL : public PlatformCodeStub {
1157 public: 1154 public:
1158 explicit BinaryOpICWithAllocationSiteStub(const BinaryOpIC::State& state) 1155 explicit BinaryOpICWithAllocationSiteStub(const BinaryOpIC::State& state)
1159 : state_(state) {} 1156 : state_(state) {}
1160 1157
1161 static void GenerateAheadOfTime(Isolate* isolate); 1158 static void GenerateAheadOfTime(Isolate* isolate);
1162 1159
1163 Handle<Code> GetCodeCopyFromTemplate(Isolate* isolate, 1160 Handle<Code> GetCodeCopyFromTemplate(Isolate* isolate,
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
1224 return BinaryOpWithAllocationSite; 1221 return BinaryOpWithAllocationSite;
1225 } 1222 }
1226 1223
1227 // Parameters accessed via CodeStubGraphBuilder::GetParameter() 1224 // Parameters accessed via CodeStubGraphBuilder::GetParameter()
1228 static const int kAllocationSite = 0; 1225 static const int kAllocationSite = 0;
1229 static const int kLeft = 1; 1226 static const int kLeft = 1;
1230 static const int kRight = 2; 1227 static const int kRight = 2;
1231 }; 1228 };
1232 1229
1233 1230
1234 // TODO(bmeurer): Rename to StringAddStub once we dropped the old StringAddStub. 1231 enum StringAddFlags {
1235 class NewStringAddStub V8_FINAL : public HydrogenCodeStub { 1232 // Omit both parameter checks.
1233 STRING_ADD_CHECK_NONE = 0,
1234 // Check left parameter.
1235 STRING_ADD_CHECK_LEFT = 1 << 0,
1236 // Check right parameter.
1237 STRING_ADD_CHECK_RIGHT = 1 << 1,
1238 // Check both parameters.
1239 STRING_ADD_CHECK_BOTH = STRING_ADD_CHECK_LEFT | STRING_ADD_CHECK_RIGHT
1240 };
1241
1242
1243 class StringAddStub V8_FINAL : public HydrogenCodeStub {
1236 public: 1244 public:
1237 NewStringAddStub(StringAddFlags flags, PretenureFlag pretenure_flag) 1245 StringAddStub(StringAddFlags flags, PretenureFlag pretenure_flag)
1238 : bit_field_(StringAddFlagsBits::encode(flags) | 1246 : bit_field_(StringAddFlagsBits::encode(flags) |
1239 PretenureFlagBits::encode(pretenure_flag)) {} 1247 PretenureFlagBits::encode(pretenure_flag)) {}
1240 1248
1241 StringAddFlags flags() const { 1249 StringAddFlags flags() const {
1242 return StringAddFlagsBits::decode(bit_field_); 1250 return StringAddFlagsBits::decode(bit_field_);
1243 } 1251 }
1244 1252
1245 PretenureFlag pretenure_flag() const { 1253 PretenureFlag pretenure_flag() const {
1246 return PretenureFlagBits::decode(bit_field_); 1254 return PretenureFlagBits::decode(bit_field_);
1247 } 1255 }
(...skipping 12 matching lines...) Expand all
1260 1268
1261 // Parameters accessed via CodeStubGraphBuilder::GetParameter() 1269 // Parameters accessed via CodeStubGraphBuilder::GetParameter()
1262 static const int kLeft = 0; 1270 static const int kLeft = 0;
1263 static const int kRight = 1; 1271 static const int kRight = 1;
1264 1272
1265 private: 1273 private:
1266 class StringAddFlagsBits: public BitField<StringAddFlags, 0, 2> {}; 1274 class StringAddFlagsBits: public BitField<StringAddFlags, 0, 2> {};
1267 class PretenureFlagBits: public BitField<PretenureFlag, 2, 1> {}; 1275 class PretenureFlagBits: public BitField<PretenureFlag, 2, 1> {};
1268 uint32_t bit_field_; 1276 uint32_t bit_field_;
1269 1277
1270 virtual Major MajorKey() V8_OVERRIDE { return NewStringAdd; } 1278 virtual Major MajorKey() V8_OVERRIDE { return StringAdd; }
1271 virtual int NotMissMinorKey() V8_OVERRIDE { return bit_field_; } 1279 virtual int NotMissMinorKey() V8_OVERRIDE { return bit_field_; }
1272 1280
1273 virtual void PrintBaseName(StringStream* stream) V8_OVERRIDE; 1281 virtual void PrintBaseName(StringStream* stream) V8_OVERRIDE;
1274 1282
1275 DISALLOW_COPY_AND_ASSIGN(NewStringAddStub); 1283 DISALLOW_COPY_AND_ASSIGN(StringAddStub);
1276 }; 1284 };
1277 1285
1278 1286
1279 class ICCompareStub: public PlatformCodeStub { 1287 class ICCompareStub: public PlatformCodeStub {
1280 public: 1288 public:
1281 ICCompareStub(Token::Value op, 1289 ICCompareStub(Token::Value op,
1282 CompareIC::State left, 1290 CompareIC::State left,
1283 CompareIC::State right, 1291 CompareIC::State right,
1284 CompareIC::State handler) 1292 CompareIC::State handler)
1285 : op_(op), 1293 : op_(op),
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
1336 Token::Value op_; 1344 Token::Value op_;
1337 CompareIC::State left_; 1345 CompareIC::State left_;
1338 CompareIC::State right_; 1346 CompareIC::State right_;
1339 CompareIC::State state_; 1347 CompareIC::State state_;
1340 Handle<Map> known_map_; 1348 Handle<Map> known_map_;
1341 }; 1349 };
1342 1350
1343 1351
1344 class CompareNilICStub : public HydrogenCodeStub { 1352 class CompareNilICStub : public HydrogenCodeStub {
1345 public: 1353 public:
1346 Handle<Type> GetType(Isolate* isolate, Handle<Map> map = Handle<Map>()); 1354 Type* GetType(Zone* zone, Handle<Map> map = Handle<Map>());
1347 Handle<Type> GetInputType(Isolate* isolate, Handle<Map> map); 1355 Type* GetInputType(Zone* zone, Handle<Map> map);
1348 1356
1349 explicit CompareNilICStub(NilValue nil) : nil_value_(nil) { } 1357 explicit CompareNilICStub(NilValue nil) : nil_value_(nil) { }
1350 1358
1351 CompareNilICStub(ExtraICState ic_state, 1359 CompareNilICStub(ExtraICState ic_state,
1352 InitializationState init_state = INITIALIZED) 1360 InitializationState init_state = INITIALIZED)
1353 : HydrogenCodeStub(init_state), 1361 : HydrogenCodeStub(init_state),
1354 nil_value_(NilValueField::decode(ic_state)), 1362 nil_value_(NilValueField::decode(ic_state)),
1355 state_(State(TypesField::decode(ic_state))) { 1363 state_(State(TypesField::decode(ic_state))) {
1356 } 1364 }
1357 1365
1358 static Handle<Code> GetUninitialized(Isolate* isolate, 1366 static Handle<Code> GetUninitialized(Isolate* isolate,
1359 NilValue nil) { 1367 NilValue nil) {
1360 return CompareNilICStub(nil, UNINITIALIZED).GetCode(isolate); 1368 return CompareNilICStub(nil, UNINITIALIZED).GetCode(isolate);
1361 } 1369 }
1362 1370
1363 virtual void InitializeInterfaceDescriptor( 1371 virtual void InitializeInterfaceDescriptor(
1364 Isolate* isolate, 1372 Isolate* isolate,
1365 CodeStubInterfaceDescriptor* descriptor); 1373 CodeStubInterfaceDescriptor* descriptor);
1366 1374
1367 static void InitializeForIsolate(Isolate* isolate) { 1375 static void InstallDescriptors(Isolate* isolate) {
1368 CompareNilICStub compare_stub(kNullValue, UNINITIALIZED); 1376 CompareNilICStub compare_stub(kNullValue, UNINITIALIZED);
1369 compare_stub.InitializeInterfaceDescriptor( 1377 compare_stub.InitializeInterfaceDescriptor(
1370 isolate, 1378 isolate,
1371 isolate->code_stub_interface_descriptor(CodeStub::CompareNilIC)); 1379 isolate->code_stub_interface_descriptor(CodeStub::CompareNilIC));
1372 } 1380 }
1373 1381
1374 virtual InlineCacheState GetICState() { 1382 virtual InlineCacheState GetICState() {
1375 if (state_.Contains(GENERIC)) { 1383 if (state_.Contains(GENERIC)) {
1376 return MEGAMORPHIC; 1384 return MEGAMORPHIC;
1377 } else if (state_.Contains(MONOMORPHIC_MAP)) { 1385 } else if (state_.Contains(MONOMORPHIC_MAP)) {
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
1544 RegExpExecStub() { } 1552 RegExpExecStub() { }
1545 1553
1546 private: 1554 private:
1547 Major MajorKey() { return RegExpExec; } 1555 Major MajorKey() { return RegExpExec; }
1548 int MinorKey() { return 0; } 1556 int MinorKey() { return 0; }
1549 1557
1550 void Generate(MacroAssembler* masm); 1558 void Generate(MacroAssembler* masm);
1551 }; 1559 };
1552 1560
1553 1561
1554 class RegExpConstructResultStub: public PlatformCodeStub { 1562 class RegExpConstructResultStub V8_FINAL : public HydrogenCodeStub {
1555 public: 1563 public:
1556 RegExpConstructResultStub() { } 1564 RegExpConstructResultStub() { }
1557 1565
1566 virtual Handle<Code> GenerateCode(Isolate* isolate) V8_OVERRIDE;
1567
1568 virtual void InitializeInterfaceDescriptor(
1569 Isolate* isolate,
1570 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE;
1571
1572 virtual Major MajorKey() V8_OVERRIDE { return RegExpConstructResult; }
1573 virtual int NotMissMinorKey() V8_OVERRIDE { return 0; }
1574
1575 static void InstallDescriptors(Isolate* isolate);
1576
1577 // Parameters accessed via CodeStubGraphBuilder::GetParameter()
1578 static const int kLength = 0;
1579 static const int kIndex = 1;
1580 static const int kInput = 2;
1581
1558 private: 1582 private:
1559 Major MajorKey() { return RegExpConstructResult; } 1583 DISALLOW_COPY_AND_ASSIGN(RegExpConstructResultStub);
1560 int MinorKey() { return 0; }
1561
1562 void Generate(MacroAssembler* masm);
1563 }; 1584 };
1564 1585
1565 1586
1566 class CallFunctionStub: public PlatformCodeStub { 1587 class CallFunctionStub: public PlatformCodeStub {
1567 public: 1588 public:
1568 CallFunctionStub(int argc, CallFunctionFlags flags) 1589 CallFunctionStub(int argc, CallFunctionFlags flags)
1569 : argc_(argc), flags_(flags) { } 1590 : argc_(argc), flags_(flags) { }
1570 1591
1571 void Generate(MacroAssembler* masm); 1592 void Generate(MacroAssembler* masm);
1572 1593
1573 virtual void FinishCode(Handle<Code> code) { 1594 virtual void FinishCode(Handle<Code> code) {
1574 code->set_has_function_cache(RecordCallTarget()); 1595 code->set_has_function_cache(RecordCallTarget());
1575 } 1596 }
1576 1597
1577 static int ExtractArgcFromMinorKey(int minor_key) { 1598 static int ExtractArgcFromMinorKey(int minor_key) {
1578 return ArgcBits::decode(minor_key); 1599 return ArgcBits::decode(minor_key);
1579 } 1600 }
1580 1601
1581 private: 1602 private:
1582 int argc_; 1603 int argc_;
1583 CallFunctionFlags flags_; 1604 CallFunctionFlags flags_;
1584 1605
1585 virtual void PrintName(StringStream* stream); 1606 virtual void PrintName(StringStream* stream);
1586 1607
1587 // Minor key encoding in 32 bits with Bitfield <Type, shift, size>. 1608 // Minor key encoding in 32 bits with Bitfield <Type, shift, size>.
1588 class FlagBits: public BitField<CallFunctionFlags, 0, 1> {}; 1609 class FlagBits: public BitField<CallFunctionFlags, 0, 2> {};
1589 class ArgcBits: public BitField<unsigned, 1, 32 - 1> {}; 1610 class ArgcBits: public BitField<unsigned, 2, 32 - 2> {};
1590 1611
1591 Major MajorKey() { return CallFunction; } 1612 Major MajorKey() { return CallFunction; }
1592 int MinorKey() { 1613 int MinorKey() {
1593 // Encode the parameters in a unique 32 bit value. 1614 // Encode the parameters in a unique 32 bit value.
1594 return FlagBits::encode(flags_) | ArgcBits::encode(argc_); 1615 return FlagBits::encode(flags_) | ArgcBits::encode(argc_);
1595 } 1616 }
1596 1617
1597 bool RecordCallTarget() { 1618 bool RecordCallTarget() {
1598 return (flags_ & RECORD_CALL_TARGET) != 0; 1619 return flags_ == RECORD_CALL_TARGET;
1620 }
1621
1622 bool CallAsMethod() {
1623 return flags_ == CALL_AS_METHOD || flags_ == WRAP_AND_CALL;
1624 }
1625
1626 bool NeedsChecks() {
1627 return flags_ != WRAP_AND_CALL;
1599 } 1628 }
1600 }; 1629 };
1601 1630
1602 1631
1603 class CallConstructStub: public PlatformCodeStub { 1632 class CallConstructStub: public PlatformCodeStub {
1604 public: 1633 public:
1605 explicit CallConstructStub(CallFunctionFlags flags) : flags_(flags) {} 1634 explicit CallConstructStub(CallFunctionFlags flags) : flags_(flags) {}
1606 1635
1607 void Generate(MacroAssembler* masm); 1636 void Generate(MacroAssembler* masm);
1608 1637
1609 virtual void FinishCode(Handle<Code> code) { 1638 virtual void FinishCode(Handle<Code> code) {
1610 code->set_has_function_cache(RecordCallTarget()); 1639 code->set_has_function_cache(RecordCallTarget());
1611 } 1640 }
1612 1641
1613 private: 1642 private:
1614 CallFunctionFlags flags_; 1643 CallFunctionFlags flags_;
1615 1644
1616 virtual void PrintName(StringStream* stream); 1645 virtual void PrintName(StringStream* stream);
1617 1646
1618 Major MajorKey() { return CallConstruct; } 1647 Major MajorKey() { return CallConstruct; }
1619 int MinorKey() { return flags_; } 1648 int MinorKey() { return flags_; }
1620 1649
1621 bool RecordCallTarget() { 1650 bool RecordCallTarget() {
1622 return (flags_ & RECORD_CALL_TARGET) != 0; 1651 return (flags_ & RECORD_CALL_TARGET) != 0;
1623 } 1652 }
1653
1654 bool CallAsMethod() {
1655 return (flags_ & CALL_AS_METHOD) != 0;
1656 }
1624 }; 1657 };
1625 1658
1626 1659
1627 enum StringIndexFlags { 1660 enum StringIndexFlags {
1628 // Accepts smis or heap numbers. 1661 // Accepts smis or heap numbers.
1629 STRING_INDEX_IS_NUMBER, 1662 STRING_INDEX_IS_NUMBER,
1630 1663
1631 // Accepts smis or heap numbers that are valid array indices 1664 // Accepts smis or heap numbers that are valid array indices
1632 // (ECMA-262 15.4). Invalid indices are reported as being out of 1665 // (ECMA-262 15.4). Invalid indices are reported as being out of
1633 // range. 1666 // range.
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
1830 }; 1863 };
1831 1864
1832 1865
1833 class DoubleToIStub : public PlatformCodeStub { 1866 class DoubleToIStub : public PlatformCodeStub {
1834 public: 1867 public:
1835 DoubleToIStub(Register source, 1868 DoubleToIStub(Register source,
1836 Register destination, 1869 Register destination,
1837 int offset, 1870 int offset,
1838 bool is_truncating, 1871 bool is_truncating,
1839 bool skip_fastpath = false) : bit_field_(0) { 1872 bool skip_fastpath = false) : bit_field_(0) {
1840 bit_field_ = SourceRegisterBits::encode(source.code_) | 1873 bit_field_ = SourceRegisterBits::encode(source.code()) |
1841 DestinationRegisterBits::encode(destination.code_) | 1874 DestinationRegisterBits::encode(destination.code()) |
1842 OffsetBits::encode(offset) | 1875 OffsetBits::encode(offset) |
1843 IsTruncatingBits::encode(is_truncating) | 1876 IsTruncatingBits::encode(is_truncating) |
1844 SkipFastPathBits::encode(skip_fastpath) | 1877 SkipFastPathBits::encode(skip_fastpath) |
1845 SSEBits::encode(CpuFeatures::IsSafeForSnapshot(SSE2) ? 1878 SSEBits::encode(CpuFeatures::IsSafeForSnapshot(SSE2) ?
1846 CpuFeatures::IsSafeForSnapshot(SSE3) ? 2 : 1 : 0); 1879 CpuFeatures::IsSafeForSnapshot(SSE3) ? 2 : 1 : 0);
1847 } 1880 }
1848 1881
1849 Register source() { 1882 Register source() {
1850 Register result = { SourceRegisterBits::decode(bit_field_) }; 1883 return Register::from_code(SourceRegisterBits::decode(bit_field_));
1851 return result;
1852 } 1884 }
1853 1885
1854 Register destination() { 1886 Register destination() {
1855 Register result = { DestinationRegisterBits::decode(bit_field_) }; 1887 return Register::from_code(DestinationRegisterBits::decode(bit_field_));
1856 return result;
1857 } 1888 }
1858 1889
1859 bool is_truncating() { 1890 bool is_truncating() {
1860 return IsTruncatingBits::decode(bit_field_); 1891 return IsTruncatingBits::decode(bit_field_);
1861 } 1892 }
1862 1893
1863 bool skip_fastpath() { 1894 bool skip_fastpath() {
1864 return SkipFastPathBits::decode(bit_field_); 1895 return SkipFastPathBits::decode(bit_field_);
1865 } 1896 }
1866 1897
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
2030 2061
2031 AllocationSiteOverrideMode override_mode() const { 2062 AllocationSiteOverrideMode override_mode() const {
2032 return AllocationSiteOverrideModeBits::decode(bit_field_); 2063 return AllocationSiteOverrideModeBits::decode(bit_field_);
2033 } 2064 }
2034 2065
2035 static void GenerateStubsAheadOfTime(Isolate* isolate); 2066 static void GenerateStubsAheadOfTime(Isolate* isolate);
2036 static void InstallDescriptors(Isolate* isolate); 2067 static void InstallDescriptors(Isolate* isolate);
2037 2068
2038 // Parameters accessed via CodeStubGraphBuilder::GetParameter() 2069 // Parameters accessed via CodeStubGraphBuilder::GetParameter()
2039 static const int kConstructor = 0; 2070 static const int kConstructor = 0;
2040 static const int kPropertyCell = 1; 2071 static const int kAllocationSite = 1;
2041 2072
2042 protected: 2073 protected:
2043 void BasePrintName(const char* name, StringStream* stream); 2074 void BasePrintName(const char* name, StringStream* stream);
2044 2075
2045 private: 2076 private:
2046 int NotMissMinorKey() { return bit_field_; } 2077 int NotMissMinorKey() { return bit_field_; }
2047 2078
2048 // Ensure data fits within available bits. 2079 // Ensure data fits within available bits.
2049 STATIC_ASSERT(LAST_ALLOCATION_SITE_OVERRIDE_MODE == 1); 2080 STATIC_ASSERT(LAST_ALLOCATION_SITE_OVERRIDE_MODE == 1);
2050 2081
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
2291 virtual Handle<Code> GenerateCode(Isolate* isolate); 2322 virtual Handle<Code> GenerateCode(Isolate* isolate);
2292 virtual void InitializeInterfaceDescriptor( 2323 virtual void InitializeInterfaceDescriptor(
2293 Isolate* isolate, 2324 Isolate* isolate,
2294 CodeStubInterfaceDescriptor* descriptor); 2325 CodeStubInterfaceDescriptor* descriptor);
2295 2326
2296 virtual Code::Kind GetCodeKind() const { return Code::TO_BOOLEAN_IC; } 2327 virtual Code::Kind GetCodeKind() const { return Code::TO_BOOLEAN_IC; }
2297 virtual void PrintState(StringStream* stream); 2328 virtual void PrintState(StringStream* stream);
2298 2329
2299 virtual bool SometimesSetsUpAFrame() { return false; } 2330 virtual bool SometimesSetsUpAFrame() { return false; }
2300 2331
2301 static void InitializeForIsolate(Isolate* isolate) { 2332 static void InstallDescriptors(Isolate* isolate) {
2302 ToBooleanStub stub; 2333 ToBooleanStub stub;
2303 stub.InitializeInterfaceDescriptor( 2334 stub.InitializeInterfaceDescriptor(
2304 isolate, 2335 isolate,
2305 isolate->code_stub_interface_descriptor(CodeStub::ToBoolean)); 2336 isolate->code_stub_interface_descriptor(CodeStub::ToBoolean));
2306 } 2337 }
2307 2338
2308 static Handle<Code> GetUninitialized(Isolate* isolate) { 2339 static Handle<Code> GetUninitialized(Isolate* isolate) {
2309 return ToBooleanStub(UNINITIALIZED).GetCode(isolate); 2340 return ToBooleanStub(UNINITIALIZED).GetCode(isolate);
2310 } 2341 }
2311 2342
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
2415 2446
2416 void Generate(MacroAssembler* masm); 2447 void Generate(MacroAssembler* masm);
2417 2448
2418 bool fp_registers_; 2449 bool fp_registers_;
2419 StubFunctionMode function_mode_; 2450 StubFunctionMode function_mode_;
2420 2451
2421 DISALLOW_COPY_AND_ASSIGN(StubFailureTrampolineStub); 2452 DISALLOW_COPY_AND_ASSIGN(StubFailureTrampolineStub);
2422 }; 2453 };
2423 2454
2424 2455
2425 class StubFailureTailCallTrampolineStub : public PlatformCodeStub {
2426 public:
2427 StubFailureTailCallTrampolineStub() : fp_registers_(CanUseFPRegisters()) {}
2428
2429 static void GenerateAheadOfTime(Isolate* isolate);
2430
2431 private:
2432 class FPRegisters: public BitField<bool, 0, 1> {};
2433 Major MajorKey() { return StubFailureTailCallTrampoline; }
2434 int MinorKey() { return FPRegisters::encode(fp_registers_); }
2435
2436 void Generate(MacroAssembler* masm);
2437
2438 bool fp_registers_;
2439
2440 DISALLOW_COPY_AND_ASSIGN(StubFailureTailCallTrampolineStub);
2441 };
2442
2443
2444 class ProfileEntryHookStub : public PlatformCodeStub { 2456 class ProfileEntryHookStub : public PlatformCodeStub {
2445 public: 2457 public:
2446 explicit ProfileEntryHookStub() {} 2458 explicit ProfileEntryHookStub() {}
2447 2459
2448 // The profile entry hook function is not allowed to cause a GC. 2460 // The profile entry hook function is not allowed to cause a GC.
2449 virtual bool SometimesSetsUpAFrame() { return false; } 2461 virtual bool SometimesSetsUpAFrame() { return false; }
2450 2462
2451 // Generates a call to the entry hook if it's enabled. 2463 // Generates a call to the entry hook if it's enabled.
2452 static void MaybeCallEntryHook(MacroAssembler* masm); 2464 static void MaybeCallEntryHook(MacroAssembler* masm);
2453 2465
(...skipping 12 matching lines...) Expand all
2466 2478
2467 2479
2468 class CallDescriptors { 2480 class CallDescriptors {
2469 public: 2481 public:
2470 static void InitializeForIsolate(Isolate* isolate); 2482 static void InitializeForIsolate(Isolate* isolate);
2471 }; 2483 };
2472 2484
2473 } } // namespace v8::internal 2485 } } // namespace v8::internal
2474 2486
2475 #endif // V8_CODE_STUBS_H_ 2487 #endif // V8_CODE_STUBS_H_
OLDNEW
« no previous file with comments | « src/checks.h ('k') | src/code-stubs.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698