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

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

Issue 22715004: Version 3.20.15 (Closed) Base URL: https://v8.googlecode.com/svn/trunk
Patch Set: Add TypedArray API and correctness patches r16033 and r16084 Created 7 years, 4 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.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 22 matching lines...) Expand all
33 #include "globals.h" 33 #include "globals.h"
34 #include "codegen.h" 34 #include "codegen.h"
35 35
36 namespace v8 { 36 namespace v8 {
37 namespace internal { 37 namespace internal {
38 38
39 // List of code stubs used on all platforms. 39 // List of code stubs used on all platforms.
40 #define CODE_STUB_LIST_ALL_PLATFORMS(V) \ 40 #define CODE_STUB_LIST_ALL_PLATFORMS(V) \
41 V(CallFunction) \ 41 V(CallFunction) \
42 V(CallConstruct) \ 42 V(CallConstruct) \
43 V(UnaryOp) \
43 V(BinaryOp) \ 44 V(BinaryOp) \
44 V(StringAdd) \ 45 V(StringAdd) \
45 V(SubString) \ 46 V(SubString) \
46 V(StringCompare) \ 47 V(StringCompare) \
47 V(Compare) \ 48 V(Compare) \
48 V(CompareIC) \ 49 V(CompareIC) \
49 V(CompareNilIC) \ 50 V(CompareNilIC) \
50 V(MathPow) \ 51 V(MathPow) \
51 V(StringLength) \ 52 V(StringLength) \
52 V(FunctionPrototype) \ 53 V(FunctionPrototype) \
(...skipping 532 matching lines...) Expand 10 before | Expand all | Expand 10 after
585 class StrictModeBits: public BitField<StrictModeFlag, 0, 1> {}; 586 class StrictModeBits: public BitField<StrictModeFlag, 0, 1> {};
586 class IsConstantBits: public BitField<bool, 1, 1> {}; 587 class IsConstantBits: public BitField<bool, 1, 1> {};
587 class RepresentationBits: public BitField<Representation::Kind, 2, 8> {}; 588 class RepresentationBits: public BitField<Representation::Kind, 2, 8> {};
588 589
589 int bit_field_; 590 int bit_field_;
590 591
591 DISALLOW_COPY_AND_ASSIGN(StoreGlobalStub); 592 DISALLOW_COPY_AND_ASSIGN(StoreGlobalStub);
592 }; 593 };
593 594
594 595
596 class UnaryOpStub : public HydrogenCodeStub {
597 public:
598 // Stub without type info available -> construct uninitialized
599 explicit UnaryOpStub(Token::Value operation)
600 : HydrogenCodeStub(UNINITIALIZED), operation_(operation) { }
601 explicit UnaryOpStub(Code::ExtraICState ic_state) :
602 state_(StateBits::decode(ic_state)),
603 operation_(OperatorBits::decode(ic_state)) { }
604
605 virtual void InitializeInterfaceDescriptor(
606 Isolate* isolate,
607 CodeStubInterfaceDescriptor* descriptor);
608
609 virtual Code::Kind GetCodeKind() const { return Code::UNARY_OP_IC; }
610 virtual InlineCacheState GetICState() {
611 if (state_.Contains(GENERIC)) {
612 return MEGAMORPHIC;
613 } else if (state_.IsEmpty()) {
614 return PREMONOMORPHIC;
615 } else {
616 return MONOMORPHIC;
617 }
618 }
619 virtual Code::ExtraICState GetExtraICState() {
620 return OperatorBits::encode(operation_) |
621 StateBits::encode(state_.ToIntegral());
622 }
623
624 Token::Value operation() { return operation_; }
625 Handle<JSFunction> ToJSFunction(Isolate* isolate);
626 Builtins::JavaScript ToJSBuiltin();
627
628 void UpdateStatus(Handle<Object> object);
629 MaybeObject* Result(Handle<Object> object, Isolate* isolate);
630 Handle<Code> GenerateCode();
631 Handle<Type> GetType(Isolate* isolate);
632
633 protected:
634 void PrintState(StringStream* stream);
635 void PrintBaseName(StringStream* stream);
636
637 private:
638 enum UnaryOpType {
639 SMI,
640 HEAP_NUMBER,
641 GENERIC,
642 NUMBER_OF_TYPES
643 };
644
645 class State : public EnumSet<UnaryOpType, byte> {
646 public:
647 State() : EnumSet<UnaryOpType, byte>() { }
648 explicit State(byte bits) : EnumSet<UnaryOpType, byte>(bits) { }
649 void Print(StringStream* stream) const;
650 };
651
652 class StateBits : public BitField<int, 0, NUMBER_OF_TYPES> { };
653 class OperatorBits : public BitField<Token::Value, NUMBER_OF_TYPES, 8> { };
654
655 State state_;
656 Token::Value operation_;
657
658 virtual CodeStub::Major MajorKey() { return UnaryOp; }
659 virtual int NotMissMinorKey() { return GetExtraICState(); }
660 };
661
662
595 class FastCloneShallowArrayStub : public HydrogenCodeStub { 663 class FastCloneShallowArrayStub : public HydrogenCodeStub {
596 public: 664 public:
597 // Maximum length of copied elements array. 665 // Maximum length of copied elements array.
598 static const int kMaximumClonedLength = 8; 666 static const int kMaximumClonedLength = 8;
599 enum Mode { 667 enum Mode {
600 CLONE_ELEMENTS, 668 CLONE_ELEMENTS,
601 CLONE_DOUBLE_ELEMENTS, 669 CLONE_DOUBLE_ELEMENTS,
602 COPY_ON_WRITE_ELEMENTS, 670 COPY_ON_WRITE_ELEMENTS,
603 CLONE_ANY_ELEMENTS, 671 CLONE_ANY_ELEMENTS,
604 LAST_CLONE_MODE = CLONE_ANY_ELEMENTS 672 LAST_CLONE_MODE = CLONE_ANY_ELEMENTS
(...skipping 1702 matching lines...) Expand 10 before | Expand all | Expand 10 after
2307 int MinorKey() { return 0; } 2375 int MinorKey() { return 0; }
2308 2376
2309 void Generate(MacroAssembler* masm); 2377 void Generate(MacroAssembler* masm);
2310 2378
2311 DISALLOW_COPY_AND_ASSIGN(ProfileEntryHookStub); 2379 DISALLOW_COPY_AND_ASSIGN(ProfileEntryHookStub);
2312 }; 2380 };
2313 2381
2314 } } // namespace v8::internal 2382 } } // namespace v8::internal
2315 2383
2316 #endif // V8_CODE_STUBS_H_ 2384 #endif // V8_CODE_STUBS_H_
OLDNEW
« no previous file with comments | « src/builtins.h ('k') | src/code-stubs.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698