@@ -278,6 +278,9 @@ static ScriptOrigin GetScriptOriginForScript(i::Isolate* isolate,
278
278
i::Handle <i::Script> script) {
279
279
i::Handle <i::Object> scriptName (script->GetNameOrSourceURL (), isolate);
280
280
i::Handle <i::Object> source_map_url (script->source_mapping_url (), isolate);
281
+ // Backed out for ABI compatibility with V8 6.2
282
+ // i::Handle<i::FixedArray> host_defined_options(script->host_defined_options(),
283
+ // isolate);
281
284
v8::Isolate* v8_isolate =
282
285
reinterpret_cast <v8::Isolate*>(script->GetIsolate ());
283
286
ScriptOriginOptions options (script->origin_options ());
@@ -290,7 +293,9 @@ static ScriptOrigin GetScriptOriginForScript(i::Isolate* isolate,
290
293
Utils::ToLocal (source_map_url),
291
294
v8::Boolean::New (v8_isolate, options.IsOpaque ()),
292
295
v8::Boolean::New (v8_isolate, script->type () == i::Script::TYPE_WASM),
293
- v8::Boolean::New (v8_isolate, options.IsModule ()));
296
+ v8::Boolean::New (v8_isolate, options.IsModule ()) /* ,
297
+ // Backed out for ABI compatibility with V8 6.2
298
+ Utils::ToLocal(host_defined_options) */ );
294
299
return origin;
295
300
}
296
301
@@ -2082,13 +2087,70 @@ Local<Value> Script::Run() {
2082
2087
RETURN_TO_LOCAL_UNCHECKED (Run (context), Value);
2083
2088
}
2084
2089
2090
+ Local<Value> ScriptOrModule::GetResourceName () {
2091
+ i::Handle <i::Script> obj = Utils::OpenHandle (this );
2092
+ i::Isolate* isolate = obj->GetIsolate ();
2093
+ ENTER_V8_NO_SCRIPT_NO_EXCEPTION (isolate);
2094
+ i::Handle <i::Object> val (obj->name (), isolate);
2095
+ return ToApiHandle<Value>(val);
2096
+ }
2097
+
2098
+ Local<PrimitiveArray> ScriptOrModule::GetHostDefinedOptions () {
2099
+ i::Handle <i::Script> obj = Utils::OpenHandle (this );
2100
+ i::Isolate* isolate = obj->GetIsolate ();
2101
+ ENTER_V8_NO_SCRIPT_NO_EXCEPTION (isolate);
2102
+ // Backed out for ABI compatibility with V8 6.2
2103
+ // i::Handle<i::FixedArray> val(obj->host_defined_options(), isolate);
2104
+ // return ToApiHandle<PrimitiveArray>(val);
2105
+ return Local<PrimitiveArray>();
2106
+ }
2085
2107
2086
2108
Local<UnboundScript> Script::GetUnboundScript () {
2087
2109
i::Handle <i::Object> obj = Utils::OpenHandle (this );
2088
2110
return ToApiHandle<UnboundScript>(
2089
2111
i::Handle <i::SharedFunctionInfo>(i::JSFunction::cast (*obj)->shared ()));
2090
2112
}
2091
2113
2114
+ // static
2115
+ Local<PrimitiveArray> PrimitiveArray::New (Isolate* v8_isolate, int length) {
2116
+ i::Isolate* isolate = reinterpret_cast <i::Isolate*>(v8_isolate);
2117
+ ENTER_V8_NO_SCRIPT_NO_EXCEPTION (isolate);
2118
+ Utils::ApiCheck (length >= 0 , " v8::PrimitiveArray::New" ,
2119
+ " length must be equal or greater than zero" );
2120
+ i::Handle <i::FixedArray> array = isolate->factory ()->NewFixedArray (length);
2121
+ return ToApiHandle<PrimitiveArray>(array);
2122
+ }
2123
+
2124
+ int PrimitiveArray::Length () const {
2125
+ i::Handle <i::FixedArray> array = Utils::OpenHandle (this );
2126
+ i::Isolate* isolate = array->GetIsolate ();
2127
+ ENTER_V8_NO_SCRIPT_NO_EXCEPTION (isolate);
2128
+ return array->length ();
2129
+ }
2130
+
2131
+ void PrimitiveArray::Set (int index, Local<Primitive> item) {
2132
+ i::Handle <i::FixedArray> array = Utils::OpenHandle (this );
2133
+ i::Isolate* isolate = array->GetIsolate ();
2134
+ ENTER_V8_NO_SCRIPT_NO_EXCEPTION (isolate);
2135
+ Utils::ApiCheck (index >= 0 && index < array->length (),
2136
+ " v8::PrimitiveArray::Set" ,
2137
+ " index must be greater than or equal to 0 and less than the "
2138
+ " array length" );
2139
+ i::Handle <i::Object> i_item = Utils::OpenHandle (*item);
2140
+ array->set (index , *i_item);
2141
+ }
2142
+
2143
+ Local<Primitive> PrimitiveArray::Get (int index) {
2144
+ i::Handle <i::FixedArray> array = Utils::OpenHandle (this );
2145
+ i::Isolate* isolate = array->GetIsolate ();
2146
+ ENTER_V8_NO_SCRIPT_NO_EXCEPTION (isolate);
2147
+ Utils::ApiCheck (index >= 0 && index < array->length (),
2148
+ " v8::PrimitiveArray::Get" ,
2149
+ " index must be greater than or equal to 0 and less than the "
2150
+ " array length" );
2151
+ i::Handle <i::Object> i_item (array->get (index ), isolate);
2152
+ return ToApiHandle<Primitive>(i_item);
2153
+ }
2092
2154
2093
2155
Module::Status Module::GetStatus () const {
2094
2156
i::Handle <i::Module> self = Utils::OpenHandle (this );
@@ -2225,11 +2287,18 @@ MaybeLocal<UnboundScript> ScriptCompiler::CompileUnboundInternal(
2225
2287
TRACE_EVENT0 (TRACE_DISABLED_BY_DEFAULT (" v8.compile" ), " V8.CompileScript" );
2226
2288
i::Handle <i::Object> name_obj;
2227
2289
i::Handle <i::Object> source_map_url;
2290
+ // Backed out for ABI compatibility with V8 6.2
2291
+ // i::Handle<i::FixedArray> host_defined_options =
2292
+ // isolate->factory()->empty_fixed_array();
2228
2293
int line_offset = 0 ;
2229
2294
int column_offset = 0 ;
2230
2295
if (!source->resource_name .IsEmpty ()) {
2231
2296
name_obj = Utils::OpenHandle (*(source->resource_name ));
2232
2297
}
2298
+ // Backed out for ABI compatibility with V8 6.2
2299
+ // if (!source->host_defined_options.IsEmpty()) {
2300
+ // host_defined_options = Utils::OpenHandle(*(source->host_defined_options));
2301
+ // }
2233
2302
if (!source->resource_line_offset .IsEmpty ()) {
2234
2303
line_offset = static_cast <int >(source->resource_line_offset ->Value ());
2235
2304
}
@@ -2243,7 +2312,7 @@ MaybeLocal<UnboundScript> ScriptCompiler::CompileUnboundInternal(
2243
2312
result = i::Compiler::GetSharedFunctionInfoForScript (
2244
2313
str, name_obj, line_offset, column_offset, source->resource_options ,
2245
2314
source_map_url, isolate->native_context (), NULL , &script_data, options,
2246
- i::NOT_NATIVES_CODE);
2315
+ i::NOT_NATIVES_CODE /* , host_defined_options */ );
2247
2316
has_pending_exception = result.is_null ();
2248
2317
if (has_pending_exception && script_data != NULL ) {
2249
2318
// This case won't happen during normal operation; we have compiled
@@ -2508,6 +2577,10 @@ MaybeLocal<Script> ScriptCompiler::Compile(Local<Context> context,
2508
2577
if (!origin.ResourceName ().IsEmpty ()) {
2509
2578
script->set_name (*Utils::OpenHandle (*(origin.ResourceName ())));
2510
2579
}
2580
+ // if (!origin.HostDefinedOptions().IsEmpty()) {
2581
+ // script->set_host_defined_options(
2582
+ // *Utils::OpenHandle(*(origin.HostDefinedOptions())));
2583
+ // }
2511
2584
if (!origin.ResourceLineOffset ().IsEmpty ()) {
2512
2585
script->set_line_offset (
2513
2586
static_cast <int >(origin.ResourceLineOffset ()->Value ()));
@@ -9871,7 +9944,9 @@ MaybeLocal<UnboundScript> debug::CompileInspectorScript(Isolate* v8_isolate,
9871
9944
i::Handle <i::Object>(), isolate->native_context (), NULL , &script_data,
9872
9945
ScriptCompiler::kNoCompileOptions ,
9873
9946
i::FLAG_expose_inspector_scripts ? i::NOT_NATIVES_CODE
9874
- : i::INSPECTOR_CODE);
9947
+ : i::INSPECTOR_CODE /* ,
9948
+ // Backed out for ABI compatibility with V8 6.2
9949
+ i::Handle<i::FixedArray>() */ );
9875
9950
has_pending_exception = result.is_null ();
9876
9951
RETURN_ON_FAILED_EXECUTION (UnboundScript);
9877
9952
}
0 commit comments