Revision: 17068
Author:   [email protected]
Date:     Wed Oct  2 10:51:10 2013 UTC
Log:      Correctly handlify CopyContextLocalsToScopeObject.

Handlified functions that expect allocation must be static, i.e. not allow to
use 'this', since 'this' is not relocated by potential GC.

[email protected]
BUG=

Review URL: https://codereview.chromium.org/25704002
http://code.google.com/p/v8/source/detail?r=17068

Modified:
 /branches/bleeding_edge/src/objects.h
 /branches/bleeding_edge/src/runtime.cc
 /branches/bleeding_edge/src/scopeinfo.cc

=======================================
--- /branches/bleeding_edge/src/objects.h       Wed Oct  2 08:27:33 2013 UTC
+++ /branches/bleeding_edge/src/objects.h       Wed Oct  2 10:51:10 2013 UTC
@@ -4103,9 +4103,9 @@


// Copies all the context locals into an object used to materialize a scope.
-  bool CopyContextLocalsToScopeObject(Isolate* isolate,
-                                      Handle<Context> context,
-                                      Handle<JSObject> scope_object);
+  static bool CopyContextLocalsToScopeObject(Handle<ScopeInfo> scope_info,
+                                             Handle<Context> context,
+ Handle<JSObject> scope_object);


   static Handle<ScopeInfo> Create(Scope* scope, Zone* zone);
=======================================
--- /branches/bleeding_edge/src/runtime.cc      Wed Oct  2 08:40:15 2013 UTC
+++ /branches/bleeding_edge/src/runtime.cc      Wed Oct  2 10:51:10 2013 UTC
@@ -11395,8 +11395,8 @@
   // Third fill all context locals.
   Handle<Context> frame_context(Context::cast(frame->context()));
   Handle<Context> function_context(frame_context->declaration_context());
-  if (!scope_info->CopyContextLocalsToScopeObject(
-          isolate, function_context, target)) {
+  if (!ScopeInfo::CopyContextLocalsToScopeObject(
+          scope_info, function_context, target)) {
     return Handle<JSObject>();
   }

@@ -11553,8 +11553,8 @@
       isolate->factory()->NewJSObject(isolate->object_function());

   // Fill all context locals to the context extension.
-  if (!scope_info->CopyContextLocalsToScopeObject(
-          isolate, context, closure_scope)) {
+  if (!ScopeInfo::CopyContextLocalsToScopeObject(
+          scope_info, context, closure_scope)) {
     return Handle<JSObject>();
   }

@@ -11674,8 +11674,8 @@
       isolate->factory()->NewJSObject(isolate->object_function());

   // Fill all context locals.
-  if (!scope_info->CopyContextLocalsToScopeObject(
-          isolate, context, block_scope)) {
+  if (!ScopeInfo::CopyContextLocalsToScopeObject(
+          scope_info, context, block_scope)) {
     return Handle<JSObject>();
   }

@@ -11697,8 +11697,8 @@
       isolate->factory()->NewJSObject(isolate->object_function());

   // Fill all context locals.
-  if (!scope_info->CopyContextLocalsToScopeObject(
-          isolate, context, module_scope)) {
+  if (!ScopeInfo::CopyContextLocalsToScopeObject(
+          scope_info, context, module_scope)) {
     return Handle<JSObject>();
   }

=======================================
--- /branches/bleeding_edge/src/scopeinfo.cc    Wed Sep 11 07:14:41 2013 UTC
+++ /branches/bleeding_edge/src/scopeinfo.cc    Wed Oct  2 10:51:10 2013 UTC
@@ -363,14 +363,14 @@
 }


-bool ScopeInfo::CopyContextLocalsToScopeObject(
-    Isolate* isolate,
-    Handle<Context> context,
-    Handle<JSObject> scope_object) {
-  int local_count = ContextLocalCount();
+bool ScopeInfo::CopyContextLocalsToScopeObject(Handle<ScopeInfo> scope_info,
+                                               Handle<Context> context,
+ Handle<JSObject> scope_object) {
+  Isolate* isolate = scope_info->GetIsolate();
+  int local_count = scope_info->ContextLocalCount();
   if (local_count == 0) return true;
   // Fill all context locals to the context extension.
-  int start = ContextLocalNameEntriesIndex();
+  int start = scope_info->ContextLocalNameEntriesIndex();
   int end = start + local_count;
   for (int i = start; i < end; ++i) {
     int context_index = Context::MIN_CONTEXT_SLOTS + i - start;
@@ -378,7 +378,7 @@
         isolate,
         SetProperty(isolate,
                     scope_object,
-                    Handle<String>(String::cast(get(i))),
+                    Handle<String>(String::cast(scope_info->get(i))),
                     Handle<Object>(context->get(context_index), isolate),
                     ::NONE,
                     kNonStrictMode),

--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to