Index: src/objects-inl.h |
diff --git a/src/objects-inl.h b/src/objects-inl.h |
index ed0c19f3caca0a14bada4ee9f52c96e29fed30f5..04c8df9a2f83c52bcfa366d1d49a6fc20bc924df 100644 |
--- a/src/objects-inl.h |
+++ b/src/objects-inl.h |
@@ -94,6 +94,15 @@ PropertyDetails PropertyDetails::AsDeleted() { |
} |
+// Getter that returns a raw Smi and setter that writes a raw Smi. |
Michael Starzinger
2012/03/14 16:15:16
I would refer to them as "tagged Smi" instead of "
|
+#define ACCESSORS_TO_SMI(holder, name, offset) \ |
+ Smi* holder::name() { return Smi::cast(READ_FIELD(this, offset)); } \ |
+ void holder::set_##name(Smi* value, WriteBarrierMode mode) { \ |
+ WRITE_FIELD(this, offset, value); \ |
+ } |
+ |
+ |
+// Getter that returns a Smi as an int and writes an int as a Smi. |
#define SMI_ACCESSORS(holder, name, offset) \ |
int holder::name() { \ |
Object* value = READ_FIELD(this, offset); \ |
@@ -3454,7 +3463,7 @@ ACCESSORS(AccessorInfo, getter, Object, kGetterOffset) |
ACCESSORS(AccessorInfo, setter, Object, kSetterOffset) |
ACCESSORS(AccessorInfo, data, Object, kDataOffset) |
ACCESSORS(AccessorInfo, name, Object, kNameOffset) |
-ACCESSORS(AccessorInfo, flag, Smi, kFlagOffset) |
+ACCESSORS_TO_SMI(AccessorInfo, flag, kFlagOffset) |
ACCESSORS(AccessorPair, getter, Object, kGetterOffset) |
ACCESSORS(AccessorPair, setter, Object, kSetterOffset) |
@@ -3495,7 +3504,7 @@ ACCESSORS(FunctionTemplateInfo, instance_call_handler, Object, |
kInstanceCallHandlerOffset) |
ACCESSORS(FunctionTemplateInfo, access_check_info, Object, |
kAccessCheckInfoOffset) |
-ACCESSORS(FunctionTemplateInfo, flag, Smi, kFlagOffset) |
+ACCESSORS_TO_SMI(FunctionTemplateInfo, flag, kFlagOffset) |
ACCESSORS(ObjectTemplateInfo, constructor, Object, kConstructorOffset) |
ACCESSORS(ObjectTemplateInfo, internal_field_count, Object, |
@@ -3509,17 +3518,17 @@ ACCESSORS(TypeSwitchInfo, types, Object, kTypesOffset) |
ACCESSORS(Script, source, Object, kSourceOffset) |
ACCESSORS(Script, name, Object, kNameOffset) |
ACCESSORS(Script, id, Object, kIdOffset) |
-ACCESSORS(Script, line_offset, Smi, kLineOffsetOffset) |
-ACCESSORS(Script, column_offset, Smi, kColumnOffsetOffset) |
+ACCESSORS_TO_SMI(Script, line_offset, kLineOffsetOffset) |
+ACCESSORS_TO_SMI(Script, column_offset, kColumnOffsetOffset) |
ACCESSORS(Script, data, Object, kDataOffset) |
ACCESSORS(Script, context_data, Object, kContextOffset) |
ACCESSORS(Script, wrapper, Foreign, kWrapperOffset) |
-ACCESSORS(Script, type, Smi, kTypeOffset) |
-ACCESSORS(Script, compilation_type, Smi, kCompilationTypeOffset) |
+ACCESSORS_TO_SMI(Script, type, kTypeOffset) |
+ACCESSORS_TO_SMI(Script, compilation_type, kCompilationTypeOffset) |
ACCESSORS(Script, line_ends, Object, kLineEndsOffset) |
ACCESSORS(Script, eval_from_shared, Object, kEvalFromSharedOffset) |
-ACCESSORS(Script, eval_from_instructions_offset, Smi, |
- kEvalFrominstructionsOffsetOffset) |
+ACCESSORS_TO_SMI(Script, eval_from_instructions_offset, |
+ kEvalFrominstructionsOffsetOffset) |
#ifdef ENABLE_DEBUGGER_SUPPORT |
ACCESSORS(DebugInfo, shared, SharedFunctionInfo, kSharedFunctionInfoIndex) |
@@ -3527,9 +3536,9 @@ ACCESSORS(DebugInfo, original_code, Code, kOriginalCodeIndex) |
ACCESSORS(DebugInfo, code, Code, kPatchedCodeIndex) |
ACCESSORS(DebugInfo, break_points, FixedArray, kBreakPointsStateIndex) |
-ACCESSORS(BreakPointInfo, code_position, Smi, kCodePositionIndex) |
-ACCESSORS(BreakPointInfo, source_position, Smi, kSourcePositionIndex) |
-ACCESSORS(BreakPointInfo, statement_position, Smi, kStatementPositionIndex) |
+ACCESSORS_TO_SMI(BreakPointInfo, code_position, kCodePositionIndex) |
+ACCESSORS_TO_SMI(BreakPointInfo, source_position, kSourcePositionIndex) |
+ACCESSORS_TO_SMI(BreakPointInfo, statement_position, kStatementPositionIndex) |
ACCESSORS(BreakPointInfo, break_point_objects, Object, kBreakPointObjectsIndex) |
#endif |
@@ -4941,22 +4950,27 @@ void FlexibleBodyDescriptor<start_offset>::IterateBody(HeapObject* obj, |
#undef SLOT_ADDR |
- |
+#undef TYPE_CHECKER |
#undef CAST_ACCESSOR |
#undef INT_ACCESSORS |
-#undef SMI_ACCESSORS |
#undef ACCESSORS |
+#undef ACCESSORS_TO_SMI |
+#undef SMI_ACCESSORS |
+#undef BOOL_GETTER |
+#undef BOOL_ACCESSORS |
#undef FIELD_ADDR |
#undef READ_FIELD |
#undef WRITE_FIELD |
#undef WRITE_BARRIER |
#undef CONDITIONAL_WRITE_BARRIER |
-#undef READ_MEMADDR_FIELD |
-#undef WRITE_MEMADDR_FIELD |
#undef READ_DOUBLE_FIELD |
#undef WRITE_DOUBLE_FIELD |
#undef READ_INT_FIELD |
#undef WRITE_INT_FIELD |
+#undef READ_INTPTR_FIELD |
+#undef WRITE_INTPTR_FIELD |
+#undef READ_UINT32_FIELD |
+#undef WRITE_UINT32_FIELD |
#undef READ_SHORT_FIELD |
#undef WRITE_SHORT_FIELD |
#undef READ_BYTE_FIELD |