Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(718)

Unified Diff: src/objects-inl.h

Issue 7833040: Fix possible crash in FixedDoubleArray::Initialize() (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: remove forgotten unused variable Created 9 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-95113.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects-inl.h
diff --git a/src/objects-inl.h b/src/objects-inl.h
index 3b0e96f1ef93793398b98eb7a5daa50ca1c156a6..588b0f63a8d230cab6dcdee3ea699b65c817b3e2 100644
--- a/src/objects-inl.h
+++ b/src/objects-inl.h
@@ -1749,9 +1749,15 @@ bool FixedDoubleArray::is_the_hole(int index) {
void FixedDoubleArray::Initialize(FixedDoubleArray* from) {
int old_length = from->length();
ASSERT(old_length < length());
- OS::MemCopy(FIELD_ADDR(this, kHeaderSize),
- FIELD_ADDR(from, kHeaderSize),
- old_length * kDoubleSize);
+ if (old_length * kDoubleSize >= OS::kMinComplexMemCopy) {
+ OS::MemCopy(FIELD_ADDR(this, kHeaderSize),
+ FIELD_ADDR(from, kHeaderSize),
+ old_length * kDoubleSize);
+ } else {
+ for (int i = 0; i < old_length; ++i) {
+ set(i, from->get_scalar(i));
+ }
+ }
int offset = kHeaderSize + old_length * kDoubleSize;
for (int current = from->length(); current < length(); ++current) {
WRITE_DOUBLE_FIELD(this, offset, hole_nan_as_double());
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-95113.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698