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

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

Issue 142813003: A64: Synchronize with r15358. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/a64
Patch Set: Created 6 years, 11 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/builtins.cc ('k') | src/codegen.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 894 matching lines...) Expand 10 before | Expand all | Expand 10 after
905 905
906 class BinaryOpStub: public PlatformCodeStub { 906 class BinaryOpStub: public PlatformCodeStub {
907 public: 907 public:
908 BinaryOpStub(Token::Value op, OverwriteMode mode) 908 BinaryOpStub(Token::Value op, OverwriteMode mode)
909 : op_(op), 909 : op_(op),
910 mode_(mode), 910 mode_(mode),
911 platform_specific_bit_(false), 911 platform_specific_bit_(false),
912 left_type_(BinaryOpIC::UNINITIALIZED), 912 left_type_(BinaryOpIC::UNINITIALIZED),
913 right_type_(BinaryOpIC::UNINITIALIZED), 913 right_type_(BinaryOpIC::UNINITIALIZED),
914 result_type_(BinaryOpIC::UNINITIALIZED), 914 result_type_(BinaryOpIC::UNINITIALIZED),
915 has_fixed_right_arg_(false), 915 encoded_right_arg_(false, encode_arg_value(1)) {
916 encoded_right_arg_(encode_arg_value(1)) {
917 Initialize(); 916 Initialize();
918 ASSERT(OpBits::is_valid(Token::NUM_TOKENS)); 917 ASSERT(OpBits::is_valid(Token::NUM_TOKENS));
919 } 918 }
920 919
921 BinaryOpStub( 920 BinaryOpStub(
922 int key, 921 int key,
923 BinaryOpIC::TypeInfo left_type, 922 BinaryOpIC::TypeInfo left_type,
924 BinaryOpIC::TypeInfo right_type, 923 BinaryOpIC::TypeInfo right_type,
925 BinaryOpIC::TypeInfo result_type, 924 BinaryOpIC::TypeInfo result_type,
926 bool has_fixed_right_arg, 925 Maybe<int32_t> fixed_right_arg)
927 int32_t fixed_right_arg_value)
928 : op_(OpBits::decode(key)), 926 : op_(OpBits::decode(key)),
929 mode_(ModeBits::decode(key)), 927 mode_(ModeBits::decode(key)),
930 platform_specific_bit_(PlatformSpecificBits::decode(key)), 928 platform_specific_bit_(PlatformSpecificBits::decode(key)),
931 left_type_(left_type), 929 left_type_(left_type),
932 right_type_(right_type), 930 right_type_(right_type),
933 result_type_(result_type), 931 result_type_(result_type),
934 has_fixed_right_arg_(has_fixed_right_arg), 932 encoded_right_arg_(fixed_right_arg.has_value,
935 encoded_right_arg_(encode_arg_value(fixed_right_arg_value)) { } 933 encode_arg_value(fixed_right_arg.value)) { }
936 934
937 static void decode_types_from_minor_key(int minor_key, 935 static void decode_types_from_minor_key(int minor_key,
938 BinaryOpIC::TypeInfo* left_type, 936 BinaryOpIC::TypeInfo* left_type,
939 BinaryOpIC::TypeInfo* right_type, 937 BinaryOpIC::TypeInfo* right_type,
940 BinaryOpIC::TypeInfo* result_type) { 938 BinaryOpIC::TypeInfo* result_type) {
941 *left_type = 939 *left_type =
942 static_cast<BinaryOpIC::TypeInfo>(LeftTypeBits::decode(minor_key)); 940 static_cast<BinaryOpIC::TypeInfo>(LeftTypeBits::decode(minor_key));
943 *right_type = 941 *right_type =
944 static_cast<BinaryOpIC::TypeInfo>(RightTypeBits::decode(minor_key)); 942 static_cast<BinaryOpIC::TypeInfo>(RightTypeBits::decode(minor_key));
945 *result_type = 943 *result_type =
946 static_cast<BinaryOpIC::TypeInfo>(ResultTypeBits::decode(minor_key)); 944 static_cast<BinaryOpIC::TypeInfo>(ResultTypeBits::decode(minor_key));
947 } 945 }
948 946
949 static Token::Value decode_op_from_minor_key(int minor_key) { 947 static Token::Value decode_op_from_minor_key(int minor_key) {
950 return static_cast<Token::Value>(OpBits::decode(minor_key)); 948 return static_cast<Token::Value>(OpBits::decode(minor_key));
951 } 949 }
952 950
953 static bool decode_has_fixed_right_arg_from_minor_key(int minor_key) { 951 static Maybe<int> decode_fixed_right_arg_from_minor_key(int minor_key) {
954 return HasFixedRightArgBits::decode(minor_key); 952 return Maybe<int>(
955 } 953 HasFixedRightArgBits::decode(minor_key),
956 954 decode_arg_value(FixedRightArgValueBits::decode(minor_key)));
957 static int decode_fixed_right_arg_value_from_minor_key(int minor_key) {
958 return decode_arg_value(FixedRightArgValueBits::decode(minor_key));
959 } 955 }
960 956
961 int fixed_right_arg_value() const { 957 int fixed_right_arg_value() const {
962 return decode_arg_value(encoded_right_arg_); 958 return decode_arg_value(encoded_right_arg_.value);
963 } 959 }
964 960
965 static bool can_encode_arg_value(int32_t value) { 961 static bool can_encode_arg_value(int32_t value) {
966 return value > 0 && 962 return value > 0 &&
967 IsPowerOf2(value) && 963 IsPowerOf2(value) &&
968 FixedRightArgValueBits::is_valid(WhichPowerOf2(value)); 964 FixedRightArgValueBits::is_valid(WhichPowerOf2(value));
969 } 965 }
970 966
971 enum SmiCodeGenerateHeapNumberResults { 967 enum SmiCodeGenerateHeapNumberResults {
972 ALLOW_HEAPNUMBER_RESULTS, 968 ALLOW_HEAPNUMBER_RESULTS,
973 NO_HEAPNUMBER_RESULTS 969 NO_HEAPNUMBER_RESULTS
974 }; 970 };
975 971
976 private: 972 private:
977 Token::Value op_; 973 Token::Value op_;
978 OverwriteMode mode_; 974 OverwriteMode mode_;
979 bool platform_specific_bit_; // Indicates SSE3 on IA32. 975 bool platform_specific_bit_; // Indicates SSE3 on IA32.
980 976
981 // Operand type information determined at runtime. 977 // Operand type information determined at runtime.
982 BinaryOpIC::TypeInfo left_type_; 978 BinaryOpIC::TypeInfo left_type_;
983 BinaryOpIC::TypeInfo right_type_; 979 BinaryOpIC::TypeInfo right_type_;
984 BinaryOpIC::TypeInfo result_type_; 980 BinaryOpIC::TypeInfo result_type_;
985 981
986 bool has_fixed_right_arg_; 982 Maybe<int> encoded_right_arg_;
987 int encoded_right_arg_;
988 983
989 static int encode_arg_value(int32_t value) { 984 static int encode_arg_value(int32_t value) {
990 ASSERT(can_encode_arg_value(value)); 985 ASSERT(can_encode_arg_value(value));
991 return WhichPowerOf2(value); 986 return WhichPowerOf2(value);
992 } 987 }
993 988
994 static int32_t decode_arg_value(int value) { 989 static int32_t decode_arg_value(int value) {
995 return 1 << value; 990 return 1 << value;
996 } 991 }
997 992
(...skipping 12 matching lines...) Expand all
1010 class FixedRightArgValueBits: public BitField<int, 20, 5> {}; 1005 class FixedRightArgValueBits: public BitField<int, 20, 5> {};
1011 1006
1012 Major MajorKey() { return BinaryOp; } 1007 Major MajorKey() { return BinaryOp; }
1013 int MinorKey() { 1008 int MinorKey() {
1014 return OpBits::encode(op_) 1009 return OpBits::encode(op_)
1015 | ModeBits::encode(mode_) 1010 | ModeBits::encode(mode_)
1016 | PlatformSpecificBits::encode(platform_specific_bit_) 1011 | PlatformSpecificBits::encode(platform_specific_bit_)
1017 | LeftTypeBits::encode(left_type_) 1012 | LeftTypeBits::encode(left_type_)
1018 | RightTypeBits::encode(right_type_) 1013 | RightTypeBits::encode(right_type_)
1019 | ResultTypeBits::encode(result_type_) 1014 | ResultTypeBits::encode(result_type_)
1020 | HasFixedRightArgBits::encode(has_fixed_right_arg_) 1015 | HasFixedRightArgBits::encode(encoded_right_arg_.has_value)
1021 | FixedRightArgValueBits::encode(encoded_right_arg_); 1016 | FixedRightArgValueBits::encode(encoded_right_arg_.value);
1022 } 1017 }
1023 1018
1024 1019
1025 // Platform-independent implementation. 1020 // Platform-independent implementation.
1026 void Generate(MacroAssembler* masm); 1021 void Generate(MacroAssembler* masm);
1027 void GenerateCallRuntime(MacroAssembler* masm); 1022 void GenerateCallRuntime(MacroAssembler* masm);
1028 1023
1029 // Platform-independent signature, platform-specific implementation. 1024 // Platform-independent signature, platform-specific implementation.
1030 void Initialize(); 1025 void Initialize();
1031 void GenerateAddStrings(MacroAssembler* masm); 1026 void GenerateAddStrings(MacroAssembler* masm);
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
1208 1203
1209 Handle<Code> GenerateCode(); 1204 Handle<Code> GenerateCode();
1210 1205
1211 // extra ic state = nil_value | type_n-1 | ... | type_0 1206 // extra ic state = nil_value | type_n-1 | ... | type_0
1212 virtual Code::ExtraICState GetExtraICState() { 1207 virtual Code::ExtraICState GetExtraICState() {
1213 return NilValueField::encode(nil_value_) | state_.ToIntegral(); 1208 return NilValueField::encode(nil_value_) | state_.ToIntegral();
1214 } 1209 }
1215 static byte ExtractTypesFromExtraICState(Code::ExtraICState state) { 1210 static byte ExtractTypesFromExtraICState(Code::ExtraICState state) {
1216 return state & ((1 << NUMBER_OF_TYPES) - 1); 1211 return state & ((1 << NUMBER_OF_TYPES) - 1);
1217 } 1212 }
1213 static NilValue ExtractNilValueFromExtraICState(Code::ExtraICState state) {
1214 return NilValueField::decode(state);
1215 }
1218 1216
1219 void Record(Handle<Object> object); 1217 void Record(Handle<Object> object);
1220 1218
1221 bool IsMonomorphic() const { return state_.Contains(MONOMORPHIC_MAP); } 1219 bool IsMonomorphic() const { return state_.Contains(MONOMORPHIC_MAP); }
1222 NilValue GetNilValue() const { return nil_value_; } 1220 NilValue GetNilValue() const { return nil_value_; }
1223 State GetState() const { return state_; } 1221 State GetState() const { return state_; }
1224 void ClearState() { state_.RemoveAll(); } 1222 void ClearState() { state_.RemoveAll(); }
1225 1223
1226 virtual void PrintName(StringStream* stream); 1224 virtual void PrintName(StringStream* stream);
1227 1225
(...skipping 746 matching lines...) Expand 10 before | Expand all | Expand 10 after
1974 HEAP_NUMBER, 1972 HEAP_NUMBER,
1975 NUMBER_OF_TYPES 1973 NUMBER_OF_TYPES
1976 }; 1974 };
1977 1975
1978 // At most 8 different types can be distinguished, because the Code object 1976 // At most 8 different types can be distinguished, because the Code object
1979 // only has room for a single byte to hold a set of these types. :-P 1977 // only has room for a single byte to hold a set of these types. :-P
1980 STATIC_ASSERT(NUMBER_OF_TYPES <= 8); 1978 STATIC_ASSERT(NUMBER_OF_TYPES <= 8);
1981 1979
1982 class Types : public EnumSet<Type, byte> { 1980 class Types : public EnumSet<Type, byte> {
1983 public: 1981 public:
1984 Types() {} 1982 Types() : EnumSet<Type, byte>(0) {}
1985 explicit Types(byte bits) : EnumSet<Type, byte>(bits) {} 1983 explicit Types(byte bits) : EnumSet<Type, byte>(bits) {}
1986 1984
1987 byte ToByte() const { return ToIntegral(); } 1985 byte ToByte() const { return ToIntegral(); }
1988 void Print(StringStream* stream) const; 1986 void Print(StringStream* stream) const;
1989 void TraceTransition(Types to) const; 1987 void TraceTransition(Types to) const;
1990 bool Record(Handle<Object> object); 1988 bool Record(Handle<Object> object);
1991 bool NeedsMap() const; 1989 bool NeedsMap() const;
1992 bool CanBeUndetectable() const; 1990 bool CanBeUndetectable() const;
1991 bool IsGeneric() const { return ToIntegral() == Generic().ToIntegral(); }
1992
1993 static Types Generic() { return Types((1 << NUMBER_OF_TYPES) - 1); }
1993 }; 1994 };
1994 1995
1995 static Types no_types() { return Types(); }
1996 static Types all_types() { return Types((1 << NUMBER_OF_TYPES) - 1); }
1997
1998 explicit ToBooleanStub(Types types = Types()) 1996 explicit ToBooleanStub(Types types = Types())
1999 : types_(types) { } 1997 : types_(types) { }
2000 explicit ToBooleanStub(Code::ExtraICState state) 1998 explicit ToBooleanStub(Code::ExtraICState state)
2001 : types_(static_cast<byte>(state)) { } 1999 : types_(static_cast<byte>(state)) { }
2002 2000
2003 bool Record(Handle<Object> object); 2001 bool Record(Handle<Object> object);
2004 Types GetTypes() { return types_; } 2002 Types GetTypes() { return types_; }
2005 2003
2006 virtual Handle<Code> GenerateCode(); 2004 virtual Handle<Code> GenerateCode();
2007 virtual void InitializeInterfaceDescriptor( 2005 virtual void InitializeInterfaceDescriptor(
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
2163 2161
2164 // The current function entry hook. 2162 // The current function entry hook.
2165 static FunctionEntryHook entry_hook_; 2163 static FunctionEntryHook entry_hook_;
2166 2164
2167 DISALLOW_COPY_AND_ASSIGN(ProfileEntryHookStub); 2165 DISALLOW_COPY_AND_ASSIGN(ProfileEntryHookStub);
2168 }; 2166 };
2169 2167
2170 } } // namespace v8::internal 2168 } } // namespace v8::internal
2171 2169
2172 #endif // V8_CODE_STUBS_H_ 2170 #endif // V8_CODE_STUBS_H_
OLDNEW
« no previous file with comments | « src/builtins.cc ('k') | src/codegen.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698