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

Side by Side Diff: src/serialize.cc

Issue 475753002: Add serializer support for out-of-line constant pool. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Add support for root pointers from code. Created 6 years, 4 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/accessors.h" 7 #include "src/accessors.h"
8 #include "src/api.h" 8 #include "src/api.h"
9 #include "src/base/platform/platform.h" 9 #include "src/base/platform/platform.h"
10 #include "src/bootstrapper.h" 10 #include "src/bootstrapper.h"
(...skipping 1069 matching lines...) Expand 10 before | Expand all | Expand 10 after
1080 // to the current code object or the instruction pointer in a function 1080 // to the current code object or the instruction pointer in a function
1081 // object. 1081 // object.
1082 ALL_SPACES(kBackref, kFromCode, kInnerPointer) 1082 ALL_SPACES(kBackref, kFromCode, kInnerPointer)
1083 ALL_SPACES(kBackrefWithSkip, kFromCode, kInnerPointer) 1083 ALL_SPACES(kBackrefWithSkip, kFromCode, kInnerPointer)
1084 ALL_SPACES(kBackref, kPlain, kInnerPointer) 1084 ALL_SPACES(kBackref, kPlain, kInnerPointer)
1085 ALL_SPACES(kBackrefWithSkip, kPlain, kInnerPointer) 1085 ALL_SPACES(kBackrefWithSkip, kPlain, kInnerPointer)
1086 // Find an object in the roots array and write a pointer to it to the 1086 // Find an object in the roots array and write a pointer to it to the
1087 // current object. 1087 // current object.
1088 CASE_STATEMENT(kRootArray, kPlain, kStartOfObject, 0) 1088 CASE_STATEMENT(kRootArray, kPlain, kStartOfObject, 0)
1089 CASE_BODY(kRootArray, kPlain, kStartOfObject, 0) 1089 CASE_BODY(kRootArray, kPlain, kStartOfObject, 0)
1090 #if V8_OOL_CONSTANT_POOL
1091 // Find an object in the roots array and write a pointer to it to in code.
1092 CASE_STATEMENT(kRootArray, kFromCode, kStartOfObject, 0)
1093 CASE_BODY(kRootArray, kFromCode, kStartOfObject, 0)
1094 #endif
1090 // Find an object in the partial snapshots cache and write a pointer to it 1095 // Find an object in the partial snapshots cache and write a pointer to it
1091 // to the current object. 1096 // to the current object.
1092 CASE_STATEMENT(kPartialSnapshotCache, kPlain, kStartOfObject, 0) 1097 CASE_STATEMENT(kPartialSnapshotCache, kPlain, kStartOfObject, 0)
1093 CASE_BODY(kPartialSnapshotCache, 1098 CASE_BODY(kPartialSnapshotCache,
1094 kPlain, 1099 kPlain,
1095 kStartOfObject, 1100 kStartOfObject,
1096 0) 1101 0)
1097 // Find an code entry in the partial snapshots cache and 1102 // Find an code entry in the partial snapshots cache and
1098 // write a pointer to it to the current object. 1103 // write a pointer to it to the current object.
1099 CASE_STATEMENT(kPartialSnapshotCache, kPlain, kInnerPointer, 0) 1104 CASE_STATEMENT(kPartialSnapshotCache, kPlain, kInnerPointer, 0)
(...skipping 11 matching lines...) Expand all
1111 // Find an external reference and write a pointer to it in the current 1116 // Find an external reference and write a pointer to it in the current
1112 // code object. 1117 // code object.
1113 CASE_STATEMENT(kExternalReference, kFromCode, kStartOfObject, 0) 1118 CASE_STATEMENT(kExternalReference, kFromCode, kStartOfObject, 0)
1114 CASE_BODY(kExternalReference, 1119 CASE_BODY(kExternalReference,
1115 kFromCode, 1120 kFromCode,
1116 kStartOfObject, 1121 kStartOfObject,
1117 0) 1122 0)
1118 // Find a builtin and write a pointer to it to the current object. 1123 // Find a builtin and write a pointer to it to the current object.
1119 CASE_STATEMENT(kBuiltin, kPlain, kStartOfObject, 0) 1124 CASE_STATEMENT(kBuiltin, kPlain, kStartOfObject, 0)
1120 CASE_BODY(kBuiltin, kPlain, kStartOfObject, 0) 1125 CASE_BODY(kBuiltin, kPlain, kStartOfObject, 0)
1126 #if V8_OOL_CONSTANT_POOL
1127 // Find a builtin code entry and write a pointer to it to the current
1128 // object.
1129 CASE_STATEMENT(kBuiltin, kPlain, kInnerPointer, 0)
1130 CASE_BODY(kBuiltin, kPlain, kInnerPointer, 0)
1131 #endif
1121 // Find a builtin and write a pointer to it in the current code object. 1132 // Find a builtin and write a pointer to it in the current code object.
1122 CASE_STATEMENT(kBuiltin, kFromCode, kInnerPointer, 0) 1133 CASE_STATEMENT(kBuiltin, kFromCode, kInnerPointer, 0)
1123 CASE_BODY(kBuiltin, kFromCode, kInnerPointer, 0) 1134 CASE_BODY(kBuiltin, kFromCode, kInnerPointer, 0)
1124 // Find an object in the attached references and write a pointer to it to 1135 // Find an object in the attached references and write a pointer to it to
1125 // the current object. 1136 // the current object.
1126 CASE_STATEMENT(kAttachedReference, kPlain, kStartOfObject, 0) 1137 CASE_STATEMENT(kAttachedReference, kPlain, kStartOfObject, 0)
1127 CASE_BODY(kAttachedReference, kPlain, kStartOfObject, 0) 1138 CASE_BODY(kAttachedReference, kPlain, kStartOfObject, 0)
1128 1139
1129 #undef CASE_STATEMENT 1140 #undef CASE_STATEMENT
1130 #undef CASE_BODY 1141 #undef CASE_BODY
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
1284 return length; 1295 return length;
1285 } 1296 }
1286 1297
1287 1298
1288 int Serializer::RootIndex(HeapObject* heap_object, HowToCode from) { 1299 int Serializer::RootIndex(HeapObject* heap_object, HowToCode from) {
1289 Heap* heap = isolate()->heap(); 1300 Heap* heap = isolate()->heap();
1290 if (heap->InNewSpace(heap_object)) return kInvalidRootIndex; 1301 if (heap->InNewSpace(heap_object)) return kInvalidRootIndex;
1291 for (int i = 0; i < root_index_wave_front_; i++) { 1302 for (int i = 0; i < root_index_wave_front_; i++) {
1292 Object* root = heap->roots_array_start()[i]; 1303 Object* root = heap->roots_array_start()[i];
1293 if (!root->IsSmi() && root == heap_object) { 1304 if (!root->IsSmi() && root == heap_object) {
1294 #if defined(V8_TARGET_ARCH_MIPS) || V8_OOL_CONSTANT_POOL || \ 1305 #if defined(V8_TARGET_ARCH_MIPS) || defined(V8_TARGET_ARCH_MIPS64)
1295 defined(V8_TARGET_ARCH_MIPS64)
1296 if (from == kFromCode) { 1306 if (from == kFromCode) {
1297 // In order to avoid code bloat in the deserializer we don't have 1307 // In order to avoid code bloat in the deserializer we don't have
1298 // support for the encoding that specifies a particular root should 1308 // support for the encoding that specifies a particular root should
1299 // be written from within code. 1309 // be written from within code.
1300 return kInvalidRootIndex; 1310 return kInvalidRootIndex;
1301 } 1311 }
1302 #endif 1312 #endif
1303 return i; 1313 return i;
1304 } 1314 }
1305 } 1315 }
(...skipping 553 matching lines...) Expand 10 before | Expand all | Expand 10 after
1859 1869
1860 1870
1861 void CodeSerializer::SerializeBuiltin(Code* builtin, HowToCode how_to_code, 1871 void CodeSerializer::SerializeBuiltin(Code* builtin, HowToCode how_to_code,
1862 WhereToPoint where_to_point, int skip) { 1872 WhereToPoint where_to_point, int skip) {
1863 if (skip != 0) { 1873 if (skip != 0) {
1864 sink_->Put(kSkip, "SkipFromSerializeBuiltin"); 1874 sink_->Put(kSkip, "SkipFromSerializeBuiltin");
1865 sink_->PutInt(skip, "SkipDistanceFromSerializeBuiltin"); 1875 sink_->PutInt(skip, "SkipDistanceFromSerializeBuiltin");
1866 } 1876 }
1867 1877
1868 DCHECK((how_to_code == kPlain && where_to_point == kStartOfObject) || 1878 DCHECK((how_to_code == kPlain && where_to_point == kStartOfObject) ||
1879 (how_to_code == kPlain && where_to_point == kInnerPointer) ||
1869 (how_to_code == kFromCode && where_to_point == kInnerPointer)); 1880 (how_to_code == kFromCode && where_to_point == kInnerPointer));
1870 int builtin_index = builtin->builtin_index(); 1881 int builtin_index = builtin->builtin_index();
1871 DCHECK_LT(builtin_index, Builtins::builtin_count); 1882 DCHECK_LT(builtin_index, Builtins::builtin_count);
1872 DCHECK_LE(0, builtin_index); 1883 DCHECK_LE(0, builtin_index);
1873 sink_->Put(kBuiltin + how_to_code + where_to_point, "Builtin"); 1884 sink_->Put(kBuiltin + how_to_code + where_to_point, "Builtin");
1874 sink_->PutInt(builtin_index, "builtin_index"); 1885 sink_->PutInt(builtin_index, "builtin_index");
1875 } 1886 }
1876 1887
1877 1888
1878 void CodeSerializer::SerializeSourceObject(HowToCode how_to_code, 1889 void CodeSerializer::SerializeSourceObject(HowToCode how_to_code,
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
1945 1956
1946 int SerializedCodeData::CheckSum(String* string) { 1957 int SerializedCodeData::CheckSum(String* string) {
1947 int checksum = Version::Hash(); 1958 int checksum = Version::Hash();
1948 #ifdef DEBUG 1959 #ifdef DEBUG
1949 uint32_t seed = static_cast<uint32_t>(checksum); 1960 uint32_t seed = static_cast<uint32_t>(checksum);
1950 checksum = static_cast<int>(IteratingStringHasher::Hash(string, seed)); 1961 checksum = static_cast<int>(IteratingStringHasher::Hash(string, seed));
1951 #endif // DEBUG 1962 #endif // DEBUG
1952 return checksum; 1963 return checksum;
1953 } 1964 }
1954 } } // namespace v8::internal 1965 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698