OLD | NEW |
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 1967 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1978 } | 1978 } |
1979 | 1979 |
1980 | 1980 |
1981 void CodeSerializer::SerializeCodeStub(Code* stub, HowToCode how_to_code, | 1981 void CodeSerializer::SerializeCodeStub(Code* stub, HowToCode how_to_code, |
1982 WhereToPoint where_to_point) { | 1982 WhereToPoint where_to_point) { |
1983 DCHECK((how_to_code == kPlain && where_to_point == kStartOfObject) || | 1983 DCHECK((how_to_code == kPlain && where_to_point == kStartOfObject) || |
1984 (how_to_code == kPlain && where_to_point == kInnerPointer) || | 1984 (how_to_code == kPlain && where_to_point == kInnerPointer) || |
1985 (how_to_code == kFromCode && where_to_point == kInnerPointer)); | 1985 (how_to_code == kFromCode && where_to_point == kInnerPointer)); |
1986 uint32_t stub_key = stub->stub_key(); | 1986 uint32_t stub_key = stub->stub_key(); |
1987 DCHECK(CodeStub::MajorKeyFromKey(stub_key) != CodeStub::NoCache); | 1987 DCHECK(CodeStub::MajorKeyFromKey(stub_key) != CodeStub::NoCache); |
| 1988 DCHECK(CodeStub::GetCode(isolate(), stub_key)->IsCode()); |
1988 | 1989 |
1989 int index = AddCodeStubKey(stub_key) + kCodeStubsBaseIndex; | 1990 int index = AddCodeStubKey(stub_key) + kCodeStubsBaseIndex; |
1990 | 1991 |
1991 if (FLAG_trace_code_serializer) { | 1992 if (FLAG_trace_code_serializer) { |
1992 PrintF("Encoding code stub %s as %d\n", | 1993 PrintF("Encoding code stub %s as %d\n", |
1993 CodeStub::MajorName(CodeStub::MajorKeyFromKey(stub_key), false), | 1994 CodeStub::MajorName(CodeStub::MajorKeyFromKey(stub_key), false), |
1994 index); | 1995 index); |
1995 } | 1996 } |
1996 | 1997 |
1997 sink_->Put(kAttachedReference + how_to_code + where_to_point, "CodeStub"); | 1998 sink_->Put(kAttachedReference + how_to_code + where_to_point, "CodeStub"); |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2108 | 2109 |
2109 int SerializedCodeData::CheckSum(String* string) { | 2110 int SerializedCodeData::CheckSum(String* string) { |
2110 int checksum = Version::Hash(); | 2111 int checksum = Version::Hash(); |
2111 #ifdef DEBUG | 2112 #ifdef DEBUG |
2112 uint32_t seed = static_cast<uint32_t>(checksum); | 2113 uint32_t seed = static_cast<uint32_t>(checksum); |
2113 checksum = static_cast<int>(IteratingStringHasher::Hash(string, seed)); | 2114 checksum = static_cast<int>(IteratingStringHasher::Hash(string, seed)); |
2114 #endif // DEBUG | 2115 #endif // DEBUG |
2115 return checksum; | 2116 return checksum; |
2116 } | 2117 } |
2117 } } // namespace v8::internal | 2118 } } // namespace v8::internal |
OLD | NEW |