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

Unified Diff: src/snapshot/natives-common.cc

Issue 1303463002: Remove inline header includes from natives.h header. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Addressed comments. 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/snapshot/natives.h ('k') | src/snapshot/natives-external.cc » ('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
new file mode 100644
index 0000000000000000000000000000000000000000..080cd4910411631fd2a75194c0fbb0d230599fda
--- /dev/null
+++ b/src/snapshot/natives-common.cc
@@ -0,0 +1,56 @@
+// Copyright 2015 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// The common functionality when building with internal or external natives.
+
+#include "src/heap/heap.h"
+#include "src/objects-inl.h"
+#include "src/snapshot/natives.h"
+
+namespace v8 {
+namespace internal {
+
+template <>
+FixedArray* NativesCollection<CORE>::GetSourceCache(Heap* heap) {
+ return heap->natives_source_cache();
+}
+
+
+template <>
+FixedArray* NativesCollection<EXPERIMENTAL>::GetSourceCache(Heap* heap) {
+ return heap->experimental_natives_source_cache();
+}
+
+
+template <>
+FixedArray* NativesCollection<EXTRAS>::GetSourceCache(Heap* heap) {
+ return heap->extra_natives_source_cache();
+}
+
+
+template <>
+FixedArray* NativesCollection<CODE_STUB>::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();
+ }
+ }
+}
+
+
+// Explicit template instantiations.
+template void NativesCollection<CORE>::UpdateSourceCache(Heap* heap);
+template void NativesCollection<CODE_STUB>::UpdateSourceCache(Heap* heap);
+template void NativesCollection<EXPERIMENTAL>::UpdateSourceCache(Heap* heap);
+template void NativesCollection<EXTRAS>::UpdateSourceCache(Heap* heap);
+
+} // namespace internal
+} // namespace v8
« no previous file with comments | « src/snapshot/natives.h ('k') | src/snapshot/natives-external.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698