Reviewers: Mads Ager,

Description:
Merge r3505 and r3509 to trunk.

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

SVN Base: http://v8.googlecode.com/svn/branches/bleeding_edge/

Affected files:
   M     trunk/src/contexts.cc
   M     trunk/src/execution.cc
   M     trunk/src/ia32/codegen-ia32.cc
   M     trunk/src/ia32/macro-assembler-ia32.cc
   M     trunk/src/version.cc


Index: trunk/src/ia32/codegen-ia32.cc
===================================================================
--- trunk/src/ia32/codegen-ia32.cc      (revision 3508)
+++ trunk/src/ia32/codegen-ia32.cc      (working copy)
@@ -174,7 +174,7 @@
      function_return_is_shadowed_ = false;

      // Allocate the local context if needed.
-    int heap_slots = scope_->num_heap_slots();
+    int heap_slots = scope_->num_heap_slots() - Context::MIN_CONTEXT_SLOTS;
      if (heap_slots > 0) {
        Comment cmnt(masm_, "[ allocate local context");
        // Allocate local context.
@@ -6741,8 +6741,11 @@
    __ mov(Operand(eax, Context::SlotOffset(Context::PREVIOUS_INDEX)), ebx);
    __ mov(Operand(eax, Context::SlotOffset(Context::EXTENSION_INDEX)), ebx);

-  // Copy the global object from the surrounding context.
-  __ mov(ebx, Operand(esi, Context::SlotOffset(Context::GLOBAL_INDEX)));
+  // Copy the global object from the surrounding context. We go through the
+  // context in the function (ecx) to match the allocation behavior we have
+  // in the runtime system (see Heap::AllocateFunctionContext).
+  __ mov(ebx, FieldOperand(ecx, JSFunction::kContextOffset));
+  __ mov(ebx, Operand(ebx, Context::SlotOffset(Context::GLOBAL_INDEX)));
    __ mov(Operand(eax, Context::SlotOffset(Context::GLOBAL_INDEX)), ebx);

    // Initialize the rest of the slots to undefined.
Index: trunk/src/ia32/macro-assembler-ia32.cc
===================================================================
--- trunk/src/ia32/macro-assembler-ia32.cc      (revision 3508)
+++ trunk/src/ia32/macro-assembler-ia32.cc      (working copy)
@@ -1369,7 +1369,6 @@
        JSBuiltinsObject::kJSBuiltinsOffset + (id * kPointerSize);
    mov(edi, FieldOperand(edx, builtins_offset));

-
    return Builtins::GetCode(id, resolved);
  }

Index: trunk/src/contexts.cc
===================================================================
--- trunk/src/contexts.cc       (revision 3508)
+++ trunk/src/contexts.cc       (working copy)
@@ -52,11 +52,14 @@
    if (global()->IsGlobalObject()) {
      return global()->global_context();
    }
+
    // During bootstrapping, the global object might not be set and we
    // have to search the context chain to find the global context.
+  ASSERT(Bootstrapper::IsActive());
    Context* current = this;
    while (!current->IsGlobalContext()) {
-    current =  
Context::cast(JSFunction::cast(current->closure())->context());
+    JSFunction* closure = JSFunction::cast(current->closure());
+    current = Context::cast(closure->context());
    }
    return current;
  }
Index: trunk/src/execution.cc
===================================================================
--- trunk/src/execution.cc      (revision 3508)
+++ trunk/src/execution.cc      (working copy)
@@ -79,6 +79,10 @@
      receiver = Handle<JSObject>(global->global_receiver());
    }

+  // Make sure that the global object of the context we're about to
+  // make the current one is indeed a global object.
+  ASSERT(func->context()->global()->IsGlobalObject());
+
    {
      // Save and restore context around invocation and block the
      // allocation of handles without explicit handle scopes.
Index: trunk/src/version.cc
===================================================================
--- trunk/src/version.cc        (revision 3508)
+++ trunk/src/version.cc        (working copy)
@@ -35,7 +35,7 @@
  #define MAJOR_VERSION     2
  #define MINOR_VERSION     0
  #define BUILD_NUMBER      5
-#define PATCH_LEVEL       1
+#define PATCH_LEVEL       2
  #define CANDIDATE_VERSION false

  // Define SONAME to have the SCons build the put a specific SONAME into the


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

Reply via email to