@@ -278,6 +278,9 @@ static ScriptOrigin GetScriptOriginForScript(i::Isolate* isolate,
278278 i::Handle<i::Script> script) {
279279 i::Handle<i::Object> scriptName (script->GetNameOrSourceURL (), isolate);
280280 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);
281284 v8::Isolate* v8_isolate =
282285 reinterpret_cast <v8::Isolate*>(script->GetIsolate ());
283286 ScriptOriginOptions options (script->origin_options ());
@@ -290,7 +293,9 @@ static ScriptOrigin GetScriptOriginForScript(i::Isolate* isolate,
290293 Utils::ToLocal (source_map_url),
291294 v8::Boolean::New (v8_isolate, options.IsOpaque ()),
292295 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) */ );
294299 return origin;
295300}
296301
@@ -2082,13 +2087,70 @@ Local<Value> Script::Run() {
20822087 RETURN_TO_LOCAL_UNCHECKED (Run (context), Value);
20832088}
20842089
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+ }
20852107
20862108Local<UnboundScript> Script::GetUnboundScript () {
20872109 i::Handle<i::Object> obj = Utils::OpenHandle (this );
20882110 return ToApiHandle<UnboundScript>(
20892111 i::Handle<i::SharedFunctionInfo>(i::JSFunction::cast (*obj)->shared ()));
20902112}
20912113
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+ }
20922154
20932155Module::Status Module::GetStatus () const {
20942156 i::Handle<i::Module> self = Utils::OpenHandle (this );
@@ -2225,11 +2287,18 @@ MaybeLocal<UnboundScript> ScriptCompiler::CompileUnboundInternal(
22252287 TRACE_EVENT0 (TRACE_DISABLED_BY_DEFAULT (" v8.compile" ), " V8.CompileScript" );
22262288 i::Handle<i::Object> name_obj;
22272289 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();
22282293 int line_offset = 0 ;
22292294 int column_offset = 0 ;
22302295 if (!source->resource_name .IsEmpty ()) {
22312296 name_obj = Utils::OpenHandle (*(source->resource_name ));
22322297 }
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+ // }
22332302 if (!source->resource_line_offset .IsEmpty ()) {
22342303 line_offset = static_cast <int >(source->resource_line_offset ->Value ());
22352304 }
@@ -2243,7 +2312,7 @@ MaybeLocal<UnboundScript> ScriptCompiler::CompileUnboundInternal(
22432312 result = i::Compiler::GetSharedFunctionInfoForScript (
22442313 str, name_obj, line_offset, column_offset, source->resource_options ,
22452314 source_map_url, isolate->native_context (), NULL , &script_data, options,
2246- i::NOT_NATIVES_CODE);
2315+ i::NOT_NATIVES_CODE /* , host_defined_options */ );
22472316 has_pending_exception = result.is_null ();
22482317 if (has_pending_exception && script_data != NULL ) {
22492318 // This case won't happen during normal operation; we have compiled
@@ -2508,6 +2577,10 @@ MaybeLocal<Script> ScriptCompiler::Compile(Local<Context> context,
25082577 if (!origin.ResourceName ().IsEmpty ()) {
25092578 script->set_name (*Utils::OpenHandle (*(origin.ResourceName ())));
25102579 }
2580+ // if (!origin.HostDefinedOptions().IsEmpty()) {
2581+ // script->set_host_defined_options(
2582+ // *Utils::OpenHandle(*(origin.HostDefinedOptions())));
2583+ // }
25112584 if (!origin.ResourceLineOffset ().IsEmpty ()) {
25122585 script->set_line_offset (
25132586 static_cast <int >(origin.ResourceLineOffset ()->Value ()));
@@ -9871,7 +9944,9 @@ MaybeLocal<UnboundScript> debug::CompileInspectorScript(Isolate* v8_isolate,
98719944 i::Handle<i::Object>(), isolate->native_context (), NULL , &script_data,
98729945 ScriptCompiler::kNoCompileOptions ,
98739946 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>() */ );
98759950 has_pending_exception = result.is_null ();
98769951 RETURN_ON_FAILED_EXECUTION (UnboundScript);
98779952 }
0 commit comments