From: vegorov@chromium.org Date: Mon, 8 Nov 2010 10:30:57 +0000 (+0000) Subject: Fix pseudo-smi accessors lo/hi ordering for SharedFunctionInfo on x64. X-Git-Tag: upstream/4.7.83~20989 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=28bd8aa024ceb347eccd60d3db56bcf75aded12d;p=platform%2Fupstream%2Fv8.git Fix pseudo-smi accessors lo/hi ordering for SharedFunctionInfo on x64. Incorrect ordering lead to crashes during GC when end position was not even number. Add static assert to catch this kind of typos. Review URL: http://codereview.chromium.org/4640003 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@5776 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- diff --git a/src/objects-inl.h b/src/objects-inl.h index 1852b54..399ef35 100644 --- a/src/objects-inl.h +++ b/src/objects-inl.h @@ -2671,6 +2671,7 @@ SMI_ACCESSORS(SharedFunctionInfo, this_property_assignments_count, #else #define PSEUDO_SMI_ACCESSORS_LO(holder, name, offset) \ + STATIC_ASSERT(holder::offset % kPointerSize == 0); \ int holder::name() { \ int value = READ_INT_FIELD(this, offset); \ ASSERT(kHeapObjectTag == 1); \ @@ -2686,30 +2687,36 @@ SMI_ACCESSORS(SharedFunctionInfo, this_property_assignments_count, (value << 1) & ~kHeapObjectTag); \ } -#define PSEUDO_SMI_ACCESSORS_HI(holder, name, offset) \ +#define PSEUDO_SMI_ACCESSORS_HI(holder, name, offset) \ + STATIC_ASSERT(holder::offset % kPointerSize == kIntSize); \ INT_ACCESSORS(holder, name, offset) - PSEUDO_SMI_ACCESSORS_LO(SharedFunctionInfo, length, kLengthOffset) -PSEUDO_SMI_ACCESSORS_HI(SharedFunctionInfo, formal_parameter_count, - kFormalParameterCountOffset) +PSEUDO_SMI_ACCESSORS_HI(SharedFunctionInfo, + formal_parameter_count, + kFormalParameterCountOffset) -PSEUDO_SMI_ACCESSORS_LO(SharedFunctionInfo, expected_nof_properties, - kExpectedNofPropertiesOffset) +PSEUDO_SMI_ACCESSORS_LO(SharedFunctionInfo, + expected_nof_properties, + kExpectedNofPropertiesOffset) PSEUDO_SMI_ACCESSORS_HI(SharedFunctionInfo, num_literals, kNumLiteralsOffset) -PSEUDO_SMI_ACCESSORS_LO(SharedFunctionInfo, start_position_and_type, - kStartPositionAndTypeOffset) -PSEUDO_SMI_ACCESSORS_HI(SharedFunctionInfo, end_position, kEndPositionOffset) - -PSEUDO_SMI_ACCESSORS_LO(SharedFunctionInfo, function_token_position, - kFunctionTokenPositionOffset) -PSEUDO_SMI_ACCESSORS_HI(SharedFunctionInfo, compiler_hints, - kCompilerHintsOffset) - -PSEUDO_SMI_ACCESSORS_LO(SharedFunctionInfo, this_property_assignments_count, - kThisPropertyAssignmentsCountOffset) +PSEUDO_SMI_ACCESSORS_LO(SharedFunctionInfo, end_position, kEndPositionOffset) +PSEUDO_SMI_ACCESSORS_HI(SharedFunctionInfo, + start_position_and_type, + kStartPositionAndTypeOffset) + +PSEUDO_SMI_ACCESSORS_LO(SharedFunctionInfo, + function_token_position, + kFunctionTokenPositionOffset) +PSEUDO_SMI_ACCESSORS_HI(SharedFunctionInfo, + compiler_hints, + kCompilerHintsOffset) + +PSEUDO_SMI_ACCESSORS_LO(SharedFunctionInfo, + this_property_assignments_count, + kThisPropertyAssignmentsCountOffset) #endif