OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_CODE_STUBS_H_ | 5 #ifndef V8_CODE_STUBS_H_ |
6 #define V8_CODE_STUBS_H_ | 6 #define V8_CODE_STUBS_H_ |
7 | 7 |
8 #include "src/allocation.h" | 8 #include "src/allocation.h" |
9 #include "src/assembler.h" | 9 #include "src/assembler.h" |
10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
(...skipping 1173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1184 DISALLOW_COPY_AND_ASSIGN(BinaryOpICStub); | 1184 DISALLOW_COPY_AND_ASSIGN(BinaryOpICStub); |
1185 }; | 1185 }; |
1186 | 1186 |
1187 | 1187 |
1188 // TODO(bmeurer): Merge this into the BinaryOpICStub once we have proper tail | 1188 // TODO(bmeurer): Merge this into the BinaryOpICStub once we have proper tail |
1189 // call support for stubs in Hydrogen. | 1189 // call support for stubs in Hydrogen. |
1190 class BinaryOpICWithAllocationSiteStub V8_FINAL : public PlatformCodeStub { | 1190 class BinaryOpICWithAllocationSiteStub V8_FINAL : public PlatformCodeStub { |
1191 public: | 1191 public: |
1192 BinaryOpICWithAllocationSiteStub(Isolate* isolate, | 1192 BinaryOpICWithAllocationSiteStub(Isolate* isolate, |
1193 const BinaryOpIC::State& state) | 1193 const BinaryOpIC::State& state) |
1194 : PlatformCodeStub(isolate), state_(state) {} | 1194 : PlatformCodeStub(isolate) { |
| 1195 minor_key_ = state.GetExtraICState(); |
| 1196 } |
1195 | 1197 |
1196 static void GenerateAheadOfTime(Isolate* isolate); | 1198 static void GenerateAheadOfTime(Isolate* isolate); |
1197 | 1199 |
1198 Handle<Code> GetCodeCopyFromTemplate(Handle<AllocationSite> allocation_site) { | 1200 Handle<Code> GetCodeCopyFromTemplate(Handle<AllocationSite> allocation_site) { |
1199 Code::FindAndReplacePattern pattern; | 1201 Code::FindAndReplacePattern pattern; |
1200 pattern.Add(isolate()->factory()->undefined_map(), allocation_site); | 1202 pattern.Add(isolate()->factory()->undefined_map(), allocation_site); |
1201 return CodeStub::GetCodeCopy(pattern); | 1203 return CodeStub::GetCodeCopy(pattern); |
1202 } | 1204 } |
1203 | 1205 |
1204 virtual Code::Kind GetCodeKind() const V8_OVERRIDE { | 1206 virtual Code::Kind GetCodeKind() const V8_OVERRIDE { |
1205 return Code::BINARY_OP_IC; | 1207 return Code::BINARY_OP_IC; |
1206 } | 1208 } |
1207 | 1209 |
1208 virtual InlineCacheState GetICState() const V8_OVERRIDE { | 1210 virtual InlineCacheState GetICState() const V8_OVERRIDE { |
1209 return state_.GetICState(); | 1211 return state().GetICState(); |
1210 } | 1212 } |
1211 | 1213 |
1212 virtual ExtraICState GetExtraICState() const V8_OVERRIDE { | 1214 virtual ExtraICState GetExtraICState() const V8_OVERRIDE { |
1213 return state_.GetExtraICState(); | 1215 return static_cast<ExtraICState>(minor_key_); |
1214 } | 1216 } |
1215 | 1217 |
1216 virtual void Generate(MacroAssembler* masm) V8_OVERRIDE; | 1218 virtual void Generate(MacroAssembler* masm) V8_OVERRIDE; |
1217 | 1219 |
1218 virtual void PrintState(OStream& os) const V8_OVERRIDE; // NOLINT | 1220 virtual void PrintState(OStream& os) const V8_OVERRIDE; // NOLINT |
1219 | 1221 |
1220 virtual Major MajorKey() const V8_OVERRIDE { | 1222 virtual Major MajorKey() const V8_OVERRIDE { |
1221 return BinaryOpICWithAllocationSite; | 1223 return BinaryOpICWithAllocationSite; |
1222 } | 1224 } |
1223 virtual uint32_t MinorKey() const V8_OVERRIDE { return GetExtraICState(); } | |
1224 | 1225 |
1225 private: | 1226 private: |
| 1227 BinaryOpIC::State state() const { |
| 1228 return BinaryOpIC::State(isolate(), static_cast<ExtraICState>(minor_key_)); |
| 1229 } |
| 1230 |
1226 static void GenerateAheadOfTime(Isolate* isolate, | 1231 static void GenerateAheadOfTime(Isolate* isolate, |
1227 const BinaryOpIC::State& state); | 1232 const BinaryOpIC::State& state); |
1228 | 1233 |
1229 BinaryOpIC::State state_; | |
1230 | |
1231 DISALLOW_COPY_AND_ASSIGN(BinaryOpICWithAllocationSiteStub); | 1234 DISALLOW_COPY_AND_ASSIGN(BinaryOpICWithAllocationSiteStub); |
1232 }; | 1235 }; |
1233 | 1236 |
1234 | 1237 |
1235 class BinaryOpWithAllocationSiteStub V8_FINAL : public BinaryOpICStub { | 1238 class BinaryOpWithAllocationSiteStub V8_FINAL : public BinaryOpICStub { |
1236 public: | 1239 public: |
1237 BinaryOpWithAllocationSiteStub(Isolate* isolate, | 1240 BinaryOpWithAllocationSiteStub(Isolate* isolate, |
1238 Token::Value op, | 1241 Token::Value op, |
1239 OverwriteMode mode) | 1242 OverwriteMode mode) |
1240 : BinaryOpICStub(isolate, op, mode) {} | 1243 : BinaryOpICStub(isolate, op, mode) {} |
(...skipping 1304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2545 | 2548 |
2546 | 2549 |
2547 class CallDescriptors { | 2550 class CallDescriptors { |
2548 public: | 2551 public: |
2549 static void InitializeForIsolate(Isolate* isolate); | 2552 static void InitializeForIsolate(Isolate* isolate); |
2550 }; | 2553 }; |
2551 | 2554 |
2552 } } // namespace v8::internal | 2555 } } // namespace v8::internal |
2553 | 2556 |
2554 #endif // V8_CODE_STUBS_H_ | 2557 #endif // V8_CODE_STUBS_H_ |
OLD | NEW |