Index: src/stub-cache.h |
diff --git a/src/stub-cache.h b/src/stub-cache.h |
index 5317ce8e1ce09cdf3e0aef664a181ebcd53bdfba..73a1a8a76f868094917f75bf3654997e296bd8bd 100644 |
--- a/src/stub-cache.h |
+++ b/src/stub-cache.h |
@@ -90,19 +90,35 @@ class StubCache { |
Code::StubType type, |
Code::ExtraICState extra_state = Code::kNoExtraICState); |
- Handle<Code> FindHandler( |
- Handle<Name> name, |
- Handle<JSObject> receiver, |
- Handle<JSObject> stub_holder, |
- Code::Kind kind, |
- Code::StubType type); |
+ Handle<Code> FindLoadHandler(Handle<Name> name, |
+ Handle<JSObject> receiver, |
+ Handle<JSObject> stub_holder, |
+ Code::Kind kind, |
+ Code::StubType type); |
- Handle<Code> ComputeMonomorphicIC(Handle<JSObject> receiver, |
- Handle<Code> handler, |
- Handle<Name> name); |
- Handle<Code> ComputeKeyedMonomorphicIC(Handle<JSObject> receiver, |
+ Handle<Code> FindStoreHandler(Handle<Name> name, |
+ Handle<JSObject> receiver, |
+ Code::Kind kind, |
+ Code::StubType type, |
+ StrictModeFlag strict_mode); |
+ |
+ Handle<Code> ComputeMonomorphicLoadIC(Handle<JSObject> receiver, |
+ Handle<Code> handler, |
+ Handle<Name> name); |
+ |
+ Handle<Code> ComputeMonomorphicKeyedLoadIC(Handle<JSObject> receiver, |
+ Handle<Code> handler, |
+ Handle<Name> name); |
+ |
+ Handle<Code> ComputeMonomorphicStoreIC(Handle<JSObject> receiver, |
Handle<Code> handler, |
- Handle<Name> name); |
+ Handle<Name> name, |
+ StrictModeFlag strict_mode); |
+ |
+ Handle<Code> ComputeMonomorphicKeyedStoreIC(Handle<JSObject> receiver, |
+ Handle<Code> handler, |
+ Handle<Name> name, |
+ StrictModeFlag strict_mode); |
// Computes the right stub matching. Inserts the result in the |
// cache before returning. This might compile a stub if needed. |
@@ -291,10 +307,16 @@ class StubCache { |
KeyedAccessStoreMode store_mode, |
StrictModeFlag strict_mode); |
- Handle<Code> ComputePolymorphicIC(MapHandleList* receiver_maps, |
- CodeHandleList* handlers, |
- int number_of_valid_maps, |
- Handle<Name> name); |
+ Handle<Code> ComputePolymorphicLoadIC(MapHandleList* receiver_maps, |
+ CodeHandleList* handlers, |
+ int number_of_valid_maps, |
+ Handle<Name> name); |
+ |
+ Handle<Code> ComputePolymorphicStoreIC(MapHandleList* receiver_maps, |
+ CodeHandleList* handlers, |
+ int number_of_valid_maps, |
+ Handle<Name> name, |
+ StrictModeFlag strict_mode); |
// Finds the Code object stored in the Heap::non_monomorphic_cache(). |
Code* FindCallInitialize(int argc, RelocInfo::Mode mode, Code::Kind kind); |
@@ -530,49 +552,6 @@ class StubCompiler BASE_EMBEDDED { |
Register scratch2, |
Label* miss_label); |
- void GenerateStoreTransition(MacroAssembler* masm, |
- Handle<JSObject> object, |
- LookupResult* lookup, |
- Handle<Map> transition, |
- Handle<Name> name, |
- Register receiver_reg, |
- Register name_reg, |
- Register value_reg, |
- Register scratch1, |
- Register scratch2, |
- Register scratch3, |
- Label* miss_label, |
- Label* miss_restore_name, |
- Label* slow); |
- |
- void GenerateStoreField(MacroAssembler* masm, |
- Handle<JSObject> object, |
- LookupResult* lookup, |
- Register receiver_reg, |
- Register name_reg, |
- Register value_reg, |
- Register scratch1, |
- Register scratch2, |
- Label* miss_label); |
- |
- static Builtins::Name MissBuiltin(Code::Kind kind) { |
- switch (kind) { |
- case Code::LOAD_IC: return Builtins::kLoadIC_Miss; |
- case Code::STORE_IC: return Builtins::kStoreIC_Miss; |
- case Code::KEYED_LOAD_IC: return Builtins::kKeyedLoadIC_Miss; |
- case Code::KEYED_STORE_IC: return Builtins::kKeyedStoreIC_Miss; |
- default: UNREACHABLE(); |
- } |
- return Builtins::kLoadIC_Miss; |
- } |
- static Builtins::Name SlowBuiltin(Code::Kind kind) { |
- switch (kind) { |
- case Code::STORE_IC: return Builtins::kStoreIC_Slow; |
- case Code::KEYED_STORE_IC: return Builtins::kKeyedStoreIC_Slow; |
- default: UNREACHABLE(); |
- } |
- return Builtins::kStoreIC_Slow; |
- } |
static void TailCallBuiltin(MacroAssembler* masm, Builtins::Name name); |
// Generates code that verifies that the property holder has not changed |
@@ -642,10 +621,77 @@ class StubCompiler BASE_EMBEDDED { |
enum FrontendCheckType { PERFORM_INITIAL_CHECKS, SKIP_INITIAL_CHECKS }; |
-class BaseLoadStubCompiler: public StubCompiler { |
+class BaseLoadStoreStubCompiler: public StubCompiler { |
public: |
- BaseLoadStubCompiler(Isolate* isolate, Register* registers) |
+ BaseLoadStoreStubCompiler(Isolate* isolate, Register* registers) |
: StubCompiler(isolate), registers_(registers) { } |
+ virtual ~BaseLoadStoreStubCompiler() { } |
+ |
+ Handle<Code> CompileMonomorphicIC(Handle<Map> receiver_map, |
+ Handle<Code> handler, |
+ Handle<Name> name); |
+ |
+ Handle<Code> CompilePolymorphicIC(MapHandleList* receiver_maps, |
+ CodeHandleList* handlers, |
+ Handle<Name> name, |
+ Code::StubType type, |
+ IcCheckType check); |
+ |
+ virtual void GenerateNameCheck(Handle<Name> name, |
+ Register name_reg, |
+ Label* miss) { } |
+ |
+ static Builtins::Name MissBuiltin(Code::Kind kind) { |
+ switch (kind) { |
+ case Code::LOAD_IC: return Builtins::kLoadIC_Miss; |
+ case Code::STORE_IC: return Builtins::kStoreIC_Miss; |
+ case Code::KEYED_LOAD_IC: return Builtins::kKeyedLoadIC_Miss; |
+ case Code::KEYED_STORE_IC: return Builtins::kKeyedStoreIC_Miss; |
+ default: UNREACHABLE(); |
+ } |
+ return Builtins::kLoadIC_Miss; |
+ } |
+ |
+ protected: |
+ virtual Register HandlerFrontendHeader(Handle<JSObject> object, |
+ Register object_reg, |
+ Handle<JSObject> holder, |
+ Handle<Name> name, |
+ Label* miss) = 0; |
+ |
+ virtual void HandlerFrontendFooter(Handle<Name> name, |
+ Label* success, |
+ Label* miss) = 0; |
+ |
+ Register HandlerFrontend(Handle<JSObject> object, |
+ Register object_reg, |
+ Handle<JSObject> holder, |
+ Handle<Name> name, |
+ Label* success); |
+ |
+ Handle<Code> GetICCode(Code::Kind kind, |
+ Code::StubType type, |
+ Handle<Name> name, |
+ InlineCacheState state = MONOMORPHIC); |
+ |
+ virtual Code::ExtraICState extra_state() { return Code::kNoExtraICState; } |
+ virtual Logger::LogEventsAndTags log_kind(Handle<Code> code) = 0; |
+ virtual void JitEvent(Handle<Name> name, Handle<Code> code) = 0; |
+ virtual Code::Kind kind() = 0; |
+ virtual Register receiver() = 0; |
+ virtual Register name() = 0; |
+ virtual Register scratch1() = 0; |
+ virtual Register scratch2() = 0; |
+ virtual Register scratch3() = 0; |
+ |
+ Register* registers_; |
+}; |
+ |
+ |
+class BaseLoadStubCompiler: public BaseLoadStoreStubCompiler { |
+ public: |
+ BaseLoadStubCompiler(Isolate* isolate, Register* registers) |
+ : BaseLoadStoreStubCompiler(isolate, registers) { } |
virtual ~BaseLoadStubCompiler() { } |
Handle<Code> CompileLoadField(Handle<JSObject> object, |
@@ -668,28 +714,17 @@ class BaseLoadStubCompiler: public StubCompiler { |
Handle<JSObject> holder, |
Handle<Name> name); |
- Handle<Code> CompileMonomorphicIC(Handle<Map> receiver_map, |
- Handle<Code> handler, |
- Handle<Name> name); |
- Handle<Code> CompilePolymorphicIC(MapHandleList* receiver_maps, |
- CodeHandleList* handlers, |
- Handle<Name> name, |
- Code::StubType type, |
- IcCheckType check); |
- |
protected: |
- Register HandlerFrontendHeader(Handle<JSObject> object, |
- Register object_reg, |
- Handle<JSObject> holder, |
- Handle<Name> name, |
- Label* success); |
- void HandlerFrontendFooter(Label* success, Label* miss); |
+ virtual Register HandlerFrontendHeader(Handle<JSObject> object, |
+ Register object_reg, |
+ Handle<JSObject> holder, |
+ Handle<Name> name, |
+ Label* miss); |
+ |
+ virtual void HandlerFrontendFooter(Handle<Name> name, |
+ Label* success, |
+ Label* miss); |
- Register HandlerFrontend(Handle<JSObject> object, |
- Register object_reg, |
- Handle<JSObject> holder, |
- Handle<Name> name, |
- Label* success); |
Register CallbackHandlerFrontend(Handle<JSObject> object, |
Register object_reg, |
Handle<JSObject> holder, |
@@ -719,30 +754,16 @@ class BaseLoadStubCompiler: public StubCompiler { |
Handle<Name> name, |
LookupResult* lookup); |
- Handle<Code> GetICCode(Code::Kind kind, |
- Code::StubType type, |
- Handle<Name> name, |
- InlineCacheState state = MONOMORPHIC); |
- |
Handle<Code> GetCode(Code::Kind kind, |
Code::StubType type, |
Handle<Name> name); |
- Register receiver() { return registers_[0]; } |
- Register name() { return registers_[1]; } |
- Register scratch1() { return registers_[2]; } |
- Register scratch2() { return registers_[3]; } |
- Register scratch3() { return registers_[4]; } |
+ virtual Register receiver() { return registers_[0]; } |
+ virtual Register name() { return registers_[1]; } |
+ virtual Register scratch1() { return registers_[2]; } |
+ virtual Register scratch2() { return registers_[3]; } |
+ virtual Register scratch3() { return registers_[4]; } |
Register scratch4() { return registers_[5]; } |
- |
- private: |
- virtual Code::Kind kind() = 0; |
- virtual Logger::LogEventsAndTags log_kind(Handle<Code> code) = 0; |
- virtual void JitEvent(Handle<Name> name, Handle<Code> code) = 0; |
- virtual void GenerateNameCheck(Handle<Name> name, |
- Register name_reg, |
- Label* miss) { } |
- Register* registers_; |
}; |
@@ -770,8 +791,6 @@ class LoadStubCompiler: public BaseLoadStubCompiler { |
Handle<Name> name, |
bool is_dont_delete); |
- static Register receiver() { return registers()[0]; } |
- |
private: |
static Register* registers(); |
virtual Code::Kind kind() { return Code::LOAD_IC; } |
@@ -796,8 +815,6 @@ class KeyedLoadStubCompiler: public BaseLoadStubCompiler { |
static void GenerateLoadDictionaryElement(MacroAssembler* masm); |
- static Register receiver() { return registers()[0]; } |
- |
private: |
static Register* registers(); |
virtual Code::Kind kind() { return Code::KEYED_LOAD_IC; } |
@@ -813,14 +830,13 @@ class KeyedLoadStubCompiler: public BaseLoadStubCompiler { |
}; |
-class BaseStoreStubCompiler: public StubCompiler { |
+class BaseStoreStubCompiler: public BaseLoadStoreStubCompiler { |
public: |
BaseStoreStubCompiler(Isolate* isolate, |
StrictModeFlag strict_mode, |
Register* registers) |
- : StubCompiler(isolate), |
- strict_mode_(strict_mode), |
- registers_(registers) { } |
+ : BaseLoadStoreStubCompiler(isolate, registers), |
+ strict_mode_(strict_mode) { } |
virtual ~BaseStoreStubCompiler() { } |
@@ -833,12 +849,65 @@ class BaseStoreStubCompiler: public StubCompiler { |
LookupResult* lookup, |
Handle<Name> name); |
- protected: |
- Handle<Code> GetICCode(Code::Kind kind, |
- Code::StubType type, |
- Handle<Name> name, |
- InlineCacheState state = MONOMORPHIC); |
+ void GenerateNegativeHolderLookup(MacroAssembler* masm, |
+ Handle<JSObject> holder, |
+ Register holder_reg, |
+ Handle<Name> name, |
+ Label* miss); |
+ |
+ void GenerateStoreTransition(MacroAssembler* masm, |
+ Handle<JSObject> object, |
+ LookupResult* lookup, |
+ Handle<Map> transition, |
+ Handle<Name> name, |
+ Register receiver_reg, |
+ Register name_reg, |
+ Register value_reg, |
+ Register scratch1, |
+ Register scratch2, |
+ Register scratch3, |
+ Label* miss_label, |
+ Label* slow); |
+ |
+ void GenerateStoreField(MacroAssembler* masm, |
+ Handle<JSObject> object, |
+ LookupResult* lookup, |
+ Register receiver_reg, |
+ Register name_reg, |
+ Register value_reg, |
+ Register scratch1, |
+ Register scratch2, |
+ Label* miss_label); |
+ |
+ static Builtins::Name MissBuiltin(Code::Kind kind) { |
+ switch (kind) { |
+ case Code::LOAD_IC: return Builtins::kLoadIC_Miss; |
+ case Code::STORE_IC: return Builtins::kStoreIC_Miss; |
+ case Code::KEYED_LOAD_IC: return Builtins::kKeyedLoadIC_Miss; |
+ case Code::KEYED_STORE_IC: return Builtins::kKeyedStoreIC_Miss; |
+ default: UNREACHABLE(); |
+ } |
+ return Builtins::kLoadIC_Miss; |
+ } |
+ static Builtins::Name SlowBuiltin(Code::Kind kind) { |
+ switch (kind) { |
+ case Code::STORE_IC: return Builtins::kStoreIC_Slow; |
+ case Code::KEYED_STORE_IC: return Builtins::kKeyedStoreIC_Slow; |
+ default: UNREACHABLE(); |
+ } |
+ return Builtins::kStoreIC_Slow; |
+ } |
+ protected: |
+ virtual Register HandlerFrontendHeader(Handle<JSObject> object, |
+ Register object_reg, |
+ Handle<JSObject> holder, |
+ Handle<Name> name, |
+ Label* miss); |
+ |
+ virtual void HandlerFrontendFooter(Handle<Name> name, |
+ Label* success, |
+ Label* miss); |
Handle<Code> GetCode(Code::Kind kind, |
Code::StubType type, |
Handle<Name> name); |
@@ -847,24 +916,17 @@ class BaseStoreStubCompiler: public StubCompiler { |
Label* label, |
Handle<Name> name); |
- Register receiver() { return registers_[0]; } |
- Register name() { return registers_[1]; } |
+ virtual Register receiver() { return registers_[0]; } |
+ virtual Register name() { return registers_[1]; } |
Register value() { return registers_[2]; } |
- Register scratch1() { return registers_[3]; } |
- Register scratch2() { return registers_[4]; } |
- Register scratch3() { return registers_[5]; } |
+ virtual Register scratch1() { return registers_[3]; } |
+ virtual Register scratch2() { return registers_[4]; } |
+ virtual Register scratch3() { return registers_[5]; } |
StrictModeFlag strict_mode() { return strict_mode_; } |
virtual Code::ExtraICState extra_state() { return strict_mode_; } |
private: |
- virtual Code::Kind kind() = 0; |
- virtual Logger::LogEventsAndTags log_kind(Handle<Code> code) = 0; |
- virtual void JitEvent(Handle<Name> name, Handle<Code> code) = 0; |
- virtual void GenerateNameCheck(Handle<Name> name, |
- Register name_reg, |
- Label* miss) { } |
StrictModeFlag strict_mode_; |
- Register* registers_; |
}; |
@@ -874,17 +936,17 @@ class StoreStubCompiler: public BaseStoreStubCompiler { |
: BaseStoreStubCompiler(isolate, strict_mode, registers()) { } |
- Handle<Code> CompileStoreCallback(Handle<Name> name, |
- Handle<JSObject> object, |
+ Handle<Code> CompileStoreCallback(Handle<JSObject> object, |
Handle<JSObject> holder, |
+ Handle<Name> name, |
Handle<ExecutableAccessorInfo> callback); |
static void GenerateStoreViaSetter(MacroAssembler* masm, |
Handle<JSFunction> setter); |
- Handle<Code> CompileStoreViaSetter(Handle<Name> name, |
- Handle<JSObject> object, |
+ Handle<Code> CompileStoreViaSetter(Handle<JSObject> object, |
Handle<JSObject> holder, |
+ Handle<Name> name, |
Handle<JSFunction> setter); |
Handle<Code> CompileStoreInterceptor(Handle<JSObject> object, |