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

Unified Diff: src/objects-inl.h

Issue 1230753004: [Interpreter] Add BytecodeArray class and add to SharedFunctionInfo. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Don't use extra memory for BytecodeArray in SharedFunctionInfo and add a BytecodeArray test. Created 5 years, 5 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 6b1cfb3c330f1d22c31793d0b4b807d2f0b537e4..d3bdabbbbd6fa74b4d82d5bb3ca778138f95149d 100644
--- a/src/objects-inl.h
+++ b/src/objects-inl.h
@@ -648,6 +648,7 @@ bool Object::IsNumber() const {
TYPE_CHECKER(ByteArray, BYTE_ARRAY_TYPE)
+TYPE_CHECKER(BytecodeArray, BYTECODE_ARRAY_TYPE)
TYPE_CHECKER(FreeSpace, FREE_SPACE_TYPE)
@@ -2950,6 +2951,7 @@ void SeededNumberDictionary::set_requires_slow_elements() {
CAST_ACCESSOR(AccessorInfo)
CAST_ACCESSOR(ArrayList)
CAST_ACCESSOR(ByteArray)
+CAST_ACCESSOR(BytecodeArray)
CAST_ACCESSOR(Cell)
CAST_ACCESSOR(Code)
CAST_ACCESSOR(CodeCacheHashTable)
@@ -3651,6 +3653,27 @@ Address ByteArray::GetDataStartAddress() {
}
+byte BytecodeArray::get(int index) {
+ DCHECK(index >= 0 && index < this->length());
+ return READ_BYTE_FIELD(this, kHeaderSize + index * kCharSize);
+}
+
+
+void BytecodeArray::set(int index, byte value) {
+ DCHECK(index >= 0 && index < this->length());
+ WRITE_BYTE_FIELD(this, kHeaderSize + index * kCharSize, value);
+}
+
+
+SMI_ACCESSORS(BytecodeArray, frame_size, kFrameSizeOffset);
+SMI_ACCESSORS(BytecodeArray, number_of_locals, kNumberOfLocalsOffset);
+
+
+Address BytecodeArray::GetFirstBytecodeAddress() {
+ return reinterpret_cast<Address>(this) - kHeapObjectTag + kHeaderSize;
+}
+
+
uint8_t* ExternalUint8ClampedArray::external_uint8_clamped_pointer() {
return reinterpret_cast<uint8_t*>(external_pointer());
}
@@ -4126,6 +4149,9 @@ int HeapObject::SizeFromMap(Map* map) {
if (instance_type == BYTE_ARRAY_TYPE) {
return reinterpret_cast<ByteArray*>(this)->ByteArraySize();
}
+ if (instance_type == BYTECODE_ARRAY_TYPE) {
+ return reinterpret_cast<BytecodeArray*>(this)->BytecodeArraySize();
+ }
if (instance_type == FREE_SPACE_TYPE) {
return reinterpret_cast<FreeSpace*>(this)->nobarrier_size();
}
@@ -5509,6 +5535,17 @@ BuiltinFunctionId SharedFunctionInfo::builtin_function_id() {
}
+bool SharedFunctionInfo::HasBytecodeArray() {
+ return function_data()->IsBytecodeArray();
+}
+
+
+BytecodeArray* SharedFunctionInfo::bytecode_array() {
+ DCHECK(HasBytecodeArray());
+ return BytecodeArray::cast(function_data());
+}
+
+
int SharedFunctionInfo::ic_age() {
return ICAgeBits::decode(counters());
}

Powered by Google App Engine
This is Rietveld 408576698