Disinherit PropertyCell from Cell
authorverwaest <verwaest@chromium.org>
Wed, 18 Mar 2015 12:54:02 +0000 (05:54 -0700)
committerCommit bot <commit-bot@chromium.org>
Wed, 18 Mar 2015 12:54:17 +0000 (12:54 +0000)
BUG=

Review URL: https://codereview.chromium.org/1015983003

Cr-Commit-Position: refs/heads/master@{#27274}

src/arm/lithium-codegen-arm.cc
src/arm64/lithium-codegen-arm64.cc
src/ast.cc
src/ast.h
src/code-stubs-hydrogen.cc
src/heap-snapshot-generator.cc
src/hydrogen-instructions.cc
src/hydrogen-instructions.h
src/ic/arm/handler-compiler-arm.cc
src/ic/arm64/handler-compiler-arm64.cc
src/objects.h

index 9d0872a7e1531fbe5b70d75a36b8c306747c3a98..a5a3f9b04e23100b6a6393acac08c983e431f5ba 100644 (file)
@@ -2827,8 +2827,8 @@ void LCodeGen::DoInstanceOfKnownGlobal(LInstanceOfKnownGlobal* instr) {
     // root array to force relocation to be able to later patch with
     // the cached map.
     Handle<Cell> cell = factory()->NewCell(factory()->the_hole_value());
-    __ mov(ip, Operand(Handle<Object>(cell)));
-    __ ldr(ip, FieldMemOperand(ip, PropertyCell::kValueOffset));
+    __ mov(ip, Operand(cell));
+    __ ldr(ip, FieldMemOperand(ip, Cell::kValueOffset));
     __ cmp(map, Operand(ip));
     __ b(ne, &cache_miss);
     __ bind(deferred->load_bool());  // Label for calculating code patching.
@@ -5198,7 +5198,7 @@ void LCodeGen::DoCheckValue(LCheckValue* instr) {
   if (isolate()->heap()->InNewSpace(*object)) {
     Register reg = ToRegister(instr->value());
     Handle<Cell> cell = isolate()->factory()->NewCell(object);
-    __ mov(ip, Operand(Handle<Object>(cell)));
+    __ mov(ip, Operand(cell));
     __ ldr(ip, FieldMemOperand(ip, Cell::kValueOffset));
     __ cmp(reg, ip);
   } else {
index 35fed1e5c5302ddf356599923f73bfd58e381976..98732683989d2906775a25e389566108b8291803 100644 (file)
@@ -2657,7 +2657,7 @@ void LCodeGen::DoCheckValue(LCheckValue* instr) {
     UseScratchRegisterScope temps(masm());
     Register temp = temps.AcquireX();
     Handle<Cell> cell = isolate()->factory()->NewCell(object);
-    __ Mov(temp, Operand(Handle<Object>(cell)));
+    __ Mov(temp, Operand(cell));
     __ Ldr(temp, FieldMemOperand(temp, Cell::kValueOffset));
     __ Cmp(reg, temp);
   } else {
@@ -3132,8 +3132,8 @@ void LCodeGen::DoInstanceOfKnownGlobal(LInstanceOfKnownGlobal* instr) {
     __ bind(&map_check);
     // Will be patched with the cached map.
     Handle<Cell> cell = factory()->NewCell(factory()->the_hole_value());
-    __ ldr(scratch, Immediate(Handle<Object>(cell)));
-    __ ldr(scratch, FieldMemOperand(scratch, PropertyCell::kValueOffset));
+    __ ldr(scratch, Immediate(cell));
+    __ ldr(scratch, FieldMemOperand(scratch, Cell::kValueOffset));
     __ cmp(map, scratch);
     __ b(&cache_miss, ne);
     // The address of this instruction is computed relative to the map check
index 482c2e6cb74ec776a37a91bf2ac551ca49c82502..1ef5ab3aac4b1fb560a93bf4144dcdeaded77b5e 100644 (file)
@@ -625,11 +625,10 @@ Call::CallType Call::GetCallType(Isolate* isolate) const {
 bool Call::ComputeGlobalTarget(Handle<GlobalObject> global,
                                LookupIterator* it) {
   target_ = Handle<JSFunction>::null();
-  cell_ = Handle<Cell>::null();
   DCHECK(it->IsFound() && it->GetHolder<JSObject>().is_identical_to(global));
-  cell_ = it->GetPropertyCell();
-  if (cell_->value()->IsJSFunction()) {
-    Handle<JSFunction> candidate(JSFunction::cast(cell_->value()));
+  Handle<PropertyCell> cell = it->GetPropertyCell();
+  if (cell->value()->IsJSFunction()) {
+    Handle<JSFunction> candidate(JSFunction::cast(cell->value()));
     // If the function is in new space we assume it's more likely to
     // change and thus prefer the general IC code.
     if (!it->isolate()->heap()->InNewSpace(*candidate)) {
index af06be70da1fa888f2ca14596c8d57390ad04d65..661b5f962d86723482c0f08b2c574413787b4f21 100644 (file)
--- a/src/ast.h
+++ b/src/ast.h
@@ -1847,8 +1847,6 @@ class Call FINAL : public Expression {
 
   Handle<JSFunction> target() { return target_; }
 
-  Handle<Cell> cell() { return cell_; }
-
   Handle<AllocationSite> allocation_site() { return allocation_site_; }
 
   void set_target(Handle<JSFunction> target) { target_ = target; }
@@ -1910,7 +1908,6 @@ class Call FINAL : public Expression {
   Expression* expression_;
   ZoneList<Expression*>* arguments_;
   Handle<JSFunction> target_;
-  Handle<Cell> cell_;
   Handle<AllocationSite> allocation_site_;
   class IsUninitializedField : public BitField8<bool, 0, 1> {};
   uint8_t bit_field_;
index 58b80d03a561556a026f9eae8bb48249b6fec0a5..599e3c6412e2fad6171b4f09b3e5ab0f23d3f24b 100644 (file)
@@ -1340,7 +1340,7 @@ HValue* CodeStubGraphBuilder<StoreGlobalStub>::BuildCodeInitializedStub() {
   HValue* cell = Add<HLoadNamedField>(weak_cell, nullptr,
                                       HObjectAccess::ForWeakCellValue());
   Add<HCheckHeapObject>(cell);
-  HObjectAccess access(HObjectAccess::ForCellPayload(isolate()));
+  HObjectAccess access = HObjectAccess::ForPropertyCellValue();
   HValue* cell_contents = Add<HLoadNamedField>(cell, nullptr, access);
 
   if (stub->is_constant()) {
index 812311f7c8f1be51559cbf575eac937897f81ad2..5864ad9b43fb9e82cf55b8e35a0bd0a3749d3ee7 100644 (file)
@@ -1512,7 +1512,8 @@ void V8HeapExplorer::ExtractCellReferences(int entry, Cell* cell) {
 
 void V8HeapExplorer::ExtractPropertyCellReferences(int entry,
                                                    PropertyCell* cell) {
-  ExtractCellReferences(entry, cell);
+  SetInternalReference(cell, entry, "value", cell->value(),
+                       PropertyCell::kValueOffset);
   MarkAsWeakContainer(cell->dependent_code());
   SetInternalReference(cell, entry, "dependent_code", cell->dependent_code(),
                        PropertyCell::kDependentCodeOffset);
index 76a6b524f1d64d2a1ea940696d511c7ce2b434b7..a3436ed94d771602947fade2df9eacdca9237e82 100644 (file)
@@ -4603,12 +4603,6 @@ HObjectAccess HObjectAccess::ForField(Handle<Map> map, int index,
 }
 
 
-HObjectAccess HObjectAccess::ForCellPayload(Isolate* isolate) {
-  return HObjectAccess(kInobject, Cell::kValueOffset, Representation::Tagged(),
-                       isolate->factory()->cell_value_string());
-}
-
-
 void HObjectAccess::SetGVNFlags(HValue *instr, PropertyAccessType access_type) {
   // set the appropriate GVN flags for a given load or store instruction
   if (access_type == STORE) {
index 388c079742facfc0b7ba38c4dbae1ff825eb6c6c..8219f3ed2200af69a9e1bae3e97c179300f60b4f 100644 (file)
@@ -6138,9 +6138,6 @@ class HObjectAccess FINAL {
                                 Representation representation,
                                 Handle<String> name);
 
-  // Create an access for the payload of a Cell or JSGlobalPropertyCell.
-  static HObjectAccess ForCellPayload(Isolate* isolate);
-
   static HObjectAccess ForJSTypedArrayLength() {
     return HObjectAccess::ForObservableJSObjectOffset(
         JSTypedArray::kLengthOffset);
index 3cf3a44afa0aa2ed71f348722c72e88609553f32..28f3cef84029cdb5965f98edd2092dd8b1427ffb 100644 (file)
@@ -197,11 +197,11 @@ void NamedLoadHandlerCompiler::GenerateLoadFunctionPrototype(
 void PropertyHandlerCompiler::GenerateCheckPropertyCell(
     MacroAssembler* masm, Handle<JSGlobalObject> global, Handle<Name> name,
     Register scratch, Label* miss) {
-  Handle<Cell> cell = JSGlobalObject::EnsurePropertyCell(global, name);
+  Handle<PropertyCell> cell = JSGlobalObject::EnsurePropertyCell(global, name);
   DCHECK(cell->value()->IsTheHole());
   Handle<WeakCell> weak_cell = masm->isolate()->factory()->NewWeakCell(cell);
   __ LoadWeakValue(scratch, weak_cell, miss);
-  __ ldr(scratch, FieldMemOperand(scratch, Cell::kValueOffset));
+  __ ldr(scratch, FieldMemOperand(scratch, PropertyCell::kValueOffset));
   __ LoadRoot(ip, Heap::kTheHoleValueRootIndex);
   __ cmp(scratch, ip);
   __ b(ne, miss);
index de1b9f598fee07449ac1aa4adb674d3d2a4cf8f2..b15d5a190fca6d83c4d37497d4a2719de82d8a41 100644 (file)
@@ -109,11 +109,11 @@ void NamedLoadHandlerCompiler::GenerateLoadFunctionPrototype(
 void PropertyHandlerCompiler::GenerateCheckPropertyCell(
     MacroAssembler* masm, Handle<JSGlobalObject> global, Handle<Name> name,
     Register scratch, Label* miss) {
-  Handle<Cell> cell = JSGlobalObject::EnsurePropertyCell(global, name);
+  Handle<PropertyCell> cell = JSGlobalObject::EnsurePropertyCell(global, name);
   DCHECK(cell->value()->IsTheHole());
   Handle<WeakCell> weak_cell = masm->isolate()->factory()->NewWeakCell(cell);
   __ LoadWeakValue(scratch, weak_cell, miss);
-  __ Ldr(scratch, FieldMemOperand(scratch, Cell::kValueOffset));
+  __ Ldr(scratch, FieldMemOperand(scratch, PropertyCell::kValueOffset));
   __ JumpIfNotRoot(scratch, Heap::kTheHoleValueRootIndex, miss);
 }
 
index 771e59e43d048ccca158abbf1ac67fd97f0e3f59..3f6f50be72768f31fb27014a5d56b37ec46c6aa8 100644 (file)
 //       - Symbol
 //     - HeapNumber
 //     - Cell
-//       - PropertyCell
+//     - PropertyCell
 //     - Code
 //     - Map
 //     - Oddball
@@ -9724,7 +9724,7 @@ class Cell: public HeapObject {
 };
 
 
-class PropertyCell: public Cell {
+class PropertyCell : public HeapObject {
  public:
   // [value]: value of the global property.
   DECL_ACCESSORS(value, Object)
@@ -9754,6 +9754,7 @@ class PropertyCell: public Cell {
   DECLARE_VERIFIER(PropertyCell)
 
   // Layout description.
+  static const int kValueOffset = HeapObject::kHeaderSize;
   static const int kDependentCodeOffset = kValueOffset + kPointerSize;
   static const int kSize = kDependentCodeOffset + kPointerSize;