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

Side by Side Diff: src/objects.cc

Issue 90643003: Experimental implementation: Exposing SIMD instructions into JavaScript Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years 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.h ('k') | src/objects-debug.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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 if (!maybe_result->ToObject(&result)) return maybe_result; 70 if (!maybe_result->ToObject(&result)) return maybe_result;
71 } 71 }
72 JSValue::cast(result)->set_value(value); 72 JSValue::cast(result)->set_value(value);
73 return result; 73 return result;
74 } 74 }
75 75
76 76
77 MaybeObject* Object::ToObject(Context* native_context) { 77 MaybeObject* Object::ToObject(Context* native_context) {
78 if (IsNumber()) { 78 if (IsNumber()) {
79 return CreateJSValue(native_context->number_function(), this); 79 return CreateJSValue(native_context->number_function(), this);
80 } else if (IsFloat32x4()) {
81 return CreateJSValue(native_context->float32x4_function(), this);
82 } else if (IsInt32x4()) {
83 return CreateJSValue(native_context->int32x4_function(), this);
80 } else if (IsBoolean()) { 84 } else if (IsBoolean()) {
81 return CreateJSValue(native_context->boolean_function(), this); 85 return CreateJSValue(native_context->boolean_function(), this);
82 } else if (IsString()) { 86 } else if (IsString()) {
83 return CreateJSValue(native_context->string_function(), this); 87 return CreateJSValue(native_context->string_function(), this);
84 } 88 }
85 ASSERT(IsJSObject()); 89 ASSERT(IsJSObject());
86 return this; 90 return this;
87 } 91 }
88 92
89 93
90 MaybeObject* Object::ToObject(Isolate* isolate) { 94 MaybeObject* Object::ToObject(Isolate* isolate) {
91 if (IsJSReceiver()) { 95 if (IsJSReceiver()) {
92 return this; 96 return this;
93 } else if (IsNumber()) { 97 } else if (IsNumber()) {
94 Context* native_context = isolate->context()->native_context(); 98 Context* native_context = isolate->context()->native_context();
95 return CreateJSValue(native_context->number_function(), this); 99 return CreateJSValue(native_context->number_function(), this);
100 } else if (IsFloat32x4()) {
101 Isolate* isolate = HeapObject::cast(this)->GetIsolate();
102 Context* native_context = isolate->context()->native_context();
103 return CreateJSValue(native_context->float32x4_function(), this);
104 } else if (IsInt32x4()) {
105 Isolate* isolate = HeapObject::cast(this)->GetIsolate();
106 Context* native_context = isolate->context()->native_context();
107 return CreateJSValue(native_context->int32x4_function(), this);
96 } else if (IsBoolean()) { 108 } else if (IsBoolean()) {
97 Context* native_context = isolate->context()->native_context(); 109 Context* native_context = isolate->context()->native_context();
98 return CreateJSValue(native_context->boolean_function(), this); 110 return CreateJSValue(native_context->boolean_function(), this);
99 } else if (IsString()) { 111 } else if (IsString()) {
100 Context* native_context = isolate->context()->native_context(); 112 Context* native_context = isolate->context()->native_context();
101 return CreateJSValue(native_context->string_function(), this); 113 return CreateJSValue(native_context->string_function(), this);
102 } else if (IsSymbol()) { 114 } else if (IsSymbol()) {
103 Context* native_context = isolate->context()->native_context(); 115 Context* native_context = isolate->context()->native_context();
104 return CreateJSValue(native_context->symbol_function(), this); 116 return CreateJSValue(native_context->symbol_function(), this);
105 } 117 }
(...skipping 15 matching lines...) Expand all
121 133
122 134
123 void Object::Lookup(Name* name, LookupResult* result) { 135 void Object::Lookup(Name* name, LookupResult* result) {
124 Object* holder = NULL; 136 Object* holder = NULL;
125 if (IsJSReceiver()) { 137 if (IsJSReceiver()) {
126 holder = this; 138 holder = this;
127 } else { 139 } else {
128 Context* native_context = result->isolate()->context()->native_context(); 140 Context* native_context = result->isolate()->context()->native_context();
129 if (IsNumber()) { 141 if (IsNumber()) {
130 holder = native_context->number_function()->instance_prototype(); 142 holder = native_context->number_function()->instance_prototype();
143 } else if (IsFloat32x4()) {
144 holder = native_context->float32x4_function()->instance_prototype();
145 } else if (IsInt32x4()) {
146 holder = native_context->int32x4_function()->instance_prototype();
131 } else if (IsString()) { 147 } else if (IsString()) {
132 holder = native_context->string_function()->instance_prototype(); 148 holder = native_context->string_function()->instance_prototype();
133 } else if (IsSymbol()) { 149 } else if (IsSymbol()) {
134 holder = native_context->symbol_function()->instance_prototype(); 150 holder = native_context->symbol_function()->instance_prototype();
135 } else if (IsBoolean()) { 151 } else if (IsBoolean()) {
136 holder = native_context->boolean_function()->instance_prototype(); 152 holder = native_context->boolean_function()->instance_prototype();
137 } else { 153 } else {
138 result->isolate()->PushStackTraceAndDie( 154 result->isolate()->PushStackTraceAndDie(
139 0xDEAD0000, this, JSReceiver::cast(this)->map(), 0xDEAD0001); 155 0xDEAD0000, this, JSReceiver::cast(this)->map(), 0xDEAD0001);
140 } 156 }
(...skipping 829 matching lines...) Expand 10 before | Expand all | Expand 10 after
970 986
971 // Iterate up the prototype chain until an element is found or the null 987 // Iterate up the prototype chain until an element is found or the null
972 // prototype is encountered. 988 // prototype is encountered.
973 for (holder = this; 989 for (holder = this;
974 holder != heap->null_value(); 990 holder != heap->null_value();
975 holder = holder->GetPrototype(isolate)) { 991 holder = holder->GetPrototype(isolate)) {
976 if (!holder->IsJSObject()) { 992 if (!holder->IsJSObject()) {
977 Context* native_context = isolate->context()->native_context(); 993 Context* native_context = isolate->context()->native_context();
978 if (holder->IsNumber()) { 994 if (holder->IsNumber()) {
979 holder = native_context->number_function()->instance_prototype(); 995 holder = native_context->number_function()->instance_prototype();
996 } else if (holder->IsFloat32x4()) {
997 holder = native_context->float32x4_function()->instance_prototype();
998 } else if (holder->IsInt32x4()) {
999 holder = native_context->int32x4_function()->instance_prototype();
980 } else if (holder->IsString()) { 1000 } else if (holder->IsString()) {
981 holder = native_context->string_function()->instance_prototype(); 1001 holder = native_context->string_function()->instance_prototype();
982 } else if (holder->IsSymbol()) { 1002 } else if (holder->IsSymbol()) {
983 holder = native_context->symbol_function()->instance_prototype(); 1003 holder = native_context->symbol_function()->instance_prototype();
984 } else if (holder->IsBoolean()) { 1004 } else if (holder->IsBoolean()) {
985 holder = native_context->boolean_function()->instance_prototype(); 1005 holder = native_context->boolean_function()->instance_prototype();
986 } else if (holder->IsJSProxy()) { 1006 } else if (holder->IsJSProxy()) {
987 return JSProxy::cast(holder)->GetElementWithHandler(receiver, index); 1007 return JSProxy::cast(holder)->GetElementWithHandler(receiver, index);
988 } else { 1008 } else {
989 // Undefined and null have no indexed properties. 1009 // Undefined and null have no indexed properties.
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
1033 // The object is either a number, a string, a boolean, 1053 // The object is either a number, a string, a boolean,
1034 // a real JS object, or a Harmony proxy. 1054 // a real JS object, or a Harmony proxy.
1035 if (heap_object->IsJSReceiver()) { 1055 if (heap_object->IsJSReceiver()) {
1036 return heap_object->map()->prototype(); 1056 return heap_object->map()->prototype();
1037 } 1057 }
1038 Context* context = isolate->context()->native_context(); 1058 Context* context = isolate->context()->native_context();
1039 1059
1040 if (heap_object->IsHeapNumber()) { 1060 if (heap_object->IsHeapNumber()) {
1041 return context->number_function()->instance_prototype(); 1061 return context->number_function()->instance_prototype();
1042 } 1062 }
1063 if (heap_object->IsFloat32x4()) {
1064 return context->float32x4_function()->instance_prototype();
1065 }
1066 if (heap_object->IsInt32x4()) {
1067 return context->int32x4_function()->instance_prototype();
1068 }
1043 if (heap_object->IsString()) { 1069 if (heap_object->IsString()) {
1044 return context->string_function()->instance_prototype(); 1070 return context->string_function()->instance_prototype();
1045 } 1071 }
1046 if (heap_object->IsSymbol()) { 1072 if (heap_object->IsSymbol()) {
1047 return context->symbol_function()->instance_prototype(); 1073 return context->symbol_function()->instance_prototype();
1048 } 1074 }
1049 if (heap_object->IsBoolean()) { 1075 if (heap_object->IsBoolean()) {
1050 return context->boolean_function()->instance_prototype(); 1076 return context->boolean_function()->instance_prototype();
1051 } else { 1077 } else {
1052 return isolate->heap()->null_value(); 1078 return isolate->heap()->null_value();
(...skipping 603 matching lines...) Expand 10 before | Expand all | Expand 10 after
1656 ExternalIntArray::cast(this)->length()); 1682 ExternalIntArray::cast(this)->length());
1657 break; 1683 break;
1658 case EXTERNAL_UNSIGNED_INT_ARRAY_TYPE: 1684 case EXTERNAL_UNSIGNED_INT_ARRAY_TYPE:
1659 accumulator->Add("<ExternalUnsignedIntArray[%u]>", 1685 accumulator->Add("<ExternalUnsignedIntArray[%u]>",
1660 ExternalUnsignedIntArray::cast(this)->length()); 1686 ExternalUnsignedIntArray::cast(this)->length());
1661 break; 1687 break;
1662 case EXTERNAL_FLOAT_ARRAY_TYPE: 1688 case EXTERNAL_FLOAT_ARRAY_TYPE:
1663 accumulator->Add("<ExternalFloatArray[%u]>", 1689 accumulator->Add("<ExternalFloatArray[%u]>",
1664 ExternalFloatArray::cast(this)->length()); 1690 ExternalFloatArray::cast(this)->length());
1665 break; 1691 break;
1692 case EXTERNAL_FLOAT32x4_ARRAY_TYPE:
1693 accumulator->Add("<ExternalFloat32x4Array[%u]>",
1694 ExternalFloat32x4Array::cast(this)->length());
1695 break;
1696 case EXTERNAL_INT32x4_ARRAY_TYPE:
1697 accumulator->Add("<ExternalInt32x4Array[%u]>",
1698 ExternalInt32x4Array::cast(this)->length());
1699 break;
1666 case EXTERNAL_DOUBLE_ARRAY_TYPE: 1700 case EXTERNAL_DOUBLE_ARRAY_TYPE:
1667 accumulator->Add("<ExternalDoubleArray[%u]>", 1701 accumulator->Add("<ExternalDoubleArray[%u]>",
1668 ExternalDoubleArray::cast(this)->length()); 1702 ExternalDoubleArray::cast(this)->length());
1669 break; 1703 break;
1670 case SHARED_FUNCTION_INFO_TYPE: { 1704 case SHARED_FUNCTION_INFO_TYPE: {
1671 SharedFunctionInfo* shared = SharedFunctionInfo::cast(this); 1705 SharedFunctionInfo* shared = SharedFunctionInfo::cast(this);
1672 SmartArrayPointer<char> debug_name = 1706 SmartArrayPointer<char> debug_name =
1673 shared->DebugName()->ToCString(); 1707 shared->DebugName()->ToCString();
1674 if (debug_name[0] != 0) { 1708 if (debug_name[0] != 0) {
1675 accumulator->Add("<SharedFunctionInfo %s>", *debug_name); 1709 accumulator->Add("<SharedFunctionInfo %s>", *debug_name);
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
1715 String::cast(symbol->name())->StringShortPrint(accumulator); 1749 String::cast(symbol->name())->StringShortPrint(accumulator);
1716 } 1750 }
1717 accumulator->Add(">"); 1751 accumulator->Add(">");
1718 break; 1752 break;
1719 } 1753 }
1720 case HEAP_NUMBER_TYPE: 1754 case HEAP_NUMBER_TYPE:
1721 accumulator->Add("<Number: "); 1755 accumulator->Add("<Number: ");
1722 HeapNumber::cast(this)->HeapNumberPrint(accumulator); 1756 HeapNumber::cast(this)->HeapNumberPrint(accumulator);
1723 accumulator->Put('>'); 1757 accumulator->Put('>');
1724 break; 1758 break;
1759 case FLOAT32x4_TYPE:
1760 accumulator->Add("<Float32x4: ");
1761 Float32x4::cast(this)->Float32x4Print(accumulator);
1762 accumulator->Put('>');
1763 break;
1764 case INT32x4_TYPE:
1765 accumulator->Add("<Int32x4: ");
1766 Int32x4::cast(this)->Int32x4Print(accumulator);
1767 accumulator->Put('>');
1768 break;
1725 case JS_PROXY_TYPE: 1769 case JS_PROXY_TYPE:
1726 accumulator->Add("<JSProxy>"); 1770 accumulator->Add("<JSProxy>");
1727 break; 1771 break;
1728 case JS_FUNCTION_PROXY_TYPE: 1772 case JS_FUNCTION_PROXY_TYPE:
1729 accumulator->Add("<JSFunctionProxy>"); 1773 accumulator->Add("<JSFunctionProxy>");
1730 break; 1774 break;
1731 case FOREIGN_TYPE: 1775 case FOREIGN_TYPE:
1732 accumulator->Add("<Foreign>"); 1776 accumulator->Add("<Foreign>");
1733 break; 1777 break;
1734 case CELL_TYPE: 1778 case CELL_TYPE:
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
1837 case CELL_TYPE: 1881 case CELL_TYPE:
1838 Cell::BodyDescriptor::IterateBody(this, v); 1882 Cell::BodyDescriptor::IterateBody(this, v);
1839 break; 1883 break;
1840 case PROPERTY_CELL_TYPE: 1884 case PROPERTY_CELL_TYPE:
1841 PropertyCell::BodyDescriptor::IterateBody(this, v); 1885 PropertyCell::BodyDescriptor::IterateBody(this, v);
1842 break; 1886 break;
1843 case SYMBOL_TYPE: 1887 case SYMBOL_TYPE:
1844 Symbol::BodyDescriptor::IterateBody(this, v); 1888 Symbol::BodyDescriptor::IterateBody(this, v);
1845 break; 1889 break;
1846 case HEAP_NUMBER_TYPE: 1890 case HEAP_NUMBER_TYPE:
1891 case FLOAT32x4_TYPE:
1892 case INT32x4_TYPE:
1847 case FILLER_TYPE: 1893 case FILLER_TYPE:
1848 case BYTE_ARRAY_TYPE: 1894 case BYTE_ARRAY_TYPE:
1849 case FREE_SPACE_TYPE: 1895 case FREE_SPACE_TYPE:
1850 case EXTERNAL_PIXEL_ARRAY_TYPE: 1896 case EXTERNAL_PIXEL_ARRAY_TYPE:
1851 case EXTERNAL_BYTE_ARRAY_TYPE: 1897 case EXTERNAL_BYTE_ARRAY_TYPE:
1852 case EXTERNAL_UNSIGNED_BYTE_ARRAY_TYPE: 1898 case EXTERNAL_UNSIGNED_BYTE_ARRAY_TYPE:
1853 case EXTERNAL_SHORT_ARRAY_TYPE: 1899 case EXTERNAL_SHORT_ARRAY_TYPE:
1854 case EXTERNAL_UNSIGNED_SHORT_ARRAY_TYPE: 1900 case EXTERNAL_UNSIGNED_SHORT_ARRAY_TYPE:
1855 case EXTERNAL_INT_ARRAY_TYPE: 1901 case EXTERNAL_INT_ARRAY_TYPE:
1856 case EXTERNAL_UNSIGNED_INT_ARRAY_TYPE: 1902 case EXTERNAL_UNSIGNED_INT_ARRAY_TYPE:
1857 case EXTERNAL_FLOAT_ARRAY_TYPE: 1903 case EXTERNAL_FLOAT_ARRAY_TYPE:
1904 case EXTERNAL_FLOAT32x4_ARRAY_TYPE:
1905 case EXTERNAL_INT32x4_ARRAY_TYPE:
1858 case EXTERNAL_DOUBLE_ARRAY_TYPE: 1906 case EXTERNAL_DOUBLE_ARRAY_TYPE:
1859 break; 1907 break;
1860 case SHARED_FUNCTION_INFO_TYPE: { 1908 case SHARED_FUNCTION_INFO_TYPE: {
1861 SharedFunctionInfo::BodyDescriptor::IterateBody(this, v); 1909 SharedFunctionInfo::BodyDescriptor::IterateBody(this, v);
1862 break; 1910 break;
1863 } 1911 }
1864 1912
1865 #define MAKE_STRUCT_CASE(NAME, Name, name) \ 1913 #define MAKE_STRUCT_CASE(NAME, Name, name) \
1866 case NAME##_TYPE: 1914 case NAME##_TYPE:
1867 STRUCT_LIST(MAKE_STRUCT_CASE) 1915 STRUCT_LIST(MAKE_STRUCT_CASE)
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
1910 // allocation when producing post-crash stack traces, so we print into a 1958 // allocation when producing post-crash stack traces, so we print into a
1911 // buffer that is plenty big enough for any floating point number, then 1959 // buffer that is plenty big enough for any floating point number, then
1912 // print that using vsnprintf (which may truncate but never allocate if 1960 // print that using vsnprintf (which may truncate but never allocate if
1913 // there is no more space in the buffer). 1961 // there is no more space in the buffer).
1914 EmbeddedVector<char, 100> buffer; 1962 EmbeddedVector<char, 100> buffer;
1915 OS::SNPrintF(buffer, "%.16g", Number()); 1963 OS::SNPrintF(buffer, "%.16g", Number());
1916 accumulator->Add("%s", buffer.start()); 1964 accumulator->Add("%s", buffer.start());
1917 } 1965 }
1918 1966
1919 1967
1968 void Float32x4::Float32x4Print(FILE* out) {
1969 PrintF(out, "%.16g %.16g %.16g %.16g", x(), y(), z(), w());
1970 }
1971
1972
1973 void Float32x4::Float32x4Print(StringStream* accumulator) {
1974 // The Windows version of vsnprintf can allocate when printing a %g string
1975 // into a buffer that may not be big enough. We don't want random memory
1976 // allocation when producing post-crash stack traces, so we print into a
1977 // buffer that is plenty big enough for any floating point number, then
1978 // print that using vsnprintf (which may truncate but never allocate if
1979 // there is no more space in the buffer).
1980 EmbeddedVector<char, 100> buffer;
1981 OS::SNPrintF(buffer, "%.16g %.16g %.16g %.16g", x(), y(), z(), w());
1982 accumulator->Add("%s", buffer.start());
1983 }
1984
1985
1986 void Int32x4::Int32x4Print(FILE* out) {
1987 PrintF(out, "%u %u %u %u", x(), y(), z(), w());
1988 }
1989
1990
1991 void Int32x4::Int32x4Print(StringStream* accumulator) {
1992 // The Windows version of vsnprintf can allocate when printing a %g string
1993 // into a buffer that may not be big enough. We don't want random memory
1994 // allocation when producing post-crash stack traces, so we print into a
1995 // buffer that is plenty big enough for any floating point number, then
1996 // print that using vsnprintf (which may truncate but never allocate if
1997 // there is no more space in the buffer).
1998 EmbeddedVector<char, 100> buffer;
1999 OS::SNPrintF(buffer, "%u %u %u %u", x(), y(), z(), w());
2000 accumulator->Add("%s", buffer.start());
2001 }
2002
2003
1920 String* JSReceiver::class_name() { 2004 String* JSReceiver::class_name() {
1921 if (IsJSFunction() && IsJSFunctionProxy()) { 2005 if (IsJSFunction() && IsJSFunctionProxy()) {
1922 return GetHeap()->function_class_string(); 2006 return GetHeap()->function_class_string();
1923 } 2007 }
1924 if (map()->constructor()->IsJSFunction()) { 2008 if (map()->constructor()->IsJSFunction()) {
1925 JSFunction* constructor = JSFunction::cast(map()->constructor()); 2009 JSFunction* constructor = JSFunction::cast(map()->constructor());
1926 return String::cast(constructor->shared()->instance_class_name()); 2010 return String::cast(constructor->shared()->instance_class_name());
1927 } 2011 }
1928 // If the constructor is not present, return "Object". 2012 // If the constructor is not present, return "Object".
1929 return GetHeap()->Object_string(); 2013 return GetHeap()->Object_string();
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after
2276 JSObject::SetNormalizedProperty(object, name, value, new_details); 2360 JSObject::SetNormalizedProperty(object, name, value, new_details);
2277 } 2361 }
2278 2362
2279 2363
2280 const char* Representation::Mnemonic() const { 2364 const char* Representation::Mnemonic() const {
2281 switch (kind_) { 2365 switch (kind_) {
2282 case kNone: return "v"; 2366 case kNone: return "v";
2283 case kTagged: return "t"; 2367 case kTagged: return "t";
2284 case kSmi: return "s"; 2368 case kSmi: return "s";
2285 case kDouble: return "d"; 2369 case kDouble: return "d";
2370 case kFloat32x4: return "float32x4";
2371 case kInt32x4: return "int32x44";
2286 case kInteger32: return "i"; 2372 case kInteger32: return "i";
2287 case kHeapObject: return "h"; 2373 case kHeapObject: return "h";
2288 case kExternal: return "x"; 2374 case kExternal: return "x";
2289 default: 2375 default:
2290 UNREACHABLE(); 2376 UNREACHABLE();
2291 return NULL; 2377 return NULL;
2292 } 2378 }
2293 } 2379 }
2294 2380
2295 2381
(...skipping 3063 matching lines...) Expand 10 before | Expand all | Expand 10 after
5359 ElementsKind kind = GetElementsKind(); 5445 ElementsKind kind = GetElementsKind();
5360 switch (kind) { 5446 switch (kind) {
5361 case EXTERNAL_PIXEL_ELEMENTS: 5447 case EXTERNAL_PIXEL_ELEMENTS:
5362 case EXTERNAL_BYTE_ELEMENTS: 5448 case EXTERNAL_BYTE_ELEMENTS:
5363 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: 5449 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS:
5364 case EXTERNAL_SHORT_ELEMENTS: 5450 case EXTERNAL_SHORT_ELEMENTS:
5365 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS: 5451 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS:
5366 case EXTERNAL_INT_ELEMENTS: 5452 case EXTERNAL_INT_ELEMENTS:
5367 case EXTERNAL_UNSIGNED_INT_ELEMENTS: 5453 case EXTERNAL_UNSIGNED_INT_ELEMENTS:
5368 case EXTERNAL_FLOAT_ELEMENTS: 5454 case EXTERNAL_FLOAT_ELEMENTS:
5455 case EXTERNAL_FLOAT32x4_ELEMENTS:
5456 case EXTERNAL_INT32x4_ELEMENTS:
5369 case EXTERNAL_DOUBLE_ELEMENTS: 5457 case EXTERNAL_DOUBLE_ELEMENTS:
5370 case FAST_DOUBLE_ELEMENTS: 5458 case FAST_DOUBLE_ELEMENTS:
5371 case FAST_HOLEY_DOUBLE_ELEMENTS: 5459 case FAST_HOLEY_DOUBLE_ELEMENTS:
5372 // Raw pixels and external arrays do not reference other 5460 // Raw pixels and external arrays do not reference other
5373 // objects. 5461 // objects.
5374 break; 5462 break;
5375 case FAST_SMI_ELEMENTS: 5463 case FAST_SMI_ELEMENTS:
5376 case FAST_HOLEY_SMI_ELEMENTS: 5464 case FAST_HOLEY_SMI_ELEMENTS:
5377 break; 5465 break;
5378 case FAST_ELEMENTS: 5466 case FAST_ELEMENTS:
(...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after
5854 UNIMPLEMENTED(); 5942 UNIMPLEMENTED();
5855 break; 5943 break;
5856 case EXTERNAL_PIXEL_ELEMENTS: 5944 case EXTERNAL_PIXEL_ELEMENTS:
5857 case EXTERNAL_BYTE_ELEMENTS: 5945 case EXTERNAL_BYTE_ELEMENTS:
5858 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: 5946 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS:
5859 case EXTERNAL_SHORT_ELEMENTS: 5947 case EXTERNAL_SHORT_ELEMENTS:
5860 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS: 5948 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS:
5861 case EXTERNAL_INT_ELEMENTS: 5949 case EXTERNAL_INT_ELEMENTS:
5862 case EXTERNAL_UNSIGNED_INT_ELEMENTS: 5950 case EXTERNAL_UNSIGNED_INT_ELEMENTS:
5863 case EXTERNAL_FLOAT_ELEMENTS: 5951 case EXTERNAL_FLOAT_ELEMENTS:
5952 case EXTERNAL_FLOAT32x4_ELEMENTS:
5953 case EXTERNAL_INT32x4_ELEMENTS:
5864 case EXTERNAL_DOUBLE_ELEMENTS: 5954 case EXTERNAL_DOUBLE_ELEMENTS:
5865 case FAST_DOUBLE_ELEMENTS: 5955 case FAST_DOUBLE_ELEMENTS:
5866 case FAST_HOLEY_DOUBLE_ELEMENTS: 5956 case FAST_HOLEY_DOUBLE_ELEMENTS:
5867 // No contained objects, nothing to do. 5957 // No contained objects, nothing to do.
5868 break; 5958 break;
5869 } 5959 }
5870 } 5960 }
5871 5961
5872 return copy; 5962 return copy;
5873 } 5963 }
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
6075 case FAST_HOLEY_DOUBLE_ELEMENTS: 6165 case FAST_HOLEY_DOUBLE_ELEMENTS:
6076 break; 6166 break;
6077 case EXTERNAL_PIXEL_ELEMENTS: 6167 case EXTERNAL_PIXEL_ELEMENTS:
6078 case EXTERNAL_BYTE_ELEMENTS: 6168 case EXTERNAL_BYTE_ELEMENTS:
6079 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: 6169 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS:
6080 case EXTERNAL_SHORT_ELEMENTS: 6170 case EXTERNAL_SHORT_ELEMENTS:
6081 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS: 6171 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS:
6082 case EXTERNAL_INT_ELEMENTS: 6172 case EXTERNAL_INT_ELEMENTS:
6083 case EXTERNAL_UNSIGNED_INT_ELEMENTS: 6173 case EXTERNAL_UNSIGNED_INT_ELEMENTS:
6084 case EXTERNAL_FLOAT_ELEMENTS: 6174 case EXTERNAL_FLOAT_ELEMENTS:
6175 case EXTERNAL_FLOAT32x4_ELEMENTS:
6176 case EXTERNAL_INT32x4_ELEMENTS:
6085 case EXTERNAL_DOUBLE_ELEMENTS: 6177 case EXTERNAL_DOUBLE_ELEMENTS:
6086 // Ignore getters and setters on pixel and external array elements. 6178 // Ignore getters and setters on pixel and external array elements.
6087 return; 6179 return;
6088 case DICTIONARY_ELEMENTS: 6180 case DICTIONARY_ELEMENTS:
6089 if (UpdateGetterSetterInDictionary(object->element_dictionary(), 6181 if (UpdateGetterSetterInDictionary(object->element_dictionary(),
6090 index, 6182 index,
6091 *getter, 6183 *getter,
6092 *setter, 6184 *setter,
6093 attributes)) { 6185 attributes)) {
6094 return; 6186 return;
(...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after
6533 case FAST_HOLEY_DOUBLE_ELEMENTS: 6625 case FAST_HOLEY_DOUBLE_ELEMENTS:
6534 break; 6626 break;
6535 case EXTERNAL_PIXEL_ELEMENTS: 6627 case EXTERNAL_PIXEL_ELEMENTS:
6536 case EXTERNAL_BYTE_ELEMENTS: 6628 case EXTERNAL_BYTE_ELEMENTS:
6537 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: 6629 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS:
6538 case EXTERNAL_SHORT_ELEMENTS: 6630 case EXTERNAL_SHORT_ELEMENTS:
6539 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS: 6631 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS:
6540 case EXTERNAL_INT_ELEMENTS: 6632 case EXTERNAL_INT_ELEMENTS:
6541 case EXTERNAL_UNSIGNED_INT_ELEMENTS: 6633 case EXTERNAL_UNSIGNED_INT_ELEMENTS:
6542 case EXTERNAL_FLOAT_ELEMENTS: 6634 case EXTERNAL_FLOAT_ELEMENTS:
6635 case EXTERNAL_FLOAT32x4_ELEMENTS:
6636 case EXTERNAL_INT32x4_ELEMENTS:
6543 case EXTERNAL_DOUBLE_ELEMENTS: 6637 case EXTERNAL_DOUBLE_ELEMENTS:
6544 // Ignore getters and setters on pixel and external array 6638 // Ignore getters and setters on pixel and external array
6545 // elements. 6639 // elements.
6546 return factory->undefined_value(); 6640 return factory->undefined_value();
6547 case DICTIONARY_ELEMENTS: 6641 case DICTIONARY_ELEMENTS:
6548 break; 6642 break;
6549 case NON_STRICT_ARGUMENTS_ELEMENTS: 6643 case NON_STRICT_ARGUMENTS_ELEMENTS:
6550 UNIMPLEMENTED(); 6644 UNIMPLEMENTED();
6551 break; 6645 break;
6552 } 6646 }
(...skipping 4435 matching lines...) Expand 10 before | Expand all | Expand 10 after
10988 break; 11082 break;
10989 } 11083 }
10990 11084
10991 case Translation::DOUBLE_REGISTER: { 11085 case Translation::DOUBLE_REGISTER: {
10992 int reg_code = iterator.Next(); 11086 int reg_code = iterator.Next();
10993 PrintF(out, "{input=%s}", 11087 PrintF(out, "{input=%s}",
10994 DoubleRegister::AllocationIndexToString(reg_code)); 11088 DoubleRegister::AllocationIndexToString(reg_code));
10995 break; 11089 break;
10996 } 11090 }
10997 11091
11092 case Translation::FLOAT32x4_REGISTER: {
11093 int reg_code = iterator.Next();
11094 PrintF(out, "{input=%s}",
11095 Float32x4Register::AllocationIndexToString(reg_code));
11096 break;
11097 }
11098
11099 case Translation::INT32x4_REGISTER: {
11100 int reg_code = iterator.Next();
11101 PrintF(out, "{input=%s}",
11102 Int32x4Register::AllocationIndexToString(reg_code));
11103 break;
11104 }
11105
10998 case Translation::STACK_SLOT: { 11106 case Translation::STACK_SLOT: {
10999 int input_slot_index = iterator.Next(); 11107 int input_slot_index = iterator.Next();
11000 PrintF(out, "{input=%d}", input_slot_index); 11108 PrintF(out, "{input=%d}", input_slot_index);
11001 break; 11109 break;
11002 } 11110 }
11003 11111
11004 case Translation::INT32_STACK_SLOT: { 11112 case Translation::INT32_STACK_SLOT: {
11005 int input_slot_index = iterator.Next(); 11113 int input_slot_index = iterator.Next();
11006 PrintF(out, "{input=%d}", input_slot_index); 11114 PrintF(out, "{input=%d}", input_slot_index);
11007 break; 11115 break;
11008 } 11116 }
11009 11117
11010 case Translation::UINT32_STACK_SLOT: { 11118 case Translation::UINT32_STACK_SLOT: {
11011 int input_slot_index = iterator.Next(); 11119 int input_slot_index = iterator.Next();
11012 PrintF(out, "{input=%d (unsigned)}", input_slot_index); 11120 PrintF(out, "{input=%d (unsigned)}", input_slot_index);
11013 break; 11121 break;
11014 } 11122 }
11015 11123
11016 case Translation::DOUBLE_STACK_SLOT: { 11124 case Translation::DOUBLE_STACK_SLOT: {
11017 int input_slot_index = iterator.Next(); 11125 int input_slot_index = iterator.Next();
11018 PrintF(out, "{input=%d}", input_slot_index); 11126 PrintF(out, "{input=%d}", input_slot_index);
11019 break; 11127 break;
11020 } 11128 }
11021 11129
11130 case Translation::FLOAT32x4_STACK_SLOT: {
11131 int input_slot_index = iterator.Next();
11132 PrintF(out, "{input=%d}", input_slot_index);
11133 break;
11134 }
11135
11136 case Translation::INT32x4_STACK_SLOT: {
11137 int input_slot_index = iterator.Next();
11138 PrintF(out, "{input=%d}", input_slot_index);
11139 break;
11140 }
11141
11022 case Translation::LITERAL: { 11142 case Translation::LITERAL: {
11023 unsigned literal_index = iterator.Next(); 11143 unsigned literal_index = iterator.Next();
11024 PrintF(out, "{literal_id=%u}", literal_index); 11144 PrintF(out, "{literal_id=%u}", literal_index);
11025 break; 11145 break;
11026 } 11146 }
11027 11147
11028 case Translation::DUPLICATED_OBJECT: { 11148 case Translation::DUPLICATED_OBJECT: {
11029 int object_index = iterator.Next(); 11149 int object_index = iterator.Next();
11030 PrintF(out, "{object_index=%d}", object_index); 11150 PrintF(out, "{object_index=%d}", object_index);
11031 break; 11151 break;
(...skipping 1502 matching lines...) Expand 10 before | Expand all | Expand 10 after
12534 Handle<Object> JSObject::SetElement(Handle<JSObject> object, 12654 Handle<Object> JSObject::SetElement(Handle<JSObject> object,
12535 uint32_t index, 12655 uint32_t index,
12536 Handle<Object> value, 12656 Handle<Object> value,
12537 PropertyAttributes attributes, 12657 PropertyAttributes attributes,
12538 StrictModeFlag strict_mode, 12658 StrictModeFlag strict_mode,
12539 bool check_prototype, 12659 bool check_prototype,
12540 SetPropertyMode set_mode) { 12660 SetPropertyMode set_mode) {
12541 Isolate* isolate = object->GetIsolate(); 12661 Isolate* isolate = object->GetIsolate();
12542 12662
12543 if (object->HasExternalArrayElements()) { 12663 if (object->HasExternalArrayElements()) {
12544 if (!value->IsNumber() && !value->IsUndefined()) { 12664 // TODO(ningxin): Throw an error if setting a Float32x4Array element
12665 // while the value is not Float32x4Object.
12666 if (!value->IsNumber() && !value->IsFloat32x4() &&
12667 !value->IsInt32x4() && !value->IsUndefined()) {
12545 bool has_exception; 12668 bool has_exception;
12546 Handle<Object> number = 12669 Handle<Object> number =
12547 Execution::ToNumber(isolate, value, &has_exception); 12670 Execution::ToNumber(isolate, value, &has_exception);
12548 if (has_exception) return Handle<Object>(); 12671 if (has_exception) return Handle<Object>();
12549 value = number; 12672 value = number;
12550 } 12673 }
12551 } 12674 }
12552 12675
12553 // Check access rights if needed. 12676 // Check access rights if needed.
12554 if (object->IsAccessCheckNeeded()) { 12677 if (object->IsAccessCheckNeeded()) {
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
12727 case EXTERNAL_UNSIGNED_INT_ELEMENTS: { 12850 case EXTERNAL_UNSIGNED_INT_ELEMENTS: {
12728 Handle<ExternalUnsignedIntArray> array( 12851 Handle<ExternalUnsignedIntArray> array(
12729 ExternalUnsignedIntArray::cast(object->elements())); 12852 ExternalUnsignedIntArray::cast(object->elements()));
12730 return ExternalUnsignedIntArray::SetValue(array, index, value); 12853 return ExternalUnsignedIntArray::SetValue(array, index, value);
12731 } 12854 }
12732 case EXTERNAL_FLOAT_ELEMENTS: { 12855 case EXTERNAL_FLOAT_ELEMENTS: {
12733 Handle<ExternalFloatArray> array( 12856 Handle<ExternalFloatArray> array(
12734 ExternalFloatArray::cast(object->elements())); 12857 ExternalFloatArray::cast(object->elements()));
12735 return ExternalFloatArray::SetValue(array, index, value); 12858 return ExternalFloatArray::SetValue(array, index, value);
12736 } 12859 }
12860 case EXTERNAL_FLOAT32x4_ELEMENTS: {
12861 Handle<ExternalFloat32x4Array> array(
12862 ExternalFloat32x4Array::cast(object->elements()));
12863 return ExternalFloat32x4Array::SetValue(array, index, value);
12864 }
12865 case EXTERNAL_INT32x4_ELEMENTS: {
12866 Handle<ExternalInt32x4Array> array(
12867 ExternalInt32x4Array::cast(object->elements()));
12868 return ExternalInt32x4Array::SetValue(array, index, value);
12869 }
12737 case EXTERNAL_DOUBLE_ELEMENTS: { 12870 case EXTERNAL_DOUBLE_ELEMENTS: {
12738 Handle<ExternalDoubleArray> array( 12871 Handle<ExternalDoubleArray> array(
12739 ExternalDoubleArray::cast(object->elements())); 12872 ExternalDoubleArray::cast(object->elements()));
12740 return ExternalDoubleArray::SetValue(array, index, value); 12873 return ExternalDoubleArray::SetValue(array, index, value);
12741 } 12874 }
12742 case DICTIONARY_ELEMENTS: 12875 case DICTIONARY_ELEMENTS:
12743 return SetDictionaryElement(object, index, value, attributes, strict_mode, 12876 return SetDictionaryElement(object, index, value, attributes, strict_mode,
12744 check_prototype, 12877 check_prototype,
12745 set_mode); 12878 set_mode);
12746 case NON_STRICT_ARGUMENTS_ELEMENTS: { 12879 case NON_STRICT_ARGUMENTS_ELEMENTS: {
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after
13119 } 13252 }
13120 break; 13253 break;
13121 } 13254 }
13122 case EXTERNAL_BYTE_ELEMENTS: 13255 case EXTERNAL_BYTE_ELEMENTS:
13123 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: 13256 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS:
13124 case EXTERNAL_SHORT_ELEMENTS: 13257 case EXTERNAL_SHORT_ELEMENTS:
13125 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS: 13258 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS:
13126 case EXTERNAL_INT_ELEMENTS: 13259 case EXTERNAL_INT_ELEMENTS:
13127 case EXTERNAL_UNSIGNED_INT_ELEMENTS: 13260 case EXTERNAL_UNSIGNED_INT_ELEMENTS:
13128 case EXTERNAL_FLOAT_ELEMENTS: 13261 case EXTERNAL_FLOAT_ELEMENTS:
13262 case EXTERNAL_FLOAT32x4_ELEMENTS:
13263 case EXTERNAL_INT32x4_ELEMENTS:
13129 case EXTERNAL_DOUBLE_ELEMENTS: 13264 case EXTERNAL_DOUBLE_ELEMENTS:
13130 case EXTERNAL_PIXEL_ELEMENTS: 13265 case EXTERNAL_PIXEL_ELEMENTS:
13131 // External arrays are considered 100% used. 13266 // External arrays are considered 100% used.
13132 ExternalArray* external_array = ExternalArray::cast(elements()); 13267 ExternalArray* external_array = ExternalArray::cast(elements());
13133 *capacity = external_array->length(); 13268 *capacity = external_array->length();
13134 *used = external_array->length(); 13269 *used = external_array->length();
13135 break; 13270 break;
13136 } 13271 }
13137 } 13272 }
13138 13273
(...skipping 494 matching lines...) Expand 10 before | Expand all | Expand 10 after
13633 ASSERT(!storage || storage->length() >= counter); 13768 ASSERT(!storage || storage->length() >= counter);
13634 break; 13769 break;
13635 } 13770 }
13636 case EXTERNAL_BYTE_ELEMENTS: 13771 case EXTERNAL_BYTE_ELEMENTS:
13637 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: 13772 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS:
13638 case EXTERNAL_SHORT_ELEMENTS: 13773 case EXTERNAL_SHORT_ELEMENTS:
13639 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS: 13774 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS:
13640 case EXTERNAL_INT_ELEMENTS: 13775 case EXTERNAL_INT_ELEMENTS:
13641 case EXTERNAL_UNSIGNED_INT_ELEMENTS: 13776 case EXTERNAL_UNSIGNED_INT_ELEMENTS:
13642 case EXTERNAL_FLOAT_ELEMENTS: 13777 case EXTERNAL_FLOAT_ELEMENTS:
13778 case EXTERNAL_FLOAT32x4_ELEMENTS:
13779 case EXTERNAL_INT32x4_ELEMENTS:
13643 case EXTERNAL_DOUBLE_ELEMENTS: { 13780 case EXTERNAL_DOUBLE_ELEMENTS: {
13644 int length = ExternalArray::cast(elements())->length(); 13781 int length = ExternalArray::cast(elements())->length();
13645 while (counter < length) { 13782 while (counter < length) {
13646 if (storage != NULL) { 13783 if (storage != NULL) {
13647 storage->set(counter, Smi::FromInt(counter)); 13784 storage->set(counter, Smi::FromInt(counter));
13648 } 13785 }
13649 counter++; 13786 counter++;
13650 } 13787 }
13651 ASSERT(!storage || storage->length() >= counter); 13788 ASSERT(!storage || storage->length() >= counter);
13652 break; 13789 break;
(...skipping 1027 matching lines...) Expand 10 before | Expand all | Expand 10 after
14680 case EXTERNAL_SHORT_ARRAY_TYPE: 14817 case EXTERNAL_SHORT_ARRAY_TYPE:
14681 return kExternalShortArray; 14818 return kExternalShortArray;
14682 case EXTERNAL_UNSIGNED_SHORT_ARRAY_TYPE: 14819 case EXTERNAL_UNSIGNED_SHORT_ARRAY_TYPE:
14683 return kExternalUnsignedShortArray; 14820 return kExternalUnsignedShortArray;
14684 case EXTERNAL_INT_ARRAY_TYPE: 14821 case EXTERNAL_INT_ARRAY_TYPE:
14685 return kExternalIntArray; 14822 return kExternalIntArray;
14686 case EXTERNAL_UNSIGNED_INT_ARRAY_TYPE: 14823 case EXTERNAL_UNSIGNED_INT_ARRAY_TYPE:
14687 return kExternalUnsignedIntArray; 14824 return kExternalUnsignedIntArray;
14688 case EXTERNAL_FLOAT_ARRAY_TYPE: 14825 case EXTERNAL_FLOAT_ARRAY_TYPE:
14689 return kExternalFloatArray; 14826 return kExternalFloatArray;
14827 case EXTERNAL_FLOAT32x4_ARRAY_TYPE:
14828 return kExternalFloat32x4Array;
14829 case EXTERNAL_INT32x4_ARRAY_TYPE:
14830 return kExternalInt32x4Array;
14690 case EXTERNAL_DOUBLE_ARRAY_TYPE: 14831 case EXTERNAL_DOUBLE_ARRAY_TYPE:
14691 return kExternalDoubleArray; 14832 return kExternalDoubleArray;
14692 case EXTERNAL_PIXEL_ARRAY_TYPE: 14833 case EXTERNAL_PIXEL_ARRAY_TYPE:
14693 return kExternalPixelArray; 14834 return kExternalPixelArray;
14694 default: 14835 default:
14695 return static_cast<ExternalArrayType>(-1); 14836 return static_cast<ExternalArrayType>(-1);
14696 } 14837 }
14697 } 14838 }
14698 14839
14699 14840
14700 size_t JSTypedArray::element_size() { 14841 size_t JSTypedArray::element_size() {
14701 switch (elements()->map()->instance_type()) { 14842 switch (elements()->map()->instance_type()) {
14702 case EXTERNAL_BYTE_ARRAY_TYPE: 14843 case EXTERNAL_BYTE_ARRAY_TYPE:
14703 return 1; 14844 return 1;
14704 case EXTERNAL_UNSIGNED_BYTE_ARRAY_TYPE: 14845 case EXTERNAL_UNSIGNED_BYTE_ARRAY_TYPE:
14705 return 1; 14846 return 1;
14706 case EXTERNAL_SHORT_ARRAY_TYPE: 14847 case EXTERNAL_SHORT_ARRAY_TYPE:
14707 return 2; 14848 return 2;
14708 case EXTERNAL_UNSIGNED_SHORT_ARRAY_TYPE: 14849 case EXTERNAL_UNSIGNED_SHORT_ARRAY_TYPE:
14709 return 2; 14850 return 2;
14710 case EXTERNAL_INT_ARRAY_TYPE: 14851 case EXTERNAL_INT_ARRAY_TYPE:
14711 return 4; 14852 return 4;
14712 case EXTERNAL_UNSIGNED_INT_ARRAY_TYPE: 14853 case EXTERNAL_UNSIGNED_INT_ARRAY_TYPE:
14713 return 4; 14854 return 4;
14714 case EXTERNAL_FLOAT_ARRAY_TYPE: 14855 case EXTERNAL_FLOAT_ARRAY_TYPE:
14715 return 4; 14856 return 4;
14857 case EXTERNAL_FLOAT32x4_ARRAY_TYPE:
14858 return 16;
14859 case EXTERNAL_INT32x4_ARRAY_TYPE:
14860 return 16;
14716 case EXTERNAL_DOUBLE_ARRAY_TYPE: 14861 case EXTERNAL_DOUBLE_ARRAY_TYPE:
14717 return 8; 14862 return 8;
14718 case EXTERNAL_PIXEL_ARRAY_TYPE: 14863 case EXTERNAL_PIXEL_ARRAY_TYPE:
14719 return 1; 14864 return 1;
14720 default: 14865 default:
14721 UNREACHABLE(); 14866 UNREACHABLE();
14722 return 0; 14867 return 0;
14723 } 14868 }
14724 } 14869 }
14725 14870
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
14947 // Clamp undefined to NaN (default). All other types have been 15092 // Clamp undefined to NaN (default). All other types have been
14948 // converted to a number type further up in the call chain. 15093 // converted to a number type further up in the call chain.
14949 ASSERT(value->IsUndefined()); 15094 ASSERT(value->IsUndefined());
14950 } 15095 }
14951 set(index, double_value); 15096 set(index, double_value);
14952 } 15097 }
14953 return heap->AllocateHeapNumber(double_value); 15098 return heap->AllocateHeapNumber(double_value);
14954 } 15099 }
14955 15100
14956 15101
15102 Handle<Object> ExternalFloat32x4Array::SetValue(
15103 Handle<ExternalFloat32x4Array> array,
15104 uint32_t index,
15105 Handle<Object> value) {
15106 CALL_HEAP_FUNCTION(array->GetIsolate(),
15107 array->SetValue(index, *value),
15108 Object);
15109 }
15110
15111
15112 MaybeObject* ExternalFloat32x4Array::SetValue(uint32_t index, Object* value) {
15113 float32x4_value_t cast_value;
15114 cast_value.storage[0] = static_cast<float>(OS::nan_value());
15115 cast_value.storage[1] = static_cast<float>(OS::nan_value());
15116 cast_value.storage[2] = static_cast<float>(OS::nan_value());
15117 cast_value.storage[3] = static_cast<float>(OS::nan_value());
15118 Heap* heap = GetHeap();
15119 if (index < static_cast<uint32_t>(length())) {
15120 if (value->IsFloat32x4()) {
15121 cast_value = Float32x4::cast(value)->value();
15122 } else {
15123 // Clamp undefined to NaN (default). All other types have been
15124 // converted to a number type further up in the call chain.
15125 ASSERT(value->IsUndefined());
15126 }
15127 set(index, cast_value);
15128 }
15129 return heap->AllocateFloat32x4(cast_value);
15130 }
15131
15132
15133 Handle<Object> ExternalInt32x4Array::SetValue(
15134 Handle<ExternalInt32x4Array> array, uint32_t index, Handle<Object> value) {
15135 CALL_HEAP_FUNCTION(array->GetIsolate(),
15136 array->SetValue(index, *value),
15137 Object);
15138 }
15139
15140
15141 MaybeObject* ExternalInt32x4Array::SetValue(uint32_t index, Object* value) {
15142 int32x4_value_t cast_value;
15143 cast_value.storage[0] = 0;
15144 cast_value.storage[1] = 0;
15145 cast_value.storage[2] = 0;
15146 cast_value.storage[3] = 0;
15147 Heap* heap = GetHeap();
15148 if (index < static_cast<uint32_t>(length())) {
15149 if (value->IsInt32x4()) {
15150 cast_value = Int32x4::cast(value)->value();
15151 } else {
15152 // Clamp undefined to zero (default). All other types have been
15153 // converted to a number type further up in the call chain.
15154 ASSERT(value->IsUndefined());
15155 }
15156 set(index, cast_value);
15157 }
15158 return heap->AllocateInt32x4(cast_value);
15159 }
15160
15161
14957 PropertyCell* GlobalObject::GetPropertyCell(LookupResult* result) { 15162 PropertyCell* GlobalObject::GetPropertyCell(LookupResult* result) {
14958 ASSERT(!HasFastProperties()); 15163 ASSERT(!HasFastProperties());
14959 Object* value = property_dictionary()->ValueAt(result->GetDictionaryEntry()); 15164 Object* value = property_dictionary()->ValueAt(result->GetDictionaryEntry());
14960 return PropertyCell::cast(value); 15165 return PropertyCell::cast(value);
14961 } 15166 }
14962 15167
14963 15168
14964 Handle<PropertyCell> JSGlobalObject::EnsurePropertyCell( 15169 Handle<PropertyCell> JSGlobalObject::EnsurePropertyCell(
14965 Handle<JSGlobalObject> global, 15170 Handle<JSGlobalObject> global,
14966 Handle<Name> name) { 15171 Handle<Name> name) {
(...skipping 1685 matching lines...) Expand 10 before | Expand all | Expand 10 after
16652 #define ERROR_MESSAGES_TEXTS(C, T) T, 16857 #define ERROR_MESSAGES_TEXTS(C, T) T,
16653 static const char* error_messages_[] = { 16858 static const char* error_messages_[] = {
16654 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) 16859 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS)
16655 }; 16860 };
16656 #undef ERROR_MESSAGES_TEXTS 16861 #undef ERROR_MESSAGES_TEXTS
16657 return error_messages_[reason]; 16862 return error_messages_[reason];
16658 } 16863 }
16659 16864
16660 16865
16661 } } // namespace v8::internal 16866 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/objects.h ('k') | src/objects-debug.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698