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

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

Issue 106453003: Allocation site support for monomorphic StringAdds in BinaryOps. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: REBASE 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/ast.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 24 matching lines...) Expand all
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(BinaryOpIC) \ 44 V(BinaryOpIC) \
45 V(BinaryOpICWithAllocationSite) \
46 V(BinaryOpWithAllocationSite) \
45 V(StringAdd) \ 47 V(StringAdd) \
46 V(NewStringAdd) \ 48 V(NewStringAdd) \
47 V(SubString) \ 49 V(SubString) \
48 V(StringCompare) \ 50 V(StringCompare) \
49 V(Compare) \ 51 V(Compare) \
50 V(CompareIC) \ 52 V(CompareIC) \
51 V(CompareNilIC) \ 53 V(CompareNilIC) \
52 V(MathPow) \ 54 V(MathPow) \
53 V(StringLength) \ 55 V(StringLength) \
54 V(FunctionPrototype) \ 56 V(FunctionPrototype) \
(...skipping 1000 matching lines...) Expand 10 before | Expand all | Expand 10 after
1055 STATIC_ASSERT(CallICBase::Contextual::kSize == ContextualBits::kSize); 1057 STATIC_ASSERT(CallICBase::Contextual::kSize == ContextualBits::kSize);
1056 class HoleyBits: public BitField<bool, 1, 1> {}; 1058 class HoleyBits: public BitField<bool, 1, 1> {};
1057 STATIC_ASSERT(Code::kArgumentsBits <= kStubMinorKeyBits - 2); 1059 STATIC_ASSERT(Code::kArgumentsBits <= kStubMinorKeyBits - 2);
1058 class ArgcBits: public BitField<int, 2, Code::kArgumentsBits> {}; 1060 class ArgcBits: public BitField<int, 2, Code::kArgumentsBits> {};
1059 virtual CodeStub::Major MajorKey() { return KeyedArrayCall; } 1061 virtual CodeStub::Major MajorKey() { return KeyedArrayCall; }
1060 int bit_field_; 1062 int bit_field_;
1061 int argc_; 1063 int argc_;
1062 }; 1064 };
1063 1065
1064 1066
1065 class BinaryOpICStub V8_FINAL : public HydrogenCodeStub { 1067 class BinaryOpICStub : public HydrogenCodeStub {
1066 public: 1068 public:
1067 BinaryOpICStub(Token::Value op, OverwriteMode mode) 1069 BinaryOpICStub(Token::Value op, OverwriteMode mode)
1068 : HydrogenCodeStub(UNINITIALIZED), state_(op, mode) {} 1070 : HydrogenCodeStub(UNINITIALIZED), state_(op, mode) {}
1069 1071
1070 explicit BinaryOpICStub(const BinaryOpIC::State& state) : state_(state) {} 1072 explicit BinaryOpICStub(const BinaryOpIC::State& state) : state_(state) {}
1071 1073
1072 static void GenerateAheadOfTime(Isolate* isolate); 1074 static void GenerateAheadOfTime(Isolate* isolate);
1073 1075
1074 virtual void InitializeInterfaceDescriptor( 1076 virtual void InitializeInterfaceDescriptor(
1075 Isolate* isolate, CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; 1077 Isolate* isolate, CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE;
1076 1078
1077 static void InstallDescriptors(Isolate* isolate); 1079 static void InstallDescriptors(Isolate* isolate);
1078 1080
1079 virtual Code::Kind GetCodeKind() const V8_OVERRIDE { 1081 virtual Code::Kind GetCodeKind() const V8_FINAL V8_OVERRIDE {
1080 return Code::BINARY_OP_IC; 1082 return Code::BINARY_OP_IC;
1081 } 1083 }
1082 1084
1083 virtual InlineCacheState GetICState() V8_OVERRIDE { 1085 virtual InlineCacheState GetICState() V8_FINAL V8_OVERRIDE {
1084 return state_.GetICState(); 1086 return state_.GetICState();
1085 } 1087 }
1086 1088
1087 virtual ExtraICState GetExtraICState() V8_OVERRIDE { 1089 virtual ExtraICState GetExtraICState() V8_FINAL V8_OVERRIDE {
1088 return state_.GetExtraICState(); 1090 return state_.GetExtraICState();
1089 } 1091 }
1090 1092
1091 virtual void VerifyPlatformFeatures(Isolate* isolate) V8_OVERRIDE { 1093 virtual void VerifyPlatformFeatures(Isolate* isolate) V8_FINAL V8_OVERRIDE {
1092 ASSERT(CpuFeatures::VerifyCrossCompiling(SSE2)); 1094 ASSERT(CpuFeatures::VerifyCrossCompiling(SSE2));
1093 } 1095 }
1094 1096
1095 virtual Handle<Code> GenerateCode(Isolate* isolate) V8_OVERRIDE; 1097 virtual Handle<Code> GenerateCode(Isolate* isolate) V8_OVERRIDE;
1096 1098
1097 const BinaryOpIC::State& state() const { return state_; } 1099 const BinaryOpIC::State& state() const { return state_; }
1098 1100
1099 virtual void PrintState(StringStream* stream) V8_OVERRIDE; 1101 virtual void PrintState(StringStream* stream) V8_FINAL V8_OVERRIDE;
1102
1103 virtual Major MajorKey() V8_OVERRIDE { return BinaryOpIC; }
1104 virtual int NotMissMinorKey() V8_FINAL V8_OVERRIDE {
1105 return GetExtraICState();
1106 }
1100 1107
1101 // Parameters accessed via CodeStubGraphBuilder::GetParameter() 1108 // Parameters accessed via CodeStubGraphBuilder::GetParameter()
1102 static const int kLeft = 0; 1109 static const int kLeft = 0;
1103 static const int kRight = 1; 1110 static const int kRight = 1;
1104 1111
1105 private: 1112 private:
1106 static void GenerateAheadOfTime(Isolate* isolate, 1113 static void GenerateAheadOfTime(Isolate* isolate,
1107 const BinaryOpIC::State& state); 1114 const BinaryOpIC::State& state);
1108 1115
1109 virtual Major MajorKey() V8_OVERRIDE { return BinaryOpIC; }
1110 virtual int NotMissMinorKey() V8_OVERRIDE { return GetExtraICState(); }
1111
1112 BinaryOpIC::State state_; 1116 BinaryOpIC::State state_;
1113 1117
1114 DISALLOW_COPY_AND_ASSIGN(BinaryOpICStub); 1118 DISALLOW_COPY_AND_ASSIGN(BinaryOpICStub);
1115 }; 1119 };
1116 1120
1117 1121
1122 // TODO(bmeurer): Merge this into the BinaryOpICStub once we have proper tail
1123 // call support for stubs in Hydrogen.
1124 class BinaryOpICWithAllocationSiteStub V8_FINAL : public PlatformCodeStub {
1125 public:
1126 explicit BinaryOpICWithAllocationSiteStub(const BinaryOpIC::State& state)
1127 : state_(state) {}
1128
1129 static void GenerateAheadOfTime(Isolate* isolate);
1130
1131 Handle<Code> GetCodeCopyFromTemplate(Isolate* isolate,
1132 Handle<AllocationSite> allocation_site) {
1133 Handle<Code> code = CodeStub::GetCodeCopyFromTemplate(isolate);
1134 // Replace the placeholder oddball with the actual allocation site.
1135 code->ReplaceNthObject(1, isolate->heap()->oddball_map(), *allocation_site);
1136 return code;
1137 }
1138
1139 virtual Code::Kind GetCodeKind() const V8_OVERRIDE {
1140 return Code::BINARY_OP_IC;
1141 }
1142
1143 virtual InlineCacheState GetICState() V8_OVERRIDE {
1144 return state_.GetICState();
1145 }
1146
1147 virtual ExtraICState GetExtraICState() V8_OVERRIDE {
1148 return state_.GetExtraICState();
1149 }
1150
1151 virtual void VerifyPlatformFeatures(Isolate* isolate) V8_OVERRIDE {
1152 ASSERT(CpuFeatures::VerifyCrossCompiling(SSE2));
1153 }
1154
1155 virtual void Generate(MacroAssembler* masm) V8_OVERRIDE;
1156
1157 virtual void PrintState(StringStream* stream) V8_OVERRIDE;
1158
1159 virtual Major MajorKey() V8_OVERRIDE { return BinaryOpICWithAllocationSite; }
1160 virtual int MinorKey() V8_OVERRIDE { return GetExtraICState(); }
1161
1162 private:
1163 static void GenerateAheadOfTime(Isolate* isolate,
1164 const BinaryOpIC::State& state);
1165
1166 BinaryOpIC::State state_;
1167
1168 DISALLOW_COPY_AND_ASSIGN(BinaryOpICWithAllocationSiteStub);
1169 };
1170
1171
1172 class BinaryOpWithAllocationSiteStub V8_FINAL : public BinaryOpICStub {
1173 public:
1174 explicit BinaryOpWithAllocationSiteStub(const BinaryOpIC::State& state)
1175 : BinaryOpICStub(state) {}
1176
1177 virtual void InitializeInterfaceDescriptor(
1178 Isolate* isolate, CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE;
1179
1180 static void InstallDescriptors(Isolate* isolate);
1181
1182 virtual Code::Kind GetCodeKind() const V8_FINAL V8_OVERRIDE {
1183 return Code::STUB;
1184 }
1185
1186 virtual Handle<Code> GenerateCode(Isolate* isolate) V8_OVERRIDE;
1187
1188 virtual Major MajorKey() V8_OVERRIDE {
1189 return BinaryOpWithAllocationSite;
1190 }
1191
1192 // Parameters accessed via CodeStubGraphBuilder::GetParameter()
1193 static const int kAllocationSite = 0;
1194 static const int kLeft = 1;
1195 static const int kRight = 2;
1196 };
1197
1198
1118 // TODO(bmeurer): Rename to StringAddStub once we dropped the old StringAddStub. 1199 // TODO(bmeurer): Rename to StringAddStub once we dropped the old StringAddStub.
1119 class NewStringAddStub V8_FINAL : public HydrogenCodeStub { 1200 class NewStringAddStub V8_FINAL : public HydrogenCodeStub {
1120 public: 1201 public:
1121 NewStringAddStub(StringAddFlags flags, PretenureFlag pretenure_flag) 1202 NewStringAddStub(StringAddFlags flags, PretenureFlag pretenure_flag)
1122 : bit_field_(StringAddFlagsBits::encode(flags) | 1203 : bit_field_(StringAddFlagsBits::encode(flags) |
1123 PretenureFlagBits::encode(pretenure_flag)) {} 1204 PretenureFlagBits::encode(pretenure_flag)) {}
1124 1205
1125 StringAddFlags flags() const { 1206 StringAddFlags flags() const {
1126 return StringAddFlagsBits::decode(bit_field_); 1207 return StringAddFlagsBits::decode(bit_field_);
1127 } 1208 }
1128 1209
1129 PretenureFlag pretenure_flag() const { 1210 PretenureFlag pretenure_flag() const {
1130 return PretenureFlagBits::decode(bit_field_); 1211 return PretenureFlagBits::decode(bit_field_);
1131 } 1212 }
1132 1213
1214 virtual void VerifyPlatformFeatures(Isolate* isolate) V8_OVERRIDE {
1215 ASSERT(CpuFeatures::VerifyCrossCompiling(SSE2));
1216 }
1217
1133 virtual Handle<Code> GenerateCode(Isolate* isolate) V8_OVERRIDE; 1218 virtual Handle<Code> GenerateCode(Isolate* isolate) V8_OVERRIDE;
1134 1219
1135 virtual void InitializeInterfaceDescriptor( 1220 virtual void InitializeInterfaceDescriptor(
1136 Isolate* isolate, 1221 Isolate* isolate,
1137 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; 1222 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE;
1138 1223
1139 static void InstallDescriptors(Isolate* isolate); 1224 static void InstallDescriptors(Isolate* isolate);
1140 1225
1141 // Parameters accessed via CodeStubGraphBuilder::GetParameter() 1226 // Parameters accessed via CodeStubGraphBuilder::GetParameter()
1142 static const int kLeft = 0; 1227 static const int kLeft = 0;
(...skipping 1219 matching lines...) Expand 10 before | Expand all | Expand 10 after
2362 int MinorKey() { return 0; } 2447 int MinorKey() { return 0; }
2363 2448
2364 void Generate(MacroAssembler* masm); 2449 void Generate(MacroAssembler* masm);
2365 2450
2366 DISALLOW_COPY_AND_ASSIGN(ProfileEntryHookStub); 2451 DISALLOW_COPY_AND_ASSIGN(ProfileEntryHookStub);
2367 }; 2452 };
2368 2453
2369 } } // namespace v8::internal 2454 } } // namespace v8::internal
2370 2455
2371 #endif // V8_CODE_STUBS_H_ 2456 #endif // V8_CODE_STUBS_H_
OLDNEW
« no previous file with comments | « src/ast.h ('k') | src/code-stubs.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698