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

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

Issue 6879009: Support Float64Arrays (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: address comments Created 9 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 | Annotate | Revision Log
« no previous file with comments | « src/objects-debug.cc ('k') | src/objects-printer.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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after
399 } 399 }
400 400
401 401
402 bool Object::IsExternalFloatArray() { 402 bool Object::IsExternalFloatArray() {
403 return Object::IsHeapObject() && 403 return Object::IsHeapObject() &&
404 HeapObject::cast(this)->map()->instance_type() == 404 HeapObject::cast(this)->map()->instance_type() ==
405 EXTERNAL_FLOAT_ARRAY_TYPE; 405 EXTERNAL_FLOAT_ARRAY_TYPE;
406 } 406 }
407 407
408 408
409 bool Object::IsExternalDoubleArray() {
410 return Object::IsHeapObject() &&
411 HeapObject::cast(this)->map()->instance_type() ==
412 EXTERNAL_DOUBLE_ARRAY_TYPE;
413 }
414
415
409 bool MaybeObject::IsFailure() { 416 bool MaybeObject::IsFailure() {
410 return HAS_FAILURE_TAG(this); 417 return HAS_FAILURE_TAG(this);
411 } 418 }
412 419
413 420
414 bool MaybeObject::IsRetryAfterGC() { 421 bool MaybeObject::IsRetryAfterGC() {
415 return HAS_FAILURE_TAG(this) 422 return HAS_FAILURE_TAG(this)
416 && Failure::cast(this)->type() == Failure::RETRY_AFTER_GC; 423 && Failure::cast(this)->type() == Failure::RETRY_AFTER_GC;
417 } 424 }
418 425
(...skipping 1475 matching lines...) Expand 10 before | Expand all | Expand 10 after
1894 CAST_ACCESSOR(Proxy) 1901 CAST_ACCESSOR(Proxy)
1895 CAST_ACCESSOR(ByteArray) 1902 CAST_ACCESSOR(ByteArray)
1896 CAST_ACCESSOR(ExternalArray) 1903 CAST_ACCESSOR(ExternalArray)
1897 CAST_ACCESSOR(ExternalByteArray) 1904 CAST_ACCESSOR(ExternalByteArray)
1898 CAST_ACCESSOR(ExternalUnsignedByteArray) 1905 CAST_ACCESSOR(ExternalUnsignedByteArray)
1899 CAST_ACCESSOR(ExternalShortArray) 1906 CAST_ACCESSOR(ExternalShortArray)
1900 CAST_ACCESSOR(ExternalUnsignedShortArray) 1907 CAST_ACCESSOR(ExternalUnsignedShortArray)
1901 CAST_ACCESSOR(ExternalIntArray) 1908 CAST_ACCESSOR(ExternalIntArray)
1902 CAST_ACCESSOR(ExternalUnsignedIntArray) 1909 CAST_ACCESSOR(ExternalUnsignedIntArray)
1903 CAST_ACCESSOR(ExternalFloatArray) 1910 CAST_ACCESSOR(ExternalFloatArray)
1911 CAST_ACCESSOR(ExternalDoubleArray)
1904 CAST_ACCESSOR(ExternalPixelArray) 1912 CAST_ACCESSOR(ExternalPixelArray)
1905 CAST_ACCESSOR(Struct) 1913 CAST_ACCESSOR(Struct)
1906 1914
1907 1915
1908 #define MAKE_STRUCT_CAST(NAME, Name, name) CAST_ACCESSOR(Name) 1916 #define MAKE_STRUCT_CAST(NAME, Name, name) CAST_ACCESSOR(Name)
1909 STRUCT_LIST(MAKE_STRUCT_CAST) 1917 STRUCT_LIST(MAKE_STRUCT_CAST)
1910 #undef MAKE_STRUCT_CAST 1918 #undef MAKE_STRUCT_CAST
1911 1919
1912 1920
1913 template <typename Shape, typename Key> 1921 template <typename Shape, typename Key>
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after
2308 } 2316 }
2309 2317
2310 2318
2311 void ExternalFloatArray::set(int index, float value) { 2319 void ExternalFloatArray::set(int index, float value) {
2312 ASSERT((index >= 0) && (index < this->length())); 2320 ASSERT((index >= 0) && (index < this->length()));
2313 float* ptr = static_cast<float*>(external_pointer()); 2321 float* ptr = static_cast<float*>(external_pointer());
2314 ptr[index] = value; 2322 ptr[index] = value;
2315 } 2323 }
2316 2324
2317 2325
2326 double ExternalDoubleArray::get(int index) {
2327 ASSERT((index >= 0) && (index < this->length()));
2328 double* ptr = static_cast<double*>(external_pointer());
2329 return ptr[index];
2330 }
2331
2332
2333 void ExternalDoubleArray::set(int index, double value) {
2334 ASSERT((index >= 0) && (index < this->length()));
2335 double* ptr = static_cast<double*>(external_pointer());
2336 ptr[index] = value;
2337 }
2338
2339
2318 int Map::visitor_id() { 2340 int Map::visitor_id() {
2319 return READ_BYTE_FIELD(this, kVisitorIdOffset); 2341 return READ_BYTE_FIELD(this, kVisitorIdOffset);
2320 } 2342 }
2321 2343
2322 2344
2323 void Map::set_visitor_id(int id) { 2345 void Map::set_visitor_id(int id) {
2324 ASSERT(0 <= id && id < 256); 2346 ASSERT(0 <= id && id < 256);
2325 WRITE_BYTE_FIELD(this, kVisitorIdOffset, static_cast<byte>(id)); 2347 WRITE_BYTE_FIELD(this, kVisitorIdOffset, static_cast<byte>(id));
2326 } 2348 }
2327 2349
(...skipping 1303 matching lines...) Expand 10 before | Expand all | Expand 10 after
3631 case EXTERNAL_UNSIGNED_BYTE_ARRAY_TYPE: 3653 case EXTERNAL_UNSIGNED_BYTE_ARRAY_TYPE:
3632 return EXTERNAL_UNSIGNED_BYTE_ELEMENTS; 3654 return EXTERNAL_UNSIGNED_BYTE_ELEMENTS;
3633 case EXTERNAL_SHORT_ARRAY_TYPE: 3655 case EXTERNAL_SHORT_ARRAY_TYPE:
3634 return EXTERNAL_SHORT_ELEMENTS; 3656 return EXTERNAL_SHORT_ELEMENTS;
3635 case EXTERNAL_UNSIGNED_SHORT_ARRAY_TYPE: 3657 case EXTERNAL_UNSIGNED_SHORT_ARRAY_TYPE:
3636 return EXTERNAL_UNSIGNED_SHORT_ELEMENTS; 3658 return EXTERNAL_UNSIGNED_SHORT_ELEMENTS;
3637 case EXTERNAL_INT_ARRAY_TYPE: 3659 case EXTERNAL_INT_ARRAY_TYPE:
3638 return EXTERNAL_INT_ELEMENTS; 3660 return EXTERNAL_INT_ELEMENTS;
3639 case EXTERNAL_UNSIGNED_INT_ARRAY_TYPE: 3661 case EXTERNAL_UNSIGNED_INT_ARRAY_TYPE:
3640 return EXTERNAL_UNSIGNED_INT_ELEMENTS; 3662 return EXTERNAL_UNSIGNED_INT_ELEMENTS;
3663 case EXTERNAL_FLOAT_ARRAY_TYPE:
3664 return EXTERNAL_FLOAT_ELEMENTS;
3665 case EXTERNAL_DOUBLE_ARRAY_TYPE:
3666 return EXTERNAL_DOUBLE_ELEMENTS;
3641 case EXTERNAL_PIXEL_ARRAY_TYPE: 3667 case EXTERNAL_PIXEL_ARRAY_TYPE:
3642 return EXTERNAL_PIXEL_ELEMENTS; 3668 return EXTERNAL_PIXEL_ELEMENTS;
3643 default: 3669 default:
3644 break; 3670 break;
3645 } 3671 }
3646 } 3672 }
3647 ASSERT(array->map()->instance_type() == EXTERNAL_FLOAT_ARRAY_TYPE); 3673 UNREACHABLE();
3648 return EXTERNAL_FLOAT_ELEMENTS; 3674 return DICTIONARY_ELEMENTS;
3649 } 3675 }
3650 3676
3651 3677
3652 bool JSObject::HasFastElements() { 3678 bool JSObject::HasFastElements() {
3653 return GetElementsKind() == FAST_ELEMENTS; 3679 return GetElementsKind() == FAST_ELEMENTS;
3654 } 3680 }
3655 3681
3656 3682
3657 bool JSObject::HasDictionaryElements() { 3683 bool JSObject::HasDictionaryElements() {
3658 return GetElementsKind() == DICTIONARY_ELEMENTS; 3684 return GetElementsKind() == DICTIONARY_ELEMENTS;
(...skipping 20 matching lines...) Expand all
3679 EXTERNAL_ELEMENTS_CHECK(Byte, EXTERNAL_BYTE_ARRAY_TYPE) 3705 EXTERNAL_ELEMENTS_CHECK(Byte, EXTERNAL_BYTE_ARRAY_TYPE)
3680 EXTERNAL_ELEMENTS_CHECK(UnsignedByte, EXTERNAL_UNSIGNED_BYTE_ARRAY_TYPE) 3706 EXTERNAL_ELEMENTS_CHECK(UnsignedByte, EXTERNAL_UNSIGNED_BYTE_ARRAY_TYPE)
3681 EXTERNAL_ELEMENTS_CHECK(Short, EXTERNAL_SHORT_ARRAY_TYPE) 3707 EXTERNAL_ELEMENTS_CHECK(Short, EXTERNAL_SHORT_ARRAY_TYPE)
3682 EXTERNAL_ELEMENTS_CHECK(UnsignedShort, 3708 EXTERNAL_ELEMENTS_CHECK(UnsignedShort,
3683 EXTERNAL_UNSIGNED_SHORT_ARRAY_TYPE) 3709 EXTERNAL_UNSIGNED_SHORT_ARRAY_TYPE)
3684 EXTERNAL_ELEMENTS_CHECK(Int, EXTERNAL_INT_ARRAY_TYPE) 3710 EXTERNAL_ELEMENTS_CHECK(Int, EXTERNAL_INT_ARRAY_TYPE)
3685 EXTERNAL_ELEMENTS_CHECK(UnsignedInt, 3711 EXTERNAL_ELEMENTS_CHECK(UnsignedInt,
3686 EXTERNAL_UNSIGNED_INT_ARRAY_TYPE) 3712 EXTERNAL_UNSIGNED_INT_ARRAY_TYPE)
3687 EXTERNAL_ELEMENTS_CHECK(Float, 3713 EXTERNAL_ELEMENTS_CHECK(Float,
3688 EXTERNAL_FLOAT_ARRAY_TYPE) 3714 EXTERNAL_FLOAT_ARRAY_TYPE)
3715 EXTERNAL_ELEMENTS_CHECK(Double,
3716 EXTERNAL_DOUBLE_ARRAY_TYPE)
3689 EXTERNAL_ELEMENTS_CHECK(Pixel, EXTERNAL_PIXEL_ARRAY_TYPE) 3717 EXTERNAL_ELEMENTS_CHECK(Pixel, EXTERNAL_PIXEL_ARRAY_TYPE)
3690 3718
3691 3719
3692 bool JSObject::HasNamedInterceptor() { 3720 bool JSObject::HasNamedInterceptor() {
3693 return map()->has_named_interceptor(); 3721 return map()->has_named_interceptor();
3694 } 3722 }
3695 3723
3696 3724
3697 bool JSObject::HasIndexedInterceptor() { 3725 bool JSObject::HasIndexedInterceptor() {
3698 return map()->has_indexed_interceptor(); 3726 return map()->has_indexed_interceptor();
(...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after
4157 #undef WRITE_INT_FIELD 4185 #undef WRITE_INT_FIELD
4158 #undef READ_SHORT_FIELD 4186 #undef READ_SHORT_FIELD
4159 #undef WRITE_SHORT_FIELD 4187 #undef WRITE_SHORT_FIELD
4160 #undef READ_BYTE_FIELD 4188 #undef READ_BYTE_FIELD
4161 #undef WRITE_BYTE_FIELD 4189 #undef WRITE_BYTE_FIELD
4162 4190
4163 4191
4164 } } // namespace v8::internal 4192 } } // namespace v8::internal
4165 4193
4166 #endif // V8_OBJECTS_INL_H_ 4194 #endif // V8_OBJECTS_INL_H_
OLDNEW
« no previous file with comments | « src/objects-debug.cc ('k') | src/objects-printer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698