| OLD | NEW |
| 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 2359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2370 ScriptOrigin GetScriptOrigin() const; | 2370 ScriptOrigin GetScriptOrigin() const; |
| 2371 V8_INLINE(static Function* Cast(Value* obj)); | 2371 V8_INLINE(static Function* Cast(Value* obj)); |
| 2372 static const int kLineOffsetNotFound; | 2372 static const int kLineOffsetNotFound; |
| 2373 | 2373 |
| 2374 private: | 2374 private: |
| 2375 Function(); | 2375 Function(); |
| 2376 static void CheckCast(Value* obj); | 2376 static void CheckCast(Value* obj); |
| 2377 }; | 2377 }; |
| 2378 | 2378 |
| 2379 #ifndef V8_ARRAY_BUFFER_INTERNAL_FIELD_COUNT | 2379 #ifndef V8_ARRAY_BUFFER_INTERNAL_FIELD_COUNT |
| 2380 // The number of required internal fields can be defined by embedder. |
| 2380 #define V8_ARRAY_BUFFER_INTERNAL_FIELD_COUNT 2 | 2381 #define V8_ARRAY_BUFFER_INTERNAL_FIELD_COUNT 2 |
| 2381 #endif | 2382 #endif |
| 2382 | 2383 |
| 2383 /** | 2384 /** |
| 2384 * An instance of the built-in ArrayBuffer constructor (ES6 draft 15.13.5). | 2385 * An instance of the built-in ArrayBuffer constructor (ES6 draft 15.13.5). |
| 2385 * This API is experimental and may change significantly. | 2386 * This API is experimental and may change significantly. |
| 2386 */ | 2387 */ |
| 2387 class V8EXPORT ArrayBuffer : public Object { | 2388 class V8EXPORT ArrayBuffer : public Object { |
| 2388 public: | 2389 public: |
| 2389 /** | 2390 /** |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2482 V8_INLINE(static ArrayBuffer* Cast(Value* obj)); | 2483 V8_INLINE(static ArrayBuffer* Cast(Value* obj)); |
| 2483 | 2484 |
| 2484 static const int kInternalFieldCount = V8_ARRAY_BUFFER_INTERNAL_FIELD_COUNT; | 2485 static const int kInternalFieldCount = V8_ARRAY_BUFFER_INTERNAL_FIELD_COUNT; |
| 2485 | 2486 |
| 2486 private: | 2487 private: |
| 2487 ArrayBuffer(); | 2488 ArrayBuffer(); |
| 2488 static void CheckCast(Value* obj); | 2489 static void CheckCast(Value* obj); |
| 2489 }; | 2490 }; |
| 2490 | 2491 |
| 2491 | 2492 |
| 2493 #ifndef V8_ARRAY_BUFFER_VIEW_INTERNAL_FIELD_COUNT |
| 2494 // The number of required internal fields can be defined by embedder. |
| 2495 #define V8_ARRAY_BUFFER_VIEW_INTERNAL_FIELD_COUNT 2 |
| 2496 #endif |
| 2497 |
| 2498 |
| 2492 /** | 2499 /** |
| 2493 * A base class for an instance of one of "views" over ArrayBuffer, | 2500 * A base class for an instance of one of "views" over ArrayBuffer, |
| 2494 * including TypedArrays and DataView (ES6 draft 15.13). | 2501 * including TypedArrays and DataView (ES6 draft 15.13). |
| 2495 * | 2502 * |
| 2496 * This API is experimental and may change significantly. | 2503 * This API is experimental and may change significantly. |
| 2497 */ | 2504 */ |
| 2498 class V8EXPORT ArrayBufferView : public Object { | 2505 class V8EXPORT ArrayBufferView : public Object { |
| 2499 public: | 2506 public: |
| 2500 /** | 2507 /** |
| 2501 * Returns underlying ArrayBuffer. | 2508 * Returns underlying ArrayBuffer. |
| 2502 */ | 2509 */ |
| 2503 Local<ArrayBuffer> Buffer(); | 2510 Local<ArrayBuffer> Buffer(); |
| 2504 /** | 2511 /** |
| 2505 * Byte offset in |Buffer|. | 2512 * Byte offset in |Buffer|. |
| 2506 */ | 2513 */ |
| 2507 size_t ByteOffset(); | 2514 size_t ByteOffset(); |
| 2508 /** | 2515 /** |
| 2509 * Size of a view in bytes. | 2516 * Size of a view in bytes. |
| 2510 */ | 2517 */ |
| 2511 size_t ByteLength(); | 2518 size_t ByteLength(); |
| 2512 /** | 2519 /** |
| 2513 * Base address of a view. | 2520 * Base address of a view. |
| 2514 */ | 2521 */ |
| 2515 void* BaseAddress(); | 2522 void* BaseAddress(); |
| 2516 | 2523 |
| 2517 V8_INLINE(static ArrayBufferView* Cast(Value* obj)); | 2524 V8_INLINE(static ArrayBufferView* Cast(Value* obj)); |
| 2518 | 2525 |
| 2526 static const int kInternalFieldCount = |
| 2527 V8_ARRAY_BUFFER_VIEW_INTERNAL_FIELD_COUNT; |
| 2528 |
| 2519 private: | 2529 private: |
| 2520 ArrayBufferView(); | 2530 ArrayBufferView(); |
| 2521 static void CheckCast(Value* obj); | 2531 static void CheckCast(Value* obj); |
| 2522 }; | 2532 }; |
| 2523 | 2533 |
| 2524 | 2534 |
| 2525 /** | 2535 /** |
| 2526 * A base class for an instance of TypedArray series of constructors | 2536 * A base class for an instance of TypedArray series of constructors |
| 2527 * (ES6 draft 15.13.6). | 2537 * (ES6 draft 15.13.6). |
| 2528 * This API is experimental and may change significantly. | 2538 * This API is experimental and may change significantly. |
| (...skipping 1457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3986 */ | 3996 */ |
| 3987 intptr_t AdjustAmountOfExternalAllocatedMemory(intptr_t change_in_bytes); | 3997 intptr_t AdjustAmountOfExternalAllocatedMemory(intptr_t change_in_bytes); |
| 3988 | 3998 |
| 3989 /** | 3999 /** |
| 3990 * Returns heap profiler for this isolate. Will return NULL until the isolate | 4000 * Returns heap profiler for this isolate. Will return NULL until the isolate |
| 3991 * is initialized. | 4001 * is initialized. |
| 3992 */ | 4002 */ |
| 3993 HeapProfiler* GetHeapProfiler(); | 4003 HeapProfiler* GetHeapProfiler(); |
| 3994 | 4004 |
| 3995 /** | 4005 /** |
| 3996 * Returns CPU profiler for this isolate. Will return NULL until the isolate | 4006 * Returns CPU profiler for this isolate. Will return NULL unless the isolate |
| 3997 * is initialized. | 4007 * is initialized. It is the embedder's responsibility to stop all CPU |
| 4008 * profiling activities if it has started any. |
| 3998 */ | 4009 */ |
| 3999 CpuProfiler* GetCpuProfiler(); | 4010 CpuProfiler* GetCpuProfiler(); |
| 4000 | 4011 |
| 4001 /** Returns the context that is on the top of the stack. */ | 4012 /** Returns the context that is on the top of the stack. */ |
| 4002 Local<Context> GetCurrentContext(); | 4013 Local<Context> GetCurrentContext(); |
| 4003 | 4014 |
| 4004 /** | 4015 /** |
| 4005 * Allows the host application to group objects together. If one | 4016 * Allows the host application to group objects together. If one |
| 4006 * object in the group is alive, all objects in the group are alive. | 4017 * object in the group is alive, all objects in the group are alive. |
| 4007 * After each garbage collection, object groups are removed. It is | 4018 * After each garbage collection, object groups are removed. It is |
| (...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4470 static void SetEntropySource(EntropySource source); | 4481 static void SetEntropySource(EntropySource source); |
| 4471 | 4482 |
| 4472 /** | 4483 /** |
| 4473 * Allows the host application to provide a callback that allows v8 to | 4484 * Allows the host application to provide a callback that allows v8 to |
| 4474 * cooperate with a profiler that rewrites return addresses on stack. | 4485 * cooperate with a profiler that rewrites return addresses on stack. |
| 4475 */ | 4486 */ |
| 4476 static void SetReturnAddressLocationResolver( | 4487 static void SetReturnAddressLocationResolver( |
| 4477 ReturnAddressLocationResolver return_address_resolver); | 4488 ReturnAddressLocationResolver return_address_resolver); |
| 4478 | 4489 |
| 4479 /** | 4490 /** |
| 4491 * Deprecated, use the variant with the Isolate parameter below instead. |
| 4492 */ |
| 4493 V8_DEPRECATED(static bool SetFunctionEntryHook(FunctionEntryHook entry_hook)); |
| 4494 |
| 4495 /** |
| 4480 * Allows the host application to provide the address of a function that's | 4496 * Allows the host application to provide the address of a function that's |
| 4481 * invoked on entry to every V8-generated function. | 4497 * invoked on entry to every V8-generated function. |
| 4482 * Note that \p entry_hook is invoked at the very start of each | 4498 * Note that \p entry_hook is invoked at the very start of each |
| 4483 * generated function. | 4499 * generated function. |
| 4484 * | 4500 * |
| 4501 * \param isolate the isolate to operate on. |
| 4485 * \param entry_hook a function that will be invoked on entry to every | 4502 * \param entry_hook a function that will be invoked on entry to every |
| 4486 * V8-generated function. | 4503 * V8-generated function. |
| 4487 * \returns true on success on supported platforms, false on failure. | 4504 * \returns true on success on supported platforms, false on failure. |
| 4488 * \note Setting a new entry hook function when one is already active will | 4505 * \note Setting an entry hook can only be done very early in an isolates |
| 4489 * fail. | 4506 * lifetime, and once set, the entry hook cannot be revoked. |
| 4490 */ | 4507 */ |
| 4491 static bool SetFunctionEntryHook(FunctionEntryHook entry_hook); | 4508 static bool SetFunctionEntryHook(Isolate* isolate, |
| 4509 FunctionEntryHook entry_hook); |
| 4492 | 4510 |
| 4493 /** | 4511 /** |
| 4494 * Allows the host application to provide the address of a function that is | 4512 * Allows the host application to provide the address of a function that is |
| 4495 * notified each time code is added, moved or removed. | 4513 * notified each time code is added, moved or removed. |
| 4496 * | 4514 * |
| 4497 * \param options options for the JIT code event handler. | 4515 * \param options options for the JIT code event handler. |
| 4498 * \param event_handler the JIT code event handler, which will be invoked | 4516 * \param event_handler the JIT code event handler, which will be invoked |
| 4499 * each time code is added, moved or removed. | 4517 * each time code is added, moved or removed. |
| 4500 * \note \p event_handler won't get notified of existent code. | 4518 * \note \p event_handler won't get notified of existent code. |
| 4501 * \note since code removal notifications are not currently issued, the | 4519 * \note since code removal notifications are not currently issued, the |
| (...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4809 private: | 4827 private: |
| 4810 // Make it hard to create heap-allocated TryCatch blocks. | 4828 // Make it hard to create heap-allocated TryCatch blocks. |
| 4811 TryCatch(const TryCatch&); | 4829 TryCatch(const TryCatch&); |
| 4812 void operator=(const TryCatch&); | 4830 void operator=(const TryCatch&); |
| 4813 void* operator new(size_t size); | 4831 void* operator new(size_t size); |
| 4814 void operator delete(void*, size_t); | 4832 void operator delete(void*, size_t); |
| 4815 | 4833 |
| 4816 v8::internal::Isolate* isolate_; | 4834 v8::internal::Isolate* isolate_; |
| 4817 void* next_; | 4835 void* next_; |
| 4818 void* exception_; | 4836 void* exception_; |
| 4819 void* message_; | 4837 void* message_obj_; |
| 4838 void* message_script_; |
| 4839 int message_start_pos_; |
| 4840 int message_end_pos_; |
| 4820 bool is_verbose_ : 1; | 4841 bool is_verbose_ : 1; |
| 4821 bool can_continue_ : 1; | 4842 bool can_continue_ : 1; |
| 4822 bool capture_message_ : 1; | 4843 bool capture_message_ : 1; |
| 4823 bool rethrow_ : 1; | 4844 bool rethrow_ : 1; |
| 4824 bool has_terminated_ : 1; | 4845 bool has_terminated_ : 1; |
| 4825 | 4846 |
| 4826 friend class v8::internal::Isolate; | 4847 friend class v8::internal::Isolate; |
| 4827 }; | 4848 }; |
| 4828 | 4849 |
| 4829 | 4850 |
| (...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5375 static const int kEmptyStringRootIndex = 131; | 5396 static const int kEmptyStringRootIndex = 131; |
| 5376 | 5397 |
| 5377 static const int kNodeClassIdOffset = 1 * kApiPointerSize; | 5398 static const int kNodeClassIdOffset = 1 * kApiPointerSize; |
| 5378 static const int kNodeFlagsOffset = 1 * kApiPointerSize + 3; | 5399 static const int kNodeFlagsOffset = 1 * kApiPointerSize + 3; |
| 5379 static const int kNodeStateMask = 0xf; | 5400 static const int kNodeStateMask = 0xf; |
| 5380 static const int kNodeStateIsWeakValue = 2; | 5401 static const int kNodeStateIsWeakValue = 2; |
| 5381 static const int kNodeStateIsNearDeathValue = 4; | 5402 static const int kNodeStateIsNearDeathValue = 4; |
| 5382 static const int kNodeIsIndependentShift = 4; | 5403 static const int kNodeIsIndependentShift = 4; |
| 5383 static const int kNodeIsPartiallyDependentShift = 5; | 5404 static const int kNodeIsPartiallyDependentShift = 5; |
| 5384 | 5405 |
| 5385 static const int kJSObjectType = 0xb0; | 5406 static const int kJSObjectType = 0xb1; |
| 5386 static const int kFirstNonstringType = 0x80; | 5407 static const int kFirstNonstringType = 0x80; |
| 5387 static const int kOddballType = 0x83; | 5408 static const int kOddballType = 0x83; |
| 5388 static const int kForeignType = 0x88; | 5409 static const int kForeignType = 0x88; |
| 5389 | 5410 |
| 5390 static const int kUndefinedOddballKind = 5; | 5411 static const int kUndefinedOddballKind = 5; |
| 5391 static const int kNullOddballKind = 3; | 5412 static const int kNullOddballKind = 3; |
| 5392 | 5413 |
| 5414 static void CheckInitializedImpl(v8::Isolate* isolate); |
| 5415 V8_INLINE(static void CheckInitialized(v8::Isolate* isolate)) { |
| 5393 #ifdef V8_ENABLE_CHECKS | 5416 #ifdef V8_ENABLE_CHECKS |
| 5394 static void CheckInitialized(v8::Isolate* isolate); | 5417 CheckInitializedImpl(isolate); |
| 5395 #else | |
| 5396 static void CheckInitialized(v8::Isolate* isolate) { } | |
| 5397 #endif | 5418 #endif |
| 5419 } |
| 5398 | 5420 |
| 5399 V8_INLINE(static bool HasHeapObjectTag(internal::Object* value)) { | 5421 V8_INLINE(static bool HasHeapObjectTag(internal::Object* value)) { |
| 5400 return ((reinterpret_cast<intptr_t>(value) & kHeapObjectTagMask) == | 5422 return ((reinterpret_cast<intptr_t>(value) & kHeapObjectTagMask) == |
| 5401 kHeapObjectTag); | 5423 kHeapObjectTag); |
| 5402 } | 5424 } |
| 5403 | 5425 |
| 5404 V8_INLINE(static int SmiValue(internal::Object* value)) { | 5426 V8_INLINE(static int SmiValue(internal::Object* value)) { |
| 5405 return PlatformSmiTagging::SmiToInt(value); | 5427 return PlatformSmiTagging::SmiToInt(value); |
| 5406 } | 5428 } |
| 5407 | 5429 |
| (...skipping 1045 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6453 | 6475 |
| 6454 | 6476 |
| 6455 } // namespace v8 | 6477 } // namespace v8 |
| 6456 | 6478 |
| 6457 | 6479 |
| 6458 #undef V8EXPORT | 6480 #undef V8EXPORT |
| 6459 #undef TYPE_CHECK | 6481 #undef TYPE_CHECK |
| 6460 | 6482 |
| 6461 | 6483 |
| 6462 #endif // V8_H_ | 6484 #endif // V8_H_ |
| OLD | NEW |