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

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

Issue 13975012: First cut at impementing ES6 TypedArrays in V8. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: CR feedback Created 7 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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 657 matching lines...) Expand 10 before | Expand all | Expand 10 after
668 668
669 669
670 bool Object::IsBoolean() { 670 bool Object::IsBoolean() {
671 return IsOddball() && 671 return IsOddball() &&
672 ((Oddball::cast(this)->kind() & Oddball::kNotBooleanMask) == 0); 672 ((Oddball::cast(this)->kind() & Oddball::kNotBooleanMask) == 0);
673 } 673 }
674 674
675 675
676 TYPE_CHECKER(JSArray, JS_ARRAY_TYPE) 676 TYPE_CHECKER(JSArray, JS_ARRAY_TYPE)
677 TYPE_CHECKER(JSArrayBuffer, JS_ARRAY_BUFFER_TYPE) 677 TYPE_CHECKER(JSArrayBuffer, JS_ARRAY_BUFFER_TYPE)
678 TYPE_CHECKER(JSTypedArray, JS_TYPED_ARRAY_TYPE)
678 TYPE_CHECKER(JSRegExp, JS_REGEXP_TYPE) 679 TYPE_CHECKER(JSRegExp, JS_REGEXP_TYPE)
679 680
680 681
681 template <> inline bool Is<JSArray>(Object* obj) { 682 template <> inline bool Is<JSArray>(Object* obj) {
682 return obj->IsJSArray(); 683 return obj->IsJSArray();
683 } 684 }
684 685
685 686
686 bool Object::IsHashTable() { 687 bool Object::IsHashTable() {
687 return Object::IsHeapObject() && 688 return Object::IsHeapObject() &&
(...skipping 907 matching lines...) Expand 10 before | Expand all | Expand 10 after
1595 case JS_FUNCTION_TYPE: 1596 case JS_FUNCTION_TYPE:
1596 return JSFunction::kSize; 1597 return JSFunction::kSize;
1597 case JS_VALUE_TYPE: 1598 case JS_VALUE_TYPE:
1598 return JSValue::kSize; 1599 return JSValue::kSize;
1599 case JS_DATE_TYPE: 1600 case JS_DATE_TYPE:
1600 return JSDate::kSize; 1601 return JSDate::kSize;
1601 case JS_ARRAY_TYPE: 1602 case JS_ARRAY_TYPE:
1602 return JSArray::kSize; 1603 return JSArray::kSize;
1603 case JS_ARRAY_BUFFER_TYPE: 1604 case JS_ARRAY_BUFFER_TYPE:
1604 return JSArrayBuffer::kSize; 1605 return JSArrayBuffer::kSize;
1606 case JS_TYPED_ARRAY_TYPE:
1607 return JSTypedArray::kSize;
1605 case JS_SET_TYPE: 1608 case JS_SET_TYPE:
1606 return JSSet::kSize; 1609 return JSSet::kSize;
1607 case JS_MAP_TYPE: 1610 case JS_MAP_TYPE:
1608 return JSMap::kSize; 1611 return JSMap::kSize;
1609 case JS_WEAK_MAP_TYPE: 1612 case JS_WEAK_MAP_TYPE:
1610 return JSWeakMap::kSize; 1613 return JSWeakMap::kSize;
1611 case JS_REGEXP_TYPE: 1614 case JS_REGEXP_TYPE:
1612 return JSRegExp::kSize; 1615 return JSRegExp::kSize;
1613 case JS_CONTEXT_EXTENSION_OBJECT_TYPE: 1616 case JS_CONTEXT_EXTENSION_OBJECT_TYPE:
1614 return JSObject::kHeaderSize; 1617 return JSObject::kHeaderSize;
(...skipping 867 matching lines...) Expand 10 before | Expand all | Expand 10 after
2482 CAST_ACCESSOR(SharedFunctionInfo) 2485 CAST_ACCESSOR(SharedFunctionInfo)
2483 CAST_ACCESSOR(Map) 2486 CAST_ACCESSOR(Map)
2484 CAST_ACCESSOR(JSFunction) 2487 CAST_ACCESSOR(JSFunction)
2485 CAST_ACCESSOR(GlobalObject) 2488 CAST_ACCESSOR(GlobalObject)
2486 CAST_ACCESSOR(JSGlobalProxy) 2489 CAST_ACCESSOR(JSGlobalProxy)
2487 CAST_ACCESSOR(JSGlobalObject) 2490 CAST_ACCESSOR(JSGlobalObject)
2488 CAST_ACCESSOR(JSBuiltinsObject) 2491 CAST_ACCESSOR(JSBuiltinsObject)
2489 CAST_ACCESSOR(Code) 2492 CAST_ACCESSOR(Code)
2490 CAST_ACCESSOR(JSArray) 2493 CAST_ACCESSOR(JSArray)
2491 CAST_ACCESSOR(JSArrayBuffer) 2494 CAST_ACCESSOR(JSArrayBuffer)
2495 CAST_ACCESSOR(JSTypedArray)
2492 CAST_ACCESSOR(JSRegExp) 2496 CAST_ACCESSOR(JSRegExp)
2493 CAST_ACCESSOR(JSProxy) 2497 CAST_ACCESSOR(JSProxy)
2494 CAST_ACCESSOR(JSFunctionProxy) 2498 CAST_ACCESSOR(JSFunctionProxy)
2495 CAST_ACCESSOR(JSSet) 2499 CAST_ACCESSOR(JSSet)
2496 CAST_ACCESSOR(JSMap) 2500 CAST_ACCESSOR(JSMap)
2497 CAST_ACCESSOR(JSWeakMap) 2501 CAST_ACCESSOR(JSWeakMap)
2498 CAST_ACCESSOR(Foreign) 2502 CAST_ACCESSOR(Foreign)
2499 CAST_ACCESSOR(ByteArray) 2503 CAST_ACCESSOR(ByteArray)
2500 CAST_ACCESSOR(FreeSpace) 2504 CAST_ACCESSOR(FreeSpace)
2501 CAST_ACCESSOR(ExternalArray) 2505 CAST_ACCESSOR(ExternalArray)
(...skipping 2682 matching lines...) Expand 10 before | Expand all | Expand 10 after
5184 5188
5185 void JSArrayBuffer::set_backing_store(void* value, WriteBarrierMode mode) { 5189 void JSArrayBuffer::set_backing_store(void* value, WriteBarrierMode mode) {
5186 intptr_t ptr = reinterpret_cast<intptr_t>(value); 5190 intptr_t ptr = reinterpret_cast<intptr_t>(value);
5187 WRITE_INTPTR_FIELD(this, kBackingStoreOffset, ptr); 5191 WRITE_INTPTR_FIELD(this, kBackingStoreOffset, ptr);
5188 } 5192 }
5189 5193
5190 5194
5191 ACCESSORS(JSArrayBuffer, byte_length, Object, kByteLengthOffset) 5195 ACCESSORS(JSArrayBuffer, byte_length, Object, kByteLengthOffset)
5192 5196
5193 5197
5198 ACCESSORS(JSTypedArray, buffer, Object, kBufferOffset)
5199 ACCESSORS(JSTypedArray, byte_offset, Object, kByteOffsetOffset)
5200 ACCESSORS(JSTypedArray, byte_length, Object, kByteLengthOffset)
5201 ACCESSORS(JSTypedArray, length, Object, kLengthOffset)
5202
5203
5194 ACCESSORS(JSRegExp, data, Object, kDataOffset) 5204 ACCESSORS(JSRegExp, data, Object, kDataOffset)
5195 5205
5196 5206
5197 JSRegExp::Type JSRegExp::TypeTag() { 5207 JSRegExp::Type JSRegExp::TypeTag() {
5198 Object* data = this->data(); 5208 Object* data = this->data();
5199 if (data->IsUndefined()) return JSRegExp::NOT_COMPILED; 5209 if (data->IsUndefined()) return JSRegExp::NOT_COMPILED;
5200 Smi* smi = Smi::cast(FixedArray::cast(data)->get(kTagIndex)); 5210 Smi* smi = Smi::cast(FixedArray::cast(data)->get(kTagIndex));
5201 return static_cast<JSRegExp::Type>(smi->value()); 5211 return static_cast<JSRegExp::Type>(smi->value());
5202 } 5212 }
5203 5213
(...skipping 878 matching lines...) Expand 10 before | Expand all | Expand 10 after
6082 #undef WRITE_UINT32_FIELD 6092 #undef WRITE_UINT32_FIELD
6083 #undef READ_SHORT_FIELD 6093 #undef READ_SHORT_FIELD
6084 #undef WRITE_SHORT_FIELD 6094 #undef WRITE_SHORT_FIELD
6085 #undef READ_BYTE_FIELD 6095 #undef READ_BYTE_FIELD
6086 #undef WRITE_BYTE_FIELD 6096 #undef WRITE_BYTE_FIELD
6087 6097
6088 6098
6089 } } // namespace v8::internal 6099 } } // namespace v8::internal
6090 6100
6091 #endif // V8_OBJECTS_INL_H_ 6101 #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