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/snapshot/serialize.h" | 5 #include "src/snapshot/serialize.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 2514 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2525 DCHECK((how_to_code == kPlain && where_to_point == kStartOfObject) || | 2525 DCHECK((how_to_code == kPlain && where_to_point == kStartOfObject) || |
2526 (how_to_code == kPlain && where_to_point == kInnerPointer) || | 2526 (how_to_code == kPlain && where_to_point == kInnerPointer) || |
2527 (how_to_code == kFromCode && where_to_point == kInnerPointer)); | 2527 (how_to_code == kFromCode && where_to_point == kInnerPointer)); |
2528 DCHECK(CodeStub::MajorKeyFromKey(stub_key) != CodeStub::NoCache); | 2528 DCHECK(CodeStub::MajorKeyFromKey(stub_key) != CodeStub::NoCache); |
2529 DCHECK(!CodeStub::GetCode(isolate(), stub_key).is_null()); | 2529 DCHECK(!CodeStub::GetCode(isolate(), stub_key).is_null()); |
2530 | 2530 |
2531 int index = AddCodeStubKey(stub_key) + kCodeStubsBaseIndex; | 2531 int index = AddCodeStubKey(stub_key) + kCodeStubsBaseIndex; |
2532 | 2532 |
2533 if (FLAG_trace_serializer) { | 2533 if (FLAG_trace_serializer) { |
2534 PrintF(" Encoding code stub %s as %d\n", | 2534 PrintF(" Encoding code stub %s as %d\n", |
2535 CodeStub::MajorName(CodeStub::MajorKeyFromKey(stub_key), false), | 2535 CodeStub::MajorName(CodeStub::MajorKeyFromKey(stub_key)), index); |
2536 index); | |
2537 } | 2536 } |
2538 | 2537 |
2539 sink_->Put(kAttachedReference + how_to_code + where_to_point, "CodeStub"); | 2538 sink_->Put(kAttachedReference + how_to_code + where_to_point, "CodeStub"); |
2540 sink_->PutInt(index, "CodeStub key"); | 2539 sink_->PutInt(index, "CodeStub key"); |
2541 } | 2540 } |
2542 | 2541 |
2543 | 2542 |
2544 void CodeSerializer::SerializeIC(Code* ic, HowToCode how_to_code, | 2543 void CodeSerializer::SerializeIC(Code* ic, HowToCode how_to_code, |
2545 WhereToPoint where_to_point) { | 2544 WhereToPoint where_to_point) { |
2546 // The IC may be implemented as a stub. | 2545 // The IC may be implemented as a stub. |
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2875 SerializedCodeData* scd = new SerializedCodeData(cached_data); | 2874 SerializedCodeData* scd = new SerializedCodeData(cached_data); |
2876 SanityCheckResult r = scd->SanityCheck(isolate, source); | 2875 SanityCheckResult r = scd->SanityCheck(isolate, source); |
2877 if (r == CHECK_SUCCESS) return scd; | 2876 if (r == CHECK_SUCCESS) return scd; |
2878 cached_data->Reject(); | 2877 cached_data->Reject(); |
2879 source->GetIsolate()->counters()->code_cache_reject_reason()->AddSample(r); | 2878 source->GetIsolate()->counters()->code_cache_reject_reason()->AddSample(r); |
2880 delete scd; | 2879 delete scd; |
2881 return NULL; | 2880 return NULL; |
2882 } | 2881 } |
2883 } // namespace internal | 2882 } // namespace internal |
2884 } // namespace v8 | 2883 } // namespace v8 |
OLD | NEW |