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

Side by Side Diff: src/serialize.cc

Issue 587213002: Fix serializing ICs. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: added TODO Created 6 years, 2 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 | « src/serialize.h ('k') | test/mjsunit/serialize-ic.js » ('j') | 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 1876 matching lines...) Expand 10 before | Expand all | Expand 10 after
1887 DCHECK(!heap_object->IsHashTable()); 1887 DCHECK(!heap_object->IsHashTable());
1888 1888
1889 if (address_mapper_.IsMapped(heap_object)) { 1889 if (address_mapper_.IsMapped(heap_object)) {
1890 SerializeReferenceToPreviousObject(heap_object, how_to_code, where_to_point, 1890 SerializeReferenceToPreviousObject(heap_object, how_to_code, where_to_point,
1891 skip); 1891 skip);
1892 return; 1892 return;
1893 } 1893 }
1894 1894
1895 if (heap_object->IsCode()) { 1895 if (heap_object->IsCode()) {
1896 Code* code_object = Code::cast(heap_object); 1896 Code* code_object = Code::cast(heap_object);
1897 DCHECK(!code_object->is_optimized_code()); 1897 switch (code_object->kind()) {
1898 if (code_object->kind() == Code::BUILTIN) { 1898 case Code::OPTIMIZED_FUNCTION: // No optimized code compiled yet.
1899 SerializeBuiltin(code_object, how_to_code, where_to_point, skip); 1899 case Code::HANDLER: // No handlers patched in yet.
1900 return; 1900 case Code::REGEXP: // No regexp literals initialized yet.
1901 } else if (code_object->IsCodeStubOrIC()) { 1901 case Code::NUMBER_OF_KINDS: // Pseudo enum value.
1902 SerializeCodeStub(code_object, how_to_code, where_to_point, skip); 1902 CHECK(false);
1903 return; 1903 case Code::BUILTIN:
1904 SerializeBuiltin(code_object, how_to_code, where_to_point, skip);
1905 return;
1906 case Code::STUB:
1907 SerializeCodeStub(code_object, how_to_code, where_to_point, skip);
1908 return;
1909 #define IC_KIND_CASE(KIND) case Code::KIND:
1910 IC_KIND_LIST(IC_KIND_CASE)
1911 #undef IC_KIND_CASE
1912 // TODO(yangguo): add special handling to canonicalize ICs.
1913 case Code::FUNCTION:
1914 SerializeHeapObject(code_object, how_to_code, where_to_point, skip);
1915 return;
1904 } 1916 }
1905 code_object->ClearInlineCaches();
1906 } 1917 }
1907 1918
1908 if (heap_object == source_) { 1919 if (heap_object == source_) {
1909 SerializeSourceObject(how_to_code, where_to_point, skip); 1920 SerializeSourceObject(how_to_code, where_to_point, skip);
1910 return; 1921 return;
1911 } 1922 }
1912 1923
1913 SerializeHeapObject(heap_object, how_to_code, where_to_point, skip); 1924 SerializeHeapObject(heap_object, how_to_code, where_to_point, skip);
1914 } 1925 }
1915 1926
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
1960 if (FLAG_trace_code_serializer) { 1971 if (FLAG_trace_code_serializer) {
1961 PrintF("Encoding builtin: %s\n", 1972 PrintF("Encoding builtin: %s\n",
1962 isolate()->builtins()->name(builtin_index)); 1973 isolate()->builtins()->name(builtin_index));
1963 } 1974 }
1964 1975
1965 sink_->Put(kBuiltin + how_to_code + where_to_point, "Builtin"); 1976 sink_->Put(kBuiltin + how_to_code + where_to_point, "Builtin");
1966 sink_->PutInt(builtin_index, "builtin_index"); 1977 sink_->PutInt(builtin_index, "builtin_index");
1967 } 1978 }
1968 1979
1969 1980
1970 void CodeSerializer::SerializeCodeStub(Code* code, HowToCode how_to_code, 1981 void CodeSerializer::SerializeCodeStub(Code* stub, HowToCode how_to_code,
1971 WhereToPoint where_to_point, int skip) { 1982 WhereToPoint where_to_point, int skip) {
1972 DCHECK((how_to_code == kPlain && where_to_point == kStartOfObject) || 1983 DCHECK((how_to_code == kPlain && where_to_point == kStartOfObject) ||
1973 (how_to_code == kPlain && where_to_point == kInnerPointer) || 1984 (how_to_code == kPlain && where_to_point == kInnerPointer) ||
1974 (how_to_code == kFromCode && where_to_point == kInnerPointer)); 1985 (how_to_code == kFromCode && where_to_point == kInnerPointer));
1975 uint32_t stub_key = code->stub_key(); 1986 uint32_t stub_key = stub->stub_key();
1976 1987 DCHECK(CodeStub::MajorKeyFromKey(stub_key) != CodeStub::NoCache);
1977 if (stub_key == CodeStub::NoCacheKey()) {
1978 if (FLAG_trace_code_serializer) {
1979 PrintF("Encoding uncacheable code stub as heap object\n");
1980 }
1981 SerializeHeapObject(code, how_to_code, where_to_point, skip);
1982 return;
1983 }
1984 1988
1985 if (skip != 0) { 1989 if (skip != 0) {
1986 sink_->Put(kSkip, "SkipFromSerializeCodeStub"); 1990 sink_->Put(kSkip, "SkipFromSerializeCodeStub");
1987 sink_->PutInt(skip, "SkipDistanceFromSerializeCodeStub"); 1991 sink_->PutInt(skip, "SkipDistanceFromSerializeCodeStub");
1988 } 1992 }
1989 1993
1990 int index = AddCodeStubKey(stub_key) + kCodeStubsBaseIndex; 1994 int index = AddCodeStubKey(stub_key) + kCodeStubsBaseIndex;
1991 1995
1992 if (FLAG_trace_code_serializer) { 1996 if (FLAG_trace_code_serializer) {
1993 PrintF("Encoding code stub %s as %d\n", 1997 PrintF("Encoding code stub %s as %d\n",
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
2117 2121
2118 int SerializedCodeData::CheckSum(String* string) { 2122 int SerializedCodeData::CheckSum(String* string) {
2119 int checksum = Version::Hash(); 2123 int checksum = Version::Hash();
2120 #ifdef DEBUG 2124 #ifdef DEBUG
2121 uint32_t seed = static_cast<uint32_t>(checksum); 2125 uint32_t seed = static_cast<uint32_t>(checksum);
2122 checksum = static_cast<int>(IteratingStringHasher::Hash(string, seed)); 2126 checksum = static_cast<int>(IteratingStringHasher::Hash(string, seed));
2123 #endif // DEBUG 2127 #endif // DEBUG
2124 return checksum; 2128 return checksum;
2125 } 2129 }
2126 } } // namespace v8::internal 2130 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/serialize.h ('k') | test/mjsunit/serialize-ic.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698