OLD | NEW |
---|---|
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 /** \mainpage V8 API Reference Guide | 5 /** \mainpage V8 API Reference Guide |
6 * | 6 * |
7 * V8 is Google's open source JavaScript engine. | 7 * V8 is Google's open source JavaScript engine. |
8 * | 8 * |
9 * This set of documents provides reference material generated from the | 9 * This set of documents provides reference material generated from the |
10 * V8 header file, include/v8.h. | 10 * V8 header file, include/v8.h. |
(...skipping 5379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5390 virtual void TraceRoots(Isolate* isolate) = 0; | 5390 virtual void TraceRoots(Isolate* isolate) = 0; |
5391 | 5391 |
5392 /** | 5392 /** |
5393 * V8 will call this method with internal fields of a potential wrappers. | 5393 * V8 will call this method with internal fields of a potential wrappers. |
5394 * Embedder is expected to trace its heap (synchronously) and call | 5394 * Embedder is expected to trace its heap (synchronously) and call |
5395 * PersistentBase::RegisterExternalReference() on all wrappers reachable from | 5395 * PersistentBase::RegisterExternalReference() on all wrappers reachable from |
5396 * any of the given wrappers. | 5396 * any of the given wrappers. |
5397 */ | 5397 */ |
5398 virtual void TraceWrappableFrom( | 5398 virtual void TraceWrappableFrom( |
5399 Isolate* isolate, | 5399 Isolate* isolate, |
5400 const std::vector<std::pair<void*, void*> >& internal_fields) = 0; | 5400 const std::vector<std::pair<Value*, Value*> >& internal_fields) = 0; |
jochen (gone - plz use gerrit)
2016/04/08 02:19:56
why this change? I don't think we should expose Da
Marcel Hlopko
2016/04/08 08:08:09
The motivation was to be consistent with SetIntern
| |
5401 /** | 5401 /** |
5402 * V8 will call this method at the end of the gc cycle. Allocation is *not* | 5402 * V8 will call this method at the end of the gc cycle. Allocation is *not* |
5403 * allowed in the ClearTracingMarks. | 5403 * allowed in the ClearTracingMarks. |
5404 */ | 5404 */ |
5405 virtual void ClearTracingMarks(Isolate* isolate) = 0; | 5405 virtual void ClearTracingMarks(Isolate* isolate) = 0; |
5406 | 5406 |
5407 protected: | 5407 protected: |
5408 virtual ~EmbedderHeapTracer() = default; | 5408 virtual ~EmbedderHeapTracer() = default; |
5409 }; | 5409 }; |
5410 | 5410 |
(...skipping 1935 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
7346 static const int kNodeClassIdOffset = 1 * kApiPointerSize; | 7346 static const int kNodeClassIdOffset = 1 * kApiPointerSize; |
7347 static const int kNodeFlagsOffset = 1 * kApiPointerSize + 3; | 7347 static const int kNodeFlagsOffset = 1 * kApiPointerSize + 3; |
7348 static const int kNodeStateMask = 0x7; | 7348 static const int kNodeStateMask = 0x7; |
7349 static const int kNodeStateIsWeakValue = 2; | 7349 static const int kNodeStateIsWeakValue = 2; |
7350 static const int kNodeStateIsPendingValue = 3; | 7350 static const int kNodeStateIsPendingValue = 3; |
7351 static const int kNodeStateIsNearDeathValue = 4; | 7351 static const int kNodeStateIsNearDeathValue = 4; |
7352 static const int kNodeIsIndependentShift = 3; | 7352 static const int kNodeIsIndependentShift = 3; |
7353 static const int kNodeIsPartiallyDependentShift = 4; | 7353 static const int kNodeIsPartiallyDependentShift = 4; |
7354 static const int kNodeIsActiveShift = 4; | 7354 static const int kNodeIsActiveShift = 4; |
7355 | 7355 |
7356 static const int kJSObjectType = 0xb6; | 7356 static const int kJSObjectType = 0xb7; |
7357 static const int kJSApiObjectType = 0xb6; | |
7357 static const int kFirstNonstringType = 0x80; | 7358 static const int kFirstNonstringType = 0x80; |
7358 static const int kOddballType = 0x83; | 7359 static const int kOddballType = 0x83; |
7359 static const int kForeignType = 0x87; | 7360 static const int kForeignType = 0x87; |
7360 | 7361 |
7361 static const int kUndefinedOddballKind = 5; | 7362 static const int kUndefinedOddballKind = 5; |
7362 static const int kNullOddballKind = 3; | 7363 static const int kNullOddballKind = 3; |
7363 | 7364 |
7364 static const uint32_t kNumIsolateDataSlots = 4; | 7365 static const uint32_t kNumIsolateDataSlots = 4; |
7365 | 7366 |
7366 V8_EXPORT static void CheckInitializedImpl(v8::Isolate* isolate); | 7367 V8_EXPORT static void CheckInitializedImpl(v8::Isolate* isolate); |
(...skipping 611 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
7978 | 7979 |
7979 | 7980 |
7980 Local<Value> Object::GetInternalField(int index) { | 7981 Local<Value> Object::GetInternalField(int index) { |
7981 #ifndef V8_ENABLE_CHECKS | 7982 #ifndef V8_ENABLE_CHECKS |
7982 typedef internal::Object O; | 7983 typedef internal::Object O; |
7983 typedef internal::HeapObject HO; | 7984 typedef internal::HeapObject HO; |
7984 typedef internal::Internals I; | 7985 typedef internal::Internals I; |
7985 O* obj = *reinterpret_cast<O**>(this); | 7986 O* obj = *reinterpret_cast<O**>(this); |
7986 // Fast path: If the object is a plain JSObject, which is the common case, we | 7987 // Fast path: If the object is a plain JSObject, which is the common case, we |
7987 // know where to find the internal fields and can return the value directly. | 7988 // know where to find the internal fields and can return the value directly. |
7988 if (I::GetInstanceType(obj) == I::kJSObjectType) { | 7989 auto instance_type = I::GetInstanceType(obj); |
7990 if (instance_type == I::kJSObjectType || | |
7991 instance_type == I::kJSApiObjectType) { | |
7989 int offset = I::kJSObjectHeaderSize + (internal::kApiPointerSize * index); | 7992 int offset = I::kJSObjectHeaderSize + (internal::kApiPointerSize * index); |
7990 O* value = I::ReadField<O*>(obj, offset); | 7993 O* value = I::ReadField<O*>(obj, offset); |
7991 O** result = HandleScope::CreateHandle(reinterpret_cast<HO*>(obj), value); | 7994 O** result = HandleScope::CreateHandle(reinterpret_cast<HO*>(obj), value); |
7992 return Local<Value>(reinterpret_cast<Value*>(result)); | 7995 return Local<Value>(reinterpret_cast<Value*>(result)); |
7993 } | 7996 } |
7994 #endif | 7997 #endif |
7995 return SlowGetInternalField(index); | 7998 return SlowGetInternalField(index); |
7996 } | 7999 } |
7997 | 8000 |
7998 | 8001 |
7999 void* Object::GetAlignedPointerFromInternalField(int index) { | 8002 void* Object::GetAlignedPointerFromInternalField(int index) { |
8000 #ifndef V8_ENABLE_CHECKS | 8003 #ifndef V8_ENABLE_CHECKS |
8001 typedef internal::Object O; | 8004 typedef internal::Object O; |
8002 typedef internal::Internals I; | 8005 typedef internal::Internals I; |
8003 O* obj = *reinterpret_cast<O**>(this); | 8006 O* obj = *reinterpret_cast<O**>(this); |
8004 // Fast path: If the object is a plain JSObject, which is the common case, we | 8007 // Fast path: If the object is a plain JSObject, which is the common case, we |
8005 // know where to find the internal fields and can return the value directly. | 8008 // know where to find the internal fields and can return the value directly. |
8006 if (V8_LIKELY(I::GetInstanceType(obj) == I::kJSObjectType)) { | 8009 auto instance_type = I::GetInstanceType(obj); |
8010 if (V8_LIKELY(instance_type == I::kJSObjectType || | |
8011 instance_type == I::kJSApiObjectType)) { | |
8007 int offset = I::kJSObjectHeaderSize + (internal::kApiPointerSize * index); | 8012 int offset = I::kJSObjectHeaderSize + (internal::kApiPointerSize * index); |
8008 return I::ReadField<void*>(obj, offset); | 8013 return I::ReadField<void*>(obj, offset); |
8009 } | 8014 } |
8010 #endif | 8015 #endif |
8011 return SlowGetAlignedPointerFromInternalField(index); | 8016 return SlowGetAlignedPointerFromInternalField(index); |
8012 } | 8017 } |
8013 | 8018 |
8014 | 8019 |
8015 String* String::Cast(v8::Value* value) { | 8020 String* String::Cast(v8::Value* value) { |
8016 #ifdef V8_ENABLE_CHECKS | 8021 #ifdef V8_ENABLE_CHECKS |
(...skipping 732 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
8749 */ | 8754 */ |
8750 | 8755 |
8751 | 8756 |
8752 } // namespace v8 | 8757 } // namespace v8 |
8753 | 8758 |
8754 | 8759 |
8755 #undef TYPE_CHECK | 8760 #undef TYPE_CHECK |
8756 | 8761 |
8757 | 8762 |
8758 #endif // INCLUDE_V8_H_ | 8763 #endif // INCLUDE_V8_H_ |
OLD | NEW |