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

Side by Side Diff: src/layout-descriptor-inl.h

Issue 2396353002: Revert "Add Smi::Zero and replace all Smi::FromInt(0) calls" (Closed)
Patch Set: Created 4 years, 2 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
« no previous file with comments | « src/keys.cc ('k') | src/mips/code-stubs-mips.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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 #ifndef V8_LAYOUT_DESCRIPTOR_INL_H_ 5 #ifndef V8_LAYOUT_DESCRIPTOR_INL_H_
6 #define V8_LAYOUT_DESCRIPTOR_INL_H_ 6 #define V8_LAYOUT_DESCRIPTOR_INL_H_
7 7
8 #include "src/layout-descriptor.h" 8 #include "src/layout-descriptor.h"
9 9
10 namespace v8 { 10 namespace v8 {
11 namespace internal { 11 namespace internal {
12 12
13 LayoutDescriptor* LayoutDescriptor::FromSmi(Smi* smi) { 13 LayoutDescriptor* LayoutDescriptor::FromSmi(Smi* smi) {
14 return LayoutDescriptor::cast(smi); 14 return LayoutDescriptor::cast(smi);
15 } 15 }
16 16
17 17
18 Handle<LayoutDescriptor> LayoutDescriptor::New(Isolate* isolate, int length) { 18 Handle<LayoutDescriptor> LayoutDescriptor::New(Isolate* isolate, int length) {
19 if (length <= kSmiValueSize) { 19 if (length <= kSmiValueSize) {
20 // The whole bit vector fits into a smi. 20 // The whole bit vector fits into a smi.
21 return handle(LayoutDescriptor::FromSmi(Smi::kZero), isolate); 21 return handle(LayoutDescriptor::FromSmi(Smi::FromInt(0)), isolate);
22 } 22 }
23 length = GetSlowModeBackingStoreLength(length); 23 length = GetSlowModeBackingStoreLength(length);
24 return Handle<LayoutDescriptor>::cast(isolate->factory()->NewFixedTypedArray( 24 return Handle<LayoutDescriptor>::cast(isolate->factory()->NewFixedTypedArray(
25 length, kExternalUint32Array, true)); 25 length, kExternalUint32Array, true));
26 } 26 }
27 27
28 28
29 bool LayoutDescriptor::InobjectUnboxedField(int inobject_properties, 29 bool LayoutDescriptor::InobjectUnboxedField(int inobject_properties,
30 PropertyDetails details) { 30 PropertyDetails details) {
31 if (details.type() != DATA || !details.representation().IsDouble()) { 31 if (details.type() != DATA || !details.representation().IsDouble()) {
32 return false; 32 return false;
33 } 33 }
34 // We care only about in-object properties. 34 // We care only about in-object properties.
35 return details.field_index() < inobject_properties; 35 return details.field_index() < inobject_properties;
36 } 36 }
37 37
38 38
39 LayoutDescriptor* LayoutDescriptor::FastPointerLayout() { 39 LayoutDescriptor* LayoutDescriptor::FastPointerLayout() {
40 return LayoutDescriptor::FromSmi(Smi::kZero); 40 return LayoutDescriptor::FromSmi(Smi::FromInt(0));
41 } 41 }
42 42
43 43
44 bool LayoutDescriptor::GetIndexes(int field_index, int* layout_word_index, 44 bool LayoutDescriptor::GetIndexes(int field_index, int* layout_word_index,
45 int* layout_bit_index) { 45 int* layout_bit_index) {
46 if (static_cast<unsigned>(field_index) >= static_cast<unsigned>(capacity())) { 46 if (static_cast<unsigned>(field_index) >= static_cast<unsigned>(capacity())) {
47 return false; 47 return false;
48 } 48 }
49 49
50 *layout_word_index = field_index / kNumberOfBits; 50 *layout_word_index = field_index / kNumberOfBits;
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 // Object headers do not contain non-tagged fields. 247 // Object headers do not contain non-tagged fields.
248 if (offset_in_bytes < header_size_) return true; 248 if (offset_in_bytes < header_size_) return true;
249 int field_index = (offset_in_bytes - header_size_) / kPointerSize; 249 int field_index = (offset_in_bytes - header_size_) / kPointerSize;
250 250
251 return layout_descriptor_->IsTagged(field_index); 251 return layout_descriptor_->IsTagged(field_index);
252 } 252 }
253 } // namespace internal 253 } // namespace internal
254 } // namespace v8 254 } // namespace v8
255 255
256 #endif // V8_LAYOUT_DESCRIPTOR_INL_H_ 256 #endif // V8_LAYOUT_DESCRIPTOR_INL_H_
OLDNEW
« no previous file with comments | « src/keys.cc ('k') | src/mips/code-stubs-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698