libv8 3.3.10.4-amd64-freebsd-9 → 3.11.8.13-amd64-freebsd-9

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1 @@
1
+ --- !ruby/object:Libv8::Location::Vendor {}
@@ -0,0 +1,35 @@
1
+ require 'rbconfig'
2
+
3
+ module Libv8
4
+ module Arch
5
+ module_function
6
+
7
+ def x86_64_from_build_cpu
8
+ RbConfig::MAKEFILE_CONFIG['build_cpu'] == 'x86_64'
9
+ end
10
+
11
+ def x86_64_from_byte_length
12
+ ['foo'].pack('p').size == 8
13
+ end
14
+
15
+ def x86_64_from_arch_flag
16
+ RbConfig::MAKEFILE_CONFIG['ARCH_FLAG'] =~ /x86_64/
17
+ end
18
+
19
+ def rubinius?
20
+ Object.const_defined?(:RUBY_ENGINE) && RUBY_ENGINE == "rbx"
21
+ end
22
+
23
+ def x64?
24
+ if rubinius?
25
+ x86_64_from_build_cpu || x86_64_from_arch_flag
26
+ else
27
+ x86_64_from_byte_length
28
+ end
29
+ end
30
+
31
+ def libv8_arch
32
+ x64? ? "x64" : "ia32"
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,81 @@
1
+ require 'yaml'
2
+ require 'pathname'
3
+ require File.expand_path '../paths', __FILE__
4
+
5
+ module Libv8
6
+ class Location
7
+ def install!
8
+ File.open(Pathname(__FILE__).dirname.join('.location.yml'), "w") do |f|
9
+ f.write self.to_yaml
10
+ end
11
+ return 0
12
+ end
13
+
14
+ def self.load!
15
+ File.open(Pathname(__FILE__).dirname.join('.location.yml')) do |f|
16
+ YAML.load f
17
+ end
18
+ end
19
+
20
+ class Vendor < Location
21
+ def install!
22
+ require File.expand_path '../builder', __FILE__
23
+ builder = Libv8::Builder.new
24
+ exit_status = builder.build_libv8!
25
+ super if exit_status == 0
26
+ verify_installation!
27
+ return exit_status
28
+ end
29
+ def configure(context = MkmfContext.new)
30
+ context.incflags.insert 0, Libv8::Paths.include_paths.map{|p| "-I#{p}"}.join(" ") + " "
31
+ context.ldflags.insert 0, Libv8::Paths.object_paths.join(" ") + " "
32
+ end
33
+
34
+ def verify_installation!
35
+ Libv8::Paths.object_paths.each do |p|
36
+ fail ArchiveNotFound, p unless File.exists? p
37
+ end
38
+ end
39
+
40
+ class ArchiveNotFound < StandardError
41
+ def initialize(filename)
42
+ super "libv8 did not install properly, expected binary v8 archive '#{filename}'to exist, but it was not found"
43
+ end
44
+ end
45
+ end
46
+
47
+ class System < Location
48
+ def configure(context = MkmfContext.new)
49
+ context.send(:dir_config, 'v8')
50
+ context.send(:find_header, 'v8.h') or fail NotFoundError
51
+ end
52
+
53
+ class NotFoundError < StandardError
54
+ def initialize(*args)
55
+ super(<<-EOS)
56
+ You have chosen to use the version of V8 found on your system
57
+ and *not* the one that is bundle with the libv8 rubygem. However,
58
+ it could not be located. please make sure you have a version of
59
+ v8 that is compatible with #{Libv8::VERSION} installed. You may
60
+ need to special --with-v8-dir options if it is in a non-standard
61
+ location
62
+
63
+ thanks,
64
+ The Mgmt
65
+
66
+ EOS
67
+ end
68
+ end
69
+ end
70
+
71
+ class MkmfContext
72
+ def incflags
73
+ $INCFLAGS
74
+ end
75
+
76
+ def ldflags
77
+ $LDFLAGS
78
+ end
79
+ end
80
+ end
81
+ end
@@ -0,0 +1,38 @@
1
+ require 'rbconfig'
2
+ require File.expand_path '../arch', __FILE__
3
+
4
+ module Libv8
5
+ module Paths
6
+ module_function
7
+
8
+ def include_paths
9
+ ["#{vendored_source_path}/include"]
10
+ end
11
+
12
+ def object_paths
13
+ [libv8_object(:base), libv8_object(:snapshot)]
14
+ end
15
+
16
+ def config
17
+ RbConfig::MAKEFILE_CONFIG
18
+ end
19
+
20
+ def libv8_object(name)
21
+ filename = "#{libv8_profile}/libv8_#{name}.#{config['LIBEXT']}"
22
+ unless File.exists? filename
23
+ filename = "#{libv8_profile}/obj.target/tools/gyp/libv8_#{name}.#{config['LIBEXT']}"
24
+ end
25
+ return filename
26
+ end
27
+
28
+ def libv8_profile
29
+ base = "#{vendored_source_path}/out/#{Libv8::Arch.libv8_arch}"
30
+ debug = "#{base}.debug"
31
+ File.exists?(debug) ? debug : "#{base}.release"
32
+ end
33
+
34
+ def vendored_source_path
35
+ File.expand_path "../../../vendor/v8", __FILE__
36
+ end
37
+ end
38
+ end
@@ -1,15 +1,9 @@
1
- require 'pathname'
2
-
3
1
  require 'libv8/version'
2
+ require 'libv8/location'
4
3
 
5
4
  module Libv8
6
- LIBRARY_PATH = Pathname(__FILE__).dirname.join('libv8', 'build', 'v8').to_s
7
- def self.library_path
8
- LIBRARY_PATH
9
- end
10
-
11
- INCLUDE_PATH = Pathname(__FILE__).dirname.join('libv8', 'v8', 'include').to_s
12
- def self.include_path
13
- INCLUDE_PATH
5
+ def self.configure_makefile
6
+ location = Location.load!
7
+ location.configure
14
8
  end
15
9
  end
@@ -1,6 +1,3 @@
1
1
  module Libv8
2
- version_file = File.join(File.dirname(__FILE__), 'VERSION')
3
- V8_VERSION = File.exist?(version_file) ? File.read(version_file).chomp : "0.0"
4
- REVISION = ".4"
5
- VERSION = V8_VERSION + REVISION
2
+ VERSION = "3.11.8.13"
6
3
  end
@@ -339,6 +339,11 @@ class EXPORT Debug {
339
339
  static bool EnableAgent(const char* name, int port,
340
340
  bool wait_for_connection = false);
341
341
 
342
+ /**
343
+ * Disable the V8 builtin debug agent. The TCP/IP connection will be closed.
344
+ */
345
+ static void DisableAgent();
346
+
342
347
  /**
343
348
  * Makes V8 process all pending debug messages.
344
349
  *
@@ -64,6 +64,7 @@
64
64
  */
65
65
  namespace v8 {
66
66
 
67
+ typedef uint32_t SnapshotObjectId;
67
68
 
68
69
  /**
69
70
  * CpuProfileNode represents a node in a call graph.
@@ -219,8 +220,9 @@ class V8EXPORT HeapGraphEdge {
219
220
  // (e.g. parts of a ConsString).
220
221
  kHidden = 4, // A link that is needed for proper sizes
221
222
  // calculation, but may be hidden from user.
222
- kShortcut = 5 // A link that must not be followed during
223
+ kShortcut = 5, // A link that must not be followed during
223
224
  // sizes calculation.
225
+ kWeak = 6 // A weak reference (ignored by the GC).
224
226
  };
225
227
 
226
228
  /** Returns edge type (see HeapGraphEdge::Type). */
@@ -254,7 +256,9 @@ class V8EXPORT HeapGraphNode {
254
256
  kClosure = 5, // Function closure.
255
257
  kRegExp = 6, // RegExp.
256
258
  kHeapNumber = 7, // Number stored in the heap.
257
- kNative = 8 // Native object (not from V8 heap).
259
+ kNative = 8, // Native object (not from V8 heap).
260
+ kSynthetic = 9 // Synthetic object, usualy used for grouping
261
+ // snapshot items together.
258
262
  };
259
263
 
260
264
  /** Returns node type (see HeapGraphNode::Type). */
@@ -269,16 +273,9 @@ class V8EXPORT HeapGraphNode {
269
273
 
270
274
  /**
271
275
  * Returns node id. For the same heap object, the id remains the same
272
- * across all snapshots. Not applicable to aggregated heap snapshots
273
- * as they only contain aggregated instances.
276
+ * across all snapshots.
274
277
  */
275
- uint64_t GetId() const;
276
-
277
- /**
278
- * Returns the number of instances. Only applicable to aggregated
279
- * heap snapshots.
280
- */
281
- int GetInstancesCount() const;
278
+ SnapshotObjectId GetId() const;
282
279
 
283
280
  /** Returns node's own size, in bytes. */
284
281
  int GetSelfSize() const;
@@ -288,14 +285,8 @@ class V8EXPORT HeapGraphNode {
288
285
  * the objects that are reachable only from this object. In other
289
286
  * words, the size of memory that will be reclaimed having this node
290
287
  * collected.
291
- *
292
- * Exact retained size calculation has O(N) (number of nodes)
293
- * computational complexity, while approximate has O(1). It is
294
- * assumed that initially heap profiling tools provide approximate
295
- * sizes for all nodes, and then exact sizes are calculated for the
296
- * most 'interesting' nodes.
297
288
  */
298
- int GetRetainedSize(bool exact) const;
289
+ int GetRetainedSize() const;
299
290
 
300
291
  /** Returns child nodes count of the node. */
301
292
  int GetChildrenCount() const;
@@ -314,6 +305,12 @@ class V8EXPORT HeapGraphNode {
314
305
  * path from the snapshot root to the current node.
315
306
  */
316
307
  const HeapGraphNode* GetDominatorNode() const;
308
+
309
+ /**
310
+ * Finds and returns a value from the heap corresponding to this node,
311
+ * if the value is still reachable.
312
+ */
313
+ Handle<Value> GetHeapValue() const;
317
314
  };
318
315
 
319
316
 
@@ -323,9 +320,7 @@ class V8EXPORT HeapGraphNode {
323
320
  class V8EXPORT HeapSnapshot {
324
321
  public:
325
322
  enum Type {
326
- kFull = 0, // Heap snapshot with all instances and references.
327
- kAggregated = 1 // Snapshot doesn't contain individual heap entries,
328
- // instead they are grouped by constructor name.
323
+ kFull = 0 // Heap snapshot with all instances and references.
329
324
  };
330
325
  enum SerializationFormat {
331
326
  kJSON = 0 // See format description near 'Serialize' method.
@@ -344,7 +339,16 @@ class V8EXPORT HeapSnapshot {
344
339
  const HeapGraphNode* GetRoot() const;
345
340
 
346
341
  /** Returns a node by its id. */
347
- const HeapGraphNode* GetNodeById(uint64_t id) const;
342
+ const HeapGraphNode* GetNodeById(SnapshotObjectId id) const;
343
+
344
+ /** Returns total nodes count in the snapshot. */
345
+ int GetNodesCount() const;
346
+
347
+ /** Returns a node by index. */
348
+ const HeapGraphNode* GetNode(int index) const;
349
+
350
+ /** Returns a max seen JS object Id. */
351
+ SnapshotObjectId GetMaxSnapshotJSObjectId() const;
348
352
 
349
353
  /**
350
354
  * Deletes the snapshot and removes it from HeapProfiler's list.
@@ -364,16 +368,20 @@ class V8EXPORT HeapSnapshot {
364
368
  * with the following structure:
365
369
  *
366
370
  * {
367
- * snapshot: {title: "...", uid: nnn},
368
- * nodes: [
369
- * meta-info (JSON string),
370
- * nodes themselves
371
- * ],
372
- * strings: [strings]
371
+ * snapshot: {
372
+ * title: "...",
373
+ * uid: nnn,
374
+ * meta: { meta-info },
375
+ * node_count: nnn,
376
+ * edge_count: nnn
377
+ * },
378
+ * nodes: [nodes array],
379
+ * edges: [edges array],
380
+ * strings: [strings array]
373
381
  * }
374
382
  *
375
- * Outgoing node links are stored after each node. Nodes reference strings
376
- * and other nodes by their indexes in corresponding arrays.
383
+ * Nodes reference strings, other nodes, and edges by their indexes
384
+ * in corresponding arrays.
377
385
  */
378
386
  void Serialize(OutputStream* stream, SerializationFormat format) const;
379
387
  };
@@ -404,6 +412,19 @@ class V8EXPORT HeapProfiler {
404
412
  /** Returns a profile by uid. */
405
413
  static const HeapSnapshot* FindSnapshot(unsigned uid);
406
414
 
415
+ /**
416
+ * Returns SnapshotObjectId for a heap object referenced by |value| if
417
+ * it has been seen by the heap profiler, kUnknownObjectId otherwise.
418
+ */
419
+ static SnapshotObjectId GetSnapshotObjectId(Handle<Value> value);
420
+
421
+ /**
422
+ * A constant for invalid SnapshotObjectId. GetSnapshotObjectId will return
423
+ * it in case heap profiler cannot find id for the object passed as
424
+ * parameter. HeapSnapshot::GetNodeById will always return NULL for such id.
425
+ */
426
+ static const SnapshotObjectId kUnknownObjectId = 0;
427
+
407
428
  /**
408
429
  * Takes a heap snapshot and returns it. Title may be an empty string.
409
430
  * See HeapSnapshot::Type for types description.
@@ -413,6 +434,33 @@ class V8EXPORT HeapProfiler {
413
434
  HeapSnapshot::Type type = HeapSnapshot::kFull,
414
435
  ActivityControl* control = NULL);
415
436
 
437
+ /**
438
+ * Starts tracking of heap objects population statistics. After calling
439
+ * this method, all heap objects relocations done by the garbage collector
440
+ * are being registered.
441
+ */
442
+ static void StartHeapObjectsTracking();
443
+
444
+ /**
445
+ * Adds a new time interval entry to the aggregated statistics array. The
446
+ * time interval entry contains information on the current heap objects
447
+ * population size. The method also updates aggregated statistics and
448
+ * reports updates for all previous time intervals via the OutputStream
449
+ * object. Updates on each time interval are provided as a stream of the
450
+ * HeapStatsUpdate structure instances.
451
+ *
452
+ * StartHeapObjectsTracking must be called before the first call to this
453
+ * method.
454
+ */
455
+ static void PushHeapObjectsStats(OutputStream* stream);
456
+
457
+ /**
458
+ * Stops tracking of heap objects population statistics, cleans up all
459
+ * collected data. StartHeapObjectsTracking must be called again prior to
460
+ * calling PushHeapObjectsStats next time.
461
+ */
462
+ static void StopHeapObjectsTracking();
463
+
416
464
  /**
417
465
  * Deletes all snapshots taken. All previously returned pointers to
418
466
  * snapshots and their contents become invalid after this call.
@@ -430,6 +478,9 @@ class V8EXPORT HeapProfiler {
430
478
  * handle.
431
479
  */
432
480
  static const uint16_t kPersistentHandleNoClassId = 0;
481
+
482
+ /** Returns the number of currently existing persistent handles. */
483
+ static int GetPersistentHandleCount();
433
484
  };
434
485
 
435
486
 
@@ -472,11 +523,22 @@ class V8EXPORT RetainedObjectInfo { // NOLINT
472
523
  virtual intptr_t GetHash() = 0;
473
524
 
474
525
  /**
475
- * Returns human-readable label. It must be a NUL-terminated UTF-8
526
+ * Returns human-readable label. It must be a null-terminated UTF-8
476
527
  * encoded string. V8 copies its contents during a call to GetLabel.
477
528
  */
478
529
  virtual const char* GetLabel() = 0;
479
530
 
531
+ /**
532
+ * Returns human-readable group label. It must be a null-terminated UTF-8
533
+ * encoded string. V8 copies its contents during a call to GetGroupLabel.
534
+ * Heap snapshot generator will collect all the group names, create
535
+ * top level entries with these names and attach the objects to the
536
+ * corresponding top level group objects. There is a default
537
+ * implementation which is required because embedders don't have their
538
+ * own implementation yet.
539
+ */
540
+ virtual const char* GetGroupLabel() { return GetLabel(); }
541
+
480
542
  /**
481
543
  * Returns element count in case if a global handle retains
482
544
  * a subgraph by holding one of its nodes.
@@ -496,6 +558,19 @@ class V8EXPORT RetainedObjectInfo { // NOLINT
496
558
  };
497
559
 
498
560
 
561
+ /**
562
+ * A struct for exporting HeapStats data from V8, using "push" model.
563
+ * See HeapProfiler::PushHeapObjectsStats.
564
+ */
565
+ struct HeapStatsUpdate {
566
+ HeapStatsUpdate(uint32_t index, uint32_t count, uint32_t size)
567
+ : index(index), count(count), size(size) { }
568
+ uint32_t index; // Index of the time interval that was changed.
569
+ uint32_t count; // New value of count field for the interval with this index.
570
+ uint32_t size; // New value of size field for the interval with this index.
571
+ };
572
+
573
+
499
574
  } // namespace v8
500
575
 
501
576
 
@@ -1,4 +1,4 @@
1
- // Copyright 2011 the V8 project authors. All rights reserved.
1
+ // Copyright 2012 the V8 project authors. All rights reserved.
2
2
  // Redistribution and use in source and binary forms, with or without
3
3
  // modification, are permitted provided that the following conditions are
4
4
  // met:
@@ -62,11 +62,13 @@
62
62
 
63
63
  #else // _WIN32
64
64
 
65
- // Setup for Linux shared library export. There is no need to distinguish
66
- // between building or using the V8 shared library, but we should not
67
- // export symbols when we are building a static library.
65
+ // Setup for Linux shared library export.
68
66
  #if defined(__GNUC__) && (__GNUC__ >= 4) && defined(V8_SHARED)
67
+ #ifdef BUILDING_V8_SHARED
69
68
  #define V8EXPORT __attribute__ ((visibility("default")))
69
+ #else
70
+ #define V8EXPORT
71
+ #endif
70
72
  #else // defined(__GNUC__) && (__GNUC__ >= 4)
71
73
  #define V8EXPORT
72
74
  #endif // defined(__GNUC__) && (__GNUC__ >= 4)
@@ -80,9 +82,11 @@ namespace v8 {
80
82
 
81
83
  class Context;
82
84
  class String;
85
+ class StringObject;
83
86
  class Value;
84
87
  class Utils;
85
88
  class Number;
89
+ class NumberObject;
86
90
  class Object;
87
91
  class Array;
88
92
  class Int32;
@@ -90,6 +94,7 @@ class Uint32;
90
94
  class External;
91
95
  class Primitive;
92
96
  class Boolean;
97
+ class BooleanObject;
93
98
  class Integer;
94
99
  class Function;
95
100
  class Date;
@@ -104,6 +109,7 @@ class Data;
104
109
  class AccessorInfo;
105
110
  class StackTrace;
106
111
  class StackFrame;
112
+ class Isolate;
107
113
 
108
114
  namespace internal {
109
115
 
@@ -165,16 +171,15 @@ typedef void (*WeakReferenceCallback)(Persistent<Value> object,
165
171
  */
166
172
  template <class T> class Handle {
167
173
  public:
168
-
169
174
  /**
170
175
  * Creates an empty handle.
171
176
  */
172
- inline Handle();
177
+ inline Handle() : val_(0) {}
173
178
 
174
179
  /**
175
180
  * Creates a new handle for the specified value.
176
181
  */
177
- inline explicit Handle(T* val) : val_(val) { }
182
+ inline explicit Handle(T* val) : val_(val) {}
178
183
 
179
184
  /**
180
185
  * Creates a handle for the contents of the specified handle. This
@@ -201,14 +206,14 @@ template <class T> class Handle {
201
206
  */
202
207
  inline bool IsEmpty() const { return val_ == 0; }
203
208
 
204
- inline T* operator->() const { return val_; }
205
-
206
- inline T* operator*() const { return val_; }
207
-
208
209
  /**
209
210
  * Sets the handle to be empty. IsEmpty() will then return true.
210
211
  */
211
- inline void Clear() { this->val_ = 0; }
212
+ inline void Clear() { val_ = 0; }
213
+
214
+ inline T* operator->() const { return val_; }
215
+
216
+ inline T* operator*() const { return val_; }
212
217
 
213
218
  /**
214
219
  * Checks whether two handles are the same.
@@ -312,7 +317,6 @@ template <class T> class Local : public Handle<T> {
312
317
  */
313
318
  template <class T> class Persistent : public Handle<T> {
314
319
  public:
315
-
316
320
  /**
317
321
  * Creates an empty persistent handle that doesn't point to any
318
322
  * storage cell.
@@ -586,7 +590,6 @@ class ScriptOrigin {
586
590
  */
587
591
  class V8EXPORT Script {
588
592
  public:
589
-
590
593
  /**
591
594
  * Compiles the specified script (context-independent).
592
595
  *
@@ -858,18 +861,17 @@ class V8EXPORT StackFrame {
858
861
  */
859
862
  class Value : public Data {
860
863
  public:
861
-
862
864
  /**
863
865
  * Returns true if this value is the undefined value. See ECMA-262
864
866
  * 4.3.10.
865
867
  */
866
- V8EXPORT bool IsUndefined() const;
868
+ inline bool IsUndefined() const;
867
869
 
868
870
  /**
869
871
  * Returns true if this value is the null value. See ECMA-262
870
872
  * 4.3.11.
871
873
  */
872
- V8EXPORT bool IsNull() const;
874
+ inline bool IsNull() const;
873
875
 
874
876
  /**
875
877
  * Returns true if this value is true.
@@ -932,6 +934,26 @@ class Value : public Data {
932
934
  */
933
935
  V8EXPORT bool IsDate() const;
934
936
 
937
+ /**
938
+ * Returns true if this value is a Boolean object.
939
+ */
940
+ V8EXPORT bool IsBooleanObject() const;
941
+
942
+ /**
943
+ * Returns true if this value is a Number object.
944
+ */
945
+ V8EXPORT bool IsNumberObject() const;
946
+
947
+ /**
948
+ * Returns true if this value is a String object.
949
+ */
950
+ V8EXPORT bool IsStringObject() const;
951
+
952
+ /**
953
+ * Returns true if this value is a NativeError.
954
+ */
955
+ V8EXPORT bool IsNativeError() const;
956
+
935
957
  /**
936
958
  * Returns true if this value is a RegExp.
937
959
  */
@@ -963,7 +985,11 @@ class Value : public Data {
963
985
  V8EXPORT bool StrictEquals(Handle<Value> that) const;
964
986
 
965
987
  private:
988
+ inline bool QuickIsUndefined() const;
989
+ inline bool QuickIsNull() const;
966
990
  inline bool QuickIsString() const;
991
+ V8EXPORT bool FullIsUndefined() const;
992
+ V8EXPORT bool FullIsNull() const;
967
993
  V8EXPORT bool FullIsString() const;
968
994
  };
969
995
 
@@ -990,7 +1016,6 @@ class Boolean : public Primitive {
990
1016
  */
991
1017
  class String : public Primitive {
992
1018
  public:
993
-
994
1019
  /**
995
1020
  * Returns the number of characters in this string.
996
1021
  */
@@ -1002,6 +1027,14 @@ class String : public Primitive {
1002
1027
  */
1003
1028
  V8EXPORT int Utf8Length() const;
1004
1029
 
1030
+ /**
1031
+ * A fast conservative check for non-ASCII characters. May
1032
+ * return true even for ASCII strings, but if it returns
1033
+ * false you can be sure that all characters are in the range
1034
+ * 0-127.
1035
+ */
1036
+ V8EXPORT bool MayContainNonAscii() const;
1037
+
1005
1038
  /**
1006
1039
  * Write the contents of the string to an external buffer.
1007
1040
  * If no arguments are given, expects the buffer to be large
@@ -1021,34 +1054,39 @@ class String : public Primitive {
1021
1054
  * \param length The number of characters to copy from the string. For
1022
1055
  * WriteUtf8 the number of bytes in the buffer.
1023
1056
  * \param nchars_ref The number of characters written, can be NULL.
1024
- * \param hints Various hints that might affect performance of this or
1057
+ * \param options Various options that might affect performance of this or
1025
1058
  * subsequent operations.
1026
1059
  * \return The number of characters copied to the buffer excluding the null
1027
1060
  * terminator. For WriteUtf8: The number of bytes copied to the buffer
1028
- * including the null terminator.
1061
+ * including the null terminator (if written).
1029
1062
  */
1030
- enum WriteHints {
1031
- NO_HINTS = 0,
1032
- HINT_MANY_WRITES_EXPECTED = 1
1063
+ enum WriteOptions {
1064
+ NO_OPTIONS = 0,
1065
+ HINT_MANY_WRITES_EXPECTED = 1,
1066
+ NO_NULL_TERMINATION = 2
1033
1067
  };
1034
1068
 
1069
+ // 16-bit character codes.
1035
1070
  V8EXPORT int Write(uint16_t* buffer,
1036
1071
  int start = 0,
1037
1072
  int length = -1,
1038
- WriteHints hints = NO_HINTS) const; // UTF-16
1073
+ int options = NO_OPTIONS) const;
1074
+ // ASCII characters.
1039
1075
  V8EXPORT int WriteAscii(char* buffer,
1040
1076
  int start = 0,
1041
1077
  int length = -1,
1042
- WriteHints hints = NO_HINTS) const; // ASCII
1078
+ int options = NO_OPTIONS) const;
1079
+ // UTF-8 encoded characters.
1043
1080
  V8EXPORT int WriteUtf8(char* buffer,
1044
1081
  int length = -1,
1045
1082
  int* nchars_ref = NULL,
1046
- WriteHints hints = NO_HINTS) const; // UTF-8
1083
+ int options = NO_OPTIONS) const;
1047
1084
 
1048
1085
  /**
1049
1086
  * A zero length string.
1050
1087
  */
1051
1088
  V8EXPORT static v8::Local<v8::String> Empty();
1089
+ inline static v8::Local<v8::String> Empty(Isolate* isolate);
1052
1090
 
1053
1091
  /**
1054
1092
  * Returns true if the string is external
@@ -1056,7 +1094,7 @@ class String : public Primitive {
1056
1094
  V8EXPORT bool IsExternal() const;
1057
1095
 
1058
1096
  /**
1059
- * Returns true if the string is both external and ascii
1097
+ * Returns true if the string is both external and ASCII
1060
1098
  */
1061
1099
  V8EXPORT bool IsExternalAscii() const;
1062
1100
 
@@ -1113,11 +1151,11 @@ class String : public Primitive {
1113
1151
  };
1114
1152
 
1115
1153
  /**
1116
- * An ExternalAsciiStringResource is a wrapper around an ascii
1154
+ * An ExternalAsciiStringResource is a wrapper around an ASCII
1117
1155
  * string buffer that resides outside V8's heap. Implement an
1118
1156
  * ExternalAsciiStringResource to manage the life cycle of the
1119
1157
  * underlying buffer. Note that the string data must be immutable
1120
- * and that the data must be strict 7-bit ASCII, not Latin1 or
1158
+ * and that the data must be strict (7-bit) ASCII, not Latin-1 or
1121
1159
  * UTF-8, which would require special treatment internally in the
1122
1160
  * engine and, in the case of UTF-8, do not allow efficient indexing.
1123
1161
  * Use String::New or convert to 16 bit data for non-ASCII.
@@ -1133,7 +1171,7 @@ class String : public Primitive {
1133
1171
  virtual ~ExternalAsciiStringResource() {}
1134
1172
  /** The string data from the underlying buffer.*/
1135
1173
  virtual const char* data() const = 0;
1136
- /** The number of ascii characters in the string.*/
1174
+ /** The number of ASCII characters in the string.*/
1137
1175
  virtual size_t length() const = 0;
1138
1176
  protected:
1139
1177
  ExternalAsciiStringResource() {}
@@ -1146,17 +1184,18 @@ class String : public Primitive {
1146
1184
  inline ExternalStringResource* GetExternalStringResource() const;
1147
1185
 
1148
1186
  /**
1149
- * Get the ExternalAsciiStringResource for an external ascii string.
1187
+ * Get the ExternalAsciiStringResource for an external ASCII string.
1150
1188
  * Returns NULL if IsExternalAscii() doesn't return true.
1151
1189
  */
1152
- V8EXPORT ExternalAsciiStringResource* GetExternalAsciiStringResource() const;
1190
+ V8EXPORT const ExternalAsciiStringResource* GetExternalAsciiStringResource()
1191
+ const;
1153
1192
 
1154
1193
  static inline String* Cast(v8::Value* obj);
1155
1194
 
1156
1195
  /**
1157
- * Allocates a new string from either utf-8 encoded or ascii data.
1196
+ * Allocates a new string from either UTF-8 encoded or ASCII data.
1158
1197
  * The second parameter 'length' gives the buffer length.
1159
- * If the data is utf-8 encoded, the caller must
1198
+ * If the data is UTF-8 encoded, the caller must
1160
1199
  * be careful to supply the length parameter.
1161
1200
  * If it is not given, the function calls
1162
1201
  * 'strlen' to determine the buffer length, it might be
@@ -1164,7 +1203,7 @@ class String : public Primitive {
1164
1203
  */
1165
1204
  V8EXPORT static Local<String> New(const char* data, int length = -1);
1166
1205
 
1167
- /** Allocates a new string from utf16 data.*/
1206
+ /** Allocates a new string from 16-bit character codes.*/
1168
1207
  V8EXPORT static Local<String> New(const uint16_t* data, int length = -1);
1169
1208
 
1170
1209
  /** Creates a symbol. Returns one if it exists already.*/
@@ -1175,7 +1214,7 @@ class String : public Primitive {
1175
1214
  * passed in as parameters.
1176
1215
  */
1177
1216
  V8EXPORT static Local<String> Concat(Handle<String> left,
1178
- Handle<String>right);
1217
+ Handle<String> right);
1179
1218
 
1180
1219
  /**
1181
1220
  * Creates a new external string using the data defined in the given
@@ -1199,14 +1238,13 @@ class String : public Primitive {
1199
1238
  V8EXPORT bool MakeExternal(ExternalStringResource* resource);
1200
1239
 
1201
1240
  /**
1202
- * Creates a new external string using the ascii data defined in the given
1241
+ * Creates a new external string using the ASCII data defined in the given
1203
1242
  * resource. When the external string is no longer live on V8's heap the
1204
1243
  * resource will be disposed by calling its Dispose method. The caller of
1205
1244
  * this function should not otherwise delete or modify the resource. Neither
1206
1245
  * should the underlying buffer be deallocated or modified except through the
1207
1246
  * destructor of the external string resource.
1208
- */
1209
- V8EXPORT static Local<String> NewExternal(
1247
+ */ V8EXPORT static Local<String> NewExternal(
1210
1248
  ExternalAsciiStringResource* resource);
1211
1249
 
1212
1250
  /**
@@ -1225,18 +1263,18 @@ class String : public Primitive {
1225
1263
  */
1226
1264
  V8EXPORT bool CanMakeExternal();
1227
1265
 
1228
- /** Creates an undetectable string from the supplied ascii or utf-8 data.*/
1266
+ /** Creates an undetectable string from the supplied ASCII or UTF-8 data.*/
1229
1267
  V8EXPORT static Local<String> NewUndetectable(const char* data,
1230
1268
  int length = -1);
1231
1269
 
1232
- /** Creates an undetectable string from the supplied utf-16 data.*/
1270
+ /** Creates an undetectable string from the supplied 16-bit character codes.*/
1233
1271
  V8EXPORT static Local<String> NewUndetectable(const uint16_t* data,
1234
1272
  int length = -1);
1235
1273
 
1236
1274
  /**
1237
- * Converts an object to a utf8-encoded character array. Useful if
1275
+ * Converts an object to a UTF-8-encoded character array. Useful if
1238
1276
  * you want to print the object. If conversion to a string fails
1239
- * (eg. due to an exception in the toString() method of the object)
1277
+ * (e.g. due to an exception in the toString() method of the object)
1240
1278
  * then the length() method returns 0 and the * operator returns
1241
1279
  * NULL.
1242
1280
  */
@@ -1257,7 +1295,7 @@ class String : public Primitive {
1257
1295
  };
1258
1296
 
1259
1297
  /**
1260
- * Converts an object to an ascii string.
1298
+ * Converts an object to an ASCII string.
1261
1299
  * Useful if you want to print the object.
1262
1300
  * If conversion to a string fails (eg. due to an exception in the toString()
1263
1301
  * method of the object) then the length() method returns 0 and the * operator
@@ -1317,7 +1355,7 @@ class Number : public Primitive {
1317
1355
  static inline Number* Cast(v8::Value* obj);
1318
1356
  private:
1319
1357
  V8EXPORT Number();
1320
- static void CheckCast(v8::Value* obj);
1358
+ V8EXPORT static void CheckCast(v8::Value* obj);
1321
1359
  };
1322
1360
 
1323
1361
 
@@ -1440,6 +1478,13 @@ class Object : public Value {
1440
1478
 
1441
1479
  V8EXPORT Local<Value> Get(uint32_t index);
1442
1480
 
1481
+ /**
1482
+ * Gets the property attributes of a property which can be None or
1483
+ * any combination of ReadOnly, DontEnum and DontDelete. Returns
1484
+ * None when the property doesn't exist.
1485
+ */
1486
+ V8EXPORT PropertyAttribute GetPropertyAttributes(Handle<Value> key);
1487
+
1443
1488
  // TODO(1245389): Replace the type-specific versions of these
1444
1489
  // functions with generic ones that accept a Handle<Value> key.
1445
1490
  V8EXPORT bool Has(Handle<String> key);
@@ -1469,6 +1514,13 @@ class Object : public Value {
1469
1514
  */
1470
1515
  V8EXPORT Local<Array> GetPropertyNames();
1471
1516
 
1517
+ /**
1518
+ * This function has the same functionality as GetPropertyNames but
1519
+ * the returned array doesn't contain the names of properties from
1520
+ * prototype objects.
1521
+ */
1522
+ V8EXPORT Local<Array> GetOwnPropertyNames();
1523
+
1472
1524
  /**
1473
1525
  * Get the prototype object. This does not skip objects marked to
1474
1526
  * be skipped by __proto__ and it does not consult the security
@@ -1623,7 +1675,7 @@ class Object : public Value {
1623
1675
  V8EXPORT bool IsCallable();
1624
1676
 
1625
1677
  /**
1626
- * Call an Object as a function if a callback is set by the
1678
+ * Call an Object as a function if a callback is set by the
1627
1679
  * ObjectTemplate::SetCallAsFunctionHandler method.
1628
1680
  */
1629
1681
  V8EXPORT Local<Value> CallAsFunction(Handle<Object> recv,
@@ -1640,6 +1692,7 @@ class Object : public Value {
1640
1692
 
1641
1693
  V8EXPORT static Local<Object> New();
1642
1694
  static inline Object* Cast(Value* obj);
1695
+
1643
1696
  private:
1644
1697
  V8EXPORT Object();
1645
1698
  V8EXPORT static void CheckCast(Value* obj);
@@ -1676,7 +1729,7 @@ class Array : public Object {
1676
1729
  static inline Array* Cast(Value* obj);
1677
1730
  private:
1678
1731
  V8EXPORT Array();
1679
- static void CheckCast(Value* obj);
1732
+ V8EXPORT static void CheckCast(Value* obj);
1680
1733
  };
1681
1734
 
1682
1735
 
@@ -1693,14 +1746,29 @@ class Function : public Object {
1693
1746
  V8EXPORT void SetName(Handle<String> name);
1694
1747
  V8EXPORT Handle<Value> GetName() const;
1695
1748
 
1749
+ /**
1750
+ * Name inferred from variable or property assignment of this function.
1751
+ * Used to facilitate debugging and profiling of JavaScript code written
1752
+ * in an OO style, where many functions are anonymous but are assigned
1753
+ * to object properties.
1754
+ */
1755
+ V8EXPORT Handle<Value> GetInferredName() const;
1756
+
1696
1757
  /**
1697
1758
  * Returns zero based line number of function body and
1698
1759
  * kLineOffsetNotFound if no information available.
1699
1760
  */
1700
1761
  V8EXPORT int GetScriptLineNumber() const;
1762
+ /**
1763
+ * Returns zero based column number of function body and
1764
+ * kLineOffsetNotFound if no information available.
1765
+ */
1766
+ V8EXPORT int GetScriptColumnNumber() const;
1767
+ V8EXPORT Handle<Value> GetScriptId() const;
1701
1768
  V8EXPORT ScriptOrigin GetScriptOrigin() const;
1702
1769
  static inline Function* Cast(Value* obj);
1703
1770
  V8EXPORT static const int kLineOffsetNotFound;
1771
+
1704
1772
  private:
1705
1773
  V8EXPORT Function();
1706
1774
  V8EXPORT static void CheckCast(Value* obj);
@@ -1741,6 +1809,63 @@ class Date : public Object {
1741
1809
  };
1742
1810
 
1743
1811
 
1812
+ /**
1813
+ * A Number object (ECMA-262, 4.3.21).
1814
+ */
1815
+ class NumberObject : public Object {
1816
+ public:
1817
+ V8EXPORT static Local<Value> New(double value);
1818
+
1819
+ /**
1820
+ * Returns the Number held by the object.
1821
+ */
1822
+ V8EXPORT double NumberValue() const;
1823
+
1824
+ static inline NumberObject* Cast(v8::Value* obj);
1825
+
1826
+ private:
1827
+ V8EXPORT static void CheckCast(v8::Value* obj);
1828
+ };
1829
+
1830
+
1831
+ /**
1832
+ * A Boolean object (ECMA-262, 4.3.15).
1833
+ */
1834
+ class BooleanObject : public Object {
1835
+ public:
1836
+ V8EXPORT static Local<Value> New(bool value);
1837
+
1838
+ /**
1839
+ * Returns the Boolean held by the object.
1840
+ */
1841
+ V8EXPORT bool BooleanValue() const;
1842
+
1843
+ static inline BooleanObject* Cast(v8::Value* obj);
1844
+
1845
+ private:
1846
+ V8EXPORT static void CheckCast(v8::Value* obj);
1847
+ };
1848
+
1849
+
1850
+ /**
1851
+ * A String object (ECMA-262, 4.3.18).
1852
+ */
1853
+ class StringObject : public Object {
1854
+ public:
1855
+ V8EXPORT static Local<Value> New(Handle<String> value);
1856
+
1857
+ /**
1858
+ * Returns the String held by the object.
1859
+ */
1860
+ V8EXPORT Local<String> StringValue() const;
1861
+
1862
+ static inline StringObject* Cast(v8::Value* obj);
1863
+
1864
+ private:
1865
+ V8EXPORT static void CheckCast(v8::Value* obj);
1866
+ };
1867
+
1868
+
1744
1869
  /**
1745
1870
  * An instance of the built-in RegExp constructor (ECMA-262, 15.10).
1746
1871
  */
@@ -1850,10 +1975,13 @@ class Arguments {
1850
1975
  inline Local<Object> Holder() const;
1851
1976
  inline bool IsConstructCall() const;
1852
1977
  inline Local<Value> Data() const;
1978
+ inline Isolate* GetIsolate() const;
1979
+
1853
1980
  private:
1854
- static const int kDataIndex = 0;
1855
- static const int kCalleeIndex = -1;
1856
- static const int kHolderIndex = -2;
1981
+ static const int kIsolateIndex = 0;
1982
+ static const int kDataIndex = -1;
1983
+ static const int kCalleeIndex = -2;
1984
+ static const int kHolderIndex = -3;
1857
1985
 
1858
1986
  friend class ImplementationUtilities;
1859
1987
  inline Arguments(internal::Object** implicit_args,
@@ -1875,9 +2003,11 @@ class V8EXPORT AccessorInfo {
1875
2003
  public:
1876
2004
  inline AccessorInfo(internal::Object** args)
1877
2005
  : args_(args) { }
2006
+ inline Isolate* GetIsolate() const;
1878
2007
  inline Local<Value> Data() const;
1879
2008
  inline Local<Object> This() const;
1880
2009
  inline Local<Object> Holder() const;
2010
+
1881
2011
  private:
1882
2012
  internal::Object** args_;
1883
2013
  };
@@ -2140,6 +2270,12 @@ class V8EXPORT FunctionTemplate : public Template {
2140
2270
  */
2141
2271
  void SetHiddenPrototype(bool value);
2142
2272
 
2273
+ /**
2274
+ * Sets the ReadOnly flag in the attributes of the 'prototype' property
2275
+ * of functions created from this FunctionTemplate to true.
2276
+ */
2277
+ void ReadOnlyPrototype();
2278
+
2143
2279
  /**
2144
2280
  * Returns true if the given object is an instance of this function
2145
2281
  * template.
@@ -2351,24 +2487,42 @@ class V8EXPORT TypeSwitch : public Data {
2351
2487
 
2352
2488
  // --- Extensions ---
2353
2489
 
2490
+ class V8EXPORT ExternalAsciiStringResourceImpl
2491
+ : public String::ExternalAsciiStringResource {
2492
+ public:
2493
+ ExternalAsciiStringResourceImpl() : data_(0), length_(0) {}
2494
+ ExternalAsciiStringResourceImpl(const char* data, size_t length)
2495
+ : data_(data), length_(length) {}
2496
+ const char* data() const { return data_; }
2497
+ size_t length() const { return length_; }
2498
+
2499
+ private:
2500
+ const char* data_;
2501
+ size_t length_;
2502
+ };
2354
2503
 
2355
2504
  /**
2356
2505
  * Ignore
2357
2506
  */
2358
2507
  class V8EXPORT Extension { // NOLINT
2359
2508
  public:
2509
+ // Note that the strings passed into this constructor must live as long
2510
+ // as the Extension itself.
2360
2511
  Extension(const char* name,
2361
2512
  const char* source = 0,
2362
2513
  int dep_count = 0,
2363
- const char** deps = 0);
2514
+ const char** deps = 0,
2515
+ int source_length = -1);
2364
2516
  virtual ~Extension() { }
2365
2517
  virtual v8::Handle<v8::FunctionTemplate>
2366
2518
  GetNativeFunction(v8::Handle<v8::String> name) {
2367
2519
  return v8::Handle<v8::FunctionTemplate>();
2368
2520
  }
2369
2521
 
2370
- const char* name() { return name_; }
2371
- const char* source() { return source_; }
2522
+ const char* name() const { return name_; }
2523
+ size_t source_length() const { return source_length_; }
2524
+ const String::ExternalAsciiStringResource* source() const {
2525
+ return &source_; }
2372
2526
  int dependency_count() { return dep_count_; }
2373
2527
  const char** dependencies() { return deps_; }
2374
2528
  void set_auto_enable(bool value) { auto_enable_ = value; }
@@ -2376,7 +2530,8 @@ class V8EXPORT Extension { // NOLINT
2376
2530
 
2377
2531
  private:
2378
2532
  const char* name_;
2379
- const char* source_;
2533
+ size_t source_length_; // expected to initialize before source_
2534
+ ExternalAsciiStringResourceImpl source_;
2380
2535
  int dep_count_;
2381
2536
  const char** deps_;
2382
2537
  bool auto_enable_;
@@ -2409,6 +2564,11 @@ Handle<Primitive> V8EXPORT Null();
2409
2564
  Handle<Boolean> V8EXPORT True();
2410
2565
  Handle<Boolean> V8EXPORT False();
2411
2566
 
2567
+ inline Handle<Primitive> Undefined(Isolate* isolate);
2568
+ inline Handle<Primitive> Null(Isolate* isolate);
2569
+ inline Handle<Boolean> True(Isolate* isolate);
2570
+ inline Handle<Boolean> False(Isolate* isolate);
2571
+
2412
2572
 
2413
2573
  /**
2414
2574
  * A set of constraints that specifies the limits of the runtime's memory use.
@@ -2508,6 +2668,9 @@ typedef void (*MemoryAllocationCallback)(ObjectSpace space,
2508
2668
  AllocationAction action,
2509
2669
  int size);
2510
2670
 
2671
+ // --- Leave Script Callback ---
2672
+ typedef void (*CallCompletedCallback)();
2673
+
2511
2674
  // --- Failed Access Check Callback ---
2512
2675
  typedef void (*FailedAccessCheckCallback)(Local<Object> target,
2513
2676
  AccessType type,
@@ -2547,23 +2710,6 @@ typedef void (*GCEpilogueCallback)(GCType type, GCCallbackFlags flags);
2547
2710
  typedef void (*GCCallback)();
2548
2711
 
2549
2712
 
2550
- /**
2551
- * Profiler modules.
2552
- *
2553
- * In V8, profiler consists of several modules: CPU profiler, and different
2554
- * kinds of heap profiling. Each can be turned on / off independently.
2555
- * When PROFILER_MODULE_HEAP_SNAPSHOT flag is passed to ResumeProfilerEx,
2556
- * modules are enabled only temporarily for making a snapshot of the heap.
2557
- */
2558
- enum ProfilerModules {
2559
- PROFILER_MODULE_NONE = 0,
2560
- PROFILER_MODULE_CPU = 1,
2561
- PROFILER_MODULE_HEAP_STATS = 1 << 1,
2562
- PROFILER_MODULE_JS_CONSTRUCTORS = 1 << 2,
2563
- PROFILER_MODULE_HEAP_SNAPSHOT = 1 << 16
2564
- };
2565
-
2566
-
2567
2713
  /**
2568
2714
  * Collection of V8 heap information.
2569
2715
  *
@@ -2604,7 +2750,7 @@ class RetainedObjectInfo;
2604
2750
  * default isolate is implicitly created and entered. The embedder
2605
2751
  * can create additional isolates and use them in parallel in multiple
2606
2752
  * threads. An isolate can be entered by at most one thread at any
2607
- * given time. The Locker/Unlocker API can be used to synchronize.
2753
+ * given time. The Locker/Unlocker API must be used to synchronize.
2608
2754
  */
2609
2755
  class V8EXPORT Isolate {
2610
2756
  public:
@@ -2673,16 +2819,15 @@ class V8EXPORT Isolate {
2673
2819
  /**
2674
2820
  * Associate embedder-specific data with the isolate
2675
2821
  */
2676
- void SetData(void* data);
2822
+ inline void SetData(void* data);
2677
2823
 
2678
2824
  /**
2679
- * Retrive embedder-specific data from the isolate.
2825
+ * Retrieve embedder-specific data from the isolate.
2680
2826
  * Returns NULL if SetData has never been called.
2681
2827
  */
2682
- void* GetData();
2828
+ inline void* GetData();
2683
2829
 
2684
2830
  private:
2685
-
2686
2831
  Isolate();
2687
2832
  Isolate(const Isolate&);
2688
2833
  ~Isolate();
@@ -2704,6 +2849,63 @@ class StartupData {
2704
2849
  int raw_size;
2705
2850
  };
2706
2851
 
2852
+
2853
+ /**
2854
+ * A helper class for driving V8 startup data decompression. It is based on
2855
+ * "CompressedStartupData" API functions from the V8 class. It isn't mandatory
2856
+ * for an embedder to use this class, instead, API functions can be used
2857
+ * directly.
2858
+ *
2859
+ * For an example of the class usage, see the "shell.cc" sample application.
2860
+ */
2861
+ class V8EXPORT StartupDataDecompressor { // NOLINT
2862
+ public:
2863
+ StartupDataDecompressor();
2864
+ virtual ~StartupDataDecompressor();
2865
+ int Decompress();
2866
+
2867
+ protected:
2868
+ virtual int DecompressData(char* raw_data,
2869
+ int* raw_data_size,
2870
+ const char* compressed_data,
2871
+ int compressed_data_size) = 0;
2872
+
2873
+ private:
2874
+ char** raw_data;
2875
+ };
2876
+
2877
+
2878
+ /**
2879
+ * EntropySource is used as a callback function when v8 needs a source
2880
+ * of entropy.
2881
+ */
2882
+ typedef bool (*EntropySource)(unsigned char* buffer, size_t length);
2883
+
2884
+
2885
+ /**
2886
+ * ReturnAddressLocationResolver is used as a callback function when v8 is
2887
+ * resolving the location of a return address on the stack. Profilers that
2888
+ * change the return address on the stack can use this to resolve the stack
2889
+ * location to whereever the profiler stashed the original return address.
2890
+ * When invoked, return_addr_location will point to a location on stack where
2891
+ * a machine return address resides, this function should return either the
2892
+ * same pointer, or a pointer to the profiler's copy of the original return
2893
+ * address.
2894
+ */
2895
+ typedef uintptr_t (*ReturnAddressLocationResolver)(
2896
+ uintptr_t return_addr_location);
2897
+
2898
+
2899
+ /**
2900
+ * Interface for iterating though all external resources in the heap.
2901
+ */
2902
+ class V8EXPORT ExternalResourceVisitor { // NOLINT
2903
+ public:
2904
+ virtual ~ExternalResourceVisitor() {}
2905
+ virtual void VisitExternalString(Handle<String> string) {}
2906
+ };
2907
+
2908
+
2707
2909
  /**
2708
2910
  * Container class for static utility functions.
2709
2911
  */
@@ -2753,6 +2955,10 @@ class V8EXPORT V8 {
2753
2955
  * v8::V8::SetDecompressedStartupData(compressed_data);
2754
2956
  * ... now V8 can be initialized
2755
2957
  * ... make sure the decompressed data stays valid until V8 shutdown
2958
+ *
2959
+ * A helper class StartupDataDecompressor is provided. It implements
2960
+ * the protocol of the interaction described above, and can be used in
2961
+ * most cases instead of calling these API functions directly.
2756
2962
  */
2757
2963
  static StartupData::CompressionAlgorithm GetCompressedStartupDataAlgorithm();
2758
2964
  static int GetCompressedStartupDataCount();
@@ -2888,11 +3094,24 @@ class V8EXPORT V8 {
2888
3094
  AllocationAction action);
2889
3095
 
2890
3096
  /**
2891
- * This function removes callback which was installed by
2892
- * AddMemoryAllocationCallback function.
3097
+ * Removes callback that was installed by AddMemoryAllocationCallback.
2893
3098
  */
2894
3099
  static void RemoveMemoryAllocationCallback(MemoryAllocationCallback callback);
2895
3100
 
3101
+ /**
3102
+ * Adds a callback to notify the host application when a script finished
3103
+ * running. If a script re-enters the runtime during executing, the
3104
+ * CallCompletedCallback is only invoked when the outer-most script
3105
+ * execution ends. Executing scripts inside the callback do not trigger
3106
+ * further callbacks.
3107
+ */
3108
+ static void AddCallCompletedCallback(CallCompletedCallback callback);
3109
+
3110
+ /**
3111
+ * Removes callback that was installed by AddCallCompletedCallback.
3112
+ */
3113
+ static void RemoveCallCompletedCallback(CallCompletedCallback callback);
3114
+
2896
3115
  /**
2897
3116
  * Allows the host application to group objects together. If one
2898
3117
  * object in the group is alive, all objects in the group are alive.
@@ -2924,6 +3143,19 @@ class V8EXPORT V8 {
2924
3143
  */
2925
3144
  static bool Initialize();
2926
3145
 
3146
+ /**
3147
+ * Allows the host application to provide a callback which can be used
3148
+ * as a source of entropy for random number generators.
3149
+ */
3150
+ static void SetEntropySource(EntropySource source);
3151
+
3152
+ /**
3153
+ * Allows the host application to provide a callback that allows v8 to
3154
+ * cooperate with a profiler that rewrites return addresses on stack.
3155
+ */
3156
+ static void SetReturnAddressLocationResolver(
3157
+ ReturnAddressLocationResolver return_address_resolver);
3158
+
2927
3159
  /**
2928
3160
  * Adjusts the amount of registered external memory. Used to give
2929
3161
  * V8 an indication of the amount of externally allocated memory
@@ -2938,7 +3170,8 @@ class V8EXPORT V8 {
2938
3170
  * that is kept alive by JavaScript objects.
2939
3171
  * \returns the adjusted value.
2940
3172
  */
2941
- static int AdjustAmountOfExternalAllocatedMemory(int change_in_bytes);
3173
+ static intptr_t AdjustAmountOfExternalAllocatedMemory(
3174
+ intptr_t change_in_bytes);
2942
3175
 
2943
3176
  /**
2944
3177
  * Suspends recording of tick samples in the profiler.
@@ -2962,65 +3195,6 @@ class V8EXPORT V8 {
2962
3195
  */
2963
3196
  static bool IsProfilerPaused();
2964
3197
 
2965
- /**
2966
- * Resumes specified profiler modules. Can be called several times to
2967
- * mark the opening of a profiler events block with the given tag.
2968
- *
2969
- * "ResumeProfiler" is equivalent to "ResumeProfilerEx(PROFILER_MODULE_CPU)".
2970
- * See ProfilerModules enum.
2971
- *
2972
- * \param flags Flags specifying profiler modules.
2973
- * \param tag Profile tag.
2974
- */
2975
- static void ResumeProfilerEx(int flags, int tag = 0);
2976
-
2977
- /**
2978
- * Pauses specified profiler modules. Each call to "PauseProfilerEx" closes
2979
- * a block of profiler events opened by a call to "ResumeProfilerEx" with the
2980
- * same tag value. There is no need for blocks to be properly nested.
2981
- * The profiler is paused when the last opened block is closed.
2982
- *
2983
- * "PauseProfiler" is equivalent to "PauseProfilerEx(PROFILER_MODULE_CPU)".
2984
- * See ProfilerModules enum.
2985
- *
2986
- * \param flags Flags specifying profiler modules.
2987
- * \param tag Profile tag.
2988
- */
2989
- static void PauseProfilerEx(int flags, int tag = 0);
2990
-
2991
- /**
2992
- * Returns active (resumed) profiler modules.
2993
- * See ProfilerModules enum.
2994
- *
2995
- * \returns active profiler modules.
2996
- */
2997
- static int GetActiveProfilerModules();
2998
-
2999
- /**
3000
- * If logging is performed into a memory buffer (via --logfile=*), allows to
3001
- * retrieve previously written messages. This can be used for retrieving
3002
- * profiler log data in the application. This function is thread-safe.
3003
- *
3004
- * Caller provides a destination buffer that must exist during GetLogLines
3005
- * call. Only whole log lines are copied into the buffer.
3006
- *
3007
- * \param from_pos specified a point in a buffer to read from, 0 is the
3008
- * beginning of a buffer. It is assumed that caller updates its current
3009
- * position using returned size value from the previous call.
3010
- * \param dest_buf destination buffer for log data.
3011
- * \param max_size size of the destination buffer.
3012
- * \returns actual size of log data copied into buffer.
3013
- */
3014
- static int GetLogLines(int from_pos, char* dest_buf, int max_size);
3015
-
3016
- /**
3017
- * The minimum allowed size for a log lines buffer. If the size of
3018
- * the buffer given will not be enough to hold a line of the maximum
3019
- * length, an attempt to find a log line end in GetLogLines will
3020
- * fail, and an empty result will be returned.
3021
- */
3022
- static const int kMinimumSizeForLogLinesBuffer = 2048;
3023
-
3024
3198
  /**
3025
3199
  * Retrieve the V8 thread id of the calling thread.
3026
3200
  *
@@ -3074,8 +3248,10 @@ class V8EXPORT V8 {
3074
3248
  * because of a call to TerminateExecution. In that case there are
3075
3249
  * still JavaScript frames on the stack and the termination
3076
3250
  * exception is still active.
3251
+ *
3252
+ * \param isolate The isolate in which to check.
3077
3253
  */
3078
- static bool IsExecutionTerminating();
3254
+ static bool IsExecutionTerminating(Isolate* isolate = NULL);
3079
3255
 
3080
3256
  /**
3081
3257
  * Releases any resources used by v8 and stops any utility threads
@@ -3093,6 +3269,13 @@ class V8EXPORT V8 {
3093
3269
  */
3094
3270
  static void GetHeapStatistics(HeapStatistics* heap_statistics);
3095
3271
 
3272
+ /**
3273
+ * Iterates through all external resources referenced from current isolate
3274
+ * heap. This method is not expected to be used except for debugging purposes
3275
+ * and may be quite slow.
3276
+ */
3277
+ static void VisitExternalResources(ExternalResourceVisitor* visitor);
3278
+
3096
3279
  /**
3097
3280
  * Optional notification that the embedder is idle.
3098
3281
  * V8 uses the notification to reduce memory footprint.
@@ -3100,8 +3283,12 @@ class V8EXPORT V8 {
3100
3283
  * Returns true if the embedder should stop calling IdleNotification
3101
3284
  * until real work has been done. This indicates that V8 has done
3102
3285
  * as much cleanup as it will be able to do.
3286
+ *
3287
+ * The hint argument specifies the amount of work to be done in the function
3288
+ * on scale from 1 to 1000. There is no guarantee that the actual work will
3289
+ * match the hint.
3103
3290
  */
3104
- static bool IdleNotification();
3291
+ static bool IdleNotification(int hint = 1000);
3105
3292
 
3106
3293
  /**
3107
3294
  * Optional notification that the system is running low on memory.
@@ -3144,7 +3331,6 @@ class V8EXPORT V8 {
3144
3331
  */
3145
3332
  class V8EXPORT TryCatch {
3146
3333
  public:
3147
-
3148
3334
  /**
3149
3335
  * Creates a new try/catch block and registers it with v8.
3150
3336
  */
@@ -3236,6 +3422,7 @@ class V8EXPORT TryCatch {
3236
3422
  void SetCaptureMessage(bool value);
3237
3423
 
3238
3424
  private:
3425
+ v8::internal::Isolate* isolate_;
3239
3426
  void* next_;
3240
3427
  void* exception_;
3241
3428
  void* message_;
@@ -3398,6 +3585,12 @@ class V8EXPORT Context {
3398
3585
  */
3399
3586
  void AllowCodeGenerationFromStrings(bool allow);
3400
3587
 
3588
+ /**
3589
+ * Returns true if code generation from strings is allowed for the context.
3590
+ * For more details see AllowCodeGenerationFromStrings(bool) documentation.
3591
+ */
3592
+ bool IsCodeGenerationFromStringsAllowed();
3593
+
3401
3594
  /**
3402
3595
  * Stack-allocated class which sets the execution context for all
3403
3596
  * operations executed within a local scope.
@@ -3427,13 +3620,15 @@ class V8EXPORT Context {
3427
3620
  * accessing handles or holding onto object pointers obtained
3428
3621
  * from V8 handles while in the particular V8 isolate. It is up
3429
3622
  * to the user of V8 to ensure (perhaps with locking) that this
3430
- * constraint is not violated.
3623
+ * constraint is not violated. In addition to any other synchronization
3624
+ * mechanism that may be used, the v8::Locker and v8::Unlocker classes
3625
+ * must be used to signal thead switches to V8.
3431
3626
  *
3432
3627
  * v8::Locker is a scoped lock object. While it's
3433
3628
  * active (i.e. between its construction and destruction) the current thread is
3434
- * allowed to use the locked isolate. V8 guarantees that an isolate can be locked
3435
- * by at most one thread at any time. In other words, the scope of a v8::Locker is
3436
- * a critical section.
3629
+ * allowed to use the locked isolate. V8 guarantees that an isolate can be
3630
+ * locked by at most one thread at any time. In other words, the scope of a
3631
+ * v8::Locker is a critical section.
3437
3632
  *
3438
3633
  * Sample usage:
3439
3634
  * \code
@@ -3498,7 +3693,7 @@ class V8EXPORT Context {
3498
3693
  * // V8 Now no longer locked.
3499
3694
  * \endcode
3500
3695
  *
3501
- *
3696
+ *
3502
3697
  */
3503
3698
  class V8EXPORT Unlocker {
3504
3699
  public:
@@ -3535,15 +3730,15 @@ class V8EXPORT Locker {
3535
3730
  static void StopPreemption();
3536
3731
 
3537
3732
  /**
3538
- * Returns whether or not the locker for a given isolate, or default isolate if NULL is given,
3539
- * is locked by the current thread.
3733
+ * Returns whether or not the locker for a given isolate, or default isolate
3734
+ * if NULL is given, is locked by the current thread.
3540
3735
  */
3541
3736
  static bool IsLocked(Isolate* isolate = NULL);
3542
3737
 
3543
3738
  /**
3544
3739
  * Returns whether v8::Locker is being used by this V8 instance.
3545
3740
  */
3546
- static bool IsActive() { return active_; }
3741
+ static bool IsActive();
3547
3742
 
3548
3743
  private:
3549
3744
  bool has_lock_;
@@ -3558,6 +3753,12 @@ class V8EXPORT Locker {
3558
3753
  };
3559
3754
 
3560
3755
 
3756
+ /**
3757
+ * A struct for exporting HeapStats data from V8, using "push" model.
3758
+ */
3759
+ struct HeapStatsUpdate;
3760
+
3761
+
3561
3762
  /**
3562
3763
  * An interface for exporting data from V8, using "push" model.
3563
3764
  */
@@ -3583,6 +3784,14 @@ class V8EXPORT OutputStream { // NOLINT
3583
3784
  * will not be called in case writing was aborted.
3584
3785
  */
3585
3786
  virtual WriteResult WriteAsciiChunk(char* data, int size) = 0;
3787
+ /**
3788
+ * Writes the next chunk of heap stats data into the stream. Writing
3789
+ * can be stopped by returning kAbort as function result. EndOfStream
3790
+ * will not be called in case writing was aborted.
3791
+ */
3792
+ virtual WriteResult WriteHeapStatsChunk(HeapStatsUpdate* data, int count) {
3793
+ return kAbort;
3794
+ };
3586
3795
  };
3587
3796
 
3588
3797
 
@@ -3610,8 +3819,8 @@ class V8EXPORT ActivityControl { // NOLINT
3610
3819
 
3611
3820
  namespace internal {
3612
3821
 
3613
- static const int kApiPointerSize = sizeof(void*); // NOLINT
3614
- static const int kApiIntSize = sizeof(int); // NOLINT
3822
+ const int kApiPointerSize = sizeof(void*); // NOLINT
3823
+ const int kApiIntSize = sizeof(int); // NOLINT
3615
3824
 
3616
3825
  // Tag information for HeapObject.
3617
3826
  const int kHeapObjectTag = 1;
@@ -3671,18 +3880,6 @@ const uintptr_t kEncodablePointerMask =
3671
3880
  PlatformSmiTagging::kEncodablePointerMask;
3672
3881
  const int kPointerToSmiShift = PlatformSmiTagging::kPointerToSmiShift;
3673
3882
 
3674
- template <size_t ptr_size> struct InternalConstants;
3675
-
3676
- // Internal constants for 32-bit systems.
3677
- template <> struct InternalConstants<4> {
3678
- static const int kStringResourceOffset = 3 * kApiPointerSize;
3679
- };
3680
-
3681
- // Internal constants for 64-bit systems.
3682
- template <> struct InternalConstants<8> {
3683
- static const int kStringResourceOffset = 3 * kApiPointerSize;
3684
- };
3685
-
3686
3883
  /**
3687
3884
  * This class exports constants and functionality from within v8 that
3688
3885
  * is necessary to implement inline functions in the v8 api. Don't
@@ -3690,23 +3887,35 @@ template <> struct InternalConstants<8> {
3690
3887
  */
3691
3888
  class Internals {
3692
3889
  public:
3693
-
3694
3890
  // These values match non-compiler-dependent values defined within
3695
3891
  // the implementation of v8.
3696
3892
  static const int kHeapObjectMapOffset = 0;
3697
3893
  static const int kMapInstanceTypeOffset = 1 * kApiPointerSize + kApiIntSize;
3698
- static const int kStringResourceOffset =
3699
- InternalConstants<kApiPointerSize>::kStringResourceOffset;
3894
+ static const int kStringResourceOffset = 3 * kApiPointerSize;
3700
3895
 
3896
+ static const int kOddballKindOffset = 3 * kApiPointerSize;
3701
3897
  static const int kForeignAddressOffset = kApiPointerSize;
3702
3898
  static const int kJSObjectHeaderSize = 3 * kApiPointerSize;
3703
3899
  static const int kFullStringRepresentationMask = 0x07;
3704
3900
  static const int kExternalTwoByteRepresentationTag = 0x02;
3705
3901
 
3706
- static const int kJSObjectType = 0xa2;
3902
+ static const int kIsolateStateOffset = 0;
3903
+ static const int kIsolateEmbedderDataOffset = 1 * kApiPointerSize;
3904
+ static const int kIsolateRootsOffset = 3 * kApiPointerSize;
3905
+ static const int kUndefinedValueRootIndex = 5;
3906
+ static const int kNullValueRootIndex = 7;
3907
+ static const int kTrueValueRootIndex = 8;
3908
+ static const int kFalseValueRootIndex = 9;
3909
+ static const int kEmptySymbolRootIndex = 128;
3910
+
3911
+ static const int kJSObjectType = 0xaa;
3707
3912
  static const int kFirstNonstringType = 0x80;
3913
+ static const int kOddballType = 0x82;
3708
3914
  static const int kForeignType = 0x85;
3709
3915
 
3916
+ static const int kUndefinedOddballKind = 5;
3917
+ static const int kNullOddballKind = 3;
3918
+
3710
3919
  static inline bool HasHeapObjectTag(internal::Object* value) {
3711
3920
  return ((reinterpret_cast<intptr_t>(value) & kHeapObjectTagMask) ==
3712
3921
  kHeapObjectTag);
@@ -3726,6 +3935,11 @@ class Internals {
3726
3935
  return ReadField<uint8_t>(map, kMapInstanceTypeOffset);
3727
3936
  }
3728
3937
 
3938
+ static inline int GetOddballKind(internal::Object* obj) {
3939
+ typedef internal::Object O;
3940
+ return SmiValue(ReadField<O*>(obj, kOddballKindOffset));
3941
+ }
3942
+
3729
3943
  static inline void* GetExternalPointerFromSmi(internal::Object* value) {
3730
3944
  const uintptr_t address = reinterpret_cast<uintptr_t>(value);
3731
3945
  return reinterpret_cast<void*>(address >> kPointerToSmiShift);
@@ -3746,6 +3960,28 @@ class Internals {
3746
3960
  return representation == kExternalTwoByteRepresentationTag;
3747
3961
  }
3748
3962
 
3963
+ static inline bool IsInitialized(v8::Isolate* isolate) {
3964
+ uint8_t* addr = reinterpret_cast<uint8_t*>(isolate) + kIsolateStateOffset;
3965
+ return *reinterpret_cast<int*>(addr) == 1;
3966
+ }
3967
+
3968
+ static inline void SetEmbedderData(v8::Isolate* isolate, void* data) {
3969
+ uint8_t* addr = reinterpret_cast<uint8_t*>(isolate) +
3970
+ kIsolateEmbedderDataOffset;
3971
+ *reinterpret_cast<void**>(addr) = data;
3972
+ }
3973
+
3974
+ static inline void* GetEmbedderData(v8::Isolate* isolate) {
3975
+ uint8_t* addr = reinterpret_cast<uint8_t*>(isolate) +
3976
+ kIsolateEmbedderDataOffset;
3977
+ return *reinterpret_cast<void**>(addr);
3978
+ }
3979
+
3980
+ static inline internal::Object** GetRoot(v8::Isolate* isolate, int index) {
3981
+ uint8_t* addr = reinterpret_cast<uint8_t*>(isolate) + kIsolateRootsOffset;
3982
+ return reinterpret_cast<internal::Object**>(addr + index * kApiPointerSize);
3983
+ }
3984
+
3749
3985
  template <typename T>
3750
3986
  static inline T ReadField(Object* ptr, int offset) {
3751
3987
  uint8_t* addr = reinterpret_cast<uint8_t*>(ptr) + offset - kHeapObjectTag;
@@ -3764,10 +4000,6 @@ class Internals {
3764
4000
  } // namespace internal
3765
4001
 
3766
4002
 
3767
- template <class T>
3768
- Handle<T>::Handle() : val_(0) { }
3769
-
3770
-
3771
4003
  template <class T>
3772
4004
  Local<T>::Local() : Handle<T>() { }
3773
4005
 
@@ -3876,6 +4108,11 @@ Local<Value> Arguments::Data() const {
3876
4108
  }
3877
4109
 
3878
4110
 
4111
+ Isolate* Arguments::GetIsolate() const {
4112
+ return *reinterpret_cast<Isolate**>(&implicit_args_[kIsolateIndex]);
4113
+ }
4114
+
4115
+
3879
4116
  bool Arguments::IsConstructCall() const {
3880
4117
  return is_construct_call_;
3881
4118
  }
@@ -3988,6 +4225,15 @@ String* String::Cast(v8::Value* value) {
3988
4225
  }
3989
4226
 
3990
4227
 
4228
+ Local<String> String::Empty(Isolate* isolate) {
4229
+ typedef internal::Object* S;
4230
+ typedef internal::Internals I;
4231
+ if (!I::IsInitialized(isolate)) return Empty();
4232
+ S* slot = I::GetRoot(isolate, I::kEmptySymbolRootIndex);
4233
+ return Local<String>(reinterpret_cast<String*>(slot));
4234
+ }
4235
+
4236
+
3991
4237
  String::ExternalStringResource* String::GetExternalStringResource() const {
3992
4238
  typedef internal::Object O;
3993
4239
  typedef internal::Internals I;
@@ -4006,6 +4252,42 @@ String::ExternalStringResource* String::GetExternalStringResource() const {
4006
4252
  }
4007
4253
 
4008
4254
 
4255
+ bool Value::IsUndefined() const {
4256
+ #ifdef V8_ENABLE_CHECKS
4257
+ return FullIsUndefined();
4258
+ #else
4259
+ return QuickIsUndefined();
4260
+ #endif
4261
+ }
4262
+
4263
+ bool Value::QuickIsUndefined() const {
4264
+ typedef internal::Object O;
4265
+ typedef internal::Internals I;
4266
+ O* obj = *reinterpret_cast<O**>(const_cast<Value*>(this));
4267
+ if (!I::HasHeapObjectTag(obj)) return false;
4268
+ if (I::GetInstanceType(obj) != I::kOddballType) return false;
4269
+ return (I::GetOddballKind(obj) == I::kUndefinedOddballKind);
4270
+ }
4271
+
4272
+
4273
+ bool Value::IsNull() const {
4274
+ #ifdef V8_ENABLE_CHECKS
4275
+ return FullIsNull();
4276
+ #else
4277
+ return QuickIsNull();
4278
+ #endif
4279
+ }
4280
+
4281
+ bool Value::QuickIsNull() const {
4282
+ typedef internal::Object O;
4283
+ typedef internal::Internals I;
4284
+ O* obj = *reinterpret_cast<O**>(const_cast<Value*>(this));
4285
+ if (!I::HasHeapObjectTag(obj)) return false;
4286
+ if (I::GetInstanceType(obj) != I::kOddballType) return false;
4287
+ return (I::GetOddballKind(obj) == I::kNullOddballKind);
4288
+ }
4289
+
4290
+
4009
4291
  bool Value::IsString() const {
4010
4292
  #ifdef V8_ENABLE_CHECKS
4011
4293
  return FullIsString();
@@ -4047,6 +4329,30 @@ Date* Date::Cast(v8::Value* value) {
4047
4329
  }
4048
4330
 
4049
4331
 
4332
+ StringObject* StringObject::Cast(v8::Value* value) {
4333
+ #ifdef V8_ENABLE_CHECKS
4334
+ CheckCast(value);
4335
+ #endif
4336
+ return static_cast<StringObject*>(value);
4337
+ }
4338
+
4339
+
4340
+ NumberObject* NumberObject::Cast(v8::Value* value) {
4341
+ #ifdef V8_ENABLE_CHECKS
4342
+ CheckCast(value);
4343
+ #endif
4344
+ return static_cast<NumberObject*>(value);
4345
+ }
4346
+
4347
+
4348
+ BooleanObject* BooleanObject::Cast(v8::Value* value) {
4349
+ #ifdef V8_ENABLE_CHECKS
4350
+ CheckCast(value);
4351
+ #endif
4352
+ return static_cast<BooleanObject*>(value);
4353
+ }
4354
+
4355
+
4050
4356
  RegExp* RegExp::Cast(v8::Value* value) {
4051
4357
  #ifdef V8_ENABLE_CHECKS
4052
4358
  CheckCast(value);
@@ -4087,6 +4393,11 @@ External* External::Cast(v8::Value* value) {
4087
4393
  }
4088
4394
 
4089
4395
 
4396
+ Isolate* AccessorInfo::GetIsolate() const {
4397
+ return *reinterpret_cast<Isolate**>(&args_[-3]);
4398
+ }
4399
+
4400
+
4090
4401
  Local<Value> AccessorInfo::Data() const {
4091
4402
  return Local<Value>(reinterpret_cast<Value*>(&args_[-2]));
4092
4403
  }
@@ -4102,6 +4413,54 @@ Local<Object> AccessorInfo::Holder() const {
4102
4413
  }
4103
4414
 
4104
4415
 
4416
+ Handle<Primitive> Undefined(Isolate* isolate) {
4417
+ typedef internal::Object* S;
4418
+ typedef internal::Internals I;
4419
+ if (!I::IsInitialized(isolate)) return Undefined();
4420
+ S* slot = I::GetRoot(isolate, I::kUndefinedValueRootIndex);
4421
+ return Handle<Primitive>(reinterpret_cast<Primitive*>(slot));
4422
+ }
4423
+
4424
+
4425
+ Handle<Primitive> Null(Isolate* isolate) {
4426
+ typedef internal::Object* S;
4427
+ typedef internal::Internals I;
4428
+ if (!I::IsInitialized(isolate)) return Null();
4429
+ S* slot = I::GetRoot(isolate, I::kNullValueRootIndex);
4430
+ return Handle<Primitive>(reinterpret_cast<Primitive*>(slot));
4431
+ }
4432
+
4433
+
4434
+ Handle<Boolean> True(Isolate* isolate) {
4435
+ typedef internal::Object* S;
4436
+ typedef internal::Internals I;
4437
+ if (!I::IsInitialized(isolate)) return True();
4438
+ S* slot = I::GetRoot(isolate, I::kTrueValueRootIndex);
4439
+ return Handle<Boolean>(reinterpret_cast<Boolean*>(slot));
4440
+ }
4441
+
4442
+
4443
+ Handle<Boolean> False(Isolate* isolate) {
4444
+ typedef internal::Object* S;
4445
+ typedef internal::Internals I;
4446
+ if (!I::IsInitialized(isolate)) return False();
4447
+ S* slot = I::GetRoot(isolate, I::kFalseValueRootIndex);
4448
+ return Handle<Boolean>(reinterpret_cast<Boolean*>(slot));
4449
+ }
4450
+
4451
+
4452
+ void Isolate::SetData(void* data) {
4453
+ typedef internal::Internals I;
4454
+ I::SetEmbedderData(this, data);
4455
+ }
4456
+
4457
+
4458
+ void* Isolate::GetData() {
4459
+ typedef internal::Internals I;
4460
+ return I::GetEmbedderData(this);
4461
+ }
4462
+
4463
+
4105
4464
  /**
4106
4465
  * \example shell.cc
4107
4466
  * A simple shell that takes a list of expressions on the