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

Side by Side Diff: src/objects.h

Issue 1188073003: Return void from array setters since the return value needs to be ignored (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 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
« no previous file with comments | « src/elements.cc ('k') | src/objects.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 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 2414 matching lines...) Expand 10 before | Expand all | Expand 10 after
2425 2425
2426 class FixedDoubleArray; 2426 class FixedDoubleArray;
2427 class IncrementalMarking; 2427 class IncrementalMarking;
2428 2428
2429 2429
2430 // FixedArray describes fixed-sized arrays with element type Object*. 2430 // FixedArray describes fixed-sized arrays with element type Object*.
2431 class FixedArray: public FixedArrayBase { 2431 class FixedArray: public FixedArrayBase {
2432 public: 2432 public:
2433 // Setter and getter for elements. 2433 // Setter and getter for elements.
2434 inline Object* get(int index) const; 2434 inline Object* get(int index) const;
2435 static Handle<Object> SetValue(Handle<JSObject> holder, 2435 static void SetValue(Handle<JSObject> holder, Handle<FixedArray> array,
2436 Handle<FixedArray> array, uint32_t index, 2436 uint32_t index, Handle<Object> value);
2437 Handle<Object> value);
2438 static inline Handle<Object> get(Handle<FixedArray> array, int index); 2437 static inline Handle<Object> get(Handle<FixedArray> array, int index);
2439 // Setter that uses write barrier. 2438 // Setter that uses write barrier.
2440 inline void set(int index, Object* value); 2439 inline void set(int index, Object* value);
2441 inline bool is_the_hole(int index); 2440 inline bool is_the_hole(int index);
2442 2441
2443 // Setter that doesn't need write barrier. 2442 // Setter that doesn't need write barrier.
2444 inline void set(int index, Smi* value); 2443 inline void set(int index, Smi* value);
2445 // Setter with explicit barrier mode. 2444 // Setter with explicit barrier mode.
2446 inline void set(int index, Object* value, WriteBarrierMode mode); 2445 inline void set(int index, Object* value, WriteBarrierMode mode);
2447 2446
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
2550 2549
2551 2550
2552 // FixedDoubleArray describes fixed-sized arrays with element type double. 2551 // FixedDoubleArray describes fixed-sized arrays with element type double.
2553 class FixedDoubleArray: public FixedArrayBase { 2552 class FixedDoubleArray: public FixedArrayBase {
2554 public: 2553 public:
2555 // Setter and getter for elements. 2554 // Setter and getter for elements.
2556 inline double get_scalar(int index); 2555 inline double get_scalar(int index);
2557 inline uint64_t get_representation(int index); 2556 inline uint64_t get_representation(int index);
2558 static inline Handle<Object> get(Handle<FixedDoubleArray> array, int index); 2557 static inline Handle<Object> get(Handle<FixedDoubleArray> array, int index);
2559 // This accessor has to get a Number as |value|. 2558 // This accessor has to get a Number as |value|.
2560 static Handle<Object> SetValue(Handle<JSObject> holder, 2559 static void SetValue(Handle<JSObject> holder, Handle<FixedDoubleArray> array,
2561 Handle<FixedDoubleArray> array, uint32_t index, 2560 uint32_t index, Handle<Object> value);
2562 Handle<Object> value);
2563 inline void set(int index, double value); 2561 inline void set(int index, double value);
2564 inline void set_the_hole(int index); 2562 inline void set_the_hole(int index);
2565 2563
2566 // Checking for the hole. 2564 // Checking for the hole.
2567 inline bool is_the_hole(int index); 2565 inline bool is_the_hole(int index);
2568 2566
2569 // Garbage collection support. 2567 // Garbage collection support.
2570 inline static int SizeFor(int length) { 2568 inline static int SizeFor(int length) {
2571 return kHeaderSize + length * kDoubleSize; 2569 return kHeaderSize + length * kDoubleSize;
2572 } 2570 }
(...skipping 1814 matching lines...) Expand 10 before | Expand all | Expand 10 after
4387 inline uint8_t* external_uint8_clamped_pointer(); 4385 inline uint8_t* external_uint8_clamped_pointer();
4388 4386
4389 // Setter and getter. 4387 // Setter and getter.
4390 inline uint8_t get_scalar(int index); 4388 inline uint8_t get_scalar(int index);
4391 static inline Handle<Object> get(Handle<ExternalUint8ClampedArray> array, 4389 static inline Handle<Object> get(Handle<ExternalUint8ClampedArray> array,
4392 int index); 4390 int index);
4393 inline void set(int index, uint8_t value); 4391 inline void set(int index, uint8_t value);
4394 4392
4395 // This accessor applies the correct conversion from Smi, HeapNumber 4393 // This accessor applies the correct conversion from Smi, HeapNumber
4396 // and undefined and clamps the converted value between 0 and 255. 4394 // and undefined and clamps the converted value between 0 and 255.
4397 static Handle<Object> SetValue(Handle<JSObject> holder, 4395 static void SetValue(Handle<JSObject> holder,
4398 Handle<ExternalUint8ClampedArray> array, 4396 Handle<ExternalUint8ClampedArray> array, uint32_t index,
4399 uint32_t index, Handle<Object> value); 4397 Handle<Object> value);
4400 4398
4401 DECLARE_CAST(ExternalUint8ClampedArray) 4399 DECLARE_CAST(ExternalUint8ClampedArray)
4402 4400
4403 // Dispatched behavior. 4401 // Dispatched behavior.
4404 DECLARE_PRINTER(ExternalUint8ClampedArray) 4402 DECLARE_PRINTER(ExternalUint8ClampedArray)
4405 DECLARE_VERIFIER(ExternalUint8ClampedArray) 4403 DECLARE_VERIFIER(ExternalUint8ClampedArray)
4406 4404
4407 private: 4405 private:
4408 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalUint8ClampedArray); 4406 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalUint8ClampedArray);
4409 }; 4407 };
4410 4408
4411 4409
4412 class ExternalInt8Array: public ExternalArray { 4410 class ExternalInt8Array: public ExternalArray {
4413 public: 4411 public:
4414 // Setter and getter. 4412 // Setter and getter.
4415 inline int8_t get_scalar(int index); 4413 inline int8_t get_scalar(int index);
4416 static inline Handle<Object> get(Handle<ExternalInt8Array> array, int index); 4414 static inline Handle<Object> get(Handle<ExternalInt8Array> array, int index);
4417 inline void set(int index, int8_t value); 4415 inline void set(int index, int8_t value);
4418 4416
4419 // This accessor applies the correct conversion from Smi, HeapNumber 4417 // This accessor applies the correct conversion from Smi, HeapNumber
4420 // and undefined. 4418 // and undefined.
4421 static Handle<Object> SetValue(Handle<JSObject> holder, 4419 static void SetValue(Handle<JSObject> holder, Handle<ExternalInt8Array> array,
4422 Handle<ExternalInt8Array> array, 4420 uint32_t index, Handle<Object> value);
4423 uint32_t index, Handle<Object> value);
4424 4421
4425 DECLARE_CAST(ExternalInt8Array) 4422 DECLARE_CAST(ExternalInt8Array)
4426 4423
4427 // Dispatched behavior. 4424 // Dispatched behavior.
4428 DECLARE_PRINTER(ExternalInt8Array) 4425 DECLARE_PRINTER(ExternalInt8Array)
4429 DECLARE_VERIFIER(ExternalInt8Array) 4426 DECLARE_VERIFIER(ExternalInt8Array)
4430 4427
4431 private: 4428 private:
4432 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalInt8Array); 4429 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalInt8Array);
4433 }; 4430 };
4434 4431
4435 4432
4436 class ExternalUint8Array: public ExternalArray { 4433 class ExternalUint8Array: public ExternalArray {
4437 public: 4434 public:
4438 // Setter and getter. 4435 // Setter and getter.
4439 inline uint8_t get_scalar(int index); 4436 inline uint8_t get_scalar(int index);
4440 static inline Handle<Object> get(Handle<ExternalUint8Array> array, int index); 4437 static inline Handle<Object> get(Handle<ExternalUint8Array> array, int index);
4441 inline void set(int index, uint8_t value); 4438 inline void set(int index, uint8_t value);
4442 4439
4443 // This accessor applies the correct conversion from Smi, HeapNumber 4440 // This accessor applies the correct conversion from Smi, HeapNumber
4444 // and undefined. 4441 // and undefined.
4445 static Handle<Object> SetValue(Handle<JSObject> holder, 4442 static void SetValue(Handle<JSObject> holder,
4446 Handle<ExternalUint8Array> array, 4443 Handle<ExternalUint8Array> array, uint32_t index,
4447 uint32_t index, Handle<Object> value); 4444 Handle<Object> value);
4448 4445
4449 DECLARE_CAST(ExternalUint8Array) 4446 DECLARE_CAST(ExternalUint8Array)
4450 4447
4451 // Dispatched behavior. 4448 // Dispatched behavior.
4452 DECLARE_PRINTER(ExternalUint8Array) 4449 DECLARE_PRINTER(ExternalUint8Array)
4453 DECLARE_VERIFIER(ExternalUint8Array) 4450 DECLARE_VERIFIER(ExternalUint8Array)
4454 4451
4455 private: 4452 private:
4456 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalUint8Array); 4453 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalUint8Array);
4457 }; 4454 };
4458 4455
4459 4456
4460 class ExternalInt16Array: public ExternalArray { 4457 class ExternalInt16Array: public ExternalArray {
4461 public: 4458 public:
4462 // Setter and getter. 4459 // Setter and getter.
4463 inline int16_t get_scalar(int index); 4460 inline int16_t get_scalar(int index);
4464 static inline Handle<Object> get(Handle<ExternalInt16Array> array, int index); 4461 static inline Handle<Object> get(Handle<ExternalInt16Array> array, int index);
4465 inline void set(int index, int16_t value); 4462 inline void set(int index, int16_t value);
4466 4463
4467 // This accessor applies the correct conversion from Smi, HeapNumber 4464 // This accessor applies the correct conversion from Smi, HeapNumber
4468 // and undefined. 4465 // and undefined.
4469 static Handle<Object> SetValue(Handle<JSObject> holder, 4466 static void SetValue(Handle<JSObject> holder,
4470 Handle<ExternalInt16Array> array, 4467 Handle<ExternalInt16Array> array, uint32_t index,
4471 uint32_t index, Handle<Object> value); 4468 Handle<Object> value);
4472 4469
4473 DECLARE_CAST(ExternalInt16Array) 4470 DECLARE_CAST(ExternalInt16Array)
4474 4471
4475 // Dispatched behavior. 4472 // Dispatched behavior.
4476 DECLARE_PRINTER(ExternalInt16Array) 4473 DECLARE_PRINTER(ExternalInt16Array)
4477 DECLARE_VERIFIER(ExternalInt16Array) 4474 DECLARE_VERIFIER(ExternalInt16Array)
4478 4475
4479 private: 4476 private:
4480 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalInt16Array); 4477 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalInt16Array);
4481 }; 4478 };
4482 4479
4483 4480
4484 class ExternalUint16Array: public ExternalArray { 4481 class ExternalUint16Array: public ExternalArray {
4485 public: 4482 public:
4486 // Setter and getter. 4483 // Setter and getter.
4487 inline uint16_t get_scalar(int index); 4484 inline uint16_t get_scalar(int index);
4488 static inline Handle<Object> get(Handle<ExternalUint16Array> array, 4485 static inline Handle<Object> get(Handle<ExternalUint16Array> array,
4489 int index); 4486 int index);
4490 inline void set(int index, uint16_t value); 4487 inline void set(int index, uint16_t value);
4491 4488
4492 // This accessor applies the correct conversion from Smi, HeapNumber 4489 // This accessor applies the correct conversion from Smi, HeapNumber
4493 // and undefined. 4490 // and undefined.
4494 static Handle<Object> SetValue(Handle<JSObject> holder, 4491 static void SetValue(Handle<JSObject> holder,
4495 Handle<ExternalUint16Array> array, 4492 Handle<ExternalUint16Array> array, uint32_t index,
4496 uint32_t index, Handle<Object> value); 4493 Handle<Object> value);
4497 4494
4498 DECLARE_CAST(ExternalUint16Array) 4495 DECLARE_CAST(ExternalUint16Array)
4499 4496
4500 // Dispatched behavior. 4497 // Dispatched behavior.
4501 DECLARE_PRINTER(ExternalUint16Array) 4498 DECLARE_PRINTER(ExternalUint16Array)
4502 DECLARE_VERIFIER(ExternalUint16Array) 4499 DECLARE_VERIFIER(ExternalUint16Array)
4503 4500
4504 private: 4501 private:
4505 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalUint16Array); 4502 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalUint16Array);
4506 }; 4503 };
4507 4504
4508 4505
4509 class ExternalInt32Array: public ExternalArray { 4506 class ExternalInt32Array: public ExternalArray {
4510 public: 4507 public:
4511 // Setter and getter. 4508 // Setter and getter.
4512 inline int32_t get_scalar(int index); 4509 inline int32_t get_scalar(int index);
4513 static inline Handle<Object> get(Handle<ExternalInt32Array> array, int index); 4510 static inline Handle<Object> get(Handle<ExternalInt32Array> array, int index);
4514 inline void set(int index, int32_t value); 4511 inline void set(int index, int32_t value);
4515 4512
4516 // This accessor applies the correct conversion from Smi, HeapNumber 4513 // This accessor applies the correct conversion from Smi, HeapNumber
4517 // and undefined. 4514 // and undefined.
4518 static Handle<Object> SetValue(Handle<JSObject> holder, 4515 static void SetValue(Handle<JSObject> holder,
4519 Handle<ExternalInt32Array> array, 4516 Handle<ExternalInt32Array> array, uint32_t index,
4520 uint32_t index, Handle<Object> value); 4517 Handle<Object> value);
4521 4518
4522 DECLARE_CAST(ExternalInt32Array) 4519 DECLARE_CAST(ExternalInt32Array)
4523 4520
4524 // Dispatched behavior. 4521 // Dispatched behavior.
4525 DECLARE_PRINTER(ExternalInt32Array) 4522 DECLARE_PRINTER(ExternalInt32Array)
4526 DECLARE_VERIFIER(ExternalInt32Array) 4523 DECLARE_VERIFIER(ExternalInt32Array)
4527 4524
4528 private: 4525 private:
4529 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalInt32Array); 4526 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalInt32Array);
4530 }; 4527 };
4531 4528
4532 4529
4533 class ExternalUint32Array: public ExternalArray { 4530 class ExternalUint32Array: public ExternalArray {
4534 public: 4531 public:
4535 // Setter and getter. 4532 // Setter and getter.
4536 inline uint32_t get_scalar(int index); 4533 inline uint32_t get_scalar(int index);
4537 static inline Handle<Object> get(Handle<ExternalUint32Array> array, 4534 static inline Handle<Object> get(Handle<ExternalUint32Array> array,
4538 int index); 4535 int index);
4539 inline void set(int index, uint32_t value); 4536 inline void set(int index, uint32_t value);
4540 4537
4541 // This accessor applies the correct conversion from Smi, HeapNumber 4538 // This accessor applies the correct conversion from Smi, HeapNumber
4542 // and undefined. 4539 // and undefined.
4543 static Handle<Object> SetValue(Handle<JSObject> holder, 4540 static void SetValue(Handle<JSObject> holder,
4544 Handle<ExternalUint32Array> array, 4541 Handle<ExternalUint32Array> array, uint32_t index,
4545 uint32_t index, Handle<Object> value); 4542 Handle<Object> value);
4546 4543
4547 DECLARE_CAST(ExternalUint32Array) 4544 DECLARE_CAST(ExternalUint32Array)
4548 4545
4549 // Dispatched behavior. 4546 // Dispatched behavior.
4550 DECLARE_PRINTER(ExternalUint32Array) 4547 DECLARE_PRINTER(ExternalUint32Array)
4551 DECLARE_VERIFIER(ExternalUint32Array) 4548 DECLARE_VERIFIER(ExternalUint32Array)
4552 4549
4553 private: 4550 private:
4554 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalUint32Array); 4551 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalUint32Array);
4555 }; 4552 };
4556 4553
4557 4554
4558 class ExternalFloat32Array: public ExternalArray { 4555 class ExternalFloat32Array: public ExternalArray {
4559 public: 4556 public:
4560 // Setter and getter. 4557 // Setter and getter.
4561 inline float get_scalar(int index); 4558 inline float get_scalar(int index);
4562 static inline Handle<Object> get(Handle<ExternalFloat32Array> array, 4559 static inline Handle<Object> get(Handle<ExternalFloat32Array> array,
4563 int index); 4560 int index);
4564 inline void set(int index, float value); 4561 inline void set(int index, float value);
4565 4562
4566 // This accessor applies the correct conversion from Smi, HeapNumber 4563 // This accessor applies the correct conversion from Smi, HeapNumber
4567 // and undefined. 4564 // and undefined.
4568 static Handle<Object> SetValue(Handle<JSObject> holder, 4565 static void SetValue(Handle<JSObject> holder,
4569 Handle<ExternalFloat32Array> array, 4566 Handle<ExternalFloat32Array> array, uint32_t index,
4570 uint32_t index, Handle<Object> value); 4567 Handle<Object> value);
4571 4568
4572 DECLARE_CAST(ExternalFloat32Array) 4569 DECLARE_CAST(ExternalFloat32Array)
4573 4570
4574 // Dispatched behavior. 4571 // Dispatched behavior.
4575 DECLARE_PRINTER(ExternalFloat32Array) 4572 DECLARE_PRINTER(ExternalFloat32Array)
4576 DECLARE_VERIFIER(ExternalFloat32Array) 4573 DECLARE_VERIFIER(ExternalFloat32Array)
4577 4574
4578 private: 4575 private:
4579 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalFloat32Array); 4576 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalFloat32Array);
4580 }; 4577 };
4581 4578
4582 4579
4583 class ExternalFloat64Array: public ExternalArray { 4580 class ExternalFloat64Array: public ExternalArray {
4584 public: 4581 public:
4585 // Setter and getter. 4582 // Setter and getter.
4586 inline double get_scalar(int index); 4583 inline double get_scalar(int index);
4587 static inline Handle<Object> get(Handle<ExternalFloat64Array> array, 4584 static inline Handle<Object> get(Handle<ExternalFloat64Array> array,
4588 int index); 4585 int index);
4589 inline void set(int index, double value); 4586 inline void set(int index, double value);
4590 4587
4591 // This accessor applies the correct conversion from Smi, HeapNumber 4588 // This accessor applies the correct conversion from Smi, HeapNumber
4592 // and undefined. 4589 // and undefined.
4593 static Handle<Object> SetValue(Handle<JSObject> holder, 4590 static void SetValue(Handle<JSObject> holder,
4594 Handle<ExternalFloat64Array> array, 4591 Handle<ExternalFloat64Array> array, uint32_t index,
4595 uint32_t index, Handle<Object> value); 4592 Handle<Object> value);
4596 4593
4597 DECLARE_CAST(ExternalFloat64Array) 4594 DECLARE_CAST(ExternalFloat64Array)
4598 4595
4599 // Dispatched behavior. 4596 // Dispatched behavior.
4600 DECLARE_PRINTER(ExternalFloat64Array) 4597 DECLARE_PRINTER(ExternalFloat64Array)
4601 DECLARE_VERIFIER(ExternalFloat64Array) 4598 DECLARE_VERIFIER(ExternalFloat64Array)
4602 4599
4603 private: 4600 private:
4604 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalFloat64Array); 4601 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalFloat64Array);
4605 }; 4602 };
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
4653 4650
4654 inline ElementType get_scalar(int index); 4651 inline ElementType get_scalar(int index);
4655 static inline Handle<Object> get(Handle<FixedTypedArray> array, int index); 4652 static inline Handle<Object> get(Handle<FixedTypedArray> array, int index);
4656 inline void set(int index, ElementType value); 4653 inline void set(int index, ElementType value);
4657 4654
4658 static inline ElementType from_int(int value); 4655 static inline ElementType from_int(int value);
4659 static inline ElementType from_double(double value); 4656 static inline ElementType from_double(double value);
4660 4657
4661 // This accessor applies the correct conversion from Smi, HeapNumber 4658 // This accessor applies the correct conversion from Smi, HeapNumber
4662 // and undefined. 4659 // and undefined.
4663 static Handle<Object> SetValue(Handle<JSObject> holder, 4660 static void SetValue(Handle<JSObject> holder,
4664 Handle<FixedTypedArray<Traits> > array, 4661 Handle<FixedTypedArray<Traits> > array, uint32_t index,
4665 uint32_t index, Handle<Object> value); 4662 Handle<Object> value);
4666 4663
4667 DECLARE_PRINTER(FixedTypedArray) 4664 DECLARE_PRINTER(FixedTypedArray)
4668 DECLARE_VERIFIER(FixedTypedArray) 4665 DECLARE_VERIFIER(FixedTypedArray)
4669 4666
4670 private: 4667 private:
4671 DISALLOW_IMPLICIT_CONSTRUCTORS(FixedTypedArray); 4668 DISALLOW_IMPLICIT_CONSTRUCTORS(FixedTypedArray);
4672 }; 4669 };
4673 4670
4674 #define FIXED_TYPED_ARRAY_TRAITS(Type, type, TYPE, elementType, size) \ 4671 #define FIXED_TYPED_ARRAY_TRAITS(Type, type, TYPE, elementType, size) \
4675 class Type##ArrayTraits { \ 4672 class Type##ArrayTraits { \
(...skipping 6202 matching lines...) Expand 10 before | Expand all | Expand 10 after
10878 } else { 10875 } else {
10879 value &= ~(1 << bit_position); 10876 value &= ~(1 << bit_position);
10880 } 10877 }
10881 return value; 10878 return value;
10882 } 10879 }
10883 }; 10880 };
10884 10881
10885 } } // namespace v8::internal 10882 } } // namespace v8::internal
10886 10883
10887 #endif // V8_OBJECTS_H_ 10884 #endif // V8_OBJECTS_H_
OLDNEW
« no previous file with comments | « src/elements.cc ('k') | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698