Reviewers: Benedikt Meurer,

Message:
Hi Benedikt, one more cleanup in the series on the way to type vector. I found
this artifact of code which "needed" the type cell used in full code for
feedback, but as it turns out it isn't necessary at all.

This CL is part of breaking the requirement that the feedback be in a cell,
rather than a feedback vector slot.

PTAL, I'll get ports after your initial look,
--Michael

Description:
We no longer need to recover type cells from the oracle.

We only need the values within them. Function calls to Array from optimized code
needed the cell in the past, but no longer.


Please review this at https://codereview.chromium.org/141893002/

SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge

Affected files (+24, -44 lines):
  M src/ast.h
  M src/ast.cc
  M src/hydrogen-instructions.h
  M src/hydrogen.cc
  M src/ia32/lithium-codegen-ia32.cc
  M src/type-info.h
  M src/type-info.cc


Index: src/ast.cc
diff --git a/src/ast.cc b/src/ast.cc
index 566bcd2ce6f92e9ddfcfacb53853e37094f3cb42..c7e06d387341f37ab700dd9887bd2b3dd1ac9d90 100644
--- a/src/ast.cc
+++ b/src/ast.cc
@@ -756,16 +756,13 @@ void Call::RecordTypeFeedback(TypeFeedbackOracle* oracle) {


 void CallNew::RecordTypeFeedback(TypeFeedbackOracle* oracle) {
-  allocation_info_cell_ =
-      oracle->GetCallNewAllocationInfoCell(CallNewFeedbackId());
+  allocation_site_ =
+      oracle->GetCallNewAllocationSite(CallNewFeedbackId());
   is_monomorphic_ = oracle->CallNewIsMonomorphic(CallNewFeedbackId());
   if (is_monomorphic_) {
     target_ = oracle->GetCallNewTarget(CallNewFeedbackId());
-    Object* value = allocation_info_cell_->value();
-    ASSERT(!value->IsTheHole());
-    if (value->IsAllocationSite()) {
-      AllocationSite* site = AllocationSite::cast(value);
-      elements_kind_ = site->GetElementsKind();
+    if (!allocation_site_.is_null()) {
+      elements_kind_ = allocation_site_->GetElementsKind();
     }
   }
 }
Index: src/ast.h
diff --git a/src/ast.h b/src/ast.h
index f172c594f45f80278c27768024e7ff0264e2703e..fe457bd2f7eb2b29abf3b6bfbbfe4a0636905c1c 100644
--- a/src/ast.h
+++ b/src/ast.h
@@ -1837,8 +1837,8 @@ class CallNew V8_FINAL : public Expression {
   virtual bool IsMonomorphic() V8_OVERRIDE { return is_monomorphic_; }
   Handle<JSFunction> target() const { return target_; }
   ElementsKind elements_kind() const { return elements_kind_; }
-  Handle<Cell> allocation_info_cell() const {
-    return allocation_info_cell_;
+  Handle<AllocationSite> allocation_site() const {
+    return allocation_site_;
   }

   BailoutId ReturnId() const { return return_id_; }
@@ -1862,7 +1862,7 @@ class CallNew V8_FINAL : public Expression {
   bool is_monomorphic_;
   Handle<JSFunction> target_;
   ElementsKind elements_kind_;
-  Handle<Cell> allocation_info_cell_;
+  Handle<AllocationSite> allocation_site_;

   const BailoutId return_id_;
 };
Index: src/hydrogen-instructions.h
diff --git a/src/hydrogen-instructions.h b/src/hydrogen-instructions.h
index fdf5953caa9389b8e5d8acbf4a8d93b3678941f1..f7cbbee51a2b1caeeaa3161edef631d2c27e245a 100644
--- a/src/hydrogen-instructions.h
+++ b/src/hydrogen-instructions.h
@@ -2510,10 +2510,9 @@ class HCallNew V8_FINAL : public HBinaryCall {

 class HCallNewArray V8_FINAL : public HBinaryCall {
  public:
-  DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P4(HCallNewArray,
+  DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P3(HCallNewArray,
                                               HValue*,
                                               int,
-                                              Handle<Cell>,
                                               ElementsKind);

   HValue* context() { return first(); }
@@ -2521,23 +2520,17 @@ class HCallNewArray V8_FINAL : public HBinaryCall {

   virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;

-  Handle<Cell> property_cell() const {
-    return type_cell_;
-  }
-
   ElementsKind elements_kind() const { return elements_kind_; }

   DECLARE_CONCRETE_INSTRUCTION(CallNewArray)

  private:
   HCallNewArray(HValue* context, HValue* constructor, int argument_count,
-                Handle<Cell> type_cell, ElementsKind elements_kind)
+                ElementsKind elements_kind)
       : HBinaryCall(context, constructor, argument_count),
-        elements_kind_(elements_kind),
-        type_cell_(type_cell) {}
+        elements_kind_(elements_kind) {}

   ElementsKind elements_kind_;
-  Handle<Cell> type_cell_;
 };


Index: src/hydrogen.cc
diff --git a/src/hydrogen.cc b/src/hydrogen.cc
index 54e7ee82b93e747a1089cf6d4220a41696a38cc0..63b6da7e8b29b792e9bb6403f365bb3bda325615 100644
--- a/src/hydrogen.cc
+++ b/src/hydrogen.cc
@@ -7944,8 +7944,8 @@ void HOptimizedGraphBuilder::BuildInlinedCallNewArray(CallNew* expr) {
   HValue* constructor = environment()->ExpressionStackAt(argument_count);

   ElementsKind kind = expr->elements_kind();
-  Handle<Cell> cell = expr->allocation_info_cell();
-  Handle<AllocationSite> site(AllocationSite::cast(cell->value()));
+  Handle<AllocationSite> site = expr->allocation_site();
+  ASSERT(!site.is_null());

// Register on the site for deoptimization if the transition feedback changes.
   AllocationSite::AddDependentCompilationInfo(
@@ -8019,8 +8019,9 @@ bool HOptimizedGraphBuilder::IsCallNewArrayInlineable(CallNew* expr) {
   int argument_count = expr->arguments()->length();
// We should have the function plus array arguments on the environment stack.
   ASSERT(environment()->length() >= (argument_count + 1));
-  Handle<Cell> cell = expr->allocation_info_cell();
-  AllocationSite* site = AllocationSite::cast(cell->value());
+  Handle<AllocationSite> site = expr->allocation_site();
+  ASSERT(!site.is_null());
+
   if (site->CanInlineCall()) {
     // We also want to avoid inlining in certain 1 argument scenarios.
     if (argument_count == 1) {
@@ -8159,7 +8160,6 @@ void HOptimizedGraphBuilder::VisitCallNew(CallNew* expr) {
     Handle<JSFunction> array_function(
         isolate()->global_context()->array_function(), isolate());
bool use_call_new_array = expr->target().is_identical_to(array_function);
-    Handle<Cell> cell = expr->allocation_info_cell();
     if (use_call_new_array && IsCallNewArrayInlineable(expr)) {
// Verify we are still calling the array function for our native context.
       Add<HCheckValue>(function, array_function);
@@ -8170,7 +8170,7 @@ void HOptimizedGraphBuilder::VisitCallNew(CallNew* expr) {
     HBinaryCall* call;
     if (use_call_new_array) {
       Add<HCheckValue>(function, array_function);
-      call = New<HCallNewArray>(function, argument_count, cell,
+      call = New<HCallNewArray>(function, argument_count,
                                 expr->elements_kind());
     } else {
       call = New<HCallNew>(function, argument_count);
Index: src/ia32/lithium-codegen-ia32.cc
diff --git a/src/ia32/lithium-codegen-ia32.cc b/src/ia32/lithium-codegen-ia32.cc index 7b50de78d6f63fbc8e605a28f3fb0b0c69f2c11e..fc47c50b6f9f84495553b235d86dade27f414a53 100644
--- a/src/ia32/lithium-codegen-ia32.cc
+++ b/src/ia32/lithium-codegen-ia32.cc
@@ -4290,7 +4290,7 @@ void LCodeGen::DoCallNewArray(LCallNewArray* instr) {
   ASSERT(ToRegister(instr->result()).is(eax));

   __ Set(eax, Immediate(instr->arity()));
-  __ mov(ebx, instr->hydrogen()->property_cell());
+  __ mov(ebx, factory()->undefined_value());
   ElementsKind kind = instr->hydrogen()->elements_kind();
   AllocationSiteOverrideMode override_mode =
       (AllocationSite::GetMode(kind) == TRACK_ALLOCATION_SITE)
Index: src/type-info.cc
diff --git a/src/type-info.cc b/src/type-info.cc
index b90e0d501013d9a3b90de9ea9e61184549dad87e..b8805215b7950eefa9d1871ab56a6f1cec5f4b94 100644
--- a/src/type-info.cc
+++ b/src/type-info.cc
@@ -74,17 +74,6 @@ Handle<Object> TypeFeedbackOracle::GetInfo(TypeFeedbackId ast_id) {
 }


-Handle<Cell> TypeFeedbackOracle::GetInfoCell(
-    TypeFeedbackId ast_id) {
-  int entry = dictionary_->FindEntry(IdToKey(ast_id));
-  if (entry != UnseededNumberDictionary::kNotFound) {
-    Cell* cell = Cell::cast(dictionary_->ValueAt(entry));
-    return Handle<Cell>(cell, isolate_);
-  }
-  return Handle<Cell>::null();
-}
-
-
 bool TypeFeedbackOracle::LoadIsUninitialized(TypeFeedbackId id) {
   Handle<Object> maybe_code = GetInfo(id);
   if (maybe_code->IsCode()) {
@@ -214,9 +203,13 @@ Handle<JSFunction> TypeFeedbackOracle::GetCallNewTarget(TypeFeedbackId id) {
 }


-Handle<Cell> TypeFeedbackOracle::GetCallNewAllocationInfoCell(
+Handle<AllocationSite> TypeFeedbackOracle::GetCallNewAllocationSite(
     TypeFeedbackId id) {
-  return GetInfoCell(id);
+  Handle<Object> info = GetInfo(id);
+  if (info->IsAllocationSite()) {
+    return Handle<AllocationSite>::cast(info);
+  }
+  return Handle<AllocationSite>::null();
 }


Index: src/type-info.h
diff --git a/src/type-info.h b/src/type-info.h
index b5d7c599bc230638acab9e3d8b7ca85d990007de..a82f0c0c2a9cf12ff6d213350c4769fb9de5d550 100644
--- a/src/type-info.h
+++ b/src/type-info.h
@@ -95,7 +95,7 @@ class TypeFeedbackOracle: public ZoneObject {
   CheckType GetCallCheckType(TypeFeedbackId id);
   Handle<JSFunction> GetCallTarget(TypeFeedbackId id);
   Handle<JSFunction> GetCallNewTarget(TypeFeedbackId id);
-  Handle<Cell> GetCallNewAllocationInfoCell(TypeFeedbackId id);
+  Handle<AllocationSite> GetCallNewAllocationSite(TypeFeedbackId id);

   bool LoadIsBuiltin(TypeFeedbackId id, Builtins::Name builtin_id);
   bool LoadIsStub(TypeFeedbackId id, ICStub* stub);
@@ -145,9 +145,6 @@ class TypeFeedbackOracle: public ZoneObject {
   // there is no information.
   Handle<Object> GetInfo(TypeFeedbackId id);

-  // Return the cell that contains type feedback.
-  Handle<Cell> GetInfoCell(TypeFeedbackId id);
-
  private:
   Handle<Context> native_context_;
   Isolate* isolate_;


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