Author: [email protected]
Date: Tue May  5 02:23:31 2009
New Revision: 1855

Modified:
    branches/1.1/src/api.cc
    branches/1.1/src/builtins-ia32.cc
    branches/1.1/test/cctest/test-api.cc

Log:
Merge change that allows the API call-as-function handlers on
non-functions to be called using new to 1.1 branch.
Review URL: http://codereview.chromium.org/108008

Modified: branches/1.1/src/api.cc
==============================================================================
--- branches/1.1/src/api.cc     (original)
+++ branches/1.1/src/api.cc     Tue May  5 02:23:31 2009
@@ -2373,7 +2373,7 @@


  const char* v8::V8::GetVersion() {
-  return "1.1.10.7";
+  return "1.1.10.8";
  }



Modified: branches/1.1/src/builtins-ia32.cc
==============================================================================
--- branches/1.1/src/builtins-ia32.cc   (original)
+++ branches/1.1/src/builtins-ia32.cc   Tue May  5 02:23:31 2009
@@ -54,6 +54,14 @@
    //  -- edi: constructor function
    // -----------------------------------

+  Label non_function_call;
+  // Check that function is not a smi.
+  __ test(edi, Immediate(kSmiTagMask));
+  __ j(zero, &non_function_call);
+  // Check that function is a JSFunction.
+  __ CmpObjectType(edi, JS_FUNCTION_TYPE, ecx);
+  __ j(not_equal, &non_function_call);
+
    // Enter a construct frame.
    __ EnterConstructFrame();

@@ -73,12 +81,6 @@
          ExternalReference::debug_step_in_fp_address();
      __ cmp(Operand::StaticVariable(debug_step_in_fp), Immediate(0));
      __ j(not_equal, &rt_call);
-    // Check that function is not a Smi.
-    __ test(edi, Immediate(kSmiTagMask));
-    __ j(zero, &rt_call);
-    // Check that function is a JSFunction
-    __ CmpObjectType(edi, JS_FUNCTION_TYPE, eax);
-    __ j(not_equal, &rt_call);

      // Verified that the constructor is a JSFunction.
      // Load the initial map and verify that it is in fact a map.
@@ -300,6 +302,16 @@
    __ lea(esp, Operand(esp, ebx, times_2, 1 * kPointerSize));  // 1 ~  
receiver
    __ push(ecx);
    __ ret(0);
+
+  // edi: called object
+  // eax: number of arguments
+  __ bind(&non_function_call);
+
+  // Set expected number of arguments to zero (not changing eax).
+  __ Set(ebx, Immediate(0));
+  __ GetBuiltinEntry(edx, Builtins::CALL_NON_FUNCTION);
+  __ jmp(Handle<Code>(builtin(ArgumentsAdaptorTrampoline)),
+         RelocInfo::CODE_TARGET);
  }



Modified: branches/1.1/test/cctest/test-api.cc
==============================================================================
--- branches/1.1/test/cctest/test-api.cc        (original)
+++ branches/1.1/test/cctest/test-api.cc        Tue May  5 02:23:31 2009
@@ -4608,11 +4608,6 @@
    value = Script::Compile(v8_str(call_17))->Run();
    CHECK(!try_catch.HasCaught());
    CHECK_EQ(17, value->Int32Value());
-
-  // Try something that will cause an exception: Call the object as a
-  // constructor. This should be the last test.
-  value = Script::Compile(v8_str("new obj(42)"))->Run();
-  CHECK(try_catch.HasCaught());
  }



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

Reply via email to