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

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

Issue 17153011: DataView implementation. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fixes Created 7 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 | 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 677 matching lines...) Expand 10 before | Expand all | Expand 10 after
688 688
689 bool Object::IsBoolean() { 689 bool Object::IsBoolean() {
690 return IsOddball() && 690 return IsOddball() &&
691 ((Oddball::cast(this)->kind() & Oddball::kNotBooleanMask) == 0); 691 ((Oddball::cast(this)->kind() & Oddball::kNotBooleanMask) == 0);
692 } 692 }
693 693
694 694
695 TYPE_CHECKER(JSArray, JS_ARRAY_TYPE) 695 TYPE_CHECKER(JSArray, JS_ARRAY_TYPE)
696 TYPE_CHECKER(JSArrayBuffer, JS_ARRAY_BUFFER_TYPE) 696 TYPE_CHECKER(JSArrayBuffer, JS_ARRAY_BUFFER_TYPE)
697 TYPE_CHECKER(JSTypedArray, JS_TYPED_ARRAY_TYPE) 697 TYPE_CHECKER(JSTypedArray, JS_TYPED_ARRAY_TYPE)
698 TYPE_CHECKER(JSDataView, JS_DATA_VIEW_TYPE)
699
700
701 bool Object::IsJSArrayBufferView() {
702 return IsJSDataView() || IsJSTypedArray();
703 }
704
705
698 TYPE_CHECKER(JSRegExp, JS_REGEXP_TYPE) 706 TYPE_CHECKER(JSRegExp, JS_REGEXP_TYPE)
699 707
700 708
701 template <> inline bool Is<JSArray>(Object* obj) { 709 template <> inline bool Is<JSArray>(Object* obj) {
702 return obj->IsJSArray(); 710 return obj->IsJSArray();
703 } 711 }
704 712
705 713
706 bool Object::IsHashTable() { 714 bool Object::IsHashTable() {
707 return Object::IsHeapObject() && 715 return Object::IsHeapObject() &&
(...skipping 958 matching lines...) Expand 10 before | Expand all | Expand 10 after
1666 case JS_VALUE_TYPE: 1674 case JS_VALUE_TYPE:
1667 return JSValue::kSize; 1675 return JSValue::kSize;
1668 case JS_DATE_TYPE: 1676 case JS_DATE_TYPE:
1669 return JSDate::kSize; 1677 return JSDate::kSize;
1670 case JS_ARRAY_TYPE: 1678 case JS_ARRAY_TYPE:
1671 return JSArray::kSize; 1679 return JSArray::kSize;
1672 case JS_ARRAY_BUFFER_TYPE: 1680 case JS_ARRAY_BUFFER_TYPE:
1673 return JSArrayBuffer::kSize; 1681 return JSArrayBuffer::kSize;
1674 case JS_TYPED_ARRAY_TYPE: 1682 case JS_TYPED_ARRAY_TYPE:
1675 return JSTypedArray::kSize; 1683 return JSTypedArray::kSize;
1684 case JS_DATA_VIEW_TYPE:
1685 return JSDataView::kSize;
1676 case JS_SET_TYPE: 1686 case JS_SET_TYPE:
1677 return JSSet::kSize; 1687 return JSSet::kSize;
1678 case JS_MAP_TYPE: 1688 case JS_MAP_TYPE:
1679 return JSMap::kSize; 1689 return JSMap::kSize;
1680 case JS_WEAK_MAP_TYPE: 1690 case JS_WEAK_MAP_TYPE:
1681 return JSWeakMap::kSize; 1691 return JSWeakMap::kSize;
1682 case JS_REGEXP_TYPE: 1692 case JS_REGEXP_TYPE:
1683 return JSRegExp::kSize; 1693 return JSRegExp::kSize;
1684 case JS_CONTEXT_EXTENSION_OBJECT_TYPE: 1694 case JS_CONTEXT_EXTENSION_OBJECT_TYPE:
1685 return JSObject::kHeaderSize; 1695 return JSObject::kHeaderSize;
(...skipping 858 matching lines...) Expand 10 before | Expand all | Expand 10 after
2544 CAST_ACCESSOR(SharedFunctionInfo) 2554 CAST_ACCESSOR(SharedFunctionInfo)
2545 CAST_ACCESSOR(Map) 2555 CAST_ACCESSOR(Map)
2546 CAST_ACCESSOR(JSFunction) 2556 CAST_ACCESSOR(JSFunction)
2547 CAST_ACCESSOR(GlobalObject) 2557 CAST_ACCESSOR(GlobalObject)
2548 CAST_ACCESSOR(JSGlobalProxy) 2558 CAST_ACCESSOR(JSGlobalProxy)
2549 CAST_ACCESSOR(JSGlobalObject) 2559 CAST_ACCESSOR(JSGlobalObject)
2550 CAST_ACCESSOR(JSBuiltinsObject) 2560 CAST_ACCESSOR(JSBuiltinsObject)
2551 CAST_ACCESSOR(Code) 2561 CAST_ACCESSOR(Code)
2552 CAST_ACCESSOR(JSArray) 2562 CAST_ACCESSOR(JSArray)
2553 CAST_ACCESSOR(JSArrayBuffer) 2563 CAST_ACCESSOR(JSArrayBuffer)
2564 CAST_ACCESSOR(JSArrayBufferView)
2554 CAST_ACCESSOR(JSTypedArray) 2565 CAST_ACCESSOR(JSTypedArray)
2566 CAST_ACCESSOR(JSDataView)
2555 CAST_ACCESSOR(JSRegExp) 2567 CAST_ACCESSOR(JSRegExp)
2556 CAST_ACCESSOR(JSProxy) 2568 CAST_ACCESSOR(JSProxy)
2557 CAST_ACCESSOR(JSFunctionProxy) 2569 CAST_ACCESSOR(JSFunctionProxy)
2558 CAST_ACCESSOR(JSSet) 2570 CAST_ACCESSOR(JSSet)
2559 CAST_ACCESSOR(JSMap) 2571 CAST_ACCESSOR(JSMap)
2560 CAST_ACCESSOR(JSWeakMap) 2572 CAST_ACCESSOR(JSWeakMap)
2561 CAST_ACCESSOR(Foreign) 2573 CAST_ACCESSOR(Foreign)
2562 CAST_ACCESSOR(ByteArray) 2574 CAST_ACCESSOR(ByteArray)
2563 CAST_ACCESSOR(FreeSpace) 2575 CAST_ACCESSOR(FreeSpace)
2564 CAST_ACCESSOR(ExternalArray) 2576 CAST_ACCESSOR(ExternalArray)
(...skipping 2726 matching lines...) Expand 10 before | Expand all | Expand 10 after
5291 return BooleanBit::get(flag(), kIsExternalBit); 5303 return BooleanBit::get(flag(), kIsExternalBit);
5292 } 5304 }
5293 5305
5294 5306
5295 void JSArrayBuffer::set_is_external(bool value) { 5307 void JSArrayBuffer::set_is_external(bool value) {
5296 set_flag(BooleanBit::set(flag(), kIsExternalBit, value)); 5308 set_flag(BooleanBit::set(flag(), kIsExternalBit, value));
5297 } 5309 }
5298 5310
5299 5311
5300 ACCESSORS(JSArrayBuffer, weak_next, Object, kWeakNextOffset) 5312 ACCESSORS(JSArrayBuffer, weak_next, Object, kWeakNextOffset)
5301 ACCESSORS(JSArrayBuffer, weak_first_array, Object, kWeakFirstArrayOffset) 5313 ACCESSORS(JSArrayBuffer, weak_first_view, Object, kWeakFirstViewOffset)
5302 5314
5303 5315
5304 ACCESSORS(JSTypedArray, buffer, Object, kBufferOffset) 5316 ACCESSORS(JSArrayBufferView, buffer, Object, kBufferOffset)
5305 ACCESSORS(JSTypedArray, byte_offset, Object, kByteOffsetOffset) 5317 ACCESSORS(JSArrayBufferView, byte_offset, Object, kByteOffsetOffset)
5306 ACCESSORS(JSTypedArray, byte_length, Object, kByteLengthOffset) 5318 ACCESSORS(JSArrayBufferView, byte_length, Object, kByteLengthOffset)
5319 ACCESSORS(JSArrayBufferView, weak_next, Object, kWeakNextOffset)
5307 ACCESSORS(JSTypedArray, length, Object, kLengthOffset) 5320 ACCESSORS(JSTypedArray, length, Object, kLengthOffset)
5308 ACCESSORS(JSTypedArray, weak_next, Object, kWeakNextOffset)
5309 5321
5310 ACCESSORS(JSRegExp, data, Object, kDataOffset) 5322 ACCESSORS(JSRegExp, data, Object, kDataOffset)
5311 5323
5312 5324
5313 JSRegExp::Type JSRegExp::TypeTag() { 5325 JSRegExp::Type JSRegExp::TypeTag() {
5314 Object* data = this->data(); 5326 Object* data = this->data();
5315 if (data->IsUndefined()) return JSRegExp::NOT_COMPILED; 5327 if (data->IsUndefined()) return JSRegExp::NOT_COMPILED;
5316 Smi* smi = Smi::cast(FixedArray::cast(data)->get(kTagIndex)); 5328 Smi* smi = Smi::cast(FixedArray::cast(data)->get(kTagIndex));
5317 return static_cast<JSRegExp::Type>(smi->value()); 5329 return static_cast<JSRegExp::Type>(smi->value());
5318 } 5330 }
(...skipping 854 matching lines...) Expand 10 before | Expand all | Expand 10 after
6173 #undef WRITE_UINT32_FIELD 6185 #undef WRITE_UINT32_FIELD
6174 #undef READ_SHORT_FIELD 6186 #undef READ_SHORT_FIELD
6175 #undef WRITE_SHORT_FIELD 6187 #undef WRITE_SHORT_FIELD
6176 #undef READ_BYTE_FIELD 6188 #undef READ_BYTE_FIELD
6177 #undef WRITE_BYTE_FIELD 6189 #undef WRITE_BYTE_FIELD
6178 6190
6179 6191
6180 } } // namespace v8::internal 6192 } } // namespace v8::internal
6181 6193
6182 #endif // V8_OBJECTS_INL_H_ 6194 #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