Revision: 18594
Author:   [email protected]
Date:     Tue Jan 14 16:15:05 2014 UTC
Log:      Get rid of ContextualMode for call ICs.

BUG=
[email protected]

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

Modified:
 /branches/bleeding_edge/src/arm/full-codegen-arm.cc
 /branches/bleeding_edge/src/arm/lithium-codegen-arm.cc
 /branches/bleeding_edge/src/ast.cc
 /branches/bleeding_edge/src/ast.h
 /branches/bleeding_edge/src/ia32/full-codegen-ia32.cc
 /branches/bleeding_edge/src/ia32/lithium-codegen-ia32.cc
 /branches/bleeding_edge/src/ic.cc
 /branches/bleeding_edge/src/ic.h
 /branches/bleeding_edge/src/stub-cache.cc
 /branches/bleeding_edge/src/stub-cache.h
 /branches/bleeding_edge/src/type-info.cc
 /branches/bleeding_edge/src/type-info.h
 /branches/bleeding_edge/src/typing.cc
 /branches/bleeding_edge/src/x64/full-codegen-x64.cc
 /branches/bleeding_edge/src/x64/lithium-codegen-x64.cc
 /branches/bleeding_edge/test/cctest/test-heap.cc
 /branches/bleeding_edge/test/mjsunit/regress/regress-2284.js
 /branches/bleeding_edge/test/mjsunit/regress/regress-2286.js

=======================================
--- /branches/bleeding_edge/src/arm/full-codegen-arm.cc Tue Jan 14 15:19:34 2014 UTC +++ /branches/bleeding_edge/src/arm/full-codegen-arm.cc Tue Jan 14 16:15:05 2014 UTC
@@ -2614,8 +2614,7 @@
   // Record source position for debugger.
   SetSourcePosition(expr->position());
   // Call the IC initialization code.
-  Handle<Code> ic =
-      isolate()->stub_cache()->ComputeCallInitialize(arg_count, mode);
+ Handle<Code> ic = isolate()->stub_cache()->ComputeCallInitialize(arg_count);
   TypeFeedbackId ast_id = mode == CONTEXTUAL
       ? TypeFeedbackId::None()
       : expr->CallFeedbackId();
@@ -4155,10 +4154,8 @@
   if (expr->is_jsruntime()) {
     // Call the JS runtime function.
     __ mov(r2, Operand(expr->name()));
-    ContextualMode mode = NOT_CONTEXTUAL;
-    Handle<Code> ic =
-        isolate()->stub_cache()->ComputeCallInitialize(arg_count, mode);
-    CallIC(ic, mode, expr->CallRuntimeFeedbackId());
+ Handle<Code> ic = isolate()->stub_cache()->ComputeCallInitialize(arg_count);
+    CallIC(ic, NOT_CONTEXTUAL, expr->CallRuntimeFeedbackId());
     // Restore context register.
     __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
   } else {
=======================================
--- /branches/bleeding_edge/src/arm/lithium-codegen-arm.cc Tue Jan 14 16:13:18 2014 UTC +++ /branches/bleeding_edge/src/arm/lithium-codegen-arm.cc Tue Jan 14 16:15:05 2014 UTC
@@ -3986,8 +3986,7 @@
   ASSERT(ToRegister(instr->result()).is(r0));

   int arity = instr->arity();
-  Handle<Code> ic =
- isolate()->stub_cache()->ComputeCallInitialize(arity, NOT_CONTEXTUAL);
+  Handle<Code> ic = isolate()->stub_cache()->ComputeCallInitialize(arity);
   __ mov(r2, Operand(instr->name()));
   CallCode(ic, RelocInfo::CODE_TARGET, instr, NEVER_INLINE_TARGET_ADDRESS);
 }
@@ -4014,8 +4013,7 @@
   ASSERT(ToRegister(instr->result()).is(r0));

   int arity = instr->arity();
-  Handle<Code> ic =
-      isolate()->stub_cache()->ComputeCallInitialize(arity, CONTEXTUAL);
+  Handle<Code> ic = isolate()->stub_cache()->ComputeCallInitialize(arity);
   __ mov(r2, Operand(instr->name()));
   CallCode(ic, RelocInfo::CODE_TARGET, instr, NEVER_INLINE_TARGET_ADDRESS);
 }
=======================================
--- /branches/bleeding_edge/src/ast.cc  Tue Jan 14 14:36:24 2014 UTC
+++ /branches/bleeding_edge/src/ast.cc  Tue Jan 14 16:15:05 2014 UTC
@@ -696,8 +696,7 @@
 }


-void Call::RecordTypeFeedback(TypeFeedbackOracle* oracle,
-                              ContextualMode contextual_mode) {
+void Call::RecordTypeFeedback(TypeFeedbackOracle* oracle) {
   is_monomorphic_ = oracle->CallIsMonomorphic(CallFeedbackId());
   Property* property = expression()->AsProperty();
   if (property == NULL) {
@@ -712,7 +711,7 @@
     receiver_types_.Clear();
     if (check_type_ == RECEIVER_MAP_CHECK) {
       oracle->CallReceiverTypes(CallFeedbackId(),
-          name, arguments()->length(), contextual_mode, &receiver_types_);
+          name, arguments()->length(), &receiver_types_);
       is_monomorphic_ = is_monomorphic_ && receiver_types_.length() > 0;
     } else {
holder_ = GetPrototypeForPrimitiveCheck(check_type_, oracle->isolate());
=======================================
--- /branches/bleeding_edge/src/ast.h   Tue Jan 14 14:36:24 2014 UTC
+++ /branches/bleeding_edge/src/ast.h   Tue Jan 14 16:15:05 2014 UTC
@@ -1737,8 +1737,7 @@

   // Type feedback information.
   TypeFeedbackId CallFeedbackId() const { return reuse(id()); }
-  void RecordTypeFeedback(TypeFeedbackOracle* oracle,
-                          ContextualMode contextual_mode);
+  void RecordTypeFeedback(TypeFeedbackOracle* oracle);
   virtual SmallMapList* GetReceiverTypes() V8_OVERRIDE {
     return &receiver_types_;
   }
=======================================
--- /branches/bleeding_edge/src/ia32/full-codegen-ia32.cc Tue Jan 14 15:19:34 2014 UTC +++ /branches/bleeding_edge/src/ia32/full-codegen-ia32.cc Tue Jan 14 16:15:05 2014 UTC
@@ -2569,7 +2569,7 @@
   // Record source position of the IC call.
   SetSourcePosition(expr->position());
   Handle<Code> ic =
-      isolate()->stub_cache()->ComputeCallInitialize(arg_count, mode);
+      isolate()->stub_cache()->ComputeCallInitialize(arg_count);
   TypeFeedbackId ast_id = mode == CONTEXTUAL
       ? TypeFeedbackId::None()
       : expr->CallFeedbackId();
@@ -4146,10 +4146,8 @@
   if (expr->is_jsruntime()) {
     // Call the JS runtime function via a call IC.
     __ Set(ecx, Immediate(expr->name()));
-    ContextualMode mode = NOT_CONTEXTUAL;
-    Handle<Code> ic =
-        isolate()->stub_cache()->ComputeCallInitialize(arg_count, mode);
-    CallIC(ic, mode, expr->CallRuntimeFeedbackId());
+ Handle<Code> ic = isolate()->stub_cache()->ComputeCallInitialize(arg_count);
+    CallIC(ic, NOT_CONTEXTUAL, expr->CallRuntimeFeedbackId());
     // Restore context register.
     __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset));
   } else {
=======================================
--- /branches/bleeding_edge/src/ia32/lithium-codegen-ia32.cc Tue Jan 14 14:36:24 2014 UTC +++ /branches/bleeding_edge/src/ia32/lithium-codegen-ia32.cc Tue Jan 14 16:15:05 2014 UTC
@@ -4229,8 +4229,7 @@
   ASSERT(ToRegister(instr->result()).is(eax));

   int arity = instr->arity();
-  Handle<Code> ic =
- isolate()->stub_cache()->ComputeCallInitialize(arity, NOT_CONTEXTUAL);
+  Handle<Code> ic = isolate()->stub_cache()->ComputeCallInitialize(arity);
   __ mov(ecx, instr->name());
   CallCode(ic, RelocInfo::CODE_TARGET, instr);
 }
@@ -4257,8 +4256,7 @@
   ASSERT(ToRegister(instr->result()).is(eax));

   int arity = instr->arity();
-  Handle<Code> ic =
-      isolate()->stub_cache()->ComputeCallInitialize(arity, CONTEXTUAL);
+  Handle<Code> ic = isolate()->stub_cache()->ComputeCallInitialize(arity);
   __ mov(ecx, instr->name());
   CallCode(ic, RelocInfo::CODE_TARGET, instr);
 }
=======================================
--- /branches/bleeding_edge/src/ic.cc   Fri Jan 10 12:19:01 2014 UTC
+++ /branches/bleeding_edge/src/ic.cc   Tue Jan 14 16:15:05 2014 UTC
@@ -489,9 +489,8 @@

 void CallICBase::Clear(Address address, Code* target) {
   if (IsCleared(target)) return;
-  ContextualMode mode = IC::GetContextualMode(target->extra_ic_state());
   Code* code = target->GetIsolate()->stub_cache()->FindCallInitialize(
-      target->arguments_count(), mode, target->kind());
+      target->arguments_count(), target->kind());
   SetTargetAtAddress(address, code);
 }

=======================================
--- /branches/bleeding_edge/src/ic.h    Fri Jan 10 12:19:01 2014 UTC
+++ /branches/bleeding_edge/src/ic.h    Tue Jan 14 16:15:05 2014 UTC
@@ -124,7 +124,7 @@
   // access to properties.
   bool IsUndeclaredGlobal(Handle<Object> receiver) {
     if (receiver->IsGlobalObject()) {
-      return IsContextual();
+      return IsCallStub() || IsContextual();
     } else {
       ASSERT(!IsContextual());
       return false;
@@ -140,10 +140,10 @@
     return target()->is_store_stub() || target()->is_keyed_store_stub();
   }

+#endif
   bool IsCallStub() {
     return target()->is_call_stub() || target()->is_keyed_call_stub();
   }
-#endif

   // Determines which map must be used for keeping the code stub.
   // These methods should not be called with undefined or null.
@@ -323,10 +323,9 @@
 class CallICBase: public IC {
  public:
   // ExtraICState bits
-  class StringStubState: public BitField<StringStubFeedback, 1, 1> {};
-  static ExtraICState ComputeExtraICState(ContextualMode mode,
-                                          StringStubFeedback feedback) {
-    return Contextual::encode(mode) | StringStubState::encode(feedback);
+  class StringStubState: public BitField<StringStubFeedback, 0, 1> {};
+  static ExtraICState ComputeExtraICState(StringStubFeedback feedback) {
+    return StringStubState::encode(feedback);
   }

   // Returns a JSFunction or a Failure.
=======================================
--- /branches/bleeding_edge/src/stub-cache.cc   Tue Jan 14 14:36:24 2014 UTC
+++ /branches/bleeding_edge/src/stub-cache.cc   Tue Jan 14 16:15:05 2014 UTC
@@ -418,12 +418,9 @@
 }


-Code* StubCache::FindCallInitialize(int argc,
-                                    ContextualMode mode,
-                                    Code::Kind kind) {
+Code* StubCache::FindCallInitialize(int argc, Code::Kind kind) {
   ExtraICState extra_state =
-      CallICBase::StringStubState::encode(DEFAULT_STRING_STUB) |
-      CallICBase::Contextual::encode(mode);
+      CallICBase::StringStubState::encode(DEFAULT_STRING_STUB);
   Code::Flags flags =
Code::ComputeFlags(kind, UNINITIALIZED, extra_state, Code::NORMAL, argc);
   UnseededNumberDictionary* dictionary =
@@ -450,11 +447,9 @@
 }


-Handle<Code> StubCache::ComputeCallInitialize(int argc,
-                                              ContextualMode mode,
-                                              Code::Kind kind) {
+Handle<Code> StubCache::ComputeCallInitialize(int argc, Code::Kind kind) {
   ExtraICState extra_state =
-      CallICBase::ComputeExtraICState(mode, DEFAULT_STRING_STUB);
+      CallICBase::ComputeExtraICState(DEFAULT_STRING_STUB);
   Code::Flags flags =
Code::ComputeFlags(kind, UNINITIALIZED, extra_state, Code::NORMAL, argc);
   Handle<UnseededNumberDictionary> cache =
@@ -469,13 +464,13 @@
 }


-Handle<Code> StubCache::ComputeCallInitialize(int argc, ContextualMode mode) {
-  return ComputeCallInitialize(argc, mode, Code::CALL_IC);
+Handle<Code> StubCache::ComputeCallInitialize(int argc) {
+  return ComputeCallInitialize(argc, Code::CALL_IC);
 }


 Handle<Code> StubCache::ComputeKeyedCallInitialize(int argc) {
-  return ComputeCallInitialize(argc, NOT_CONTEXTUAL, Code::KEYED_CALL_IC);
+  return ComputeCallInitialize(argc, Code::KEYED_CALL_IC);
 }


=======================================
--- /branches/bleeding_edge/src/stub-cache.h    Tue Jan 14 14:36:24 2014 UTC
+++ /branches/bleeding_edge/src/stub-cache.h    Tue Jan 14 16:15:05 2014 UTC
@@ -138,7 +138,7 @@

   // ---

-  Handle<Code> ComputeCallInitialize(int argc, ContextualMode mode);
+  Handle<Code> ComputeCallInitialize(int argc);

   Handle<Code> ComputeKeyedCallInitialize(int argc);

@@ -185,7 +185,7 @@
                                     ExtraICState extra_ic_state);

   // Finds the Code object stored in the Heap::non_monomorphic_cache().
-  Code* FindCallInitialize(int argc, ContextualMode mode, Code::Kind kind);
+  Code* FindCallInitialize(int argc, Code::Kind kind);
   Code* FindPreMonomorphicIC(Code::Kind kind, ExtraICState extra_ic_state);

 #ifdef ENABLE_DEBUGGER_SUPPORT
@@ -269,9 +269,7 @@
  private:
   explicit StubCache(Isolate* isolate);

-  Handle<Code> ComputeCallInitialize(int argc,
-                                     ContextualMode mode,
-                                     Code::Kind kind);
+  Handle<Code> ComputeCallInitialize(int argc, Code::Kind kind);

   // The stub cache has a primary and secondary level.  The two levels have
   // different hashing algorithms in order to avoid simultaneous collisions
=======================================
--- /branches/bleeding_edge/src/type-info.cc    Tue Jan 14 14:36:24 2014 UTC
+++ /branches/bleeding_edge/src/type-info.cc    Tue Jan 14 16:15:05 2014 UTC
@@ -178,14 +178,11 @@
 void TypeFeedbackOracle::CallReceiverTypes(TypeFeedbackId id,
                                            Handle<String> name,
                                            int arity,
-                                           ContextualMode contextual_mode,
                                            SmallMapList* types) {
   // Note: Currently we do not take string extra ic data into account
   // here.
-  ExtraICState extra_ic_state =
-      CallIC::Contextual::encode(contextual_mode);
   Code::Flags flags = Code::ComputeMonomorphicFlags(
-      Code::CALL_IC, extra_ic_state, OWN_MAP, Code::NORMAL, arity);
+      Code::CALL_IC, kNoExtraICState, OWN_MAP, Code::NORMAL, arity);
   CollectReceiverTypes(id, name, flags, types);
 }

=======================================
--- /branches/bleeding_edge/src/type-info.h     Tue Jan 14 14:36:24 2014 UTC
+++ /branches/bleeding_edge/src/type-info.h     Tue Jan 14 16:15:05 2014 UTC
@@ -68,7 +68,6 @@
   void CallReceiverTypes(TypeFeedbackId id,
                          Handle<String> name,
                          int arity,
-                         ContextualMode contextual_mode,
                          SmallMapList* types);
   void PropertyReceiverTypes(TypeFeedbackId id,
                              Handle<String> name,
=======================================
--- /branches/bleeding_edge/src/typing.cc       Tue Jan 14 14:36:24 2014 UTC
+++ /branches/bleeding_edge/src/typing.cc       Tue Jan 14 16:15:05 2014 UTC
@@ -530,11 +530,8 @@


 void AstTyper::VisitCall(Call* expr) {
-  Expression* callee = expr->expression();
-  Property* prop = callee->AsProperty();
- ContextualMode contextual_mode = prop == NULL ? CONTEXTUAL : NOT_CONTEXTUAL;
   // Collect type feedback.
-  expr->RecordTypeFeedback(oracle(), contextual_mode);
+  expr->RecordTypeFeedback(oracle());

   RECURSE(Visit(expr->expression()));
   ZoneList<Expression*>* args = expr->arguments();
=======================================
--- /branches/bleeding_edge/src/x64/full-codegen-x64.cc Tue Jan 14 15:19:34 2014 UTC +++ /branches/bleeding_edge/src/x64/full-codegen-x64.cc Tue Jan 14 16:15:05 2014 UTC
@@ -2551,8 +2551,7 @@
   // Record source position for debugger.
   SetSourcePosition(expr->position());
   // Call the IC initialization code.
-  Handle<Code> ic =
-      isolate()->stub_cache()->ComputeCallInitialize(arg_count, mode);
+ Handle<Code> ic = isolate()->stub_cache()->ComputeCallInitialize(arg_count);
   TypeFeedbackId ast_id = mode == CONTEXTUAL
       ? TypeFeedbackId::None()
       : expr->CallFeedbackId();
@@ -4150,10 +4149,8 @@
   if (expr->is_jsruntime()) {
     // Call the JS runtime function using a call IC.
     __ Move(rcx, expr->name());
-    ContextualMode mode = NOT_CONTEXTUAL;
-    Handle<Code> ic =
-        isolate()->stub_cache()->ComputeCallInitialize(arg_count, mode);
-    CallIC(ic, mode, expr->CallRuntimeFeedbackId());
+ Handle<Code> ic = isolate()->stub_cache()->ComputeCallInitialize(arg_count);
+    CallIC(ic, NOT_CONTEXTUAL, expr->CallRuntimeFeedbackId());
     // Restore context register.
     __ movq(rsi, Operand(rbp, StandardFrameConstants::kContextOffset));
   } else {
=======================================
--- /branches/bleeding_edge/src/x64/lithium-codegen-x64.cc Tue Jan 14 14:36:24 2014 UTC +++ /branches/bleeding_edge/src/x64/lithium-codegen-x64.cc Tue Jan 14 16:15:05 2014 UTC
@@ -3801,8 +3801,7 @@
   ASSERT(ToRegister(instr->result()).is(rax));

   int arity = instr->arity();
-  Handle<Code> ic =
- isolate()->stub_cache()->ComputeCallInitialize(arity, NOT_CONTEXTUAL);
+  Handle<Code> ic = isolate()->stub_cache()->ComputeCallInitialize(arity);
   __ Move(rcx, instr->name());
   CallCode(ic, RelocInfo::CODE_TARGET, instr);
 }
@@ -3828,8 +3827,7 @@
   ASSERT(ToRegister(instr->context()).is(rsi));
   ASSERT(ToRegister(instr->result()).is(rax));
   int arity = instr->arity();
-  Handle<Code> ic =
-      isolate()->stub_cache()->ComputeCallInitialize(arity, CONTEXTUAL);
+  Handle<Code> ic = isolate()->stub_cache()->ComputeCallInitialize(arity);
   __ Move(rcx, instr->name());
   CallCode(ic, RelocInfo::CODE_TARGET, instr);
 }
=======================================
--- /branches/bleeding_edge/test/cctest/test-heap.cc Mon Jan 13 17:11:36 2014 UTC +++ /branches/bleeding_edge/test/cctest/test-heap.cc Tue Jan 14 16:15:05 2014 UTC
@@ -3090,7 +3090,7 @@
     HandleScope inner_scope(isolate);
     AlwaysAllocateScope always_allocate;
     SimulateFullSpace(heap->code_space());
-    isolate->stub_cache()->ComputeCallInitialize(9, NOT_CONTEXTUAL);
+    isolate->stub_cache()->ComputeCallInitialize(9);
   }

   // Second compile a CallIC and execute it once so that it gets patched to
=======================================
--- /branches/bleeding_edge/test/mjsunit/regress/regress-2284.js Mon Aug 13 15:34:49 2012 UTC +++ /branches/bleeding_edge/test/mjsunit/regress/regress-2284.js Tue Jan 14 16:15:05 2014 UTC
@@ -27,6 +27,6 @@

 // Flags: --allow-natives-syntax

-assertThrows("%foobar();", TypeError);
-assertThrows("%constructor();", TypeError);
-assertThrows("%constructor(23);", TypeError);
+assertThrows("%foobar();", Error);
+assertThrows("%constructor();", Error);
+assertThrows("%constructor(23);", Error);
=======================================
--- /branches/bleeding_edge/test/mjsunit/regress/regress-2286.js Thu Sep 20 09:55:19 2012 UTC +++ /branches/bleeding_edge/test/mjsunit/regress/regress-2286.js Tue Jan 14 16:15:05 2014 UTC
@@ -28,5 +28,5 @@
 // Flags: --allow-natives-syntax

 assertThrows("f()", ReferenceError);
-assertThrows("%f()", TypeError);
+assertThrows("%f()", Error);
 assertThrows("%_f()", SyntaxError);

--
--
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