Drastically reduce the number of created strings in d8, 2nd attempt.

This also reduces the number of TLS accesses, so it is a double-win. We have
230k less TLS accesses while running Octane now, so we are down to 23% now
compared to the start of these TLS-related CLs.

To get things right in the presence of multiple Isolates, we have to thread the
correct Isolate through several layers. This threading wasn't that bad after
all, it keeps one honest about the real depdencies. The only ugly thing is that
in ExternalArrayWeakCallback we have to conjure up the current Isolate from the
TLS, but this is a know API deficiency.

Introduced a tiny helper function for throwing on the way.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@13018 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 6a6012c0
This diff is collapsed.
......@@ -158,7 +158,7 @@ class SourceGroup {
void End(int offset) { end_offset_ = offset; }
void Execute();
void Execute(Isolate* isolate);
#ifndef V8_SHARED
void StartExecuteInThread();
......@@ -187,7 +187,7 @@ class SourceGroup {
#endif // V8_SHARED
void ExitShell(int exit_code);
Handle<String> ReadFile(const char* name);
Handle<String> ReadFile(Isolate* isolate, const char* name);
const char** argv_;
int begin_offset_;
......@@ -272,9 +272,9 @@ class Shell : public i::AllStatic {
bool report_exceptions);
static const char* ToCString(const v8::String::Utf8Value& value);
static void ReportException(TryCatch* try_catch);
static Handle<String> ReadFile(const char* name);
static Persistent<Context> CreateEvaluationContext();
static int RunMain(int argc, char* argv[]);
static Handle<String> ReadFile(Isolate* isolate, const char* name);
static Persistent<Context> CreateEvaluationContext(Isolate* isolate);
static int RunMain(Isolate* isolate, int argc, char* argv[]);
static int Main(int argc, char* argv[]);
static void Exit(int exit_code);
......@@ -310,9 +310,9 @@ class Shell : public i::AllStatic {
static Handle<Value> DisableProfiler(const Arguments& args);
static Handle<Value> Read(const Arguments& args);
static Handle<Value> ReadBuffer(const Arguments& args);
static Handle<String> ReadFromStdin();
static Handle<String> ReadFromStdin(Isolate* isolate);
static Handle<Value> ReadLine(const Arguments& args) {
return ReadFromStdin();
return ReadFromStdin(args.GetIsolate());
}
static Handle<Value> Load(const Arguments& args);
static Handle<Value> ArrayBuffer(const Arguments& args);
......@@ -365,7 +365,6 @@ class Shell : public i::AllStatic {
static void AddOSMethods(Handle<ObjectTemplate> os_template);
static LineEditor* console;
static const char* kPrompt;
static ShellOptions options;
......@@ -384,15 +383,17 @@ class Shell : public i::AllStatic {
static Counter* GetCounter(const char* name, bool is_histogram);
static void InstallUtilityScript();
#endif // V8_SHARED
static void Initialize();
static void RunShell();
static void Initialize(Isolate* isolate);
static void RunShell(Isolate* isolate);
static bool SetOptions(int argc, char* argv[]);
static Handle<ObjectTemplate> CreateGlobalTemplate();
static Handle<ObjectTemplate> CreateGlobalTemplate(Isolate* isolate);
static Handle<FunctionTemplate> CreateArrayBufferTemplate(InvocationCallback);
static Handle<FunctionTemplate> CreateArrayTemplate(InvocationCallback);
static Handle<Value> CreateExternalArrayBuffer(Handle<Object> buffer,
static Handle<Value> CreateExternalArrayBuffer(Isolate* isolate,
Handle<Object> buffer,
int32_t size);
static Handle<Object> CreateExternalArray(Handle<Object> array,
static Handle<Object> CreateExternalArray(Isolate* isolate,
Handle<Object> array,
Handle<Object> buffer,
ExternalArrayType type,
int32_t length,
......
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