Reviewers: Vyacheslav Egorov,
Description:
Make the code flushing candidate field explicit in code objects.
This way it is counted and the rounding of the size will just work
without extra tweaking if you want to add an extra field to code
objects.
[email protected]
BUG=
TEST=
Please review this at http://codereview.chromium.org/6969037/
SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge
Affected files:
M src/heap.cc
M src/mark-compact.cc
M src/objects-inl.h
M src/objects.h
Index: src/heap.cc
diff --git a/src/heap.cc b/src/heap.cc
index
64489a1cce1ff8a5ee6d9228fa3adbee7082f961..94fad94795283bb35c13f4cca9fb2f5a97cc6199
100644
--- a/src/heap.cc
+++ b/src/heap.cc
@@ -2799,6 +2799,7 @@ MaybeObject* Heap::CreateCode(const CodeDesc& desc,
code->set_check_type(RECEIVER_MAP_CHECK);
}
code->set_deoptimization_data(empty_fixed_array());
+ code->set_code_flushing_candidate(undefined_value());
// Allow self references to created code object by patching the handle to
// point to the newly allocated Code object.
if (!self_reference.is_null()) {
Index: src/mark-compact.cc
diff --git a/src/mark-compact.cc b/src/mark-compact.cc
index
68a506226de6afd89dab87dc9dc671d1a7989410..8931e238a47538f8ce39ae0f1752fd3d1014cff9
100644
--- a/src/mark-compact.cc
+++ b/src/mark-compact.cc
@@ -1,4 +1,4 @@
-// Copyright 2006-2008 the V8 project authors. All rights reserved.
+// Copyright 2011 the V8 project authors. All rights reserved.
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
@@ -305,13 +305,11 @@ class CodeFlusher {
*GetNextCandidateField(candidate) = next_candidate;
}
- STATIC_ASSERT(kPointerSize <= Code::kHeaderSize -
Code::kHeaderPaddingStart);
-
static SharedFunctionInfo** GetNextCandidateField(
SharedFunctionInfo* candidate) {
Code* code = candidate->unchecked_code();
return reinterpret_cast<SharedFunctionInfo**>(
- code->address() + Code::kHeaderPaddingStart);
+ code->address() + Code::kCodeFlushingCandidateOffset);
}
static SharedFunctionInfo* GetNextCandidate(SharedFunctionInfo*
candidate) {
Index: src/objects-inl.h
diff --git a/src/objects-inl.h b/src/objects-inl.h
index
9a38584cba6caa8400218bacb324f369b03451bd..6ee46f192abe171202e15cdbe96159068fe1333f
100644
--- a/src/objects-inl.h
+++ b/src/objects-inl.h
@@ -3548,6 +3548,8 @@ JSMessageObject* JSMessageObject::cast(Object* obj) {
INT_ACCESSORS(Code, instruction_size, kInstructionSizeOffset)
ACCESSORS(Code, relocation_info, ByteArray, kRelocationInfoOffset)
ACCESSORS(Code, deoptimization_data, FixedArray, kDeoptimizationDataOffset)
+ACCESSORS(Code, code_flushing_candidate,
+ Object, kCodeFlushingCandidateOffset)
byte* Code::instruction_start() {
Index: src/objects.h
diff --git a/src/objects.h b/src/objects.h
index
be4652bed5894264ca48baea2205f8ecf8209078..ab7d7d00acdecec171f5e19a8baada138e67804a
100644
--- a/src/objects.h
+++ b/src/objects.h
@@ -3317,6 +3317,12 @@ class Code: public HeapObject {
// [deoptimization_data]: Array containing data for deopt.
DECL_ACCESSORS(deoptimization_data, FixedArray)
+ // [code_flushing_candidate]: Field only used during garbage
+ // collection to hold code flushing candidates. The contents of this
+ // field does not have to be traced during garbage collection since
+ // it is only used by the garbage collector itself.
+ DECL_ACCESSORS(code_flushing_candidate, Object)
+
// Unchecked accessors to be used during GC.
inline ByteArray* unchecked_relocation_info();
inline FixedArray* unchecked_deoptimization_data();
@@ -3537,9 +3543,11 @@ class Code: public HeapObject {
static const int kRelocationInfoOffset = kInstructionSizeOffset +
kIntSize;
static const int kDeoptimizationDataOffset =
kRelocationInfoOffset + kPointerSize;
- static const int kFlagsOffset = kDeoptimizationDataOffset + kPointerSize;
- static const int kKindSpecificFlagsOffset = kFlagsOffset + kIntSize;
+ static const int kCodeFlushingCandidateOffset =
+ kDeoptimizationDataOffset + kPointerSize;
+ static const int kFlagsOffset = kCodeFlushingCandidateOffset +
kPointerSize;
+ static const int kKindSpecificFlagsOffset = kFlagsOffset + kIntSize;
static const int kKindSpecificFlagsSize = 2 * kIntSize;
static const int kHeaderPaddingStart = kKindSpecificFlagsOffset +
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev