| Index: src/code-stubs.h
|
| diff --git a/src/code-stubs.h b/src/code-stubs.h
|
| index a498222dcc15cd81d9f965381138c85be40bc3b8..3b31e8dbe7733afccd063e9e4eed94e71a9fa3da 100644
|
| --- a/src/code-stubs.h
|
| +++ b/src/code-stubs.h
|
| @@ -43,6 +43,7 @@ namespace internal {
|
| V(CallConstruct) \
|
| V(BinaryOp) \
|
| V(StringAdd) \
|
| + V(NewStringAdd) \
|
| V(SubString) \
|
| V(StringCompare) \
|
| V(Compare) \
|
| @@ -561,51 +562,6 @@ class FastNewBlockContextStub : public PlatformCodeStub {
|
| int MinorKey() { return slots_; }
|
| };
|
|
|
| -class StoreGlobalStub : public HydrogenCodeStub {
|
| - public:
|
| - StoreGlobalStub(StrictModeFlag strict_mode, bool is_constant) {
|
| - bit_field_ = StrictModeBits::encode(strict_mode) |
|
| - IsConstantBits::encode(is_constant);
|
| - }
|
| -
|
| - virtual Handle<Code> GenerateCode(Isolate* isolate);
|
| -
|
| - virtual void InitializeInterfaceDescriptor(
|
| - Isolate* isolate,
|
| - CodeStubInterfaceDescriptor* descriptor);
|
| -
|
| - virtual Code::Kind GetCodeKind() const { return Code::STORE_IC; }
|
| - virtual InlineCacheState GetICState() { return MONOMORPHIC; }
|
| - virtual Code::ExtraICState GetExtraICState() { return bit_field_; }
|
| -
|
| - bool is_constant() {
|
| - return IsConstantBits::decode(bit_field_);
|
| - }
|
| - void set_is_constant(bool value) {
|
| - bit_field_ = IsConstantBits::update(bit_field_, value);
|
| - }
|
| -
|
| - Representation representation() {
|
| - return Representation::FromKind(RepresentationBits::decode(bit_field_));
|
| - }
|
| - void set_representation(Representation r) {
|
| - bit_field_ = RepresentationBits::update(bit_field_, r.kind());
|
| - }
|
| -
|
| - private:
|
| - virtual int NotMissMinorKey() { return GetExtraICState(); }
|
| - Major MajorKey() { return StoreGlobal; }
|
| -
|
| - class StrictModeBits: public BitField<StrictModeFlag, 0, 1> {};
|
| - class IsConstantBits: public BitField<bool, 1, 1> {};
|
| - class RepresentationBits: public BitField<Representation::Kind, 2, 8> {};
|
| -
|
| - int bit_field_;
|
| -
|
| - DISALLOW_COPY_AND_ASSIGN(StoreGlobalStub);
|
| -};
|
| -
|
| -
|
| class FastCloneShallowArrayStub : public HydrogenCodeStub {
|
| public:
|
| // Maximum length of copied elements array.
|
| @@ -907,7 +863,6 @@ class HICStub: public HydrogenCodeStub {
|
| virtual InlineCacheState GetICState() { return MONOMORPHIC; }
|
|
|
| protected:
|
| - HICStub() { }
|
| class KindBits: public BitField<Code::Kind, 0, 4> {};
|
| virtual Code::Kind kind() const = 0;
|
| };
|
| @@ -917,16 +872,12 @@ class HandlerStub: public HICStub {
|
| public:
|
| virtual Code::Kind GetCodeKind() const { return Code::HANDLER; }
|
| virtual int GetStubFlags() { return kind(); }
|
| -
|
| - protected:
|
| - HandlerStub() : HICStub() { }
|
| };
|
|
|
|
|
| class LoadFieldStub: public HandlerStub {
|
| public:
|
| - LoadFieldStub(bool inobject, int index, Representation representation)
|
| - : HandlerStub() {
|
| + LoadFieldStub(bool inobject, int index, Representation representation) {
|
| Initialize(Code::LOAD_IC, inobject, index, representation);
|
| }
|
|
|
| @@ -988,6 +939,63 @@ class LoadFieldStub: public HandlerStub {
|
| };
|
|
|
|
|
| +class StoreGlobalStub : public HandlerStub {
|
| + public:
|
| + StoreGlobalStub(StrictModeFlag strict_mode, bool is_constant) {
|
| + bit_field_ = StrictModeBits::encode(strict_mode) |
|
| + IsConstantBits::encode(is_constant);
|
| + }
|
| +
|
| + Handle<Code> GetCodeCopyFromTemplate(Isolate* isolate,
|
| + Map* receiver_map,
|
| + PropertyCell* cell) {
|
| + Handle<Code> code = CodeStub::GetCodeCopyFromTemplate(isolate);
|
| + // Replace the placeholder cell and global object map with the actual global
|
| + // cell and receiver map.
|
| + Map* cell_map = isolate->heap()->global_property_cell_map();
|
| + code->ReplaceNthObject(1, cell_map, cell);
|
| + code->ReplaceNthObject(1, isolate->heap()->meta_map(), receiver_map);
|
| + return code;
|
| + }
|
| +
|
| + virtual Code::Kind kind() const { return Code::STORE_IC; }
|
| +
|
| + virtual Handle<Code> GenerateCode(Isolate* isolate);
|
| +
|
| + virtual void InitializeInterfaceDescriptor(
|
| + Isolate* isolate,
|
| + CodeStubInterfaceDescriptor* descriptor);
|
| +
|
| + virtual Code::ExtraICState GetExtraICState() { return bit_field_; }
|
| +
|
| + bool is_constant() {
|
| + return IsConstantBits::decode(bit_field_);
|
| + }
|
| + void set_is_constant(bool value) {
|
| + bit_field_ = IsConstantBits::update(bit_field_, value);
|
| + }
|
| +
|
| + Representation representation() {
|
| + return Representation::FromKind(RepresentationBits::decode(bit_field_));
|
| + }
|
| + void set_representation(Representation r) {
|
| + bit_field_ = RepresentationBits::update(bit_field_, r.kind());
|
| + }
|
| +
|
| + private:
|
| + virtual int NotMissMinorKey() { return GetExtraICState(); }
|
| + Major MajorKey() { return StoreGlobal; }
|
| +
|
| + class StrictModeBits: public BitField<StrictModeFlag, 0, 1> {};
|
| + class IsConstantBits: public BitField<bool, 1, 1> {};
|
| + class RepresentationBits: public BitField<Representation::Kind, 2, 8> {};
|
| +
|
| + int bit_field_;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(StoreGlobalStub);
|
| +};
|
| +
|
| +
|
| class KeyedLoadFieldStub: public LoadFieldStub {
|
| public:
|
| KeyedLoadFieldStub(bool inobject, int index, Representation representation)
|
| @@ -1180,6 +1188,47 @@ class BinaryOpStub: public HydrogenCodeStub {
|
| };
|
|
|
|
|
| +// TODO(bmeurer): Rename to StringAddStub once we dropped the old StringAddStub.
|
| +class NewStringAddStub V8_FINAL : public HydrogenCodeStub {
|
| + public:
|
| + NewStringAddStub(StringAddFlags flags, PretenureFlag pretenure_flag)
|
| + : bit_field_(StringAddFlagsBits::encode(flags) |
|
| + PretenureFlagBits::encode(pretenure_flag)) {}
|
| +
|
| + StringAddFlags flags() const {
|
| + return StringAddFlagsBits::decode(bit_field_);
|
| + }
|
| +
|
| + PretenureFlag pretenure_flag() const {
|
| + return PretenureFlagBits::decode(bit_field_);
|
| + }
|
| +
|
| + virtual Handle<Code> GenerateCode(Isolate* isolate) V8_OVERRIDE;
|
| +
|
| + virtual void InitializeInterfaceDescriptor(
|
| + Isolate* isolate,
|
| + CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE;
|
| +
|
| + static void InstallDescriptors(Isolate* isolate);
|
| +
|
| + // Parameters accessed via CodeStubGraphBuilder::GetParameter()
|
| + static const int kLeft = 0;
|
| + static const int kRight = 1;
|
| +
|
| + private:
|
| + class StringAddFlagsBits: public BitField<StringAddFlags, 0, 2> {};
|
| + class PretenureFlagBits: public BitField<PretenureFlag, 2, 1> {};
|
| + uint32_t bit_field_;
|
| +
|
| + virtual Major MajorKey() V8_OVERRIDE { return NewStringAdd; }
|
| + virtual int NotMissMinorKey() V8_OVERRIDE { return bit_field_; }
|
| +
|
| + virtual void PrintBaseName(StringStream* stream) V8_OVERRIDE;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(NewStringAddStub);
|
| +};
|
| +
|
| +
|
| class ICCompareStub: public PlatformCodeStub {
|
| public:
|
| ICCompareStub(Token::Value op,
|
|
|