From 036d23ec734aea43e4801b36295c3b3ec86ca66a Mon Sep 17 00:00:00 2001 From: verwaest Date: Tue, 16 Feb 2016 05:28:12 -0800 Subject: [PATCH] Don't include field-type.h/field-index.h into property.h BUG= Review URL: https://codereview.chromium.org/1696333002 Cr-Commit-Position: refs/heads/master@{#34035} --- src/compiler/access-info.cc | 1 + src/crankshaft/hydrogen-types.cc | 1 + src/crankshaft/hydrogen.cc | 8 ++++++++ src/crankshaft/hydrogen.h | 7 +------ src/d8.cc | 1 + src/ic/arm/handler-compiler-arm.cc | 4 +++- src/ic/arm64/handler-compiler-arm64.cc | 4 +++- src/ic/handler-compiler.cc | 3 ++- src/ic/ia32/handler-compiler-ia32.cc | 4 +++- src/ic/ic.cc | 1 + src/ic/mips/handler-compiler-mips.cc | 4 +++- src/ic/mips64/handler-compiler-mips64.cc | 4 +++- src/ic/ppc/handler-compiler-ppc.cc | 4 +++- src/ic/x64/handler-compiler-x64.cc | 4 +++- src/ic/x87/handler-compiler-x87.cc | 4 +++- src/json-parser.h | 1 + src/lookup.cc | 1 + src/objects-debug.cc | 1 + src/objects-inl.h | 11 ----------- src/objects.cc | 12 +++++++++++- src/objects.h | 2 +- src/property.cc | 6 ++++++ src/property.h | 6 +----- src/regexp/regexp-parser.cc | 1 + src/runtime/runtime-interpreter.cc | 1 + test/cctest/heap/test-heap.cc | 1 + test/cctest/test-field-type-tracking.cc | 1 + test/cctest/test-transitions.cc | 1 + test/cctest/test-unboxed-doubles.cc | 1 + 29 files changed, 67 insertions(+), 33 deletions(-) diff --git a/src/compiler/access-info.cc b/src/compiler/access-info.cc index 38f0d6bbce..988661149c 100644 --- a/src/compiler/access-info.cc +++ b/src/compiler/access-info.cc @@ -8,6 +8,7 @@ #include "src/compilation-dependencies.h" #include "src/compiler/access-info.h" #include "src/field-index-inl.h" +#include "src/field-type.h" #include "src/objects-inl.h" // TODO(mstarzinger): Temporary cycle breaker! #include "src/type-cache.h" diff --git a/src/crankshaft/hydrogen-types.cc b/src/crankshaft/hydrogen-types.cc index 001235c03e..8c8562581a 100644 --- a/src/crankshaft/hydrogen-types.cc +++ b/src/crankshaft/hydrogen-types.cc @@ -4,6 +4,7 @@ #include "src/crankshaft/hydrogen-types.h" +#include "src/field-type.h" #include "src/handles-inl.h" #include "src/ostreams.h" diff --git a/src/crankshaft/hydrogen.cc b/src/crankshaft/hydrogen.cc index 526f3d7238..915383b81d 100644 --- a/src/crankshaft/hydrogen.cc +++ b/src/crankshaft/hydrogen.cc @@ -34,6 +34,7 @@ #include "src/crankshaft/hydrogen-uint32-analysis.h" #include "src/crankshaft/lithium-allocator.h" #include "src/crankshaft/typing.h" +#include "src/field-type.h" #include "src/full-codegen/full-codegen.h" #include "src/ic/call-optimization.h" #include "src/ic/ic.h" @@ -6258,6 +6259,13 @@ HInstruction* HOptimizedGraphBuilder::BuildStoreNamedField( return instr; } +Handle +HOptimizedGraphBuilder::PropertyAccessInfo::GetFieldTypeFromMap( + Handle map) const { + DCHECK(IsFound()); + DCHECK(number_ < map->NumberOfOwnDescriptors()); + return handle(map->instance_descriptors()->GetFieldType(number_), isolate()); +} bool HOptimizedGraphBuilder::PropertyAccessInfo::IsCompatible( PropertyAccessInfo* info) { diff --git a/src/crankshaft/hydrogen.h b/src/crankshaft/hydrogen.h index 6f45400f44..1ae53eeade 100644 --- a/src/crankshaft/hydrogen.h +++ b/src/crankshaft/hydrogen.h @@ -2622,12 +2622,7 @@ class HOptimizedGraphBuilder : public HGraphBuilder, public AstVisitor { Handle GetAccessorsFromMap(Handle map) const { return GetConstantFromMap(map); } - Handle GetFieldTypeFromMap(Handle map) const { - DCHECK(IsFound()); - DCHECK(number_ < map->NumberOfOwnDescriptors()); - return handle(map->instance_descriptors()->GetFieldType(number_), - isolate()); - } + Handle GetFieldTypeFromMap(Handle map) const; Handle GetFieldOwnerFromMap(Handle map) const { DCHECK(IsFound()); DCHECK(number_ < map->NumberOfOwnDescriptors()); diff --git a/src/d8.cc b/src/d8.cc index e35b6a7fbc..ae345dd2c7 100644 --- a/src/d8.cc +++ b/src/d8.cc @@ -35,6 +35,7 @@ #endif #include "src/d8.h" +#include "src/ostreams.h" #include "include/libplatform/libplatform.h" #ifndef V8_SHARED diff --git a/src/ic/arm/handler-compiler-arm.cc b/src/ic/arm/handler-compiler-arm.cc index 9207d22c1a..5f2b861d08 100644 --- a/src/ic/arm/handler-compiler-arm.cc +++ b/src/ic/arm/handler-compiler-arm.cc @@ -4,8 +4,10 @@ #if V8_TARGET_ARCH_ARM -#include "src/ic/call-optimization.h" #include "src/ic/handler-compiler.h" + +#include "src/field-type.h" +#include "src/ic/call-optimization.h" #include "src/ic/ic.h" #include "src/isolate-inl.h" diff --git a/src/ic/arm64/handler-compiler-arm64.cc b/src/ic/arm64/handler-compiler-arm64.cc index 47a450d15c..51ae3b50cf 100644 --- a/src/ic/arm64/handler-compiler-arm64.cc +++ b/src/ic/arm64/handler-compiler-arm64.cc @@ -4,8 +4,10 @@ #if V8_TARGET_ARCH_ARM64 -#include "src/ic/call-optimization.h" #include "src/ic/handler-compiler.h" + +#include "src/field-type.h" +#include "src/ic/call-optimization.h" #include "src/ic/ic.h" #include "src/isolate-inl.h" diff --git a/src/ic/handler-compiler.cc b/src/ic/handler-compiler.cc index dfbb54fc1a..80e24e656e 100644 --- a/src/ic/handler-compiler.cc +++ b/src/ic/handler-compiler.cc @@ -4,9 +4,10 @@ #include "src/ic/handler-compiler.h" +#include "src/field-type.h" #include "src/ic/call-optimization.h" -#include "src/ic/ic.h" #include "src/ic/ic-inl.h" +#include "src/ic/ic.h" #include "src/isolate-inl.h" #include "src/profiler/cpu-profiler.h" diff --git a/src/ic/ia32/handler-compiler-ia32.cc b/src/ic/ia32/handler-compiler-ia32.cc index 60c9536720..3bdddf9b6d 100644 --- a/src/ic/ia32/handler-compiler-ia32.cc +++ b/src/ic/ia32/handler-compiler-ia32.cc @@ -4,8 +4,10 @@ #if V8_TARGET_ARCH_IA32 -#include "src/ic/call-optimization.h" #include "src/ic/handler-compiler.h" + +#include "src/field-type.h" +#include "src/ic/call-optimization.h" #include "src/ic/ic.h" #include "src/isolate-inl.h" diff --git a/src/ic/ic.cc b/src/ic/ic.cc index 921910690c..757b5b5b62 100644 --- a/src/ic/ic.cc +++ b/src/ic/ic.cc @@ -11,6 +11,7 @@ #include "src/codegen.h" #include "src/conversions.h" #include "src/execution.h" +#include "src/field-type.h" #include "src/frames-inl.h" #include "src/ic/call-optimization.h" #include "src/ic/handler-compiler.h" diff --git a/src/ic/mips/handler-compiler-mips.cc b/src/ic/mips/handler-compiler-mips.cc index 2828409b17..f3af1cf537 100644 --- a/src/ic/mips/handler-compiler-mips.cc +++ b/src/ic/mips/handler-compiler-mips.cc @@ -4,8 +4,10 @@ #if V8_TARGET_ARCH_MIPS -#include "src/ic/call-optimization.h" #include "src/ic/handler-compiler.h" + +#include "src/field-type.h" +#include "src/ic/call-optimization.h" #include "src/ic/ic.h" #include "src/isolate-inl.h" diff --git a/src/ic/mips64/handler-compiler-mips64.cc b/src/ic/mips64/handler-compiler-mips64.cc index b9bb1955c5..968effdd7f 100644 --- a/src/ic/mips64/handler-compiler-mips64.cc +++ b/src/ic/mips64/handler-compiler-mips64.cc @@ -4,8 +4,10 @@ #if V8_TARGET_ARCH_MIPS64 -#include "src/ic/call-optimization.h" #include "src/ic/handler-compiler.h" + +#include "src/field-type.h" +#include "src/ic/call-optimization.h" #include "src/ic/ic.h" #include "src/isolate-inl.h" diff --git a/src/ic/ppc/handler-compiler-ppc.cc b/src/ic/ppc/handler-compiler-ppc.cc index 830626b104..6e7d78afd3 100644 --- a/src/ic/ppc/handler-compiler-ppc.cc +++ b/src/ic/ppc/handler-compiler-ppc.cc @@ -4,8 +4,10 @@ #if V8_TARGET_ARCH_PPC -#include "src/ic/call-optimization.h" #include "src/ic/handler-compiler.h" + +#include "src/field-type.h" +#include "src/ic/call-optimization.h" #include "src/ic/ic.h" #include "src/isolate-inl.h" diff --git a/src/ic/x64/handler-compiler-x64.cc b/src/ic/x64/handler-compiler-x64.cc index 85f0973e16..ac3dd9a367 100644 --- a/src/ic/x64/handler-compiler-x64.cc +++ b/src/ic/x64/handler-compiler-x64.cc @@ -4,8 +4,10 @@ #if V8_TARGET_ARCH_X64 -#include "src/ic/call-optimization.h" #include "src/ic/handler-compiler.h" + +#include "src/field-type.h" +#include "src/ic/call-optimization.h" #include "src/ic/ic.h" #include "src/isolate-inl.h" diff --git a/src/ic/x87/handler-compiler-x87.cc b/src/ic/x87/handler-compiler-x87.cc index 353689e4ea..1b25f06347 100644 --- a/src/ic/x87/handler-compiler-x87.cc +++ b/src/ic/x87/handler-compiler-x87.cc @@ -4,8 +4,10 @@ #if V8_TARGET_ARCH_X87 -#include "src/ic/call-optimization.h" #include "src/ic/handler-compiler.h" + +#include "src/field-type.h" +#include "src/ic/call-optimization.h" #include "src/ic/ic.h" #include "src/isolate-inl.h" diff --git a/src/json-parser.h b/src/json-parser.h index 0ee1c85581..5944428104 100644 --- a/src/json-parser.h +++ b/src/json-parser.h @@ -9,6 +9,7 @@ #include "src/conversions.h" #include "src/debug/debug.h" #include "src/factory.h" +#include "src/field-type.h" #include "src/messages.h" #include "src/parsing/scanner.h" #include "src/parsing/token.h" diff --git a/src/lookup.cc b/src/lookup.cc index 8dec50280e..6d5a60205f 100644 --- a/src/lookup.cc +++ b/src/lookup.cc @@ -7,6 +7,7 @@ #include "src/bootstrapper.h" #include "src/deoptimizer.h" #include "src/elements.h" +#include "src/field-type.h" #include "src/isolate-inl.h" namespace v8 { diff --git a/src/objects-debug.cc b/src/objects-debug.cc index fafa80d7e0..ef3d461df1 100644 --- a/src/objects-debug.cc +++ b/src/objects-debug.cc @@ -7,6 +7,7 @@ #include "src/bootstrapper.h" #include "src/disasm.h" #include "src/disassembler.h" +#include "src/field-type.h" #include "src/macro-assembler.h" #include "src/ostreams.h" #include "src/regexp/jsregexp.h" diff --git a/src/objects-inl.h b/src/objects-inl.h index 83f46e3484..9f4a843043 100644 --- a/src/objects-inl.h +++ b/src/objects-inl.h @@ -2813,17 +2813,6 @@ int DescriptorArray::GetFieldIndex(int descriptor_number) { return GetDetails(descriptor_number).field_index(); } -FieldType* DescriptorArray::GetFieldType(int descriptor_number) { - DCHECK(GetDetails(descriptor_number).location() == kField); - Object* value = GetValue(descriptor_number); - if (value->IsWeakCell()) { - if (WeakCell::cast(value)->cleared()) return FieldType::None(); - value = WeakCell::cast(value)->value(); - } - return FieldType::cast(value); -} - - Object* DescriptorArray::GetConstant(int descriptor_number) { return GetValue(descriptor_number); } diff --git a/src/objects.cc b/src/objects.cc index 680abc36ab..ae0572e5ff 100644 --- a/src/objects.cc +++ b/src/objects.cc @@ -25,8 +25,9 @@ #include "src/deoptimizer.h" #include "src/elements.h" #include "src/execution.h" -#include "src/field-index.h" #include "src/field-index-inl.h" +#include "src/field-index.h" +#include "src/field-type.h" #include "src/full-codegen/full-codegen.h" #include "src/ic/ic.h" #include "src/identity-map.h" @@ -9906,6 +9907,15 @@ Handle Map::CopyForPreventExtensions(Handle map, return new_map; } +FieldType* DescriptorArray::GetFieldType(int descriptor_number) { + DCHECK(GetDetails(descriptor_number).location() == kField); + Object* value = GetValue(descriptor_number); + if (value->IsWeakCell()) { + if (WeakCell::cast(value)->cleared()) return FieldType::None(); + value = WeakCell::cast(value)->value(); + } + return FieldType::cast(value); +} bool DescriptorArray::CanHoldValue(int descriptor, Object* value) { PropertyDetails details = GetDetails(descriptor); diff --git a/src/objects.h b/src/objects.h index f43210c7f6..bd0470cc6e 100644 --- a/src/objects.h +++ b/src/objects.h @@ -2973,7 +2973,7 @@ class DescriptorArray: public FixedArray { inline PropertyDetails GetDetails(int descriptor_number); inline PropertyType GetType(int descriptor_number); inline int GetFieldIndex(int descriptor_number); - inline FieldType* GetFieldType(int descriptor_number); + FieldType* GetFieldType(int descriptor_number); inline Object* GetConstant(int descriptor_number); inline Object* GetCallbacksObject(int descriptor_number); inline AccessorDescriptor* GetCallbacks(int descriptor_number); diff --git a/src/property.cc b/src/property.cc index 93ba43cb92..a4e0d67102 100644 --- a/src/property.cc +++ b/src/property.cc @@ -4,6 +4,7 @@ #include "src/property.h" +#include "src/field-type.h" #include "src/handles-inl.h" #include "src/ostreams.h" @@ -20,6 +21,11 @@ std::ostream& operator<<(std::ostream& os, return os; } +DataDescriptor::DataDescriptor(Handle key, int field_index, + PropertyAttributes attributes, + Representation representation) + : Descriptor(key, FieldType::Any(key->GetIsolate()), attributes, DATA, + representation, field_index) {} struct FastPropertyDetails { explicit FastPropertyDetails(const PropertyDetails& v) : details(v) {} diff --git a/src/property.h b/src/property.h index 1256d5930c..c8da9aa607 100644 --- a/src/property.h +++ b/src/property.h @@ -8,8 +8,6 @@ #include #include "src/factory.h" -#include "src/field-index.h" -#include "src/field-type.h" #include "src/isolate.h" namespace v8 { @@ -75,9 +73,7 @@ std::ostream& operator<<(std::ostream& os, const Descriptor& d); class DataDescriptor final : public Descriptor { public: DataDescriptor(Handle key, int field_index, - PropertyAttributes attributes, Representation representation) - : Descriptor(key, FieldType::Any(key->GetIsolate()), attributes, DATA, - representation, field_index) {} + PropertyAttributes attributes, Representation representation); // The field type is either a simple type or a map wrapped in a weak cell. DataDescriptor(Handle key, int field_index, Handle wrapped_field_type, diff --git a/src/regexp/regexp-parser.cc b/src/regexp/regexp-parser.cc index 7470e28aed..7d02b87b7e 100644 --- a/src/regexp/regexp-parser.cc +++ b/src/regexp/regexp-parser.cc @@ -8,6 +8,7 @@ #include "src/factory.h" #include "src/isolate.h" #include "src/objects-inl.h" +#include "src/ostreams.h" #include "src/regexp/jsregexp.h" #include "src/utils.h" diff --git a/src/runtime/runtime-interpreter.cc b/src/runtime/runtime-interpreter.cc index d79c2cacb9..cbacb554ad 100644 --- a/src/runtime/runtime-interpreter.cc +++ b/src/runtime/runtime-interpreter.cc @@ -11,6 +11,7 @@ #include "src/interpreter/bytecode-array-iterator.h" #include "src/interpreter/bytecodes.h" #include "src/isolate-inl.h" +#include "src/ostreams.h" namespace v8 { namespace internal { diff --git a/test/cctest/heap/test-heap.cc b/test/cctest/heap/test-heap.cc index af5d2705da..e6616897d5 100644 --- a/test/cctest/heap/test-heap.cc +++ b/test/cctest/heap/test-heap.cc @@ -33,6 +33,7 @@ #include "src/deoptimizer.h" #include "src/execution.h" #include "src/factory.h" +#include "src/field-type.h" #include "src/global-handles.h" #include "src/heap/gc-tracer.h" #include "src/heap/memory-reducer.h" diff --git a/test/cctest/test-field-type-tracking.cc b/test/cctest/test-field-type-tracking.cc index 0ca7ea4673..cee3600314 100644 --- a/test/cctest/test-field-type-tracking.cc +++ b/test/cctest/test-field-type-tracking.cc @@ -12,6 +12,7 @@ #include "src/compilation-cache.h" #include "src/execution.h" #include "src/factory.h" +#include "src/field-type.h" #include "src/global-handles.h" #include "src/ic/stub-cache.h" #include "src/macro-assembler.h" diff --git a/test/cctest/test-transitions.cc b/test/cctest/test-transitions.cc index e3d5193435..b7eb50f1c9 100644 --- a/test/cctest/test-transitions.cc +++ b/test/cctest/test-transitions.cc @@ -10,6 +10,7 @@ #include "src/compilation-cache.h" #include "src/execution.h" #include "src/factory.h" +#include "src/field-type.h" #include "src/global-handles.h" #include "test/cctest/cctest.h" diff --git a/test/cctest/test-unboxed-doubles.cc b/test/cctest/test-unboxed-doubles.cc index c0a5886251..f195a31c79 100644 --- a/test/cctest/test-unboxed-doubles.cc +++ b/test/cctest/test-unboxed-doubles.cc @@ -10,6 +10,7 @@ #include "src/compilation-cache.h" #include "src/execution.h" #include "src/factory.h" +#include "src/field-type.h" #include "src/global-handles.h" #include "src/heap/slots-buffer.h" #include "src/ic/ic.h"