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

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

Issue 1292533005: Remove heap-inl.h include from natives.h. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: fix again. argh templates. 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
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..b0ee9c6d8afae0ea1008147740f4f6112354b273
--- /dev/null
+++ b/src/snapshot/natives-common.cc
@@ -0,0 +1,50 @@
+// 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.h"
+#include "src/snapshot/natives.h"
+
+namespace v8 {
+namespace internal {
+
+template <NativeType type>
+FixedArray* NativesCollectionBase<type>::GetSourceCache(Heap* heap) {
Michael Starzinger 2015/08/18 12:05:56 First trying to templatize NativesCollection and t
+ switch (type) {
+ case CORE:
+ return heap->natives_source_cache();
+ case EXPERIMENTAL:
+ return heap->experimental_natives_source_cache();
+ case CODE_STUB:
+ return heap->code_stub_natives_source_cache();
+ case EXTRAS:
+ return heap->extra_natives_source_cache();
+ default:
+ UNREACHABLE();
+ return NULL;
+ }
+}
+
+
+template <NativeType type>
+void NativesCollectionBase<type>::UpdateSourceCache(Heap* heap) {
+ FixedArray* cache = GetSourceCache(heap);
+ for (int i = 0; i < cache->length(); i++) {
+ Object* source = cache->get(i);
+ if (!source->IsUndefined()) {
+ ExternalOneByteString::cast(source)->update_data_cache();
+ }
+ }
+}
+
+
+// Explicit template instantiation.
+template class NativesCollectionBase<CORE>;
+template class NativesCollectionBase<CODE_STUB>;
+template class NativesCollectionBase<EXPERIMENTAL>;
+template class NativesCollectionBase<EXTRAS>;
+} // namespace internal
+} // namespace v8
« src/snapshot/natives.h ('K') | « src/snapshot/natives.h ('k') | tools/gyp/v8.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698