OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 12 matching lines...) Expand all Loading... |
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
27 | 27 |
28 #ifndef V8_CODE_STUBS_H_ | 28 #ifndef V8_CODE_STUBS_H_ |
29 #define V8_CODE_STUBS_H_ | 29 #define V8_CODE_STUBS_H_ |
30 | 30 |
31 #include "allocation.h" | 31 #include "allocation.h" |
32 #include "globals.h" | 32 #include "globals.h" |
| 33 #include "codegen.h" |
33 | 34 |
34 namespace v8 { | 35 namespace v8 { |
35 namespace internal { | 36 namespace internal { |
36 | 37 |
37 // List of code stubs used on all platforms. | 38 // List of code stubs used on all platforms. |
38 #define CODE_STUB_LIST_ALL_PLATFORMS(V) \ | 39 #define CODE_STUB_LIST_ALL_PLATFORMS(V) \ |
39 V(CallFunction) \ | 40 V(CallFunction) \ |
40 V(UnaryOp) \ | 41 V(UnaryOp) \ |
41 V(BinaryOp) \ | 42 V(BinaryOp) \ |
42 V(StringAdd) \ | 43 V(StringAdd) \ |
(...skipping 19 matching lines...) Expand all Loading... |
62 V(ToNumber) \ | 63 V(ToNumber) \ |
63 V(CounterOp) \ | 64 V(CounterOp) \ |
64 V(ArgumentsAccess) \ | 65 V(ArgumentsAccess) \ |
65 V(RegExpConstructResult) \ | 66 V(RegExpConstructResult) \ |
66 V(NumberToString) \ | 67 V(NumberToString) \ |
67 V(CEntry) \ | 68 V(CEntry) \ |
68 V(JSEntry) \ | 69 V(JSEntry) \ |
69 V(KeyedLoadElement) \ | 70 V(KeyedLoadElement) \ |
70 V(KeyedStoreElement) \ | 71 V(KeyedStoreElement) \ |
71 V(DebuggerStatement) \ | 72 V(DebuggerStatement) \ |
72 V(StringDictionaryLookup) | 73 V(StringDictionaryLookup) \ |
| 74 V(ElementsTransitionAndStore) |
73 | 75 |
74 // List of code stubs only used on ARM platforms. | 76 // List of code stubs only used on ARM platforms. |
75 #ifdef V8_TARGET_ARCH_ARM | 77 #ifdef V8_TARGET_ARCH_ARM |
76 #define CODE_STUB_LIST_ARM(V) \ | 78 #define CODE_STUB_LIST_ARM(V) \ |
77 V(GetProperty) \ | 79 V(GetProperty) \ |
78 V(SetProperty) \ | 80 V(SetProperty) \ |
79 V(InvokeBuiltin) \ | 81 V(InvokeBuiltin) \ |
80 V(RegExpCEntry) \ | 82 V(RegExpCEntry) \ |
81 V(DirectCEntry) | 83 V(DirectCEntry) |
82 #else | 84 #else |
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
355 }; | 357 }; |
356 | 358 |
357 | 359 |
358 class FastCloneShallowArrayStub : public CodeStub { | 360 class FastCloneShallowArrayStub : public CodeStub { |
359 public: | 361 public: |
360 // Maximum length of copied elements array. | 362 // Maximum length of copied elements array. |
361 static const int kMaximumClonedLength = 8; | 363 static const int kMaximumClonedLength = 8; |
362 | 364 |
363 enum Mode { | 365 enum Mode { |
364 CLONE_ELEMENTS, | 366 CLONE_ELEMENTS, |
| 367 CLONE_DOUBLE_ELEMENTS, |
365 COPY_ON_WRITE_ELEMENTS | 368 COPY_ON_WRITE_ELEMENTS |
366 }; | 369 }; |
367 | 370 |
368 FastCloneShallowArrayStub(Mode mode, int length) | 371 FastCloneShallowArrayStub(Mode mode, int length) |
369 : mode_(mode), | 372 : mode_(mode), |
370 length_((mode == COPY_ON_WRITE_ELEMENTS) ? 0 : length) { | 373 length_((mode == COPY_ON_WRITE_ELEMENTS) ? 0 : length) { |
371 ASSERT(length_ >= 0); | 374 ASSERT(length_ >= 0); |
372 ASSERT(length_ <= kMaximumClonedLength); | 375 ASSERT(length_ <= kMaximumClonedLength); |
373 } | 376 } |
374 | 377 |
375 void Generate(MacroAssembler* masm); | 378 void Generate(MacroAssembler* masm); |
376 | 379 |
377 private: | 380 private: |
378 Mode mode_; | 381 Mode mode_; |
379 int length_; | 382 int length_; |
380 | 383 |
381 Major MajorKey() { return FastCloneShallowArray; } | 384 Major MajorKey() { return FastCloneShallowArray; } |
382 int MinorKey() { | 385 int MinorKey() { |
383 ASSERT(mode_ == 0 || mode_ == 1); | 386 ASSERT(mode_ == 0 || mode_ == 1 || mode_ == 2); |
384 return (length_ << 1) | mode_; | 387 return length_ * 3 + mode_; |
385 } | 388 } |
386 }; | 389 }; |
387 | 390 |
388 | 391 |
389 class InstanceofStub: public CodeStub { | 392 class InstanceofStub: public CodeStub { |
390 public: | 393 public: |
391 enum Flags { | 394 enum Flags { |
392 kNoFlags = 0, | 395 kNoFlags = 0, |
393 kArgsInRegisters = 1 << 0, | 396 kArgsInRegisters = 1 << 0, |
394 kCallSiteInlineCheck = 1 << 1, | 397 kCallSiteInlineCheck = 1 << 1, |
(...skipping 623 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1018 void CheckOddball(MacroAssembler* masm, | 1021 void CheckOddball(MacroAssembler* masm, |
1019 Type type, | 1022 Type type, |
1020 Heap::RootListIndex value, | 1023 Heap::RootListIndex value, |
1021 bool result); | 1024 bool result); |
1022 void GenerateTypeTransition(MacroAssembler* masm); | 1025 void GenerateTypeTransition(MacroAssembler* masm); |
1023 | 1026 |
1024 Register tos_; | 1027 Register tos_; |
1025 Types types_; | 1028 Types types_; |
1026 }; | 1029 }; |
1027 | 1030 |
| 1031 |
| 1032 class ElementsTransitionAndStoreStub : public CodeStub { |
| 1033 public: |
| 1034 ElementsTransitionAndStoreStub(ElementsKind from, |
| 1035 ElementsKind to, |
| 1036 bool is_jsarray, |
| 1037 StrictModeFlag strict_mode) |
| 1038 : from_(from), |
| 1039 to_(to), |
| 1040 is_jsarray_(is_jsarray), |
| 1041 strict_mode_(strict_mode) {} |
| 1042 |
| 1043 private: |
| 1044 class FromBits: public BitField<ElementsKind, 0, 8> {}; |
| 1045 class ToBits: public BitField<ElementsKind, 8, 8> {}; |
| 1046 class IsJSArrayBits: public BitField<bool, 16, 8> {}; |
| 1047 class StrictModeBits: public BitField<StrictModeFlag, 24, 8> {}; |
| 1048 |
| 1049 Major MajorKey() { return ElementsTransitionAndStore; } |
| 1050 int MinorKey() { |
| 1051 return FromBits::encode(from_) | |
| 1052 ToBits::encode(to_) | |
| 1053 IsJSArrayBits::encode(is_jsarray_) | |
| 1054 StrictModeBits::encode(strict_mode_); |
| 1055 } |
| 1056 |
| 1057 void Generate(MacroAssembler* masm); |
| 1058 |
| 1059 ElementsKind from_; |
| 1060 ElementsKind to_; |
| 1061 bool is_jsarray_; |
| 1062 StrictModeFlag strict_mode_; |
| 1063 |
| 1064 DISALLOW_COPY_AND_ASSIGN(ElementsTransitionAndStoreStub); |
| 1065 }; |
| 1066 |
1028 } } // namespace v8::internal | 1067 } } // namespace v8::internal |
1029 | 1068 |
1030 #endif // V8_CODE_STUBS_H_ | 1069 #endif // V8_CODE_STUBS_H_ |
OLD | NEW |