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

Unified Diff: src/code-stubs.h

Issue 26968004: Turn Load/StoreGlobal into a handler. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/arm/stub-cache-arm.cc ('k') | src/ia32/stub-cache-ia32.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/code-stubs.h
diff --git a/src/code-stubs.h b/src/code-stubs.h
index d2101ae293b6cee60ef3ca597bc483ab9b4d18ba..00b01c188f47a78328c75f098cee1957633e6988 100644
--- a/src/code-stubs.h
+++ b/src/code-stubs.h
@@ -552,51 +552,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.
@@ -898,7 +853,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;
};
@@ -908,16 +862,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);
}
@@ -979,6 +929,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)
« no previous file with comments | « src/arm/stub-cache-arm.cc ('k') | src/ia32/stub-cache-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698