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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/snapshot/natives.h ('k') | src/snapshot/serializer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/snapshot/natives-common.cc
diff --git a/src/snapshot/natives-common.cc b/src/snapshot/natives-common.cc
index 446c50f8a6fcae17d8e46a1df01e28c527e2674a..71f81ea971682b1970b06cad8a9a05cfe564b87c 100644
--- a/src/snapshot/natives-common.cc
+++ b/src/snapshot/natives-common.cc
@@ -11,21 +11,29 @@
namespace v8 {
namespace internal {
-template <>
-FixedArray* NativesCollection<CORE>::GetSourceCache(Heap* heap) {
- return heap->natives_source_cache();
-}
-
-
-template <>
-FixedArray* NativesCollection<EXTRAS>::GetSourceCache(Heap* heap) {
- return heap->extra_natives_source_cache();
-}
-
-
-template <>
-FixedArray* NativesCollection<EXPERIMENTAL_EXTRAS>::GetSourceCache(Heap* heap) {
- return heap->experimental_extra_natives_source_cache();
+NativesExternalStringResource::NativesExternalStringResource(NativeType type,
+ int index)
+ : type_(type), index_(index) {
+ Vector<const char> source;
+ DCHECK(0 <= index);
+ switch (type_) {
+ case CORE:
+ DCHECK(index < Natives::GetBuiltinsCount());
+ source = Natives::GetScriptSource(index);
+ break;
+ case EXTRAS:
+ DCHECK(index < ExtraNatives::GetBuiltinsCount());
+ source = ExtraNatives::GetScriptSource(index);
+ break;
+ case EXPERIMENTAL_EXTRAS:
+ DCHECK(index < ExperimentalExtraNatives::GetBuiltinsCount());
+ source = ExperimentalExtraNatives::GetScriptSource(index);
+ break;
+ default:
+ UNREACHABLE();
+ }
+ data_ = source.start();
+ length_ = source.length();
}
} // namespace internal
« 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