Reviewers: Michael Starzinger,
Description:
Remove heap-inl.h include from natives.h.
[email protected]
Please review this at https://codereview.chromium.org/1292533005/
Base URL: https://chromium.googlesource.com/v8/v8.git@master
Affected files (+58, -35 lines):
M BUILD.gn
M src/snapshot/natives.h
A src/snapshot/natives-common.cc
M tools/gyp/v8.gyp
Index: BUILD.gn
diff --git a/BUILD.gn b/BUILD.gn
index
e25a68180a3e5b6e14ac29577352de3cfc86019e..55bbaccdf567fcc8a1492fcfceddc48be8a21146
100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -1135,6 +1135,7 @@ source_set("v8_base") {
"src/simulator.h",
"src/small-pointer-list.h",
"src/snapshot/natives.h",
+ "src/snapshot/natives-common.cc",
"src/snapshot/serialize.cc",
"src/snapshot/serialize.h",
"src/snapshot/snapshot-common.cc",
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..b91bea5b9d6a7758624cf59f380cbbaf0ad0f0ce
--- /dev/null
+++ b/src/snapshot/natives-common.cc
@@ -0,0 +1,55 @@
+// 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 <>
+FixedArray* Natives::GetSourceCache(Heap* heap) {
+ return heap->natives_source_cache();
+}
+
+
+template <>
+FixedArray* ExperimentalNatives::GetSourceCache(Heap* heap) {
+ return heap->experimental_natives_source_cache();
+}
+
+
+template <>
+FixedArray* ExtraNatives::GetSourceCache(Heap* heap) {
+ return heap->extra_natives_source_cache();
+}
+
+
+template <>
+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();
+ }
+ }
+}
+
+
+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
Index: src/snapshot/natives.h
diff --git a/src/snapshot/natives.h b/src/snapshot/natives.h
index
8c24bd23d089d6abd2bf9290487ec0e12f7c37a2..2ce648d49e8d53398a3e3e92982016bfcc8865d0
100644
--- a/src/snapshot/natives.h
+++ b/src/snapshot/natives.h
@@ -39,7 +39,7 @@ class NativesCollection {
// The following methods are implemented below:
- inline static FixedArray* GetSourceCache(Heap* heap);
+ static FixedArray* GetSourceCache(Heap* heap);
static void UpdateSourceCache(Heap* heap);
};
@@ -49,40 +49,6 @@ 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);
Index: tools/gyp/v8.gyp
diff --git a/tools/gyp/v8.gyp b/tools/gyp/v8.gyp
index
0ac43deaf5fe5a463e3f5f65b5e9b2a6c6bd305f..4d205a728138248962ef4e1c1901ccc0064a1da5
100644
--- a/tools/gyp/v8.gyp
+++ b/tools/gyp/v8.gyp
@@ -929,6 +929,7 @@
'../../src/simulator.h',
'../../src/small-pointer-list.h',
'../../src/snapshot/natives.h',
+ '../../src/snapshot/natives-common.cc',
'../../src/snapshot/serialize.cc',
'../../src/snapshot/serialize.h',
'../../src/snapshot/snapshot.h',
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.