Author: [email protected]
Date: Mon Mar 30 06:03:32 2009
New Revision: 1641

Modified:
    branches/bleeding_edge/src/list.h
    branches/bleeding_edge/src/virtual-frame-arm.cc
    branches/bleeding_edge/src/virtual-frame-arm.h
    branches/bleeding_edge/src/virtual-frame-ia32.cc
    branches/bleeding_edge/src/virtual-frame-ia32.h
    branches/bleeding_edge/src/virtual-frame.cc

Log:
Initialize list of frame elements to proper size.
Review URL: http://codereview.chromium.org/57006

Modified: branches/bleeding_edge/src/list.h
==============================================================================
--- branches/bleeding_edge/src/list.h   (original)
+++ branches/bleeding_edge/src/list.h   Mon Mar 30 06:03:32 2009
@@ -1,4 +1,4 @@
-// Copyright 2006-2008 the V8 project authors. All rights reserved.
+// Copyright 2006-2009 the V8 project authors. All rights reserved.
  // Redistribution and use in source and binary forms, with or without
  // modification, are permitted provided that the following conditions are
  // met:
@@ -67,6 +67,7 @@

    INLINE(bool is_empty() const) { return length_ == 0; }
    INLINE(int length() const) { return length_; }
+  INLINE(int capacity() const) { return capacity_; }

    Vector<T> ToVector() { return Vector<T>(data_, length_); }


Modified: branches/bleeding_edge/src/virtual-frame-arm.cc
==============================================================================
--- branches/bleeding_edge/src/virtual-frame-arm.cc     (original)
+++ branches/bleeding_edge/src/virtual-frame-arm.cc     Mon Mar 30 06:03:32 2009
@@ -1,4 +1,4 @@
-// Copyright 2008 the V8 project authors. All rights reserved.
+// Copyright 2009 the V8 project authors. All rights reserved.
  // Redistribution and use in source and binary forms, with or without
  // modification, are permitted provided that the following conditions are
  // met:
@@ -44,7 +44,9 @@
  VirtualFrame::VirtualFrame(CodeGenerator* cgen)
      : cgen_(cgen),
        masm_(cgen->masm()),
-      elements_(0),
+      elements_(cgen->scope()->num_parameters()
+                + cgen->scope()->num_stack_slots()
+                + kPreallocatedElements),
        parameter_count_(cgen->scope()->num_parameters()),
        local_count_(0),
        stack_pointer_(parameter_count_),  // 0-based index of TOS.

Modified: branches/bleeding_edge/src/virtual-frame-arm.h
==============================================================================
--- branches/bleeding_edge/src/virtual-frame-arm.h      (original)
+++ branches/bleeding_edge/src/virtual-frame-arm.h      Mon Mar 30 06:03:32 2009
@@ -1,4 +1,4 @@
-// Copyright 2008 the V8 project authors. All rights reserved.
+// Copyright 2009 the V8 project authors. All rights reserved.
  // Redistribution and use in source and binary forms, with or without
  // modification, are permitted provided that the following conditions are
  // met:
@@ -331,6 +331,7 @@
    static const int kContextOffset = StandardFrameConstants::kContextOffset;

    static const int kHandlerSize = StackHandlerConstants::kSize /  
kPointerSize;
+  static const int kPreallocatedElements = 5 + 8;  // 8 expression stack  
slots.

    CodeGenerator* cgen_;
    MacroAssembler* masm_;

Modified: branches/bleeding_edge/src/virtual-frame-ia32.cc
==============================================================================
--- branches/bleeding_edge/src/virtual-frame-ia32.cc    (original)
+++ branches/bleeding_edge/src/virtual-frame-ia32.cc    Mon Mar 30 06:03:32  
2009
@@ -1,4 +1,4 @@
-// Copyright 2008 the V8 project authors. All rights reserved.
+// Copyright 2009 the V8 project authors. All rights reserved.
  // Redistribution and use in source and binary forms, with or without
  // modification, are permitted provided that the following conditions are
  // met:
@@ -43,7 +43,9 @@
  VirtualFrame::VirtualFrame(CodeGenerator* cgen)
      : cgen_(cgen),
        masm_(cgen->masm()),
-      elements_(0),
+      elements_(cgen->scope()->num_parameters()
+                + cgen->scope()->num_stack_slots()
+                + kPreallocatedElements),
        parameter_count_(cgen->scope()->num_parameters()),
        local_count_(0),
        stack_pointer_(parameter_count_ + 1),  // 0-based index of TOS.

Modified: branches/bleeding_edge/src/virtual-frame-ia32.h
==============================================================================
--- branches/bleeding_edge/src/virtual-frame-ia32.h     (original)
+++ branches/bleeding_edge/src/virtual-frame-ia32.h     Mon Mar 30 06:03:32 2009
@@ -1,4 +1,4 @@
-// Copyright 2008 the V8 project authors. All rights reserved.
+// Copyright 2009 the V8 project authors. All rights reserved.
  // Redistribution and use in source and binary forms, with or without
  // modification, are permitted provided that the following conditions are
  // met:
@@ -340,6 +340,7 @@
    static const int kContextOffset = StandardFrameConstants::kContextOffset;

    static const int kHandlerSize = StackHandlerConstants::kSize /  
kPointerSize;
+  static const int kPreallocatedElements = 5 + 8;  // 8 expression stack  
slots.

    CodeGenerator* cgen_;
    MacroAssembler* masm_;

Modified: branches/bleeding_edge/src/virtual-frame.cc
==============================================================================
--- branches/bleeding_edge/src/virtual-frame.cc (original)
+++ branches/bleeding_edge/src/virtual-frame.cc Mon Mar 30 06:03:32 2009
@@ -53,7 +53,7 @@
  VirtualFrame::VirtualFrame(VirtualFrame* original)
      : cgen_(original->cgen_),
        masm_(original->masm_),
-      elements_(original->elements_.length()),
+      elements_(original->elements_.capacity()),
        parameter_count_(original->parameter_count_),
        local_count_(original->local_count_),
        stack_pointer_(original->stack_pointer_),

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

Reply via email to