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

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

Issue 2103983003: Revert "[wasm] Complete separation of compilation and instantiation" (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: 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 2288 matching lines...) Expand 10 before | Expand all | Expand 10 after
2299 2299
2300 Object* FixedArray::get(int index) const { 2300 Object* FixedArray::get(int index) const {
2301 SLOW_DCHECK(index >= 0 && index < this->length()); 2301 SLOW_DCHECK(index >= 0 && index < this->length());
2302 return READ_FIELD(this, kHeaderSize + index * kPointerSize); 2302 return READ_FIELD(this, kHeaderSize + index * kPointerSize);
2303 } 2303 }
2304 2304
2305 Handle<Object> FixedArray::get(FixedArray* array, int index, Isolate* isolate) { 2305 Handle<Object> FixedArray::get(FixedArray* array, int index, Isolate* isolate) {
2306 return handle(array->get(index), isolate); 2306 return handle(array->get(index), isolate);
2307 } 2307 }
2308 2308
2309 template <class T>
2310 MaybeHandle<T> FixedArray::GetValue(int index) const {
2311 Object* obj = get(index);
2312 if (obj->IsUndefined(GetIsolate())) return MaybeHandle<T>();
2313 return Handle<T>(T::cast(obj));
2314 }
2315
2316 template <class T>
2317 Handle<T> FixedArray::GetValueChecked(int index) const {
2318 Object* obj = get(index);
2319 CHECK(!obj->IsUndefined(GetIsolate()));
2320 return Handle<T>(T::cast(obj));
2321 }
2322 2309
2323 bool FixedArray::is_the_hole(int index) { 2310 bool FixedArray::is_the_hole(int index) {
2324 return get(index) == GetHeap()->the_hole_value(); 2311 return get(index) == GetHeap()->the_hole_value();
2325 } 2312 }
2326 2313
2314
2327 void FixedArray::set(int index, Smi* value) { 2315 void FixedArray::set(int index, Smi* value) {
2328 DCHECK(map() != GetHeap()->fixed_cow_array_map()); 2316 DCHECK(map() != GetHeap()->fixed_cow_array_map());
2329 DCHECK(index >= 0 && index < this->length()); 2317 DCHECK(index >= 0 && index < this->length());
2330 DCHECK(reinterpret_cast<Object*>(value)->IsSmi()); 2318 DCHECK(reinterpret_cast<Object*>(value)->IsSmi());
2331 int offset = kHeaderSize + index * kPointerSize; 2319 int offset = kHeaderSize + index * kPointerSize;
2332 WRITE_FIELD(this, offset, value); 2320 WRITE_FIELD(this, offset, value);
2333 } 2321 }
2334 2322
2335 2323
2336 void FixedArray::set(int index, Object* value) { 2324 void FixedArray::set(int index, Object* value) {
(...skipping 1649 matching lines...) Expand 10 before | Expand all | Expand 10 after
3986 } 3974 }
3987 3975
3988 3976
3989 int ByteArray::Size() { return RoundUp(length() + kHeaderSize, kPointerSize); } 3977 int ByteArray::Size() { return RoundUp(length() + kHeaderSize, kPointerSize); }
3990 3978
3991 byte ByteArray::get(int index) { 3979 byte ByteArray::get(int index) {
3992 DCHECK(index >= 0 && index < this->length()); 3980 DCHECK(index >= 0 && index < this->length());
3993 return READ_BYTE_FIELD(this, kHeaderSize + index * kCharSize); 3981 return READ_BYTE_FIELD(this, kHeaderSize + index * kCharSize);
3994 } 3982 }
3995 3983
3996 const byte* ByteArray::data() const {
3997 return reinterpret_cast<const byte*>(FIELD_ADDR_CONST(this, kHeaderSize));
3998 }
3999 3984
4000 void ByteArray::set(int index, byte value) { 3985 void ByteArray::set(int index, byte value) {
4001 DCHECK(index >= 0 && index < this->length()); 3986 DCHECK(index >= 0 && index < this->length());
4002 WRITE_BYTE_FIELD(this, kHeaderSize + index * kCharSize, value); 3987 WRITE_BYTE_FIELD(this, kHeaderSize + index * kCharSize, value);
4003 } 3988 }
4004 3989
4005 void ByteArray::copy_in(int index, const byte* buffer, int length) { 3990 void ByteArray::copy_in(int index, const byte* buffer, int length) {
4006 DCHECK(index >= 0 && length >= 0 && index + length >= index && 3991 DCHECK(index >= 0 && length >= 0 && index + length >= index &&
4007 index + length <= this->length()); 3992 index + length <= this->length());
4008 byte* dst_addr = FIELD_ADDR(this, kHeaderSize + index * kCharSize); 3993 byte* dst_addr = FIELD_ADDR(this, kHeaderSize + index * kCharSize);
(...skipping 4029 matching lines...) Expand 10 before | Expand all | Expand 10 after
8038 #undef WRITE_INT64_FIELD 8023 #undef WRITE_INT64_FIELD
8039 #undef READ_BYTE_FIELD 8024 #undef READ_BYTE_FIELD
8040 #undef WRITE_BYTE_FIELD 8025 #undef WRITE_BYTE_FIELD
8041 #undef NOBARRIER_READ_BYTE_FIELD 8026 #undef NOBARRIER_READ_BYTE_FIELD
8042 #undef NOBARRIER_WRITE_BYTE_FIELD 8027 #undef NOBARRIER_WRITE_BYTE_FIELD
8043 8028
8044 } // namespace internal 8029 } // namespace internal
8045 } // namespace v8 8030 } // namespace v8
8046 8031
8047 #endif // V8_OBJECTS_INL_H_ 8032 #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