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 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 * dereferencing the handle (for instance, to extract the Object* from | 204 * dereferencing the handle (for instance, to extract the Object* from |
205 * a Handle<Object>); the value will still be governed by a handle | 205 * a Handle<Object>); the value will still be governed by a handle |
206 * behind the scenes and the same rules apply to these values as to | 206 * behind the scenes and the same rules apply to these values as to |
207 * their handles. | 207 * their handles. |
208 */ | 208 */ |
209 template <class T> class Handle { | 209 template <class T> class Handle { |
210 public: | 210 public: |
211 /** | 211 /** |
212 * Creates an empty handle. | 212 * Creates an empty handle. |
213 */ | 213 */ |
214 V8_INLINE(Handle()) : val_(0) {} | 214 V8_INLINE Handle() : val_(0) {} |
215 | 215 |
216 /** | 216 /** |
217 * Creates a handle for the contents of the specified handle. This | 217 * Creates a handle for the contents of the specified handle. This |
218 * constructor allows you to pass handles as arguments by value and | 218 * constructor allows you to pass handles as arguments by value and |
219 * to assign between handles. However, if you try to assign between | 219 * to assign between handles. However, if you try to assign between |
220 * incompatible handles, for instance from a Handle<String> to a | 220 * incompatible handles, for instance from a Handle<String> to a |
221 * Handle<Number> it will cause a compile-time error. Assigning | 221 * Handle<Number> it will cause a compile-time error. Assigning |
222 * between compatible handles, for instance assigning a | 222 * between compatible handles, for instance assigning a |
223 * Handle<String> to a variable declared as Handle<Value>, is legal | 223 * Handle<String> to a variable declared as Handle<Value>, is legal |
224 * because String is a subclass of Value. | 224 * because String is a subclass of Value. |
225 */ | 225 */ |
226 template <class S> V8_INLINE(Handle(Handle<S> that)) | 226 template <class S> V8_INLINE Handle(Handle<S> that) |
227 : val_(reinterpret_cast<T*>(*that)) { | 227 : val_(reinterpret_cast<T*>(*that)) { |
228 /** | 228 /** |
229 * This check fails when trying to convert between incompatible | 229 * This check fails when trying to convert between incompatible |
230 * handles. For example, converting from a Handle<String> to a | 230 * handles. For example, converting from a Handle<String> to a |
231 * Handle<Number>. | 231 * Handle<Number>. |
232 */ | 232 */ |
233 TYPE_CHECK(T, S); | 233 TYPE_CHECK(T, S); |
234 } | 234 } |
235 | 235 |
236 /** | 236 /** |
237 * Returns true if the handle is empty. | 237 * Returns true if the handle is empty. |
238 */ | 238 */ |
239 V8_INLINE(bool IsEmpty() const) { return val_ == 0; } | 239 V8_INLINE bool IsEmpty() const { return val_ == 0; } |
240 | 240 |
241 /** | 241 /** |
242 * Sets the handle to be empty. IsEmpty() will then return true. | 242 * Sets the handle to be empty. IsEmpty() will then return true. |
243 */ | 243 */ |
244 V8_INLINE(void Clear()) { val_ = 0; } | 244 V8_INLINE void Clear() { val_ = 0; } |
245 | 245 |
246 V8_INLINE(T* operator->() const) { return val_; } | 246 V8_INLINE T* operator->() const { return val_; } |
247 | 247 |
248 V8_INLINE(T* operator*() const) { return val_; } | 248 V8_INLINE T* operator*() const { return val_; } |
249 | 249 |
250 /** | 250 /** |
251 * Checks whether two handles are the same. | 251 * Checks whether two handles are the same. |
252 * Returns true if both are empty, or if the objects | 252 * Returns true if both are empty, or if the objects |
253 * to which they refer are identical. | 253 * to which they refer are identical. |
254 * The handles' references are not checked. | 254 * The handles' references are not checked. |
255 */ | 255 */ |
256 template <class S> V8_INLINE(bool operator==(const Handle<S>& that) const) { | 256 template <class S> V8_INLINE bool operator==(const Handle<S>& that) const { |
257 internal::Object** a = reinterpret_cast<internal::Object**>(**this); | 257 internal::Object** a = reinterpret_cast<internal::Object**>(**this); |
258 internal::Object** b = reinterpret_cast<internal::Object**>(*that); | 258 internal::Object** b = reinterpret_cast<internal::Object**>(*that); |
259 if (a == 0) return b == 0; | 259 if (a == 0) return b == 0; |
260 if (b == 0) return false; | 260 if (b == 0) return false; |
261 return *a == *b; | 261 return *a == *b; |
262 } | 262 } |
263 | 263 |
264 template <class S> V8_INLINE( | 264 template <class S> V8_INLINE bool operator==( |
265 bool operator==(const Persistent<S>& that) const) { | 265 const Persistent<S>& that) const { |
266 internal::Object** a = reinterpret_cast<internal::Object**>(**this); | 266 internal::Object** a = reinterpret_cast<internal::Object**>(**this); |
267 internal::Object** b = reinterpret_cast<internal::Object**>(*that); | 267 internal::Object** b = reinterpret_cast<internal::Object**>(*that); |
268 if (a == 0) return b == 0; | 268 if (a == 0) return b == 0; |
269 if (b == 0) return false; | 269 if (b == 0) return false; |
270 return *a == *b; | 270 return *a == *b; |
271 } | 271 } |
272 | 272 |
273 /** | 273 /** |
274 * Checks whether two handles are different. | 274 * Checks whether two handles are different. |
275 * Returns true if only one of the handles is empty, or if | 275 * Returns true if only one of the handles is empty, or if |
276 * the objects to which they refer are different. | 276 * the objects to which they refer are different. |
277 * The handles' references are not checked. | 277 * The handles' references are not checked. |
278 */ | 278 */ |
279 template <class S> V8_INLINE(bool operator!=(const Handle<S>& that) const) { | 279 template <class S> V8_INLINE bool operator!=(const Handle<S>& that) const { |
280 return !operator==(that); | 280 return !operator==(that); |
281 } | 281 } |
282 | 282 |
283 template <class S> V8_INLINE( | 283 template <class S> V8_INLINE bool operator!=( |
284 bool operator!=(const Persistent<S>& that) const) { | 284 const Persistent<S>& that) const { |
285 return !operator==(that); | 285 return !operator==(that); |
286 } | 286 } |
287 | 287 |
288 template <class S> V8_INLINE(static Handle<T> Cast(Handle<S> that)) { | 288 template <class S> V8_INLINE static Handle<T> Cast(Handle<S> that) { |
289 #ifdef V8_ENABLE_CHECKS | 289 #ifdef V8_ENABLE_CHECKS |
290 // If we're going to perform the type check then we have to check | 290 // If we're going to perform the type check then we have to check |
291 // that the handle isn't empty before doing the checked cast. | 291 // that the handle isn't empty before doing the checked cast. |
292 if (that.IsEmpty()) return Handle<T>(); | 292 if (that.IsEmpty()) return Handle<T>(); |
293 #endif | 293 #endif |
294 return Handle<T>(T::Cast(*that)); | 294 return Handle<T>(T::Cast(*that)); |
295 } | 295 } |
296 | 296 |
297 template <class S> V8_INLINE(Handle<S> As()) { | 297 template <class S> V8_INLINE Handle<S> As() { |
298 return Handle<S>::Cast(*this); | 298 return Handle<S>::Cast(*this); |
299 } | 299 } |
300 | 300 |
301 V8_INLINE(static Handle<T> New(Isolate* isolate, Handle<T> that)) { | 301 V8_INLINE static Handle<T> New(Isolate* isolate, Handle<T> that) { |
302 return New(isolate, that.val_); | 302 return New(isolate, that.val_); |
303 } | 303 } |
304 V8_INLINE(static Handle<T> New(Isolate* isolate, const Persistent<T>& that)) { | 304 V8_INLINE static Handle<T> New(Isolate* isolate, const Persistent<T>& that) { |
305 return New(isolate, that.val_); | 305 return New(isolate, that.val_); |
306 } | 306 } |
307 | 307 |
308 #ifndef V8_ALLOW_ACCESS_TO_RAW_HANDLE_CONSTRUCTOR | 308 #ifndef V8_ALLOW_ACCESS_TO_RAW_HANDLE_CONSTRUCTOR |
309 | 309 |
310 private: | 310 private: |
311 #endif | 311 #endif |
312 /** | 312 /** |
313 * Creates a new handle for the specified value. | 313 * Creates a new handle for the specified value. |
314 */ | 314 */ |
315 V8_INLINE(explicit Handle(T* val)) : val_(val) {} | 315 V8_INLINE explicit Handle(T* val) : val_(val) {} |
316 | 316 |
317 private: | 317 private: |
318 friend class Utils; | 318 friend class Utils; |
319 template<class F, class M> friend class Persistent; | 319 template<class F, class M> friend class Persistent; |
320 template<class F> friend class Local; | 320 template<class F> friend class Local; |
321 template<class F> friend class FunctionCallbackInfo; | 321 template<class F> friend class FunctionCallbackInfo; |
322 template<class F> friend class PropertyCallbackInfo; | 322 template<class F> friend class PropertyCallbackInfo; |
323 template<class F> friend class internal::CustomArguments; | 323 template<class F> friend class internal::CustomArguments; |
324 friend Handle<Primitive> Undefined(Isolate* isolate); | 324 friend Handle<Primitive> Undefined(Isolate* isolate); |
325 friend Handle<Primitive> Null(Isolate* isolate); | 325 friend Handle<Primitive> Null(Isolate* isolate); |
326 friend Handle<Boolean> True(Isolate* isolate); | 326 friend Handle<Boolean> True(Isolate* isolate); |
327 friend Handle<Boolean> False(Isolate* isolate); | 327 friend Handle<Boolean> False(Isolate* isolate); |
328 friend class Context; | 328 friend class Context; |
329 friend class HandleScope; | 329 friend class HandleScope; |
330 | 330 |
331 V8_INLINE(static Handle<T> New(Isolate* isolate, T* that)); | 331 V8_INLINE static Handle<T> New(Isolate* isolate, T* that); |
332 | 332 |
333 T* val_; | 333 T* val_; |
334 }; | 334 }; |
335 | 335 |
336 | 336 |
337 /** | 337 /** |
338 * A light-weight stack-allocated object handle. All operations | 338 * A light-weight stack-allocated object handle. All operations |
339 * that return objects from within v8 return them in local handles. They | 339 * that return objects from within v8 return them in local handles. They |
340 * are created within HandleScopes, and all local handles allocated within a | 340 * are created within HandleScopes, and all local handles allocated within a |
341 * handle scope are destroyed when the handle scope is destroyed. Hence it | 341 * handle scope are destroyed when the handle scope is destroyed. Hence it |
342 * is not necessary to explicitly deallocate local handles. | 342 * is not necessary to explicitly deallocate local handles. |
343 */ | 343 */ |
344 template <class T> class Local : public Handle<T> { | 344 template <class T> class Local : public Handle<T> { |
345 public: | 345 public: |
346 V8_INLINE(Local()); | 346 V8_INLINE Local(); |
347 template <class S> V8_INLINE(Local(Local<S> that)) | 347 template <class S> V8_INLINE Local(Local<S> that) |
348 : Handle<T>(reinterpret_cast<T*>(*that)) { | 348 : Handle<T>(reinterpret_cast<T*>(*that)) { |
349 /** | 349 /** |
350 * This check fails when trying to convert between incompatible | 350 * This check fails when trying to convert between incompatible |
351 * handles. For example, converting from a Handle<String> to a | 351 * handles. For example, converting from a Handle<String> to a |
352 * Handle<Number>. | 352 * Handle<Number>. |
353 */ | 353 */ |
354 TYPE_CHECK(T, S); | 354 TYPE_CHECK(T, S); |
355 } | 355 } |
356 | 356 |
357 | 357 |
358 template <class S> V8_INLINE(static Local<T> Cast(Local<S> that)) { | 358 template <class S> V8_INLINE static Local<T> Cast(Local<S> that) { |
359 #ifdef V8_ENABLE_CHECKS | 359 #ifdef V8_ENABLE_CHECKS |
360 // If we're going to perform the type check then we have to check | 360 // If we're going to perform the type check then we have to check |
361 // that the handle isn't empty before doing the checked cast. | 361 // that the handle isn't empty before doing the checked cast. |
362 if (that.IsEmpty()) return Local<T>(); | 362 if (that.IsEmpty()) return Local<T>(); |
363 #endif | 363 #endif |
364 return Local<T>(T::Cast(*that)); | 364 return Local<T>(T::Cast(*that)); |
365 } | 365 } |
366 template <class S> V8_INLINE(Local(Handle<S> that)) | 366 template <class S> V8_INLINE Local(Handle<S> that) |
367 : Handle<T>(reinterpret_cast<T*>(*that)) { | 367 : Handle<T>(reinterpret_cast<T*>(*that)) { |
368 TYPE_CHECK(T, S); | 368 TYPE_CHECK(T, S); |
369 } | 369 } |
370 | 370 |
371 template <class S> V8_INLINE(Local<S> As()) { | 371 template <class S> V8_INLINE Local<S> As() { |
372 return Local<S>::Cast(*this); | 372 return Local<S>::Cast(*this); |
373 } | 373 } |
374 | 374 |
375 /** | 375 /** |
376 * Create a local handle for the content of another handle. | 376 * Create a local handle for the content of another handle. |
377 * The referee is kept alive by the local handle even when | 377 * The referee is kept alive by the local handle even when |
378 * the original handle is destroyed/disposed. | 378 * the original handle is destroyed/disposed. |
379 */ | 379 */ |
380 V8_INLINE(static Local<T> New(Handle<T> that)); | 380 V8_INLINE static Local<T> New(Handle<T> that); |
381 V8_INLINE(static Local<T> New(Isolate* isolate, Handle<T> that)); | 381 V8_INLINE static Local<T> New(Isolate* isolate, Handle<T> that); |
382 template<class M> | 382 template<class M> |
383 V8_INLINE(static Local<T> New(Isolate* isolate, | 383 V8_INLINE static Local<T> New(Isolate* isolate, |
384 const Persistent<T, M>& that)); | 384 const Persistent<T, M>& that); |
385 | 385 |
386 #ifndef V8_ALLOW_ACCESS_TO_RAW_HANDLE_CONSTRUCTOR | 386 #ifndef V8_ALLOW_ACCESS_TO_RAW_HANDLE_CONSTRUCTOR |
387 | 387 |
388 private: | 388 private: |
389 #endif | 389 #endif |
390 template <class S> V8_INLINE(Local(S* that) : Handle<T>(that)) { } | 390 template <class S> V8_INLINE Local(S* that) : Handle<T>(that) { } |
391 | 391 |
392 private: | 392 private: |
393 friend class Utils; | 393 friend class Utils; |
394 template<class F> friend class Eternal; | 394 template<class F> friend class Eternal; |
395 template<class F, class M> friend class Persistent; | 395 template<class F, class M> friend class Persistent; |
396 template<class F> friend class Handle; | 396 template<class F> friend class Handle; |
397 template<class F> friend class FunctionCallbackInfo; | 397 template<class F> friend class FunctionCallbackInfo; |
398 template<class F> friend class PropertyCallbackInfo; | 398 template<class F> friend class PropertyCallbackInfo; |
399 friend class String; | 399 friend class String; |
400 friend class Object; | 400 friend class Object; |
401 friend class Context; | 401 friend class Context; |
402 template<class F> friend class internal::CustomArguments; | 402 template<class F> friend class internal::CustomArguments; |
403 friend class HandleScope; | 403 friend class HandleScope; |
404 | 404 |
405 V8_INLINE(static Local<T> New(Isolate* isolate, T* that)); | 405 V8_INLINE static Local<T> New(Isolate* isolate, T* that); |
406 }; | 406 }; |
407 | 407 |
408 | 408 |
409 // Eternal handles are set-once handles that live for the life of the isolate. | 409 // Eternal handles are set-once handles that live for the life of the isolate. |
410 template <class T> class Eternal { | 410 template <class T> class Eternal { |
411 public: | 411 public: |
412 V8_INLINE(Eternal()) : index_(kInitialValue) { } | 412 V8_INLINE Eternal() : index_(kInitialValue) { } |
413 template<class S> | 413 template<class S> |
414 V8_INLINE(Eternal(Isolate* isolate, Local<S> handle)) | 414 V8_INLINE Eternal(Isolate* isolate, Local<S> handle) : index_(kInitialValue) { |
415 : index_(kInitialValue) { | |
416 Set(isolate, handle); | 415 Set(isolate, handle); |
417 } | 416 } |
418 // Can only be safely called if already set. | 417 // Can only be safely called if already set. |
419 V8_INLINE(Local<T> Get(Isolate* isolate)); | 418 V8_INLINE Local<T> Get(Isolate* isolate); |
420 V8_INLINE(bool IsEmpty()) { return index_ == kInitialValue; } | 419 V8_INLINE bool IsEmpty() { return index_ == kInitialValue; } |
421 template<class S> | 420 template<class S> V8_INLINE void Set(Isolate* isolate, Local<S> handle); |
422 V8_INLINE(void Set(Isolate* isolate, Local<S> handle)); | |
423 | 421 |
424 private: | 422 private: |
425 static const int kInitialValue = -1; | 423 static const int kInitialValue = -1; |
426 int index_; | 424 int index_; |
427 }; | 425 }; |
428 | 426 |
429 | 427 |
430 template<class T, class P> | 428 template<class T, class P> |
431 class WeakCallbackData { | 429 class WeakCallbackData { |
432 public: | 430 public: |
433 typedef void (*Callback)(const WeakCallbackData<T, P>& data); | 431 typedef void (*Callback)(const WeakCallbackData<T, P>& data); |
434 | 432 |
435 V8_INLINE(Isolate* GetIsolate()) const { return isolate_; } | 433 V8_INLINE Isolate* GetIsolate() const { return isolate_; } |
436 V8_INLINE(Local<T> GetValue()) const { return handle_; } | 434 V8_INLINE Local<T> GetValue() const { return handle_; } |
437 V8_INLINE(P* GetParameter()) const { return parameter_; } | 435 V8_INLINE P* GetParameter() const { return parameter_; } |
438 | 436 |
439 private: | 437 private: |
440 friend class internal::GlobalHandles; | 438 friend class internal::GlobalHandles; |
441 WeakCallbackData(Isolate* isolate, Local<T> handle, P* parameter) | 439 WeakCallbackData(Isolate* isolate, Local<T> handle, P* parameter) |
442 : isolate_(isolate), handle_(handle), parameter_(parameter) { } | 440 : isolate_(isolate), handle_(handle), parameter_(parameter) { } |
443 Isolate* isolate_; | 441 Isolate* isolate_; |
444 Local<T> handle_; | 442 Local<T> handle_; |
445 P* parameter_; | 443 P* parameter_; |
446 }; | 444 }; |
447 | 445 |
(...skipping 15 matching lines...) Expand all Loading... |
463 * use of the copy constructor or assignment operator. | 461 * use of the copy constructor or assignment operator. |
464 * At present kResetInDestructor is not set, but that will change in a future | 462 * At present kResetInDestructor is not set, but that will change in a future |
465 * version. | 463 * version. |
466 */ | 464 */ |
467 template<class T> | 465 template<class T> |
468 class NonCopyablePersistentTraits { | 466 class NonCopyablePersistentTraits { |
469 public: | 467 public: |
470 typedef Persistent<T, NonCopyablePersistentTraits<T> > NonCopyablePersistent; | 468 typedef Persistent<T, NonCopyablePersistentTraits<T> > NonCopyablePersistent; |
471 static const bool kResetInDestructor = false; | 469 static const bool kResetInDestructor = false; |
472 template<class S, class M> | 470 template<class S, class M> |
473 V8_INLINE(static void Copy(const Persistent<S, M>& source, | 471 V8_INLINE static void Copy(const Persistent<S, M>& source, |
474 NonCopyablePersistent* dest)) { | 472 NonCopyablePersistent* dest) { |
475 Uncompilable<Object>(); | 473 Uncompilable<Object>(); |
476 } | 474 } |
477 // TODO(dcarney): come up with a good compile error here. | 475 // TODO(dcarney): come up with a good compile error here. |
478 template<class O> | 476 template<class O> V8_INLINE static void Uncompilable() { |
479 V8_INLINE(static void Uncompilable()) { | |
480 TYPE_CHECK(O, Primitive); | 477 TYPE_CHECK(O, Primitive); |
481 } | 478 } |
482 }; | 479 }; |
483 | 480 |
484 | 481 |
485 /** | 482 /** |
486 * An object reference that is independent of any handle scope. Where | 483 * An object reference that is independent of any handle scope. Where |
487 * a Local handle only lives as long as the HandleScope in which it was | 484 * a Local handle only lives as long as the HandleScope in which it was |
488 * allocated, a Persistent handle remains valid until it is explicitly | 485 * allocated, a Persistent handle remains valid until it is explicitly |
489 * disposed. | 486 * disposed. |
490 * | 487 * |
491 * A persistent handle contains a reference to a storage cell within | 488 * A persistent handle contains a reference to a storage cell within |
492 * the v8 engine which holds an object value and which is updated by | 489 * the v8 engine which holds an object value and which is updated by |
493 * the garbage collector whenever the object is moved. A new storage | 490 * the garbage collector whenever the object is moved. A new storage |
494 * cell can be created using the constructor or Persistent::Reset and | 491 * cell can be created using the constructor or Persistent::Reset and |
495 * existing handles can be disposed using Persistent::Reset. | 492 * existing handles can be disposed using Persistent::Reset. |
496 * | 493 * |
497 * Copy, assignment and destructor bevavior is controlled by the traits | 494 * Copy, assignment and destructor bevavior is controlled by the traits |
498 * class M. | 495 * class M. |
499 */ | 496 */ |
500 template <class T, class M> class Persistent { | 497 template <class T, class M> class Persistent { |
501 public: | 498 public: |
502 /** | 499 /** |
503 * A Persistent with no storage cell. | 500 * A Persistent with no storage cell. |
504 */ | 501 */ |
505 V8_INLINE(Persistent()) : val_(0) { } | 502 V8_INLINE Persistent() : val_(0) { } |
506 /** | 503 /** |
507 * Construct a Persistent from a Handle. | 504 * Construct a Persistent from a Handle. |
508 * When the Handle is non-empty, a new storage cell is created | 505 * When the Handle is non-empty, a new storage cell is created |
509 * pointing to the same object, and no flags are set. | 506 * pointing to the same object, and no flags are set. |
510 */ | 507 */ |
511 template <class S> V8_INLINE(Persistent(Isolate* isolate, Handle<S> that)) | 508 template <class S> V8_INLINE Persistent(Isolate* isolate, Handle<S> that) |
512 : val_(New(isolate, *that)) { | 509 : val_(New(isolate, *that)) { |
513 TYPE_CHECK(T, S); | 510 TYPE_CHECK(T, S); |
514 } | 511 } |
515 /** | 512 /** |
516 * Construct a Persistent from a Persistent. | 513 * Construct a Persistent from a Persistent. |
517 * When the Persistent is non-empty, a new storage cell is created | 514 * When the Persistent is non-empty, a new storage cell is created |
518 * pointing to the same object, and no flags are set. | 515 * pointing to the same object, and no flags are set. |
519 */ | 516 */ |
520 template <class S, class M2> | 517 template <class S, class M2> |
521 V8_INLINE(Persistent(Isolate* isolate, const Persistent<S, M2>& that)) | 518 V8_INLINE Persistent(Isolate* isolate, const Persistent<S, M2>& that) |
522 : val_(New(isolate, *that)) { | 519 : val_(New(isolate, *that)) { |
523 TYPE_CHECK(T, S); | 520 TYPE_CHECK(T, S); |
524 } | 521 } |
525 /** | 522 /** |
526 * The copy constructors and assignment operator create a Persistent | 523 * The copy constructors and assignment operator create a Persistent |
527 * exactly as the Persistent constructor, but the Copy function from the | 524 * exactly as the Persistent constructor, but the Copy function from the |
528 * traits class is called, allowing the setting of flags based on the | 525 * traits class is called, allowing the setting of flags based on the |
529 * copied Persistent. | 526 * copied Persistent. |
530 */ | 527 */ |
531 V8_INLINE(Persistent(const Persistent& that)) : val_(0) { | 528 V8_INLINE Persistent(const Persistent& that) : val_(0) { |
532 Copy(that); | 529 Copy(that); |
533 } | 530 } |
534 template <class S, class M2> | 531 template <class S, class M2> |
535 V8_INLINE(Persistent(const Persistent<S, M2>& that)) : val_(0) { | 532 V8_INLINE Persistent(const Persistent<S, M2>& that) : val_(0) { |
536 Copy(that); | 533 Copy(that); |
537 } | 534 } |
538 V8_INLINE(Persistent& operator=(const Persistent& that)) { // NOLINT | 535 V8_INLINE Persistent& operator=(const Persistent& that) { // NOLINT |
539 Copy(that); | 536 Copy(that); |
540 return *this; | 537 return *this; |
541 } | 538 } |
542 template <class S, class M2> | 539 template <class S, class M2> |
543 V8_INLINE(Persistent& operator=(const Persistent<S, M2>& that)) { // NOLINT | 540 V8_INLINE Persistent& operator=(const Persistent<S, M2>& that) { // NOLINT |
544 Copy(that); | 541 Copy(that); |
545 return *this; | 542 return *this; |
546 } | 543 } |
547 /** | 544 /** |
548 * The destructor will dispose the Persistent based on the | 545 * The destructor will dispose the Persistent based on the |
549 * kResetInDestructor flags in the traits class. Since not calling dispose | 546 * kResetInDestructor flags in the traits class. Since not calling dispose |
550 * can result in a memory leak, it is recommended to always set this flag. | 547 * can result in a memory leak, it is recommended to always set this flag. |
551 */ | 548 */ |
552 V8_INLINE(~Persistent()) { | 549 V8_INLINE ~Persistent() { |
553 if (M::kResetInDestructor) Reset(); | 550 if (M::kResetInDestructor) Reset(); |
554 } | 551 } |
555 | 552 |
556 /** | 553 /** |
557 * If non-empty, destroy the underlying storage cell | 554 * If non-empty, destroy the underlying storage cell |
558 * IsEmpty() will return true after this call. | 555 * IsEmpty() will return true after this call. |
559 */ | 556 */ |
560 V8_INLINE(void Reset()); | 557 V8_INLINE void Reset(); |
561 template <class S> | |
562 /** | 558 /** |
563 * If non-empty, destroy the underlying storage cell | 559 * If non-empty, destroy the underlying storage cell |
564 * and create a new one with the contents of other if other is non empty | 560 * and create a new one with the contents of other if other is non empty |
565 */ | 561 */ |
566 V8_INLINE(void Reset(Isolate* isolate, const Handle<S>& other)); | 562 template <class S> |
| 563 V8_INLINE void Reset(Isolate* isolate, const Handle<S>& other); |
567 /** | 564 /** |
568 * If non-empty, destroy the underlying storage cell | 565 * If non-empty, destroy the underlying storage cell |
569 * and create a new one with the contents of other if other is non empty | 566 * and create a new one with the contents of other if other is non empty |
570 */ | 567 */ |
571 template <class S, class M2> | 568 template <class S, class M2> |
572 V8_INLINE(void Reset(Isolate* isolate, const Persistent<S, M2>& other)); | 569 V8_INLINE void Reset(Isolate* isolate, const Persistent<S, M2>& other); |
573 // TODO(dcarney): deprecate | 570 // TODO(dcarney): deprecate |
574 V8_INLINE(void Dispose()) { Reset(); } | 571 V8_INLINE void Dispose() { Reset(); } |
575 V8_DEPRECATED(V8_INLINE(void Dispose(Isolate* isolate))) { Reset(); } | 572 V8_DEPRECATED(V8_INLINE void Dispose(Isolate* isolate)) { Reset(); } |
576 | 573 |
577 V8_INLINE(bool IsEmpty() const) { return val_ == 0; } | 574 V8_INLINE bool IsEmpty() const { return val_ == 0; } |
578 | 575 |
579 // TODO(dcarney): this is pretty useless, fix or remove | 576 // TODO(dcarney): this is pretty useless, fix or remove |
580 template <class S> | 577 template <class S> |
581 V8_INLINE(static Persistent<T>& Cast(Persistent<S>& that)) { // NOLINT | 578 V8_INLINE static Persistent<T>& Cast(Persistent<S>& that) { // NOLINT |
582 #ifdef V8_ENABLE_CHECKS | 579 #ifdef V8_ENABLE_CHECKS |
583 // If we're going to perform the type check then we have to check | 580 // If we're going to perform the type check then we have to check |
584 // that the handle isn't empty before doing the checked cast. | 581 // that the handle isn't empty before doing the checked cast. |
585 if (!that.IsEmpty()) T::Cast(*that); | 582 if (!that.IsEmpty()) T::Cast(*that); |
586 #endif | 583 #endif |
587 return reinterpret_cast<Persistent<T>&>(that); | 584 return reinterpret_cast<Persistent<T>&>(that); |
588 } | 585 } |
589 | 586 |
590 // TODO(dcarney): this is pretty useless, fix or remove | 587 // TODO(dcarney): this is pretty useless, fix or remove |
591 template <class S> V8_INLINE(Persistent<S>& As()) { // NOLINT | 588 template <class S> V8_INLINE Persistent<S>& As() { // NOLINT |
592 return Persistent<S>::Cast(*this); | 589 return Persistent<S>::Cast(*this); |
593 } | 590 } |
594 | 591 |
595 template <class S, class M2> V8_INLINE( | 592 template <class S, class M2> |
596 bool operator==(const Persistent<S, M2>& that) const) { | 593 V8_INLINE bool operator==(const Persistent<S, M2>& that) const { |
597 internal::Object** a = reinterpret_cast<internal::Object**>(**this); | 594 internal::Object** a = reinterpret_cast<internal::Object**>(**this); |
598 internal::Object** b = reinterpret_cast<internal::Object**>(*that); | 595 internal::Object** b = reinterpret_cast<internal::Object**>(*that); |
599 if (a == 0) return b == 0; | 596 if (a == 0) return b == 0; |
600 if (b == 0) return false; | 597 if (b == 0) return false; |
601 return *a == *b; | 598 return *a == *b; |
602 } | 599 } |
603 | 600 |
604 template <class S> V8_INLINE(bool operator==(const Handle<S>& that) const) { | 601 template <class S> V8_INLINE bool operator==(const Handle<S>& that) const { |
605 internal::Object** a = reinterpret_cast<internal::Object**>(**this); | 602 internal::Object** a = reinterpret_cast<internal::Object**>(**this); |
606 internal::Object** b = reinterpret_cast<internal::Object**>(*that); | 603 internal::Object** b = reinterpret_cast<internal::Object**>(*that); |
607 if (a == 0) return b == 0; | 604 if (a == 0) return b == 0; |
608 if (b == 0) return false; | 605 if (b == 0) return false; |
609 return *a == *b; | 606 return *a == *b; |
610 } | 607 } |
611 | 608 |
612 template <class S, class M2> V8_INLINE( | 609 template <class S, class M2> |
613 bool operator!=(const Persistent<S, M2>& that) const) { | 610 V8_INLINE bool operator!=(const Persistent<S, M2>& that) const { |
614 return !operator==(that); | 611 return !operator==(that); |
615 } | 612 } |
616 | 613 |
617 template <class S> V8_INLINE(bool operator!=(const Handle<S>& that) const) { | 614 template <class S> V8_INLINE bool operator!=(const Handle<S>& that) const { |
618 return !operator==(that); | 615 return !operator==(that); |
619 } | 616 } |
620 | 617 |
621 template<typename P> | 618 template<typename P> |
622 V8_INLINE(void SetWeak( | 619 V8_INLINE void SetWeak( |
623 P* parameter, | 620 P* parameter, |
624 typename WeakCallbackData<T, P>::Callback callback)); | 621 typename WeakCallbackData<T, P>::Callback callback); |
625 | 622 |
626 template<typename S, typename P> | 623 template<typename S, typename P> |
627 V8_INLINE(void SetWeak( | 624 V8_INLINE void SetWeak( |
628 P* parameter, | 625 P* parameter, |
629 typename WeakCallbackData<S, P>::Callback callback)); | 626 typename WeakCallbackData<S, P>::Callback callback); |
630 | 627 |
631 // TODO(dcarney): deprecate | 628 // TODO(dcarney): deprecate |
632 template<typename S, typename P> | 629 template<typename S, typename P> |
633 V8_INLINE(void MakeWeak( | 630 V8_INLINE void MakeWeak( |
634 P* parameter, | 631 P* parameter, |
635 typename WeakReferenceCallbacks<S, P>::Revivable callback)); | 632 typename WeakReferenceCallbacks<S, P>::Revivable callback); |
636 | 633 |
637 // TODO(dcarney): deprecate | 634 // TODO(dcarney): deprecate |
638 template<typename P> | 635 template<typename P> |
639 V8_INLINE(void MakeWeak( | 636 V8_INLINE void MakeWeak( |
640 P* parameter, | 637 P* parameter, |
641 typename WeakReferenceCallbacks<T, P>::Revivable callback)); | 638 typename WeakReferenceCallbacks<T, P>::Revivable callback); |
642 | 639 |
643 V8_INLINE(void ClearWeak()); | 640 V8_INLINE void ClearWeak(); |
644 | 641 |
645 V8_DEPRECATED(V8_INLINE(void ClearWeak(Isolate* isolate))) { ClearWeak(); } | 642 V8_DEPRECATED(V8_INLINE void ClearWeak(Isolate* isolate)) { ClearWeak(); } |
646 | 643 |
647 /** | 644 /** |
648 * Marks the reference to this object independent. Garbage collector is free | 645 * Marks the reference to this object independent. Garbage collector is free |
649 * to ignore any object groups containing this object. Weak callback for an | 646 * to ignore any object groups containing this object. Weak callback for an |
650 * independent handle should not assume that it will be preceded by a global | 647 * independent handle should not assume that it will be preceded by a global |
651 * GC prologue callback or followed by a global GC epilogue callback. | 648 * GC prologue callback or followed by a global GC epilogue callback. |
652 */ | 649 */ |
653 V8_INLINE(void MarkIndependent()); | 650 V8_INLINE void MarkIndependent(); |
654 | 651 |
655 V8_DEPRECATED(V8_INLINE(void MarkIndependent(Isolate* isolate))) { | 652 V8_DEPRECATED(V8_INLINE void MarkIndependent(Isolate* isolate)) { |
656 MarkIndependent(); | 653 MarkIndependent(); |
657 } | 654 } |
658 | 655 |
659 /** | 656 /** |
660 * Marks the reference to this object partially dependent. Partially dependent | 657 * Marks the reference to this object partially dependent. Partially dependent |
661 * handles only depend on other partially dependent handles and these | 658 * handles only depend on other partially dependent handles and these |
662 * dependencies are provided through object groups. It provides a way to build | 659 * dependencies are provided through object groups. It provides a way to build |
663 * smaller object groups for young objects that represent only a subset of all | 660 * smaller object groups for young objects that represent only a subset of all |
664 * external dependencies. This mark is automatically cleared after each | 661 * external dependencies. This mark is automatically cleared after each |
665 * garbage collection. | 662 * garbage collection. |
666 */ | 663 */ |
667 V8_INLINE(void MarkPartiallyDependent()); | 664 V8_INLINE void MarkPartiallyDependent(); |
668 | 665 |
669 V8_DEPRECATED(V8_INLINE(void MarkPartiallyDependent(Isolate* isolate))) { | 666 V8_DEPRECATED(V8_INLINE void MarkPartiallyDependent(Isolate* isolate)) { |
670 MarkPartiallyDependent(); | 667 MarkPartiallyDependent(); |
671 } | 668 } |
672 | 669 |
673 V8_INLINE(bool IsIndependent() const); | 670 V8_INLINE bool IsIndependent() const; |
674 | 671 |
675 V8_DEPRECATED(V8_INLINE(bool IsIndependent(Isolate* isolate)) const) { | 672 V8_DEPRECATED(V8_INLINE bool IsIndependent(Isolate* isolate) const) { |
676 return IsIndependent(); | 673 return IsIndependent(); |
677 } | 674 } |
678 | 675 |
679 /** Checks if the handle holds the only reference to an object. */ | 676 /** Checks if the handle holds the only reference to an object. */ |
680 V8_INLINE(bool IsNearDeath() const); | 677 V8_INLINE bool IsNearDeath() const; |
681 | 678 |
682 V8_DEPRECATED(V8_INLINE(bool IsNearDeath(Isolate* isolate)) const) { | 679 V8_DEPRECATED(V8_INLINE bool IsNearDeath(Isolate* isolate) const) { |
683 return IsNearDeath(); | 680 return IsNearDeath(); |
684 } | 681 } |
685 | 682 |
686 /** Returns true if the handle's reference is weak. */ | 683 /** Returns true if the handle's reference is weak. */ |
687 V8_INLINE(bool IsWeak() const); | 684 V8_INLINE bool IsWeak() const; |
688 | 685 |
689 V8_DEPRECATED(V8_INLINE(bool IsWeak(Isolate* isolate)) const) { | 686 V8_DEPRECATED(V8_INLINE bool IsWeak(Isolate* isolate) const) { |
690 return IsWeak(); | 687 return IsWeak(); |
691 } | 688 } |
692 | 689 |
693 /** | 690 /** |
694 * Assigns a wrapper class ID to the handle. See RetainedObjectInfo interface | 691 * Assigns a wrapper class ID to the handle. See RetainedObjectInfo interface |
695 * description in v8-profiler.h for details. | 692 * description in v8-profiler.h for details. |
696 */ | 693 */ |
697 V8_INLINE(void SetWrapperClassId(uint16_t class_id)); | 694 V8_INLINE void SetWrapperClassId(uint16_t class_id); |
698 | 695 |
699 V8_DEPRECATED( | 696 V8_DEPRECATED( |
700 V8_INLINE(void SetWrapperClassId(Isolate * isolate, uint16_t class_id))) { | 697 V8_INLINE void SetWrapperClassId(Isolate * isolate, uint16_t class_id)) { |
701 SetWrapperClassId(class_id); | 698 SetWrapperClassId(class_id); |
702 } | 699 } |
703 | 700 |
704 /** | 701 /** |
705 * Returns the class ID previously assigned to this handle or 0 if no class ID | 702 * Returns the class ID previously assigned to this handle or 0 if no class ID |
706 * was previously assigned. | 703 * was previously assigned. |
707 */ | 704 */ |
708 V8_INLINE(uint16_t WrapperClassId() const); | 705 V8_INLINE uint16_t WrapperClassId() const; |
709 | 706 |
710 V8_DEPRECATED(V8_INLINE(uint16_t WrapperClassId(Isolate* isolate)) const) { | 707 V8_DEPRECATED(V8_INLINE uint16_t WrapperClassId(Isolate* isolate) const) { |
711 return WrapperClassId(); | 708 return WrapperClassId(); |
712 } | 709 } |
713 | 710 |
714 // TODO(dcarney): remove | 711 // TODO(dcarney): remove |
715 V8_INLINE(T* ClearAndLeak()); | 712 V8_INLINE T* ClearAndLeak(); |
716 | 713 |
717 // TODO(dcarney): remove | 714 // TODO(dcarney): remove |
718 V8_INLINE(void Clear()) { val_ = 0; } | 715 V8_INLINE void Clear() { val_ = 0; } |
719 | 716 |
720 // TODO(dcarney): remove | 717 // TODO(dcarney): remove |
721 #ifndef V8_ALLOW_ACCESS_TO_RAW_HANDLE_CONSTRUCTOR | 718 #ifndef V8_ALLOW_ACCESS_TO_RAW_HANDLE_CONSTRUCTOR |
722 | 719 |
723 private: | 720 private: |
724 #endif | 721 #endif |
725 template <class S> V8_INLINE(Persistent(S* that)) : val_(that) { } | 722 template <class S> V8_INLINE Persistent(S* that) : val_(that) { } |
726 | 723 |
727 V8_INLINE(T* operator*() const) { return val_; } | 724 V8_INLINE T* operator*() const { return val_; } |
728 | 725 |
729 private: | 726 private: |
730 friend class Utils; | 727 friend class Utils; |
731 template<class F> friend class Handle; | 728 template<class F> friend class Handle; |
732 template<class F> friend class Local; | 729 template<class F> friend class Local; |
733 template<class F1, class F2> friend class Persistent; | 730 template<class F1, class F2> friend class Persistent; |
734 template<class F> friend class ReturnValue; | 731 template<class F> friend class ReturnValue; |
735 | 732 |
736 V8_INLINE(static T* New(Isolate* isolate, T* that)); | 733 V8_INLINE static T* New(Isolate* isolate, T* that); |
737 template<class S, class M2> | 734 template<class S, class M2> |
738 V8_INLINE(void Copy(const Persistent<S, M2>& that)); | 735 V8_INLINE void Copy(const Persistent<S, M2>& that); |
739 | 736 |
740 T* val_; | 737 T* val_; |
741 }; | 738 }; |
742 | 739 |
743 /** | 740 /** |
744 * A stack-allocated class that governs a number of local handles. | 741 * A stack-allocated class that governs a number of local handles. |
745 * After a handle scope has been created, all local handles will be | 742 * After a handle scope has been created, all local handles will be |
746 * allocated within that handle scope until either the handle scope is | 743 * allocated within that handle scope until either the handle scope is |
747 * deleted or another handle scope is created. If there is already a | 744 * deleted or another handle scope is created. If there is already a |
748 * handle scope and a new one is created, all allocations will take | 745 * handle scope and a new one is created, all allocations will take |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
788 void* operator new(size_t size); | 785 void* operator new(size_t size); |
789 void operator delete(void*, size_t); | 786 void operator delete(void*, size_t); |
790 | 787 |
791 // This Data class is accessible internally as HandleScopeData through a | 788 // This Data class is accessible internally as HandleScopeData through a |
792 // typedef in the ImplementationUtilities class. | 789 // typedef in the ImplementationUtilities class. |
793 class V8_EXPORT Data { | 790 class V8_EXPORT Data { |
794 public: | 791 public: |
795 internal::Object** next; | 792 internal::Object** next; |
796 internal::Object** limit; | 793 internal::Object** limit; |
797 int level; | 794 int level; |
798 V8_INLINE(void Initialize()) { | 795 V8_INLINE void Initialize() { |
799 next = limit = NULL; | 796 next = limit = NULL; |
800 level = 0; | 797 level = 0; |
801 } | 798 } |
802 }; | 799 }; |
803 | 800 |
804 void Initialize(Isolate* isolate); | 801 void Initialize(Isolate* isolate); |
805 void Leave(); | 802 void Leave(); |
806 | 803 |
807 internal::Isolate* isolate_; | 804 internal::Isolate* isolate_; |
808 internal::Object** prev_next_; | 805 internal::Object** prev_next_; |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
897 */ | 894 */ |
898 virtual bool HasError() = 0; | 895 virtual bool HasError() = 0; |
899 }; | 896 }; |
900 | 897 |
901 | 898 |
902 /** | 899 /** |
903 * The origin, within a file, of a script. | 900 * The origin, within a file, of a script. |
904 */ | 901 */ |
905 class ScriptOrigin { | 902 class ScriptOrigin { |
906 public: | 903 public: |
907 V8_INLINE(ScriptOrigin( | 904 V8_INLINE ScriptOrigin( |
908 Handle<Value> resource_name, | 905 Handle<Value> resource_name, |
909 Handle<Integer> resource_line_offset = Handle<Integer>(), | 906 Handle<Integer> resource_line_offset = Handle<Integer>(), |
910 Handle<Integer> resource_column_offset = Handle<Integer>(), | 907 Handle<Integer> resource_column_offset = Handle<Integer>(), |
911 Handle<Boolean> resource_is_shared_cross_origin = Handle<Boolean>())) | 908 Handle<Boolean> resource_is_shared_cross_origin = Handle<Boolean>()) |
912 : resource_name_(resource_name), | 909 : resource_name_(resource_name), |
913 resource_line_offset_(resource_line_offset), | 910 resource_line_offset_(resource_line_offset), |
914 resource_column_offset_(resource_column_offset), | 911 resource_column_offset_(resource_column_offset), |
915 resource_is_shared_cross_origin_(resource_is_shared_cross_origin) { } | 912 resource_is_shared_cross_origin_(resource_is_shared_cross_origin) { } |
916 V8_INLINE(Handle<Value> ResourceName() const); | 913 V8_INLINE Handle<Value> ResourceName() const; |
917 V8_INLINE(Handle<Integer> ResourceLineOffset() const); | 914 V8_INLINE Handle<Integer> ResourceLineOffset() const; |
918 V8_INLINE(Handle<Integer> ResourceColumnOffset() const); | 915 V8_INLINE Handle<Integer> ResourceColumnOffset() const; |
919 V8_INLINE(Handle<Boolean> ResourceIsSharedCrossOrigin() const); | 916 V8_INLINE Handle<Boolean> ResourceIsSharedCrossOrigin() const; |
920 private: | 917 private: |
921 Handle<Value> resource_name_; | 918 Handle<Value> resource_name_; |
922 Handle<Integer> resource_line_offset_; | 919 Handle<Integer> resource_line_offset_; |
923 Handle<Integer> resource_column_offset_; | 920 Handle<Integer> resource_column_offset_; |
924 Handle<Boolean> resource_is_shared_cross_origin_; | 921 Handle<Boolean> resource_is_shared_cross_origin_; |
925 }; | 922 }; |
926 | 923 |
927 | 924 |
928 /** | 925 /** |
929 * A compiled JavaScript script. | 926 * A compiled JavaScript script. |
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1250 | 1247 |
1251 /** | 1248 /** |
1252 * The superclass of all JavaScript values and objects. | 1249 * The superclass of all JavaScript values and objects. |
1253 */ | 1250 */ |
1254 class V8_EXPORT Value : public Data { | 1251 class V8_EXPORT Value : public Data { |
1255 public: | 1252 public: |
1256 /** | 1253 /** |
1257 * Returns true if this value is the undefined value. See ECMA-262 | 1254 * Returns true if this value is the undefined value. See ECMA-262 |
1258 * 4.3.10. | 1255 * 4.3.10. |
1259 */ | 1256 */ |
1260 V8_INLINE(bool IsUndefined() const); | 1257 V8_INLINE bool IsUndefined() const; |
1261 | 1258 |
1262 /** | 1259 /** |
1263 * Returns true if this value is the null value. See ECMA-262 | 1260 * Returns true if this value is the null value. See ECMA-262 |
1264 * 4.3.11. | 1261 * 4.3.11. |
1265 */ | 1262 */ |
1266 V8_INLINE(bool IsNull() const); | 1263 V8_INLINE bool IsNull() const; |
1267 | 1264 |
1268 /** | 1265 /** |
1269 * Returns true if this value is true. | 1266 * Returns true if this value is true. |
1270 */ | 1267 */ |
1271 bool IsTrue() const; | 1268 bool IsTrue() const; |
1272 | 1269 |
1273 /** | 1270 /** |
1274 * Returns true if this value is false. | 1271 * Returns true if this value is false. |
1275 */ | 1272 */ |
1276 bool IsFalse() const; | 1273 bool IsFalse() const; |
1277 | 1274 |
1278 /** | 1275 /** |
1279 * Returns true if this value is an instance of the String type. | 1276 * Returns true if this value is an instance of the String type. |
1280 * See ECMA-262 8.4. | 1277 * See ECMA-262 8.4. |
1281 */ | 1278 */ |
1282 V8_INLINE(bool IsString() const); | 1279 V8_INLINE bool IsString() const; |
1283 | 1280 |
1284 /** | 1281 /** |
1285 * Returns true if this value is a symbol. | 1282 * Returns true if this value is a symbol. |
1286 * This is an experimental feature. | 1283 * This is an experimental feature. |
1287 */ | 1284 */ |
1288 bool IsSymbol() const; | 1285 bool IsSymbol() const; |
1289 | 1286 |
1290 /** | 1287 /** |
1291 * Returns true if this value is a function. | 1288 * Returns true if this value is a function. |
1292 */ | 1289 */ |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1460 bool BooleanValue() const; | 1457 bool BooleanValue() const; |
1461 double NumberValue() const; | 1458 double NumberValue() const; |
1462 int64_t IntegerValue() const; | 1459 int64_t IntegerValue() const; |
1463 uint32_t Uint32Value() const; | 1460 uint32_t Uint32Value() const; |
1464 int32_t Int32Value() const; | 1461 int32_t Int32Value() const; |
1465 | 1462 |
1466 /** JS == */ | 1463 /** JS == */ |
1467 bool Equals(Handle<Value> that) const; | 1464 bool Equals(Handle<Value> that) const; |
1468 bool StrictEquals(Handle<Value> that) const; | 1465 bool StrictEquals(Handle<Value> that) const; |
1469 | 1466 |
1470 template <class T> V8_INLINE(static Value* Cast(T* value)); | 1467 template <class T> V8_INLINE static Value* Cast(T* value); |
1471 | 1468 |
1472 private: | 1469 private: |
1473 V8_INLINE(bool QuickIsUndefined() const); | 1470 V8_INLINE bool QuickIsUndefined() const; |
1474 V8_INLINE(bool QuickIsNull() const); | 1471 V8_INLINE bool QuickIsNull() const; |
1475 V8_INLINE(bool QuickIsString() const); | 1472 V8_INLINE bool QuickIsString() const; |
1476 bool FullIsUndefined() const; | 1473 bool FullIsUndefined() const; |
1477 bool FullIsNull() const; | 1474 bool FullIsNull() const; |
1478 bool FullIsString() const; | 1475 bool FullIsString() const; |
1479 }; | 1476 }; |
1480 | 1477 |
1481 | 1478 |
1482 /** | 1479 /** |
1483 * The superclass of primitive values. See ECMA-262 4.3.2. | 1480 * The superclass of primitive values. See ECMA-262 4.3.2. |
1484 */ | 1481 */ |
1485 class V8_EXPORT Primitive : public Value { }; | 1482 class V8_EXPORT Primitive : public Value { }; |
1486 | 1483 |
1487 | 1484 |
1488 /** | 1485 /** |
1489 * A primitive boolean value (ECMA-262, 4.3.14). Either the true | 1486 * A primitive boolean value (ECMA-262, 4.3.14). Either the true |
1490 * or false value. | 1487 * or false value. |
1491 */ | 1488 */ |
1492 class V8_EXPORT Boolean : public Primitive { | 1489 class V8_EXPORT Boolean : public Primitive { |
1493 public: | 1490 public: |
1494 bool Value() const; | 1491 bool Value() const; |
1495 V8_INLINE(static Handle<Boolean> New(bool value)); | 1492 V8_INLINE static Handle<Boolean> New(bool value); |
1496 }; | 1493 }; |
1497 | 1494 |
1498 | 1495 |
1499 /** | 1496 /** |
1500 * A JavaScript string value (ECMA-262, 4.3.17). | 1497 * A JavaScript string value (ECMA-262, 4.3.17). |
1501 */ | 1498 */ |
1502 class V8_EXPORT String : public Primitive { | 1499 class V8_EXPORT String : public Primitive { |
1503 public: | 1500 public: |
1504 enum Encoding { | 1501 enum Encoding { |
1505 UNKNOWN_ENCODING = 0x1, | 1502 UNKNOWN_ENCODING = 0x1, |
1506 TWO_BYTE_ENCODING = 0x0, | 1503 TWO_BYTE_ENCODING = 0x0, |
1507 ASCII_ENCODING = 0x4, | 1504 ASCII_ENCODING = 0x4, |
1508 ONE_BYTE_ENCODING = 0x4 | 1505 ONE_BYTE_ENCODING = 0x4 |
1509 }; | 1506 }; |
1510 /** | 1507 /** |
1511 * Returns the number of characters in this string. | 1508 * Returns the number of characters in this string. |
1512 */ | 1509 */ |
1513 int Length() const; | 1510 int Length() const; |
1514 | 1511 |
1515 /** | 1512 /** |
1516 * Returns the number of bytes in the UTF-8 encoded | 1513 * Returns the number of bytes in the UTF-8 encoded |
1517 * representation of this string. | 1514 * representation of this string. |
1518 */ | 1515 */ |
1519 int Utf8Length() const; | 1516 int Utf8Length() const; |
1520 | 1517 |
1521 /** | 1518 /** |
1522 * This function is no longer useful. | 1519 * This function is no longer useful. |
1523 */ | 1520 */ |
1524 V8_DEPRECATED(V8_INLINE(bool MayContainNonAscii()) const) { return true; } | 1521 V8_DEPRECATED(V8_INLINE bool MayContainNonAscii() const) { return true; } |
1525 | 1522 |
1526 /** | 1523 /** |
1527 * Returns whether this string is known to contain only one byte data. | 1524 * Returns whether this string is known to contain only one byte data. |
1528 * Does not read the string. | 1525 * Does not read the string. |
1529 * False negatives are possible. | 1526 * False negatives are possible. |
1530 */ | 1527 */ |
1531 bool IsOneByte() const; | 1528 bool IsOneByte() const; |
1532 | 1529 |
1533 /** | 1530 /** |
1534 * Returns whether this string contain only one byte data. | 1531 * Returns whether this string contain only one byte data. |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1586 // UTF-8 encoded characters. | 1583 // UTF-8 encoded characters. |
1587 int WriteUtf8(char* buffer, | 1584 int WriteUtf8(char* buffer, |
1588 int length = -1, | 1585 int length = -1, |
1589 int* nchars_ref = NULL, | 1586 int* nchars_ref = NULL, |
1590 int options = NO_OPTIONS) const; | 1587 int options = NO_OPTIONS) const; |
1591 | 1588 |
1592 /** | 1589 /** |
1593 * A zero length string. | 1590 * A zero length string. |
1594 */ | 1591 */ |
1595 static v8::Local<v8::String> Empty(); | 1592 static v8::Local<v8::String> Empty(); |
1596 V8_INLINE(static v8::Local<v8::String> Empty(Isolate* isolate)); | 1593 V8_INLINE static v8::Local<v8::String> Empty(Isolate* isolate); |
1597 | 1594 |
1598 /** | 1595 /** |
1599 * Returns true if the string is external | 1596 * Returns true if the string is external |
1600 */ | 1597 */ |
1601 bool IsExternal() const; | 1598 bool IsExternal() const; |
1602 | 1599 |
1603 /** | 1600 /** |
1604 * Returns true if the string is both external and ASCII | 1601 * Returns true if the string is both external and ASCII |
1605 */ | 1602 */ |
1606 bool IsExternalAscii() const; | 1603 bool IsExternalAscii() const; |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1684 ExternalAsciiStringResource() {} | 1681 ExternalAsciiStringResource() {} |
1685 }; | 1682 }; |
1686 | 1683 |
1687 typedef ExternalAsciiStringResource ExternalOneByteStringResource; | 1684 typedef ExternalAsciiStringResource ExternalOneByteStringResource; |
1688 | 1685 |
1689 /** | 1686 /** |
1690 * If the string is an external string, return the ExternalStringResourceBase | 1687 * If the string is an external string, return the ExternalStringResourceBase |
1691 * regardless of the encoding, otherwise return NULL. The encoding of the | 1688 * regardless of the encoding, otherwise return NULL. The encoding of the |
1692 * string is returned in encoding_out. | 1689 * string is returned in encoding_out. |
1693 */ | 1690 */ |
1694 V8_INLINE(ExternalStringResourceBase* GetExternalStringResourceBase( | 1691 V8_INLINE ExternalStringResourceBase* GetExternalStringResourceBase( |
1695 Encoding* encoding_out) const); | 1692 Encoding* encoding_out) const; |
1696 | 1693 |
1697 /** | 1694 /** |
1698 * Get the ExternalStringResource for an external string. Returns | 1695 * Get the ExternalStringResource for an external string. Returns |
1699 * NULL if IsExternal() doesn't return true. | 1696 * NULL if IsExternal() doesn't return true. |
1700 */ | 1697 */ |
1701 V8_INLINE(ExternalStringResource* GetExternalStringResource() const); | 1698 V8_INLINE ExternalStringResource* GetExternalStringResource() const; |
1702 | 1699 |
1703 /** | 1700 /** |
1704 * Get the ExternalAsciiStringResource for an external ASCII string. | 1701 * Get the ExternalAsciiStringResource for an external ASCII string. |
1705 * Returns NULL if IsExternalAscii() doesn't return true. | 1702 * Returns NULL if IsExternalAscii() doesn't return true. |
1706 */ | 1703 */ |
1707 const ExternalAsciiStringResource* GetExternalAsciiStringResource() const; | 1704 const ExternalAsciiStringResource* GetExternalAsciiStringResource() const; |
1708 | 1705 |
1709 V8_INLINE(static String* Cast(v8::Value* obj)); | 1706 V8_INLINE static String* Cast(v8::Value* obj); |
1710 | 1707 |
1711 // TODO(dcarney): deprecate | 1708 // TODO(dcarney): deprecate |
1712 /** | 1709 /** |
1713 * Allocates a new string from either UTF-8 encoded or ASCII data. | 1710 * Allocates a new string from either UTF-8 encoded or ASCII data. |
1714 * The second parameter 'length' gives the buffer length. If omitted, | 1711 * The second parameter 'length' gives the buffer length. If omitted, |
1715 * the function calls 'strlen' to determine the buffer length. | 1712 * the function calls 'strlen' to determine the buffer length. |
1716 */ | 1713 */ |
1717 V8_INLINE(static Local<String> New(const char* data, int length = -1)); | 1714 V8_INLINE static Local<String> New(const char* data, int length = -1); |
1718 | 1715 |
1719 // TODO(dcarney): deprecate | 1716 // TODO(dcarney): deprecate |
1720 /** Allocates a new string from 16-bit character codes.*/ | 1717 /** Allocates a new string from 16-bit character codes.*/ |
1721 V8_INLINE(static Local<String> New(const uint16_t* data, int length = -1)); | 1718 V8_INLINE static Local<String> New(const uint16_t* data, int length = -1); |
1722 | 1719 |
1723 // TODO(dcarney): deprecate | 1720 // TODO(dcarney): deprecate |
1724 /** | 1721 /** |
1725 * Creates an internalized string (historically called a "symbol", | 1722 * Creates an internalized string (historically called a "symbol", |
1726 * not to be confused with ES6 symbols). Returns one if it exists already. | 1723 * not to be confused with ES6 symbols). Returns one if it exists already. |
1727 */ | 1724 */ |
1728 V8_INLINE(static Local<String> NewSymbol(const char* data, int length = -1)); | 1725 V8_INLINE static Local<String> NewSymbol(const char* data, int length = -1); |
1729 | 1726 |
1730 enum NewStringType { | 1727 enum NewStringType { |
1731 kNormalString, kInternalizedString, kUndetectableString | 1728 kNormalString, kInternalizedString, kUndetectableString |
1732 }; | 1729 }; |
1733 | 1730 |
1734 /** Allocates a new string from UTF-8 data.*/ | 1731 /** Allocates a new string from UTF-8 data.*/ |
1735 static Local<String> NewFromUtf8(Isolate* isolate, | 1732 static Local<String> NewFromUtf8(Isolate* isolate, |
1736 const char* data, | 1733 const char* data, |
1737 NewStringType type = kNormalString, | 1734 NewStringType type = kNormalString, |
1738 int length = -1); | 1735 int length = -1); |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1799 */ | 1796 */ |
1800 bool MakeExternal(ExternalAsciiStringResource* resource); | 1797 bool MakeExternal(ExternalAsciiStringResource* resource); |
1801 | 1798 |
1802 /** | 1799 /** |
1803 * Returns true if this string can be made external. | 1800 * Returns true if this string can be made external. |
1804 */ | 1801 */ |
1805 bool CanMakeExternal(); | 1802 bool CanMakeExternal(); |
1806 | 1803 |
1807 // TODO(dcarney): deprecate | 1804 // TODO(dcarney): deprecate |
1808 /** Creates an undetectable string from the supplied ASCII or UTF-8 data.*/ | 1805 /** Creates an undetectable string from the supplied ASCII or UTF-8 data.*/ |
1809 V8_INLINE( | 1806 V8_INLINE static Local<String> NewUndetectable(const char* data, |
1810 static Local<String> NewUndetectable(const char* data, int length = -1)); | 1807 int length = -1); |
1811 | 1808 |
1812 // TODO(dcarney): deprecate | 1809 // TODO(dcarney): deprecate |
1813 /** Creates an undetectable string from the supplied 16-bit character codes.*/ | 1810 /** Creates an undetectable string from the supplied 16-bit character codes.*/ |
1814 V8_INLINE(static Local<String> NewUndetectable( | 1811 V8_INLINE static Local<String> NewUndetectable(const uint16_t* data, |
1815 const uint16_t* data, int length = -1)); | 1812 int length = -1); |
1816 | 1813 |
1817 /** | 1814 /** |
1818 * Converts an object to a UTF-8-encoded character array. Useful if | 1815 * Converts an object to a UTF-8-encoded character array. Useful if |
1819 * you want to print the object. If conversion to a string fails | 1816 * you want to print the object. If conversion to a string fails |
1820 * (e.g. due to an exception in the toString() method of the object) | 1817 * (e.g. due to an exception in the toString() method of the object) |
1821 * then the length() method returns 0 and the * operator returns | 1818 * then the length() method returns 0 and the * operator returns |
1822 * NULL. | 1819 * NULL. |
1823 */ | 1820 */ |
1824 class V8_EXPORT Utf8Value { | 1821 class V8_EXPORT Utf8Value { |
1825 public: | 1822 public: |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1900 public: | 1897 public: |
1901 // Returns the print name string of the symbol, or undefined if none. | 1898 // Returns the print name string of the symbol, or undefined if none. |
1902 Local<Value> Name() const; | 1899 Local<Value> Name() const; |
1903 | 1900 |
1904 // Create a symbol without a print name. | 1901 // Create a symbol without a print name. |
1905 static Local<Symbol> New(Isolate* isolate); | 1902 static Local<Symbol> New(Isolate* isolate); |
1906 | 1903 |
1907 // Create a symbol with a print name. | 1904 // Create a symbol with a print name. |
1908 static Local<Symbol> New(Isolate *isolate, const char* data, int length = -1); | 1905 static Local<Symbol> New(Isolate *isolate, const char* data, int length = -1); |
1909 | 1906 |
1910 V8_INLINE(static Symbol* Cast(v8::Value* obj)); | 1907 V8_INLINE static Symbol* Cast(v8::Value* obj); |
1911 private: | 1908 private: |
1912 Symbol(); | 1909 Symbol(); |
1913 static void CheckCast(v8::Value* obj); | 1910 static void CheckCast(v8::Value* obj); |
1914 }; | 1911 }; |
1915 | 1912 |
1916 | 1913 |
1917 /** | 1914 /** |
1918 * A JavaScript number value (ECMA-262, 4.3.20) | 1915 * A JavaScript number value (ECMA-262, 4.3.20) |
1919 */ | 1916 */ |
1920 class V8_EXPORT Number : public Primitive { | 1917 class V8_EXPORT Number : public Primitive { |
1921 public: | 1918 public: |
1922 double Value() const; | 1919 double Value() const; |
1923 static Local<Number> New(double value); | 1920 static Local<Number> New(double value); |
1924 static Local<Number> New(Isolate* isolate, double value); | 1921 static Local<Number> New(Isolate* isolate, double value); |
1925 V8_INLINE(static Number* Cast(v8::Value* obj)); | 1922 V8_INLINE static Number* Cast(v8::Value* obj); |
1926 private: | 1923 private: |
1927 Number(); | 1924 Number(); |
1928 static void CheckCast(v8::Value* obj); | 1925 static void CheckCast(v8::Value* obj); |
1929 }; | 1926 }; |
1930 | 1927 |
1931 | 1928 |
1932 /** | 1929 /** |
1933 * A JavaScript value representing a signed integer. | 1930 * A JavaScript value representing a signed integer. |
1934 */ | 1931 */ |
1935 class V8_EXPORT Integer : public Number { | 1932 class V8_EXPORT Integer : public Number { |
1936 public: | 1933 public: |
1937 static Local<Integer> New(int32_t value); | 1934 static Local<Integer> New(int32_t value); |
1938 static Local<Integer> NewFromUnsigned(uint32_t value); | 1935 static Local<Integer> NewFromUnsigned(uint32_t value); |
1939 static Local<Integer> New(int32_t value, Isolate*); | 1936 static Local<Integer> New(int32_t value, Isolate*); |
1940 static Local<Integer> NewFromUnsigned(uint32_t value, Isolate*); | 1937 static Local<Integer> NewFromUnsigned(uint32_t value, Isolate*); |
1941 int64_t Value() const; | 1938 int64_t Value() const; |
1942 V8_INLINE(static Integer* Cast(v8::Value* obj)); | 1939 V8_INLINE static Integer* Cast(v8::Value* obj); |
1943 private: | 1940 private: |
1944 Integer(); | 1941 Integer(); |
1945 static void CheckCast(v8::Value* obj); | 1942 static void CheckCast(v8::Value* obj); |
1946 }; | 1943 }; |
1947 | 1944 |
1948 | 1945 |
1949 /** | 1946 /** |
1950 * A JavaScript value representing a 32-bit signed integer. | 1947 * A JavaScript value representing a 32-bit signed integer. |
1951 */ | 1948 */ |
1952 class V8_EXPORT Int32 : public Integer { | 1949 class V8_EXPORT Int32 : public Integer { |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2133 | 2130 |
2134 /** | 2131 /** |
2135 * Returns the name of the function invoked as a constructor for this object. | 2132 * Returns the name of the function invoked as a constructor for this object. |
2136 */ | 2133 */ |
2137 Local<String> GetConstructorName(); | 2134 Local<String> GetConstructorName(); |
2138 | 2135 |
2139 /** Gets the number of internal fields for this Object. */ | 2136 /** Gets the number of internal fields for this Object. */ |
2140 int InternalFieldCount(); | 2137 int InternalFieldCount(); |
2141 | 2138 |
2142 /** Gets the value from an internal field. */ | 2139 /** Gets the value from an internal field. */ |
2143 V8_INLINE(Local<Value> GetInternalField(int index)); | 2140 V8_INLINE Local<Value> GetInternalField(int index); |
2144 | 2141 |
2145 /** Sets the value in an internal field. */ | 2142 /** Sets the value in an internal field. */ |
2146 void SetInternalField(int index, Handle<Value> value); | 2143 void SetInternalField(int index, Handle<Value> value); |
2147 | 2144 |
2148 /** | 2145 /** |
2149 * Gets a 2-byte-aligned native pointer from an internal field. This field | 2146 * Gets a 2-byte-aligned native pointer from an internal field. This field |
2150 * must have been set by SetAlignedPointerInInternalField, everything else | 2147 * must have been set by SetAlignedPointerInInternalField, everything else |
2151 * leads to undefined behavior. | 2148 * leads to undefined behavior. |
2152 */ | 2149 */ |
2153 V8_INLINE(void* GetAlignedPointerFromInternalField(int index)); | 2150 V8_INLINE void* GetAlignedPointerFromInternalField(int index); |
2154 | 2151 |
2155 /** | 2152 /** |
2156 * Sets a 2-byte-aligned native pointer in an internal field. To retrieve such | 2153 * Sets a 2-byte-aligned native pointer in an internal field. To retrieve such |
2157 * a field, GetAlignedPointerFromInternalField must be used, everything else | 2154 * a field, GetAlignedPointerFromInternalField must be used, everything else |
2158 * leads to undefined behavior. | 2155 * leads to undefined behavior. |
2159 */ | 2156 */ |
2160 void SetAlignedPointerInInternalField(int index, void* value); | 2157 void SetAlignedPointerInInternalField(int index, void* value); |
2161 | 2158 |
2162 // Testers for local properties. | 2159 // Testers for local properties. |
2163 bool HasOwnProperty(Handle<String> key); | 2160 bool HasOwnProperty(Handle<String> key); |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2273 Handle<Value> argv[]); | 2270 Handle<Value> argv[]); |
2274 | 2271 |
2275 /** | 2272 /** |
2276 * Call an Object as a constructor if a callback is set by the | 2273 * Call an Object as a constructor if a callback is set by the |
2277 * ObjectTemplate::SetCallAsFunctionHandler method. | 2274 * ObjectTemplate::SetCallAsFunctionHandler method. |
2278 * Note: This method behaves like the Function::NewInstance method. | 2275 * Note: This method behaves like the Function::NewInstance method. |
2279 */ | 2276 */ |
2280 Local<Value> CallAsConstructor(int argc, Handle<Value> argv[]); | 2277 Local<Value> CallAsConstructor(int argc, Handle<Value> argv[]); |
2281 | 2278 |
2282 static Local<Object> New(); | 2279 static Local<Object> New(); |
2283 V8_INLINE(static Object* Cast(Value* obj)); | 2280 V8_INLINE static Object* Cast(Value* obj); |
2284 | 2281 |
2285 private: | 2282 private: |
2286 Object(); | 2283 Object(); |
2287 static void CheckCast(Value* obj); | 2284 static void CheckCast(Value* obj); |
2288 Local<Value> SlowGetInternalField(int index); | 2285 Local<Value> SlowGetInternalField(int index); |
2289 void* SlowGetAlignedPointerFromInternalField(int index); | 2286 void* SlowGetAlignedPointerFromInternalField(int index); |
2290 }; | 2287 }; |
2291 | 2288 |
2292 | 2289 |
2293 /** | 2290 /** |
2294 * An instance of the built-in array constructor (ECMA-262, 15.4.2). | 2291 * An instance of the built-in array constructor (ECMA-262, 15.4.2). |
2295 */ | 2292 */ |
2296 class V8_EXPORT Array : public Object { | 2293 class V8_EXPORT Array : public Object { |
2297 public: | 2294 public: |
2298 uint32_t Length() const; | 2295 uint32_t Length() const; |
2299 | 2296 |
2300 /** | 2297 /** |
2301 * Clones an element at index |index|. Returns an empty | 2298 * Clones an element at index |index|. Returns an empty |
2302 * handle if cloning fails (for any reason). | 2299 * handle if cloning fails (for any reason). |
2303 */ | 2300 */ |
2304 Local<Object> CloneElementAt(uint32_t index); | 2301 Local<Object> CloneElementAt(uint32_t index); |
2305 | 2302 |
2306 /** | 2303 /** |
2307 * Creates a JavaScript array with the given length. If the length | 2304 * Creates a JavaScript array with the given length. If the length |
2308 * is negative the returned array will have length 0. | 2305 * is negative the returned array will have length 0. |
2309 */ | 2306 */ |
2310 static Local<Array> New(int length = 0); | 2307 static Local<Array> New(int length = 0); |
2311 | 2308 |
2312 V8_INLINE(static Array* Cast(Value* obj)); | 2309 V8_INLINE static Array* Cast(Value* obj); |
2313 private: | 2310 private: |
2314 Array(); | 2311 Array(); |
2315 static void CheckCast(Value* obj); | 2312 static void CheckCast(Value* obj); |
2316 }; | 2313 }; |
2317 | 2314 |
2318 | 2315 |
2319 template<typename T> | 2316 template<typename T> |
2320 class ReturnValue { | 2317 class ReturnValue { |
2321 public: | 2318 public: |
2322 template <class S> V8_INLINE(ReturnValue(const ReturnValue<S>& that)) | 2319 template <class S> V8_INLINE ReturnValue(const ReturnValue<S>& that) |
2323 : value_(that.value_) { | 2320 : value_(that.value_) { |
2324 TYPE_CHECK(T, S); | 2321 TYPE_CHECK(T, S); |
2325 } | 2322 } |
2326 // Handle setters | 2323 // Handle setters |
2327 template <typename S> V8_INLINE(void Set(const Persistent<S>& handle)); | 2324 template <typename S> V8_INLINE void Set(const Persistent<S>& handle); |
2328 template <typename S> V8_INLINE(void Set(const Handle<S> handle)); | 2325 template <typename S> V8_INLINE void Set(const Handle<S> handle); |
2329 // Fast primitive setters | 2326 // Fast primitive setters |
2330 V8_INLINE(void Set(bool value)); | 2327 V8_INLINE void Set(bool value); |
2331 V8_INLINE(void Set(double i)); | 2328 V8_INLINE void Set(double i); |
2332 V8_INLINE(void Set(int32_t i)); | 2329 V8_INLINE void Set(int32_t i); |
2333 V8_INLINE(void Set(uint32_t i)); | 2330 V8_INLINE void Set(uint32_t i); |
2334 // Fast JS primitive setters | 2331 // Fast JS primitive setters |
2335 V8_INLINE(void SetNull()); | 2332 V8_INLINE void SetNull(); |
2336 V8_INLINE(void SetUndefined()); | 2333 V8_INLINE void SetUndefined(); |
2337 V8_INLINE(void SetEmptyString()); | 2334 V8_INLINE void SetEmptyString(); |
2338 // Convenience getter for Isolate | 2335 // Convenience getter for Isolate |
2339 V8_INLINE(Isolate* GetIsolate()); | 2336 V8_INLINE Isolate* GetIsolate(); |
2340 | 2337 |
2341 private: | 2338 private: |
2342 template<class F> friend class ReturnValue; | 2339 template<class F> friend class ReturnValue; |
2343 template<class F> friend class FunctionCallbackInfo; | 2340 template<class F> friend class FunctionCallbackInfo; |
2344 template<class F> friend class PropertyCallbackInfo; | 2341 template<class F> friend class PropertyCallbackInfo; |
2345 V8_INLINE(internal::Object* GetDefaultValue()); | 2342 V8_INLINE internal::Object* GetDefaultValue(); |
2346 V8_INLINE(explicit ReturnValue(internal::Object** slot)); | 2343 V8_INLINE explicit ReturnValue(internal::Object** slot); |
2347 internal::Object** value_; | 2344 internal::Object** value_; |
2348 }; | 2345 }; |
2349 | 2346 |
2350 | 2347 |
2351 /** | 2348 /** |
2352 * The argument information given to function call callbacks. This | 2349 * The argument information given to function call callbacks. This |
2353 * class provides access to information about the context of the call, | 2350 * class provides access to information about the context of the call, |
2354 * including the receiver, the number and values of arguments, and | 2351 * including the receiver, the number and values of arguments, and |
2355 * the holder of the function. | 2352 * the holder of the function. |
2356 */ | 2353 */ |
2357 template<typename T> | 2354 template<typename T> |
2358 class FunctionCallbackInfo { | 2355 class FunctionCallbackInfo { |
2359 public: | 2356 public: |
2360 V8_INLINE(int Length() const); | 2357 V8_INLINE int Length() const; |
2361 V8_INLINE(Local<Value> operator[](int i) const); | 2358 V8_INLINE Local<Value> operator[](int i) const; |
2362 V8_INLINE(Local<Function> Callee() const); | 2359 V8_INLINE Local<Function> Callee() const; |
2363 V8_INLINE(Local<Object> This() const); | 2360 V8_INLINE Local<Object> This() const; |
2364 V8_INLINE(Local<Object> Holder() const); | 2361 V8_INLINE Local<Object> Holder() const; |
2365 V8_INLINE(bool IsConstructCall() const); | 2362 V8_INLINE bool IsConstructCall() const; |
2366 V8_INLINE(Local<Value> Data() const); | 2363 V8_INLINE Local<Value> Data() const; |
2367 V8_INLINE(Isolate* GetIsolate() const); | 2364 V8_INLINE Isolate* GetIsolate() const; |
2368 V8_INLINE(ReturnValue<T> GetReturnValue() const); | 2365 V8_INLINE ReturnValue<T> GetReturnValue() const; |
2369 // This shouldn't be public, but the arm compiler needs it. | 2366 // This shouldn't be public, but the arm compiler needs it. |
2370 static const int kArgsLength = 6; | 2367 static const int kArgsLength = 6; |
2371 | 2368 |
2372 protected: | 2369 protected: |
2373 friend class internal::FunctionCallbackArguments; | 2370 friend class internal::FunctionCallbackArguments; |
2374 friend class internal::CustomArguments<FunctionCallbackInfo>; | 2371 friend class internal::CustomArguments<FunctionCallbackInfo>; |
2375 static const int kReturnValueIndex = 0; | 2372 static const int kReturnValueIndex = 0; |
2376 static const int kReturnValueDefaultValueIndex = -1; | 2373 static const int kReturnValueDefaultValueIndex = -1; |
2377 static const int kIsolateIndex = -2; | 2374 static const int kIsolateIndex = -2; |
2378 static const int kDataIndex = -3; | 2375 static const int kDataIndex = -3; |
2379 static const int kCalleeIndex = -4; | 2376 static const int kCalleeIndex = -4; |
2380 static const int kHolderIndex = -5; | 2377 static const int kHolderIndex = -5; |
2381 | 2378 |
2382 V8_INLINE(FunctionCallbackInfo(internal::Object** implicit_args, | 2379 V8_INLINE FunctionCallbackInfo(internal::Object** implicit_args, |
2383 internal::Object** values, | 2380 internal::Object** values, |
2384 int length, | 2381 int length, |
2385 bool is_construct_call)); | 2382 bool is_construct_call); |
2386 internal::Object** implicit_args_; | 2383 internal::Object** implicit_args_; |
2387 internal::Object** values_; | 2384 internal::Object** values_; |
2388 int length_; | 2385 int length_; |
2389 bool is_construct_call_; | 2386 bool is_construct_call_; |
2390 }; | 2387 }; |
2391 | 2388 |
2392 | 2389 |
2393 /** | 2390 /** |
2394 * The information passed to a property callback about the context | 2391 * The information passed to a property callback about the context |
2395 * of the property access. | 2392 * of the property access. |
2396 */ | 2393 */ |
2397 template<typename T> | 2394 template<typename T> |
2398 class PropertyCallbackInfo { | 2395 class PropertyCallbackInfo { |
2399 public: | 2396 public: |
2400 V8_INLINE(Isolate* GetIsolate() const); | 2397 V8_INLINE Isolate* GetIsolate() const; |
2401 V8_INLINE(Local<Value> Data() const); | 2398 V8_INLINE Local<Value> Data() const; |
2402 V8_INLINE(Local<Object> This() const); | 2399 V8_INLINE Local<Object> This() const; |
2403 V8_INLINE(Local<Object> Holder() const); | 2400 V8_INLINE Local<Object> Holder() const; |
2404 V8_INLINE(ReturnValue<T> GetReturnValue() const); | 2401 V8_INLINE ReturnValue<T> GetReturnValue() const; |
2405 // This shouldn't be public, but the arm compiler needs it. | 2402 // This shouldn't be public, but the arm compiler needs it. |
2406 static const int kArgsLength = 6; | 2403 static const int kArgsLength = 6; |
2407 | 2404 |
2408 protected: | 2405 protected: |
2409 friend class MacroAssembler; | 2406 friend class MacroAssembler; |
2410 friend class internal::PropertyCallbackArguments; | 2407 friend class internal::PropertyCallbackArguments; |
2411 friend class internal::CustomArguments<PropertyCallbackInfo>; | 2408 friend class internal::CustomArguments<PropertyCallbackInfo>; |
2412 static const int kThisIndex = 0; | 2409 static const int kThisIndex = 0; |
2413 static const int kHolderIndex = -1; | 2410 static const int kHolderIndex = -1; |
2414 static const int kDataIndex = -2; | 2411 static const int kDataIndex = -2; |
2415 static const int kReturnValueIndex = -3; | 2412 static const int kReturnValueIndex = -3; |
2416 static const int kReturnValueDefaultValueIndex = -4; | 2413 static const int kReturnValueDefaultValueIndex = -4; |
2417 static const int kIsolateIndex = -5; | 2414 static const int kIsolateIndex = -5; |
2418 | 2415 |
2419 V8_INLINE(PropertyCallbackInfo(internal::Object** args)) | 2416 V8_INLINE PropertyCallbackInfo(internal::Object** args) : args_(args) {} |
2420 : args_(args) { } | |
2421 internal::Object** args_; | 2417 internal::Object** args_; |
2422 }; | 2418 }; |
2423 | 2419 |
2424 | 2420 |
2425 typedef void (*FunctionCallback)(const FunctionCallbackInfo<Value>& info); | 2421 typedef void (*FunctionCallback)(const FunctionCallbackInfo<Value>& info); |
2426 | 2422 |
2427 | 2423 |
2428 /** | 2424 /** |
2429 * A JavaScript function object (ECMA-262, 15.3). | 2425 * A JavaScript function object (ECMA-262, 15.3). |
2430 */ | 2426 */ |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2469 * DEPRECATED: use ScriptId() instead. | 2465 * DEPRECATED: use ScriptId() instead. |
2470 */ | 2466 */ |
2471 Handle<Value> GetScriptId() const; | 2467 Handle<Value> GetScriptId() const; |
2472 | 2468 |
2473 /** | 2469 /** |
2474 * Returns scriptId. | 2470 * Returns scriptId. |
2475 */ | 2471 */ |
2476 int ScriptId() const; | 2472 int ScriptId() const; |
2477 | 2473 |
2478 ScriptOrigin GetScriptOrigin() const; | 2474 ScriptOrigin GetScriptOrigin() const; |
2479 V8_INLINE(static Function* Cast(Value* obj)); | 2475 V8_INLINE static Function* Cast(Value* obj); |
2480 static const int kLineOffsetNotFound; | 2476 static const int kLineOffsetNotFound; |
2481 | 2477 |
2482 private: | 2478 private: |
2483 Function(); | 2479 Function(); |
2484 static void CheckCast(Value* obj); | 2480 static void CheckCast(Value* obj); |
2485 }; | 2481 }; |
2486 | 2482 |
2487 #ifndef V8_ARRAY_BUFFER_INTERNAL_FIELD_COUNT | 2483 #ifndef V8_ARRAY_BUFFER_INTERNAL_FIELD_COUNT |
2488 // The number of required internal fields can be defined by embedder. | 2484 // The number of required internal fields can be defined by embedder. |
2489 #define V8_ARRAY_BUFFER_INTERNAL_FIELD_COUNT 2 | 2485 #define V8_ARRAY_BUFFER_INTERNAL_FIELD_COUNT 2 |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2588 * Make this ArrayBuffer external. The pointer to underlying memory block | 2584 * Make this ArrayBuffer external. The pointer to underlying memory block |
2589 * and byte length are returned as |Contents| structure. After ArrayBuffer | 2585 * and byte length are returned as |Contents| structure. After ArrayBuffer |
2590 * had been etxrenalized, it does no longer owns the memory block. The caller | 2586 * had been etxrenalized, it does no longer owns the memory block. The caller |
2591 * should take steps to free memory when it is no longer needed. | 2587 * should take steps to free memory when it is no longer needed. |
2592 * | 2588 * |
2593 * The memory block is guaranteed to be allocated with |Allocator::Allocate| | 2589 * The memory block is guaranteed to be allocated with |Allocator::Allocate| |
2594 * that has been set with V8::SetArrayBufferAllocator. | 2590 * that has been set with V8::SetArrayBufferAllocator. |
2595 */ | 2591 */ |
2596 Contents Externalize(); | 2592 Contents Externalize(); |
2597 | 2593 |
2598 V8_INLINE(static ArrayBuffer* Cast(Value* obj)); | 2594 V8_INLINE static ArrayBuffer* Cast(Value* obj); |
2599 | 2595 |
2600 static const int kInternalFieldCount = V8_ARRAY_BUFFER_INTERNAL_FIELD_COUNT; | 2596 static const int kInternalFieldCount = V8_ARRAY_BUFFER_INTERNAL_FIELD_COUNT; |
2601 | 2597 |
2602 private: | 2598 private: |
2603 ArrayBuffer(); | 2599 ArrayBuffer(); |
2604 static void CheckCast(Value* obj); | 2600 static void CheckCast(Value* obj); |
2605 }; | 2601 }; |
2606 | 2602 |
2607 | 2603 |
2608 #ifndef V8_ARRAY_BUFFER_VIEW_INTERNAL_FIELD_COUNT | 2604 #ifndef V8_ARRAY_BUFFER_VIEW_INTERNAL_FIELD_COUNT |
(...skipping 20 matching lines...) Expand all Loading... |
2629 size_t ByteOffset(); | 2625 size_t ByteOffset(); |
2630 /** | 2626 /** |
2631 * Size of a view in bytes. | 2627 * Size of a view in bytes. |
2632 */ | 2628 */ |
2633 size_t ByteLength(); | 2629 size_t ByteLength(); |
2634 /** | 2630 /** |
2635 * Base address of a view. | 2631 * Base address of a view. |
2636 */ | 2632 */ |
2637 void* BaseAddress(); | 2633 void* BaseAddress(); |
2638 | 2634 |
2639 V8_INLINE(static ArrayBufferView* Cast(Value* obj)); | 2635 V8_INLINE static ArrayBufferView* Cast(Value* obj); |
2640 | 2636 |
2641 static const int kInternalFieldCount = | 2637 static const int kInternalFieldCount = |
2642 V8_ARRAY_BUFFER_VIEW_INTERNAL_FIELD_COUNT; | 2638 V8_ARRAY_BUFFER_VIEW_INTERNAL_FIELD_COUNT; |
2643 | 2639 |
2644 private: | 2640 private: |
2645 ArrayBufferView(); | 2641 ArrayBufferView(); |
2646 static void CheckCast(Value* obj); | 2642 static void CheckCast(Value* obj); |
2647 }; | 2643 }; |
2648 | 2644 |
2649 | 2645 |
2650 /** | 2646 /** |
2651 * A base class for an instance of TypedArray series of constructors | 2647 * A base class for an instance of TypedArray series of constructors |
2652 * (ES6 draft 15.13.6). | 2648 * (ES6 draft 15.13.6). |
2653 * This API is experimental and may change significantly. | 2649 * This API is experimental and may change significantly. |
2654 */ | 2650 */ |
2655 class V8_EXPORT TypedArray : public ArrayBufferView { | 2651 class V8_EXPORT TypedArray : public ArrayBufferView { |
2656 public: | 2652 public: |
2657 /** | 2653 /** |
2658 * Number of elements in this typed array | 2654 * Number of elements in this typed array |
2659 * (e.g. for Int16Array, |ByteLength|/2). | 2655 * (e.g. for Int16Array, |ByteLength|/2). |
2660 */ | 2656 */ |
2661 size_t Length(); | 2657 size_t Length(); |
2662 | 2658 |
2663 V8_INLINE(static TypedArray* Cast(Value* obj)); | 2659 V8_INLINE static TypedArray* Cast(Value* obj); |
2664 | 2660 |
2665 private: | 2661 private: |
2666 TypedArray(); | 2662 TypedArray(); |
2667 static void CheckCast(Value* obj); | 2663 static void CheckCast(Value* obj); |
2668 }; | 2664 }; |
2669 | 2665 |
2670 | 2666 |
2671 /** | 2667 /** |
2672 * An instance of Uint8Array constructor (ES6 draft 15.13.6). | 2668 * An instance of Uint8Array constructor (ES6 draft 15.13.6). |
2673 * This API is experimental and may change significantly. | 2669 * This API is experimental and may change significantly. |
2674 */ | 2670 */ |
2675 class V8_EXPORT Uint8Array : public TypedArray { | 2671 class V8_EXPORT Uint8Array : public TypedArray { |
2676 public: | 2672 public: |
2677 static Local<Uint8Array> New(Handle<ArrayBuffer> array_buffer, | 2673 static Local<Uint8Array> New(Handle<ArrayBuffer> array_buffer, |
2678 size_t byte_offset, size_t length); | 2674 size_t byte_offset, size_t length); |
2679 V8_INLINE(static Uint8Array* Cast(Value* obj)); | 2675 V8_INLINE static Uint8Array* Cast(Value* obj); |
2680 | 2676 |
2681 private: | 2677 private: |
2682 Uint8Array(); | 2678 Uint8Array(); |
2683 static void CheckCast(Value* obj); | 2679 static void CheckCast(Value* obj); |
2684 }; | 2680 }; |
2685 | 2681 |
2686 | 2682 |
2687 /** | 2683 /** |
2688 * An instance of Uint8ClampedArray constructor (ES6 draft 15.13.6). | 2684 * An instance of Uint8ClampedArray constructor (ES6 draft 15.13.6). |
2689 * This API is experimental and may change significantly. | 2685 * This API is experimental and may change significantly. |
2690 */ | 2686 */ |
2691 class V8_EXPORT Uint8ClampedArray : public TypedArray { | 2687 class V8_EXPORT Uint8ClampedArray : public TypedArray { |
2692 public: | 2688 public: |
2693 static Local<Uint8ClampedArray> New(Handle<ArrayBuffer> array_buffer, | 2689 static Local<Uint8ClampedArray> New(Handle<ArrayBuffer> array_buffer, |
2694 size_t byte_offset, size_t length); | 2690 size_t byte_offset, size_t length); |
2695 V8_INLINE(static Uint8ClampedArray* Cast(Value* obj)); | 2691 V8_INLINE static Uint8ClampedArray* Cast(Value* obj); |
2696 | 2692 |
2697 private: | 2693 private: |
2698 Uint8ClampedArray(); | 2694 Uint8ClampedArray(); |
2699 static void CheckCast(Value* obj); | 2695 static void CheckCast(Value* obj); |
2700 }; | 2696 }; |
2701 | 2697 |
2702 /** | 2698 /** |
2703 * An instance of Int8Array constructor (ES6 draft 15.13.6). | 2699 * An instance of Int8Array constructor (ES6 draft 15.13.6). |
2704 * This API is experimental and may change significantly. | 2700 * This API is experimental and may change significantly. |
2705 */ | 2701 */ |
2706 class V8_EXPORT Int8Array : public TypedArray { | 2702 class V8_EXPORT Int8Array : public TypedArray { |
2707 public: | 2703 public: |
2708 static Local<Int8Array> New(Handle<ArrayBuffer> array_buffer, | 2704 static Local<Int8Array> New(Handle<ArrayBuffer> array_buffer, |
2709 size_t byte_offset, size_t length); | 2705 size_t byte_offset, size_t length); |
2710 V8_INLINE(static Int8Array* Cast(Value* obj)); | 2706 V8_INLINE static Int8Array* Cast(Value* obj); |
2711 | 2707 |
2712 private: | 2708 private: |
2713 Int8Array(); | 2709 Int8Array(); |
2714 static void CheckCast(Value* obj); | 2710 static void CheckCast(Value* obj); |
2715 }; | 2711 }; |
2716 | 2712 |
2717 | 2713 |
2718 /** | 2714 /** |
2719 * An instance of Uint16Array constructor (ES6 draft 15.13.6). | 2715 * An instance of Uint16Array constructor (ES6 draft 15.13.6). |
2720 * This API is experimental and may change significantly. | 2716 * This API is experimental and may change significantly. |
2721 */ | 2717 */ |
2722 class V8_EXPORT Uint16Array : public TypedArray { | 2718 class V8_EXPORT Uint16Array : public TypedArray { |
2723 public: | 2719 public: |
2724 static Local<Uint16Array> New(Handle<ArrayBuffer> array_buffer, | 2720 static Local<Uint16Array> New(Handle<ArrayBuffer> array_buffer, |
2725 size_t byte_offset, size_t length); | 2721 size_t byte_offset, size_t length); |
2726 V8_INLINE(static Uint16Array* Cast(Value* obj)); | 2722 V8_INLINE static Uint16Array* Cast(Value* obj); |
2727 | 2723 |
2728 private: | 2724 private: |
2729 Uint16Array(); | 2725 Uint16Array(); |
2730 static void CheckCast(Value* obj); | 2726 static void CheckCast(Value* obj); |
2731 }; | 2727 }; |
2732 | 2728 |
2733 | 2729 |
2734 /** | 2730 /** |
2735 * An instance of Int16Array constructor (ES6 draft 15.13.6). | 2731 * An instance of Int16Array constructor (ES6 draft 15.13.6). |
2736 * This API is experimental and may change significantly. | 2732 * This API is experimental and may change significantly. |
2737 */ | 2733 */ |
2738 class V8_EXPORT Int16Array : public TypedArray { | 2734 class V8_EXPORT Int16Array : public TypedArray { |
2739 public: | 2735 public: |
2740 static Local<Int16Array> New(Handle<ArrayBuffer> array_buffer, | 2736 static Local<Int16Array> New(Handle<ArrayBuffer> array_buffer, |
2741 size_t byte_offset, size_t length); | 2737 size_t byte_offset, size_t length); |
2742 V8_INLINE(static Int16Array* Cast(Value* obj)); | 2738 V8_INLINE static Int16Array* Cast(Value* obj); |
2743 | 2739 |
2744 private: | 2740 private: |
2745 Int16Array(); | 2741 Int16Array(); |
2746 static void CheckCast(Value* obj); | 2742 static void CheckCast(Value* obj); |
2747 }; | 2743 }; |
2748 | 2744 |
2749 | 2745 |
2750 /** | 2746 /** |
2751 * An instance of Uint32Array constructor (ES6 draft 15.13.6). | 2747 * An instance of Uint32Array constructor (ES6 draft 15.13.6). |
2752 * This API is experimental and may change significantly. | 2748 * This API is experimental and may change significantly. |
2753 */ | 2749 */ |
2754 class V8_EXPORT Uint32Array : public TypedArray { | 2750 class V8_EXPORT Uint32Array : public TypedArray { |
2755 public: | 2751 public: |
2756 static Local<Uint32Array> New(Handle<ArrayBuffer> array_buffer, | 2752 static Local<Uint32Array> New(Handle<ArrayBuffer> array_buffer, |
2757 size_t byte_offset, size_t length); | 2753 size_t byte_offset, size_t length); |
2758 V8_INLINE(static Uint32Array* Cast(Value* obj)); | 2754 V8_INLINE static Uint32Array* Cast(Value* obj); |
2759 | 2755 |
2760 private: | 2756 private: |
2761 Uint32Array(); | 2757 Uint32Array(); |
2762 static void CheckCast(Value* obj); | 2758 static void CheckCast(Value* obj); |
2763 }; | 2759 }; |
2764 | 2760 |
2765 | 2761 |
2766 /** | 2762 /** |
2767 * An instance of Int32Array constructor (ES6 draft 15.13.6). | 2763 * An instance of Int32Array constructor (ES6 draft 15.13.6). |
2768 * This API is experimental and may change significantly. | 2764 * This API is experimental and may change significantly. |
2769 */ | 2765 */ |
2770 class V8_EXPORT Int32Array : public TypedArray { | 2766 class V8_EXPORT Int32Array : public TypedArray { |
2771 public: | 2767 public: |
2772 static Local<Int32Array> New(Handle<ArrayBuffer> array_buffer, | 2768 static Local<Int32Array> New(Handle<ArrayBuffer> array_buffer, |
2773 size_t byte_offset, size_t length); | 2769 size_t byte_offset, size_t length); |
2774 V8_INLINE(static Int32Array* Cast(Value* obj)); | 2770 V8_INLINE static Int32Array* Cast(Value* obj); |
2775 | 2771 |
2776 private: | 2772 private: |
2777 Int32Array(); | 2773 Int32Array(); |
2778 static void CheckCast(Value* obj); | 2774 static void CheckCast(Value* obj); |
2779 }; | 2775 }; |
2780 | 2776 |
2781 | 2777 |
2782 /** | 2778 /** |
2783 * An instance of Float32Array constructor (ES6 draft 15.13.6). | 2779 * An instance of Float32Array constructor (ES6 draft 15.13.6). |
2784 * This API is experimental and may change significantly. | 2780 * This API is experimental and may change significantly. |
2785 */ | 2781 */ |
2786 class V8_EXPORT Float32Array : public TypedArray { | 2782 class V8_EXPORT Float32Array : public TypedArray { |
2787 public: | 2783 public: |
2788 static Local<Float32Array> New(Handle<ArrayBuffer> array_buffer, | 2784 static Local<Float32Array> New(Handle<ArrayBuffer> array_buffer, |
2789 size_t byte_offset, size_t length); | 2785 size_t byte_offset, size_t length); |
2790 V8_INLINE(static Float32Array* Cast(Value* obj)); | 2786 V8_INLINE static Float32Array* Cast(Value* obj); |
2791 | 2787 |
2792 private: | 2788 private: |
2793 Float32Array(); | 2789 Float32Array(); |
2794 static void CheckCast(Value* obj); | 2790 static void CheckCast(Value* obj); |
2795 }; | 2791 }; |
2796 | 2792 |
2797 | 2793 |
2798 /** | 2794 /** |
2799 * An instance of Float64Array constructor (ES6 draft 15.13.6). | 2795 * An instance of Float64Array constructor (ES6 draft 15.13.6). |
2800 * This API is experimental and may change significantly. | 2796 * This API is experimental and may change significantly. |
2801 */ | 2797 */ |
2802 class V8_EXPORT Float64Array : public TypedArray { | 2798 class V8_EXPORT Float64Array : public TypedArray { |
2803 public: | 2799 public: |
2804 static Local<Float64Array> New(Handle<ArrayBuffer> array_buffer, | 2800 static Local<Float64Array> New(Handle<ArrayBuffer> array_buffer, |
2805 size_t byte_offset, size_t length); | 2801 size_t byte_offset, size_t length); |
2806 V8_INLINE(static Float64Array* Cast(Value* obj)); | 2802 V8_INLINE static Float64Array* Cast(Value* obj); |
2807 | 2803 |
2808 private: | 2804 private: |
2809 Float64Array(); | 2805 Float64Array(); |
2810 static void CheckCast(Value* obj); | 2806 static void CheckCast(Value* obj); |
2811 }; | 2807 }; |
2812 | 2808 |
2813 | 2809 |
2814 /** | 2810 /** |
2815 * An instance of DataView constructor (ES6 draft 15.13.7). | 2811 * An instance of DataView constructor (ES6 draft 15.13.7). |
2816 * This API is experimental and may change significantly. | 2812 * This API is experimental and may change significantly. |
2817 */ | 2813 */ |
2818 class V8_EXPORT DataView : public ArrayBufferView { | 2814 class V8_EXPORT DataView : public ArrayBufferView { |
2819 public: | 2815 public: |
2820 static Local<DataView> New(Handle<ArrayBuffer> array_buffer, | 2816 static Local<DataView> New(Handle<ArrayBuffer> array_buffer, |
2821 size_t byte_offset, size_t length); | 2817 size_t byte_offset, size_t length); |
2822 V8_INLINE(static DataView* Cast(Value* obj)); | 2818 V8_INLINE static DataView* Cast(Value* obj); |
2823 | 2819 |
2824 private: | 2820 private: |
2825 DataView(); | 2821 DataView(); |
2826 static void CheckCast(Value* obj); | 2822 static void CheckCast(Value* obj); |
2827 }; | 2823 }; |
2828 | 2824 |
2829 | 2825 |
2830 /** | 2826 /** |
2831 * An instance of the built-in Date constructor (ECMA-262, 15.9). | 2827 * An instance of the built-in Date constructor (ECMA-262, 15.9). |
2832 */ | 2828 */ |
2833 class V8_EXPORT Date : public Object { | 2829 class V8_EXPORT Date : public Object { |
2834 public: | 2830 public: |
2835 static Local<Value> New(double time); | 2831 static Local<Value> New(double time); |
2836 | 2832 |
2837 // Deprecated, use Date::ValueOf() instead. | 2833 // Deprecated, use Date::ValueOf() instead. |
2838 // TODO(svenpanne) Actually deprecate when Chrome is adapted. | 2834 // TODO(svenpanne) Actually deprecate when Chrome is adapted. |
2839 double NumberValue() const { return ValueOf(); } | 2835 double NumberValue() const { return ValueOf(); } |
2840 | 2836 |
2841 /** | 2837 /** |
2842 * A specialization of Value::NumberValue that is more efficient | 2838 * A specialization of Value::NumberValue that is more efficient |
2843 * because we know the structure of this object. | 2839 * because we know the structure of this object. |
2844 */ | 2840 */ |
2845 double ValueOf() const; | 2841 double ValueOf() const; |
2846 | 2842 |
2847 V8_INLINE(static Date* Cast(v8::Value* obj)); | 2843 V8_INLINE static Date* Cast(v8::Value* obj); |
2848 | 2844 |
2849 /** | 2845 /** |
2850 * Notification that the embedder has changed the time zone, | 2846 * Notification that the embedder has changed the time zone, |
2851 * daylight savings time, or other date / time configuration | 2847 * daylight savings time, or other date / time configuration |
2852 * parameters. V8 keeps a cache of various values used for | 2848 * parameters. V8 keeps a cache of various values used for |
2853 * date / time computation. This notification will reset | 2849 * date / time computation. This notification will reset |
2854 * those cached values for the current context so that date / | 2850 * those cached values for the current context so that date / |
2855 * time configuration changes would be reflected in the Date | 2851 * time configuration changes would be reflected in the Date |
2856 * object. | 2852 * object. |
2857 * | 2853 * |
(...skipping 16 matching lines...) Expand all Loading... |
2874 | 2870 |
2875 // Deprecated, use NumberObject::ValueOf() instead. | 2871 // Deprecated, use NumberObject::ValueOf() instead. |
2876 // TODO(svenpanne) Actually deprecate when Chrome is adapted. | 2872 // TODO(svenpanne) Actually deprecate when Chrome is adapted. |
2877 double NumberValue() const { return ValueOf(); } | 2873 double NumberValue() const { return ValueOf(); } |
2878 | 2874 |
2879 /** | 2875 /** |
2880 * Returns the Number held by the object. | 2876 * Returns the Number held by the object. |
2881 */ | 2877 */ |
2882 double ValueOf() const; | 2878 double ValueOf() const; |
2883 | 2879 |
2884 V8_INLINE(static NumberObject* Cast(v8::Value* obj)); | 2880 V8_INLINE static NumberObject* Cast(v8::Value* obj); |
2885 | 2881 |
2886 private: | 2882 private: |
2887 static void CheckCast(v8::Value* obj); | 2883 static void CheckCast(v8::Value* obj); |
2888 }; | 2884 }; |
2889 | 2885 |
2890 | 2886 |
2891 /** | 2887 /** |
2892 * A Boolean object (ECMA-262, 4.3.15). | 2888 * A Boolean object (ECMA-262, 4.3.15). |
2893 */ | 2889 */ |
2894 class V8_EXPORT BooleanObject : public Object { | 2890 class V8_EXPORT BooleanObject : public Object { |
2895 public: | 2891 public: |
2896 static Local<Value> New(bool value); | 2892 static Local<Value> New(bool value); |
2897 | 2893 |
2898 // Deprecated, use BooleanObject::ValueOf() instead. | 2894 // Deprecated, use BooleanObject::ValueOf() instead. |
2899 // TODO(svenpanne) Actually deprecate when Chrome is adapted. | 2895 // TODO(svenpanne) Actually deprecate when Chrome is adapted. |
2900 bool BooleanValue() const { return ValueOf(); } | 2896 bool BooleanValue() const { return ValueOf(); } |
2901 | 2897 |
2902 /** | 2898 /** |
2903 * Returns the Boolean held by the object. | 2899 * Returns the Boolean held by the object. |
2904 */ | 2900 */ |
2905 bool ValueOf() const; | 2901 bool ValueOf() const; |
2906 | 2902 |
2907 V8_INLINE(static BooleanObject* Cast(v8::Value* obj)); | 2903 V8_INLINE static BooleanObject* Cast(v8::Value* obj); |
2908 | 2904 |
2909 private: | 2905 private: |
2910 static void CheckCast(v8::Value* obj); | 2906 static void CheckCast(v8::Value* obj); |
2911 }; | 2907 }; |
2912 | 2908 |
2913 | 2909 |
2914 /** | 2910 /** |
2915 * A String object (ECMA-262, 4.3.18). | 2911 * A String object (ECMA-262, 4.3.18). |
2916 */ | 2912 */ |
2917 class V8_EXPORT StringObject : public Object { | 2913 class V8_EXPORT StringObject : public Object { |
2918 public: | 2914 public: |
2919 static Local<Value> New(Handle<String> value); | 2915 static Local<Value> New(Handle<String> value); |
2920 | 2916 |
2921 // Deprecated, use StringObject::ValueOf() instead. | 2917 // Deprecated, use StringObject::ValueOf() instead. |
2922 // TODO(svenpanne) Actually deprecate when Chrome is adapted. | 2918 // TODO(svenpanne) Actually deprecate when Chrome is adapted. |
2923 Local<String> StringValue() const { return ValueOf(); } | 2919 Local<String> StringValue() const { return ValueOf(); } |
2924 | 2920 |
2925 /** | 2921 /** |
2926 * Returns the String held by the object. | 2922 * Returns the String held by the object. |
2927 */ | 2923 */ |
2928 Local<String> ValueOf() const; | 2924 Local<String> ValueOf() const; |
2929 | 2925 |
2930 V8_INLINE(static StringObject* Cast(v8::Value* obj)); | 2926 V8_INLINE static StringObject* Cast(v8::Value* obj); |
2931 | 2927 |
2932 private: | 2928 private: |
2933 static void CheckCast(v8::Value* obj); | 2929 static void CheckCast(v8::Value* obj); |
2934 }; | 2930 }; |
2935 | 2931 |
2936 | 2932 |
2937 /** | 2933 /** |
2938 * A Symbol object (ECMA-262 edition 6). | 2934 * A Symbol object (ECMA-262 edition 6). |
2939 * | 2935 * |
2940 * This is an experimental feature. Use at your own risk. | 2936 * This is an experimental feature. Use at your own risk. |
2941 */ | 2937 */ |
2942 class V8_EXPORT SymbolObject : public Object { | 2938 class V8_EXPORT SymbolObject : public Object { |
2943 public: | 2939 public: |
2944 static Local<Value> New(Isolate* isolate, Handle<Symbol> value); | 2940 static Local<Value> New(Isolate* isolate, Handle<Symbol> value); |
2945 | 2941 |
2946 // Deprecated, use SymbolObject::ValueOf() instead. | 2942 // Deprecated, use SymbolObject::ValueOf() instead. |
2947 // TODO(svenpanne) Actually deprecate when Chrome is adapted. | 2943 // TODO(svenpanne) Actually deprecate when Chrome is adapted. |
2948 Local<Symbol> SymbolValue() const { return ValueOf(); } | 2944 Local<Symbol> SymbolValue() const { return ValueOf(); } |
2949 | 2945 |
2950 /** | 2946 /** |
2951 * Returns the Symbol held by the object. | 2947 * Returns the Symbol held by the object. |
2952 */ | 2948 */ |
2953 Local<Symbol> ValueOf() const; | 2949 Local<Symbol> ValueOf() const; |
2954 | 2950 |
2955 V8_INLINE(static SymbolObject* Cast(v8::Value* obj)); | 2951 V8_INLINE static SymbolObject* Cast(v8::Value* obj); |
2956 | 2952 |
2957 private: | 2953 private: |
2958 static void CheckCast(v8::Value* obj); | 2954 static void CheckCast(v8::Value* obj); |
2959 }; | 2955 }; |
2960 | 2956 |
2961 | 2957 |
2962 /** | 2958 /** |
2963 * An instance of the built-in RegExp constructor (ECMA-262, 15.10). | 2959 * An instance of the built-in RegExp constructor (ECMA-262, 15.10). |
2964 */ | 2960 */ |
2965 class V8_EXPORT RegExp : public Object { | 2961 class V8_EXPORT RegExp : public Object { |
(...skipping 25 matching lines...) Expand all Loading... |
2991 * Returns the value of the source property: a string representing | 2987 * Returns the value of the source property: a string representing |
2992 * the regular expression. | 2988 * the regular expression. |
2993 */ | 2989 */ |
2994 Local<String> GetSource() const; | 2990 Local<String> GetSource() const; |
2995 | 2991 |
2996 /** | 2992 /** |
2997 * Returns the flags bit field. | 2993 * Returns the flags bit field. |
2998 */ | 2994 */ |
2999 Flags GetFlags() const; | 2995 Flags GetFlags() const; |
3000 | 2996 |
3001 V8_INLINE(static RegExp* Cast(v8::Value* obj)); | 2997 V8_INLINE static RegExp* Cast(v8::Value* obj); |
3002 | 2998 |
3003 private: | 2999 private: |
3004 static void CheckCast(v8::Value* obj); | 3000 static void CheckCast(v8::Value* obj); |
3005 }; | 3001 }; |
3006 | 3002 |
3007 | 3003 |
3008 /** | 3004 /** |
3009 * A JavaScript value that wraps a C++ void*. This type of value is mainly used | 3005 * A JavaScript value that wraps a C++ void*. This type of value is mainly used |
3010 * to associate C++ data structures with JavaScript objects. | 3006 * to associate C++ data structures with JavaScript objects. |
3011 */ | 3007 */ |
3012 class V8_EXPORT External : public Value { | 3008 class V8_EXPORT External : public Value { |
3013 public: | 3009 public: |
3014 static Local<External> New(void* value); | 3010 static Local<External> New(void* value); |
3015 V8_INLINE(static External* Cast(Value* obj)); | 3011 V8_INLINE static External* Cast(Value* obj); |
3016 void* Value() const; | 3012 void* Value() const; |
3017 private: | 3013 private: |
3018 static void CheckCast(v8::Value* obj); | 3014 static void CheckCast(v8::Value* obj); |
3019 }; | 3015 }; |
3020 | 3016 |
3021 | 3017 |
3022 // --- Templates --- | 3018 // --- Templates --- |
3023 | 3019 |
3024 | 3020 |
3025 /** | 3021 /** |
3026 * The superclass of object and function templates. | 3022 * The superclass of object and function templates. |
3027 */ | 3023 */ |
3028 class V8_EXPORT Template : public Data { | 3024 class V8_EXPORT Template : public Data { |
3029 public: | 3025 public: |
3030 /** Adds a property to each instance created by this template.*/ | 3026 /** Adds a property to each instance created by this template.*/ |
3031 void Set(Handle<String> name, Handle<Data> value, | 3027 void Set(Handle<String> name, Handle<Data> value, |
3032 PropertyAttribute attributes = None); | 3028 PropertyAttribute attributes = None); |
3033 V8_INLINE(void Set(const char* name, Handle<Data> value)); | 3029 V8_INLINE void Set(const char* name, Handle<Data> value); |
3034 | 3030 |
3035 void SetAccessorProperty( | 3031 void SetAccessorProperty( |
3036 Local<String> name, | 3032 Local<String> name, |
3037 Local<FunctionTemplate> getter = Local<FunctionTemplate>(), | 3033 Local<FunctionTemplate> getter = Local<FunctionTemplate>(), |
3038 Local<FunctionTemplate> setter = Local<FunctionTemplate>(), | 3034 Local<FunctionTemplate> setter = Local<FunctionTemplate>(), |
3039 PropertyAttribute attribute = None, | 3035 PropertyAttribute attribute = None, |
3040 AccessControl settings = DEFAULT); | 3036 AccessControl settings = DEFAULT); |
3041 | 3037 |
3042 /** | 3038 /** |
3043 * Whenever the property with the given name is accessed on objects | 3039 * Whenever the property with the given name is accessed on objects |
(...skipping 656 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3700 | 3696 |
3701 | 3697 |
3702 void V8_EXPORT RegisterExtension(Extension* extension); | 3698 void V8_EXPORT RegisterExtension(Extension* extension); |
3703 | 3699 |
3704 | 3700 |
3705 /** | 3701 /** |
3706 * Ignore | 3702 * Ignore |
3707 */ | 3703 */ |
3708 class V8_EXPORT DeclareExtension { | 3704 class V8_EXPORT DeclareExtension { |
3709 public: | 3705 public: |
3710 V8_INLINE(DeclareExtension(Extension* extension)) { | 3706 V8_INLINE DeclareExtension(Extension* extension) { |
3711 RegisterExtension(extension); | 3707 RegisterExtension(extension); |
3712 } | 3708 } |
3713 }; | 3709 }; |
3714 | 3710 |
3715 | 3711 |
3716 // --- Statics --- | 3712 // --- Statics --- |
3717 | 3713 |
3718 | 3714 |
3719 Handle<Primitive> V8_EXPORT Undefined(); | 3715 Handle<Primitive> V8_EXPORT Undefined(); |
3720 Handle<Primitive> V8_EXPORT Null(); | 3716 Handle<Primitive> V8_EXPORT Null(); |
3721 Handle<Boolean> V8_EXPORT True(); | 3717 Handle<Boolean> V8_EXPORT True(); |
3722 Handle<Boolean> V8_EXPORT False(); | 3718 Handle<Boolean> V8_EXPORT False(); |
3723 | 3719 |
3724 V8_INLINE(Handle<Primitive> Undefined(Isolate* isolate)); | 3720 V8_INLINE Handle<Primitive> Undefined(Isolate* isolate); |
3725 V8_INLINE(Handle<Primitive> Null(Isolate* isolate)); | 3721 V8_INLINE Handle<Primitive> Null(Isolate* isolate); |
3726 V8_INLINE(Handle<Boolean> True(Isolate* isolate)); | 3722 V8_INLINE Handle<Boolean> True(Isolate* isolate); |
3727 V8_INLINE(Handle<Boolean> False(Isolate* isolate)); | 3723 V8_INLINE Handle<Boolean> False(Isolate* isolate); |
3728 | 3724 |
3729 | 3725 |
3730 /** | 3726 /** |
3731 * A set of constraints that specifies the limits of the runtime's memory use. | 3727 * A set of constraints that specifies the limits of the runtime's memory use. |
3732 * You must set the heap size before initializing the VM - the size cannot be | 3728 * You must set the heap size before initializing the VM - the size cannot be |
3733 * adjusted after the VM is initialized. | 3729 * adjusted after the VM is initialized. |
3734 * | 3730 * |
3735 * If you are using threads then you should hold the V8::Locker lock while | 3731 * If you are using threads then you should hold the V8::Locker lock while |
3736 * setting the stack limit and you must set a non-default stack limit separately | 3732 * setting the stack limit and you must set a non-default stack limit separately |
3737 * for each thread. | 3733 * for each thread. |
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3975 | 3971 |
3976 /** | 3972 /** |
3977 * Disposes the isolate. The isolate must not be entered by any | 3973 * Disposes the isolate. The isolate must not be entered by any |
3978 * thread to be disposable. | 3974 * thread to be disposable. |
3979 */ | 3975 */ |
3980 void Dispose(); | 3976 void Dispose(); |
3981 | 3977 |
3982 /** | 3978 /** |
3983 * Associate embedder-specific data with the isolate | 3979 * Associate embedder-specific data with the isolate |
3984 */ | 3980 */ |
3985 V8_INLINE(void SetData(void* data)); | 3981 V8_INLINE void SetData(void* data); |
3986 | 3982 |
3987 /** | 3983 /** |
3988 * Retrieve embedder-specific data from the isolate. | 3984 * Retrieve embedder-specific data from the isolate. |
3989 * Returns NULL if SetData has never been called. | 3985 * Returns NULL if SetData has never been called. |
3990 */ | 3986 */ |
3991 V8_INLINE(void* GetData()); | 3987 V8_INLINE void* GetData(); |
3992 | 3988 |
3993 /** | 3989 /** |
3994 * Get statistics about the heap memory usage. | 3990 * Get statistics about the heap memory usage. |
3995 */ | 3991 */ |
3996 void GetHeapStatistics(HeapStatistics* heap_statistics); | 3992 void GetHeapStatistics(HeapStatistics* heap_statistics); |
3997 | 3993 |
3998 /** | 3994 /** |
3999 * Adjusts the amount of registered external memory. Used to give V8 an | 3995 * Adjusts the amount of registered external memory. Used to give V8 an |
4000 * indication of the amount of externally allocated memory that is kept alive | 3996 * indication of the amount of externally allocated memory that is kept alive |
4001 * by JavaScript objects. V8 uses this to decide when to perform global | 3997 * by JavaScript objects. V8 uses this to decide when to perform global |
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4253 | 4249 |
4254 | 4250 |
4255 /** | 4251 /** |
4256 * Asserts that no action is performed that could cause a handle's value | 4252 * Asserts that no action is performed that could cause a handle's value |
4257 * to be modified. Useful when otherwise unsafe handle operations need to | 4253 * to be modified. Useful when otherwise unsafe handle operations need to |
4258 * be performed. | 4254 * be performed. |
4259 */ | 4255 */ |
4260 class V8_EXPORT AssertNoGCScope { | 4256 class V8_EXPORT AssertNoGCScope { |
4261 #ifndef DEBUG | 4257 #ifndef DEBUG |
4262 // TODO(yangguo): remove isolate argument. | 4258 // TODO(yangguo): remove isolate argument. |
4263 V8_INLINE(AssertNoGCScope(Isolate* isolate)) { } | 4259 V8_INLINE AssertNoGCScope(Isolate* isolate) {} |
4264 #else | 4260 #else |
4265 AssertNoGCScope(Isolate* isolate); | 4261 AssertNoGCScope(Isolate* isolate); |
4266 ~AssertNoGCScope(); | 4262 ~AssertNoGCScope(); |
4267 private: | 4263 private: |
4268 void* disallow_heap_allocation_; | 4264 void* disallow_heap_allocation_; |
4269 #endif | 4265 #endif |
4270 }; | 4266 }; |
4271 | 4267 |
4272 | 4268 |
4273 /** | 4269 /** |
(...skipping 682 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4956 static bool InContext(); | 4952 static bool InContext(); |
4957 | 4953 |
4958 /** Returns an isolate associated with a current context. */ | 4954 /** Returns an isolate associated with a current context. */ |
4959 v8::Isolate* GetIsolate(); | 4955 v8::Isolate* GetIsolate(); |
4960 | 4956 |
4961 /** | 4957 /** |
4962 * Gets the embedder data with the given index, which must have been set by a | 4958 * Gets the embedder data with the given index, which must have been set by a |
4963 * previous call to SetEmbedderData with the same index. Note that index 0 | 4959 * previous call to SetEmbedderData with the same index. Note that index 0 |
4964 * currently has a special meaning for Chrome's debugger. | 4960 * currently has a special meaning for Chrome's debugger. |
4965 */ | 4961 */ |
4966 V8_INLINE(Local<Value> GetEmbedderData(int index)); | 4962 V8_INLINE Local<Value> GetEmbedderData(int index); |
4967 | 4963 |
4968 /** | 4964 /** |
4969 * Sets the embedder data with the given index, growing the data as | 4965 * Sets the embedder data with the given index, growing the data as |
4970 * needed. Note that index 0 currently has a special meaning for Chrome's | 4966 * needed. Note that index 0 currently has a special meaning for Chrome's |
4971 * debugger. | 4967 * debugger. |
4972 */ | 4968 */ |
4973 void SetEmbedderData(int index, Handle<Value> value); | 4969 void SetEmbedderData(int index, Handle<Value> value); |
4974 | 4970 |
4975 /** | 4971 /** |
4976 * Gets a 2-byte-aligned native pointer from the embedder data with the given | 4972 * Gets a 2-byte-aligned native pointer from the embedder data with the given |
4977 * index, which must have bees set by a previous call to | 4973 * index, which must have bees set by a previous call to |
4978 * SetAlignedPointerInEmbedderData with the same index. Note that index 0 | 4974 * SetAlignedPointerInEmbedderData with the same index. Note that index 0 |
4979 * currently has a special meaning for Chrome's debugger. | 4975 * currently has a special meaning for Chrome's debugger. |
4980 */ | 4976 */ |
4981 V8_INLINE(void* GetAlignedPointerFromEmbedderData(int index)); | 4977 V8_INLINE void* GetAlignedPointerFromEmbedderData(int index); |
4982 | 4978 |
4983 /** | 4979 /** |
4984 * Sets a 2-byte-aligned native pointer in the embedder data with the given | 4980 * Sets a 2-byte-aligned native pointer in the embedder data with the given |
4985 * index, growing the data as needed. Note that index 0 currently has a | 4981 * index, growing the data as needed. Note that index 0 currently has a |
4986 * special meaning for Chrome's debugger. | 4982 * special meaning for Chrome's debugger. |
4987 */ | 4983 */ |
4988 void SetAlignedPointerInEmbedderData(int index, void* value); | 4984 void SetAlignedPointerInEmbedderData(int index, void* value); |
4989 | 4985 |
4990 /** | 4986 /** |
4991 * Control whether code generation from strings is allowed. Calling | 4987 * Control whether code generation from strings is allowed. Calling |
(...skipping 22 matching lines...) Expand all Loading... |
5014 * constructor are called. | 5010 * constructor are called. |
5015 */ | 5011 */ |
5016 void SetErrorMessageForCodeGenerationFromStrings(Handle<String> message); | 5012 void SetErrorMessageForCodeGenerationFromStrings(Handle<String> message); |
5017 | 5013 |
5018 /** | 5014 /** |
5019 * Stack-allocated class which sets the execution context for all | 5015 * Stack-allocated class which sets the execution context for all |
5020 * operations executed within a local scope. | 5016 * operations executed within a local scope. |
5021 */ | 5017 */ |
5022 class Scope { | 5018 class Scope { |
5023 public: | 5019 public: |
5024 explicit V8_INLINE(Scope(Handle<Context> context)) : context_(context) { | 5020 explicit V8_INLINE Scope(Handle<Context> context) : context_(context) { |
5025 context_->Enter(); | 5021 context_->Enter(); |
5026 } | 5022 } |
5027 // TODO(dcarney): deprecate | 5023 // TODO(dcarney): deprecate |
5028 V8_INLINE(Scope(Isolate* isolate, Persistent<Context>& context)) // NOLINT | 5024 V8_INLINE Scope(Isolate* isolate, Persistent<Context>& context) // NOLINT |
5029 : context_(Handle<Context>::New(isolate, context)) { | 5025 : context_(Handle<Context>::New(isolate, context)) { |
5030 context_->Enter(); | 5026 context_->Enter(); |
5031 } | 5027 } |
5032 V8_INLINE(~Scope()) { context_->Exit(); } | 5028 V8_INLINE ~Scope() { context_->Exit(); } |
5033 | 5029 |
5034 private: | 5030 private: |
5035 Handle<Context> context_; | 5031 Handle<Context> context_; |
5036 }; | 5032 }; |
5037 | 5033 |
5038 private: | 5034 private: |
5039 friend class Value; | 5035 friend class Value; |
5040 friend class Script; | 5036 friend class Script; |
5041 friend class Object; | 5037 friend class Object; |
5042 friend class Function; | 5038 friend class Function; |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5120 * // V8 still locked (1 level). | 5116 * // V8 still locked (1 level). |
5121 * } | 5117 * } |
5122 * // V8 Now no longer locked. | 5118 * // V8 Now no longer locked. |
5123 * \endcode | 5119 * \endcode |
5124 */ | 5120 */ |
5125 class V8_EXPORT Unlocker { | 5121 class V8_EXPORT Unlocker { |
5126 public: | 5122 public: |
5127 /** | 5123 /** |
5128 * Initialize Unlocker for a given Isolate. | 5124 * Initialize Unlocker for a given Isolate. |
5129 */ | 5125 */ |
5130 V8_INLINE(explicit Unlocker(Isolate* isolate)) { Initialize(isolate); } | 5126 V8_INLINE explicit Unlocker(Isolate* isolate) { Initialize(isolate); } |
5131 | 5127 |
5132 /** Deprecated. Use Isolate version instead. */ | 5128 /** Deprecated. Use Isolate version instead. */ |
5133 V8_DEPRECATED(Unlocker()); | 5129 V8_DEPRECATED(Unlocker()); |
5134 | 5130 |
5135 ~Unlocker(); | 5131 ~Unlocker(); |
5136 private: | 5132 private: |
5137 void Initialize(Isolate* isolate); | 5133 void Initialize(Isolate* isolate); |
5138 | 5134 |
5139 internal::Isolate* isolate_; | 5135 internal::Isolate* isolate_; |
5140 }; | 5136 }; |
5141 | 5137 |
5142 | 5138 |
5143 class V8_EXPORT Locker { | 5139 class V8_EXPORT Locker { |
5144 public: | 5140 public: |
5145 /** | 5141 /** |
5146 * Initialize Locker for a given Isolate. | 5142 * Initialize Locker for a given Isolate. |
5147 */ | 5143 */ |
5148 V8_INLINE(explicit Locker(Isolate* isolate)) { Initialize(isolate); } | 5144 V8_INLINE explicit Locker(Isolate* isolate) { Initialize(isolate); } |
5149 | 5145 |
5150 /** Deprecated. Use Isolate version instead. */ | 5146 /** Deprecated. Use Isolate version instead. */ |
5151 V8_DEPRECATED(Locker()); | 5147 V8_DEPRECATED(Locker()); |
5152 | 5148 |
5153 ~Locker(); | 5149 ~Locker(); |
5154 | 5150 |
5155 /** | 5151 /** |
5156 * Start preemption. | 5152 * Start preemption. |
5157 * | 5153 * |
5158 * When preemption is started, a timer is fired every n milliseconds | 5154 * When preemption is started, a timer is fired every n milliseconds |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5267 const intptr_t kHeapObjectTagMask = (1 << kHeapObjectTagSize) - 1; | 5263 const intptr_t kHeapObjectTagMask = (1 << kHeapObjectTagSize) - 1; |
5268 | 5264 |
5269 // Tag information for Smi. | 5265 // Tag information for Smi. |
5270 const int kSmiTag = 0; | 5266 const int kSmiTag = 0; |
5271 const int kSmiTagSize = 1; | 5267 const int kSmiTagSize = 1; |
5272 const intptr_t kSmiTagMask = (1 << kSmiTagSize) - 1; | 5268 const intptr_t kSmiTagMask = (1 << kSmiTagSize) - 1; |
5273 | 5269 |
5274 template <size_t ptr_size> struct SmiTagging; | 5270 template <size_t ptr_size> struct SmiTagging; |
5275 | 5271 |
5276 template<int kSmiShiftSize> | 5272 template<int kSmiShiftSize> |
5277 V8_INLINE(internal::Object* IntToSmi(int value)) { | 5273 V8_INLINE internal::Object* IntToSmi(int value) { |
5278 int smi_shift_bits = kSmiTagSize + kSmiShiftSize; | 5274 int smi_shift_bits = kSmiTagSize + kSmiShiftSize; |
5279 intptr_t tagged_value = | 5275 intptr_t tagged_value = |
5280 (static_cast<intptr_t>(value) << smi_shift_bits) | kSmiTag; | 5276 (static_cast<intptr_t>(value) << smi_shift_bits) | kSmiTag; |
5281 return reinterpret_cast<internal::Object*>(tagged_value); | 5277 return reinterpret_cast<internal::Object*>(tagged_value); |
5282 } | 5278 } |
5283 | 5279 |
5284 // Smi constants for 32-bit systems. | 5280 // Smi constants for 32-bit systems. |
5285 template <> struct SmiTagging<4> { | 5281 template <> struct SmiTagging<4> { |
5286 static const int kSmiShiftSize = 0; | 5282 static const int kSmiShiftSize = 0; |
5287 static const int kSmiValueSize = 31; | 5283 static const int kSmiValueSize = 31; |
5288 V8_INLINE(static int SmiToInt(internal::Object* value)) { | 5284 V8_INLINE static int SmiToInt(internal::Object* value) { |
5289 int shift_bits = kSmiTagSize + kSmiShiftSize; | 5285 int shift_bits = kSmiTagSize + kSmiShiftSize; |
5290 // Throw away top 32 bits and shift down (requires >> to be sign extending). | 5286 // Throw away top 32 bits and shift down (requires >> to be sign extending). |
5291 return static_cast<int>(reinterpret_cast<intptr_t>(value)) >> shift_bits; | 5287 return static_cast<int>(reinterpret_cast<intptr_t>(value)) >> shift_bits; |
5292 } | 5288 } |
5293 V8_INLINE(static internal::Object* IntToSmi(int value)) { | 5289 V8_INLINE static internal::Object* IntToSmi(int value) { |
5294 return internal::IntToSmi<kSmiShiftSize>(value); | 5290 return internal::IntToSmi<kSmiShiftSize>(value); |
5295 } | 5291 } |
5296 V8_INLINE(static bool IsValidSmi(intptr_t value)) { | 5292 V8_INLINE static bool IsValidSmi(intptr_t value) { |
5297 // To be representable as an tagged small integer, the two | 5293 // To be representable as an tagged small integer, the two |
5298 // most-significant bits of 'value' must be either 00 or 11 due to | 5294 // most-significant bits of 'value' must be either 00 or 11 due to |
5299 // sign-extension. To check this we add 01 to the two | 5295 // sign-extension. To check this we add 01 to the two |
5300 // most-significant bits, and check if the most-significant bit is 0 | 5296 // most-significant bits, and check if the most-significant bit is 0 |
5301 // | 5297 // |
5302 // CAUTION: The original code below: | 5298 // CAUTION: The original code below: |
5303 // bool result = ((value + 0x40000000) & 0x80000000) == 0; | 5299 // bool result = ((value + 0x40000000) & 0x80000000) == 0; |
5304 // may lead to incorrect results according to the C language spec, and | 5300 // may lead to incorrect results according to the C language spec, and |
5305 // in fact doesn't work correctly with gcc4.1.1 in some cases: The | 5301 // in fact doesn't work correctly with gcc4.1.1 in some cases: The |
5306 // compiler may produce undefined results in case of signed integer | 5302 // compiler may produce undefined results in case of signed integer |
5307 // overflow. The computation must be done w/ unsigned ints. | 5303 // overflow. The computation must be done w/ unsigned ints. |
5308 return static_cast<uintptr_t>(value + 0x40000000U) < 0x80000000U; | 5304 return static_cast<uintptr_t>(value + 0x40000000U) < 0x80000000U; |
5309 } | 5305 } |
5310 }; | 5306 }; |
5311 | 5307 |
5312 // Smi constants for 64-bit systems. | 5308 // Smi constants for 64-bit systems. |
5313 template <> struct SmiTagging<8> { | 5309 template <> struct SmiTagging<8> { |
5314 static const int kSmiShiftSize = 31; | 5310 static const int kSmiShiftSize = 31; |
5315 static const int kSmiValueSize = 32; | 5311 static const int kSmiValueSize = 32; |
5316 V8_INLINE(static int SmiToInt(internal::Object* value)) { | 5312 V8_INLINE static int SmiToInt(internal::Object* value) { |
5317 int shift_bits = kSmiTagSize + kSmiShiftSize; | 5313 int shift_bits = kSmiTagSize + kSmiShiftSize; |
5318 // Shift down and throw away top 32 bits. | 5314 // Shift down and throw away top 32 bits. |
5319 return static_cast<int>(reinterpret_cast<intptr_t>(value) >> shift_bits); | 5315 return static_cast<int>(reinterpret_cast<intptr_t>(value) >> shift_bits); |
5320 } | 5316 } |
5321 V8_INLINE(static internal::Object* IntToSmi(int value)) { | 5317 V8_INLINE static internal::Object* IntToSmi(int value) { |
5322 return internal::IntToSmi<kSmiShiftSize>(value); | 5318 return internal::IntToSmi<kSmiShiftSize>(value); |
5323 } | 5319 } |
5324 V8_INLINE(static bool IsValidSmi(intptr_t value)) { | 5320 V8_INLINE static bool IsValidSmi(intptr_t value) { |
5325 // To be representable as a long smi, the value must be a 32-bit integer. | 5321 // To be representable as a long smi, the value must be a 32-bit integer. |
5326 return (value == static_cast<int32_t>(value)); | 5322 return (value == static_cast<int32_t>(value)); |
5327 } | 5323 } |
5328 }; | 5324 }; |
5329 | 5325 |
5330 typedef SmiTagging<kApiPointerSize> PlatformSmiTagging; | 5326 typedef SmiTagging<kApiPointerSize> PlatformSmiTagging; |
5331 const int kSmiShiftSize = PlatformSmiTagging::kSmiShiftSize; | 5327 const int kSmiShiftSize = PlatformSmiTagging::kSmiShiftSize; |
5332 const int kSmiValueSize = PlatformSmiTagging::kSmiValueSize; | 5328 const int kSmiValueSize = PlatformSmiTagging::kSmiValueSize; |
5333 V8_INLINE(static bool SmiValuesAre31Bits()) { return kSmiValueSize == 31; } | 5329 V8_INLINE static bool SmiValuesAre31Bits() { return kSmiValueSize == 31; } |
5334 V8_INLINE(static bool SmiValuesAre32Bits()) { return kSmiValueSize == 32; } | 5330 V8_INLINE static bool SmiValuesAre32Bits() { return kSmiValueSize == 32; } |
5335 | 5331 |
5336 /** | 5332 /** |
5337 * This class exports constants and functionality from within v8 that | 5333 * This class exports constants and functionality from within v8 that |
5338 * is necessary to implement inline functions in the v8 api. Don't | 5334 * is necessary to implement inline functions in the v8 api. Don't |
5339 * depend on functions and constants defined here. | 5335 * depend on functions and constants defined here. |
5340 */ | 5336 */ |
5341 class Internals { | 5337 class Internals { |
5342 public: | 5338 public: |
5343 // These values match non-compiler-dependent values defined within | 5339 // These values match non-compiler-dependent values defined within |
5344 // the implementation of v8. | 5340 // the implementation of v8. |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5376 | 5372 |
5377 static const int kJSObjectType = 0xb1; | 5373 static const int kJSObjectType = 0xb1; |
5378 static const int kFirstNonstringType = 0x80; | 5374 static const int kFirstNonstringType = 0x80; |
5379 static const int kOddballType = 0x83; | 5375 static const int kOddballType = 0x83; |
5380 static const int kForeignType = 0x87; | 5376 static const int kForeignType = 0x87; |
5381 | 5377 |
5382 static const int kUndefinedOddballKind = 5; | 5378 static const int kUndefinedOddballKind = 5; |
5383 static const int kNullOddballKind = 3; | 5379 static const int kNullOddballKind = 3; |
5384 | 5380 |
5385 static void CheckInitializedImpl(v8::Isolate* isolate); | 5381 static void CheckInitializedImpl(v8::Isolate* isolate); |
5386 V8_INLINE(static void CheckInitialized(v8::Isolate* isolate)) { | 5382 V8_INLINE static void CheckInitialized(v8::Isolate* isolate) { |
5387 #ifdef V8_ENABLE_CHECKS | 5383 #ifdef V8_ENABLE_CHECKS |
5388 CheckInitializedImpl(isolate); | 5384 CheckInitializedImpl(isolate); |
5389 #endif | 5385 #endif |
5390 } | 5386 } |
5391 | 5387 |
5392 V8_INLINE(static bool HasHeapObjectTag(internal::Object* value)) { | 5388 V8_INLINE static bool HasHeapObjectTag(internal::Object* value) { |
5393 return ((reinterpret_cast<intptr_t>(value) & kHeapObjectTagMask) == | 5389 return ((reinterpret_cast<intptr_t>(value) & kHeapObjectTagMask) == |
5394 kHeapObjectTag); | 5390 kHeapObjectTag); |
5395 } | 5391 } |
5396 | 5392 |
5397 V8_INLINE(static int SmiValue(internal::Object* value)) { | 5393 V8_INLINE static int SmiValue(internal::Object* value) { |
5398 return PlatformSmiTagging::SmiToInt(value); | 5394 return PlatformSmiTagging::SmiToInt(value); |
5399 } | 5395 } |
5400 | 5396 |
5401 V8_INLINE(static internal::Object* IntToSmi(int value)) { | 5397 V8_INLINE static internal::Object* IntToSmi(int value) { |
5402 return PlatformSmiTagging::IntToSmi(value); | 5398 return PlatformSmiTagging::IntToSmi(value); |
5403 } | 5399 } |
5404 | 5400 |
5405 V8_INLINE(static bool IsValidSmi(intptr_t value)) { | 5401 V8_INLINE static bool IsValidSmi(intptr_t value) { |
5406 return PlatformSmiTagging::IsValidSmi(value); | 5402 return PlatformSmiTagging::IsValidSmi(value); |
5407 } | 5403 } |
5408 | 5404 |
5409 V8_INLINE(static int GetInstanceType(internal::Object* obj)) { | 5405 V8_INLINE static int GetInstanceType(internal::Object* obj) { |
5410 typedef internal::Object O; | 5406 typedef internal::Object O; |
5411 O* map = ReadField<O*>(obj, kHeapObjectMapOffset); | 5407 O* map = ReadField<O*>(obj, kHeapObjectMapOffset); |
5412 return ReadField<uint8_t>(map, kMapInstanceTypeOffset); | 5408 return ReadField<uint8_t>(map, kMapInstanceTypeOffset); |
5413 } | 5409 } |
5414 | 5410 |
5415 V8_INLINE(static int GetOddballKind(internal::Object* obj)) { | 5411 V8_INLINE static int GetOddballKind(internal::Object* obj) { |
5416 typedef internal::Object O; | 5412 typedef internal::Object O; |
5417 return SmiValue(ReadField<O*>(obj, kOddballKindOffset)); | 5413 return SmiValue(ReadField<O*>(obj, kOddballKindOffset)); |
5418 } | 5414 } |
5419 | 5415 |
5420 V8_INLINE(static bool IsExternalTwoByteString(int instance_type)) { | 5416 V8_INLINE static bool IsExternalTwoByteString(int instance_type) { |
5421 int representation = (instance_type & kFullStringRepresentationMask); | 5417 int representation = (instance_type & kFullStringRepresentationMask); |
5422 return representation == kExternalTwoByteRepresentationTag; | 5418 return representation == kExternalTwoByteRepresentationTag; |
5423 } | 5419 } |
5424 | 5420 |
5425 V8_INLINE(static uint8_t GetNodeFlag(internal::Object** obj, int shift)) { | 5421 V8_INLINE static uint8_t GetNodeFlag(internal::Object** obj, int shift) { |
5426 uint8_t* addr = reinterpret_cast<uint8_t*>(obj) + kNodeFlagsOffset; | 5422 uint8_t* addr = reinterpret_cast<uint8_t*>(obj) + kNodeFlagsOffset; |
5427 return *addr & static_cast<uint8_t>(1U << shift); | 5423 return *addr & static_cast<uint8_t>(1U << shift); |
5428 } | 5424 } |
5429 | 5425 |
5430 V8_INLINE(static void UpdateNodeFlag(internal::Object** obj, | 5426 V8_INLINE static void UpdateNodeFlag(internal::Object** obj, |
5431 bool value, int shift)) { | 5427 bool value, int shift) { |
5432 uint8_t* addr = reinterpret_cast<uint8_t*>(obj) + kNodeFlagsOffset; | 5428 uint8_t* addr = reinterpret_cast<uint8_t*>(obj) + kNodeFlagsOffset; |
5433 uint8_t mask = static_cast<uint8_t>(1 << shift); | 5429 uint8_t mask = static_cast<uint8_t>(1 << shift); |
5434 *addr = static_cast<uint8_t>((*addr & ~mask) | (value << shift)); | 5430 *addr = static_cast<uint8_t>((*addr & ~mask) | (value << shift)); |
5435 } | 5431 } |
5436 | 5432 |
5437 V8_INLINE(static uint8_t GetNodeState(internal::Object** obj)) { | 5433 V8_INLINE static uint8_t GetNodeState(internal::Object** obj) { |
5438 uint8_t* addr = reinterpret_cast<uint8_t*>(obj) + kNodeFlagsOffset; | 5434 uint8_t* addr = reinterpret_cast<uint8_t*>(obj) + kNodeFlagsOffset; |
5439 return *addr & kNodeStateMask; | 5435 return *addr & kNodeStateMask; |
5440 } | 5436 } |
5441 | 5437 |
5442 V8_INLINE(static void UpdateNodeState(internal::Object** obj, | 5438 V8_INLINE static void UpdateNodeState(internal::Object** obj, |
5443 uint8_t value)) { | 5439 uint8_t value) { |
5444 uint8_t* addr = reinterpret_cast<uint8_t*>(obj) + kNodeFlagsOffset; | 5440 uint8_t* addr = reinterpret_cast<uint8_t*>(obj) + kNodeFlagsOffset; |
5445 *addr = static_cast<uint8_t>((*addr & ~kNodeStateMask) | value); | 5441 *addr = static_cast<uint8_t>((*addr & ~kNodeStateMask) | value); |
5446 } | 5442 } |
5447 | 5443 |
5448 V8_INLINE(static void SetEmbedderData(v8::Isolate* isolate, void* data)) { | 5444 V8_INLINE static void SetEmbedderData(v8::Isolate* isolate, void* data) { |
5449 uint8_t* addr = reinterpret_cast<uint8_t*>(isolate) + | 5445 uint8_t* addr = reinterpret_cast<uint8_t*>(isolate) + |
5450 kIsolateEmbedderDataOffset; | 5446 kIsolateEmbedderDataOffset; |
5451 *reinterpret_cast<void**>(addr) = data; | 5447 *reinterpret_cast<void**>(addr) = data; |
5452 } | 5448 } |
5453 | 5449 |
5454 V8_INLINE(static void* GetEmbedderData(v8::Isolate* isolate)) { | 5450 V8_INLINE static void* GetEmbedderData(v8::Isolate* isolate) { |
5455 uint8_t* addr = reinterpret_cast<uint8_t*>(isolate) + | 5451 uint8_t* addr = reinterpret_cast<uint8_t*>(isolate) + |
5456 kIsolateEmbedderDataOffset; | 5452 kIsolateEmbedderDataOffset; |
5457 return *reinterpret_cast<void**>(addr); | 5453 return *reinterpret_cast<void**>(addr); |
5458 } | 5454 } |
5459 | 5455 |
5460 V8_INLINE(static internal::Object** GetRoot(v8::Isolate* isolate, | 5456 V8_INLINE static internal::Object** GetRoot(v8::Isolate* isolate, |
5461 int index)) { | 5457 int index) { |
5462 uint8_t* addr = reinterpret_cast<uint8_t*>(isolate) + kIsolateRootsOffset; | 5458 uint8_t* addr = reinterpret_cast<uint8_t*>(isolate) + kIsolateRootsOffset; |
5463 return reinterpret_cast<internal::Object**>(addr + index * kApiPointerSize); | 5459 return reinterpret_cast<internal::Object**>(addr + index * kApiPointerSize); |
5464 } | 5460 } |
5465 | 5461 |
5466 template <typename T> | 5462 template <typename T> V8_INLINE static T ReadField(Object* ptr, int offset) { |
5467 V8_INLINE(static T ReadField(Object* ptr, int offset)) { | |
5468 uint8_t* addr = reinterpret_cast<uint8_t*>(ptr) + offset - kHeapObjectTag; | 5463 uint8_t* addr = reinterpret_cast<uint8_t*>(ptr) + offset - kHeapObjectTag; |
5469 return *reinterpret_cast<T*>(addr); | 5464 return *reinterpret_cast<T*>(addr); |
5470 } | 5465 } |
5471 | 5466 |
5472 template <typename T> | 5467 template <typename T> |
5473 V8_INLINE(static T ReadEmbedderData(Context* context, int index)) { | 5468 V8_INLINE static T ReadEmbedderData(Context* context, int index) { |
5474 typedef internal::Object O; | 5469 typedef internal::Object O; |
5475 typedef internal::Internals I; | 5470 typedef internal::Internals I; |
5476 O* ctx = *reinterpret_cast<O**>(context); | 5471 O* ctx = *reinterpret_cast<O**>(context); |
5477 int embedder_data_offset = I::kContextHeaderSize + | 5472 int embedder_data_offset = I::kContextHeaderSize + |
5478 (internal::kApiPointerSize * I::kContextEmbedderDataIndex); | 5473 (internal::kApiPointerSize * I::kContextEmbedderDataIndex); |
5479 O* embedder_data = I::ReadField<O*>(ctx, embedder_data_offset); | 5474 O* embedder_data = I::ReadField<O*>(ctx, embedder_data_offset); |
5480 int value_offset = | 5475 int value_offset = |
5481 I::kFixedArrayHeaderSize + (internal::kApiPointerSize * index); | 5476 I::kFixedArrayHeaderSize + (internal::kApiPointerSize * index); |
5482 return I::ReadField<T>(embedder_data, value_offset); | 5477 return I::ReadField<T>(embedder_data, value_offset); |
5483 } | 5478 } |
5484 | 5479 |
5485 V8_INLINE(static bool CanCastToHeapObject(void* o)) { return false; } | 5480 V8_INLINE static bool CanCastToHeapObject(void* o) { return false; } |
5486 V8_INLINE(static bool CanCastToHeapObject(Context* o)) { return true; } | 5481 V8_INLINE static bool CanCastToHeapObject(Context* o) { return true; } |
5487 V8_INLINE(static bool CanCastToHeapObject(String* o)) { return true; } | 5482 V8_INLINE static bool CanCastToHeapObject(String* o) { return true; } |
5488 V8_INLINE(static bool CanCastToHeapObject(Object* o)) { return true; } | 5483 V8_INLINE static bool CanCastToHeapObject(Object* o) { return true; } |
5489 V8_INLINE(static bool CanCastToHeapObject(Message* o)) { return true; } | 5484 V8_INLINE static bool CanCastToHeapObject(Message* o) { return true; } |
5490 V8_INLINE(static bool CanCastToHeapObject(StackTrace* o)) { return true; } | 5485 V8_INLINE static bool CanCastToHeapObject(StackTrace* o) { return true; } |
5491 V8_INLINE(static bool CanCastToHeapObject(StackFrame* o)) { return true; } | 5486 V8_INLINE static bool CanCastToHeapObject(StackFrame* o) { return true; } |
5492 }; | 5487 }; |
5493 | 5488 |
5494 } // namespace internal | 5489 } // namespace internal |
5495 | 5490 |
5496 | 5491 |
5497 template <class T> | 5492 template <class T> |
5498 Local<T>::Local() : Handle<T>() { } | 5493 Local<T>::Local() : Handle<T>() { } |
5499 | 5494 |
5500 | 5495 |
5501 template <class T> | 5496 template <class T> |
(...skipping 934 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6436 */ | 6431 */ |
6437 | 6432 |
6438 | 6433 |
6439 } // namespace v8 | 6434 } // namespace v8 |
6440 | 6435 |
6441 | 6436 |
6442 #undef TYPE_CHECK | 6437 #undef TYPE_CHECK |
6443 | 6438 |
6444 | 6439 |
6445 #endif // V8_H_ | 6440 #endif // V8_H_ |
OLD | NEW |