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

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

Issue 149133004: A64: Synchronize with r17807. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/a64
Patch Set: Created 6 years, 10 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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 V(InternalArrayNoArgumentConstructor) \ 83 V(InternalArrayNoArgumentConstructor) \
84 V(InternalArraySingleArgumentConstructor) \ 84 V(InternalArraySingleArgumentConstructor) \
85 V(InternalArrayNArgumentsConstructor) \ 85 V(InternalArrayNArgumentsConstructor) \
86 V(KeyedStoreElement) \ 86 V(KeyedStoreElement) \
87 V(DebuggerStatement) \ 87 V(DebuggerStatement) \
88 V(NameDictionaryLookup) \ 88 V(NameDictionaryLookup) \
89 V(ElementsTransitionAndStore) \ 89 V(ElementsTransitionAndStore) \
90 V(TransitionElementsKind) \ 90 V(TransitionElementsKind) \
91 V(StoreArrayLiteralElement) \ 91 V(StoreArrayLiteralElement) \
92 V(StubFailureTrampoline) \ 92 V(StubFailureTrampoline) \
93 V(StubFailureTailCallTrampoline) \
93 V(ArrayConstructor) \ 94 V(ArrayConstructor) \
94 V(InternalArrayConstructor) \ 95 V(InternalArrayConstructor) \
95 V(ProfileEntryHook) \ 96 V(ProfileEntryHook) \
96 V(StoreGlobal) \ 97 V(StoreGlobal) \
97 /* IC Handler stubs */ \ 98 /* IC Handler stubs */ \
98 V(LoadField) \ 99 V(LoadField) \
99 V(KeyedLoadField) 100 V(KeyedLoadField) \
101 V(KeyedArrayCall)
100 102
101 // List of code stubs only used on ARM platforms. 103 // List of code stubs only used on ARM platforms.
102 #if V8_TARGET_ARCH_ARM 104 #if V8_TARGET_ARCH_ARM
103 #define CODE_STUB_LIST_ARM(V) \ 105 #define CODE_STUB_LIST_ARM(V) \
104 V(GetProperty) \ 106 V(GetProperty) \
105 V(SetProperty) \ 107 V(SetProperty) \
106 V(InvokeBuiltin) \ 108 V(InvokeBuiltin) \
107 V(DirectCEntry) 109 V(DirectCEntry)
108 #elif V8_TARGET_ARCH_A64 110 #elif V8_TARGET_ARCH_A64
109 #define CODE_STUB_LIST_ARM(V) \ 111 #define CODE_STUB_LIST_ARM(V) \
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 bool is_pregenerated = IsPregenerated(isolate); 171 bool is_pregenerated = IsPregenerated(isolate);
170 Code* code = NULL; 172 Code* code = NULL;
171 CHECK(!is_pregenerated || FindCodeInCache(&code, isolate)); 173 CHECK(!is_pregenerated || FindCodeInCache(&code, isolate));
172 return is_pregenerated; 174 return is_pregenerated;
173 } 175 }
174 176
175 // See comment above, where Instanceof is defined. 177 // See comment above, where Instanceof is defined.
176 virtual bool IsPregenerated(Isolate* isolate) { return false; } 178 virtual bool IsPregenerated(Isolate* isolate) { return false; }
177 179
178 static void GenerateStubsAheadOfTime(Isolate* isolate); 180 static void GenerateStubsAheadOfTime(Isolate* isolate);
181 static void GenerateStubsRequiringBuiltinsAheadOfTime(Isolate* isolate);
179 static void GenerateFPStubs(Isolate* isolate); 182 static void GenerateFPStubs(Isolate* isolate);
180 183
181 // Some stubs put untagged junk on the stack that cannot be scanned by the 184 // Some stubs put untagged junk on the stack that cannot be scanned by the
182 // GC. This means that we must be statically sure that no GC can occur while 185 // GC. This means that we must be statically sure that no GC can occur while
183 // they are running. If that is the case they should override this to return 186 // they are running. If that is the case they should override this to return
184 // true, which will cause an assertion if we try to call something that can 187 // true, which will cause an assertion if we try to call something that can
185 // GC or if we try to put a stack frame on top of the junk, which would not 188 // GC or if we try to put a stack frame on top of the junk, which would not
186 // result in a traversable stack. 189 // result in a traversable stack.
187 virtual bool SometimesSetsUpAFrame() { return true; } 190 virtual bool SometimesSetsUpAFrame() { return true; }
188 191
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 279
277 virtual Code::Kind GetCodeKind() const { return Code::STUB; } 280 virtual Code::Kind GetCodeKind() const { return Code::STUB; }
278 281
279 protected: 282 protected:
280 // Generates the assembler code for the stub. 283 // Generates the assembler code for the stub.
281 virtual void Generate(MacroAssembler* masm) = 0; 284 virtual void Generate(MacroAssembler* masm) = 0;
282 }; 285 };
283 286
284 287
285 enum StubFunctionMode { NOT_JS_FUNCTION_STUB_MODE, JS_FUNCTION_STUB_MODE }; 288 enum StubFunctionMode { NOT_JS_FUNCTION_STUB_MODE, JS_FUNCTION_STUB_MODE };
289 enum HandlerArgumentsMode { DONT_PASS_ARGUMENTS, PASS_ARGUMENTS };
290
291 enum ContinuationType { NORMAL_CONTINUATION, TAIL_CALL_CONTINUATION };
286 292
287 293
288 struct CodeStubInterfaceDescriptor { 294 struct CodeStubInterfaceDescriptor {
289 CodeStubInterfaceDescriptor(); 295 CodeStubInterfaceDescriptor();
290 int register_param_count_; 296 int register_param_count_;
297
291 Register stack_parameter_count_; 298 Register stack_parameter_count_;
292 // if hint_stack_parameter_count_ > 0, the code stub can optimize the 299 // if hint_stack_parameter_count_ > 0, the code stub can optimize the
293 // return sequence. Default value is -1, which means it is ignored. 300 // return sequence. Default value is -1, which means it is ignored.
294 int hint_stack_parameter_count_; 301 int hint_stack_parameter_count_;
302 ContinuationType continuation_type_;
295 StubFunctionMode function_mode_; 303 StubFunctionMode function_mode_;
296 Register* register_params_; 304 Register* register_params_;
305
297 Address deoptimization_handler_; 306 Address deoptimization_handler_;
307 HandlerArgumentsMode handler_arguments_mode_;
308
309 bool initialized() const { return register_param_count_ >= 0; }
310
311 bool HasTailCallContinuation() const {
312 return continuation_type_ == TAIL_CALL_CONTINUATION;
313 }
298 314
299 int environment_length() const { 315 int environment_length() const {
300 if (stack_parameter_count_.is_valid()) {
301 return register_param_count_ + 1;
302 }
303 return register_param_count_; 316 return register_param_count_;
304 } 317 }
305 318
306 bool initialized() const { return register_param_count_ >= 0; }
307
308 void SetMissHandler(ExternalReference handler) { 319 void SetMissHandler(ExternalReference handler) {
309 miss_handler_ = handler; 320 miss_handler_ = handler;
310 has_miss_handler_ = true; 321 has_miss_handler_ = true;
322 // Our miss handler infrastructure doesn't currently support
323 // variable stack parameter counts.
324 ASSERT(!stack_parameter_count_.is_valid());
311 } 325 }
312 326
313 ExternalReference miss_handler() { 327 ExternalReference miss_handler() {
314 ASSERT(has_miss_handler_); 328 ASSERT(has_miss_handler_);
315 return miss_handler_; 329 return miss_handler_;
316 } 330 }
317 331
318 bool has_miss_handler() { 332 bool has_miss_handler() {
319 return has_miss_handler_; 333 return has_miss_handler_;
320 } 334 }
321 335
336 Register GetParameterRegister(int index) {
337 return register_params_[index];
338 }
339
340 bool IsParameterCountRegister(int index) {
341 return GetParameterRegister(index).is(stack_parameter_count_);
342 }
343
344 int GetHandlerParameterCount() {
345 int params = environment_length();
346 if (handler_arguments_mode_ == PASS_ARGUMENTS) {
347 params += 1;
348 }
349 return params;
350 }
351
322 private: 352 private:
323 ExternalReference miss_handler_; 353 ExternalReference miss_handler_;
324 bool has_miss_handler_; 354 bool has_miss_handler_;
325 }; 355 };
326 356
327 // A helper to make up for the fact that type Register is not fully
328 // defined outside of the platform directories
329 #define DESCRIPTOR_GET_PARAMETER_REGISTER(descriptor, index) \
330 ((index) == (descriptor)->register_param_count_) \
331 ? (descriptor)->stack_parameter_count_ \
332 : (descriptor)->register_params_[(index)]
333
334 357
335 class HydrogenCodeStub : public CodeStub { 358 class HydrogenCodeStub : public CodeStub {
336 public: 359 public:
337 enum InitializationState { 360 enum InitializationState {
338 UNINITIALIZED, 361 UNINITIALIZED,
339 INITIALIZED 362 INITIALIZED
340 }; 363 };
341 364
342 explicit HydrogenCodeStub(InitializationState state = INITIALIZED) { 365 explicit HydrogenCodeStub(InitializationState state = INITIALIZED) {
343 is_uninitialized_ = (state == UNINITIALIZED); 366 is_uninitialized_ = (state == UNINITIALIZED);
(...skipping 521 matching lines...) Expand 10 before | Expand all | Expand 10 after
865 protected: 888 protected:
866 class KindBits: public BitField<Code::Kind, 0, 4> {}; 889 class KindBits: public BitField<Code::Kind, 0, 4> {};
867 virtual Code::Kind kind() const = 0; 890 virtual Code::Kind kind() const = 0;
868 }; 891 };
869 892
870 893
871 class HandlerStub: public HICStub { 894 class HandlerStub: public HICStub {
872 public: 895 public:
873 virtual Code::Kind GetCodeKind() const { return Code::HANDLER; } 896 virtual Code::Kind GetCodeKind() const { return Code::HANDLER; }
874 virtual int GetStubFlags() { return kind(); } 897 virtual int GetStubFlags() { return kind(); }
898
899 protected:
900 HandlerStub() : HICStub() { }
901 virtual int NotMissMinorKey() { return bit_field_; }
902 int bit_field_;
875 }; 903 };
876 904
877 905
878 class LoadFieldStub: public HandlerStub { 906 class LoadFieldStub: public HandlerStub {
879 public: 907 public:
880 LoadFieldStub(bool inobject, int index, Representation representation) { 908 LoadFieldStub(bool inobject, int index, Representation representation) {
881 Initialize(Code::LOAD_IC, inobject, index, representation); 909 Initialize(Code::LOAD_IC, inobject, index, representation);
882 } 910 }
883 911
884 virtual Handle<Code> GenerateCode(Isolate* isolate); 912 virtual Handle<Code> GenerateCode(Isolate* isolate);
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
926 | IndexBits::encode(index) 954 | IndexBits::encode(index)
927 | UnboxedDoubleBits::encode(unboxed_double); 955 | UnboxedDoubleBits::encode(unboxed_double);
928 } 956 }
929 957
930 private: 958 private:
931 STATIC_ASSERT(KindBits::kSize == 4); 959 STATIC_ASSERT(KindBits::kSize == 4);
932 class InobjectBits: public BitField<bool, 4, 1> {}; 960 class InobjectBits: public BitField<bool, 4, 1> {};
933 class IndexBits: public BitField<int, 5, 11> {}; 961 class IndexBits: public BitField<int, 5, 11> {};
934 class UnboxedDoubleBits: public BitField<bool, 16, 1> {}; 962 class UnboxedDoubleBits: public BitField<bool, 16, 1> {};
935 virtual CodeStub::Major MajorKey() { return LoadField; } 963 virtual CodeStub::Major MajorKey() { return LoadField; }
936 virtual int NotMissMinorKey() { return bit_field_; }
937
938 int bit_field_;
939 }; 964 };
940 965
941 966
942 class StoreGlobalStub : public HandlerStub { 967 class StoreGlobalStub : public HandlerStub {
943 public: 968 public:
944 StoreGlobalStub(StrictModeFlag strict_mode, bool is_constant) { 969 StoreGlobalStub(StrictModeFlag strict_mode, bool is_constant) {
945 bit_field_ = StrictModeBits::encode(strict_mode) | 970 bit_field_ = StrictModeBits::encode(strict_mode) |
946 IsConstantBits::encode(is_constant); 971 IsConstantBits::encode(is_constant);
947 } 972 }
948 973
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
1007 Isolate* isolate, 1032 Isolate* isolate,
1008 CodeStubInterfaceDescriptor* descriptor); 1033 CodeStubInterfaceDescriptor* descriptor);
1009 1034
1010 virtual Handle<Code> GenerateCode(Isolate* isolate); 1035 virtual Handle<Code> GenerateCode(Isolate* isolate);
1011 1036
1012 private: 1037 private:
1013 virtual CodeStub::Major MajorKey() { return KeyedLoadField; } 1038 virtual CodeStub::Major MajorKey() { return KeyedLoadField; }
1014 }; 1039 };
1015 1040
1016 1041
1042 class KeyedArrayCallStub: public HICStub {
1043 public:
1044 KeyedArrayCallStub(bool holey, int argc) : HICStub(), argc_(argc) {
1045 bit_field_ = ContextualBits::encode(false) | HoleyBits::encode(holey);
1046 }
1047
1048 virtual Code::Kind kind() const { return Code::KEYED_CALL_IC; }
1049 virtual Code::ExtraICState GetExtraICState() { return bit_field_; }
1050
1051 ElementsKind elements_kind() {
1052 return HoleyBits::decode(bit_field_) ? FAST_HOLEY_ELEMENTS : FAST_ELEMENTS;
1053 }
1054
1055 int argc() { return argc_; }
1056 virtual int GetStubFlags() { return argc(); }
1057
1058 static bool IsHoley(Handle<Code> code) {
1059 Code::ExtraICState state = code->extra_ic_state();
1060 return HoleyBits::decode(state);
1061 }
1062
1063 virtual void InitializeInterfaceDescriptor(
1064 Isolate* isolate,
1065 CodeStubInterfaceDescriptor* descriptor);
1066
1067 virtual Handle<Code> GenerateCode(Isolate* isolate);
1068
1069 private:
1070 virtual int NotMissMinorKey() {
1071 return GetExtraICState() | ArgcBits::encode(argc_);
1072 }
1073
1074 class ContextualBits: public BitField<bool, 0, 1> {};
1075 STATIC_ASSERT(CallICBase::Contextual::kShift == ContextualBits::kShift);
1076 STATIC_ASSERT(CallICBase::Contextual::kSize == ContextualBits::kSize);
1077 class HoleyBits: public BitField<bool, 1, 1> {};
1078 STATIC_ASSERT(Code::kArgumentsBits <= kStubMinorKeyBits - 2);
1079 class ArgcBits: public BitField<int, 2, Code::kArgumentsBits> {};
1080 virtual CodeStub::Major MajorKey() { return KeyedArrayCall; }
1081 int bit_field_;
1082 int argc_;
1083 };
1084
1085
1017 class BinaryOpStub: public HydrogenCodeStub { 1086 class BinaryOpStub: public HydrogenCodeStub {
1018 public: 1087 public:
1019 BinaryOpStub(Token::Value op, OverwriteMode mode) 1088 BinaryOpStub(Token::Value op, OverwriteMode mode)
1020 : HydrogenCodeStub(UNINITIALIZED), op_(op), mode_(mode) { 1089 : HydrogenCodeStub(UNINITIALIZED), op_(op), mode_(mode) {
1021 ASSERT(op <= LAST_TOKEN && op >= FIRST_TOKEN); 1090 ASSERT(op <= LAST_TOKEN && op >= FIRST_TOKEN);
1022 Initialize(); 1091 Initialize();
1023 } 1092 }
1024 1093
1025 explicit BinaryOpStub(Code::ExtraICState state) 1094 explicit BinaryOpStub(Code::ExtraICState state)
1026 : op_(decode_token(OpBits::decode(state))), 1095 : op_(decode_token(OpBits::decode(state))),
(...skipping 744 matching lines...) Expand 10 before | Expand all | Expand 10 after
1771 } 1840 }
1772 1841
1773 private: 1842 private:
1774 MacroAssembler* masm_; 1843 MacroAssembler* masm_;
1775 bool previous_allow_; 1844 bool previous_allow_;
1776 1845
1777 DISALLOW_COPY_AND_ASSIGN(AllowStubCallsScope); 1846 DISALLOW_COPY_AND_ASSIGN(AllowStubCallsScope);
1778 }; 1847 };
1779 1848
1780 1849
1781 class KeyedLoadDictionaryElementStub : public PlatformCodeStub { 1850 class KeyedLoadDictionaryElementStub : public HydrogenCodeStub {
1782 public: 1851 public:
1783 KeyedLoadDictionaryElementStub() {} 1852 KeyedLoadDictionaryElementStub() {}
1784 1853
1854 virtual Handle<Code> GenerateCode(Isolate* isolate) V8_OVERRIDE;
1855
1856 virtual void InitializeInterfaceDescriptor(
1857 Isolate* isolate,
1858 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE;
1859
1860 private:
1861 Major MajorKey() { return KeyedLoadElement; }
1862 int NotMissMinorKey() { return DICTIONARY_ELEMENTS; }
1863
1864 DISALLOW_COPY_AND_ASSIGN(KeyedLoadDictionaryElementStub);
1865 };
1866
1867
1868 class KeyedLoadDictionaryElementPlatformStub : public PlatformCodeStub {
1869 public:
1870 KeyedLoadDictionaryElementPlatformStub() {}
1871
1785 void Generate(MacroAssembler* masm); 1872 void Generate(MacroAssembler* masm);
1786 1873
1787 private: 1874 private:
1788 Major MajorKey() { return KeyedLoadElement; } 1875 Major MajorKey() { return KeyedLoadElement; }
1789 int MinorKey() { return DICTIONARY_ELEMENTS; } 1876 int MinorKey() { return DICTIONARY_ELEMENTS; }
1790 1877
1791 DISALLOW_COPY_AND_ASSIGN(KeyedLoadDictionaryElementStub); 1878 DISALLOW_COPY_AND_ASSIGN(KeyedLoadDictionaryElementPlatformStub);
1792 }; 1879 };
1793 1880
1794 1881
1795 class DoubleToIStub : public PlatformCodeStub { 1882 class DoubleToIStub : public PlatformCodeStub {
1796 public: 1883 public:
1797 DoubleToIStub(Register source, 1884 DoubleToIStub(Register source,
1798 Register destination, 1885 Register destination,
1799 int offset, 1886 int offset,
1800 bool is_truncating, 1887 bool is_truncating,
1801 bool skip_fastpath = false) : bit_field_(0) { 1888 bool skip_fastpath = false) : bit_field_(0) {
(...skipping 610 matching lines...) Expand 10 before | Expand all | Expand 10 after
2412 2499
2413 void Generate(MacroAssembler* masm); 2500 void Generate(MacroAssembler* masm);
2414 2501
2415 bool fp_registers_; 2502 bool fp_registers_;
2416 StubFunctionMode function_mode_; 2503 StubFunctionMode function_mode_;
2417 2504
2418 DISALLOW_COPY_AND_ASSIGN(StubFailureTrampolineStub); 2505 DISALLOW_COPY_AND_ASSIGN(StubFailureTrampolineStub);
2419 }; 2506 };
2420 2507
2421 2508
2509 class StubFailureTailCallTrampolineStub : public PlatformCodeStub {
2510 public:
2511 StubFailureTailCallTrampolineStub() : fp_registers_(CanUseFPRegisters()) {}
2512
2513 virtual bool IsPregenerated(Isolate* isolate) V8_OVERRIDE { return true; }
2514
2515 static void GenerateAheadOfTime(Isolate* isolate);
2516
2517 private:
2518 class FPRegisters: public BitField<bool, 0, 1> {};
2519 Major MajorKey() { return StubFailureTailCallTrampoline; }
2520 int MinorKey() { return FPRegisters::encode(fp_registers_); }
2521
2522 void Generate(MacroAssembler* masm);
2523
2524 bool fp_registers_;
2525
2526 DISALLOW_COPY_AND_ASSIGN(StubFailureTailCallTrampolineStub);
2527 };
2528
2529
2422 class ProfileEntryHookStub : public PlatformCodeStub { 2530 class ProfileEntryHookStub : public PlatformCodeStub {
2423 public: 2531 public:
2424 explicit ProfileEntryHookStub() {} 2532 explicit ProfileEntryHookStub() {}
2425 2533
2426 // The profile entry hook function is not allowed to cause a GC. 2534 // The profile entry hook function is not allowed to cause a GC.
2427 virtual bool SometimesSetsUpAFrame() { return false; } 2535 virtual bool SometimesSetsUpAFrame() { return false; }
2428 2536
2429 // Generates a call to the entry hook if it's enabled. 2537 // Generates a call to the entry hook if it's enabled.
2430 static void MaybeCallEntryHook(MacroAssembler* masm); 2538 static void MaybeCallEntryHook(MacroAssembler* masm);
2431 2539
2432 private: 2540 private:
2433 static void EntryHookTrampoline(intptr_t function, 2541 static void EntryHookTrampoline(intptr_t function,
2434 intptr_t stack_pointer, 2542 intptr_t stack_pointer,
2435 Isolate* isolate); 2543 Isolate* isolate);
2436 2544
2437 Major MajorKey() { return ProfileEntryHook; } 2545 Major MajorKey() { return ProfileEntryHook; }
2438 int MinorKey() { return 0; } 2546 int MinorKey() { return 0; }
2439 2547
2440 void Generate(MacroAssembler* masm); 2548 void Generate(MacroAssembler* masm);
2441 2549
2442 DISALLOW_COPY_AND_ASSIGN(ProfileEntryHookStub); 2550 DISALLOW_COPY_AND_ASSIGN(ProfileEntryHookStub);
2443 }; 2551 };
2444 2552
2445 } } // namespace v8::internal 2553 } } // namespace v8::internal
2446 2554
2447 #endif // V8_CODE_STUBS_H_ 2555 #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