| Index: src/ic.h
|
| diff --git a/src/ic.h b/src/ic.h
|
| index bfb73ac6a530772ad7bc02e9ee88a9a07c726b38..66b9d21ece70e274be2fa6bd5a8650d2c0ff2b88 100644
|
| --- a/src/ic.h
|
| +++ b/src/ic.h
|
| @@ -66,6 +66,12 @@ namespace internal {
|
| //
|
| class IC {
|
| public:
|
| + // ICs store extra state in a Code object. The default extra state is
|
| + // kNoExtraICState. It's defined here and in Code::kNoExtraICState to prevent
|
| + // circular dependency, with the static assert below ensuring they are the
|
| + // same.
|
| + static const Code::ExtraICState kNoExtraICState = 0;
|
| + STATIC_ASSERT(kNoExtraICState == Code::kNoExtraICState);
|
| // The ids for utility called from the generated code.
|
| enum UtilityId {
|
| #define CONST_NAME(name) k##name,
|
| @@ -255,6 +261,8 @@ class IC {
|
| Handle<String> name);
|
| void TryRemoveInvalidHandlers(Handle<Map> map, Handle<String> name);
|
|
|
| + virtual Code::ExtraICState extra_ic_state() { return IC::kNoExtraICState; }
|
| +
|
| private:
|
| Code* raw_target() const { return GetTargetAtAddress(address()); }
|
|
|
| @@ -296,8 +304,13 @@ class IC_Utility {
|
|
|
| class CallICBase: public IC {
|
| public:
|
| - class Contextual: public BitField<bool, 0, 1> {};
|
| + // ExtraICState bits
|
| + class Contextual: public BitField<ContextualMode, 0, 1> {};
|
| class StringStubState: public BitField<StringStubFeedback, 1, 1> {};
|
| + static Code::ExtraICState ComputeExtraICState(ContextualMode mode,
|
| + StringStubFeedback feedback) {
|
| + return Contextual::encode(mode) | StringStubState::encode(feedback);
|
| + }
|
|
|
| // Returns a JSFunction or a Failure.
|
| MUST_USE_RESULT MaybeObject* LoadFunction(Handle<Object> object,
|
| @@ -307,8 +320,6 @@ class CallICBase: public IC {
|
| CallICBase(Code::Kind kind, Isolate* isolate)
|
| : IC(EXTRA_CALL_FRAME, isolate), kind_(kind) {}
|
|
|
| - virtual Code::ExtraICState extra_ic_state() { return Code::kNoExtraICState; }
|
| -
|
| // Compute a monomorphic stub if possible, otherwise return a null handle.
|
| Handle<Code> ComputeMonomorphicStub(LookupResult* lookup,
|
| Handle<Object> object,
|
| @@ -379,7 +390,7 @@ class CallIC: public CallICBase {
|
|
|
| static void GenerateNormal(MacroAssembler* masm, int argc) {
|
| CallICBase::GenerateNormal(masm, argc);
|
| - GenerateMiss(masm, argc, Code::kNoExtraICState);
|
| + GenerateMiss(masm, argc, IC::kNoExtraICState);
|
| }
|
| bool TryUpdateExtraICState(LookupResult* lookup, Handle<Object> object);
|
|
|
| @@ -408,7 +419,7 @@ class KeyedCallIC: public CallICBase {
|
|
|
| static void GenerateMiss(MacroAssembler* masm, int argc) {
|
| CallICBase::GenerateMiss(masm, argc, IC::kKeyedCallIC_Miss,
|
| - Code::kNoExtraICState);
|
| + IC::kNoExtraICState);
|
| }
|
|
|
| static void GenerateMegamorphic(MacroAssembler* masm, int argc);
|
| @@ -559,9 +570,21 @@ class KeyedLoadIC: public LoadIC {
|
|
|
| class StoreIC: public IC {
|
| public:
|
| + // ExtraICState bits
|
| + class StrictModeState: public BitField<StrictModeFlag, 0, 1> {};
|
| + static Code::ExtraICState ComputeExtraICState(StrictModeFlag flag) {
|
| + return StrictModeState::encode(flag);
|
| + }
|
| +
|
| + static StrictModeFlag GetStrictMode(Code::ExtraICState state) {
|
| + return StrictModeState::decode(state);
|
| + }
|
| +
|
| + static const int kStrictModeICState = 1 << StrictModeState::kShift;
|
| +
|
| StoreIC(FrameDepth depth, Isolate* isolate)
|
| : IC(depth, isolate),
|
| - strict_mode_(Code::GetStrictMode(target()->extra_ic_state())) {
|
| + strict_mode_(StrictModeState::decode(target()->extra_ic_state())) {
|
| ASSERT(IsStoreStub());
|
| }
|
|
|
| @@ -642,11 +665,15 @@ class StoreIC: public IC {
|
| Handle<Object> value,
|
| InlineCacheHolderFlag cache_holder);
|
|
|
| + virtual Code::ExtraICState extra_ic_state() {
|
| + return ComputeExtraICState(strict_mode());
|
| + }
|
| +
|
| private:
|
| void set_target(Code* code) {
|
| // Strict mode must be preserved across IC patching.
|
| - ASSERT(Code::GetStrictMode(code->extra_ic_state()) ==
|
| - Code::GetStrictMode(target()->extra_ic_state()));
|
| + ASSERT(GetStrictMode(code->extra_ic_state()) ==
|
| + GetStrictMode(target()->extra_ic_state()));
|
| IC::set_target(code);
|
| }
|
|
|
| @@ -681,6 +708,22 @@ enum KeyedStoreIncrementLength {
|
|
|
| class KeyedStoreIC: public StoreIC {
|
| public:
|
| + // ExtraICState bits (building on IC)
|
| + // ExtraICState bits
|
| + class ExtraICStateKeyedAccessStoreMode:
|
| + public BitField<KeyedAccessStoreMode, 1, 4> {}; // NOLINT
|
| +
|
| + static Code::ExtraICState ComputeExtraICState(StrictModeFlag flag,
|
| + KeyedAccessStoreMode mode) {
|
| + return StrictModeState::encode(flag) |
|
| + ExtraICStateKeyedAccessStoreMode::encode(mode);
|
| + }
|
| +
|
| + static KeyedAccessStoreMode GetKeyedAccessStoreMode(
|
| + Code::ExtraICState extra_state) {
|
| + return ExtraICStateKeyedAccessStoreMode::decode(extra_state);
|
| + }
|
| +
|
| KeyedStoreIC(FrameDepth depth, Isolate* isolate)
|
| : StoreIC(depth, isolate) {
|
| ASSERT(target()->is_keyed_store_stub());
|
| @@ -707,6 +750,10 @@ class KeyedStoreIC: public StoreIC {
|
|
|
| virtual void UpdateMegamorphicCache(Type* type, Name* name, Code* code) { }
|
|
|
| + virtual Code::ExtraICState extra_ic_state() {
|
| + return ComputeExtraICState(strict_mode(), STANDARD_STORE);
|
| + }
|
| +
|
| virtual Handle<Code> pre_monomorphic_stub() {
|
| return pre_monomorphic_stub(isolate(), strict_mode());
|
| }
|
| @@ -735,7 +782,7 @@ class KeyedStoreIC: public StoreIC {
|
| private:
|
| void set_target(Code* code) {
|
| // Strict mode must be preserved across IC patching.
|
| - ASSERT(Code::GetStrictMode(code->extra_ic_state()) == strict_mode());
|
| + ASSERT(GetStrictMode(code->extra_ic_state()) == strict_mode());
|
| IC::set_target(code);
|
| }
|
|
|
|
|