Revision: 18185
Author:   [email protected]
Date:     Mon Dec  2 11:59:44 2013 UTC
Log: Removed pieces of extra_ic_state scattered around the stub compiler class hierarchy, and pushed down to a extra_ic_state in the base class.

[email protected]

Review URL: https://codereview.chromium.org/98853002
http://code.google.com/p/v8/source/detail?r=18185

Modified:
 /branches/bleeding_edge/src/arm/stub-cache-arm.cc
 /branches/bleeding_edge/src/ia32/stub-cache-ia32.cc
 /branches/bleeding_edge/src/ic.cc
 /branches/bleeding_edge/src/mips/stub-cache-mips.cc
 /branches/bleeding_edge/src/stub-cache.cc
 /branches/bleeding_edge/src/stub-cache.h
 /branches/bleeding_edge/src/x64/stub-cache-x64.cc

=======================================
--- /branches/bleeding_edge/src/arm/stub-cache-arm.cc Fri Nov 29 15:22:16 2013 UTC +++ /branches/bleeding_edge/src/arm/stub-cache-arm.cc Mon Dec 2 11:59:44 2013 UTC
@@ -1547,7 +1547,7 @@
   Handle<Code> code =
       isolate()->stub_cache()->ComputeCallMiss(arguments().immediate(),
                                                kind_,
-                                               extra_state_);
+                                               extra_state());
   __ Jump(code, RelocInfo::CODE_TARGET);
 }

@@ -1938,7 +1938,7 @@
   Label* index_out_of_range_label = &index_out_of_range;

   if (kind_ == Code::CALL_IC &&
-      (CallICBase::StringStubState::decode(extra_state_) ==
+      (CallICBase::StringStubState::decode(extra_state()) ==
        DEFAULT_STRING_STUB)) {
     index_out_of_range_label = &miss;
   }
@@ -2004,7 +2004,7 @@
   Label index_out_of_range;
   Label* index_out_of_range_label = &index_out_of_range;
   if (kind_ == Code::CALL_IC &&
-      (CallICBase::StringStubState::decode(extra_state_) ==
+      (CallICBase::StringStubState::decode(extra_state()) ==
        DEFAULT_STRING_STUB)) {
     index_out_of_range_label = &miss;
   }
@@ -2466,7 +2466,7 @@
   // Get the receiver from the stack.
   __ ldr(r1, MemOperand(sp, argc * kPointerSize));

-  CallInterceptorCompiler compiler(this, arguments(), r2, extra_state_);
+  CallInterceptorCompiler compiler(this, arguments(), r2, extra_state());
   compiler.Compile(masm(), object, holder, name, &lookup, r1, r3, r4, r0,
                    &miss);

=======================================
--- /branches/bleeding_edge/src/ia32/stub-cache-ia32.cc Mon Dec 2 08:09:17 2013 UTC +++ /branches/bleeding_edge/src/ia32/stub-cache-ia32.cc Mon Dec 2 11:59:44 2013 UTC
@@ -1639,7 +1639,7 @@
   Handle<Code> code =
       isolate()->stub_cache()->ComputeCallMiss(arguments().immediate(),
                                                kind_,
-                                               extra_state_);
+                                               extra_state());
   __ jmp(code, RelocInfo::CODE_TARGET);
 }

@@ -2033,7 +2033,7 @@
   Label* index_out_of_range_label = &index_out_of_range;

   if (kind_ == Code::CALL_IC &&
-      (CallICBase::StringStubState::decode(extra_state_) ==
+      (CallICBase::StringStubState::decode(extra_state()) ==
        DEFAULT_STRING_STUB)) {
     index_out_of_range_label = &miss;
   }
@@ -2099,7 +2099,7 @@
   Label* index_out_of_range_label = &index_out_of_range;

   if (kind_ == Code::CALL_IC &&
-      (CallICBase::StringStubState::decode(extra_state_) ==
+      (CallICBase::StringStubState::decode(extra_state()) ==
        DEFAULT_STRING_STUB)) {
     index_out_of_range_label = &miss;
   }
@@ -2589,7 +2589,7 @@
   // Get the receiver from the stack.
   __ mov(edx, Operand(esp, (argc + 1) * kPointerSize));

-  CallInterceptorCompiler compiler(this, arguments(), ecx, extra_state_);
+  CallInterceptorCompiler compiler(this, arguments(), ecx, extra_state());
compiler.Compile(masm(), object, holder, name, &lookup, edx, ebx, edi, eax,
                    &miss);

=======================================
--- /branches/bleeding_edge/src/ic.cc   Mon Dec  2 09:51:37 2013 UTC
+++ /branches/bleeding_edge/src/ic.cc   Mon Dec  2 11:59:44 2013 UTC
@@ -1205,7 +1205,7 @@

   Handle<Type> type = CurrentTypeOf(object, isolate());
   Handle<JSObject> holder(lookup->holder());
-  LoadStubCompiler compiler(isolate(), cache_holder, kind());
+ LoadStubCompiler compiler(isolate(), kNoExtraICState, cache_holder, kind());

   switch (lookup->type()) {
     case FIELD: {
=======================================
--- /branches/bleeding_edge/src/mips/stub-cache-mips.cc Fri Nov 29 15:22:16 2013 UTC +++ /branches/bleeding_edge/src/mips/stub-cache-mips.cc Mon Dec 2 11:59:44 2013 UTC
@@ -1533,7 +1533,7 @@
   Handle<Code> code =
       isolate()->stub_cache()->ComputeCallMiss(arguments().immediate(),
                                                kind_,
-                                               extra_state_);
+                                               extra_state());
   __ Jump(code, RelocInfo::CODE_TARGET);
 }

@@ -1923,7 +1923,7 @@
   Label* index_out_of_range_label = &index_out_of_range;

   if (kind_ == Code::CALL_IC &&
-      (CallICBase::StringStubState::decode(extra_state_) ==
+      (CallICBase::StringStubState::decode(extra_state()) ==
        DEFAULT_STRING_STUB)) {
     index_out_of_range_label = &miss;
   }
@@ -1987,7 +1987,7 @@
   Label index_out_of_range;
   Label* index_out_of_range_label = &index_out_of_range;
   if (kind_ == Code::CALL_IC &&
-      (CallICBase::StringStubState::decode(extra_state_) ==
+      (CallICBase::StringStubState::decode(extra_state()) ==
        DEFAULT_STRING_STUB)) {
     index_out_of_range_label = &miss;
   }
@@ -2463,7 +2463,7 @@
   // Get the receiver from the stack.
   __ lw(a1, MemOperand(sp, argc * kPointerSize));

-  CallInterceptorCompiler compiler(this, arguments(), a2, extra_state_);
+  CallInterceptorCompiler compiler(this, arguments(), a2, extra_state());
   compiler.Compile(masm(), object, holder, name, &lookup, a1, a3, t0, a0,
                    &miss);

=======================================
--- /branches/bleeding_edge/src/stub-cache.cc   Fri Nov 29 12:57:47 2013 UTC
+++ /branches/bleeding_edge/src/stub-cache.cc   Mon Dec  2 11:59:44 2013 UTC
@@ -152,13 +152,13 @@
     KeyedLoadStubCompiler ic_compiler(isolate(), flag);
     ic = ic_compiler.CompileMonomorphicIC(type, handler, name);
   } else if (kind == Code::STORE_IC) {
-    StrictModeFlag strict_mode = StoreIC::GetStrictMode(extra_ic_state);
-    StoreStubCompiler ic_compiler(isolate(), strict_mode);
+    StoreStubCompiler ic_compiler(isolate(), extra_ic_state);
     ic = ic_compiler.CompileMonomorphicIC(type, handler, name);
   } else {
     ASSERT(kind == Code::KEYED_STORE_IC);
-    StrictModeFlag strict_mode = StoreIC::GetStrictMode(extra_ic_state);
- KeyedStoreStubCompiler ic_compiler(isolate(), strict_mode, STANDARD_STORE);
+    ASSERT(STANDARD_STORE ==
+           KeyedStoreIC::GetKeyedAccessStoreMode(extra_ic_state));
+    KeyedStoreStubCompiler ic_compiler(isolate(), extra_ic_state);
     ic = ic_compiler.CompileMonomorphicIC(type, handler, name);
   }

@@ -236,7 +236,7 @@
Handle<Object> probe(receiver_map->FindInCodeCache(*name, flags), isolate_);
   if (probe->IsCode()) return Handle<Code>::cast(probe);

-  KeyedStoreStubCompiler compiler(isolate(), strict_mode, store_mode);
+  KeyedStoreStubCompiler compiler(isolate(), extra_state);
   Handle<Code> code = compiler.CompileStoreElement(receiver_map);

   Map::UpdateCodeCache(receiver_map, name, code);
@@ -647,7 +647,7 @@
   Handle<Object> probe = cache->Lookup(receiver_maps, flags);
   if (probe->IsCode()) return Handle<Code>::cast(probe);

-  KeyedStoreStubCompiler compiler(isolate_, strict_mode, store_mode);
+  KeyedStoreStubCompiler compiler(isolate_, extra_state);
Handle<Code> code = compiler.CompileStoreElementPolymorphic(receiver_maps);
   PolymorphicCodeCache::Update(cache, receiver_maps, flags, code);
   return code;
@@ -1129,7 +1129,7 @@


 CallKind CallStubCompiler::call_kind() {
-  return CallICBase::Contextual::decode(extra_state_)
+  return CallICBase::Contextual::decode(extra_state())
       ? CALL_AS_FUNCTION
       : CALL_AS_METHOD;
 }
@@ -1577,11 +1577,11 @@
     stub = KeyedStoreFastElementStub(
         is_jsarray,
         elements_kind,
-        store_mode_).GetCode(isolate());
+        store_mode()).GetCode(isolate());
   } else {
     stub = KeyedStoreElementStub(is_jsarray,
                                  elements_kind,
-                                 store_mode_).GetCode(isolate());
+                                 store_mode()).GetCode(isolate());
   }

   __ DispatchMap(receiver(), scratch1(), receiver_map, stub, DO_SMI_CHECK);
@@ -1707,19 +1707,19 @@
           elements_kind,
           transitioned_map->elements_kind(),
           is_js_array,
-          store_mode_).GetCode(isolate());
+          store_mode()).GetCode(isolate());
     } else {
       if (receiver_map->has_fast_elements() ||
           receiver_map->has_external_array_elements()) {
         cached_stub = KeyedStoreFastElementStub(
             is_js_array,
             elements_kind,
-            store_mode_).GetCode(isolate());
+            store_mode()).GetCode(isolate());
       } else {
         cached_stub = KeyedStoreElementStub(
             is_js_array,
             elements_kind,
-            store_mode_).GetCode(isolate());
+            store_mode()).GetCode(isolate());
       }
     }
     ASSERT(!cached_stub.is_null());
@@ -1746,10 +1746,9 @@
                                    Code::Kind kind,
                                    ExtraICState extra_state,
                                    InlineCacheHolderFlag cache_holder)
-    : StubCompiler(isolate),
+    : StubCompiler(isolate, extra_state),
       arguments_(argc),
       kind_(kind),
-      extra_state_(extra_state),
       cache_holder_(cache_holder) {
 }

@@ -1817,7 +1816,7 @@
                                        Handle<Name> name) {
   int argc = arguments_.immediate();
   Code::Flags flags = Code::ComputeMonomorphicFlags(
-      kind_, extra_state_, cache_holder_, type, argc);
+      kind_, extra_state(), cache_holder_, type, argc);
   return GetCodeWithFlags(flags, name);
 }

=======================================
--- /branches/bleeding_edge/src/stub-cache.h    Fri Nov 29 12:57:47 2013 UTC
+++ /branches/bleeding_edge/src/stub-cache.h    Mon Dec  2 11:59:44 2013 UTC
@@ -364,8 +364,10 @@
 // The stub compilers compile stubs for the stub cache.
 class StubCompiler BASE_EMBEDDED {
  public:
-  explicit StubCompiler(Isolate* isolate)
-      : isolate_(isolate), masm_(isolate, NULL, 256), failure_(NULL) { }
+  explicit StubCompiler(Isolate* isolate,
+                        ExtraICState extra_ic_state = kNoExtraICState)
+      : isolate_(isolate), extra_ic_state_(extra_ic_state),
+        masm_(isolate, NULL, 256), failure_(NULL) { }

   // Functions to compile either CallIC or KeyedCallIC.  The specific kind
   // is extracted from the code flags.
@@ -488,6 +490,8 @@
  protected:
   Handle<Code> GetCodeWithFlags(Code::Flags flags, const char* name);
   Handle<Code> GetCodeWithFlags(Code::Flags flags, Handle<Name> name);
+
+  ExtraICState extra_state() { return extra_ic_state_; }

   MacroAssembler* masm() { return &masm_; }
   void set_failure(Failure* failure) { failure_ = failure; }
@@ -504,6 +508,7 @@

  private:
   Isolate* isolate_;
+  const ExtraICState extra_ic_state_;
   MacroAssembler masm_;
   Failure* failure_;
 };
@@ -516,8 +521,11 @@
  public:
   BaseLoadStoreStubCompiler(Isolate* isolate,
                             Code::Kind kind,
+                            ExtraICState extra_ic_state = kNoExtraICState,
                             InlineCacheHolderFlag cache_holder = OWN_MAP)
-      : StubCompiler(isolate), kind_(kind), cache_holder_(cache_holder) {
+      : StubCompiler(isolate, extra_ic_state),
+        kind_(kind),
+        cache_holder_(cache_holder) {
     InitializeRegisters();
   }
   virtual ~BaseLoadStoreStubCompiler() { }
@@ -589,7 +597,6 @@
   }
   void JitEvent(Handle<Name> name, Handle<Code> code);

-  virtual ExtraICState extra_state() { return kNoExtraICState; }
   virtual Register receiver() = 0;
   virtual Register name() = 0;
   virtual Register scratch1() = 0;
@@ -609,9 +616,11 @@
 class LoadStubCompiler: public BaseLoadStoreStubCompiler {
  public:
   LoadStubCompiler(Isolate* isolate,
+                   ExtraICState extra_ic_state = kNoExtraICState,
                    InlineCacheHolderFlag cache_holder = OWN_MAP,
                    Code::Kind kind = Code::LOAD_IC)
-      : BaseLoadStoreStubCompiler(isolate, kind, cache_holder) { }
+      : BaseLoadStoreStubCompiler(isolate, kind, extra_ic_state,
+                                  cache_holder) { }
   virtual ~LoadStubCompiler() { }

   Handle<Code> CompileLoadField(Handle<Type> type,
@@ -708,8 +717,10 @@
 class KeyedLoadStubCompiler: public LoadStubCompiler {
  public:
   KeyedLoadStubCompiler(Isolate* isolate,
+                        ExtraICState extra_ic_state = kNoExtraICState,
                         InlineCacheHolderFlag cache_holder = OWN_MAP)
-      : LoadStubCompiler(isolate, cache_holder, Code::KEYED_LOAD_IC) { }
+      : LoadStubCompiler(isolate, extra_ic_state, cache_holder,
+                         Code::KEYED_LOAD_IC) { }

   Handle<Code> CompileLoadElement(Handle<Map> receiver_map);

@@ -732,10 +743,9 @@
 class StoreStubCompiler: public BaseLoadStoreStubCompiler {
  public:
   StoreStubCompiler(Isolate* isolate,
-                    StrictModeFlag strict_mode,
+                    ExtraICState extra_ic_state,
                     Code::Kind kind = Code::STORE_IC)
-      : BaseLoadStoreStubCompiler(isolate, kind),
-        strict_mode_(strict_mode) { }
+      : BaseLoadStoreStubCompiler(isolate, kind, extra_ic_state) {}

   virtual ~StoreStubCompiler() { }

@@ -826,16 +836,11 @@
   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 ExtraICState extra_state() {
-    return StoreIC::ComputeExtraICState(strict_mode_);
-  }

  protected:
   static Register* registers();

  private:
-  StrictModeFlag strict_mode_;
   friend class BaseLoadStoreStubCompiler;
 };

@@ -843,10 +848,8 @@
 class KeyedStoreStubCompiler: public StoreStubCompiler {
  public:
   KeyedStoreStubCompiler(Isolate* isolate,
-                         StrictModeFlag strict_mode,
-                         KeyedAccessStoreMode store_mode)
-      : StoreStubCompiler(isolate, strict_mode, Code::KEYED_STORE_IC),
-        store_mode_(store_mode) { }
+                         ExtraICState extra_ic_state)
+      : StoreStubCompiler(isolate, extra_ic_state, Code::KEYED_STORE_IC) {}

   Handle<Code> CompileStoreElement(Handle<Map> receiver_map);

@@ -859,10 +862,11 @@
   static void GenerateStoreDictionaryElement(MacroAssembler* masm);

  protected:
-  virtual ExtraICState extra_state() {
-    return KeyedStoreIC::ComputeExtraICState(strict_mode(), store_mode_);
+  static Register* registers();
+
+  KeyedAccessStoreMode store_mode() {
+    return KeyedStoreIC::GetKeyedAccessStoreMode(extra_state());
   }
-  static Register* registers();

  private:
   Register transition_map() {
@@ -872,7 +876,6 @@
   virtual void GenerateNameCheck(Handle<Name> name,
                                  Register name_reg,
                                  Label* miss);
-  KeyedAccessStoreMode store_mode_;
   friend class BaseLoadStoreStubCompiler;
 };

@@ -1000,7 +1003,6 @@

   const ParameterCount arguments_;
   const Code::Kind kind_;
-  const ExtraICState extra_state_;
   const InlineCacheHolderFlag cache_holder_;
 };

=======================================
--- /branches/bleeding_edge/src/x64/stub-cache-x64.cc Fri Nov 29 15:22:16 2013 UTC +++ /branches/bleeding_edge/src/x64/stub-cache-x64.cc Mon Dec 2 11:59:44 2013 UTC
@@ -1572,7 +1572,7 @@
   Handle<Code> code =
       isolate()->stub_cache()->ComputeCallMiss(arguments().immediate(),
                                                kind_,
-                                               extra_state_);
+                                               extra_state());
   __ Jump(code, RelocInfo::CODE_TARGET);
 }

@@ -1957,7 +1957,7 @@
   Label index_out_of_range;
   Label* index_out_of_range_label = &index_out_of_range;
   if (kind_ == Code::CALL_IC &&
-      (CallICBase::StringStubState::decode(extra_state_) ==
+      (CallICBase::StringStubState::decode(extra_state()) ==
        DEFAULT_STRING_STUB)) {
     index_out_of_range_label = &miss;
   }
@@ -2024,7 +2024,7 @@
   Label index_out_of_range;
   Label* index_out_of_range_label = &index_out_of_range;
   if (kind_ == Code::CALL_IC &&
-      (CallICBase::StringStubState::decode(extra_state_) ==
+      (CallICBase::StringStubState::decode(extra_state()) ==
        DEFAULT_STRING_STUB)) {
     index_out_of_range_label = &miss;
   }
@@ -2497,7 +2497,7 @@
   StackArgumentsAccessor args(rsp, arguments());
   __ movq(rdx, args.GetReceiverOperand());

-  CallInterceptorCompiler compiler(this, arguments(), rcx, extra_state_);
+  CallInterceptorCompiler compiler(this, arguments(), rcx, extra_state());
compiler.Compile(masm(), object, holder, name, &lookup, rdx, rbx, rdi, rax,
                    &miss);

--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to