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

Side by Side Diff: src/objects.h

Issue 1069883002: WIP SharedArrayBuffer implementation (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 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
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 #ifndef V8_OBJECTS_H_ 5 #ifndef V8_OBJECTS_H_
6 #define V8_OBJECTS_H_ 6 #define V8_OBJECTS_H_
7 7
8 #include <iosfwd> 8 #include <iosfwd>
9 9
10 #include "src/allocation.h" 10 #include "src/allocation.h"
(...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after
437 V(JS_CONTEXT_EXTENSION_OBJECT_TYPE) \ 437 V(JS_CONTEXT_EXTENSION_OBJECT_TYPE) \
438 V(JS_GENERATOR_OBJECT_TYPE) \ 438 V(JS_GENERATOR_OBJECT_TYPE) \
439 V(JS_MODULE_TYPE) \ 439 V(JS_MODULE_TYPE) \
440 V(JS_GLOBAL_OBJECT_TYPE) \ 440 V(JS_GLOBAL_OBJECT_TYPE) \
441 V(JS_BUILTINS_OBJECT_TYPE) \ 441 V(JS_BUILTINS_OBJECT_TYPE) \
442 V(JS_GLOBAL_PROXY_TYPE) \ 442 V(JS_GLOBAL_PROXY_TYPE) \
443 V(JS_ARRAY_TYPE) \ 443 V(JS_ARRAY_TYPE) \
444 V(JS_ARRAY_BUFFER_TYPE) \ 444 V(JS_ARRAY_BUFFER_TYPE) \
445 V(JS_TYPED_ARRAY_TYPE) \ 445 V(JS_TYPED_ARRAY_TYPE) \
446 V(JS_DATA_VIEW_TYPE) \ 446 V(JS_DATA_VIEW_TYPE) \
447 V(JS_SHARED_ARRAY_BUFFER_TYPE) \
448 V(JS_SHARED_TYPED_ARRAY_TYPE) \
447 V(JS_PROXY_TYPE) \ 449 V(JS_PROXY_TYPE) \
448 V(JS_SET_TYPE) \ 450 V(JS_SET_TYPE) \
449 V(JS_MAP_TYPE) \ 451 V(JS_MAP_TYPE) \
450 V(JS_SET_ITERATOR_TYPE) \ 452 V(JS_SET_ITERATOR_TYPE) \
451 V(JS_MAP_ITERATOR_TYPE) \ 453 V(JS_MAP_ITERATOR_TYPE) \
452 V(JS_WEAK_MAP_TYPE) \ 454 V(JS_WEAK_MAP_TYPE) \
453 V(JS_WEAK_SET_TYPE) \ 455 V(JS_WEAK_SET_TYPE) \
454 V(JS_REGEXP_TYPE) \ 456 V(JS_REGEXP_TYPE) \
455 \ 457 \
456 V(JS_FUNCTION_TYPE) \ 458 V(JS_FUNCTION_TYPE) \
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
738 JS_CONTEXT_EXTENSION_OBJECT_TYPE, 740 JS_CONTEXT_EXTENSION_OBJECT_TYPE,
739 JS_GENERATOR_OBJECT_TYPE, 741 JS_GENERATOR_OBJECT_TYPE,
740 JS_MODULE_TYPE, 742 JS_MODULE_TYPE,
741 JS_GLOBAL_OBJECT_TYPE, 743 JS_GLOBAL_OBJECT_TYPE,
742 JS_BUILTINS_OBJECT_TYPE, 744 JS_BUILTINS_OBJECT_TYPE,
743 JS_GLOBAL_PROXY_TYPE, 745 JS_GLOBAL_PROXY_TYPE,
744 JS_ARRAY_TYPE, 746 JS_ARRAY_TYPE,
745 JS_ARRAY_BUFFER_TYPE, 747 JS_ARRAY_BUFFER_TYPE,
746 JS_TYPED_ARRAY_TYPE, 748 JS_TYPED_ARRAY_TYPE,
747 JS_DATA_VIEW_TYPE, 749 JS_DATA_VIEW_TYPE,
750 JS_SHARED_ARRAY_BUFFER_TYPE,
751 JS_SHARED_TYPED_ARRAY_TYPE,
748 JS_SET_TYPE, 752 JS_SET_TYPE,
749 JS_MAP_TYPE, 753 JS_MAP_TYPE,
750 JS_SET_ITERATOR_TYPE, 754 JS_SET_ITERATOR_TYPE,
751 JS_MAP_ITERATOR_TYPE, 755 JS_MAP_ITERATOR_TYPE,
752 JS_WEAK_MAP_TYPE, 756 JS_WEAK_MAP_TYPE,
753 JS_WEAK_SET_TYPE, 757 JS_WEAK_SET_TYPE,
754 JS_REGEXP_TYPE, 758 JS_REGEXP_TYPE,
755 JS_FUNCTION_TYPE, // LAST_JS_OBJECT_TYPE, LAST_JS_RECEIVER_TYPE 759 JS_FUNCTION_TYPE, // LAST_JS_OBJECT_TYPE, LAST_JS_RECEIVER_TYPE
756 760
757 // Pseudo-types 761 // Pseudo-types
(...skipping 9460 matching lines...) Expand 10 before | Expand all | Expand 10 after
10218 10222
10219 inline bool is_external(); 10223 inline bool is_external();
10220 inline void set_is_external(bool value); 10224 inline void set_is_external(bool value);
10221 10225
10222 inline bool should_be_freed(); 10226 inline bool should_be_freed();
10223 inline void set_should_be_freed(bool value); 10227 inline void set_should_be_freed(bool value);
10224 10228
10225 inline bool is_neuterable(); 10229 inline bool is_neuterable();
10226 inline void set_is_neuterable(bool value); 10230 inline void set_is_neuterable(bool value);
10227 10231
10232 inline bool is_shared();
10233 inline void set_is_shared(bool value);
10234
10228 // [weak_next]: linked list of array buffers. 10235 // [weak_next]: linked list of array buffers.
10229 DECL_ACCESSORS(weak_next, Object) 10236 DECL_ACCESSORS(weak_next, Object)
10230 10237
10231 // [weak_first_array]: weak linked list of views. 10238 // [weak_first_array]: weak linked list of views.
10232 DECL_ACCESSORS(weak_first_view, Object) 10239 DECL_ACCESSORS(weak_first_view, Object)
10233 10240
10234 DECLARE_CAST(JSArrayBuffer) 10241 DECLARE_CAST(JSArrayBuffer)
10235 10242
10236 // Neutering. Only neuters the buffer, not associated typed arrays. 10243 // Neutering. Only neuters the buffer, not associated typed arrays.
10237 void Neuter(); 10244 void Neuter();
(...skipping 10 matching lines...) Expand all
10248 static const int kSize = kWeakFirstViewOffset + kPointerSize; 10255 static const int kSize = kWeakFirstViewOffset + kPointerSize;
10249 10256
10250 static const int kSizeWithInternalFields = 10257 static const int kSizeWithInternalFields =
10251 kSize + v8::ArrayBuffer::kInternalFieldCount * kPointerSize; 10258 kSize + v8::ArrayBuffer::kInternalFieldCount * kPointerSize;
10252 10259
10253 private: 10260 private:
10254 // Bit position in a flag 10261 // Bit position in a flag
10255 static const int kIsExternalBit = 0; 10262 static const int kIsExternalBit = 0;
10256 static const int kShouldBeFreed = 1; 10263 static const int kShouldBeFreed = 1;
10257 static const int kIsNeuterableBit = 2; 10264 static const int kIsNeuterableBit = 2;
10265 static const int kIsSharedBit = 3;
Jarin 2015/04/16 14:55:28 Why do you need the bit? Cannot you get the shared
binji 2015/04/16 21:00:34 Do you mean from the ExternalArrayType? I currentl
Jarin 2015/04/17 07:49:27 I was just wondering why you could not define is_s
binji 2015/04/17 09:06:44 Thanks, that works. I knew I was missing something
10258 10266
10259 DISALLOW_IMPLICIT_CONSTRUCTORS(JSArrayBuffer); 10267 DISALLOW_IMPLICIT_CONSTRUCTORS(JSArrayBuffer);
10260 }; 10268 };
10261 10269
10262 10270
10263 class JSArrayBufferView: public JSObject { 10271 class JSArrayBufferView: public JSObject {
10264 public: 10272 public:
10265 // [buffer]: ArrayBuffer that this typed array views. 10273 // [buffer]: ArrayBuffer that this typed array views.
10266 DECL_ACCESSORS(buffer, Object) 10274 DECL_ACCESSORS(buffer, Object)
10267 10275
(...skipping 22 matching lines...) Expand all
10290 private: 10298 private:
10291 DISALLOW_IMPLICIT_CONSTRUCTORS(JSArrayBufferView); 10299 DISALLOW_IMPLICIT_CONSTRUCTORS(JSArrayBufferView);
10292 }; 10300 };
10293 10301
10294 10302
10295 class JSTypedArray: public JSArrayBufferView { 10303 class JSTypedArray: public JSArrayBufferView {
10296 public: 10304 public:
10297 // [length]: length of typed array in elements. 10305 // [length]: length of typed array in elements.
10298 DECL_ACCESSORS(length, Object) 10306 DECL_ACCESSORS(length, Object)
10299 10307
10308 // TODO(binji): How to make this a flags array and access it via hydrogen?
10309 // See hydrogen.cc:HOptimizedGraphBuilder::GenerateTypedArrayInitialize
10310 // [is_shared]
10311 DECL_BOOLEAN_ACCESSORS(is_shared)
10312
10300 // Neutering. Only neuters this typed array. 10313 // Neutering. Only neuters this typed array.
10301 void Neuter(); 10314 void Neuter();
10302 10315
10303 DECLARE_CAST(JSTypedArray) 10316 DECLARE_CAST(JSTypedArray)
10304 10317
10305 ExternalArrayType type(); 10318 ExternalArrayType type();
10306 size_t element_size(); 10319 size_t element_size();
10307 10320
10308 Handle<JSArrayBuffer> GetBuffer(); 10321 Handle<JSArrayBuffer> GetBuffer();
10309 10322
10310 // Dispatched behavior. 10323 // Dispatched behavior.
10311 DECLARE_PRINTER(JSTypedArray) 10324 DECLARE_PRINTER(JSTypedArray)
10312 DECLARE_VERIFIER(JSTypedArray) 10325 DECLARE_VERIFIER(JSTypedArray)
10313 10326
10314 static const int kLengthOffset = kViewSize + kPointerSize; 10327 static const int kLengthOffset = kViewSize + kPointerSize;
10315 static const int kSize = kLengthOffset + kPointerSize; 10328 static const int kIsSharedOffset = kLengthOffset + kPointerSize;
Jarin 2015/04/16 14:55:28 Again, why do you need the shared flag? Don't you
binji 2015/04/16 21:00:34 see above
10329 static const int kSize = kIsSharedOffset + kPointerSize;
10316 10330
10317 static const int kSizeWithInternalFields = 10331 static const int kSizeWithInternalFields =
10318 kSize + v8::ArrayBufferView::kInternalFieldCount * kPointerSize; 10332 kSize + v8::ArrayBufferView::kInternalFieldCount * kPointerSize;
10319 10333
10320 private: 10334 private:
10321 static Handle<JSArrayBuffer> MaterializeArrayBuffer( 10335 static Handle<JSArrayBuffer> MaterializeArrayBuffer(
10322 Handle<JSTypedArray> typed_array); 10336 Handle<JSTypedArray> typed_array);
10323 10337
10324 DISALLOW_IMPLICIT_CONSTRUCTORS(JSTypedArray); 10338 DISALLOW_IMPLICIT_CONSTRUCTORS(JSTypedArray);
10325 }; 10339 };
(...skipping 747 matching lines...) Expand 10 before | Expand all | Expand 10 after
11073 } else { 11087 } else {
11074 value &= ~(1 << bit_position); 11088 value &= ~(1 << bit_position);
11075 } 11089 }
11076 return value; 11090 return value;
11077 } 11091 }
11078 }; 11092 };
11079 11093
11080 } } // namespace v8::internal 11094 } } // namespace v8::internal
11081 11095
11082 #endif // V8_OBJECTS_H_ 11096 #endif // V8_OBJECTS_H_
OLDNEW
« src/factory.h ('K') | « src/macros.py ('k') | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698