Revision: 2908
Author: [email protected]
Date: Thu Sep 17 00:14:48 2009
Log: Minor changes to the native array construct code.

Named a constant and added an assert to get notified when related constants  
change.

Removed reloading of the Array function when Array is called as a  
constructor as the Array function is preserved in edi.
Review URL: http://codereview.chromium.org/207010
http://code.google.com/p/v8/source/detail?r=2908

Modified:
  /branches/bleeding_edge/src/ia32/builtins-ia32.cc

=======================================
--- /branches/bleeding_edge/src/ia32/builtins-ia32.cc   Wed Sep 16 04:17:57  
2009
+++ /branches/bleeding_edge/src/ia32/builtins-ia32.cc   Thu Sep 17 00:14:48  
2009
@@ -740,7 +740,10 @@
    __ mov(FieldOperand(scratch1, Array::kLengthOffset), Immediate(holes));

    // Fill the FixedArray with the hole value. Inline the code if short.
-  if (holes <= 4) {
+  // Reconsider loop unfolding if kPreallocatedArrayElements gets changed.
+  static const int kLoopUnfoldLimit = 4
+  ASSERT(kPreallocatedArrayElements <= kLoopUnfoldLimit);
+  if (holes <= kLoopUnfoldLimit) {
      // Use a scratch register here to have only one reloc info when  
unfolding
      // the loop.
      __ mov(scratch3, Factory::the_hole_value());
@@ -1068,7 +1071,7 @@
      __ Assert(equal, "Unexpected initial map for Array function");
    }

-  // Run the native code for the Array function called as constructor.
+  // Run the native code for the Array function called as a normal  
function.
    ArrayNativeCode(masm, false, &generic_array_code);

    // Jump to the generic array code in case the specialized code cannot  
handle
@@ -1110,7 +1113,6 @@
    // Jump to the generic construct code in case the specialized code cannot
    // handle the construction.
    __ bind(&generic_constructor);
-  GenerateLoadArrayFunction(masm, edi);
    Code* code = Builtins::builtin(Builtins::JSConstructStubGeneric);
    Handle<Code> generic_construct_stub(code);
    __ jmp(generic_construct_stub, RelocInfo::CODE_TARGET);

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

Reply via email to