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

Side by Side Diff: include/v8.h

Issue 39973003: Merge bleeding_edge. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/parser
Patch Set: again Created 7 years, 1 month 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 | « build/toolchain.gypi ('k') | include/v8-profiler.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 694 matching lines...) Expand 10 before | Expand all | Expand 10 after
705 // TODO(dcarney): remove 705 // TODO(dcarney): remove
706 #ifndef V8_ALLOW_ACCESS_TO_RAW_HANDLE_CONSTRUCTOR 706 #ifndef V8_ALLOW_ACCESS_TO_RAW_HANDLE_CONSTRUCTOR
707 707
708 private: 708 private:
709 #endif 709 #endif
710 template <class S> V8_INLINE Persistent(S* that) : val_(that) { } 710 template <class S> V8_INLINE Persistent(S* that) : val_(that) { }
711 711
712 V8_INLINE T* operator*() const { return val_; } 712 V8_INLINE T* operator*() const { return val_; }
713 713
714 private: 714 private:
715 friend class Isolate;
715 friend class Utils; 716 friend class Utils;
716 template<class F> friend class Handle; 717 template<class F> friend class Handle;
717 template<class F> friend class Local; 718 template<class F> friend class Local;
718 template<class F1, class F2> friend class Persistent; 719 template<class F1, class F2> friend class Persistent;
719 template<class F> friend class ReturnValue; 720 template<class F> friend class ReturnValue;
720 721
721 V8_INLINE static T* New(Isolate* isolate, T* that); 722 V8_INLINE static T* New(Isolate* isolate, T* that);
722 template<class S, class M2> 723 template<class S, class M2>
723 V8_INLINE void Copy(const Persistent<S, M2>& that); 724 V8_INLINE void Copy(const Persistent<S, M2>& that);
724 725
(...skipping 1746 matching lines...) Expand 10 before | Expand all | Expand 10 after
2471 2472
2472 /** 2473 /**
2473 * Name inferred from variable or property assignment of this function. 2474 * Name inferred from variable or property assignment of this function.
2474 * Used to facilitate debugging and profiling of JavaScript code written 2475 * Used to facilitate debugging and profiling of JavaScript code written
2475 * in an OO style, where many functions are anonymous but are assigned 2476 * in an OO style, where many functions are anonymous but are assigned
2476 * to object properties. 2477 * to object properties.
2477 */ 2478 */
2478 Handle<Value> GetInferredName() const; 2479 Handle<Value> GetInferredName() const;
2479 2480
2480 /** 2481 /**
2482 * User-defined name assigned to the "displayName" property of this function.
2483 * Used to facilitate debugging and profiling of JavaScript code.
2484 */
2485 Handle<Value> GetDisplayName() const;
2486
2487 /**
2481 * Returns zero based line number of function body and 2488 * Returns zero based line number of function body and
2482 * kLineOffsetNotFound if no information available. 2489 * kLineOffsetNotFound if no information available.
2483 */ 2490 */
2484 int GetScriptLineNumber() const; 2491 int GetScriptLineNumber() const;
2485 /** 2492 /**
2486 * Returns zero based column number of function body and 2493 * Returns zero based column number of function body and
2487 * kLineOffsetNotFound if no information available. 2494 * kLineOffsetNotFound if no information available.
2488 */ 2495 */
2489 int GetScriptColumnNumber() const; 2496 int GetScriptColumnNumber() const;
2490 2497
2491 /** 2498 /**
2499 * Tells whether this function is builtin.
2500 */
2501 bool IsBuiltin() const;
2502
2503 /**
2492 * Returns scriptId object. 2504 * Returns scriptId object.
2493 */ 2505 */
2494 V8_DEPRECATED("Use ScriptId instead", Handle<Value> GetScriptId()) const; 2506 V8_DEPRECATED("Use ScriptId instead", Handle<Value> GetScriptId()) const;
2495 2507
2496 /** 2508 /**
2497 * Returns scriptId. 2509 * Returns scriptId.
2498 */ 2510 */
2499 int ScriptId() const; 2511 int ScriptId() const;
2500 2512
2501 ScriptOrigin GetScriptOrigin() const; 2513 ScriptOrigin GetScriptOrigin() const;
(...skipping 1557 matching lines...) Expand 10 before | Expand all | Expand 10 after
4059 * Allows the host application to group objects together. If one 4071 * Allows the host application to group objects together. If one
4060 * object in the group is alive, all objects in the group are alive. 4072 * object in the group is alive, all objects in the group are alive.
4061 * After each garbage collection, object groups are removed. It is 4073 * After each garbage collection, object groups are removed. It is
4062 * intended to be used in the before-garbage-collection callback 4074 * intended to be used in the before-garbage-collection callback
4063 * function, for instance to simulate DOM tree connections among JS 4075 * function, for instance to simulate DOM tree connections among JS
4064 * wrapper objects. Object groups for all dependent handles need to 4076 * wrapper objects. Object groups for all dependent handles need to
4065 * be provided for kGCTypeMarkSweepCompact collections, for all other 4077 * be provided for kGCTypeMarkSweepCompact collections, for all other
4066 * garbage collection types it is sufficient to provide object groups 4078 * garbage collection types it is sufficient to provide object groups
4067 * for partially dependent handles only. 4079 * for partially dependent handles only.
4068 */ 4080 */
4069 void SetObjectGroupId(const Persistent<Value>& object, 4081 template<typename T> void SetObjectGroupId(const Persistent<T>& object,
4070 UniqueId id); 4082 UniqueId id);
4071 4083
4072 /** 4084 /**
4073 * Allows the host application to declare implicit references from an object 4085 * Allows the host application to declare implicit references from an object
4074 * group to an object. If the objects of the object group are alive, the child 4086 * group to an object. If the objects of the object group are alive, the child
4075 * object is alive too. After each garbage collection, all implicit references 4087 * object is alive too. After each garbage collection, all implicit references
4076 * are removed. It is intended to be used in the before-garbage-collection 4088 * are removed. It is intended to be used in the before-garbage-collection
4077 * callback function. 4089 * callback function.
4078 */ 4090 */
4079 void SetReferenceFromGroup(UniqueId id, 4091 template<typename T> void SetReferenceFromGroup(UniqueId id,
4080 const Persistent<Value>& child); 4092 const Persistent<T>& child);
4081 4093
4082 /** 4094 /**
4083 * Allows the host application to declare implicit references from an object 4095 * Allows the host application to declare implicit references from an object
4084 * to another object. If the parent object is alive, the child object is alive 4096 * to another object. If the parent object is alive, the child object is alive
4085 * too. After each garbage collection, all implicit references are removed. It 4097 * too. After each garbage collection, all implicit references are removed. It
4086 * is intended to be used in the before-garbage-collection callback function. 4098 * is intended to be used in the before-garbage-collection callback function.
4087 */ 4099 */
4088 void SetReference(const Persistent<Object>& parent, 4100 template<typename T, typename S>
4089 const Persistent<Value>& child); 4101 void SetReference(const Persistent<T>& parent, const Persistent<S>& child);
4090 4102
4091 typedef void (*GCPrologueCallback)(Isolate* isolate, 4103 typedef void (*GCPrologueCallback)(Isolate* isolate,
4092 GCType type, 4104 GCType type,
4093 GCCallbackFlags flags); 4105 GCCallbackFlags flags);
4094 typedef void (*GCEpilogueCallback)(Isolate* isolate, 4106 typedef void (*GCEpilogueCallback)(Isolate* isolate,
4095 GCType type, 4107 GCType type,
4096 GCCallbackFlags flags); 4108 GCCallbackFlags flags);
4097 4109
4098 /** 4110 /**
4099 * Enables the host application to receive a notification before a 4111 * Enables the host application to receive a notification before a
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
4133 */ 4145 */
4134 void RemoveGCEpilogueCallback(GCEpilogueCallback callback); 4146 void RemoveGCEpilogueCallback(GCEpilogueCallback callback);
4135 4147
4136 private: 4148 private:
4137 Isolate(); 4149 Isolate();
4138 Isolate(const Isolate&); 4150 Isolate(const Isolate&);
4139 ~Isolate(); 4151 ~Isolate();
4140 Isolate& operator=(const Isolate&); 4152 Isolate& operator=(const Isolate&);
4141 void* operator new(size_t size); 4153 void* operator new(size_t size);
4142 void operator delete(void*, size_t); 4154 void operator delete(void*, size_t);
4155
4156 void SetObjectGroupId(internal::Object** object, UniqueId id);
4157 void SetReferenceFromGroup(UniqueId id, internal::Object** object);
4158 void SetReference(internal::Object** parent, internal::Object** child);
4143 }; 4159 };
4144 4160
4145
4146 class V8_EXPORT StartupData { 4161 class V8_EXPORT StartupData {
4147 public: 4162 public:
4148 enum CompressionAlgorithm { 4163 enum CompressionAlgorithm {
4149 kUncompressed, 4164 kUncompressed,
4150 kBZip2 4165 kBZip2
4151 }; 4166 };
4152 4167
4153 const char* data; 4168 const char* data;
4154 int compressed_size; 4169 int compressed_size;
4155 int raw_size; 4170 int raw_size;
(...skipping 1230 matching lines...) Expand 10 before | Expand all | Expand 10 after
5386 static const int kStringEncodingMask = 0x4; 5401 static const int kStringEncodingMask = 0x4;
5387 static const int kExternalTwoByteRepresentationTag = 0x02; 5402 static const int kExternalTwoByteRepresentationTag = 0x02;
5388 static const int kExternalAsciiRepresentationTag = 0x06; 5403 static const int kExternalAsciiRepresentationTag = 0x06;
5389 5404
5390 static const int kIsolateEmbedderDataOffset = 1 * kApiPointerSize; 5405 static const int kIsolateEmbedderDataOffset = 1 * kApiPointerSize;
5391 static const int kIsolateRootsOffset = 3 * kApiPointerSize; 5406 static const int kIsolateRootsOffset = 3 * kApiPointerSize;
5392 static const int kUndefinedValueRootIndex = 5; 5407 static const int kUndefinedValueRootIndex = 5;
5393 static const int kNullValueRootIndex = 7; 5408 static const int kNullValueRootIndex = 7;
5394 static const int kTrueValueRootIndex = 8; 5409 static const int kTrueValueRootIndex = 8;
5395 static const int kFalseValueRootIndex = 9; 5410 static const int kFalseValueRootIndex = 9;
5396 static const int kEmptyStringRootIndex = 131; 5411 static const int kEmptyStringRootIndex = 132;
5397 5412
5398 static const int kNodeClassIdOffset = 1 * kApiPointerSize; 5413 static const int kNodeClassIdOffset = 1 * kApiPointerSize;
5399 static const int kNodeFlagsOffset = 1 * kApiPointerSize + 3; 5414 static const int kNodeFlagsOffset = 1 * kApiPointerSize + 3;
5400 static const int kNodeStateMask = 0xf; 5415 static const int kNodeStateMask = 0xf;
5401 static const int kNodeStateIsWeakValue = 2; 5416 static const int kNodeStateIsWeakValue = 2;
5402 static const int kNodeStateIsPendingValue = 3; 5417 static const int kNodeStateIsPendingValue = 3;
5403 static const int kNodeStateIsNearDeathValue = 4; 5418 static const int kNodeStateIsNearDeathValue = 4;
5404 static const int kNodeIsIndependentShift = 4; 5419 static const int kNodeIsIndependentShift = 4;
5405 static const int kNodeIsPartiallyDependentShift = 5; 5420 static const int kNodeIsPartiallyDependentShift = 5;
5406 5421
5407 static const int kJSObjectType = 0xb1; 5422 static const int kJSObjectType = 0xb2;
5408 static const int kFirstNonstringType = 0x80; 5423 static const int kFirstNonstringType = 0x80;
5409 static const int kOddballType = 0x83; 5424 static const int kOddballType = 0x83;
5410 static const int kForeignType = 0x87; 5425 static const int kForeignType = 0x87;
5411 5426
5412 static const int kUndefinedOddballKind = 5; 5427 static const int kUndefinedOddballKind = 5;
5413 static const int kNullOddballKind = 3; 5428 static const int kNullOddballKind = 3;
5414 5429
5415 V8_EXPORT static void CheckInitializedImpl(v8::Isolate* isolate); 5430 V8_EXPORT static void CheckInitializedImpl(v8::Isolate* isolate);
5416 V8_INLINE static void CheckInitialized(v8::Isolate* isolate) { 5431 V8_INLINE static void CheckInitialized(v8::Isolate* isolate) {
5417 #ifdef V8_ENABLE_CHECKS 5432 #ifdef V8_ENABLE_CHECKS
(...skipping 995 matching lines...) Expand 10 before | Expand all | Expand 10 after
6413 I::SetEmbedderData(this, data); 6428 I::SetEmbedderData(this, data);
6414 } 6429 }
6415 6430
6416 6431
6417 void* Isolate::GetData() { 6432 void* Isolate::GetData() {
6418 typedef internal::Internals I; 6433 typedef internal::Internals I;
6419 return I::GetEmbedderData(this); 6434 return I::GetEmbedderData(this);
6420 } 6435 }
6421 6436
6422 6437
6438 template<typename T>
6439 void Isolate::SetObjectGroupId(const Persistent<T>& object,
6440 UniqueId id) {
6441 TYPE_CHECK(Value, T);
6442 SetObjectGroupId(reinterpret_cast<v8::internal::Object**>(object.val_), id);
6443 }
6444
6445
6446 template<typename T>
6447 void Isolate::SetReferenceFromGroup(UniqueId id,
6448 const Persistent<T>& object) {
6449 TYPE_CHECK(Value, T);
6450 SetReferenceFromGroup(id,
6451 reinterpret_cast<v8::internal::Object**>(object.val_));
6452 }
6453
6454
6455 template<typename T, typename S>
6456 void Isolate::SetReference(const Persistent<T>& parent,
6457 const Persistent<S>& child) {
6458 TYPE_CHECK(Object, T);
6459 TYPE_CHECK(Value, S);
6460 SetReference(reinterpret_cast<v8::internal::Object**>(parent.val_),
6461 reinterpret_cast<v8::internal::Object**>(child.val_));
6462 }
6463
6464
6423 Local<Value> Context::GetEmbedderData(int index) { 6465 Local<Value> Context::GetEmbedderData(int index) {
6424 #ifndef V8_ENABLE_CHECKS 6466 #ifndef V8_ENABLE_CHECKS
6425 typedef internal::Object O; 6467 typedef internal::Object O;
6426 typedef internal::HeapObject HO; 6468 typedef internal::HeapObject HO;
6427 typedef internal::Internals I; 6469 typedef internal::Internals I;
6428 HO* context = *reinterpret_cast<HO**>(this); 6470 HO* context = *reinterpret_cast<HO**>(this);
6429 O** result = 6471 O** result =
6430 HandleScope::CreateHandle(context, I::ReadEmbedderData<O*>(this, index)); 6472 HandleScope::CreateHandle(context, I::ReadEmbedderData<O*>(this, index));
6431 return Local<Value>(reinterpret_cast<Value*>(result)); 6473 return Local<Value>(reinterpret_cast<Value*>(result));
6432 #else 6474 #else
(...skipping 24 matching lines...) Expand all
6457 */ 6499 */
6458 6500
6459 6501
6460 } // namespace v8 6502 } // namespace v8
6461 6503
6462 6504
6463 #undef TYPE_CHECK 6505 #undef TYPE_CHECK
6464 6506
6465 6507
6466 #endif // V8_H_ 6508 #endif // V8_H_
OLDNEW
« no previous file with comments | « build/toolchain.gypi ('k') | include/v8-profiler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698