Commit 0f9253b5 authored by whesse@chromium.org's avatar whesse@chromium.org

Initialize list of frame elements to proper size.

Review URL: http://codereview.chromium.org/57006

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@1641 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent ab845fd8
// 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 // Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are // modification, are permitted provided that the following conditions are
// met: // met:
...@@ -67,6 +67,7 @@ class List { ...@@ -67,6 +67,7 @@ class List {
INLINE(bool is_empty() const) { return length_ == 0; } INLINE(bool is_empty() const) { return length_ == 0; }
INLINE(int length() const) { return length_; } INLINE(int length() const) { return length_; }
INLINE(int capacity() const) { return capacity_; }
Vector<T> ToVector() { return Vector<T>(data_, length_); } Vector<T> ToVector() { return Vector<T>(data_, length_); }
......
// 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 // Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are // modification, are permitted provided that the following conditions are
// met: // met:
...@@ -44,7 +44,9 @@ namespace v8 { namespace internal { ...@@ -44,7 +44,9 @@ namespace v8 { namespace internal {
VirtualFrame::VirtualFrame(CodeGenerator* cgen) VirtualFrame::VirtualFrame(CodeGenerator* cgen)
: cgen_(cgen), : cgen_(cgen),
masm_(cgen->masm()), masm_(cgen->masm()),
elements_(0), elements_(cgen->scope()->num_parameters()
+ cgen->scope()->num_stack_slots()
+ kPreallocatedElements),
parameter_count_(cgen->scope()->num_parameters()), parameter_count_(cgen->scope()->num_parameters()),
local_count_(0), local_count_(0),
stack_pointer_(parameter_count_), // 0-based index of TOS. stack_pointer_(parameter_count_), // 0-based index of TOS.
......
// 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 // Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are // modification, are permitted provided that the following conditions are
// met: // met:
...@@ -331,6 +331,7 @@ class VirtualFrame : public Malloced { ...@@ -331,6 +331,7 @@ class VirtualFrame : public Malloced {
static const int kContextOffset = StandardFrameConstants::kContextOffset; static const int kContextOffset = StandardFrameConstants::kContextOffset;
static const int kHandlerSize = StackHandlerConstants::kSize / kPointerSize; static const int kHandlerSize = StackHandlerConstants::kSize / kPointerSize;
static const int kPreallocatedElements = 5 + 8; // 8 expression stack slots.
CodeGenerator* cgen_; CodeGenerator* cgen_;
MacroAssembler* masm_; MacroAssembler* masm_;
......
// 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 // Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are // modification, are permitted provided that the following conditions are
// met: // met:
...@@ -43,7 +43,9 @@ namespace v8 { namespace internal { ...@@ -43,7 +43,9 @@ namespace v8 { namespace internal {
VirtualFrame::VirtualFrame(CodeGenerator* cgen) VirtualFrame::VirtualFrame(CodeGenerator* cgen)
: cgen_(cgen), : cgen_(cgen),
masm_(cgen->masm()), masm_(cgen->masm()),
elements_(0), elements_(cgen->scope()->num_parameters()
+ cgen->scope()->num_stack_slots()
+ kPreallocatedElements),
parameter_count_(cgen->scope()->num_parameters()), parameter_count_(cgen->scope()->num_parameters()),
local_count_(0), local_count_(0),
stack_pointer_(parameter_count_ + 1), // 0-based index of TOS. stack_pointer_(parameter_count_ + 1), // 0-based index of TOS.
......
// 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 // Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are // modification, are permitted provided that the following conditions are
// met: // met:
...@@ -340,6 +340,7 @@ class VirtualFrame : public Malloced { ...@@ -340,6 +340,7 @@ class VirtualFrame : public Malloced {
static const int kContextOffset = StandardFrameConstants::kContextOffset; static const int kContextOffset = StandardFrameConstants::kContextOffset;
static const int kHandlerSize = StackHandlerConstants::kSize / kPointerSize; static const int kHandlerSize = StackHandlerConstants::kSize / kPointerSize;
static const int kPreallocatedElements = 5 + 8; // 8 expression stack slots.
CodeGenerator* cgen_; CodeGenerator* cgen_;
MacroAssembler* masm_; MacroAssembler* masm_;
......
...@@ -53,7 +53,7 @@ VirtualFrame::SpilledScope::~SpilledScope() { ...@@ -53,7 +53,7 @@ VirtualFrame::SpilledScope::~SpilledScope() {
VirtualFrame::VirtualFrame(VirtualFrame* original) VirtualFrame::VirtualFrame(VirtualFrame* original)
: cgen_(original->cgen_), : cgen_(original->cgen_),
masm_(original->masm_), masm_(original->masm_),
elements_(original->elements_.length()), elements_(original->elements_.capacity()),
parameter_count_(original->parameter_count_), parameter_count_(original->parameter_count_),
local_count_(original->local_count_), local_count_(original->local_count_),
stack_pointer_(original->stack_pointer_), stack_pointer_(original->stack_pointer_),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment