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

Side by Side Diff: include/v8.h

Issue 13958007: First cut at API for ES6 ArrayBuffers (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 | « no previous file | src/api.h » ('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 1953 matching lines...) Expand 10 before | Expand all | Expand 10 after
1964 V8_INLINE(static Function* Cast(Value* obj)); 1964 V8_INLINE(static Function* Cast(Value* obj));
1965 static const int kLineOffsetNotFound; 1965 static const int kLineOffsetNotFound;
1966 1966
1967 private: 1967 private:
1968 Function(); 1968 Function();
1969 static void CheckCast(Value* obj); 1969 static void CheckCast(Value* obj);
1970 }; 1970 };
1971 1971
1972 1972
1973 /** 1973 /**
1974 * An instance of the built-in ArrayBuffer constructor (ES6 draft 15.13.5).
1975 * This API is experimental and may change significantly.
1976 */
1977 class V8EXPORT ArrayBuffer : public Object {
1978 public:
1979 /**
1980 * Data length in bytes.
1981 */
1982 size_t ByteLength() const;
1983 /**
1984 * Raw pointer to the array buffer data
1985 */
1986 void* Data() const;
1987
1988 /**
1989 * Create a new ArrayBuffer. Allocate |byte_length| bytes.
1990 * Allocated memory will be owned by a created ArrayBuffer and
1991 * will be deallocated when it is garbage-collected.
1992 */
1993 static Local<ArrayBuffer> New(size_t byte_length);
1994
1995 /**
1996 * Create a new ArrayBuffer over an existing memory block.
1997 * The memory block will not be reclaimed when a created ArrayBuffer
1998 * is garbage-collected.
1999 */
2000 static Local<ArrayBuffer> New(void* data, size_t byte_length);
2001
2002 V8_INLINE(static ArrayBuffer* Cast(Value* obj));
2003
2004 private:
2005 ArrayBuffer();
2006 static void CheckCast(Value* obj);
2007 };
2008
2009
2010 /**
1974 * An instance of the built-in Date constructor (ECMA-262, 15.9). 2011 * An instance of the built-in Date constructor (ECMA-262, 15.9).
1975 */ 2012 */
1976 class V8EXPORT Date : public Object { 2013 class V8EXPORT Date : public Object {
1977 public: 2014 public:
1978 static Local<Value> New(double time); 2015 static Local<Value> New(double time);
1979 2016
1980 /** 2017 /**
1981 * A specialization of Value::NumberValue that is more efficient 2018 * A specialization of Value::NumberValue that is more efficient
1982 * because we know the structure of this object. 2019 * because we know the structure of this object.
1983 */ 2020 */
(...skipping 2438 matching lines...) Expand 10 before | Expand all | Expand 10 after
4422 // the implementation of v8. 4459 // the implementation of v8.
4423 static const int kHeapObjectMapOffset = 0; 4460 static const int kHeapObjectMapOffset = 0;
4424 static const int kMapInstanceTypeOffset = 1 * kApiPointerSize + kApiIntSize; 4461 static const int kMapInstanceTypeOffset = 1 * kApiPointerSize + kApiIntSize;
4425 static const int kStringResourceOffset = 3 * kApiPointerSize; 4462 static const int kStringResourceOffset = 3 * kApiPointerSize;
4426 4463
4427 static const int kOddballKindOffset = 3 * kApiPointerSize; 4464 static const int kOddballKindOffset = 3 * kApiPointerSize;
4428 static const int kForeignAddressOffset = kApiPointerSize; 4465 static const int kForeignAddressOffset = kApiPointerSize;
4429 static const int kJSObjectHeaderSize = 3 * kApiPointerSize; 4466 static const int kJSObjectHeaderSize = 3 * kApiPointerSize;
4430 static const int kFixedArrayHeaderSize = 2 * kApiPointerSize; 4467 static const int kFixedArrayHeaderSize = 2 * kApiPointerSize;
4431 static const int kContextHeaderSize = 2 * kApiPointerSize; 4468 static const int kContextHeaderSize = 2 * kApiPointerSize;
4432 static const int kContextEmbedderDataIndex = 55; 4469 static const int kContextEmbedderDataIndex = 56;
4433 static const int kFullStringRepresentationMask = 0x07; 4470 static const int kFullStringRepresentationMask = 0x07;
4434 static const int kStringEncodingMask = 0x4; 4471 static const int kStringEncodingMask = 0x4;
4435 static const int kExternalTwoByteRepresentationTag = 0x02; 4472 static const int kExternalTwoByteRepresentationTag = 0x02;
4436 static const int kExternalAsciiRepresentationTag = 0x06; 4473 static const int kExternalAsciiRepresentationTag = 0x06;
4437 4474
4438 static const int kIsolateStateOffset = 0; 4475 static const int kIsolateStateOffset = 0;
4439 static const int kIsolateEmbedderDataOffset = 1 * kApiPointerSize; 4476 static const int kIsolateEmbedderDataOffset = 1 * kApiPointerSize;
4440 static const int kIsolateRootsOffset = 3 * kApiPointerSize; 4477 static const int kIsolateRootsOffset = 3 * kApiPointerSize;
4441 static const int kUndefinedValueRootIndex = 5; 4478 static const int kUndefinedValueRootIndex = 5;
4442 static const int kNullValueRootIndex = 7; 4479 static const int kNullValueRootIndex = 7;
(...skipping 652 matching lines...) Expand 10 before | Expand all | Expand 10 after
5095 5132
5096 5133
5097 Array* Array::Cast(v8::Value* value) { 5134 Array* Array::Cast(v8::Value* value) {
5098 #ifdef V8_ENABLE_CHECKS 5135 #ifdef V8_ENABLE_CHECKS
5099 CheckCast(value); 5136 CheckCast(value);
5100 #endif 5137 #endif
5101 return static_cast<Array*>(value); 5138 return static_cast<Array*>(value);
5102 } 5139 }
5103 5140
5104 5141
5142 ArrayBuffer* ArrayBuffer::Cast(v8::Value* value) {
5143 #ifdef V8_ENABLE_CHECKS
5144 CheckCast(value);
5145 #endif
5146 return static_cast<ArrayBuffer*>(value);
5147 }
5148
5149
5105 Function* Function::Cast(v8::Value* value) { 5150 Function* Function::Cast(v8::Value* value) {
5106 #ifdef V8_ENABLE_CHECKS 5151 #ifdef V8_ENABLE_CHECKS
5107 CheckCast(value); 5152 CheckCast(value);
5108 #endif 5153 #endif
5109 return static_cast<Function*>(value); 5154 return static_cast<Function*>(value);
5110 } 5155 }
5111 5156
5112 5157
5113 External* External::Cast(v8::Value* value) { 5158 External* External::Cast(v8::Value* value) {
5114 #ifdef V8_ENABLE_CHECKS 5159 #ifdef V8_ENABLE_CHECKS
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
5221 5266
5222 5267
5223 } // namespace v8 5268 } // namespace v8
5224 5269
5225 5270
5226 #undef V8EXPORT 5271 #undef V8EXPORT
5227 #undef TYPE_CHECK 5272 #undef TYPE_CHECK
5228 5273
5229 5274
5230 #endif // V8_H_ 5275 #endif // V8_H_
OLDNEW
« no previous file with comments | « no previous file | src/api.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698