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

Side by Side Diff: src/snapshot/natives-common.cc

Issue 2807023003: [snapshot] encode resource before serializing. (Closed)
Patch Set: fix Created 3 years, 8 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
« no previous file with comments | « src/snapshot/natives.h ('k') | src/snapshot/serializer.h » ('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 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 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 // The common functionality when building with internal or external natives. 5 // The common functionality when building with internal or external natives.
6 6
7 #include "src/heap/heap.h" 7 #include "src/heap/heap.h"
8 #include "src/objects-inl.h" 8 #include "src/objects-inl.h"
9 #include "src/snapshot/natives.h" 9 #include "src/snapshot/natives.h"
10 10
11 namespace v8 { 11 namespace v8 {
12 namespace internal { 12 namespace internal {
13 13
14 template <> 14 NativesExternalStringResource::NativesExternalStringResource(NativeType type,
15 FixedArray* NativesCollection<CORE>::GetSourceCache(Heap* heap) { 15 int index)
16 return heap->natives_source_cache(); 16 : type_(type), index_(index) {
17 } 17 Vector<const char> source;
18 18 DCHECK(0 <= index);
19 19 switch (type_) {
20 template <> 20 case CORE:
21 FixedArray* NativesCollection<EXTRAS>::GetSourceCache(Heap* heap) { 21 DCHECK(index < Natives::GetBuiltinsCount());
22 return heap->extra_natives_source_cache(); 22 source = Natives::GetScriptSource(index);
23 } 23 break;
24 24 case EXTRAS:
25 25 DCHECK(index < ExtraNatives::GetBuiltinsCount());
26 template <> 26 source = ExtraNatives::GetScriptSource(index);
27 FixedArray* NativesCollection<EXPERIMENTAL_EXTRAS>::GetSourceCache(Heap* heap) { 27 break;
28 return heap->experimental_extra_natives_source_cache(); 28 case EXPERIMENTAL_EXTRAS:
29 DCHECK(index < ExperimentalExtraNatives::GetBuiltinsCount());
30 source = ExperimentalExtraNatives::GetScriptSource(index);
31 break;
32 default:
33 UNREACHABLE();
34 }
35 data_ = source.start();
36 length_ = source.length();
29 } 37 }
30 38
31 } // namespace internal 39 } // namespace internal
32 } // namespace v8 40 } // namespace v8
OLDNEW
« no previous file with comments | « src/snapshot/natives.h ('k') | src/snapshot/serializer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698