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

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

Issue 2094563002: [wasm] Complete separation of compilation and instantiation (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 6 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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 // Review notes: 5 // Review notes:
6 // 6 //
7 // - The use of macros in these inline functions may seem superfluous 7 // - The use of macros in these inline functions may seem superfluous
8 // but it is absolutely needed to make sure gcc generates optimal 8 // but it is absolutely needed to make sure gcc generates optimal
9 // code. gcc is not happy when attempting to inline too deep. 9 // code. gcc is not happy when attempting to inline too deep.
10 // 10 //
(...skipping 2289 matching lines...) Expand 10 before | Expand all | Expand 10 after
2300 2300
2301 Object* FixedArray::get(int index) const { 2301 Object* FixedArray::get(int index) const {
2302 SLOW_DCHECK(index >= 0 && index < this->length()); 2302 SLOW_DCHECK(index >= 0 && index < this->length());
2303 return READ_FIELD(this, kHeaderSize + index * kPointerSize); 2303 return READ_FIELD(this, kHeaderSize + index * kPointerSize);
2304 } 2304 }
2305 2305
2306 Handle<Object> FixedArray::get(FixedArray* array, int index, Isolate* isolate) { 2306 Handle<Object> FixedArray::get(FixedArray* array, int index, Isolate* isolate) {
2307 return handle(array->get(index), isolate); 2307 return handle(array->get(index), isolate);
2308 } 2308 }
2309 2309
2310 template <class T>
2311 Handle<T> FixedArray::GetValueOrNull(int index) const {
2312 Object* obj = get(index);
2313 if (obj->IsUndefined(GetIsolate())) return Handle<T>::null();
2314 return Handle<T>(T::cast(obj));
2315 }
2310 2316
2311 bool FixedArray::is_the_hole(int index) { 2317 bool FixedArray::is_the_hole(int index) {
2312 return get(index) == GetHeap()->the_hole_value(); 2318 return get(index) == GetHeap()->the_hole_value();
2313 } 2319 }
2314 2320
2315 2321
2316 void FixedArray::set(int index, Smi* value) { 2322 void FixedArray::set(int index, Smi* value) {
2317 DCHECK(map() != GetHeap()->fixed_cow_array_map()); 2323 DCHECK(map() != GetHeap()->fixed_cow_array_map());
2318 DCHECK(index >= 0 && index < this->length()); 2324 DCHECK(index >= 0 && index < this->length());
2319 DCHECK(reinterpret_cast<Object*>(value)->IsSmi()); 2325 DCHECK(reinterpret_cast<Object*>(value)->IsSmi());
(...skipping 1633 matching lines...) Expand 10 before | Expand all | Expand 10 after
3953 } 3959 }
3954 3960
3955 3961
3956 int ByteArray::Size() { return RoundUp(length() + kHeaderSize, kPointerSize); } 3962 int ByteArray::Size() { return RoundUp(length() + kHeaderSize, kPointerSize); }
3957 3963
3958 byte ByteArray::get(int index) { 3964 byte ByteArray::get(int index) {
3959 DCHECK(index >= 0 && index < this->length()); 3965 DCHECK(index >= 0 && index < this->length());
3960 return READ_BYTE_FIELD(this, kHeaderSize + index * kCharSize); 3966 return READ_BYTE_FIELD(this, kHeaderSize + index * kCharSize);
3961 } 3967 }
3962 3968
3969 const byte* ByteArray::data() const {
3970 return reinterpret_cast<const byte*>(FIELD_ADDR_CONST(this, kHeaderSize));
3971 }
3963 3972
3964 void ByteArray::set(int index, byte value) { 3973 void ByteArray::set(int index, byte value) {
3965 DCHECK(index >= 0 && index < this->length()); 3974 DCHECK(index >= 0 && index < this->length());
3966 WRITE_BYTE_FIELD(this, kHeaderSize + index * kCharSize, value); 3975 WRITE_BYTE_FIELD(this, kHeaderSize + index * kCharSize, value);
3967 } 3976 }
3968 3977
3969 void ByteArray::copy_in(int index, const byte* buffer, int length) { 3978 void ByteArray::copy_in(int index, const byte* buffer, int length) {
3970 DCHECK(index >= 0 && length >= 0 && index + length >= index && 3979 DCHECK(index >= 0 && length >= 0 && index + length >= index &&
3971 index + length <= this->length()); 3980 index + length <= this->length());
3972 byte* dst_addr = FIELD_ADDR(this, kHeaderSize + index * kCharSize); 3981 byte* dst_addr = FIELD_ADDR(this, kHeaderSize + index * kCharSize);
(...skipping 3984 matching lines...) Expand 10 before | Expand all | Expand 10 after
7957 #undef WRITE_INT64_FIELD 7966 #undef WRITE_INT64_FIELD
7958 #undef READ_BYTE_FIELD 7967 #undef READ_BYTE_FIELD
7959 #undef WRITE_BYTE_FIELD 7968 #undef WRITE_BYTE_FIELD
7960 #undef NOBARRIER_READ_BYTE_FIELD 7969 #undef NOBARRIER_READ_BYTE_FIELD
7961 #undef NOBARRIER_WRITE_BYTE_FIELD 7970 #undef NOBARRIER_WRITE_BYTE_FIELD
7962 7971
7963 } // namespace internal 7972 } // namespace internal
7964 } // namespace v8 7973 } // namespace v8
7965 7974
7966 #endif // V8_OBJECTS_INL_H_ 7975 #endif // V8_OBJECTS_INL_H_
OLDNEW
« src/objects.h ('K') | « src/objects.h ('k') | src/signature.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698