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

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: Incorporated Feedback Created 4 years, 5 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/objects.h ('k') | src/signature.h » ('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 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 2290 matching lines...) Expand 10 before | Expand all | Expand 10 after
2301 2301
2302 Object* FixedArray::get(int index) const { 2302 Object* FixedArray::get(int index) const {
2303 SLOW_DCHECK(index >= 0 && index < this->length()); 2303 SLOW_DCHECK(index >= 0 && index < this->length());
2304 return READ_FIELD(this, kHeaderSize + index * kPointerSize); 2304 return READ_FIELD(this, kHeaderSize + index * kPointerSize);
2305 } 2305 }
2306 2306
2307 Handle<Object> FixedArray::get(FixedArray* array, int index, Isolate* isolate) { 2307 Handle<Object> FixedArray::get(FixedArray* array, int index, Isolate* isolate) {
2308 return handle(array->get(index), isolate); 2308 return handle(array->get(index), isolate);
2309 } 2309 }
2310 2310
2311 template <class T>
2312 MaybeHandle<T> FixedArray::GetValue(int index) const {
2313 Object* obj = get(index);
2314 if (obj->IsUndefined(GetIsolate())) return MaybeHandle<T>();
2315 return Handle<T>(T::cast(obj));
2316 }
2317
2318 template <class T>
2319 Handle<T> FixedArray::GetValueChecked(int index) const {
2320 Object* obj = get(index);
2321 CHECK(!obj->IsUndefined(GetIsolate()));
2322 return Handle<T>(T::cast(obj));
2323 }
2311 2324
2312 bool FixedArray::is_the_hole(int index) { 2325 bool FixedArray::is_the_hole(int index) {
2313 return get(index) == GetHeap()->the_hole_value(); 2326 return get(index) == GetHeap()->the_hole_value();
2314 } 2327 }
2315 2328
2316
2317 void FixedArray::set(int index, Smi* value) { 2329 void FixedArray::set(int index, Smi* value) {
2318 DCHECK(map() != GetHeap()->fixed_cow_array_map()); 2330 DCHECK(map() != GetHeap()->fixed_cow_array_map());
2319 DCHECK(index >= 0 && index < this->length()); 2331 DCHECK(index >= 0 && index < this->length());
2320 DCHECK(reinterpret_cast<Object*>(value)->IsSmi()); 2332 DCHECK(reinterpret_cast<Object*>(value)->IsSmi());
2321 int offset = kHeaderSize + index * kPointerSize; 2333 int offset = kHeaderSize + index * kPointerSize;
2322 WRITE_FIELD(this, offset, value); 2334 WRITE_FIELD(this, offset, value);
2323 } 2335 }
2324 2336
2325 2337
2326 void FixedArray::set(int index, Object* value) { 2338 void FixedArray::set(int index, Object* value) {
(...skipping 1627 matching lines...) Expand 10 before | Expand all | Expand 10 after
3954 } 3966 }
3955 3967
3956 3968
3957 int ByteArray::Size() { return RoundUp(length() + kHeaderSize, kPointerSize); } 3969 int ByteArray::Size() { return RoundUp(length() + kHeaderSize, kPointerSize); }
3958 3970
3959 byte ByteArray::get(int index) { 3971 byte ByteArray::get(int index) {
3960 DCHECK(index >= 0 && index < this->length()); 3972 DCHECK(index >= 0 && index < this->length());
3961 return READ_BYTE_FIELD(this, kHeaderSize + index * kCharSize); 3973 return READ_BYTE_FIELD(this, kHeaderSize + index * kCharSize);
3962 } 3974 }
3963 3975
3976 const byte* ByteArray::data() const {
3977 return reinterpret_cast<const byte*>(FIELD_ADDR_CONST(this, kHeaderSize));
3978 }
3964 3979
3965 void ByteArray::set(int index, byte value) { 3980 void ByteArray::set(int index, byte value) {
3966 DCHECK(index >= 0 && index < this->length()); 3981 DCHECK(index >= 0 && index < this->length());
3967 WRITE_BYTE_FIELD(this, kHeaderSize + index * kCharSize, value); 3982 WRITE_BYTE_FIELD(this, kHeaderSize + index * kCharSize, value);
3968 } 3983 }
3969 3984
3970 void ByteArray::copy_in(int index, const byte* buffer, int length) { 3985 void ByteArray::copy_in(int index, const byte* buffer, int length) {
3971 DCHECK(index >= 0 && length >= 0 && index + length >= index && 3986 DCHECK(index >= 0 && length >= 0 && index + length >= index &&
3972 index + length <= this->length()); 3987 index + length <= this->length());
3973 byte* dst_addr = FIELD_ADDR(this, kHeaderSize + index * kCharSize); 3988 byte* dst_addr = FIELD_ADDR(this, kHeaderSize + index * kCharSize);
(...skipping 4025 matching lines...) Expand 10 before | Expand all | Expand 10 after
7999 #undef WRITE_INT64_FIELD 8014 #undef WRITE_INT64_FIELD
8000 #undef READ_BYTE_FIELD 8015 #undef READ_BYTE_FIELD
8001 #undef WRITE_BYTE_FIELD 8016 #undef WRITE_BYTE_FIELD
8002 #undef NOBARRIER_READ_BYTE_FIELD 8017 #undef NOBARRIER_READ_BYTE_FIELD
8003 #undef NOBARRIER_WRITE_BYTE_FIELD 8018 #undef NOBARRIER_WRITE_BYTE_FIELD
8004 8019
8005 } // namespace internal 8020 } // namespace internal
8006 } // namespace v8 8021 } // namespace v8
8007 8022
8008 #endif // V8_OBJECTS_INL_H_ 8023 #endif // V8_OBJECTS_INL_H_
OLDNEW
« no previous file with comments | « src/objects.h ('k') | src/signature.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698