Commit 2144dc2d authored by yurys@chromium.org's avatar yurys@chromium.org

Define V8EXPORT only in v8.h and use it in the other headers

V8EXPORT is defined in each header of V8 public API and the definitions already have some slight discrepancies. This CL makes all headers use the same definition in v8.h

BUG=None
R=svenpanne@chromium.org

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@16078 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 5e121882
...@@ -30,40 +30,6 @@ ...@@ -30,40 +30,6 @@
#include "v8.h" #include "v8.h"
#ifdef _WIN32
typedef int int32_t;
typedef unsigned int uint32_t;
typedef unsigned short uint16_t; // NOLINT
typedef long long int64_t; // NOLINT
// Setup for Windows DLL export/import. See v8.h in this directory for
// information on how to build/use V8 as a DLL.
#if defined(BUILDING_V8_SHARED) && defined(USING_V8_SHARED)
#error both BUILDING_V8_SHARED and USING_V8_SHARED are set - please check the\
build configuration to ensure that at most one of these is set
#endif
#ifdef BUILDING_V8_SHARED
#define EXPORT __declspec(dllexport)
#elif USING_V8_SHARED
#define EXPORT __declspec(dllimport)
#else
#define EXPORT
#endif
#else // _WIN32
// Setup for Linux shared library export. See v8.h in this directory for
// information on how to build/use V8 as shared library.
#if defined(__GNUC__) && (__GNUC__ >= 4) && defined(V8_SHARED)
#define EXPORT __attribute__ ((visibility("default")))
#else // defined(__GNUC__) && (__GNUC__ >= 4)
#define EXPORT
#endif // defined(__GNUC__) && (__GNUC__ >= 4)
#endif // _WIN32
/** /**
* Debugger support for the V8 JavaScript engine. * Debugger support for the V8 JavaScript engine.
*/ */
...@@ -81,7 +47,7 @@ enum DebugEvent { ...@@ -81,7 +47,7 @@ enum DebugEvent {
}; };
class EXPORT Debug { class V8_EXPORT Debug {
public: public:
/** /**
* A client object passed to the v8 debugger whose ownership will be taken by * A client object passed to the v8 debugger whose ownership will be taken by
......
...@@ -28,48 +28,14 @@ ...@@ -28,48 +28,14 @@
#ifndef PREPARSER_H #ifndef PREPARSER_H
#define PREPARSER_H #define PREPARSER_H
#include "v8.h"
#include "v8stdint.h" #include "v8stdint.h"
#ifdef _WIN32
// Setup for Windows DLL export/import. When building the V8 DLL the
// BUILDING_V8_SHARED needs to be defined. When building a program which uses
// the V8 DLL USING_V8_SHARED needs to be defined. When either building the V8
// static library or building a program which uses the V8 static library neither
// BUILDING_V8_SHARED nor USING_V8_SHARED should be defined.
#if defined(BUILDING_V8_SHARED) && defined(USING_V8_SHARED)
#error both BUILDING_V8_SHARED and USING_V8_SHARED are set - please check the\
build configuration to ensure that at most one of these is set
#endif
#ifdef BUILDING_V8_SHARED
#define V8EXPORT __declspec(dllexport)
#elif USING_V8_SHARED
#define V8EXPORT __declspec(dllimport)
#else
#define V8EXPORT
#endif // BUILDING_V8_SHARED
#else // _WIN32
// Setup for Linux shared library export. There is no need to distinguish
// between building or using the V8 shared library, but we should not
// export symbols when we are building a static library.
#if defined(__GNUC__) && ((__GNUC__ >= 4) || \
(__GNUC__ == 3 && __GNUC_MINOR__ >= 3)) && defined(V8_SHARED)
#define V8EXPORT __attribute__ ((visibility("default")))
#else
#define V8EXPORT
#endif
#endif // _WIN32
namespace v8 { namespace v8 {
// The result of preparsing is either a stack overflow error, or an opaque // The result of preparsing is either a stack overflow error, or an opaque
// blob of data that can be passed back into the parser. // blob of data that can be passed back into the parser.
class V8EXPORT PreParserData { class V8_EXPORT PreParserData {
public: public:
PreParserData(size_t size, const uint8_t* data) PreParserData(size_t size, const uint8_t* data)
: data_(data), size_(size) { } : data_(data), size_(size) { }
...@@ -94,7 +60,7 @@ class V8EXPORT PreParserData { ...@@ -94,7 +60,7 @@ class V8EXPORT PreParserData {
// Interface for a stream of Unicode characters. // Interface for a stream of Unicode characters.
class V8EXPORT UnicodeInputStream { // NOLINT - Thinks V8EXPORT is class name. class V8_EXPORT UnicodeInputStream { // NOLINT - V8_EXPORT is not a class name.
public: public:
virtual ~UnicodeInputStream(); virtual ~UnicodeInputStream();
...@@ -110,11 +76,9 @@ class V8EXPORT UnicodeInputStream { // NOLINT - Thinks V8EXPORT is class name. ...@@ -110,11 +76,9 @@ class V8EXPORT UnicodeInputStream { // NOLINT - Thinks V8EXPORT is class name.
// more stack space than the limit provided, the result's stack_overflow() // more stack space than the limit provided, the result's stack_overflow()
// method will return true. Otherwise the result contains preparser // method will return true. Otherwise the result contains preparser
// data that can be used by the V8 parser to speed up parsing. // data that can be used by the V8 parser to speed up parsing.
PreParserData V8EXPORT Preparse(UnicodeInputStream* input, PreParserData V8_EXPORT Preparse(UnicodeInputStream* input,
size_t max_stack_size); size_t max_stack_size);
} // namespace v8. } // namespace v8.
#undef V8EXPORT
#endif // PREPARSER_H #endif // PREPARSER_H
...@@ -30,36 +30,6 @@ ...@@ -30,36 +30,6 @@
#include "v8.h" #include "v8.h"
#ifdef _WIN32
// Setup for Windows DLL export/import. See v8.h in this directory for
// information on how to build/use V8 as a DLL.
#if defined(BUILDING_V8_SHARED) && defined(USING_V8_SHARED)
#error both BUILDING_V8_SHARED and USING_V8_SHARED are set - please check the\
build configuration to ensure that at most one of these is set
#endif
#ifdef BUILDING_V8_SHARED
#define V8EXPORT __declspec(dllexport)
#elif USING_V8_SHARED
#define V8EXPORT __declspec(dllimport)
#else
#define V8EXPORT
#endif
#else // _WIN32
// Setup for Linux shared library export. See v8.h in this directory for
// information on how to build/use V8 as shared library.
#if defined(__GNUC__) && ((__GNUC__ >= 4) || \
(__GNUC__ == 3 && __GNUC_MINOR__ >= 3)) && defined(V8_SHARED)
#define V8EXPORT __attribute__ ((visibility("default")))
#else
#define V8EXPORT
#endif
#endif // _WIN32
/** /**
* Profiler support for the V8 JavaScript engine. * Profiler support for the V8 JavaScript engine.
*/ */
...@@ -70,7 +40,7 @@ typedef uint32_t SnapshotObjectId; ...@@ -70,7 +40,7 @@ typedef uint32_t SnapshotObjectId;
/** /**
* CpuProfileNode represents a node in a call graph. * CpuProfileNode represents a node in a call graph.
*/ */
class V8EXPORT CpuProfileNode { class V8_EXPORT CpuProfileNode {
public: public:
/** Returns function name (empty string for anonymous functions.) */ /** Returns function name (empty string for anonymous functions.) */
Handle<String> GetFunctionName() const; Handle<String> GetFunctionName() const;
...@@ -125,7 +95,7 @@ class V8EXPORT CpuProfileNode { ...@@ -125,7 +95,7 @@ class V8EXPORT CpuProfileNode {
* CpuProfile contains a CPU profile in a form of top-down call tree * CpuProfile contains a CPU profile in a form of top-down call tree
* (from main() down to functions that do all the work). * (from main() down to functions that do all the work).
*/ */
class V8EXPORT CpuProfile { class V8_EXPORT CpuProfile {
public: public:
/** Returns CPU profile UID (assigned by the profiler.) */ /** Returns CPU profile UID (assigned by the profiler.) */
unsigned GetUid() const; unsigned GetUid() const;
...@@ -176,7 +146,7 @@ class V8EXPORT CpuProfile { ...@@ -176,7 +146,7 @@ class V8EXPORT CpuProfile {
* Interface for controlling CPU profiling. Instance of the * Interface for controlling CPU profiling. Instance of the
* profiler can be retrieved using v8::Isolate::GetCpuProfiler. * profiler can be retrieved using v8::Isolate::GetCpuProfiler.
*/ */
class V8EXPORT CpuProfiler { class V8_EXPORT CpuProfiler {
public: public:
/** /**
* A note on security tokens usage. As scripts from different * A note on security tokens usage. As scripts from different
...@@ -237,7 +207,7 @@ class HeapGraphNode; ...@@ -237,7 +207,7 @@ class HeapGraphNode;
* HeapSnapshotEdge represents a directed connection between heap * HeapSnapshotEdge represents a directed connection between heap
* graph nodes: from retainers to retained nodes. * graph nodes: from retainers to retained nodes.
*/ */
class V8EXPORT HeapGraphEdge { class V8_EXPORT HeapGraphEdge {
public: public:
enum Type { enum Type {
kContextVariable = 0, // A variable from a function context. kContextVariable = 0, // A variable from a function context.
...@@ -273,7 +243,7 @@ class V8EXPORT HeapGraphEdge { ...@@ -273,7 +243,7 @@ class V8EXPORT HeapGraphEdge {
/** /**
* HeapGraphNode represents a node in a heap graph. * HeapGraphNode represents a node in a heap graph.
*/ */
class V8EXPORT HeapGraphNode { class V8_EXPORT HeapGraphNode {
public: public:
enum Type { enum Type {
kHidden = 0, // Hidden node, may be filtered when shown to user. kHidden = 0, // Hidden node, may be filtered when shown to user.
...@@ -325,7 +295,7 @@ class V8EXPORT HeapGraphNode { ...@@ -325,7 +295,7 @@ class V8EXPORT HeapGraphNode {
/** /**
* HeapSnapshots record the state of the JS heap at some moment. * HeapSnapshots record the state of the JS heap at some moment.
*/ */
class V8EXPORT HeapSnapshot { class V8_EXPORT HeapSnapshot {
public: public:
enum SerializationFormat { enum SerializationFormat {
kJSON = 0 // See format description near 'Serialize' method. kJSON = 0 // See format description near 'Serialize' method.
...@@ -395,7 +365,7 @@ class RetainedObjectInfo; ...@@ -395,7 +365,7 @@ class RetainedObjectInfo;
* Interface for controlling heap profiling. Instance of the * Interface for controlling heap profiling. Instance of the
* profiler can be retrieved using v8::Isolate::GetHeapProfiler. * profiler can be retrieved using v8::Isolate::GetHeapProfiler.
*/ */
class V8EXPORT HeapProfiler { class V8_EXPORT HeapProfiler {
public: public:
/** /**
* Callback function invoked for obtaining RetainedObjectInfo for * Callback function invoked for obtaining RetainedObjectInfo for
...@@ -533,7 +503,7 @@ class V8EXPORT HeapProfiler { ...@@ -533,7 +503,7 @@ class V8EXPORT HeapProfiler {
* keeps them alive only during snapshot collection. Afterwards, they * keeps them alive only during snapshot collection. Afterwards, they
* are freed by calling the Dispose class function. * are freed by calling the Dispose class function.
*/ */
class V8EXPORT RetainedObjectInfo { // NOLINT class V8_EXPORT RetainedObjectInfo { // NOLINT
public: public:
/** Called by V8 when it no longer needs an instance. */ /** Called by V8 when it no longer needs an instance. */
virtual void Dispose() = 0; virtual void Dispose() = 0;
...@@ -599,7 +569,4 @@ struct HeapStatsUpdate { ...@@ -599,7 +569,4 @@ struct HeapStatsUpdate {
} // namespace v8 } // namespace v8
#undef V8EXPORT
#endif // V8_V8_PROFILER_H_ #endif // V8_V8_PROFILER_H_
...@@ -30,42 +30,12 @@ ...@@ -30,42 +30,12 @@
#include "v8.h" #include "v8.h"
#ifdef _WIN32
// Setup for Windows DLL export/import. See v8.h in this directory for
// information on how to build/use V8 as a DLL.
#if defined(BUILDING_V8_SHARED) && defined(USING_V8_SHARED)
#error both BUILDING_V8_SHARED and USING_V8_SHARED are set - please check the\
build configuration to ensure that at most one of these is set
#endif
#ifdef BUILDING_V8_SHARED
#define V8EXPORT __declspec(dllexport)
#elif USING_V8_SHARED
#define V8EXPORT __declspec(dllimport)
#else
#define V8EXPORT
#endif
#else // _WIN32
// Setup for Linux shared library export. See v8.h in this directory for
// information on how to build/use V8 as shared library.
#if defined(__GNUC__) && ((__GNUC__ >= 4) || \
(__GNUC__ == 3 && __GNUC_MINOR__ >= 3)) && defined(V8_SHARED)
#define V8EXPORT __attribute__ ((visibility("default")))
#else
#define V8EXPORT
#endif
#endif // _WIN32
/** /**
* Testing support for the V8 JavaScript engine. * Testing support for the V8 JavaScript engine.
*/ */
namespace v8 { namespace v8 {
class V8EXPORT Testing { class V8_EXPORT Testing {
public: public:
enum StressType { enum StressType {
kStressTypeOpt, kStressTypeOpt,
...@@ -99,7 +69,7 @@ class V8EXPORT Testing { ...@@ -99,7 +69,7 @@ class V8EXPORT Testing {
} // namespace v8 } // namespace v8
#undef V8EXPORT #undef V8_EXPORT
#endif // V8_V8_TEST_H_ #endif // V8_V8_TEST_H_
This diff is collapsed.
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