Commit 88309de1 authored by ahaas's avatar ahaas Committed by Commit bot

Moved the ExternalReferenceTable class to src/external-reference-table.cc/.h

The new location allows to add an external reference without requiring
an lgtm from a snapshot/ owner.

R=yangguo@chromium.org

Review URL: https://codereview.chromium.org/1812853002

Cr-Commit-Position: refs/heads/master@{#34858}
parent da8b4fa7
...@@ -1019,6 +1019,8 @@ source_set("v8_base") { ...@@ -1019,6 +1019,8 @@ source_set("v8_base") {
"src/extensions/statistics-extension.h", "src/extensions/statistics-extension.h",
"src/extensions/trigger-failure-extension.cc", "src/extensions/trigger-failure-extension.cc",
"src/extensions/trigger-failure-extension.h", "src/extensions/trigger-failure-extension.h",
"src/external-reference-table.cc",
"src/external-reference-table.h",
"src/factory.cc", "src/factory.cc",
"src/factory.h", "src/factory.h",
"src/fast-accessor-assembler.cc", "src/fast-accessor-assembler.cc",
......
This diff is collapsed.
// Copyright 2016 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.
#ifndef V8_EXTERNAL_REFERENCE_TABLE_H_
#define V8_EXTERNAL_REFERENCE_TABLE_H_
#include "src/address-map.h"
namespace v8 {
namespace internal {
class Isolate;
// ExternalReferenceTable is a helper class that defines the relationship
// between external references and their encodings. It is used to build
// hashmaps in ExternalReferenceEncoder and ExternalReferenceDecoder.
class ExternalReferenceTable {
public:
static ExternalReferenceTable* instance(Isolate* isolate);
int size() const { return refs_.length(); }
Address address(int i) { return refs_[i].address; }
const char* name(int i) { return refs_[i].name; }
inline static Address NotAvailable() { return NULL; }
static const int kDeoptTableSerializeEntryCount = 64;
private:
struct ExternalReferenceEntry {
Address address;
const char* name;
};
explicit ExternalReferenceTable(Isolate* isolate);
void Add(Address address, const char* name) {
ExternalReferenceEntry entry = {address, name};
refs_.Add(entry);
}
List<ExternalReferenceEntry> refs_;
DISALLOW_COPY_AND_ASSIGN(ExternalReferenceTable);
};
} // namespace internal
} // namespace v8
#endif // V8_EXTERNAL_REFERENCE_TABLE_H_
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
#include "src/crankshaft/hydrogen.h" #include "src/crankshaft/hydrogen.h"
#include "src/debug/debug.h" #include "src/debug/debug.h"
#include "src/deoptimizer.h" #include "src/deoptimizer.h"
#include "src/external-reference-table.h"
#include "src/frames-inl.h" #include "src/frames-inl.h"
#include "src/ic/stub-cache.h" #include "src/ic/stub-cache.h"
#include "src/interpreter/interpreter.h" #include "src/interpreter/interpreter.h"
...@@ -35,7 +36,6 @@ ...@@ -35,7 +36,6 @@
#include "src/runtime-profiler.h" #include "src/runtime-profiler.h"
#include "src/simulator.h" #include "src/simulator.h"
#include "src/snapshot/deserializer.h" #include "src/snapshot/deserializer.h"
#include "src/snapshot/serializer-common.h"
#include "src/v8.h" #include "src/v8.h"
#include "src/version.h" #include "src/version.h"
#include "src/vm-state-inl.h" #include "src/vm-state-inl.h"
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
#include "src/snapshot/deserializer.h" #include "src/snapshot/deserializer.h"
#include "src/bootstrapper.h" #include "src/bootstrapper.h"
#include "src/external-reference-table.h"
#include "src/heap/heap.h" #include "src/heap/heap.h"
#include "src/isolate.h" #include "src/isolate.h"
#include "src/macro-assembler.h" #include "src/macro-assembler.h"
......
This diff is collapsed.
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#define V8_SNAPSHOT_SERIALIZER_COMMON_H_ #define V8_SNAPSHOT_SERIALIZER_COMMON_H_
#include "src/address-map.h" #include "src/address-map.h"
#include "src/external-reference-table.h"
#include "src/globals.h" #include "src/globals.h"
namespace v8 { namespace v8 {
...@@ -13,39 +14,6 @@ namespace internal { ...@@ -13,39 +14,6 @@ namespace internal {
class Isolate; class Isolate;
// ExternalReferenceTable is a helper class that defines the relationship
// between external references and their encodings. It is used to build
// hashmaps in ExternalReferenceEncoder and ExternalReferenceDecoder.
class ExternalReferenceTable {
public:
static ExternalReferenceTable* instance(Isolate* isolate);
int size() const { return refs_.length(); }
Address address(int i) { return refs_[i].address; }
const char* name(int i) { return refs_[i].name; }
inline static Address NotAvailable() { return NULL; }
static const int kDeoptTableSerializeEntryCount = 64;
private:
struct ExternalReferenceEntry {
Address address;
const char* name;
};
explicit ExternalReferenceTable(Isolate* isolate);
void Add(Address address, const char* name) {
ExternalReferenceEntry entry = {address, name};
refs_.Add(entry);
}
List<ExternalReferenceEntry> refs_;
DISALLOW_COPY_AND_ASSIGN(ExternalReferenceTable);
};
class ExternalReferenceEncoder { class ExternalReferenceEncoder {
public: public:
explicit ExternalReferenceEncoder(Isolate* isolate); explicit ExternalReferenceEncoder(Isolate* isolate);
......
...@@ -8,7 +8,7 @@ import os ...@@ -8,7 +8,7 @@ import os
import sys import sys
DECLARE_FILE = "src/assembler.h" DECLARE_FILE = "src/assembler.h"
REGISTER_FILE = "src/snapshot/serializer-common.cc" REGISTER_FILE = "src/external-reference-table.cc"
DECLARE_RE = re.compile("\s*static ExternalReference ([^(]+)\(") DECLARE_RE = re.compile("\s*static ExternalReference ([^(]+)\(")
REGISTER_RE = re.compile("\s*Add\(ExternalReference::([^(]+)\(") REGISTER_RE = re.compile("\s*Add\(ExternalReference::([^(]+)\(")
......
...@@ -847,6 +847,8 @@ ...@@ -847,6 +847,8 @@
'../../src/extensions/statistics-extension.h', '../../src/extensions/statistics-extension.h',
'../../src/extensions/trigger-failure-extension.cc', '../../src/extensions/trigger-failure-extension.cc',
'../../src/extensions/trigger-failure-extension.h', '../../src/extensions/trigger-failure-extension.h',
'../../src/external-reference-table.cc',
'../../src/external-reference-table.h',
'../../src/factory.cc', '../../src/factory.cc',
'../../src/factory.h', '../../src/factory.h',
'../../src/fast-accessor-assembler.cc', '../../src/fast-accessor-assembler.cc',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment