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

Side by Side Diff: src/objects-inl.h

Issue 257453003: Some code cleanup, esp. includes and copyright headers. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: REBASE Created 6 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « src/objects-debug.cc ('k') | src/objects-printer.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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Use of this source code is governed by a BSD-style license that can be
3 // modification, are permitted provided that the following conditions are 3 // found in the LICENSE file.
4 // met:
5 //
6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided
11 // with the distribution.
12 // * Neither the name of Google Inc. nor the names of its
13 // contributors may be used to endorse or promote products derived
14 // from this software without specific prior written permission.
15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 //
28 // Review notes:
29 //
30 // - The use of macros in these inline functions may seem superfluous
31 // but it is absolutely needed to make sure gcc generates optimal
32 // code. gcc is not happy when attempting to inline too deep.
33 //
34 4
35 #ifndef V8_OBJECTS_INL_H_ 5 #ifndef V8_OBJECTS_INL_H_
36 #define V8_OBJECTS_INL_H_ 6 #define V8_OBJECTS_INL_H_
37 7
38 #include "elements.h"
39 #include "objects.h" 8 #include "objects.h"
9
40 #include "contexts.h" 10 #include "contexts.h"
41 #include "conversions-inl.h" 11 #include "conversions-inl.h"
12 #include "elements.h"
13 #include "factory.h"
42 #include "heap.h" 14 #include "heap.h"
43 #include "isolate.h"
44 #include "heap-inl.h" 15 #include "heap-inl.h"
16 #include "incremental-marking.h"
17 #include "objects-visiting.h"
45 #include "property.h" 18 #include "property.h"
46 #include "spaces.h" 19 #include "spaces.h"
47 #include "store-buffer.h" 20 #include "store-buffer.h"
21 #include "transitions-inl.h"
48 #include "v8memory.h" 22 #include "v8memory.h"
49 #include "factory.h"
50 #include "incremental-marking.h"
51 #include "transitions-inl.h"
52 #include "objects-visiting.h"
53 23
54 namespace v8 { 24 namespace v8 {
55 namespace internal { 25 namespace internal {
56 26
57 PropertyDetails::PropertyDetails(Smi* smi) { 27 PropertyDetails::PropertyDetails(Smi* smi) {
58 value_ = smi->value(); 28 value_ = smi->value();
59 } 29 }
60 30
61 31
62 Smi* PropertyDetails::AsSmi() const { 32 Smi* PropertyDetails::AsSmi() const {
63 // Ensure the upper 2 bits have the same value by sign extending it. This is 33 // Ensure the upper 2 bits have the same value by sign extending it. This is
64 // necessary to be able to use the 31st bit of the property details. 34 // necessary to be able to use the 31st bit of the property details.
65 int value = value_ << 1; 35 int value = value_ << 1;
66 return Smi::FromInt(value >> 1); 36 return Smi::FromInt(value >> 1);
67 } 37 }
68 38
69 39
70 PropertyDetails PropertyDetails::AsDeleted() const { 40 PropertyDetails PropertyDetails::AsDeleted() const {
71 Smi* smi = Smi::FromInt(value_ | DeletedField::encode(1)); 41 Smi* smi = Smi::FromInt(value_ | DeletedField::encode(1));
72 return PropertyDetails(smi); 42 return PropertyDetails(smi);
73 } 43 }
74 44
75 45
46 // Review notes:
47 //
48 // - The use of macros in these inline functions may seem superfluous
49 // but it is absolutely needed to make sure gcc generates optimal
50 // code. gcc is not happy when attempting to inline too deep.
51 //
76 #define TYPE_CHECKER(type, instancetype) \ 52 #define TYPE_CHECKER(type, instancetype) \
77 bool Object::Is##type() { \ 53 bool Object::Is##type() { \
78 return Object::IsHeapObject() && \ 54 return Object::IsHeapObject() && \
79 HeapObject::cast(this)->map()->instance_type() == instancetype; \ 55 HeapObject::cast(this)->map()->instance_type() == instancetype; \
80 } 56 }
81 57
82 58
83 #define CAST_ACCESSOR(type) \ 59 #define CAST_ACCESSOR(type) \
84 type* type::cast(Object* object) { \ 60 type* type::cast(Object* object) { \
85 SLOW_ASSERT(object->Is##type()); \ 61 SLOW_ASSERT(object->Is##type()); \
(...skipping 6935 matching lines...) Expand 10 before | Expand all | Expand 10 after
7021 #undef READ_SHORT_FIELD 6997 #undef READ_SHORT_FIELD
7022 #undef WRITE_SHORT_FIELD 6998 #undef WRITE_SHORT_FIELD
7023 #undef READ_BYTE_FIELD 6999 #undef READ_BYTE_FIELD
7024 #undef WRITE_BYTE_FIELD 7000 #undef WRITE_BYTE_FIELD
7025 #undef NOBARRIER_READ_BYTE_FIELD 7001 #undef NOBARRIER_READ_BYTE_FIELD
7026 #undef NOBARRIER_WRITE_BYTE_FIELD 7002 #undef NOBARRIER_WRITE_BYTE_FIELD
7027 7003
7028 } } // namespace v8::internal 7004 } } // namespace v8::internal
7029 7005
7030 #endif // V8_OBJECTS_INL_H_ 7006 #endif // V8_OBJECTS_INL_H_
OLDNEW
« no previous file with comments | « src/objects-debug.cc ('k') | src/objects-printer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698