| OLD | NEW |
| 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 23 matching lines...) Expand all Loading... |
| 34 #include "globals.h" | 34 #include "globals.h" |
| 35 #include "macro-assembler.h" | 35 #include "macro-assembler.h" |
| 36 | 36 |
| 37 namespace v8 { | 37 namespace v8 { |
| 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(BinaryOp) \ | 44 V(BinaryOpIC) \ |
| 45 V(StringAdd) \ | 45 V(StringAdd) \ |
| 46 V(NewStringAdd) \ | 46 V(NewStringAdd) \ |
| 47 V(SubString) \ | 47 V(SubString) \ |
| 48 V(StringCompare) \ | 48 V(StringCompare) \ |
| 49 V(Compare) \ | 49 V(Compare) \ |
| 50 V(CompareIC) \ | 50 V(CompareIC) \ |
| 51 V(CompareNilIC) \ | 51 V(CompareNilIC) \ |
| 52 V(MathPow) \ | 52 V(MathPow) \ |
| 53 V(StringLength) \ | 53 V(StringLength) \ |
| 54 V(FunctionPrototype) \ | 54 V(FunctionPrototype) \ |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 #else | 125 #else |
| 126 #define CODE_STUB_LIST_MIPS(V) | 126 #define CODE_STUB_LIST_MIPS(V) |
| 127 #endif | 127 #endif |
| 128 | 128 |
| 129 // Combined list of code stubs. | 129 // Combined list of code stubs. |
| 130 #define CODE_STUB_LIST(V) \ | 130 #define CODE_STUB_LIST(V) \ |
| 131 CODE_STUB_LIST_ALL_PLATFORMS(V) \ | 131 CODE_STUB_LIST_ALL_PLATFORMS(V) \ |
| 132 CODE_STUB_LIST_ARM(V) \ | 132 CODE_STUB_LIST_ARM(V) \ |
| 133 CODE_STUB_LIST_MIPS(V) | 133 CODE_STUB_LIST_MIPS(V) |
| 134 | 134 |
| 135 // Mode to overwrite BinaryExpression values. | |
| 136 enum OverwriteMode { NO_OVERWRITE, OVERWRITE_LEFT, OVERWRITE_RIGHT }; | |
| 137 | |
| 138 // Stub is base classes of all stubs. | 135 // Stub is base classes of all stubs. |
| 139 class CodeStub BASE_EMBEDDED { | 136 class CodeStub BASE_EMBEDDED { |
| 140 public: | 137 public: |
| 141 enum Major { | 138 enum Major { |
| 142 #define DEF_ENUM(name) name, | 139 #define DEF_ENUM(name) name, |
| 143 CODE_STUB_LIST(DEF_ENUM) | 140 CODE_STUB_LIST(DEF_ENUM) |
| 144 #undef DEF_ENUM | 141 #undef DEF_ENUM |
| 145 NoCache, // marker for stubs that do custom caching | 142 NoCache, // marker for stubs that do custom caching |
| 146 NUMBER_OF_IDS | 143 NUMBER_OF_IDS |
| 147 }; | 144 }; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 160 | 157 |
| 161 // Gets the major key from a code object that is a code stub or binary op IC. | 158 // Gets the major key from a code object that is a code stub or binary op IC. |
| 162 static Major GetMajorKey(Code* code_stub) { | 159 static Major GetMajorKey(Code* code_stub) { |
| 163 return static_cast<Major>(code_stub->major_key()); | 160 return static_cast<Major>(code_stub->major_key()); |
| 164 } | 161 } |
| 165 | 162 |
| 166 static const char* MajorName(Major major_key, bool allow_unknown_keys); | 163 static const char* MajorName(Major major_key, bool allow_unknown_keys); |
| 167 | 164 |
| 168 virtual ~CodeStub() {} | 165 virtual ~CodeStub() {} |
| 169 | 166 |
| 170 bool CompilingCallsToThisStubIsGCSafe(Isolate* isolate) { | |
| 171 bool is_pregenerated = IsPregenerated(isolate); | |
| 172 Code* code = NULL; | |
| 173 CHECK(!is_pregenerated || FindCodeInCache(&code, isolate)); | |
| 174 return is_pregenerated; | |
| 175 } | |
| 176 | |
| 177 // See comment above, where Instanceof is defined. | |
| 178 virtual bool IsPregenerated(Isolate* isolate) { return false; } | |
| 179 | |
| 180 static void GenerateStubsAheadOfTime(Isolate* isolate); | 167 static void GenerateStubsAheadOfTime(Isolate* isolate); |
| 181 static void GenerateStubsRequiringBuiltinsAheadOfTime(Isolate* isolate); | 168 static void GenerateStubsRequiringBuiltinsAheadOfTime(Isolate* isolate); |
| 182 static void GenerateFPStubs(Isolate* isolate); | 169 static void GenerateFPStubs(Isolate* isolate); |
| 183 | 170 |
| 184 // Some stubs put untagged junk on the stack that cannot be scanned by the | 171 // Some stubs put untagged junk on the stack that cannot be scanned by the |
| 185 // GC. This means that we must be statically sure that no GC can occur while | 172 // GC. This means that we must be statically sure that no GC can occur while |
| 186 // they are running. If that is the case they should override this to return | 173 // they are running. If that is the case they should override this to return |
| 187 // true, which will cause an assertion if we try to call something that can | 174 // true, which will cause an assertion if we try to call something that can |
| 188 // GC or if we try to put a stack frame on top of the junk, which would not | 175 // GC or if we try to put a stack frame on top of the junk, which would not |
| 189 // result in a traversable stack. | 176 // result in a traversable stack. |
| (...skipping 494 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 684 DISALLOW_COPY_AND_ASSIGN(FastCloneShallowObjectStub); | 671 DISALLOW_COPY_AND_ASSIGN(FastCloneShallowObjectStub); |
| 685 }; | 672 }; |
| 686 | 673 |
| 687 | 674 |
| 688 class CreateAllocationSiteStub : public HydrogenCodeStub { | 675 class CreateAllocationSiteStub : public HydrogenCodeStub { |
| 689 public: | 676 public: |
| 690 explicit CreateAllocationSiteStub() { } | 677 explicit CreateAllocationSiteStub() { } |
| 691 | 678 |
| 692 virtual Handle<Code> GenerateCode(Isolate* isolate); | 679 virtual Handle<Code> GenerateCode(Isolate* isolate); |
| 693 | 680 |
| 694 virtual bool IsPregenerated(Isolate* isolate) V8_OVERRIDE { return true; } | |
| 695 | |
| 696 static void GenerateAheadOfTime(Isolate* isolate); | 681 static void GenerateAheadOfTime(Isolate* isolate); |
| 697 | 682 |
| 698 virtual void InitializeInterfaceDescriptor( | 683 virtual void InitializeInterfaceDescriptor( |
| 699 Isolate* isolate, | 684 Isolate* isolate, |
| 700 CodeStubInterfaceDescriptor* descriptor); | 685 CodeStubInterfaceDescriptor* descriptor); |
| 701 | 686 |
| 702 private: | 687 private: |
| 703 Major MajorKey() { return CreateAllocationSite; } | 688 Major MajorKey() { return CreateAllocationSite; } |
| 704 int NotMissMinorKey() { return 0; } | 689 int NotMissMinorKey() { return 0; } |
| 705 | 690 |
| (...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1074 STATIC_ASSERT(CallICBase::Contextual::kSize == ContextualBits::kSize); | 1059 STATIC_ASSERT(CallICBase::Contextual::kSize == ContextualBits::kSize); |
| 1075 class HoleyBits: public BitField<bool, 1, 1> {}; | 1060 class HoleyBits: public BitField<bool, 1, 1> {}; |
| 1076 STATIC_ASSERT(Code::kArgumentsBits <= kStubMinorKeyBits - 2); | 1061 STATIC_ASSERT(Code::kArgumentsBits <= kStubMinorKeyBits - 2); |
| 1077 class ArgcBits: public BitField<int, 2, Code::kArgumentsBits> {}; | 1062 class ArgcBits: public BitField<int, 2, Code::kArgumentsBits> {}; |
| 1078 virtual CodeStub::Major MajorKey() { return KeyedArrayCall; } | 1063 virtual CodeStub::Major MajorKey() { return KeyedArrayCall; } |
| 1079 int bit_field_; | 1064 int bit_field_; |
| 1080 int argc_; | 1065 int argc_; |
| 1081 }; | 1066 }; |
| 1082 | 1067 |
| 1083 | 1068 |
| 1084 class BinaryOpStub: public HydrogenCodeStub { | 1069 class BinaryOpICStub V8_FINAL : public HydrogenCodeStub { |
| 1085 public: | 1070 public: |
| 1086 BinaryOpStub(Token::Value op, OverwriteMode mode) | 1071 BinaryOpICStub(Token::Value op, OverwriteMode mode) |
| 1087 : HydrogenCodeStub(UNINITIALIZED), op_(op), mode_(mode) { | 1072 : HydrogenCodeStub(UNINITIALIZED), state_(op, mode) {} |
| 1088 ASSERT(op <= LAST_TOKEN && op >= FIRST_TOKEN); | 1073 |
| 1089 Initialize(); | 1074 explicit BinaryOpICStub(const BinaryOpIC::State& state) : state_(state) {} |
| 1075 |
| 1076 static void GenerateAheadOfTime(Isolate* isolate); |
| 1077 |
| 1078 virtual void InitializeInterfaceDescriptor( |
| 1079 Isolate* isolate, CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; |
| 1080 |
| 1081 static void InstallDescriptors(Isolate* isolate); |
| 1082 |
| 1083 virtual Code::Kind GetCodeKind() const V8_OVERRIDE { |
| 1084 return Code::BINARY_OP_IC; |
| 1090 } | 1085 } |
| 1091 | 1086 |
| 1092 explicit BinaryOpStub(ExtraICState state) | 1087 virtual InlineCacheState GetICState() V8_OVERRIDE { |
| 1093 : op_(decode_token(OpBits::decode(state))), | 1088 return state_.GetICState(); |
| 1094 mode_(OverwriteModeField::decode(state)), | |
| 1095 fixed_right_arg_( | |
| 1096 Maybe<int>(HasFixedRightArgBits::decode(state), | |
| 1097 decode_arg_value(FixedRightArgValueBits::decode(state)))), | |
| 1098 left_state_(LeftStateField::decode(state)), | |
| 1099 right_state_(fixed_right_arg_.has_value | |
| 1100 ? ((fixed_right_arg_.value <= Smi::kMaxValue) ? SMI : INT32) | |
| 1101 : RightStateField::decode(state)), | |
| 1102 result_state_(ResultStateField::decode(state)) { | |
| 1103 // We don't deserialize the SSE2 Field, since this is only used to be able | |
| 1104 // to include SSE2 as well as non-SSE2 versions in the snapshot. For code | |
| 1105 // generation we always want it to reflect the current state. | |
| 1106 ASSERT(!fixed_right_arg_.has_value || | |
| 1107 can_encode_arg_value(fixed_right_arg_.value)); | |
| 1108 } | 1089 } |
| 1109 | 1090 |
| 1110 static const int FIRST_TOKEN = Token::BIT_OR; | 1091 virtual ExtraICState GetExtraICState() V8_OVERRIDE { |
| 1111 static const int LAST_TOKEN = Token::MOD; | 1092 return state_.GetExtraICState(); |
| 1112 | |
| 1113 static void GenerateAheadOfTime(Isolate* isolate); | |
| 1114 virtual void InitializeInterfaceDescriptor( | |
| 1115 Isolate* isolate, CodeStubInterfaceDescriptor* descriptor); | |
| 1116 static void InitializeForIsolate(Isolate* isolate) { | |
| 1117 BinaryOpStub binopStub(UNINITIALIZED); | |
| 1118 binopStub.InitializeInterfaceDescriptor( | |
| 1119 isolate, isolate->code_stub_interface_descriptor(CodeStub::BinaryOp)); | |
| 1120 } | |
| 1121 | |
| 1122 virtual Code::Kind GetCodeKind() const { return Code::BINARY_OP_IC; } | |
| 1123 virtual InlineCacheState GetICState() { | |
| 1124 if (Max(left_state_, right_state_) == NONE) { | |
| 1125 return ::v8::internal::UNINITIALIZED; | |
| 1126 } | |
| 1127 if (Max(left_state_, right_state_) == GENERIC) return MEGAMORPHIC; | |
| 1128 return MONOMORPHIC; | |
| 1129 } | 1093 } |
| 1130 | 1094 |
| 1131 virtual void VerifyPlatformFeatures(Isolate* isolate) V8_OVERRIDE { | 1095 virtual void VerifyPlatformFeatures(Isolate* isolate) V8_OVERRIDE { |
| 1132 ASSERT(CpuFeatures::VerifyCrossCompiling(SSE2)); | 1096 ASSERT(CpuFeatures::VerifyCrossCompiling(SSE2)); |
| 1133 } | 1097 } |
| 1134 | 1098 |
| 1135 virtual ExtraICState GetExtraICState() { | 1099 virtual Handle<Code> GenerateCode(Isolate* isolate) V8_OVERRIDE; |
| 1136 bool sse_field = Max(result_state_, Max(left_state_, right_state_)) > SMI && | |
| 1137 CpuFeatures::IsSafeForSnapshot(SSE2); | |
| 1138 | 1100 |
| 1139 return OpBits::encode(encode_token(op_)) | 1101 const BinaryOpIC::State& state() const { return state_; } |
| 1140 | LeftStateField::encode(left_state_) | |
| 1141 | RightStateField::encode(fixed_right_arg_.has_value | |
| 1142 ? NONE : right_state_) | |
| 1143 | ResultStateField::encode(result_state_) | |
| 1144 | HasFixedRightArgBits::encode(fixed_right_arg_.has_value) | |
| 1145 | FixedRightArgValueBits::encode(fixed_right_arg_.has_value | |
| 1146 ? encode_arg_value( | |
| 1147 fixed_right_arg_.value) | |
| 1148 : 0) | |
| 1149 | SSE2Field::encode(sse_field) | |
| 1150 | OverwriteModeField::encode(mode_); | |
| 1151 } | |
| 1152 | 1102 |
| 1153 bool CanReuseDoubleBox() { | 1103 virtual void PrintState(StringStream* stream) V8_OVERRIDE; |
| 1154 return result_state_ <= NUMBER && result_state_ > SMI && | |
| 1155 ((left_state_ > SMI && left_state_ <= NUMBER && | |
| 1156 mode_ == OVERWRITE_LEFT) || | |
| 1157 (right_state_ > SMI && right_state_ <= NUMBER && | |
| 1158 mode_ == OVERWRITE_RIGHT)); | |
| 1159 } | |
| 1160 | 1104 |
| 1161 bool HasSideEffects(Isolate* isolate) const { | 1105 // Parameters accessed via CodeStubGraphBuilder::GetParameter() |
| 1162 Handle<Type> left = GetLeftType(isolate); | 1106 static const int kLeft = 0; |
| 1163 Handle<Type> right = GetRightType(isolate); | 1107 static const int kRight = 1; |
| 1164 return left->Maybe(Type::Receiver()) || right->Maybe(Type::Receiver()); | |
| 1165 } | |
| 1166 | |
| 1167 virtual Handle<Code> GenerateCode(Isolate* isolate); | |
| 1168 | |
| 1169 Maybe<Handle<Object> > Result(Handle<Object> left, | |
| 1170 Handle<Object> right, | |
| 1171 Isolate* isolate); | |
| 1172 | |
| 1173 Token::Value operation() const { return op_; } | |
| 1174 OverwriteMode mode() const { return mode_; } | |
| 1175 Maybe<int> fixed_right_arg() const { return fixed_right_arg_; } | |
| 1176 | |
| 1177 Handle<Type> GetLeftType(Isolate* isolate) const; | |
| 1178 Handle<Type> GetRightType(Isolate* isolate) const; | |
| 1179 Handle<Type> GetResultType(Isolate* isolate) const; | |
| 1180 | |
| 1181 void UpdateStatus(Handle<Object> left, | |
| 1182 Handle<Object> right, | |
| 1183 Maybe<Handle<Object> > result); | |
| 1184 | |
| 1185 void PrintState(StringStream* stream); | |
| 1186 | 1108 |
| 1187 private: | 1109 private: |
| 1188 explicit BinaryOpStub(InitializationState state) : HydrogenCodeStub(state), | 1110 static void GenerateAheadOfTime(Isolate* isolate, |
| 1189 op_(Token::ADD), | 1111 const BinaryOpIC::State& state); |
| 1190 mode_(NO_OVERWRITE) { | |
| 1191 Initialize(); | |
| 1192 } | |
| 1193 void Initialize(); | |
| 1194 | 1112 |
| 1195 enum State { NONE, SMI, INT32, NUMBER, STRING, GENERIC }; | 1113 virtual Major MajorKey() V8_OVERRIDE { return BinaryOpIC; } |
| 1114 virtual int NotMissMinorKey() V8_OVERRIDE { return GetExtraICState(); } |
| 1196 | 1115 |
| 1197 // We truncate the last bit of the token. | 1116 BinaryOpIC::State state_; |
| 1198 STATIC_ASSERT(LAST_TOKEN - FIRST_TOKEN < (1 << 5)); | |
| 1199 class LeftStateField: public BitField<State, 0, 3> {}; | |
| 1200 // When fixed right arg is set, we don't need to store the right state. | |
| 1201 // Thus the two fields can overlap. | |
| 1202 class HasFixedRightArgBits: public BitField<bool, 4, 1> {}; | |
| 1203 class FixedRightArgValueBits: public BitField<int, 5, 4> {}; | |
| 1204 class RightStateField: public BitField<State, 5, 3> {}; | |
| 1205 class ResultStateField: public BitField<State, 9, 3> {}; | |
| 1206 class SSE2Field: public BitField<bool, 12, 1> {}; | |
| 1207 class OverwriteModeField: public BitField<OverwriteMode, 13, 2> {}; | |
| 1208 class OpBits: public BitField<int, 15, 5> {}; | |
| 1209 | 1117 |
| 1210 virtual CodeStub::Major MajorKey() { return BinaryOp; } | 1118 DISALLOW_COPY_AND_ASSIGN(BinaryOpICStub); |
| 1211 virtual int NotMissMinorKey() { return GetExtraICState(); } | |
| 1212 | |
| 1213 static Handle<Type> StateToType(State state, | |
| 1214 Isolate* isolate); | |
| 1215 | |
| 1216 static void Generate(Token::Value op, | |
| 1217 State left, | |
| 1218 int right, | |
| 1219 State result, | |
| 1220 OverwriteMode mode, | |
| 1221 Isolate* isolate); | |
| 1222 | |
| 1223 static void Generate(Token::Value op, | |
| 1224 State left, | |
| 1225 State right, | |
| 1226 State result, | |
| 1227 OverwriteMode mode, | |
| 1228 Isolate* isolate); | |
| 1229 | |
| 1230 void UpdateStatus(Handle<Object> object, | |
| 1231 State* state); | |
| 1232 | |
| 1233 bool can_encode_arg_value(int32_t value) const; | |
| 1234 int encode_arg_value(int32_t value) const; | |
| 1235 int32_t decode_arg_value(int value) const; | |
| 1236 int encode_token(Token::Value op) const; | |
| 1237 Token::Value decode_token(int op) const; | |
| 1238 | |
| 1239 bool has_int_result() const { | |
| 1240 return op_ == Token::BIT_XOR || op_ == Token::BIT_AND || | |
| 1241 op_ == Token::BIT_OR || op_ == Token::SAR || op_ == Token::SHL; | |
| 1242 } | |
| 1243 | |
| 1244 const char* StateToName(State state); | |
| 1245 | |
| 1246 void PrintBaseName(StringStream* stream); | |
| 1247 | |
| 1248 Token::Value op_; | |
| 1249 OverwriteMode mode_; | |
| 1250 | |
| 1251 Maybe<int> fixed_right_arg_; | |
| 1252 State left_state_; | |
| 1253 State right_state_; | |
| 1254 State result_state_; | |
| 1255 }; | 1119 }; |
| 1256 | 1120 |
| 1257 | 1121 |
| 1258 // TODO(bmeurer): Rename to StringAddStub once we dropped the old StringAddStub. | 1122 // TODO(bmeurer): Rename to StringAddStub once we dropped the old StringAddStub. |
| 1259 class NewStringAddStub V8_FINAL : public HydrogenCodeStub { | 1123 class NewStringAddStub V8_FINAL : public HydrogenCodeStub { |
| 1260 public: | 1124 public: |
| 1261 NewStringAddStub(StringAddFlags flags, PretenureFlag pretenure_flag) | 1125 NewStringAddStub(StringAddFlags flags, PretenureFlag pretenure_flag) |
| 1262 : bit_field_(StringAddFlagsBits::encode(flags) | | 1126 : bit_field_(StringAddFlagsBits::encode(flags) | |
| 1263 PretenureFlagBits::encode(pretenure_flag)) {} | 1127 PretenureFlagBits::encode(pretenure_flag)) {} |
| 1264 | 1128 |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1468 explicit CEntryStub(int result_size, | 1332 explicit CEntryStub(int result_size, |
| 1469 SaveFPRegsMode save_doubles = kDontSaveFPRegs) | 1333 SaveFPRegsMode save_doubles = kDontSaveFPRegs) |
| 1470 : result_size_(result_size), save_doubles_(save_doubles) { } | 1334 : result_size_(result_size), save_doubles_(save_doubles) { } |
| 1471 | 1335 |
| 1472 void Generate(MacroAssembler* masm); | 1336 void Generate(MacroAssembler* masm); |
| 1473 | 1337 |
| 1474 // The version of this stub that doesn't save doubles is generated ahead of | 1338 // The version of this stub that doesn't save doubles is generated ahead of |
| 1475 // time, so it's OK to call it from other stubs that can't cope with GC during | 1339 // time, so it's OK to call it from other stubs that can't cope with GC during |
| 1476 // their code generation. On machines that always have gp registers (x64) we | 1340 // their code generation. On machines that always have gp registers (x64) we |
| 1477 // can generate both variants ahead of time. | 1341 // can generate both variants ahead of time. |
| 1478 virtual bool IsPregenerated(Isolate* isolate) V8_OVERRIDE; | |
| 1479 static void GenerateAheadOfTime(Isolate* isolate); | 1342 static void GenerateAheadOfTime(Isolate* isolate); |
| 1480 | 1343 |
| 1481 protected: | 1344 protected: |
| 1482 virtual void VerifyPlatformFeatures(Isolate* isolate) V8_OVERRIDE { | 1345 virtual void VerifyPlatformFeatures(Isolate* isolate) V8_OVERRIDE { |
| 1483 ASSERT(CpuFeatures::VerifyCrossCompiling(SSE2)); | 1346 ASSERT(CpuFeatures::VerifyCrossCompiling(SSE2)); |
| 1484 }; | 1347 }; |
| 1485 | 1348 |
| 1486 private: | 1349 private: |
| 1487 void GenerateCore(MacroAssembler* masm, | 1350 void GenerateCore(MacroAssembler* masm, |
| 1488 Label* throw_normal_exception, | 1351 Label* throw_normal_exception, |
| (...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1820 } | 1683 } |
| 1821 | 1684 |
| 1822 private: | 1685 private: |
| 1823 StringCharCodeAtGenerator char_code_at_generator_; | 1686 StringCharCodeAtGenerator char_code_at_generator_; |
| 1824 StringCharFromCodeGenerator char_from_code_generator_; | 1687 StringCharFromCodeGenerator char_from_code_generator_; |
| 1825 | 1688 |
| 1826 DISALLOW_COPY_AND_ASSIGN(StringCharAtGenerator); | 1689 DISALLOW_COPY_AND_ASSIGN(StringCharAtGenerator); |
| 1827 }; | 1690 }; |
| 1828 | 1691 |
| 1829 | 1692 |
| 1830 class AllowStubCallsScope { | |
| 1831 public: | |
| 1832 AllowStubCallsScope(MacroAssembler* masm, bool allow) | |
| 1833 : masm_(masm), previous_allow_(masm->allow_stub_calls()) { | |
| 1834 masm_->set_allow_stub_calls(allow); | |
| 1835 } | |
| 1836 ~AllowStubCallsScope() { | |
| 1837 masm_->set_allow_stub_calls(previous_allow_); | |
| 1838 } | |
| 1839 | |
| 1840 private: | |
| 1841 MacroAssembler* masm_; | |
| 1842 bool previous_allow_; | |
| 1843 | |
| 1844 DISALLOW_COPY_AND_ASSIGN(AllowStubCallsScope); | |
| 1845 }; | |
| 1846 | |
| 1847 | |
| 1848 class KeyedLoadDictionaryElementStub : public HydrogenCodeStub { | 1693 class KeyedLoadDictionaryElementStub : public HydrogenCodeStub { |
| 1849 public: | 1694 public: |
| 1850 KeyedLoadDictionaryElementStub() {} | 1695 KeyedLoadDictionaryElementStub() {} |
| 1851 | 1696 |
| 1852 virtual Handle<Code> GenerateCode(Isolate* isolate) V8_OVERRIDE; | 1697 virtual Handle<Code> GenerateCode(Isolate* isolate) V8_OVERRIDE; |
| 1853 | 1698 |
| 1854 virtual void InitializeInterfaceDescriptor( | 1699 virtual void InitializeInterfaceDescriptor( |
| 1855 Isolate* isolate, | 1700 Isolate* isolate, |
| 1856 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; | 1701 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; |
| 1857 | 1702 |
| (...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2109 } | 1954 } |
| 2110 | 1955 |
| 2111 AllocationSiteOverrideMode override_mode() const { | 1956 AllocationSiteOverrideMode override_mode() const { |
| 2112 return AllocationSiteOverrideModeBits::decode(bit_field_); | 1957 return AllocationSiteOverrideModeBits::decode(bit_field_); |
| 2113 } | 1958 } |
| 2114 | 1959 |
| 2115 ContextCheckMode context_mode() const { | 1960 ContextCheckMode context_mode() const { |
| 2116 return ContextCheckModeBits::decode(bit_field_); | 1961 return ContextCheckModeBits::decode(bit_field_); |
| 2117 } | 1962 } |
| 2118 | 1963 |
| 2119 virtual bool IsPregenerated(Isolate* isolate) V8_OVERRIDE { | |
| 2120 // We only pre-generate stubs that verify correct context | |
| 2121 return context_mode() == CONTEXT_CHECK_REQUIRED; | |
| 2122 } | |
| 2123 | |
| 2124 static void GenerateStubsAheadOfTime(Isolate* isolate); | 1964 static void GenerateStubsAheadOfTime(Isolate* isolate); |
| 2125 static void InstallDescriptors(Isolate* isolate); | 1965 static void InstallDescriptors(Isolate* isolate); |
| 2126 | 1966 |
| 2127 // Parameters accessed via CodeStubGraphBuilder::GetParameter() | 1967 // Parameters accessed via CodeStubGraphBuilder::GetParameter() |
| 2128 static const int kConstructor = 0; | 1968 static const int kConstructor = 0; |
| 2129 static const int kPropertyCell = 1; | 1969 static const int kPropertyCell = 1; |
| 2130 | 1970 |
| 2131 private: | 1971 private: |
| 2132 int NotMissMinorKey() { return bit_field_; } | 1972 int NotMissMinorKey() { return bit_field_; } |
| 2133 | 1973 |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2210 DISALLOW_COPY_AND_ASSIGN(ArrayNArgumentsConstructorStub); | 2050 DISALLOW_COPY_AND_ASSIGN(ArrayNArgumentsConstructorStub); |
| 2211 }; | 2051 }; |
| 2212 | 2052 |
| 2213 | 2053 |
| 2214 class InternalArrayConstructorStubBase : public HydrogenCodeStub { | 2054 class InternalArrayConstructorStubBase : public HydrogenCodeStub { |
| 2215 public: | 2055 public: |
| 2216 explicit InternalArrayConstructorStubBase(ElementsKind kind) { | 2056 explicit InternalArrayConstructorStubBase(ElementsKind kind) { |
| 2217 kind_ = kind; | 2057 kind_ = kind; |
| 2218 } | 2058 } |
| 2219 | 2059 |
| 2220 virtual bool IsPregenerated(Isolate* isolate) V8_OVERRIDE { return true; } | |
| 2221 static void GenerateStubsAheadOfTime(Isolate* isolate); | 2060 static void GenerateStubsAheadOfTime(Isolate* isolate); |
| 2222 static void InstallDescriptors(Isolate* isolate); | 2061 static void InstallDescriptors(Isolate* isolate); |
| 2223 | 2062 |
| 2224 // Parameters accessed via CodeStubGraphBuilder::GetParameter() | 2063 // Parameters accessed via CodeStubGraphBuilder::GetParameter() |
| 2225 static const int kConstructor = 0; | 2064 static const int kConstructor = 0; |
| 2226 | 2065 |
| 2227 ElementsKind elements_kind() const { return kind_; } | 2066 ElementsKind elements_kind() const { return kind_; } |
| 2228 | 2067 |
| 2229 private: | 2068 private: |
| 2230 int NotMissMinorKey() { return kind_; } | 2069 int NotMissMinorKey() { return kind_; } |
| (...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2474 | 2313 |
| 2475 DISALLOW_COPY_AND_ASSIGN(StoreArrayLiteralElementStub); | 2314 DISALLOW_COPY_AND_ASSIGN(StoreArrayLiteralElementStub); |
| 2476 }; | 2315 }; |
| 2477 | 2316 |
| 2478 | 2317 |
| 2479 class StubFailureTrampolineStub : public PlatformCodeStub { | 2318 class StubFailureTrampolineStub : public PlatformCodeStub { |
| 2480 public: | 2319 public: |
| 2481 explicit StubFailureTrampolineStub(StubFunctionMode function_mode) | 2320 explicit StubFailureTrampolineStub(StubFunctionMode function_mode) |
| 2482 : fp_registers_(CanUseFPRegisters()), function_mode_(function_mode) {} | 2321 : fp_registers_(CanUseFPRegisters()), function_mode_(function_mode) {} |
| 2483 | 2322 |
| 2484 virtual bool IsPregenerated(Isolate* isolate) V8_OVERRIDE { return true; } | |
| 2485 | |
| 2486 static void GenerateAheadOfTime(Isolate* isolate); | 2323 static void GenerateAheadOfTime(Isolate* isolate); |
| 2487 | 2324 |
| 2488 private: | 2325 private: |
| 2489 class FPRegisters: public BitField<bool, 0, 1> {}; | 2326 class FPRegisters: public BitField<bool, 0, 1> {}; |
| 2490 class FunctionModeField: public BitField<StubFunctionMode, 1, 1> {}; | 2327 class FunctionModeField: public BitField<StubFunctionMode, 1, 1> {}; |
| 2491 | 2328 |
| 2492 Major MajorKey() { return StubFailureTrampoline; } | 2329 Major MajorKey() { return StubFailureTrampoline; } |
| 2493 int MinorKey() { | 2330 int MinorKey() { |
| 2494 return FPRegisters::encode(fp_registers_) | | 2331 return FPRegisters::encode(fp_registers_) | |
| 2495 FunctionModeField::encode(function_mode_); | 2332 FunctionModeField::encode(function_mode_); |
| 2496 } | 2333 } |
| 2497 | 2334 |
| 2498 void Generate(MacroAssembler* masm); | 2335 void Generate(MacroAssembler* masm); |
| 2499 | 2336 |
| 2500 bool fp_registers_; | 2337 bool fp_registers_; |
| 2501 StubFunctionMode function_mode_; | 2338 StubFunctionMode function_mode_; |
| 2502 | 2339 |
| 2503 DISALLOW_COPY_AND_ASSIGN(StubFailureTrampolineStub); | 2340 DISALLOW_COPY_AND_ASSIGN(StubFailureTrampolineStub); |
| 2504 }; | 2341 }; |
| 2505 | 2342 |
| 2506 | 2343 |
| 2507 class StubFailureTailCallTrampolineStub : public PlatformCodeStub { | 2344 class StubFailureTailCallTrampolineStub : public PlatformCodeStub { |
| 2508 public: | 2345 public: |
| 2509 StubFailureTailCallTrampolineStub() : fp_registers_(CanUseFPRegisters()) {} | 2346 StubFailureTailCallTrampolineStub() : fp_registers_(CanUseFPRegisters()) {} |
| 2510 | 2347 |
| 2511 virtual bool IsPregenerated(Isolate* isolate) V8_OVERRIDE { return true; } | |
| 2512 | |
| 2513 static void GenerateAheadOfTime(Isolate* isolate); | 2348 static void GenerateAheadOfTime(Isolate* isolate); |
| 2514 | 2349 |
| 2515 private: | 2350 private: |
| 2516 class FPRegisters: public BitField<bool, 0, 1> {}; | 2351 class FPRegisters: public BitField<bool, 0, 1> {}; |
| 2517 Major MajorKey() { return StubFailureTailCallTrampoline; } | 2352 Major MajorKey() { return StubFailureTailCallTrampoline; } |
| 2518 int MinorKey() { return FPRegisters::encode(fp_registers_); } | 2353 int MinorKey() { return FPRegisters::encode(fp_registers_); } |
| 2519 | 2354 |
| 2520 void Generate(MacroAssembler* masm); | 2355 void Generate(MacroAssembler* masm); |
| 2521 | 2356 |
| 2522 bool fp_registers_; | 2357 bool fp_registers_; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 2544 int MinorKey() { return 0; } | 2379 int MinorKey() { return 0; } |
| 2545 | 2380 |
| 2546 void Generate(MacroAssembler* masm); | 2381 void Generate(MacroAssembler* masm); |
| 2547 | 2382 |
| 2548 DISALLOW_COPY_AND_ASSIGN(ProfileEntryHookStub); | 2383 DISALLOW_COPY_AND_ASSIGN(ProfileEntryHookStub); |
| 2549 }; | 2384 }; |
| 2550 | 2385 |
| 2551 } } // namespace v8::internal | 2386 } } // namespace v8::internal |
| 2552 | 2387 |
| 2553 #endif // V8_CODE_STUBS_H_ | 2388 #endif // V8_CODE_STUBS_H_ |
| OLD | NEW |