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

Unified Diff: src/snapshot/natives.h

Issue 1289603002: Put V8 extras into the snapshot (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix nit Created 5 years, 4 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/bootstrapper.cc ('k') | src/snapshot/serialize.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/snapshot/natives.h
diff --git a/src/snapshot/natives.h b/src/snapshot/natives.h
index 08bc40cf86464a0d51c3cafc31dcac299b5981bc..8c24bd23d089d6abd2bf9290487ec0e12f7c37a2 100644
--- a/src/snapshot/natives.h
+++ b/src/snapshot/natives.h
@@ -5,6 +5,10 @@
#ifndef V8_SNAPSHOT_NATIVES_H_
#define V8_SNAPSHOT_NATIVES_H_
+#include "src/heap/heap.h"
+#include "src/heap/heap-inl.h"
Michael Starzinger 2015/08/17 16:47:26 I have been working the entire last week to get ri
+#include "src/objects.h"
+#include "src/objects-inl.h"
#include "src/vector.h"
namespace v8 { class StartupData; } // Forward declaration.
@@ -17,6 +21,8 @@ enum NativeType { CORE, CODE_STUB, EXPERIMENTAL, EXTRAS, D8, TEST };
template <NativeType type>
class NativesCollection {
public:
+ // The following methods are implemented in js2c-generated code:
+
// Number of built-in scripts.
static int GetBuiltinsCount();
// Number of debugger implementation scripts.
@@ -30,6 +36,11 @@ class NativesCollection {
static Vector<const char> GetScriptSource(int index);
static Vector<const char> GetScriptName(int index);
static Vector<const char> GetScriptsSource();
+
+ // The following methods are implemented below:
+
+ inline static FixedArray* GetSourceCache(Heap* heap);
+ static void UpdateSourceCache(Heap* heap);
};
typedef NativesCollection<CORE> Natives;
@@ -37,6 +48,41 @@ typedef NativesCollection<CODE_STUB> CodeStubNatives;
typedef NativesCollection<EXPERIMENTAL> ExperimentalNatives;
typedef NativesCollection<EXTRAS> ExtraNatives;
+
+template <>
+inline FixedArray* Natives::GetSourceCache(Heap* heap) {
+ return heap->natives_source_cache();
+}
+
+
+template <>
+inline FixedArray* ExperimentalNatives::GetSourceCache(Heap* heap) {
+ return heap->experimental_natives_source_cache();
+}
+
+
+template <>
+inline FixedArray* ExtraNatives::GetSourceCache(Heap* heap) {
+ return heap->extra_natives_source_cache();
+}
+
+
+template <>
+inline FixedArray* CodeStubNatives::GetSourceCache(Heap* heap) {
+ return heap->code_stub_natives_source_cache();
+}
+
+template <NativeType type>
+void NativesCollection<type>::UpdateSourceCache(Heap* heap) {
+ for (int i = 0; i < GetBuiltinsCount(); i++) {
+ Object* source = GetSourceCache(heap)->get(i);
+ if (!source->IsUndefined()) {
+ ExternalOneByteString::cast(source)->update_data_cache();
+ }
+ }
+}
+
+
#ifdef V8_USE_EXTERNAL_STARTUP_DATA
// Used for reading the natives at runtime. Implementation in natives-empty.cc
void SetNativesFromFile(StartupData* natives_blob);
« no previous file with comments | « src/bootstrapper.cc ('k') | src/snapshot/serialize.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698