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

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

Issue 618643002: Replace OStream with std::ostream. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fix Created 6 years, 2 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/basic-block-profiler.cc ('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 // 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 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 // Returns information for computing the number key. 197 // Returns information for computing the number key.
198 virtual Major MajorKey() const = 0; 198 virtual Major MajorKey() const = 0;
199 uint32_t MinorKey() const { return minor_key_; } 199 uint32_t MinorKey() const { return minor_key_; }
200 200
201 virtual InlineCacheState GetICState() const { return UNINITIALIZED; } 201 virtual InlineCacheState GetICState() const { return UNINITIALIZED; }
202 virtual ExtraICState GetExtraICState() const { return kNoExtraICState; } 202 virtual ExtraICState GetExtraICState() const { return kNoExtraICState; }
203 virtual Code::StubType GetStubType() { 203 virtual Code::StubType GetStubType() {
204 return Code::NORMAL; 204 return Code::NORMAL;
205 } 205 }
206 206
207 friend OStream& operator<<(OStream& os, const CodeStub& s) { 207 friend std::ostream& operator<<(std::ostream& os, const CodeStub& s) {
208 s.PrintName(os); 208 s.PrintName(os);
209 return os; 209 return os;
210 } 210 }
211 211
212 Isolate* isolate() const { return isolate_; } 212 Isolate* isolate() const { return isolate_; }
213 213
214 protected: 214 protected:
215 CodeStub(uint32_t key, Isolate* isolate) 215 CodeStub(uint32_t key, Isolate* isolate)
216 : minor_key_(MinorKeyFromKey(key)), isolate_(isolate) {} 216 : minor_key_(MinorKeyFromKey(key)), isolate_(isolate) {}
217 217
218 // Generates the assembler code for the stub. 218 // Generates the assembler code for the stub.
219 virtual Handle<Code> GenerateCode() = 0; 219 virtual Handle<Code> GenerateCode() = 0;
220 220
221 // Returns whether the code generated for this stub needs to be allocated as 221 // Returns whether the code generated for this stub needs to be allocated as
222 // a fixed (non-moveable) code object. 222 // a fixed (non-moveable) code object.
223 virtual bool NeedsImmovableCode() { return false; } 223 virtual bool NeedsImmovableCode() { return false; }
224 224
225 virtual void PrintName(OStream& os) const; // NOLINT 225 virtual void PrintName(std::ostream& os) const; // NOLINT
226 virtual void PrintBaseName(OStream& os) const; // NOLINT 226 virtual void PrintBaseName(std::ostream& os) const; // NOLINT
227 virtual void PrintState(OStream& os) const { ; } // NOLINT 227 virtual void PrintState(std::ostream& os) const { ; } // NOLINT
228 228
229 // Computes the key based on major and minor. 229 // Computes the key based on major and minor.
230 uint32_t GetKey() { 230 uint32_t GetKey() {
231 DCHECK(static_cast<int>(MajorKey()) < NUMBER_OF_IDS); 231 DCHECK(static_cast<int>(MajorKey()) < NUMBER_OF_IDS);
232 return MinorKeyBits::encode(MinorKey()) | MajorKeyBits::encode(MajorKey()); 232 return MinorKeyBits::encode(MinorKey()) | MajorKeyBits::encode(MajorKey());
233 } 233 }
234 234
235 uint32_t minor_key_; 235 uint32_t minor_key_;
236 236
237 private: 237 private:
(...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after
699 bool HasArgsInRegisters() const { return (flags() & kArgsInRegisters) != 0; } 699 bool HasArgsInRegisters() const { return (flags() & kArgsInRegisters) != 0; }
700 700
701 bool HasCallSiteInlineCheck() const { 701 bool HasCallSiteInlineCheck() const {
702 return (flags() & kCallSiteInlineCheck) != 0; 702 return (flags() & kCallSiteInlineCheck) != 0;
703 } 703 }
704 704
705 bool ReturnTrueFalseObject() const { 705 bool ReturnTrueFalseObject() const {
706 return (flags() & kReturnTrueFalseObject) != 0; 706 return (flags() & kReturnTrueFalseObject) != 0;
707 } 707 }
708 708
709 virtual void PrintName(OStream& os) const OVERRIDE; // NOLINT 709 virtual void PrintName(std::ostream& os) const OVERRIDE; // NOLINT
710 710
711 class FlagBits : public BitField<Flags, 0, 3> {}; 711 class FlagBits : public BitField<Flags, 0, 3> {};
712 712
713 DEFINE_PLATFORM_CODE_STUB(Instanceof, PlatformCodeStub); 713 DEFINE_PLATFORM_CODE_STUB(Instanceof, PlatformCodeStub);
714 }; 714 };
715 715
716 716
717 enum AllocationSiteOverrideMode { 717 enum AllocationSiteOverrideMode {
718 DONT_OVERRIDE, 718 DONT_OVERRIDE,
719 DISABLE_ALLOCATION_SITES, 719 DISABLE_ALLOCATION_SITES,
(...skipping 10 matching lines...) Expand all
730 explicit ArrayConstructorStub(Isolate* isolate); 730 explicit ArrayConstructorStub(Isolate* isolate);
731 731
732 private: 732 private:
733 ArgumentCountKey argument_count() const { 733 ArgumentCountKey argument_count() const {
734 return ArgumentCountBits::decode(minor_key_); 734 return ArgumentCountBits::decode(minor_key_);
735 } 735 }
736 736
737 void GenerateDispatchToArrayStub(MacroAssembler* masm, 737 void GenerateDispatchToArrayStub(MacroAssembler* masm,
738 AllocationSiteOverrideMode mode); 738 AllocationSiteOverrideMode mode);
739 739
740 virtual void PrintName(OStream& os) const OVERRIDE; // NOLINT 740 virtual void PrintName(std::ostream& os) const OVERRIDE; // NOLINT
741 741
742 class ArgumentCountBits : public BitField<ArgumentCountKey, 0, 2> {}; 742 class ArgumentCountBits : public BitField<ArgumentCountKey, 0, 2> {};
743 743
744 DEFINE_CALL_INTERFACE_DESCRIPTOR(ArrayConstructor); 744 DEFINE_CALL_INTERFACE_DESCRIPTOR(ArrayConstructor);
745 DEFINE_PLATFORM_CODE_STUB(ArrayConstructor, PlatformCodeStub); 745 DEFINE_PLATFORM_CODE_STUB(ArrayConstructor, PlatformCodeStub);
746 }; 746 };
747 747
748 748
749 class InternalArrayConstructorStub: public PlatformCodeStub { 749 class InternalArrayConstructorStub: public PlatformCodeStub {
750 public: 750 public:
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
816 int arg_count() const { return state().arg_count(); } 816 int arg_count() const { return state().arg_count(); }
817 817
818 CallICState state() const { 818 CallICState state() const {
819 return CallICState(static_cast<ExtraICState>(minor_key_)); 819 return CallICState(static_cast<ExtraICState>(minor_key_));
820 } 820 }
821 821
822 // Code generation helpers. 822 // Code generation helpers.
823 void GenerateMiss(MacroAssembler* masm); 823 void GenerateMiss(MacroAssembler* masm);
824 824
825 private: 825 private:
826 virtual void PrintState(OStream& os) const OVERRIDE; // NOLINT 826 virtual void PrintState(std::ostream& os) const OVERRIDE; // NOLINT
827 827
828 DEFINE_CALL_INTERFACE_DESCRIPTOR(CallFunctionWithFeedback); 828 DEFINE_CALL_INTERFACE_DESCRIPTOR(CallFunctionWithFeedback);
829 DEFINE_PLATFORM_CODE_STUB(CallIC, PlatformCodeStub); 829 DEFINE_PLATFORM_CODE_STUB(CallIC, PlatformCodeStub);
830 }; 830 };
831 831
832 832
833 class CallIC_ArrayStub: public CallICStub { 833 class CallIC_ArrayStub: public CallICStub {
834 public: 834 public:
835 CallIC_ArrayStub(Isolate* isolate, const CallICState& state_in) 835 CallIC_ArrayStub(Isolate* isolate, const CallICState& state_in)
836 : CallICStub(isolate, state_in) {} 836 : CallICStub(isolate, state_in) {}
837 837
838 virtual InlineCacheState GetICState() const FINAL OVERRIDE { 838 virtual InlineCacheState GetICState() const FINAL OVERRIDE {
839 return MONOMORPHIC; 839 return MONOMORPHIC;
840 } 840 }
841 841
842 private: 842 private:
843 virtual void PrintState(OStream& os) const OVERRIDE; // NOLINT 843 virtual void PrintState(std::ostream& os) const OVERRIDE; // NOLINT
844 844
845 DEFINE_PLATFORM_CODE_STUB(CallIC_Array, CallICStub); 845 DEFINE_PLATFORM_CODE_STUB(CallIC_Array, CallICStub);
846 }; 846 };
847 847
848 848
849 // TODO(verwaest): Translate to hydrogen code stub. 849 // TODO(verwaest): Translate to hydrogen code stub.
850 class FunctionPrototypeStub : public PlatformCodeStub { 850 class FunctionPrototypeStub : public PlatformCodeStub {
851 public: 851 public:
852 explicit FunctionPrototypeStub(Isolate* isolate) 852 explicit FunctionPrototypeStub(Isolate* isolate)
853 : PlatformCodeStub(isolate) {} 853 : PlatformCodeStub(isolate) {}
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after
1155 } 1155 }
1156 1156
1157 virtual ExtraICState GetExtraICState() const FINAL OVERRIDE { 1157 virtual ExtraICState GetExtraICState() const FINAL OVERRIDE {
1158 return static_cast<ExtraICState>(sub_minor_key()); 1158 return static_cast<ExtraICState>(sub_minor_key());
1159 } 1159 }
1160 1160
1161 BinaryOpICState state() const { 1161 BinaryOpICState state() const {
1162 return BinaryOpICState(isolate(), GetExtraICState()); 1162 return BinaryOpICState(isolate(), GetExtraICState());
1163 } 1163 }
1164 1164
1165 virtual void PrintState(OStream& os) const FINAL OVERRIDE; // NOLINT 1165 virtual void PrintState(std::ostream& os) const FINAL OVERRIDE; // NOLINT
1166 1166
1167 // Parameters accessed via CodeStubGraphBuilder::GetParameter() 1167 // Parameters accessed via CodeStubGraphBuilder::GetParameter()
1168 static const int kLeft = 0; 1168 static const int kLeft = 0;
1169 static const int kRight = 1; 1169 static const int kRight = 1;
1170 1170
1171 private: 1171 private:
1172 static void GenerateAheadOfTime(Isolate* isolate, 1172 static void GenerateAheadOfTime(Isolate* isolate,
1173 const BinaryOpICState& state); 1173 const BinaryOpICState& state);
1174 1174
1175 DEFINE_CALL_INTERFACE_DESCRIPTOR(BinaryOp); 1175 DEFINE_CALL_INTERFACE_DESCRIPTOR(BinaryOp);
(...skipping 24 matching lines...) Expand all
1200 } 1200 }
1201 1201
1202 virtual InlineCacheState GetICState() const OVERRIDE { 1202 virtual InlineCacheState GetICState() const OVERRIDE {
1203 return state().GetICState(); 1203 return state().GetICState();
1204 } 1204 }
1205 1205
1206 virtual ExtraICState GetExtraICState() const OVERRIDE { 1206 virtual ExtraICState GetExtraICState() const OVERRIDE {
1207 return static_cast<ExtraICState>(minor_key_); 1207 return static_cast<ExtraICState>(minor_key_);
1208 } 1208 }
1209 1209
1210 virtual void PrintState(OStream& os) const OVERRIDE; // NOLINT 1210 virtual void PrintState(std::ostream& os) const OVERRIDE; // NOLINT
1211 1211
1212 private: 1212 private:
1213 BinaryOpICState state() const { 1213 BinaryOpICState state() const {
1214 return BinaryOpICState(isolate(), static_cast<ExtraICState>(minor_key_)); 1214 return BinaryOpICState(isolate(), static_cast<ExtraICState>(minor_key_));
1215 } 1215 }
1216 1216
1217 static void GenerateAheadOfTime(Isolate* isolate, 1217 static void GenerateAheadOfTime(Isolate* isolate,
1218 const BinaryOpICState& state); 1218 const BinaryOpICState& state);
1219 1219
1220 DEFINE_CALL_INTERFACE_DESCRIPTOR(BinaryOpWithAllocationSite); 1220 DEFINE_CALL_INTERFACE_DESCRIPTOR(BinaryOpWithAllocationSite);
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
1276 } 1276 }
1277 1277
1278 // Parameters accessed via CodeStubGraphBuilder::GetParameter() 1278 // Parameters accessed via CodeStubGraphBuilder::GetParameter()
1279 static const int kLeft = 0; 1279 static const int kLeft = 0;
1280 static const int kRight = 1; 1280 static const int kRight = 1;
1281 1281
1282 private: 1282 private:
1283 class StringAddFlagsBits: public BitField<StringAddFlags, 0, 2> {}; 1283 class StringAddFlagsBits: public BitField<StringAddFlags, 0, 2> {};
1284 class PretenureFlagBits: public BitField<PretenureFlag, 2, 1> {}; 1284 class PretenureFlagBits: public BitField<PretenureFlag, 2, 1> {};
1285 1285
1286 virtual void PrintBaseName(OStream& os) const OVERRIDE; // NOLINT 1286 virtual void PrintBaseName(std::ostream& os) const OVERRIDE; // NOLINT
1287 1287
1288 DEFINE_CALL_INTERFACE_DESCRIPTOR(StringAdd); 1288 DEFINE_CALL_INTERFACE_DESCRIPTOR(StringAdd);
1289 DEFINE_HYDROGEN_CODE_STUB(StringAdd, HydrogenCodeStub); 1289 DEFINE_HYDROGEN_CODE_STUB(StringAdd, HydrogenCodeStub);
1290 }; 1290 };
1291 1291
1292 1292
1293 class CompareICStub : public PlatformCodeStub { 1293 class CompareICStub : public PlatformCodeStub {
1294 public: 1294 public:
1295 CompareICStub(Isolate* isolate, Token::Value op, CompareICState::State left, 1295 CompareICStub(Isolate* isolate, Token::Value op, CompareICState::State left,
1296 CompareICState::State right, CompareICState::State state) 1296 CompareICState::State right, CompareICState::State state)
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
1388 void UpdateStatus(Handle<Object> object); 1388 void UpdateStatus(Handle<Object> object);
1389 1389
1390 bool IsMonomorphic() const { return state().Contains(MONOMORPHIC_MAP); } 1390 bool IsMonomorphic() const { return state().Contains(MONOMORPHIC_MAP); }
1391 1391
1392 NilValue nil_value() const { return NilValueBits::decode(sub_minor_key()); } 1392 NilValue nil_value() const { return NilValueBits::decode(sub_minor_key()); }
1393 1393
1394 void ClearState() { 1394 void ClearState() {
1395 set_sub_minor_key(TypesBits::update(sub_minor_key(), 0)); 1395 set_sub_minor_key(TypesBits::update(sub_minor_key(), 0));
1396 } 1396 }
1397 1397
1398 virtual void PrintState(OStream& os) const OVERRIDE; // NOLINT 1398 virtual void PrintState(std::ostream& os) const OVERRIDE; // NOLINT
1399 virtual void PrintBaseName(OStream& os) const OVERRIDE; // NOLINT 1399 virtual void PrintBaseName(std::ostream& os) const OVERRIDE; // NOLINT
1400 1400
1401 private: 1401 private:
1402 CompareNilICStub(Isolate* isolate, NilValue nil, 1402 CompareNilICStub(Isolate* isolate, NilValue nil,
1403 InitializationState init_state) 1403 InitializationState init_state)
1404 : HydrogenCodeStub(isolate, init_state) { 1404 : HydrogenCodeStub(isolate, init_state) {
1405 set_sub_minor_key(NilValueBits::encode(nil)); 1405 set_sub_minor_key(NilValueBits::encode(nil));
1406 } 1406 }
1407 1407
1408 enum CompareNilType { 1408 enum CompareNilType {
1409 UNDEFINED, 1409 UNDEFINED,
1410 NULL_TYPE, 1410 NULL_TYPE,
1411 MONOMORPHIC_MAP, 1411 MONOMORPHIC_MAP,
1412 GENERIC, 1412 GENERIC,
1413 NUMBER_OF_TYPES 1413 NUMBER_OF_TYPES
1414 }; 1414 };
1415 1415
1416 // At most 6 different types can be distinguished, because the Code object 1416 // At most 6 different types can be distinguished, because the Code object
1417 // only has room for a single byte to hold a set and there are two more 1417 // only has room for a single byte to hold a set and there are two more
1418 // boolean flags we need to store. :-P 1418 // boolean flags we need to store. :-P
1419 STATIC_ASSERT(NUMBER_OF_TYPES <= 6); 1419 STATIC_ASSERT(NUMBER_OF_TYPES <= 6);
1420 1420
1421 class State : public EnumSet<CompareNilType, byte> { 1421 class State : public EnumSet<CompareNilType, byte> {
1422 public: 1422 public:
1423 State() : EnumSet<CompareNilType, byte>(0) { } 1423 State() : EnumSet<CompareNilType, byte>(0) { }
1424 explicit State(byte bits) : EnumSet<CompareNilType, byte>(bits) { } 1424 explicit State(byte bits) : EnumSet<CompareNilType, byte>(bits) { }
1425 }; 1425 };
1426 friend OStream& operator<<(OStream& os, const State& s); 1426 friend std::ostream& operator<<(std::ostream& os, const State& s);
1427 1427
1428 State state() const { return State(TypesBits::decode(sub_minor_key())); } 1428 State state() const { return State(TypesBits::decode(sub_minor_key())); }
1429 1429
1430 class NilValueBits : public BitField<NilValue, 0, 1> {}; 1430 class NilValueBits : public BitField<NilValue, 0, 1> {};
1431 class TypesBits : public BitField<byte, 1, NUMBER_OF_TYPES> {}; 1431 class TypesBits : public BitField<byte, 1, NUMBER_OF_TYPES> {};
1432 1432
1433 friend class CompareNilIC; 1433 friend class CompareNilIC;
1434 1434
1435 DEFINE_CALL_INTERFACE_DESCRIPTOR(CompareNil); 1435 DEFINE_CALL_INTERFACE_DESCRIPTOR(CompareNil);
1436 DEFINE_HYDROGEN_CODE_STUB(CompareNilIC, HydrogenCodeStub); 1436 DEFINE_HYDROGEN_CODE_STUB(CompareNilIC, HydrogenCodeStub);
1437 }; 1437 };
1438 1438
1439 1439
1440 OStream& operator<<(OStream& os, const CompareNilICStub::State& s); 1440 std::ostream& operator<<(std::ostream& os, const CompareNilICStub::State& s);
1441 1441
1442 1442
1443 class CEntryStub : public PlatformCodeStub { 1443 class CEntryStub : public PlatformCodeStub {
1444 public: 1444 public:
1445 CEntryStub(Isolate* isolate, int result_size, 1445 CEntryStub(Isolate* isolate, int result_size,
1446 SaveFPRegsMode save_doubles = kDontSaveFPRegs) 1446 SaveFPRegsMode save_doubles = kDontSaveFPRegs)
1447 : PlatformCodeStub(isolate) { 1447 : PlatformCodeStub(isolate) {
1448 minor_key_ = SaveDoublesBits::encode(save_doubles == kSaveFPRegs); 1448 minor_key_ = SaveDoublesBits::encode(save_doubles == kSaveFPRegs);
1449 DCHECK(result_size == 1 || result_size == 2); 1449 DCHECK(result_size == 1 || result_size == 2);
1450 #ifdef _WIN64 1450 #ifdef _WIN64
(...skipping 27 matching lines...) Expand all
1478 public: 1478 public:
1479 JSEntryStub(Isolate* isolate, StackFrame::Type type) 1479 JSEntryStub(Isolate* isolate, StackFrame::Type type)
1480 : PlatformCodeStub(isolate) { 1480 : PlatformCodeStub(isolate) {
1481 DCHECK(type == StackFrame::ENTRY || type == StackFrame::ENTRY_CONSTRUCT); 1481 DCHECK(type == StackFrame::ENTRY || type == StackFrame::ENTRY_CONSTRUCT);
1482 minor_key_ = StackFrameTypeBits::encode(type); 1482 minor_key_ = StackFrameTypeBits::encode(type);
1483 } 1483 }
1484 1484
1485 private: 1485 private:
1486 virtual void FinishCode(Handle<Code> code); 1486 virtual void FinishCode(Handle<Code> code);
1487 1487
1488 virtual void PrintName(OStream& os) const OVERRIDE { // NOLINT 1488 virtual void PrintName(std::ostream& os) const OVERRIDE { // NOLINT
1489 os << (type() == StackFrame::ENTRY ? "JSEntryStub" 1489 os << (type() == StackFrame::ENTRY ? "JSEntryStub"
1490 : "JSConstructEntryStub"); 1490 : "JSConstructEntryStub");
1491 } 1491 }
1492 1492
1493 StackFrame::Type type() const { 1493 StackFrame::Type type() const {
1494 return StackFrameTypeBits::decode(minor_key_); 1494 return StackFrameTypeBits::decode(minor_key_);
1495 } 1495 }
1496 1496
1497 class StackFrameTypeBits : public BitField<StackFrame::Type, 0, 5> {}; 1497 class StackFrameTypeBits : public BitField<StackFrame::Type, 0, 5> {};
1498 1498
(...skipping 25 matching lines...) Expand all
1524 } 1524 }
1525 1525
1526 private: 1526 private:
1527 Type type() const { return TypeBits::decode(minor_key_); } 1527 Type type() const { return TypeBits::decode(minor_key_); }
1528 1528
1529 void GenerateReadElement(MacroAssembler* masm); 1529 void GenerateReadElement(MacroAssembler* masm);
1530 void GenerateNewStrict(MacroAssembler* masm); 1530 void GenerateNewStrict(MacroAssembler* masm);
1531 void GenerateNewSloppyFast(MacroAssembler* masm); 1531 void GenerateNewSloppyFast(MacroAssembler* masm);
1532 void GenerateNewSloppySlow(MacroAssembler* masm); 1532 void GenerateNewSloppySlow(MacroAssembler* masm);
1533 1533
1534 virtual void PrintName(OStream& os) const OVERRIDE; // NOLINT 1534 virtual void PrintName(std::ostream& os) const OVERRIDE; // NOLINT
1535 1535
1536 class TypeBits : public BitField<Type, 0, 2> {}; 1536 class TypeBits : public BitField<Type, 0, 2> {};
1537 1537
1538 DEFINE_PLATFORM_CODE_STUB(ArgumentsAccess, PlatformCodeStub); 1538 DEFINE_PLATFORM_CODE_STUB(ArgumentsAccess, PlatformCodeStub);
1539 }; 1539 };
1540 1540
1541 1541
1542 class RegExpExecStub: public PlatformCodeStub { 1542 class RegExpExecStub: public PlatformCodeStub {
1543 public: 1543 public:
1544 explicit RegExpExecStub(Isolate* isolate) : PlatformCodeStub(isolate) { } 1544 explicit RegExpExecStub(Isolate* isolate) : PlatformCodeStub(isolate) { }
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
1578 private: 1578 private:
1579 int argc() const { return ArgcBits::decode(minor_key_); } 1579 int argc() const { return ArgcBits::decode(minor_key_); }
1580 int flags() const { return FlagBits::decode(minor_key_); } 1580 int flags() const { return FlagBits::decode(minor_key_); }
1581 1581
1582 bool CallAsMethod() const { 1582 bool CallAsMethod() const {
1583 return flags() == CALL_AS_METHOD || flags() == WRAP_AND_CALL; 1583 return flags() == CALL_AS_METHOD || flags() == WRAP_AND_CALL;
1584 } 1584 }
1585 1585
1586 bool NeedsChecks() const { return flags() != WRAP_AND_CALL; } 1586 bool NeedsChecks() const { return flags() != WRAP_AND_CALL; }
1587 1587
1588 virtual void PrintName(OStream& os) const OVERRIDE; // NOLINT 1588 virtual void PrintName(std::ostream& os) const OVERRIDE; // NOLINT
1589 1589
1590 // Minor key encoding in 32 bits with Bitfield <Type, shift, size>. 1590 // Minor key encoding in 32 bits with Bitfield <Type, shift, size>.
1591 class FlagBits : public BitField<CallFunctionFlags, 0, 2> {}; 1591 class FlagBits : public BitField<CallFunctionFlags, 0, 2> {};
1592 class ArgcBits : public BitField<unsigned, 2, Code::kArgumentsBits> {}; 1592 class ArgcBits : public BitField<unsigned, 2, Code::kArgumentsBits> {};
1593 STATIC_ASSERT(Code::kArgumentsBits + 2 <= kStubMinorKeyBits); 1593 STATIC_ASSERT(Code::kArgumentsBits + 2 <= kStubMinorKeyBits);
1594 1594
1595 DEFINE_CALL_INTERFACE_DESCRIPTOR(CallFunction); 1595 DEFINE_CALL_INTERFACE_DESCRIPTOR(CallFunction);
1596 DEFINE_PLATFORM_CODE_STUB(CallFunction, PlatformCodeStub); 1596 DEFINE_PLATFORM_CODE_STUB(CallFunction, PlatformCodeStub);
1597 }; 1597 };
1598 1598
1599 1599
1600 class CallConstructStub: public PlatformCodeStub { 1600 class CallConstructStub: public PlatformCodeStub {
1601 public: 1601 public:
1602 CallConstructStub(Isolate* isolate, CallConstructorFlags flags) 1602 CallConstructStub(Isolate* isolate, CallConstructorFlags flags)
1603 : PlatformCodeStub(isolate) { 1603 : PlatformCodeStub(isolate) {
1604 minor_key_ = FlagBits::encode(flags); 1604 minor_key_ = FlagBits::encode(flags);
1605 } 1605 }
1606 1606
1607 virtual void FinishCode(Handle<Code> code) { 1607 virtual void FinishCode(Handle<Code> code) {
1608 code->set_has_function_cache(RecordCallTarget()); 1608 code->set_has_function_cache(RecordCallTarget());
1609 } 1609 }
1610 1610
1611 private: 1611 private:
1612 CallConstructorFlags flags() const { return FlagBits::decode(minor_key_); } 1612 CallConstructorFlags flags() const { return FlagBits::decode(minor_key_); }
1613 1613
1614 bool RecordCallTarget() const { 1614 bool RecordCallTarget() const {
1615 return (flags() & RECORD_CONSTRUCTOR_TARGET) != 0; 1615 return (flags() & RECORD_CONSTRUCTOR_TARGET) != 0;
1616 } 1616 }
1617 1617
1618 virtual void PrintName(OStream& os) const OVERRIDE; // NOLINT 1618 virtual void PrintName(std::ostream& os) const OVERRIDE; // NOLINT
1619 1619
1620 class FlagBits : public BitField<CallConstructorFlags, 0, 1> {}; 1620 class FlagBits : public BitField<CallConstructorFlags, 0, 1> {};
1621 1621
1622 DEFINE_CALL_INTERFACE_DESCRIPTOR(CallConstruct); 1622 DEFINE_CALL_INTERFACE_DESCRIPTOR(CallConstruct);
1623 DEFINE_PLATFORM_CODE_STUB(CallConstruct, PlatformCodeStub); 1623 DEFINE_PLATFORM_CODE_STUB(CallConstruct, PlatformCodeStub);
1624 }; 1624 };
1625 1625
1626 1626
1627 enum StringIndexFlags { 1627 enum StringIndexFlags {
1628 // Accepts smis or heap numbers. 1628 // Accepts smis or heap numbers.
(...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after
2074 return AllocationSiteOverrideModeBits::decode(sub_minor_key()); 2074 return AllocationSiteOverrideModeBits::decode(sub_minor_key());
2075 } 2075 }
2076 2076
2077 static void GenerateStubsAheadOfTime(Isolate* isolate); 2077 static void GenerateStubsAheadOfTime(Isolate* isolate);
2078 2078
2079 // Parameters accessed via CodeStubGraphBuilder::GetParameter() 2079 // Parameters accessed via CodeStubGraphBuilder::GetParameter()
2080 static const int kConstructor = 0; 2080 static const int kConstructor = 0;
2081 static const int kAllocationSite = 1; 2081 static const int kAllocationSite = 1;
2082 2082
2083 protected: 2083 protected:
2084 OStream& BasePrintName(OStream& os, const char* name) const; // NOLINT 2084 std::ostream& BasePrintName(std::ostream& os,
2085 const char* name) const; // NOLINT
2085 2086
2086 private: 2087 private:
2087 // Ensure data fits within available bits. 2088 // Ensure data fits within available bits.
2088 STATIC_ASSERT(LAST_ALLOCATION_SITE_OVERRIDE_MODE == 1); 2089 STATIC_ASSERT(LAST_ALLOCATION_SITE_OVERRIDE_MODE == 1);
2089 2090
2090 class ElementsKindBits: public BitField<ElementsKind, 0, 8> {}; 2091 class ElementsKindBits: public BitField<ElementsKind, 0, 8> {};
2091 class AllocationSiteOverrideModeBits: public 2092 class AllocationSiteOverrideModeBits: public
2092 BitField<AllocationSiteOverrideMode, 8, 1> {}; // NOLINT 2093 BitField<AllocationSiteOverrideMode, 8, 1> {}; // NOLINT
2093 2094
2094 DEFINE_CODE_STUB_BASE(ArrayConstructorStubBase, HydrogenCodeStub); 2095 DEFINE_CODE_STUB_BASE(ArrayConstructorStubBase, HydrogenCodeStub);
2095 }; 2096 };
2096 2097
2097 2098
2098 class ArrayNoArgumentConstructorStub : public ArrayConstructorStubBase { 2099 class ArrayNoArgumentConstructorStub : public ArrayConstructorStubBase {
2099 public: 2100 public:
2100 ArrayNoArgumentConstructorStub( 2101 ArrayNoArgumentConstructorStub(
2101 Isolate* isolate, 2102 Isolate* isolate,
2102 ElementsKind kind, 2103 ElementsKind kind,
2103 AllocationSiteOverrideMode override_mode = DONT_OVERRIDE) 2104 AllocationSiteOverrideMode override_mode = DONT_OVERRIDE)
2104 : ArrayConstructorStubBase(isolate, kind, override_mode) { 2105 : ArrayConstructorStubBase(isolate, kind, override_mode) {
2105 } 2106 }
2106 2107
2107 private: 2108 private:
2108 virtual void PrintName(OStream& os) const OVERRIDE { // NOLINT 2109 virtual void PrintName(std::ostream& os) const OVERRIDE { // NOLINT
2109 BasePrintName(os, "ArrayNoArgumentConstructorStub"); 2110 BasePrintName(os, "ArrayNoArgumentConstructorStub");
2110 } 2111 }
2111 2112
2112 DEFINE_CALL_INTERFACE_DESCRIPTOR(ArrayConstructorConstantArgCount); 2113 DEFINE_CALL_INTERFACE_DESCRIPTOR(ArrayConstructorConstantArgCount);
2113 DEFINE_HYDROGEN_CODE_STUB(ArrayNoArgumentConstructor, 2114 DEFINE_HYDROGEN_CODE_STUB(ArrayNoArgumentConstructor,
2114 ArrayConstructorStubBase); 2115 ArrayConstructorStubBase);
2115 }; 2116 };
2116 2117
2117 2118
2118 class ArraySingleArgumentConstructorStub : public ArrayConstructorStubBase { 2119 class ArraySingleArgumentConstructorStub : public ArrayConstructorStubBase {
2119 public: 2120 public:
2120 ArraySingleArgumentConstructorStub( 2121 ArraySingleArgumentConstructorStub(
2121 Isolate* isolate, 2122 Isolate* isolate,
2122 ElementsKind kind, 2123 ElementsKind kind,
2123 AllocationSiteOverrideMode override_mode = DONT_OVERRIDE) 2124 AllocationSiteOverrideMode override_mode = DONT_OVERRIDE)
2124 : ArrayConstructorStubBase(isolate, kind, override_mode) { 2125 : ArrayConstructorStubBase(isolate, kind, override_mode) {
2125 } 2126 }
2126 2127
2127 private: 2128 private:
2128 virtual void PrintName(OStream& os) const { // NOLINT 2129 virtual void PrintName(std::ostream& os) const { // NOLINT
2129 BasePrintName(os, "ArraySingleArgumentConstructorStub"); 2130 BasePrintName(os, "ArraySingleArgumentConstructorStub");
2130 } 2131 }
2131 2132
2132 DEFINE_CALL_INTERFACE_DESCRIPTOR(ArrayConstructor); 2133 DEFINE_CALL_INTERFACE_DESCRIPTOR(ArrayConstructor);
2133 DEFINE_HYDROGEN_CODE_STUB(ArraySingleArgumentConstructor, 2134 DEFINE_HYDROGEN_CODE_STUB(ArraySingleArgumentConstructor,
2134 ArrayConstructorStubBase); 2135 ArrayConstructorStubBase);
2135 }; 2136 };
2136 2137
2137 2138
2138 class ArrayNArgumentsConstructorStub : public ArrayConstructorStubBase { 2139 class ArrayNArgumentsConstructorStub : public ArrayConstructorStubBase {
2139 public: 2140 public:
2140 ArrayNArgumentsConstructorStub( 2141 ArrayNArgumentsConstructorStub(
2141 Isolate* isolate, 2142 Isolate* isolate,
2142 ElementsKind kind, 2143 ElementsKind kind,
2143 AllocationSiteOverrideMode override_mode = DONT_OVERRIDE) 2144 AllocationSiteOverrideMode override_mode = DONT_OVERRIDE)
2144 : ArrayConstructorStubBase(isolate, kind, override_mode) { 2145 : ArrayConstructorStubBase(isolate, kind, override_mode) {
2145 } 2146 }
2146 2147
2147 private: 2148 private:
2148 virtual void PrintName(OStream& os) const { // NOLINT 2149 virtual void PrintName(std::ostream& os) const { // NOLINT
2149 BasePrintName(os, "ArrayNArgumentsConstructorStub"); 2150 BasePrintName(os, "ArrayNArgumentsConstructorStub");
2150 } 2151 }
2151 2152
2152 DEFINE_CALL_INTERFACE_DESCRIPTOR(ArrayConstructor); 2153 DEFINE_CALL_INTERFACE_DESCRIPTOR(ArrayConstructor);
2153 DEFINE_HYDROGEN_CODE_STUB(ArrayNArgumentsConstructor, 2154 DEFINE_HYDROGEN_CODE_STUB(ArrayNArgumentsConstructor,
2154 ArrayConstructorStubBase); 2155 ArrayConstructorStubBase);
2155 }; 2156 };
2156 2157
2157 2158
2158 class InternalArrayConstructorStubBase : public HydrogenCodeStub { 2159 class InternalArrayConstructorStubBase : public HydrogenCodeStub {
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
2283 : HydrogenCodeStub(isolate) { 2284 : HydrogenCodeStub(isolate) {
2284 set_sub_minor_key(TypesBits::encode(static_cast<byte>(state)) | 2285 set_sub_minor_key(TypesBits::encode(static_cast<byte>(state)) |
2285 ResultModeBits::encode(RESULT_AS_SMI)); 2286 ResultModeBits::encode(RESULT_AS_SMI));
2286 } 2287 }
2287 2288
2288 bool UpdateStatus(Handle<Object> object); 2289 bool UpdateStatus(Handle<Object> object);
2289 Types types() const { return Types(TypesBits::decode(sub_minor_key())); } 2290 Types types() const { return Types(TypesBits::decode(sub_minor_key())); }
2290 ResultMode mode() const { return ResultModeBits::decode(sub_minor_key()); } 2291 ResultMode mode() const { return ResultModeBits::decode(sub_minor_key()); }
2291 2292
2292 virtual Code::Kind GetCodeKind() const { return Code::TO_BOOLEAN_IC; } 2293 virtual Code::Kind GetCodeKind() const { return Code::TO_BOOLEAN_IC; }
2293 virtual void PrintState(OStream& os) const OVERRIDE; // NOLINT 2294 virtual void PrintState(std::ostream& os) const OVERRIDE; // NOLINT
2294 2295
2295 virtual bool SometimesSetsUpAFrame() { return false; } 2296 virtual bool SometimesSetsUpAFrame() { return false; }
2296 2297
2297 static Handle<Code> GetUninitialized(Isolate* isolate) { 2298 static Handle<Code> GetUninitialized(Isolate* isolate) {
2298 return ToBooleanStub(isolate, UNINITIALIZED).GetCode(); 2299 return ToBooleanStub(isolate, UNINITIALIZED).GetCode();
2299 } 2300 }
2300 2301
2301 virtual ExtraICState GetExtraICState() const { return types().ToIntegral(); } 2302 virtual ExtraICState GetExtraICState() const { return types().ToIntegral(); }
2302 2303
2303 virtual InlineCacheState GetICState() const { 2304 virtual InlineCacheState GetICState() const {
(...skipping 11 matching lines...) Expand all
2315 } 2316 }
2316 2317
2317 class TypesBits : public BitField<byte, 0, NUMBER_OF_TYPES> {}; 2318 class TypesBits : public BitField<byte, 0, NUMBER_OF_TYPES> {};
2318 class ResultModeBits : public BitField<ResultMode, NUMBER_OF_TYPES, 2> {}; 2319 class ResultModeBits : public BitField<ResultMode, NUMBER_OF_TYPES, 2> {};
2319 2320
2320 DEFINE_CALL_INTERFACE_DESCRIPTOR(ToBoolean); 2321 DEFINE_CALL_INTERFACE_DESCRIPTOR(ToBoolean);
2321 DEFINE_HYDROGEN_CODE_STUB(ToBoolean, HydrogenCodeStub); 2322 DEFINE_HYDROGEN_CODE_STUB(ToBoolean, HydrogenCodeStub);
2322 }; 2323 };
2323 2324
2324 2325
2325 OStream& operator<<(OStream& os, const ToBooleanStub::Types& t); 2326 std::ostream& operator<<(std::ostream& os, const ToBooleanStub::Types& t);
2326 2327
2327 2328
2328 class ElementsTransitionAndStoreStub : public HydrogenCodeStub { 2329 class ElementsTransitionAndStoreStub : public HydrogenCodeStub {
2329 public: 2330 public:
2330 ElementsTransitionAndStoreStub(Isolate* isolate, ElementsKind from_kind, 2331 ElementsTransitionAndStoreStub(Isolate* isolate, ElementsKind from_kind,
2331 ElementsKind to_kind, bool is_jsarray, 2332 ElementsKind to_kind, bool is_jsarray,
2332 KeyedAccessStoreMode store_mode) 2333 KeyedAccessStoreMode store_mode)
2333 : HydrogenCodeStub(isolate) { 2334 : HydrogenCodeStub(isolate) {
2334 set_sub_minor_key(FromBits::encode(from_kind) | ToBits::encode(to_kind) | 2335 set_sub_minor_key(FromBits::encode(from_kind) | ToBits::encode(to_kind) |
2335 IsJSArrayBits::encode(is_jsarray) | 2336 IsJSArrayBits::encode(is_jsarray) |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
2469 2470
2470 #undef DEFINE_CALL_INTERFACE_DESCRIPTOR 2471 #undef DEFINE_CALL_INTERFACE_DESCRIPTOR
2471 #undef DEFINE_PLATFORM_CODE_STUB 2472 #undef DEFINE_PLATFORM_CODE_STUB
2472 #undef DEFINE_HANDLER_CODE_STUB 2473 #undef DEFINE_HANDLER_CODE_STUB
2473 #undef DEFINE_HYDROGEN_CODE_STUB 2474 #undef DEFINE_HYDROGEN_CODE_STUB
2474 #undef DEFINE_CODE_STUB 2475 #undef DEFINE_CODE_STUB
2475 #undef DEFINE_CODE_STUB_BASE 2476 #undef DEFINE_CODE_STUB_BASE
2476 } } // namespace v8::internal 2477 } } // namespace v8::internal
2477 2478
2478 #endif // V8_CODE_STUBS_H_ 2479 #endif // V8_CODE_STUBS_H_
OLDNEW
« no previous file with comments | « src/basic-block-profiler.cc ('k') | src/code-stubs.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698