Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(847)

Unified Diff: src/objects-inl.h

Issue 1030353003: Enable constant pool support. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/objects-inl.h
diff --git a/src/objects-inl.h b/src/objects-inl.h
index 94a3cb3c947a63512d0515cee178bc5e47bcbee5..952849d89db1123ea1848a93e4d99f1dfc2e4d2d 100644
--- a/src/objects-inl.h
+++ b/src/objects-inl.h
@@ -5129,12 +5129,23 @@ bool Code::is_debug_stub() {
}
-ConstantPoolArray* Code::constant_pool() {
- return ConstantPoolArray::cast(READ_FIELD(this, kConstantPoolOffset));
+Address Code::constant_pool() {
+ Address constant_pool = NULL;
+ if (FLAG_enable_ool_constant_pool) {
+ constant_pool =
+ reinterpret_cast<Address>(READ_FIELD(this, kConstantPoolOffset));
+ } else if (FLAG_enable_embedded_constant_pool) {
+ int offset = constant_pool_offset();
+ if (offset < instruction_size()) {
+ constant_pool = FIELD_ADDR(this, kHeaderSize + offset);
+ }
+ }
+ return constant_pool;
}
void Code::set_constant_pool(Object* value) {
+ DCHECK(FLAG_enable_ool_constant_pool);
DCHECK(value->IsConstantPoolArray());
WRITE_FIELD(this, kConstantPoolOffset, value);
WRITE_BARRIER(GetHeap(), this, kConstantPoolOffset, value);
@@ -6293,6 +6304,7 @@ SMI_ACCESSORS(JSMessageObject, end_position, kEndPositionOffset)
INT_ACCESSORS(Code, instruction_size, kInstructionSizeOffset)
INT_ACCESSORS(Code, prologue_offset, kPrologueOffset)
+INT_ACCESSORS(Code, constant_pool_offset, kConstantPoolOffset)
ACCESSORS(Code, relocation_info, ByteArray, kRelocationInfoOffset)
ACCESSORS(Code, handler_table, FixedArray, kHandlerTableOffset)
ACCESSORS(Code, deoptimization_data, FixedArray, kDeoptimizationDataOffset)
@@ -6304,7 +6316,9 @@ void Code::WipeOutHeader() {
WRITE_FIELD(this, kRelocationInfoOffset, NULL);
WRITE_FIELD(this, kHandlerTableOffset, NULL);
WRITE_FIELD(this, kDeoptimizationDataOffset, NULL);
- WRITE_FIELD(this, kConstantPoolOffset, NULL);
+ if (FLAG_enable_ool_constant_pool) {
+ WRITE_FIELD(this, kConstantPoolOffset, NULL);
+ }
// Do not wipe out major/minor keys on a code stub or IC
if (!READ_FIELD(this, kTypeFeedbackInfoOffset)->IsSmi()) {
WRITE_FIELD(this, kTypeFeedbackInfoOffset, NULL);
@@ -6818,6 +6832,7 @@ void String::SetForwardedInternalizedString(String* canonical) {
DCHECK(canonical->IsInternalizedString());
DCHECK(canonical->HasHashCode());
WRITE_FIELD(this, kHashFieldSlot, canonical);
+
// Setting the hash field to a tagged value sets the LSB, causing the hash
// code to be interpreted as uninitialized. We use this fact to recognize
// that we have a forwarded string.

Powered by Google App Engine
This is Rietveld 408576698