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

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

Issue 13064003: First steps towards implementing ArrayBuffer &co in V8 (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Added forgotten tests 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 656 matching lines...) Expand 10 before | Expand all | Expand 10 after
667 TYPE_CHECKER(Foreign, FOREIGN_TYPE) 667 TYPE_CHECKER(Foreign, FOREIGN_TYPE)
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(JSRegExp, JS_REGEXP_TYPE) 678 TYPE_CHECKER(JSRegExp, JS_REGEXP_TYPE)
678 679
679 680
680 template <> inline bool Is<JSArray>(Object* obj) { 681 template <> inline bool Is<JSArray>(Object* obj) {
681 return obj->IsJSArray(); 682 return obj->IsJSArray();
682 } 683 }
683 684
684 685
685 bool Object::IsHashTable() { 686 bool Object::IsHashTable() {
686 return Object::IsHeapObject() && 687 return Object::IsHeapObject() &&
(...skipping 868 matching lines...) Expand 10 before | Expand all | Expand 10 after
1555 case JS_BUILTINS_OBJECT_TYPE: 1556 case JS_BUILTINS_OBJECT_TYPE:
1556 return JSBuiltinsObject::kSize; 1557 return JSBuiltinsObject::kSize;
1557 case JS_FUNCTION_TYPE: 1558 case JS_FUNCTION_TYPE:
1558 return JSFunction::kSize; 1559 return JSFunction::kSize;
1559 case JS_VALUE_TYPE: 1560 case JS_VALUE_TYPE:
1560 return JSValue::kSize; 1561 return JSValue::kSize;
1561 case JS_DATE_TYPE: 1562 case JS_DATE_TYPE:
1562 return JSDate::kSize; 1563 return JSDate::kSize;
1563 case JS_ARRAY_TYPE: 1564 case JS_ARRAY_TYPE:
1564 return JSArray::kSize; 1565 return JSArray::kSize;
1566 case JS_ARRAY_BUFFER_TYPE:
1567 return JSArrayBuffer::kSize;
1565 case JS_SET_TYPE: 1568 case JS_SET_TYPE:
1566 return JSSet::kSize; 1569 return JSSet::kSize;
1567 case JS_MAP_TYPE: 1570 case JS_MAP_TYPE:
1568 return JSMap::kSize; 1571 return JSMap::kSize;
1569 case JS_WEAK_MAP_TYPE: 1572 case JS_WEAK_MAP_TYPE:
1570 return JSWeakMap::kSize; 1573 return JSWeakMap::kSize;
1571 case JS_REGEXP_TYPE: 1574 case JS_REGEXP_TYPE:
1572 return JSRegExp::kSize; 1575 return JSRegExp::kSize;
1573 case JS_CONTEXT_EXTENSION_OBJECT_TYPE: 1576 case JS_CONTEXT_EXTENSION_OBJECT_TYPE:
1574 return JSObject::kHeaderSize; 1577 return JSObject::kHeaderSize;
(...skipping 866 matching lines...) Expand 10 before | Expand all | Expand 10 after
2441 CAST_ACCESSOR(JSGlobalPropertyCell) 2444 CAST_ACCESSOR(JSGlobalPropertyCell)
2442 CAST_ACCESSOR(SharedFunctionInfo) 2445 CAST_ACCESSOR(SharedFunctionInfo)
2443 CAST_ACCESSOR(Map) 2446 CAST_ACCESSOR(Map)
2444 CAST_ACCESSOR(JSFunction) 2447 CAST_ACCESSOR(JSFunction)
2445 CAST_ACCESSOR(GlobalObject) 2448 CAST_ACCESSOR(GlobalObject)
2446 CAST_ACCESSOR(JSGlobalProxy) 2449 CAST_ACCESSOR(JSGlobalProxy)
2447 CAST_ACCESSOR(JSGlobalObject) 2450 CAST_ACCESSOR(JSGlobalObject)
2448 CAST_ACCESSOR(JSBuiltinsObject) 2451 CAST_ACCESSOR(JSBuiltinsObject)
2449 CAST_ACCESSOR(Code) 2452 CAST_ACCESSOR(Code)
2450 CAST_ACCESSOR(JSArray) 2453 CAST_ACCESSOR(JSArray)
2454 CAST_ACCESSOR(JSArrayBuffer)
2451 CAST_ACCESSOR(JSRegExp) 2455 CAST_ACCESSOR(JSRegExp)
2452 CAST_ACCESSOR(JSProxy) 2456 CAST_ACCESSOR(JSProxy)
2453 CAST_ACCESSOR(JSFunctionProxy) 2457 CAST_ACCESSOR(JSFunctionProxy)
2454 CAST_ACCESSOR(JSSet) 2458 CAST_ACCESSOR(JSSet)
2455 CAST_ACCESSOR(JSMap) 2459 CAST_ACCESSOR(JSMap)
2456 CAST_ACCESSOR(JSWeakMap) 2460 CAST_ACCESSOR(JSWeakMap)
2457 CAST_ACCESSOR(Foreign) 2461 CAST_ACCESSOR(Foreign)
2458 CAST_ACCESSOR(ByteArray) 2462 CAST_ACCESSOR(ByteArray)
2459 CAST_ACCESSOR(FreeSpace) 2463 CAST_ACCESSOR(FreeSpace)
2460 CAST_ACCESSOR(ExternalArray) 2464 CAST_ACCESSOR(ExternalArray)
(...skipping 2663 matching lines...) Expand 10 before | Expand all | Expand 10 after
5124 5128
5125 5129
5126 bool Code::contains(byte* inner_pointer) { 5130 bool Code::contains(byte* inner_pointer) {
5127 return (address() <= inner_pointer) && (inner_pointer <= address() + Size()); 5131 return (address() <= inner_pointer) && (inner_pointer <= address() + Size());
5128 } 5132 }
5129 5133
5130 5134
5131 ACCESSORS(JSArray, length, Object, kLengthOffset) 5135 ACCESSORS(JSArray, length, Object, kLengthOffset)
5132 5136
5133 5137
5138 void* JSArrayBuffer::backing_store() {
5139 intptr_t ptr = READ_INTPTR_FIELD(this, kBackingStoreOffset);
5140 return reinterpret_cast<void*>(ptr);
5141 }
5142
5143
5144 void JSArrayBuffer::set_backing_store(void* value, WriteBarrierMode mode) {
5145 intptr_t ptr = reinterpret_cast<intptr_t>(value);
5146 WRITE_INTPTR_FIELD(this, kBackingStoreOffset, ptr);
5147 }
5148
5149
5150 ACCESSORS(JSArrayBuffer, byte_length, Object, kByteLengthOffset)
5151
5152
5134 ACCESSORS(JSRegExp, data, Object, kDataOffset) 5153 ACCESSORS(JSRegExp, data, Object, kDataOffset)
5135 5154
5136 5155
5137 JSRegExp::Type JSRegExp::TypeTag() { 5156 JSRegExp::Type JSRegExp::TypeTag() {
5138 Object* data = this->data(); 5157 Object* data = this->data();
5139 if (data->IsUndefined()) return JSRegExp::NOT_COMPILED; 5158 if (data->IsUndefined()) return JSRegExp::NOT_COMPILED;
5140 Smi* smi = Smi::cast(FixedArray::cast(data)->get(kTagIndex)); 5159 Smi* smi = Smi::cast(FixedArray::cast(data)->get(kTagIndex));
5141 return static_cast<JSRegExp::Type>(smi->value()); 5160 return static_cast<JSRegExp::Type>(smi->value());
5142 } 5161 }
5143 5162
(...skipping 878 matching lines...) Expand 10 before | Expand all | Expand 10 after
6022 #undef WRITE_UINT32_FIELD 6041 #undef WRITE_UINT32_FIELD
6023 #undef READ_SHORT_FIELD 6042 #undef READ_SHORT_FIELD
6024 #undef WRITE_SHORT_FIELD 6043 #undef WRITE_SHORT_FIELD
6025 #undef READ_BYTE_FIELD 6044 #undef READ_BYTE_FIELD
6026 #undef WRITE_BYTE_FIELD 6045 #undef WRITE_BYTE_FIELD
6027 6046
6028 6047
6029 } } // namespace v8::internal 6048 } } // namespace v8::internal
6030 6049
6031 #endif // V8_OBJECTS_INL_H_ 6050 #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