Reviewers: dimich,

Message:

http://dromaeo.com/?id=132764,132765,132766
132764 is bleeding_edge@7111 (latest merged in isolates)
132765 is isolates with this patch
132766 is isolates without this patch

We gained 20% on getAttributes and bits and pieces on other stuff, but still
~10% short of bleeding_edge

Description:
[Isolates] Speed-up HandleApiCallHelper
Get rid of redundant thread-local-storage fetch of current isolate in
HandleApiCallHelpers
This speeds up dromaeo.com/?dom-attr by ~10%

BUG=
TEST=

Please review this at http://codereview.chromium.org/6684005/

SVN Base: https://v8.googlecode.com/svn/branches/experimental/isolates

Affected files:
  M src/builtins.cc
  M src/log.h


Index: src/builtins.cc
diff --git a/src/builtins.cc b/src/builtins.cc
index 14519da4c2501cd6f7e3df6ab2a65860991e4599..76dadb6b4eb2ff8e0b1adb659b4e6e407f962ab4 100644
--- a/src/builtins.cc
+++ b/src/builtins.cc
@@ -1038,13 +1038,13 @@ MUST_USE_RESULT static MaybeObject* HandleApiCallHelper(
   ASSERT(is_construct == CalledAsConstructor(isolate));
   Heap* heap = isolate->heap();

-  HandleScope scope;
+  HandleScope scope(isolate);
   Handle<JSFunction> function = args.called_function();
   ASSERT(function->shared()->IsApiFunction());

   FunctionTemplateInfo* fun_data = function->shared()->get_api_func_data();
   if (is_construct) {
-    Handle<FunctionTemplateInfo> desc(fun_data);
+    Handle<FunctionTemplateInfo> desc(fun_data, isolate);
     bool pending_exception = false;
     isolate->factory()->ConfigureInstance(
         desc, Handle<JSObject>::cast(args.receiver()), &pending_exception);
@@ -1072,7 +1072,7 @@ MUST_USE_RESULT static MaybeObject* HandleApiCallHelper(
     Object* data_obj = call_data->data();
     Object* result;

-    LOG(ApiObjectAccess("call", JSObject::cast(*args.receiver())));
+ LOG_ISOLATE(isolate,ApiObjectAccess("call", JSObject::cast(*args.receiver())));
     ASSERT(raw_holder->IsJSObject());

     CustomArguments custom(isolate);
@@ -1212,9 +1212,8 @@ MUST_USE_RESULT static MaybeObject* HandleApiCallAsFunctionOrConstructor(
   // Get the data for the call and perform the callback.
   Object* result;
   {
-    HandleScope scope;
-
-    LOG(ApiObjectAccess("call non-function", obj));
+    HandleScope scope(isolate);
+    LOG_ISOLATE(isolate, ApiObjectAccess("call non-function", obj));

     CustomArguments custom(isolate);
     v8::ImplementationUtilities::PrepareArgumentsData(custom.end(),
Index: src/log.h
diff --git a/src/log.h b/src/log.h
index 1d7daeabd0cb10a93a058c6020d62c55d968e93a..7dbce193fef8a1beb6b554754516dbf0eea45f09 100644
--- a/src/log.h
+++ b/src/log.h
@@ -76,16 +76,17 @@ class SlidingStateWindow;
 class LogMessageBuilder;

 #undef LOG
-// TODO(isolates): pass isolate pointer here.
 #ifdef ENABLE_LOGGING_AND_PROFILING
-#define LOG(Call)                                   \
+#define LOG_ISOLATE(isolate,Call)                   \
   do {                                              \
     v8::internal::Logger* logger =                  \
-        v8::internal::Isolate::Current()->logger(); \
+        (isolate)->logger();                        \
     if (logger->is_logging())                       \
       logger->Call;                                 \
   } while (false)
+#define LOG(Call) LOG_ISOLATE(v8::internal::Isolate::Current(),Call)
 #else
+#define LOG_ISOLATE(isolate,Call) ((void)0)
 #define LOG(Call) ((void) 0)
 #endif



--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to