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

Side by Side Diff: src/objects.cc

Issue 2632503003: [runtime] Allocate space for computed property names (Closed)
Patch Set: Fix some variable names. Created 3 years, 11 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/objects.h" 5 #include "src/objects.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 #include <iomanip> 8 #include <iomanip>
9 #include <memory> 9 #include <memory>
10 #include <sstream> 10 #include <sstream>
(...skipping 9791 matching lines...) Expand 10 before | Expand all | Expand 10 after
9802 9802
9803 9803
9804 void FixedArray::CopyTo(int pos, FixedArray* dest, int dest_pos, int len) { 9804 void FixedArray::CopyTo(int pos, FixedArray* dest, int dest_pos, int len) {
9805 DisallowHeapAllocation no_gc; 9805 DisallowHeapAllocation no_gc;
9806 WriteBarrierMode mode = dest->GetWriteBarrierMode(no_gc); 9806 WriteBarrierMode mode = dest->GetWriteBarrierMode(no_gc);
9807 for (int index = 0; index < len; index++) { 9807 for (int index = 0; index < len; index++) {
9808 dest->set(dest_pos+index, get(pos+index), mode); 9808 dest->set(dest_pos+index, get(pos+index), mode);
9809 } 9809 }
9810 } 9810 }
9811 9811
9812 int const ConstantProperties::number_of_properties() {
9813 if (has_number_of_properties()) {
9814 return Smi::cast(this->get(FixedArray::length() - 1))->value();
9815 }
9816 return FixedArray::length() / 2;
9817 }
9818
9819 int const ConstantProperties::length() {
9820 return FixedArray::length() - (this->has_number_of_properties() ? 1 : 0);
Toon Verwaest 2017/01/18 08:49:53 Perhaps better to not call this length; it's a lit
Franzi 2017/01/18 14:23:10 Done. Using size() which is intuitive for lists an
9821 }
9822
9823 bool const ConstantProperties::has_number_of_properties() {
9824 return FixedArray::length() % 2 != 0;
9825 }
9812 9826
9813 #ifdef DEBUG 9827 #ifdef DEBUG
9814 bool FixedArray::IsEqualTo(FixedArray* other) { 9828 bool FixedArray::IsEqualTo(FixedArray* other) {
9815 if (length() != other->length()) return false; 9829 if (length() != other->length()) return false;
9816 for (int i = 0 ; i < length(); ++i) { 9830 for (int i = 0 ; i < length(); ++i) {
9817 if (get(i) != other->get(i)) return false; 9831 if (get(i) != other->get(i)) return false;
9818 } 9832 }
9819 return true; 9833 return true;
9820 } 9834 }
9821 #endif 9835 #endif
(...skipping 10079 matching lines...) Expand 10 before | Expand all | Expand 10 after
19901 // depend on this. 19915 // depend on this.
19902 return DICTIONARY_ELEMENTS; 19916 return DICTIONARY_ELEMENTS;
19903 } 19917 }
19904 DCHECK_LE(kind, LAST_ELEMENTS_KIND); 19918 DCHECK_LE(kind, LAST_ELEMENTS_KIND);
19905 return kind; 19919 return kind;
19906 } 19920 }
19907 } 19921 }
19908 19922
19909 } // namespace internal 19923 } // namespace internal
19910 } // namespace v8 19924 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698