libv8 6.0.286.54.3-universal-darwin-15 → 6.2.414.42.0beta1-universal-darwin-15

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: daaad59767ee0942a99453413685a5cd6d57d45d
4
- data.tar.gz: 4d2ece59415206172c6c629ae004a81396d675ec
3
+ metadata.gz: ede8fcd500a542f89c08265455abe5127de9a6c3
4
+ data.tar.gz: 0f551fd589a60539b182cf9bbfea49abd47d7c62
5
5
  SHA512:
6
- metadata.gz: 201451013d206dcff30284d142077eeb809f7671be2ad8dd01ea8a5999f6de920cc5d1e3c772b2a6c5ccfe4e4f1479eeef4a7e8b5176a47cfaa1e0a4b4908b0e
7
- data.tar.gz: 1c6ecd53576522d6009b375340c02ff3d966d57ba298cd0d2b0179909c5c7f643cd56a09985a6a79b9d6d45655d32023ada9ceba14d89a5737175228a0de2201
6
+ metadata.gz: 96724aca6809e134c32955166e22ccc0fbcabedcd1a3c6db16eeb1a18546af43c73604c11ce7510903e75690b85cc988a19b1bc13a49ac0ae6029d9854d2be21
7
+ data.tar.gz: 9981b95302d34e0882a5a1f2055233c8d180ef6619802b01414a13e443383351117b238a6ea9dfe1f7f53e18d6f84c24002e6d2ba3a405fbd4c8bea250118922
@@ -1,3 +1,3 @@
1
1
  module Libv8
2
- VERSION = "6.0.286.54.3"
2
+ VERSION = "6.2.414.42.0beta1"
3
3
  end
@@ -30,12 +30,15 @@ enum class MessageLoopBehavior : bool {
30
30
  * If |idle_task_support| is enabled then the platform will accept idle
31
31
  * tasks (IdleTasksEnabled will return true) and will rely on the embedder
32
32
  * calling v8::platform::RunIdleTasks to process the idle tasks.
33
+ * If |tracing_controller| is nullptr, the default platform will create a
34
+ * v8::platform::TracingController instance and use it.
33
35
  */
34
36
  V8_PLATFORM_EXPORT v8::Platform* CreateDefaultPlatform(
35
37
  int thread_pool_size = 0,
36
38
  IdleTaskSupport idle_task_support = IdleTaskSupport::kDisabled,
37
39
  InProcessStackDumping in_process_stack_dumping =
38
- InProcessStackDumping::kEnabled);
40
+ InProcessStackDumping::kEnabled,
41
+ v8::TracingController* tracing_controller = nullptr);
39
42
 
40
43
  /**
41
44
  * Pumps the message loop for the given isolate.
@@ -67,6 +70,8 @@ V8_PLATFORM_EXPORT void RunIdleTasks(v8::Platform* platform,
67
70
  * Attempts to set the tracing controller for the given platform.
68
71
  *
69
72
  * The |platform| has to be created using |CreateDefaultPlatform|.
73
+ *
74
+ * DEPRECATED: Will be removed soon.
70
75
  */
71
76
  V8_PLATFORM_EXPORT void SetTracingController(
72
77
  v8::Platform* platform,
@@ -209,7 +209,15 @@ class V8_PLATFORM_EXPORT TraceConfig {
209
209
  void operator=(const TraceConfig&) = delete;
210
210
  };
211
211
 
212
- class V8_PLATFORM_EXPORT TracingController {
212
+ #if defined(_MSC_VER)
213
+ #define V8_PLATFORM_NON_EXPORTED_BASE(code) \
214
+ __pragma(warning(suppress : 4275)) code
215
+ #else
216
+ #define V8_PLATFORM_NON_EXPORTED_BASE(code) code
217
+ #endif // defined(_MSC_VER)
218
+
219
+ class V8_PLATFORM_EXPORT TracingController
220
+ : public V8_PLATFORM_NON_EXPORTED_BASE(v8::TracingController) {
213
221
  public:
214
222
  enum Mode { DISABLED = 0, RECORDING_MODE };
215
223
 
@@ -227,25 +235,29 @@ class V8_PLATFORM_EXPORT TracingController {
227
235
  };
228
236
 
229
237
  TracingController();
230
- ~TracingController();
238
+ ~TracingController() override;
231
239
  void Initialize(TraceBuffer* trace_buffer);
232
- const uint8_t* GetCategoryGroupEnabled(const char* category_group);
233
- static const char* GetCategoryGroupName(const uint8_t* category_enabled_flag);
240
+
241
+ // v8::TracingController implementation.
242
+ const uint8_t* GetCategoryGroupEnabled(const char* category_group) override;
234
243
  uint64_t AddTraceEvent(
235
244
  char phase, const uint8_t* category_enabled_flag, const char* name,
236
245
  const char* scope, uint64_t id, uint64_t bind_id, int32_t num_args,
237
246
  const char** arg_names, const uint8_t* arg_types,
238
247
  const uint64_t* arg_values,
239
248
  std::unique_ptr<v8::ConvertableToTraceFormat>* arg_convertables,
240
- unsigned int flags);
249
+ unsigned int flags) override;
241
250
  void UpdateTraceEventDuration(const uint8_t* category_enabled_flag,
242
- const char* name, uint64_t handle);
251
+ const char* name, uint64_t handle) override;
252
+ void AddTraceStateObserver(
253
+ v8::TracingController::TraceStateObserver* observer) override;
254
+ void RemoveTraceStateObserver(
255
+ v8::TracingController::TraceStateObserver* observer) override;
243
256
 
244
257
  void StartTracing(TraceConfig* trace_config);
245
258
  void StopTracing();
246
259
 
247
- void AddTraceStateObserver(Platform::TraceStateObserver* observer);
248
- void RemoveTraceStateObserver(Platform::TraceStateObserver* observer);
260
+ static const char* GetCategoryGroupName(const uint8_t* category_enabled_flag);
249
261
 
250
262
  private:
251
263
  const uint8_t* GetCategoryGroupEnabledInternal(const char* category_group);
@@ -255,7 +267,7 @@ class V8_PLATFORM_EXPORT TracingController {
255
267
  std::unique_ptr<TraceBuffer> trace_buffer_;
256
268
  std::unique_ptr<TraceConfig> trace_config_;
257
269
  std::unique_ptr<base::Mutex> mutex_;
258
- std::unordered_set<Platform::TraceStateObserver*> observers_;
270
+ std::unordered_set<v8::TracingController::TraceStateObserver*> observers_;
259
271
  Mode mode_ = DISABLED;
260
272
 
261
273
  // Disallow copy and assign
@@ -263,6 +275,8 @@ class V8_PLATFORM_EXPORT TracingController {
263
275
  void operator=(const TracingController&) = delete;
264
276
  };
265
277
 
278
+ #undef V8_PLATFORM_NON_EXPORTED_BASE
279
+
266
280
  } // namespace tracing
267
281
  } // namespace platform
268
282
  } // namespace v8
@@ -52,6 +52,66 @@ class ConvertableToTraceFormat {
52
52
  virtual void AppendAsTraceFormat(std::string* out) const = 0;
53
53
  };
54
54
 
55
+ /**
56
+ * V8 Tracing controller.
57
+ *
58
+ * Can be implemented by an embedder to record trace events from V8.
59
+ */
60
+ class TracingController {
61
+ public:
62
+ virtual ~TracingController() = default;
63
+
64
+ /**
65
+ * Called by TRACE_EVENT* macros, don't call this directly.
66
+ * The name parameter is a category group for example:
67
+ * TRACE_EVENT0("v8,parse", "V8.Parse")
68
+ * The pointer returned points to a value with zero or more of the bits
69
+ * defined in CategoryGroupEnabledFlags.
70
+ **/
71
+ virtual const uint8_t* GetCategoryGroupEnabled(const char* name) {
72
+ static uint8_t no = 0;
73
+ return &no;
74
+ }
75
+
76
+ /**
77
+ * Adds a trace event to the platform tracing system. This function call is
78
+ * usually the result of a TRACE_* macro from trace_event_common.h when
79
+ * tracing and the category of the particular trace are enabled. It is not
80
+ * advisable to call this function on its own; it is really only meant to be
81
+ * used by the trace macros. The returned handle can be used by
82
+ * UpdateTraceEventDuration to update the duration of COMPLETE events.
83
+ */
84
+ virtual uint64_t AddTraceEvent(
85
+ char phase, const uint8_t* category_enabled_flag, const char* name,
86
+ const char* scope, uint64_t id, uint64_t bind_id, int32_t num_args,
87
+ const char** arg_names, const uint8_t* arg_types,
88
+ const uint64_t* arg_values,
89
+ std::unique_ptr<ConvertableToTraceFormat>* arg_convertables,
90
+ unsigned int flags) {
91
+ return 0;
92
+ }
93
+
94
+ /**
95
+ * Sets the duration field of a COMPLETE trace event. It must be called with
96
+ * the handle returned from AddTraceEvent().
97
+ **/
98
+ virtual void UpdateTraceEventDuration(const uint8_t* category_enabled_flag,
99
+ const char* name, uint64_t handle) {}
100
+
101
+ class TraceStateObserver {
102
+ public:
103
+ virtual ~TraceStateObserver() = default;
104
+ virtual void OnTraceEnabled() = 0;
105
+ virtual void OnTraceDisabled() = 0;
106
+ };
107
+
108
+ /** Adds tracing state change observer. */
109
+ virtual void AddTraceStateObserver(TraceStateObserver*) {}
110
+
111
+ /** Removes tracing state change observer. */
112
+ virtual void RemoveTraceStateObserver(TraceStateObserver*) {}
113
+ };
114
+
55
115
  /**
56
116
  * V8 Platform abstraction layer.
57
117
  *
@@ -72,6 +132,15 @@ class Platform {
72
132
 
73
133
  virtual ~Platform() = default;
74
134
 
135
+ /**
136
+ * Enables the embedder to respond in cases where V8 can't allocate large
137
+ * blocks of memory. V8 retries the failed allocation once after calling this
138
+ * method. On success, execution continues; otherwise V8 exits with a fatal
139
+ * error.
140
+ * Embedder overrides of this function must NOT call back into V8.
141
+ */
142
+ virtual void OnCriticalMemoryPressure() {}
143
+
75
144
  /**
76
145
  * Gets the number of threads that are used to execute background tasks. Is
77
146
  * used to estimate the number of tasks a work package should be split into.
@@ -137,89 +206,34 @@ class Platform {
137
206
  virtual double MonotonicallyIncreasingTime() = 0;
138
207
 
139
208
  /**
140
- * Called by TRACE_EVENT* macros, don't call this directly.
141
- * The name parameter is a category group for example:
142
- * TRACE_EVENT0("v8,parse", "V8.Parse")
143
- * The pointer returned points to a value with zero or more of the bits
144
- * defined in CategoryGroupEnabledFlags.
145
- **/
146
- virtual const uint8_t* GetCategoryGroupEnabled(const char* name) {
147
- static uint8_t no = 0;
148
- return &no;
209
+ * Current wall-clock time in milliseconds since epoch.
210
+ * This function is expected to return at least millisecond-precision values.
211
+ */
212
+ virtual double CurrentClockTimeMillis() {
213
+ // TODO(dats): Make pure virtual after V8 roll in Chromium.
214
+ return 0.0;
149
215
  }
150
216
 
151
- /**
152
- * Gets the category group name of the given category_enabled_flag pointer.
153
- * Usually used while serliazing TRACE_EVENTs.
154
- **/
155
- virtual const char* GetCategoryGroupName(
156
- const uint8_t* category_enabled_flag) {
157
- static const char dummy[] = "dummy";
158
- return dummy;
159
- }
217
+ typedef void (*StackTracePrinter)();
160
218
 
161
219
  /**
162
- * Adds a trace event to the platform tracing system. This function call is
163
- * usually the result of a TRACE_* macro from trace_event_common.h when
164
- * tracing and the category of the particular trace are enabled. It is not
165
- * advisable to call this function on its own; it is really only meant to be
166
- * used by the trace macros. The returned handle can be used by
167
- * UpdateTraceEventDuration to update the duration of COMPLETE events.
220
+ * Returns a function pointer that print a stack trace of the current stack
221
+ * on invocation. Disables printing of the stack trace if nullptr.
168
222
  */
169
- virtual uint64_t AddTraceEvent(
170
- char phase, const uint8_t* category_enabled_flag, const char* name,
171
- const char* scope, uint64_t id, uint64_t bind_id, int32_t num_args,
172
- const char** arg_names, const uint8_t* arg_types,
173
- const uint64_t* arg_values, unsigned int flags) {
174
- return 0;
175
- }
223
+ virtual StackTracePrinter GetStackTracePrinter() { return nullptr; }
176
224
 
177
225
  /**
178
- * Adds a trace event to the platform tracing system. This function call is
179
- * usually the result of a TRACE_* macro from trace_event_common.h when
180
- * tracing and the category of the particular trace are enabled. It is not
181
- * advisable to call this function on its own; it is really only meant to be
182
- * used by the trace macros. The returned handle can be used by
183
- * UpdateTraceEventDuration to update the duration of COMPLETE events.
226
+ * Returns an instance of a v8::TracingController. This must be non-nullptr.
184
227
  */
185
- virtual uint64_t AddTraceEvent(
186
- char phase, const uint8_t* category_enabled_flag, const char* name,
187
- const char* scope, uint64_t id, uint64_t bind_id, int32_t num_args,
188
- const char** arg_names, const uint8_t* arg_types,
189
- const uint64_t* arg_values,
190
- std::unique_ptr<ConvertableToTraceFormat>* arg_convertables,
191
- unsigned int flags) {
192
- return AddTraceEvent(phase, category_enabled_flag, name, scope, id, bind_id,
193
- num_args, arg_names, arg_types, arg_values, flags);
194
- }
228
+ virtual TracingController* GetTracingController() = 0;
195
229
 
230
+ protected:
196
231
  /**
197
- * Sets the duration field of a COMPLETE trace event. It must be called with
198
- * the handle returned from AddTraceEvent().
199
- **/
200
- virtual void UpdateTraceEventDuration(const uint8_t* category_enabled_flag,
201
- const char* name, uint64_t handle) {}
202
-
203
- class TraceStateObserver {
204
- public:
205
- virtual ~TraceStateObserver() = default;
206
- virtual void OnTraceEnabled() = 0;
207
- virtual void OnTraceDisabled() = 0;
208
- };
209
-
210
- /** Adds tracing state change observer. */
211
- virtual void AddTraceStateObserver(TraceStateObserver*) {}
212
-
213
- /** Removes tracing state change observer. */
214
- virtual void RemoveTraceStateObserver(TraceStateObserver*) {}
215
-
216
- typedef void (*StackTracePrinter)();
217
-
218
- /**
219
- * Returns a function pointer that print a stack trace of the current stack
220
- * on invocation. Disables printing of the stack trace if nullptr.
232
+ * Default implementation of current wall-clock time in milliseconds
233
+ * since epoch. Useful for implementing |CurrentClockTimeMillis| if
234
+ * nothing special needed.
221
235
  */
222
- virtual StackTracePrinter GetStackTracePrinter() { return nullptr; }
236
+ static double SystemClockTimeMillis();
223
237
  };
224
238
 
225
239
  } // namespace v8
@@ -389,7 +389,7 @@ class V8_EXPORT HeapGraphNode {
389
389
  kRegExp = 6, // RegExp.
390
390
  kHeapNumber = 7, // Number stored in the heap.
391
391
  kNative = 8, // Native object (not from V8 heap).
392
- kSynthetic = 9, // Synthetic object, usualy used for grouping
392
+ kSynthetic = 9, // Synthetic object, usually used for grouping
393
393
  // snapshot items together.
394
394
  kConsString = 10, // Concatenated string. A pair of pointers to strings.
395
395
  kSlicedString = 11, // Sliced string. A fragment of another string.
@@ -784,7 +784,7 @@ class V8_EXPORT HeapProfiler {
784
784
  /**
785
785
  * Returns the sampled profile of allocations allocated (and still live) since
786
786
  * StartSamplingHeapProfiler was called. The ownership of the pointer is
787
- * transfered to the caller. Returns nullptr if sampling heap profiler is not
787
+ * transferred to the caller. Returns nullptr if sampling heap profiler is not
788
788
  * active.
789
789
  */
790
790
  AllocationProfile* GetAllocationProfile();
@@ -809,9 +809,6 @@ class V8_EXPORT HeapProfiler {
809
809
  */
810
810
  static const uint16_t kPersistentHandleNoClassId = 0;
811
811
 
812
- /** Returns memory used for profiler internal data and snapshots. */
813
- size_t GetProfilerMemorySize();
814
-
815
812
  private:
816
813
  HeapProfiler();
817
814
  ~HeapProfiler();
@@ -9,9 +9,9 @@
9
9
  // NOTE these macros are used by some of the tool scripts and the build
10
10
  // system so their names cannot be changed without changing the scripts.
11
11
  #define V8_MAJOR_VERSION 6
12
- #define V8_MINOR_VERSION 0
13
- #define V8_BUILD_NUMBER 286
14
- #define V8_PATCH_LEVEL 54
12
+ #define V8_MINOR_VERSION 2
13
+ #define V8_BUILD_NUMBER 414
14
+ #define V8_PATCH_LEVEL 42
15
15
 
16
16
  // Use 1 for candidates and 0 otherwise.
17
17
  // (Boolean macro values are not supported by all preprocessors.)
@@ -139,6 +139,7 @@ template<typename T> class ReturnValue;
139
139
 
140
140
  namespace internal {
141
141
  class Arguments;
142
+ class DeferredHandles;
142
143
  class Heap;
143
144
  class HeapObject;
144
145
  class Isolate;
@@ -869,8 +870,6 @@ class V8_EXPORT HandleScope {
869
870
 
870
871
  HandleScope(const HandleScope&) = delete;
871
872
  void operator=(const HandleScope&) = delete;
872
- void* operator new(size_t size);
873
- void operator delete(void*, size_t);
874
873
 
875
874
  protected:
876
875
  V8_INLINE HandleScope() {}
@@ -881,6 +880,13 @@ class V8_EXPORT HandleScope {
881
880
  internal::Object* value);
882
881
 
883
882
  private:
883
+ // Declaring operator new and delete as deleted is not spec compliant.
884
+ // Therefore declare them private instead to disable dynamic alloc
885
+ void* operator new(size_t size);
886
+ void* operator new[](size_t size);
887
+ void operator delete(void*, size_t);
888
+ void operator delete[](void*, size_t);
889
+
884
890
  // Uses heap_object to obtain the current Isolate.
885
891
  static internal::Object** CreateHandle(internal::HeapObject* heap_object,
886
892
  internal::Object* value);
@@ -921,10 +927,15 @@ class V8_EXPORT EscapableHandleScope : public HandleScope {
921
927
 
922
928
  EscapableHandleScope(const EscapableHandleScope&) = delete;
923
929
  void operator=(const EscapableHandleScope&) = delete;
930
+
931
+ private:
932
+ // Declaring operator new and delete as deleted is not spec compliant.
933
+ // Therefore declare them private instead to disable dynamic alloc
924
934
  void* operator new(size_t size);
935
+ void* operator new[](size_t size);
925
936
  void operator delete(void*, size_t);
937
+ void operator delete[](void*, size_t);
926
938
 
927
- private:
928
939
  internal::Object** Escape(internal::Object** escape_value);
929
940
  internal::Object** escape_slot_;
930
941
  };
@@ -941,10 +952,15 @@ class V8_EXPORT SealHandleScope {
941
952
 
942
953
  SealHandleScope(const SealHandleScope&) = delete;
943
954
  void operator=(const SealHandleScope&) = delete;
955
+
956
+ private:
957
+ // Declaring operator new and delete as deleted is not spec compliant.
958
+ // Therefore declare them private instead to disable dynamic alloc
944
959
  void* operator new(size_t size);
960
+ void* operator new[](size_t size);
945
961
  void operator delete(void*, size_t);
962
+ void operator delete[](void*, size_t);
946
963
 
947
- private:
948
964
  internal::Isolate* const isolate_;
949
965
  internal::Object** prev_limit_;
950
966
  int prev_sealed_level_;
@@ -1016,9 +1032,6 @@ class ScriptOrigin {
1016
1032
  V8_INLINE Local<Value> ResourceName() const;
1017
1033
  V8_INLINE Local<Integer> ResourceLineOffset() const;
1018
1034
  V8_INLINE Local<Integer> ResourceColumnOffset() const;
1019
- /**
1020
- * Returns true for embedder's debugger scripts
1021
- */
1022
1035
  V8_INLINE Local<Integer> ScriptID() const;
1023
1036
  V8_INLINE Local<Value> SourceMapUrl() const;
1024
1037
  V8_INLINE ScriptOriginOptions Options() const { return options_; }
@@ -1032,7 +1045,6 @@ class ScriptOrigin {
1032
1045
  Local<Value> source_map_url_;
1033
1046
  };
1034
1047
 
1035
-
1036
1048
  /**
1037
1049
  * A compiled JavaScript script, not yet tied to a Context.
1038
1050
  */
@@ -1064,6 +1076,22 @@ class V8_EXPORT UnboundScript {
1064
1076
  static const int kNoScriptId = 0;
1065
1077
  };
1066
1078
 
1079
+ /**
1080
+ * A location in JavaScript source.
1081
+ */
1082
+ class V8_EXPORT Location {
1083
+ public:
1084
+ int GetLineNumber() { return line_number_; }
1085
+ int GetColumnNumber() { return column_number_; }
1086
+
1087
+ Location(int line_number, int column_number)
1088
+ : line_number_(line_number), column_number_(column_number) {}
1089
+
1090
+ private:
1091
+ int line_number_;
1092
+ int column_number_;
1093
+ };
1094
+
1067
1095
  /**
1068
1096
  * This is an unfinished experimental feature, and is only exposed
1069
1097
  * here for internal testing purposes. DO NOT USE.
@@ -1072,6 +1100,28 @@ class V8_EXPORT UnboundScript {
1072
1100
  */
1073
1101
  class V8_EXPORT Module {
1074
1102
  public:
1103
+ /**
1104
+ * The different states a module can be in.
1105
+ */
1106
+ enum Status {
1107
+ kUninstantiated,
1108
+ kInstantiating,
1109
+ kInstantiated,
1110
+ kEvaluating,
1111
+ kEvaluated,
1112
+ kErrored
1113
+ };
1114
+
1115
+ /**
1116
+ * Returns the module's current status.
1117
+ */
1118
+ Status GetStatus() const;
1119
+
1120
+ /**
1121
+ * For a module in kErrored status, this returns the corresponding exception.
1122
+ */
1123
+ Local<Value> GetException() const;
1124
+
1075
1125
  /**
1076
1126
  * Returns the number of modules requested by this module.
1077
1127
  */
@@ -1083,6 +1133,12 @@ class V8_EXPORT Module {
1083
1133
  */
1084
1134
  Local<String> GetModuleRequest(int i) const;
1085
1135
 
1136
+ /**
1137
+ * Returns the source location (line number and column number) of the ith
1138
+ * module specifier's first occurrence in this module.
1139
+ */
1140
+ Location GetModuleRequestLocation(int i) const;
1141
+
1086
1142
  /**
1087
1143
  * Returns the identity hash for this object.
1088
1144
  */
@@ -1095,40 +1151,29 @@ class V8_EXPORT Module {
1095
1151
  /**
1096
1152
  * ModuleDeclarationInstantiation
1097
1153
  *
1098
- * Returns false if an exception occurred during instantiation. (In the case
1099
- * where the callback throws an exception, that exception is propagated.)
1154
+ * Returns an empty Maybe<bool> if an exception occurred during
1155
+ * instantiation. (In the case where the callback throws an exception, that
1156
+ * exception is propagated.)
1100
1157
  */
1101
- V8_WARN_UNUSED_RESULT bool Instantiate(Local<Context> context,
1102
- ResolveCallback callback);
1158
+ V8_DEPRECATED("Use Maybe<bool> version",
1159
+ bool Instantiate(Local<Context> context,
1160
+ ResolveCallback callback));
1161
+ V8_WARN_UNUSED_RESULT Maybe<bool> InstantiateModule(Local<Context> context,
1162
+ ResolveCallback callback);
1103
1163
 
1104
1164
  /**
1105
1165
  * ModuleEvaluation
1106
1166
  *
1107
1167
  * Returns the completion value.
1168
+ * TODO(neis): Be more precise or say nothing.
1108
1169
  */
1109
1170
  V8_WARN_UNUSED_RESULT MaybeLocal<Value> Evaluate(Local<Context> context);
1110
- };
1111
-
1112
- /**
1113
- * This is an unfinished experimental feature, and is only exposed
1114
- * here for internal testing purposes. DO NOT USE.
1115
- *
1116
- * A compiled JavaScript module.
1117
- */
1118
- class V8_EXPORT DynamicImportResult {
1119
- public:
1120
- /**
1121
- * Resolves the promise with the namespace object of the given
1122
- * module.
1123
- */
1124
- V8_WARN_UNUSED_RESULT bool FinishDynamicImportSuccess(Local<Context> context,
1125
- Local<Module> module);
1126
1171
 
1127
1172
  /**
1128
- * Rejects the promise with the given exception.
1173
+ * Returns the namespace object of this module.
1174
+ * The module's status must be kEvaluated.
1129
1175
  */
1130
- V8_WARN_UNUSED_RESULT bool FinishDynamicImportFailure(Local<Context> context,
1131
- Local<Value> exception);
1176
+ Local<Value> GetModuleNamespace();
1132
1177
  };
1133
1178
 
1134
1179
  /**
@@ -1681,7 +1726,16 @@ class V8_EXPORT StackFrame {
1681
1726
 
1682
1727
 
1683
1728
  // A StateTag represents a possible state of the VM.
1684
- enum StateTag { JS, GC, COMPILER, OTHER, EXTERNAL, IDLE };
1729
+ enum StateTag {
1730
+ JS,
1731
+ GC,
1732
+ PARSER,
1733
+ BYTECODE_COMPILER,
1734
+ COMPILER,
1735
+ OTHER,
1736
+ EXTERNAL,
1737
+ IDLE
1738
+ };
1685
1739
 
1686
1740
  // A RegisterState represents the current state of registers used
1687
1741
  // by the sampling profiler API.
@@ -2398,7 +2452,8 @@ enum class NewStringType {
2398
2452
  */
2399
2453
  class V8_EXPORT String : public Name {
2400
2454
  public:
2401
- static const int kMaxLength = (1 << 28) - 16;
2455
+ static constexpr int kMaxLength =
2456
+ sizeof(void*) == 4 ? (1 << 28) - 16 : (1 << 30) - 1 - 24;
2402
2457
 
2403
2458
  enum Encoding {
2404
2459
  UNKNOWN_ENCODING = 0x1,
@@ -2717,7 +2772,9 @@ class V8_EXPORT String : public Name {
2717
2772
  */
2718
2773
  class V8_EXPORT Utf8Value {
2719
2774
  public:
2720
- explicit Utf8Value(Local<v8::Value> obj);
2775
+ V8_DEPRECATE_SOON("Use Isolate version",
2776
+ explicit Utf8Value(Local<v8::Value> obj));
2777
+ Utf8Value(Isolate* isolate, Local<v8::Value> obj);
2721
2778
  ~Utf8Value();
2722
2779
  char* operator*() { return str_; }
2723
2780
  const char* operator*() const { return str_; }
@@ -2740,7 +2797,9 @@ class V8_EXPORT String : public Name {
2740
2797
  */
2741
2798
  class V8_EXPORT Value {
2742
2799
  public:
2743
- explicit Value(Local<v8::Value> obj);
2800
+ V8_DEPRECATE_SOON("Use Isolate version",
2801
+ explicit Value(Local<v8::Value> obj));
2802
+ Value(Isolate* isolate, Local<v8::Value> obj);
2744
2803
  ~Value();
2745
2804
  uint16_t* operator*() { return str_; }
2746
2805
  const uint16_t* operator*() const { return str_; }
@@ -3053,12 +3112,9 @@ class V8_EXPORT Object : public Value {
3053
3112
  //
3054
3113
  // Note also that this only works for named properties.
3055
3114
  V8_DEPRECATED("Use CreateDataProperty / DefineOwnProperty",
3056
- bool ForceSet(Local<Value> key, Local<Value> value,
3057
- PropertyAttribute attribs = None));
3058
- V8_DEPRECATE_SOON("Use CreateDataProperty / DefineOwnProperty",
3059
- Maybe<bool> ForceSet(Local<Context> context,
3060
- Local<Value> key, Local<Value> value,
3061
- PropertyAttribute attribs = None));
3115
+ Maybe<bool> ForceSet(Local<Context> context, Local<Value> key,
3116
+ Local<Value> value,
3117
+ PropertyAttribute attribs = None));
3062
3118
 
3063
3119
  V8_DEPRECATE_SOON("Use maybe version", Local<Value> Get(Local<Value> key));
3064
3120
  V8_WARN_UNUSED_RESULT MaybeLocal<Value> Get(Local<Context> context,
@@ -4123,6 +4179,46 @@ class V8_EXPORT WasmCompiledModule : public Object {
4123
4179
  static void CheckCast(Value* obj);
4124
4180
  };
4125
4181
 
4182
+ // TODO(mtrofin): when streaming compilation is done, we can rename this
4183
+ // to simply WasmModuleObjectBuilder
4184
+ class V8_EXPORT WasmModuleObjectBuilderStreaming final {
4185
+ public:
4186
+ WasmModuleObjectBuilderStreaming(Isolate* isolate);
4187
+ // The buffer passed into OnBytesReceived is owned by the caller.
4188
+ void OnBytesReceived(const uint8_t*, size_t size);
4189
+ void Finish();
4190
+ void Abort(Local<Value> exception);
4191
+ Local<Promise> GetPromise();
4192
+
4193
+ ~WasmModuleObjectBuilderStreaming();
4194
+
4195
+ private:
4196
+ typedef std::pair<std::unique_ptr<const uint8_t[]>, size_t> Buffer;
4197
+
4198
+ WasmModuleObjectBuilderStreaming(const WasmModuleObjectBuilderStreaming&) =
4199
+ delete;
4200
+ WasmModuleObjectBuilderStreaming(WasmModuleObjectBuilderStreaming&&) =
4201
+ default;
4202
+ WasmModuleObjectBuilderStreaming& operator=(
4203
+ const WasmModuleObjectBuilderStreaming&) = delete;
4204
+ WasmModuleObjectBuilderStreaming& operator=(
4205
+ WasmModuleObjectBuilderStreaming&&) = default;
4206
+ Isolate* isolate_ = nullptr;
4207
+
4208
+ #if V8_CC_MSVC
4209
+ // We don't need the static Copy API, so the default
4210
+ // NonCopyablePersistentTraits would be sufficient, however,
4211
+ // MSVC eagerly instantiates the Copy.
4212
+ // We ensure we don't use Copy, however, by compiling with the
4213
+ // defaults everywhere else.
4214
+ Persistent<Promise, CopyablePersistentTraits<Promise>> promise_;
4215
+ #else
4216
+ Persistent<Promise> promise_;
4217
+ #endif
4218
+ std::vector<Buffer> received_buffers_;
4219
+ size_t total_size_ = 0;
4220
+ };
4221
+
4126
4222
  class V8_EXPORT WasmModuleObjectBuilder final {
4127
4223
  public:
4128
4224
  WasmModuleObjectBuilder(Isolate* isolate) : isolate_(isolate) {}
@@ -4247,7 +4343,18 @@ class V8_EXPORT ArrayBuffer : public Object {
4247
4343
  */
4248
4344
  class V8_EXPORT Contents { // NOLINT
4249
4345
  public:
4250
- Contents() : data_(NULL), byte_length_(0) {}
4346
+ Contents()
4347
+ : data_(nullptr),
4348
+ byte_length_(0),
4349
+ allocation_base_(nullptr),
4350
+ allocation_length_(0),
4351
+ allocation_mode_(Allocator::AllocationMode::kNormal) {}
4352
+
4353
+ void* AllocationBase() const { return allocation_base_; }
4354
+ size_t AllocationLength() const { return allocation_length_; }
4355
+ Allocator::AllocationMode AllocationMode() const {
4356
+ return allocation_mode_;
4357
+ }
4251
4358
 
4252
4359
  void* Data() const { return data_; }
4253
4360
  size_t ByteLength() const { return byte_length_; }
@@ -4255,6 +4362,9 @@ class V8_EXPORT ArrayBuffer : public Object {
4255
4362
  private:
4256
4363
  void* data_;
4257
4364
  size_t byte_length_;
4365
+ void* allocation_base_;
4366
+ size_t allocation_length_;
4367
+ Allocator::AllocationMode allocation_mode_;
4258
4368
 
4259
4369
  friend class ArrayBuffer;
4260
4370
  };
@@ -4400,6 +4510,12 @@ class V8_EXPORT ArrayBufferView : public Object {
4400
4510
  */
4401
4511
  class V8_EXPORT TypedArray : public ArrayBufferView {
4402
4512
  public:
4513
+ /*
4514
+ * The largest typed array size that can be constructed using New.
4515
+ */
4516
+ static constexpr size_t kMaxLength =
4517
+ sizeof(void*) == 4 ? (1u << 30) - 1 : (1u << 31) - 1;
4518
+
4403
4519
  /**
4404
4520
  * Number of elements in this typed array
4405
4521
  * (e.g. for Int16Array, |ByteLength|/2).
@@ -4603,7 +4719,18 @@ class V8_EXPORT SharedArrayBuffer : public Object {
4603
4719
  */
4604
4720
  class V8_EXPORT Contents { // NOLINT
4605
4721
  public:
4606
- Contents() : data_(NULL), byte_length_(0) {}
4722
+ Contents()
4723
+ : data_(nullptr),
4724
+ byte_length_(0),
4725
+ allocation_base_(nullptr),
4726
+ allocation_length_(0),
4727
+ allocation_mode_(ArrayBuffer::Allocator::AllocationMode::kNormal) {}
4728
+
4729
+ void* AllocationBase() const { return allocation_base_; }
4730
+ size_t AllocationLength() const { return allocation_length_; }
4731
+ ArrayBuffer::Allocator::AllocationMode AllocationMode() const {
4732
+ return allocation_mode_;
4733
+ }
4607
4734
 
4608
4735
  void* Data() const { return data_; }
4609
4736
  size_t ByteLength() const { return byte_length_; }
@@ -4611,6 +4738,9 @@ class V8_EXPORT SharedArrayBuffer : public Object {
4611
4738
  private:
4612
4739
  void* data_;
4613
4740
  size_t byte_length_;
4741
+ void* allocation_base_;
4742
+ size_t allocation_length_;
4743
+ ArrayBuffer::Allocator::AllocationMode allocation_mode_;
4614
4744
 
4615
4745
  friend class SharedArrayBuffer;
4616
4746
  };
@@ -4857,6 +4987,7 @@ class V8_EXPORT External : public Value {
4857
4987
  F(ArrayProto_forEach, array_for_each_iterator) \
4858
4988
  F(ArrayProto_keys, array_keys_iterator) \
4859
4989
  F(ArrayProto_values, array_values_iterator) \
4990
+ F(ErrorPrototype, initial_error_prototype) \
4860
4991
  F(IteratorPrototype, initial_iterator_prototype)
4861
4992
 
4862
4993
  enum Intrinsic {
@@ -4995,7 +5126,6 @@ typedef void (*NamedPropertyDeleterCallback)(
4995
5126
  Local<String> property,
4996
5127
  const PropertyCallbackInfo<Boolean>& info);
4997
5128
 
4998
-
4999
5129
  /**
5000
5130
  * Returns an array containing the names of the properties the named
5001
5131
  * property getter intercepts.
@@ -5119,7 +5249,6 @@ typedef void (*GenericNamedPropertyQueryCallback)(
5119
5249
  typedef void (*GenericNamedPropertyDeleterCallback)(
5120
5250
  Local<Name> property, const PropertyCallbackInfo<Boolean>& info);
5121
5251
 
5122
-
5123
5252
  /**
5124
5253
  * Returns an array containing the names of the properties the named
5125
5254
  * property getter intercepts.
@@ -5921,6 +6050,8 @@ V8_INLINE Local<Boolean> False(Isolate* isolate);
5921
6050
  *
5922
6051
  * The arguments for set_max_semi_space_size, set_max_old_space_size,
5923
6052
  * set_max_executable_size, set_code_range_size specify limits in MB.
6053
+ *
6054
+ * The argument for set_max_semi_space_size_in_kb is in KB.
5924
6055
  */
5925
6056
  class V8_EXPORT ResourceConstraints {
5926
6057
  public:
@@ -5938,10 +6069,28 @@ class V8_EXPORT ResourceConstraints {
5938
6069
  void ConfigureDefaults(uint64_t physical_memory,
5939
6070
  uint64_t virtual_memory_limit);
5940
6071
 
5941
- int max_semi_space_size() const { return max_semi_space_size_; }
5942
- void set_max_semi_space_size(int limit_in_mb) {
5943
- max_semi_space_size_ = limit_in_mb;
6072
+ // Returns the max semi-space size in MB.
6073
+ V8_DEPRECATE_SOON("Use max_semi_space_size_in_kb()",
6074
+ int max_semi_space_size()) {
6075
+ return static_cast<int>(max_semi_space_size_in_kb_ / 1024);
6076
+ }
6077
+
6078
+ // Sets the max semi-space size in MB.
6079
+ V8_DEPRECATE_SOON("Use set_max_semi_space_size_in_kb(size_t limit_in_kb)",
6080
+ void set_max_semi_space_size(int limit_in_mb)) {
6081
+ max_semi_space_size_in_kb_ = limit_in_mb * 1024;
6082
+ }
6083
+
6084
+ // Returns the max semi-space size in KB.
6085
+ size_t max_semi_space_size_in_kb() const {
6086
+ return max_semi_space_size_in_kb_;
5944
6087
  }
6088
+
6089
+ // Sets the max semi-space size in KB.
6090
+ void set_max_semi_space_size_in_kb(size_t limit_in_kb) {
6091
+ max_semi_space_size_in_kb_ = limit_in_kb;
6092
+ }
6093
+
5945
6094
  int max_old_space_size() const { return max_old_space_size_; }
5946
6095
  void set_max_old_space_size(int limit_in_mb) {
5947
6096
  max_old_space_size_ = limit_in_mb;
@@ -5967,7 +6116,10 @@ class V8_EXPORT ResourceConstraints {
5967
6116
  }
5968
6117
 
5969
6118
  private:
5970
- int max_semi_space_size_;
6119
+ // max_semi_space_size_ is in KB
6120
+ size_t max_semi_space_size_in_kb_;
6121
+
6122
+ // The remaining limits are in MB
5971
6123
  int max_old_space_size_;
5972
6124
  int max_executable_size_;
5973
6125
  uint32_t* stack_limit_;
@@ -6055,21 +6207,25 @@ typedef void (*DeprecatedCallCompletedCallback)();
6055
6207
  /**
6056
6208
  * HostImportDynamicallyCallback is called when we require the
6057
6209
  * embedder to load a module. This is used as part of the dynamic
6058
- * import syntax. The behavior of this callback is not specified in
6059
- * EcmaScript.
6210
+ * import syntax.
6060
6211
  *
6061
6212
  * The referrer is the name of the file which calls the dynamic
6062
6213
  * import. The referrer can be used to resolve the module location.
6063
6214
  *
6064
6215
  * The specifier is the name of the module that should be imported.
6065
6216
  *
6066
- * The DynamicImportResult object is used to signal success or failure
6067
- * by calling it's respective methods.
6217
+ * The embedder must compile, instantiate, evaluate the Module, and
6218
+ * obtain it's namespace object.
6068
6219
  *
6220
+ * The Promise returned from this function is forwarded to userland
6221
+ * JavaScript. The embedder must resolve this promise with the module
6222
+ * namespace object. In case of an exception, the embedder must reject
6223
+ * this promise with the exception. If the promise creation itself
6224
+ * fails (e.g. due to stack overflow), the embedder must propagate
6225
+ * that exception by returning an empty MaybeLocal.
6069
6226
  */
6070
- typedef void (*HostImportModuleDynamicallyCallback)(
6071
- Isolate* isolate, Local<String> referrer, Local<String> specifier,
6072
- Local<DynamicImportResult> result);
6227
+ typedef MaybeLocal<Promise> (*HostImportModuleDynamicallyCallback)(
6228
+ Local<Context> context, Local<String> referrer, Local<String> specifier);
6073
6229
 
6074
6230
  /**
6075
6231
  * PromiseHook with type kInit is called when a new promise is
@@ -6192,11 +6348,16 @@ typedef void (*FailedAccessCheckCallback)(Local<Object> target,
6192
6348
  * Callback to check if code generation from strings is allowed. See
6193
6349
  * Context::AllowCodeGenerationFromStrings.
6194
6350
  */
6195
- typedef bool (*AllowCodeGenerationFromStringsCallback)(Local<Context> context);
6351
+ typedef bool (*AllowCodeGenerationFromStringsCallback)(Local<Context> context,
6352
+ Local<String> source);
6196
6353
 
6197
- // --- WASM compilation callbacks ---
6354
+ // --- WebAssembly compilation callbacks ---
6198
6355
  typedef bool (*ExtensionCallback)(const FunctionCallbackInfo<Value>&);
6199
6356
 
6357
+ // --- Callback for APIs defined on v8-supported objects, but implemented
6358
+ // by the embedder. Example: WebAssembly.{compile|instantiate}Streaming ---
6359
+ typedef void (*ApiImplementationCallback)(const FunctionCallbackInfo<Value>&);
6360
+
6200
6361
  // --- Garbage Collection Callbacks ---
6201
6362
 
6202
6363
  /**
@@ -6397,7 +6558,7 @@ struct JitCodeEvent {
6397
6558
  struct line_info_t {
6398
6559
  // PC offset
6399
6560
  size_t offset;
6400
- // Code postion
6561
+ // Code position
6401
6562
  size_t pos;
6402
6563
  // The position type.
6403
6564
  PositionType position_type;
@@ -6620,8 +6781,7 @@ class V8_EXPORT Isolate {
6620
6781
  add_histogram_sample_callback(nullptr),
6621
6782
  array_buffer_allocator(nullptr),
6622
6783
  external_references(nullptr),
6623
- allow_atomics_wait(true),
6624
- host_import_module_dynamically_callback_(nullptr) {}
6784
+ allow_atomics_wait(true) {}
6625
6785
 
6626
6786
  /**
6627
6787
  * The optional entry_hook allows the host application to provide the
@@ -6677,23 +6837,13 @@ class V8_EXPORT Isolate {
6677
6837
  * deserialization. This array and its content must stay valid for the
6678
6838
  * entire lifetime of the isolate.
6679
6839
  */
6680
- intptr_t* external_references;
6840
+ const intptr_t* external_references;
6681
6841
 
6682
6842
  /**
6683
6843
  * Whether calling Atomics.wait (a function that may block) is allowed in
6684
6844
  * this isolate. This can also be configured via SetAllowAtomicsWait.
6685
6845
  */
6686
6846
  bool allow_atomics_wait;
6687
-
6688
- /**
6689
- * This is an unfinished experimental feature, and is only exposed
6690
- * here for internal testing purposes. DO NOT USE.
6691
- *
6692
- * This specifies the callback called by the upcoming dynamic
6693
- * import() language feature to load modules.
6694
- */
6695
- HostImportModuleDynamicallyCallback
6696
- host_import_module_dynamically_callback_;
6697
6847
  };
6698
6848
 
6699
6849
 
@@ -6832,6 +6982,8 @@ class V8_EXPORT Isolate {
6832
6982
  kAssigmentExpressionLHSIsCallInSloppy = 36,
6833
6983
  kAssigmentExpressionLHSIsCallInStrict = 37,
6834
6984
  kPromiseConstructorReturnedUndefined = 38,
6985
+ kConstructorNonUndefinedPrimitiveReturn = 39,
6986
+ kLabeledExpressionStatement = 40,
6835
6987
 
6836
6988
  // If you add new values here, you'll also need to update Chromium's:
6837
6989
  // UseCounter.h, V8PerIsolateData.cpp, histograms.xml
@@ -6884,6 +7036,16 @@ class V8_EXPORT Isolate {
6884
7036
  void SetAbortOnUncaughtExceptionCallback(
6885
7037
  AbortOnUncaughtExceptionCallback callback);
6886
7038
 
7039
+ /**
7040
+ * This is an unfinished experimental feature, and is only exposed
7041
+ * here for internal testing purposes. DO NOT USE.
7042
+ *
7043
+ * This specifies the callback called by the upcoming dynamic
7044
+ * import() language feature to load modules.
7045
+ */
7046
+ void SetHostImportModuleDynamicallyCallback(
7047
+ HostImportModuleDynamicallyCallback callback);
7048
+
6887
7049
  /**
6888
7050
  * Optional notification that the system is running low on memory.
6889
7051
  * V8 uses these notifications to guide heuristics.
@@ -7081,6 +7243,12 @@ class V8_EXPORT Isolate {
7081
7243
  */
7082
7244
  Local<Context> GetEnteredOrMicrotaskContext();
7083
7245
 
7246
+ /**
7247
+ * Returns the Context that corresponds to the Incumbent realm in HTML spec.
7248
+ * https://html.spec.whatwg.org/multipage/webappapis.html#incumbent
7249
+ */
7250
+ Local<Context> GetIncumbentContext();
7251
+
7084
7252
  /**
7085
7253
  * Schedules an exception to be thrown when returning to JavaScript. When an
7086
7254
  * exception has been scheduled it is illegal to invoke any JavaScript
@@ -7133,6 +7301,17 @@ class V8_EXPORT Isolate {
7133
7301
  */
7134
7302
  void RemoveGCEpilogueCallback(GCCallback callback);
7135
7303
 
7304
+ typedef size_t (*GetExternallyAllocatedMemoryInBytesCallback)();
7305
+
7306
+ /**
7307
+ * Set the callback that tells V8 how much memory is currently allocated
7308
+ * externally of the V8 heap. Ideally this memory is somehow connected to V8
7309
+ * objects and may get freed-up when the corresponding V8 objects get
7310
+ * collected by a V8 garbage collection.
7311
+ */
7312
+ void SetGetExternallyAllocatedMemoryInBytesCallback(
7313
+ GetExternallyAllocatedMemoryInBytesCallback callback);
7314
+
7136
7315
  /**
7137
7316
  * Forcefully terminate the current thread of JavaScript execution
7138
7317
  * in the given isolate.
@@ -7230,8 +7409,8 @@ class V8_EXPORT Isolate {
7230
7409
  DeprecatedCallCompletedCallback callback));
7231
7410
 
7232
7411
  /**
7233
- * Experimental: Set the PromiseHook callback for various promise
7234
- * lifecycle events.
7412
+ * Set the PromiseHook callback for various promise lifecycle
7413
+ * events.
7235
7414
  */
7236
7415
  void SetPromiseHook(PromiseHook hook);
7237
7416
 
@@ -7450,12 +7629,13 @@ class V8_EXPORT Isolate {
7450
7629
  AllowCodeGenerationFromStringsCallback callback);
7451
7630
 
7452
7631
  /**
7453
- * Embedder over{ride|load} injection points for wasm APIs.
7632
+ * Embedder over{ride|load} injection points for wasm APIs. The expectation
7633
+ * is that the embedder sets them at most once.
7454
7634
  */
7455
7635
  void SetWasmModuleCallback(ExtensionCallback callback);
7456
- void SetWasmCompileCallback(ExtensionCallback callback);
7457
7636
  void SetWasmInstanceCallback(ExtensionCallback callback);
7458
- void SetWasmInstantiateCallback(ExtensionCallback callback);
7637
+
7638
+ void SetWasmCompileStreamingCallback(ApiImplementationCallback callback);
7459
7639
 
7460
7640
  /**
7461
7641
  * Check if V8 is dead and therefore unusable. This is the case after
@@ -7552,14 +7732,19 @@ class V8_EXPORT Isolate {
7552
7732
  ~Isolate() = delete;
7553
7733
  Isolate(const Isolate&) = delete;
7554
7734
  Isolate& operator=(const Isolate&) = delete;
7735
+ // Deleting operator new and delete here is allowed as ctor and dtor is also
7736
+ // deleted.
7555
7737
  void* operator new(size_t size) = delete;
7738
+ void* operator new[](size_t size) = delete;
7556
7739
  void operator delete(void*, size_t) = delete;
7740
+ void operator delete[](void*, size_t) = delete;
7557
7741
 
7558
7742
  private:
7559
7743
  template <class K, class V, class Traits>
7560
7744
  friend class PersistentValueMapBase;
7561
7745
 
7562
7746
  void ReportExternalAllocationLimitReached();
7747
+ void CheckMemoryPressure();
7563
7748
  };
7564
7749
 
7565
7750
  class V8_EXPORT StartupData {
@@ -7579,7 +7764,7 @@ typedef bool (*EntropySource)(unsigned char* buffer, size_t length);
7579
7764
  * ReturnAddressLocationResolver is used as a callback function when v8 is
7580
7765
  * resolving the location of a return address on the stack. Profilers that
7581
7766
  * change the return address on the stack can use this to resolve the stack
7582
- * location to whereever the profiler stashed the original return address.
7767
+ * location to wherever the profiler stashed the original return address.
7583
7768
  *
7584
7769
  * \param return_addr_location A location on stack where a machine
7585
7770
  * return address resides.
@@ -7602,14 +7787,6 @@ class V8_EXPORT V8 {
7602
7787
  "Use isolate version",
7603
7788
  void SetFatalErrorHandler(FatalErrorCallback that));
7604
7789
 
7605
- /**
7606
- * Set the callback to invoke to check if code generation from
7607
- * strings should be allowed.
7608
- */
7609
- V8_INLINE static V8_DEPRECATED(
7610
- "Use isolate version", void SetAllowCodeGenerationFromStringsCallback(
7611
- AllowCodeGenerationFromStringsCallback that));
7612
-
7613
7790
  /**
7614
7791
  * Check if V8 is dead and therefore unusable. This is the case after
7615
7792
  * fatal errors such as out-of-memory situations.
@@ -7919,7 +8096,7 @@ class V8_EXPORT V8 {
7919
8096
  */
7920
8097
  static void ShutdownPlatform();
7921
8098
 
7922
- #if V8_OS_LINUX && V8_TARGET_ARCH_X64 && !V8_OS_ANDROID
8099
+ #if V8_OS_POSIX
7923
8100
  /**
7924
8101
  * Give the V8 signal handler a chance to handle a fault.
7925
8102
  *
@@ -7940,7 +8117,7 @@ class V8_EXPORT V8 {
7940
8117
  * points to a ucontext_t structure.
7941
8118
  */
7942
8119
  static bool TryHandleSignal(int signal_number, void* info, void* context);
7943
- #endif // V8_OS_LINUX
8120
+ #endif // V8_OS_POSIX
7944
8121
 
7945
8122
  /**
7946
8123
  * Enable the default signal handler rather than using one provided by the
@@ -8005,7 +8182,7 @@ class V8_EXPORT SnapshotCreator {
8005
8182
  * \param external_references a null-terminated array of external references
8006
8183
  * that must be equivalent to CreateParams::external_references.
8007
8184
  */
8008
- SnapshotCreator(intptr_t* external_references = nullptr,
8185
+ SnapshotCreator(const intptr_t* external_references = nullptr,
8009
8186
  StartupData* existing_blob = nullptr);
8010
8187
 
8011
8188
  ~SnapshotCreator();
@@ -8019,8 +8196,12 @@ class V8_EXPORT SnapshotCreator {
8019
8196
  * Set the default context to be included in the snapshot blob.
8020
8197
  * The snapshot will not contain the global proxy, and we expect one or a
8021
8198
  * global object template to create one, to be provided upon deserialization.
8199
+ *
8200
+ * \param callback optional callback to serialize internal fields.
8022
8201
  */
8023
- void SetDefaultContext(Local<Context> context);
8202
+ void SetDefaultContext(Local<Context> context,
8203
+ SerializeInternalFieldsCallback callback =
8204
+ SerializeInternalFieldsCallback());
8024
8205
 
8025
8206
  /**
8026
8207
  * Add additional context to be included in the snapshot blob.
@@ -8279,10 +8460,15 @@ class V8_EXPORT TryCatch {
8279
8460
 
8280
8461
  TryCatch(const TryCatch&) = delete;
8281
8462
  void operator=(const TryCatch&) = delete;
8463
+
8464
+ private:
8465
+ // Declaring operator new and delete as deleted is not spec compliant.
8466
+ // Therefore declare them private instead to disable dynamic alloc
8282
8467
  void* operator new(size_t size);
8468
+ void* operator new[](size_t size);
8283
8469
  void operator delete(void*, size_t);
8470
+ void operator delete[](void*, size_t);
8284
8471
 
8285
- private:
8286
8472
  void ResetInternal();
8287
8473
 
8288
8474
  internal::Isolate* isolate_;
@@ -8367,7 +8553,9 @@ class V8_EXPORT Context {
8367
8553
  static Local<Context> New(
8368
8554
  Isolate* isolate, ExtensionConfiguration* extensions = NULL,
8369
8555
  MaybeLocal<ObjectTemplate> global_template = MaybeLocal<ObjectTemplate>(),
8370
- MaybeLocal<Value> global_object = MaybeLocal<Value>());
8556
+ MaybeLocal<Value> global_object = MaybeLocal<Value>(),
8557
+ DeserializeInternalFieldsCallback internal_fields_deserializer =
8558
+ DeserializeInternalFieldsCallback());
8371
8559
 
8372
8560
  /**
8373
8561
  * Create a new context from a (non-default) context snapshot. There
@@ -8535,6 +8723,27 @@ class V8_EXPORT Context {
8535
8723
  Local<Context> context_;
8536
8724
  };
8537
8725
 
8726
+ /**
8727
+ * Stack-allocated class to support the backup incumbent settings object
8728
+ * stack.
8729
+ * https://html.spec.whatwg.org/multipage/webappapis.html#backup-incumbent-settings-object-stack
8730
+ */
8731
+ class BackupIncumbentScope {
8732
+ public:
8733
+ /**
8734
+ * |backup_incumbent_context| is pushed onto the backup incumbent settings
8735
+ * object stack.
8736
+ */
8737
+ explicit BackupIncumbentScope(Local<Context> backup_incumbent_context);
8738
+ ~BackupIncumbentScope();
8739
+
8740
+ private:
8741
+ friend class internal::Isolate;
8742
+
8743
+ Local<Context> backup_incumbent_context_;
8744
+ const BackupIncumbentScope* prev_ = nullptr;
8745
+ };
8746
+
8538
8747
  private:
8539
8748
  friend class Value;
8540
8749
  friend class Script;
@@ -8782,6 +8991,8 @@ class Internals {
8782
8991
  static const int kExternalMemoryOffset = 4 * kApiPointerSize;
8783
8992
  static const int kExternalMemoryLimitOffset =
8784
8993
  kExternalMemoryOffset + kApiInt64Size;
8994
+ static const int kExternalMemoryAtLastMarkCompactOffset =
8995
+ kExternalMemoryLimitOffset + kApiInt64Size;
8785
8996
  static const int kIsolateRootsOffset = kExternalMemoryLimitOffset +
8786
8997
  kApiInt64Size + kApiInt64Size +
8787
8998
  kApiPointerSize + kApiPointerSize;
@@ -8801,8 +9012,8 @@ class Internals {
8801
9012
  static const int kNodeIsIndependentShift = 3;
8802
9013
  static const int kNodeIsActiveShift = 4;
8803
9014
 
8804
- static const int kJSApiObjectType = 0xbb;
8805
- static const int kJSObjectType = 0xbc;
9015
+ static const int kJSApiObjectType = 0xbd;
9016
+ static const int kJSObjectType = 0xbe;
8806
9017
  static const int kFirstNonstringType = 0x80;
8807
9018
  static const int kOddballType = 0x82;
8808
9019
  static const int kForeignType = 0x86;
@@ -10000,13 +10211,32 @@ uint32_t Isolate::GetNumberOfDataSlots() {
10000
10211
  int64_t Isolate::AdjustAmountOfExternalAllocatedMemory(
10001
10212
  int64_t change_in_bytes) {
10002
10213
  typedef internal::Internals I;
10214
+ const int64_t kMemoryReducerActivationLimit = 32 * 1024 * 1024;
10003
10215
  int64_t* external_memory = reinterpret_cast<int64_t*>(
10004
10216
  reinterpret_cast<uint8_t*>(this) + I::kExternalMemoryOffset);
10005
- const int64_t external_memory_limit = *reinterpret_cast<int64_t*>(
10217
+ int64_t* external_memory_limit = reinterpret_cast<int64_t*>(
10006
10218
  reinterpret_cast<uint8_t*>(this) + I::kExternalMemoryLimitOffset);
10219
+ int64_t* external_memory_at_last_mc =
10220
+ reinterpret_cast<int64_t*>(reinterpret_cast<uint8_t*>(this) +
10221
+ I::kExternalMemoryAtLastMarkCompactOffset);
10007
10222
  const int64_t amount = *external_memory + change_in_bytes;
10223
+
10008
10224
  *external_memory = amount;
10009
- if (change_in_bytes > 0 && amount > external_memory_limit) {
10225
+
10226
+ int64_t allocation_diff_since_last_mc =
10227
+ *external_memory_at_last_mc - *external_memory;
10228
+ allocation_diff_since_last_mc = allocation_diff_since_last_mc < 0
10229
+ ? -allocation_diff_since_last_mc
10230
+ : allocation_diff_since_last_mc;
10231
+ if (allocation_diff_since_last_mc > kMemoryReducerActivationLimit) {
10232
+ CheckMemoryPressure();
10233
+ }
10234
+
10235
+ if (change_in_bytes < 0) {
10236
+ *external_memory_limit += change_in_bytes;
10237
+ }
10238
+
10239
+ if (change_in_bytes > 0 && amount > *external_memory_limit) {
10010
10240
  ReportExternalAllocationLimitReached();
10011
10241
  }
10012
10242
  return *external_memory;
@@ -10036,14 +10266,6 @@ void* Context::GetAlignedPointerFromEmbedderData(int index) {
10036
10266
  #endif
10037
10267
  }
10038
10268
 
10039
-
10040
- void V8::SetAllowCodeGenerationFromStringsCallback(
10041
- AllowCodeGenerationFromStringsCallback callback) {
10042
- Isolate* isolate = Isolate::GetCurrent();
10043
- isolate->SetAllowCodeGenerationFromStringsCallback(callback);
10044
- }
10045
-
10046
-
10047
10269
  bool V8::IsDead() {
10048
10270
  Isolate* isolate = Isolate::GetCurrent();
10049
10271
  return isolate->IsDead();
@@ -61,6 +61,7 @@
61
61
  // V8_OS_CYGWIN - Cygwin
62
62
  // V8_OS_DRAGONFLYBSD - DragonFlyBSD
63
63
  // V8_OS_FREEBSD - FreeBSD
64
+ // V8_OS_FUCHSIA - Fuchsia
64
65
  // V8_OS_LINUX - Linux
65
66
  // V8_OS_MACOSX - Mac OS X
66
67
  // V8_OS_NETBSD - NetBSD
@@ -95,6 +96,9 @@
95
96
  # define V8_OS_BSD 1
96
97
  # define V8_OS_FREEBSD 1
97
98
  # define V8_OS_POSIX 1
99
+ #elif defined(__Fuchsia__)
100
+ # define V8_OS_FUCHSIA 1
101
+ # define V8_OS_POSIX 1
98
102
  #elif defined(__DragonFly__)
99
103
  # define V8_OS_BSD 1
100
104
  # define V8_OS_DRAGONFLYBSD 1
@@ -169,7 +173,6 @@
169
173
  // supported
170
174
  // V8_HAS_ATTRIBUTE_DEPRECATED - __attribute__((deprecated)) supported
171
175
  // V8_HAS_ATTRIBUTE_NOINLINE - __attribute__((noinline)) supported
172
- // V8_HAS_ATTRIBUTE_NORETURN - __attribute__((noreturn)) supported
173
176
  // V8_HAS_ATTRIBUTE_UNUSED - __attribute__((unused)) supported
174
177
  // V8_HAS_ATTRIBUTE_VISIBILITY - __attribute__((visibility)) supported
175
178
  // V8_HAS_ATTRIBUTE_WARN_UNUSED_RESULT - __attribute__((warn_unused_result))
@@ -209,7 +212,6 @@
209
212
  # define V8_HAS_ATTRIBUTE_ALWAYS_INLINE (__has_attribute(always_inline))
210
213
  # define V8_HAS_ATTRIBUTE_DEPRECATED (__has_attribute(deprecated))
211
214
  # define V8_HAS_ATTRIBUTE_NOINLINE (__has_attribute(noinline))
212
- # define V8_HAS_ATTRIBUTE_NORETURN (__has_attribute(noreturn))
213
215
  # define V8_HAS_ATTRIBUTE_UNUSED (__has_attribute(unused))
214
216
  # define V8_HAS_ATTRIBUTE_VISIBILITY (__has_attribute(visibility))
215
217
  # define V8_HAS_ATTRIBUTE_WARN_UNUSED_RESULT \
@@ -250,7 +252,6 @@
250
252
  # define V8_HAS_ATTRIBUTE_DEPRECATED (V8_GNUC_PREREQ(3, 4, 0))
251
253
  # define V8_HAS_ATTRIBUTE_DEPRECATED_MESSAGE (V8_GNUC_PREREQ(4, 5, 0))
252
254
  # define V8_HAS_ATTRIBUTE_NOINLINE (V8_GNUC_PREREQ(3, 4, 0))
253
- # define V8_HAS_ATTRIBUTE_NORETURN (V8_GNUC_PREREQ(2, 5, 0))
254
255
  # define V8_HAS_ATTRIBUTE_UNUSED (V8_GNUC_PREREQ(2, 95, 0))
255
256
  # define V8_HAS_ATTRIBUTE_VISIBILITY (V8_GNUC_PREREQ(4, 3, 0))
256
257
  # define V8_HAS_ATTRIBUTE_WARN_UNUSED_RESULT \
@@ -311,18 +312,6 @@
311
312
  #endif
312
313
 
313
314
 
314
- // A macro used to tell the compiler that a particular function never returns.
315
- // Use like:
316
- // V8_NORETURN void MyAbort() { abort(); }
317
- #if V8_HAS_ATTRIBUTE_NORETURN
318
- # define V8_NORETURN __attribute__((noreturn))
319
- #elif V8_HAS_DECLSPEC_NORETURN
320
- # define V8_NORETURN __declspec(noreturn)
321
- #else
322
- # define V8_NORETURN /* NOT SUPPORTED */
323
- #endif
324
-
325
-
326
315
  // A macro (V8_DEPRECATED) to mark classes or functions as deprecated.
327
316
  #if defined(V8_DEPRECATION_WARNINGS) && V8_HAS_ATTRIBUTE_DEPRECATED_MESSAGE
328
317
  #define V8_DEPRECATED(message, declarator) \
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: libv8
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.0.286.54.3
4
+ version: 6.2.414.42.0beta1
5
5
  platform: universal-darwin-15
6
6
  authors:
7
7
  - Charles Lowell
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-10-25 00:00:00.000000000 Z
11
+ date: 2017-12-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -105,9 +105,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
105
105
  version: '0'
106
106
  required_rubygems_version: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - '>='
108
+ - - '>'
109
109
  - !ruby/object:Gem::Version
110
- version: '0'
110
+ version: 1.3.1
111
111
  requirements: []
112
112
  rubyforge_project: libv8
113
113
  rubygems_version: 2.0.14.1