2012-01-11 14:42:58 +00:00
|
|
|
// Copyright 2012 the V8 project authors. All rights reserved.
|
2008-10-21 09:12:27 +00:00
|
|
|
// Redistribution and use in source and binary forms, with or without
|
|
|
|
// modification, are permitted provided that the following conditions are
|
|
|
|
// met:
|
|
|
|
//
|
|
|
|
// * Redistributions of source code must retain the above copyright
|
|
|
|
// notice, this list of conditions and the following disclaimer.
|
|
|
|
// * Redistributions in binary form must reproduce the above
|
|
|
|
// copyright notice, this list of conditions and the following
|
|
|
|
// disclaimer in the documentation and/or other materials provided
|
|
|
|
// with the distribution.
|
|
|
|
// * Neither the name of Google Inc. nor the names of its
|
|
|
|
// contributors may be used to endorse or promote products derived
|
|
|
|
// from this software without specific prior written permission.
|
|
|
|
//
|
|
|
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
|
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
|
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
|
|
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
|
|
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
|
|
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
|
|
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
|
|
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
|
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
|
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
|
|
|
|
#ifndef V8_D8_H_
|
|
|
|
#define V8_D8_H_
|
|
|
|
|
2011-08-08 09:34:18 +00:00
|
|
|
#ifndef V8_SHARED
|
2011-07-14 15:43:40 +00:00
|
|
|
#include "allocation.h"
|
2009-03-24 13:33:54 +00:00
|
|
|
#include "hashmap.h"
|
2012-07-19 18:58:23 +00:00
|
|
|
#include "smart-pointers.h"
|
2011-09-08 13:51:06 +00:00
|
|
|
#include "v8.h"
|
2011-07-14 15:43:40 +00:00
|
|
|
#else
|
|
|
|
#include "../include/v8.h"
|
2011-08-08 09:34:18 +00:00
|
|
|
#endif // V8_SHARED
|
2008-10-21 09:12:27 +00:00
|
|
|
|
|
|
|
namespace v8 {
|
|
|
|
|
|
|
|
|
2011-08-08 09:34:18 +00:00
|
|
|
#ifndef V8_SHARED
|
2008-12-03 09:35:21 +00:00
|
|
|
// A single counter in a counter collection.
|
2008-10-21 09:12:27 +00:00
|
|
|
class Counter {
|
|
|
|
public:
|
2008-12-03 09:35:21 +00:00
|
|
|
static const int kMaxNameSize = 64;
|
2009-04-14 00:30:44 +00:00
|
|
|
int32_t* Bind(const char* name, bool histogram);
|
|
|
|
int32_t* ptr() { return &count_; }
|
|
|
|
int32_t count() { return count_; }
|
|
|
|
int32_t sample_total() { return sample_total_; }
|
|
|
|
bool is_histogram() { return is_histogram_; }
|
|
|
|
void AddSample(int32_t sample);
|
2008-10-21 09:12:27 +00:00
|
|
|
private:
|
2009-04-14 00:30:44 +00:00
|
|
|
int32_t count_;
|
|
|
|
int32_t sample_total_;
|
|
|
|
bool is_histogram_;
|
2008-12-03 09:35:21 +00:00
|
|
|
uint8_t name_[kMaxNameSize];
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
// A set of counters and associated information. An instance of this
|
|
|
|
// class is stored directly in the memory-mapped counters file if
|
|
|
|
// the --map-counters options is used
|
|
|
|
class CounterCollection {
|
|
|
|
public:
|
|
|
|
CounterCollection();
|
|
|
|
Counter* GetNextCounter();
|
|
|
|
private:
|
2012-07-13 12:22:09 +00:00
|
|
|
static const unsigned kMaxCounters = 512;
|
2008-12-03 09:35:21 +00:00
|
|
|
uint32_t magic_number_;
|
|
|
|
uint32_t max_counters_;
|
|
|
|
uint32_t max_name_size_;
|
|
|
|
uint32_t counters_in_use_;
|
|
|
|
Counter counters_[kMaxCounters];
|
2008-10-21 09:12:27 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2009-03-24 13:33:54 +00:00
|
|
|
class CounterMap {
|
|
|
|
public:
|
|
|
|
CounterMap(): hash_map_(Match) { }
|
|
|
|
Counter* Lookup(const char* name) {
|
|
|
|
i::HashMap::Entry* answer = hash_map_.Lookup(
|
|
|
|
const_cast<char*>(name),
|
|
|
|
Hash(name),
|
|
|
|
false);
|
|
|
|
if (!answer) return NULL;
|
|
|
|
return reinterpret_cast<Counter*>(answer->value);
|
|
|
|
}
|
|
|
|
void Set(const char* name, Counter* value) {
|
|
|
|
i::HashMap::Entry* answer = hash_map_.Lookup(
|
|
|
|
const_cast<char*>(name),
|
|
|
|
Hash(name),
|
|
|
|
true);
|
|
|
|
ASSERT(answer != NULL);
|
|
|
|
answer->value = value;
|
|
|
|
}
|
|
|
|
class Iterator {
|
|
|
|
public:
|
2009-03-24 14:29:49 +00:00
|
|
|
explicit Iterator(CounterMap* map)
|
|
|
|
: map_(&map->hash_map_), entry_(map_->Start()) { }
|
2009-03-24 13:33:54 +00:00
|
|
|
void Next() { entry_ = map_->Next(entry_); }
|
|
|
|
bool More() { return entry_ != NULL; }
|
|
|
|
const char* CurrentKey() { return static_cast<const char*>(entry_->key); }
|
|
|
|
Counter* CurrentValue() { return static_cast<Counter*>(entry_->value); }
|
|
|
|
private:
|
|
|
|
i::HashMap* map_;
|
|
|
|
i::HashMap::Entry* entry_;
|
|
|
|
};
|
2011-06-07 07:17:46 +00:00
|
|
|
|
2009-03-24 13:33:54 +00:00
|
|
|
private:
|
|
|
|
static int Hash(const char* name);
|
|
|
|
static bool Match(void* key1, void* key2);
|
|
|
|
i::HashMap hash_map_;
|
|
|
|
};
|
2011-08-08 09:34:18 +00:00
|
|
|
#endif // V8_SHARED
|
2009-03-24 13:33:54 +00:00
|
|
|
|
|
|
|
|
2011-09-14 14:39:56 +00:00
|
|
|
class LineEditor {
|
|
|
|
public:
|
|
|
|
enum Type { DUMB = 0, READLINE = 1 };
|
|
|
|
LineEditor(Type type, const char* name);
|
|
|
|
virtual ~LineEditor() { }
|
|
|
|
|
2012-01-17 13:37:09 +00:00
|
|
|
virtual Handle<String> Prompt(const char* prompt) = 0;
|
2013-03-12 08:00:20 +00:00
|
|
|
virtual bool Open(Isolate* isolate) { return true; }
|
2011-09-14 14:39:56 +00:00
|
|
|
virtual bool Close() { return true; }
|
|
|
|
virtual void AddHistory(const char* str) { }
|
|
|
|
|
|
|
|
const char* name() { return name_; }
|
2013-02-28 17:40:24 +00:00
|
|
|
static LineEditor* Get() { return current_; }
|
2011-09-14 14:39:56 +00:00
|
|
|
private:
|
|
|
|
Type type_;
|
|
|
|
const char* name_;
|
2013-02-28 17:40:24 +00:00
|
|
|
static LineEditor* current_;
|
2011-09-14 14:39:56 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2011-07-11 07:38:09 +00:00
|
|
|
class SourceGroup {
|
|
|
|
public:
|
2011-07-14 15:43:40 +00:00
|
|
|
SourceGroup() :
|
2011-08-08 09:34:18 +00:00
|
|
|
#ifndef V8_SHARED
|
2011-07-14 15:43:40 +00:00
|
|
|
next_semaphore_(v8::internal::OS::CreateSemaphore(0)),
|
|
|
|
done_semaphore_(v8::internal::OS::CreateSemaphore(0)),
|
2011-09-08 22:44:03 +00:00
|
|
|
thread_(NULL),
|
2011-08-08 09:34:18 +00:00
|
|
|
#endif // V8_SHARED
|
2011-07-14 15:43:40 +00:00
|
|
|
argv_(NULL),
|
|
|
|
begin_offset_(0),
|
2011-09-08 13:51:06 +00:00
|
|
|
end_offset_(0) {}
|
2011-07-11 07:38:09 +00:00
|
|
|
|
2011-09-08 22:44:03 +00:00
|
|
|
~SourceGroup();
|
|
|
|
|
2011-07-11 07:38:09 +00:00
|
|
|
void Begin(char** argv, int offset) {
|
|
|
|
argv_ = const_cast<const char**>(argv);
|
|
|
|
begin_offset_ = offset;
|
|
|
|
}
|
|
|
|
|
|
|
|
void End(int offset) { end_offset_ = offset; }
|
|
|
|
|
2012-11-20 14:47:56 +00:00
|
|
|
void Execute(Isolate* isolate);
|
2011-07-11 07:38:09 +00:00
|
|
|
|
2011-08-08 09:34:18 +00:00
|
|
|
#ifndef V8_SHARED
|
2011-07-11 07:38:09 +00:00
|
|
|
void StartExecuteInThread();
|
|
|
|
void WaitForThread();
|
|
|
|
|
|
|
|
private:
|
|
|
|
class IsolateThread : public i::Thread {
|
|
|
|
public:
|
|
|
|
explicit IsolateThread(SourceGroup* group)
|
|
|
|
: i::Thread(GetThreadOptions()), group_(group) {}
|
|
|
|
|
|
|
|
virtual void Run() {
|
|
|
|
group_->ExecuteInThread();
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
SourceGroup* group_;
|
|
|
|
};
|
|
|
|
|
|
|
|
static i::Thread::Options GetThreadOptions();
|
|
|
|
void ExecuteInThread();
|
|
|
|
|
2011-09-08 22:44:03 +00:00
|
|
|
i::Semaphore* next_semaphore_;
|
|
|
|
i::Semaphore* done_semaphore_;
|
|
|
|
i::Thread* thread_;
|
2011-08-08 09:34:18 +00:00
|
|
|
#endif // V8_SHARED
|
2011-07-11 07:38:09 +00:00
|
|
|
|
|
|
|
void ExitShell(int exit_code);
|
2012-11-20 14:47:56 +00:00
|
|
|
Handle<String> ReadFile(Isolate* isolate, const char* name);
|
2011-07-11 07:38:09 +00:00
|
|
|
|
|
|
|
const char** argv_;
|
|
|
|
int begin_offset_;
|
|
|
|
int end_offset_;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2012-01-24 11:55:11 +00:00
|
|
|
class BinaryResource : public v8::String::ExternalAsciiStringResource {
|
|
|
|
public:
|
|
|
|
BinaryResource(const char* string, int length)
|
|
|
|
: data_(string),
|
|
|
|
length_(length) { }
|
|
|
|
|
|
|
|
~BinaryResource() {
|
|
|
|
delete[] data_;
|
|
|
|
data_ = NULL;
|
|
|
|
length_ = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual const char* data() const { return data_; }
|
|
|
|
virtual size_t length() const { return length_; }
|
|
|
|
|
|
|
|
private:
|
|
|
|
const char* data_;
|
|
|
|
size_t length_;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2011-07-11 07:38:09 +00:00
|
|
|
class ShellOptions {
|
|
|
|
public:
|
2011-07-14 15:43:40 +00:00
|
|
|
ShellOptions() :
|
2011-08-08 09:34:18 +00:00
|
|
|
#ifndef V8_SHARED
|
2011-07-14 15:43:40 +00:00
|
|
|
use_preemption(true),
|
|
|
|
preemption_interval(10),
|
2011-09-13 13:16:13 +00:00
|
|
|
num_parallel_files(0),
|
2011-07-14 15:43:40 +00:00
|
|
|
parallel_files(NULL),
|
2011-08-08 09:34:18 +00:00
|
|
|
#endif // V8_SHARED
|
2011-07-14 15:43:40 +00:00
|
|
|
script_executed(false),
|
|
|
|
last_run(true),
|
2012-08-20 13:19:52 +00:00
|
|
|
send_idle_notification(false),
|
2011-07-14 15:43:40 +00:00
|
|
|
stress_opt(false),
|
|
|
|
stress_deopt(false),
|
|
|
|
interactive_shell(false),
|
|
|
|
test_shell(false),
|
|
|
|
num_isolates(1),
|
|
|
|
isolate_sources(NULL) { }
|
|
|
|
|
2011-09-13 13:16:13 +00:00
|
|
|
~ShellOptions() {
|
|
|
|
#ifndef V8_SHARED
|
|
|
|
delete[] parallel_files;
|
|
|
|
#endif // V8_SHARED
|
|
|
|
delete[] isolate_sources;
|
|
|
|
}
|
2011-09-13 09:31:41 +00:00
|
|
|
|
2011-08-08 09:34:18 +00:00
|
|
|
#ifndef V8_SHARED
|
2011-07-14 15:43:40 +00:00
|
|
|
bool use_preemption;
|
|
|
|
int preemption_interval;
|
2011-09-13 13:16:13 +00:00
|
|
|
int num_parallel_files;
|
|
|
|
char** parallel_files;
|
2011-08-08 09:34:18 +00:00
|
|
|
#endif // V8_SHARED
|
2011-07-11 07:38:09 +00:00
|
|
|
bool script_executed;
|
|
|
|
bool last_run;
|
2012-08-20 13:19:52 +00:00
|
|
|
bool send_idle_notification;
|
2011-07-11 07:38:09 +00:00
|
|
|
bool stress_opt;
|
|
|
|
bool stress_deopt;
|
|
|
|
bool interactive_shell;
|
|
|
|
bool test_shell;
|
|
|
|
int num_isolates;
|
|
|
|
SourceGroup* isolate_sources;
|
|
|
|
};
|
|
|
|
|
2011-08-08 09:34:18 +00:00
|
|
|
#ifdef V8_SHARED
|
2011-07-14 15:43:40 +00:00
|
|
|
class Shell {
|
|
|
|
#else
|
|
|
|
class Shell : public i::AllStatic {
|
2011-08-08 09:34:18 +00:00
|
|
|
#endif // V8_SHARED
|
2011-09-08 19:57:14 +00:00
|
|
|
|
2008-10-21 09:12:27 +00:00
|
|
|
public:
|
2013-03-15 12:06:53 +00:00
|
|
|
static bool ExecuteString(Isolate* isolate,
|
|
|
|
Handle<String> source,
|
2008-10-21 09:12:27 +00:00
|
|
|
Handle<Value> name,
|
|
|
|
bool print_result,
|
|
|
|
bool report_exceptions);
|
2010-04-16 12:19:47 +00:00
|
|
|
static const char* ToCString(const v8::String::Utf8Value& value);
|
2013-03-15 12:06:53 +00:00
|
|
|
static void ReportException(Isolate* isolate, TryCatch* try_catch);
|
2012-11-20 14:47:56 +00:00
|
|
|
static Handle<String> ReadFile(Isolate* isolate, const char* name);
|
2013-05-08 07:45:16 +00:00
|
|
|
static Local<Context> CreateEvaluationContext(Isolate* isolate);
|
2012-11-20 14:47:56 +00:00
|
|
|
static int RunMain(Isolate* isolate, int argc, char* argv[]);
|
2011-07-14 15:43:40 +00:00
|
|
|
static int Main(int argc, char* argv[]);
|
2011-09-13 13:16:13 +00:00
|
|
|
static void Exit(int exit_code);
|
2013-01-08 15:24:17 +00:00
|
|
|
static void OnExit();
|
2011-07-14 15:43:40 +00:00
|
|
|
|
2011-08-08 09:34:18 +00:00
|
|
|
#ifndef V8_SHARED
|
2013-03-15 12:06:53 +00:00
|
|
|
static Handle<Array> GetCompletions(Isolate* isolate,
|
|
|
|
Handle<String> text,
|
2011-07-14 15:43:40 +00:00
|
|
|
Handle<String> full);
|
2008-12-01 07:40:43 +00:00
|
|
|
static int* LookupCounter(const char* name);
|
2009-04-14 00:30:44 +00:00
|
|
|
static void* CreateHistogram(const char* name,
|
|
|
|
int min,
|
|
|
|
int max,
|
|
|
|
size_t buckets);
|
|
|
|
static void AddHistogramSample(void* histogram, int sample);
|
2008-12-03 09:35:21 +00:00
|
|
|
static void MapCounters(const char* name);
|
2011-07-14 15:43:40 +00:00
|
|
|
|
2009-04-20 16:36:13 +00:00
|
|
|
#ifdef ENABLE_DEBUGGER_SUPPORT
|
2013-05-02 20:18:42 +00:00
|
|
|
static Handle<Object> DebugMessageDetails(Isolate* isolate,
|
|
|
|
Handle<String> message);
|
|
|
|
static Handle<Value> DebugCommandToJSONRequest(Isolate* isolate,
|
|
|
|
Handle<String> command);
|
2012-01-20 11:59:00 +00:00
|
|
|
static void DispatchDebugMessages();
|
|
|
|
#endif // ENABLE_DEBUGGER_SUPPORT
|
|
|
|
#endif // V8_SHARED
|
2008-10-21 09:12:27 +00:00
|
|
|
|
2013-06-05 12:36:33 +00:00
|
|
|
static void RealmCurrent(const v8::FunctionCallbackInfo<v8::Value>& args);
|
|
|
|
static void RealmOwner(const v8::FunctionCallbackInfo<v8::Value>& args);
|
|
|
|
static void RealmGlobal(const v8::FunctionCallbackInfo<v8::Value>& args);
|
|
|
|
static void RealmCreate(const v8::FunctionCallbackInfo<v8::Value>& args);
|
|
|
|
static void RealmDispose(const v8::FunctionCallbackInfo<v8::Value>& args);
|
|
|
|
static void RealmSwitch(const v8::FunctionCallbackInfo<v8::Value>& args);
|
|
|
|
static void RealmEval(const v8::FunctionCallbackInfo<v8::Value>& args);
|
|
|
|
static void RealmSharedGet(Local<String> property,
|
|
|
|
const PropertyCallbackInfo<Value>& info);
|
2013-04-22 11:29:52 +00:00
|
|
|
static void RealmSharedSet(Local<String> property,
|
|
|
|
Local<Value> value,
|
2013-06-05 12:36:33 +00:00
|
|
|
const PropertyCallbackInfo<void>& info);
|
|
|
|
|
|
|
|
static void Print(const v8::FunctionCallbackInfo<v8::Value>& args);
|
|
|
|
static void Write(const v8::FunctionCallbackInfo<v8::Value>& args);
|
|
|
|
static void Quit(const v8::FunctionCallbackInfo<v8::Value>& args);
|
|
|
|
static void Version(const v8::FunctionCallbackInfo<v8::Value>& args);
|
|
|
|
static void EnableProfiler(const v8::FunctionCallbackInfo<v8::Value>& args);
|
|
|
|
static void DisableProfiler(const v8::FunctionCallbackInfo<v8::Value>& args);
|
|
|
|
static void Read(const v8::FunctionCallbackInfo<v8::Value>& args);
|
|
|
|
static void ReadBuffer(const v8::FunctionCallbackInfo<v8::Value>& args);
|
2012-11-20 14:47:56 +00:00
|
|
|
static Handle<String> ReadFromStdin(Isolate* isolate);
|
2013-06-05 12:36:33 +00:00
|
|
|
static void ReadLine(const v8::FunctionCallbackInfo<v8::Value>& args) {
|
|
|
|
args.GetReturnValue().Set(ReadFromStdin(args.GetIsolate()));
|
2012-01-17 13:37:09 +00:00
|
|
|
}
|
2013-06-05 12:36:33 +00:00
|
|
|
static void Load(const v8::FunctionCallbackInfo<v8::Value>& args);
|
|
|
|
static void ArrayBuffer(const v8::FunctionCallbackInfo<v8::Value>& args);
|
|
|
|
static void Int8Array(const v8::FunctionCallbackInfo<v8::Value>& args);
|
|
|
|
static void Uint8Array(const v8::FunctionCallbackInfo<v8::Value>& args);
|
|
|
|
static void Int16Array(const v8::FunctionCallbackInfo<v8::Value>& args);
|
|
|
|
static void Uint16Array(const v8::FunctionCallbackInfo<v8::Value>& args);
|
|
|
|
static void Int32Array(const v8::FunctionCallbackInfo<v8::Value>& args);
|
|
|
|
static void Uint32Array(const v8::FunctionCallbackInfo<v8::Value>& args);
|
|
|
|
static void Float32Array(const v8::FunctionCallbackInfo<v8::Value>& args);
|
|
|
|
static void Float64Array(const v8::FunctionCallbackInfo<v8::Value>& args);
|
|
|
|
static void Uint8ClampedArray(
|
|
|
|
const v8::FunctionCallbackInfo<v8::Value>& args);
|
|
|
|
static void ArrayBufferSlice(const v8::FunctionCallbackInfo<v8::Value>& args);
|
|
|
|
static void ArraySubArray(const v8::FunctionCallbackInfo<v8::Value>& args);
|
|
|
|
static void ArraySet(const v8::FunctionCallbackInfo<v8::Value>& args);
|
2009-03-31 06:51:25 +00:00
|
|
|
// The OS object on the global object contains methods for performing
|
|
|
|
// operating system calls:
|
|
|
|
//
|
|
|
|
// os.system("program_name", ["arg1", "arg2", ...], timeout1, timeout2) will
|
|
|
|
// run the command, passing the arguments to the program. The standard output
|
|
|
|
// of the program will be picked up and returned as a multiline string. If
|
2009-03-27 13:50:26 +00:00
|
|
|
// timeout1 is present then it should be a number. -1 indicates no timeout
|
|
|
|
// and a positive number is used as a timeout in milliseconds that limits the
|
|
|
|
// time spent waiting between receiving output characters from the program.
|
|
|
|
// timeout2, if present, should be a number indicating the limit in
|
|
|
|
// milliseconds on the total running time of the program. Exceptions are
|
|
|
|
// thrown on timeouts or other errors or if the exit status of the program
|
|
|
|
// indicates an error.
|
2009-03-31 06:51:25 +00:00
|
|
|
//
|
|
|
|
// os.chdir(dir) changes directory to the given directory. Throws an
|
|
|
|
// exception/ on error.
|
|
|
|
//
|
|
|
|
// os.setenv(variable, value) sets an environment variable. Repeated calls to
|
|
|
|
// this method leak memory due to the API of setenv in the standard C library.
|
2009-03-31 12:45:33 +00:00
|
|
|
//
|
|
|
|
// os.umask(alue) calls the umask system call and returns the old umask.
|
|
|
|
//
|
|
|
|
// os.mkdirp(name, mask) creates a directory. The mask (if present) is anded
|
|
|
|
// with the current umask. Intermediate directories are created if necessary.
|
|
|
|
// An exception is not thrown if the directory already exists. Analogous to
|
|
|
|
// the "mkdir -p" command.
|
2013-06-05 12:36:33 +00:00
|
|
|
static void OSObject(const v8::FunctionCallbackInfo<v8::Value>& args);
|
|
|
|
static void System(const v8::FunctionCallbackInfo<v8::Value>& args);
|
|
|
|
static void ChangeDirectory(const v8::FunctionCallbackInfo<v8::Value>& args);
|
|
|
|
static void SetEnvironment(const v8::FunctionCallbackInfo<v8::Value>& args);
|
|
|
|
static void UnsetEnvironment(const v8::FunctionCallbackInfo<v8::Value>& args);
|
|
|
|
static void SetUMask(const v8::FunctionCallbackInfo<v8::Value>& args);
|
|
|
|
static void MakeDirectory(const v8::FunctionCallbackInfo<v8::Value>& args);
|
|
|
|
static void RemoveDirectory(const v8::FunctionCallbackInfo<v8::Value>& args);
|
2009-03-31 12:45:33 +00:00
|
|
|
|
|
|
|
static void AddOSMethods(Handle<ObjectTemplate> os_template);
|
2012-01-17 13:37:09 +00:00
|
|
|
|
2008-10-21 09:12:27 +00:00
|
|
|
static const char* kPrompt;
|
2011-07-11 07:38:09 +00:00
|
|
|
static ShellOptions options;
|
|
|
|
|
2008-10-21 09:12:27 +00:00
|
|
|
private:
|
|
|
|
static Persistent<Context> evaluation_context_;
|
2011-08-08 09:34:18 +00:00
|
|
|
#ifndef V8_SHARED
|
2011-07-14 15:43:40 +00:00
|
|
|
static Persistent<Context> utility_context_;
|
2009-03-24 13:33:54 +00:00
|
|
|
static CounterMap* counter_map_;
|
2008-12-03 09:35:21 +00:00
|
|
|
// We statically allocate a set of local counters to be used if we
|
|
|
|
// don't want to store the stats in a memory-mapped file
|
|
|
|
static CounterCollection local_counters_;
|
|
|
|
static CounterCollection* counters_;
|
|
|
|
static i::OS::MemoryMappedFile* counters_file_;
|
2011-07-11 07:38:09 +00:00
|
|
|
static i::Mutex* context_mutex_;
|
2011-07-14 15:43:40 +00:00
|
|
|
|
2009-04-14 00:30:44 +00:00
|
|
|
static Counter* GetCounter(const char* name, bool is_histogram);
|
2013-01-18 07:20:17 +00:00
|
|
|
static void InstallUtilityScript(Isolate* isolate);
|
2011-08-08 09:34:18 +00:00
|
|
|
#endif // V8_SHARED
|
2012-11-20 14:47:56 +00:00
|
|
|
static void Initialize(Isolate* isolate);
|
2012-11-22 08:35:21 +00:00
|
|
|
static void InitializeDebugger(Isolate* isolate);
|
2012-11-20 14:47:56 +00:00
|
|
|
static void RunShell(Isolate* isolate);
|
2011-07-14 15:43:40 +00:00
|
|
|
static bool SetOptions(int argc, char* argv[]);
|
2012-11-20 14:47:56 +00:00
|
|
|
static Handle<ObjectTemplate> CreateGlobalTemplate(Isolate* isolate);
|
2012-07-03 13:44:36 +00:00
|
|
|
static Handle<FunctionTemplate> CreateArrayBufferTemplate(InvocationCallback);
|
2012-06-28 16:29:53 +00:00
|
|
|
static Handle<FunctionTemplate> CreateArrayTemplate(InvocationCallback);
|
2012-11-20 14:47:56 +00:00
|
|
|
static Handle<Value> CreateExternalArrayBuffer(Isolate* isolate,
|
|
|
|
Handle<Object> buffer,
|
2012-06-28 16:29:53 +00:00
|
|
|
int32_t size);
|
2012-11-20 14:47:56 +00:00
|
|
|
static Handle<Object> CreateExternalArray(Isolate* isolate,
|
|
|
|
Handle<Object> array,
|
2012-06-28 16:29:53 +00:00
|
|
|
Handle<Object> buffer,
|
|
|
|
ExternalArrayType type,
|
|
|
|
int32_t length,
|
|
|
|
int32_t byteLength,
|
|
|
|
int32_t byteOffset,
|
|
|
|
int32_t element_size);
|
2013-06-05 12:36:33 +00:00
|
|
|
static void CreateExternalArray(
|
|
|
|
const v8::FunctionCallbackInfo<v8::Value>& args,
|
|
|
|
ExternalArrayType type,
|
|
|
|
int32_t element_size);
|
2013-01-25 08:31:46 +00:00
|
|
|
static void ExternalArrayWeakCallback(Isolate* isolate,
|
2013-05-07 10:44:30 +00:00
|
|
|
Persistent<Object>* object,
|
|
|
|
uint8_t* data);
|
2008-10-21 09:12:27 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
} // namespace v8
|
|
|
|
|
|
|
|
|
|
|
|
#endif // V8_D8_H_
|