I agree that we could handle this case more gracefully, but then again,
d8's purpose is testing V8, not for production usage.

The content of the natives file cannot be generated by d8. You are
confusing it with the startup snapshot.

Yang

On Tue, Jan 5, 2016, 22:55 Zac Hansen <[email protected]> wrote:

> It just seems odd that there's no way to detect them being missing and
> throw an exception that actually gives some information about the problem
> or even regenerate the contents of the file at the cost of startup speed.
>
> --Zac
>
> On Tue, Jan 5, 2016 at 4:40 AM, 'Daniel Vogelheim' via v8-dev <
> [email protected]> wrote:
>
>> Hi,
>>
>> V8 really, really needs its 'natives', so crashing if it doesn't have
>> them is the expected result. The 'natives' are the built-in JS libraries
>> and V8 cannot execute without them. Note that the 'Get started' guide
>> explicitly tells you to copy the natives file. (Step 4 in 'Run the
>> Example').
>>
>> What used to be different is that by default the 'natives' were linked
>> into the library, so there was no separate file to take care. You can
>> return to this state by compiling with v8_use_external_startup_data=0.
>>
>> If you build with the default settings - 'natives' in an external file -
>> then the embedder is expected to hand the natives to V8, via
>> v8::V8::SetNativesDataBlob. The 'hello world' example does this in the
>> simplest possible way, by telling V8 to load them from the path of the
>> executable (line "V8::InitializeExternalStartupData(argv[0]);"). Presumably
>> a more sophisticated embedder would use a more sophisticated mechanism.
>>
>> Daniel
>>
>> On Tue, Jan 5, 2016 at 9:19 AM, <[email protected]> wrote:
>>
>>> I saw a thread from earlier this year, but I wanted to say it's still
>>> happening:
>>>
>>> https://groups.google.com/forum/#!topic/v8-dev/LxKgBbEHLCE
>>>
>>> If I run the sample code from here
>>>
>>> https://developers.google.com/v8/get_started
>>>
>>> and don't copy natives_blob.bin to the current directory, I get the
>>> following crash when creating an isolate:
>>>
>>> * thread #1: tid = 0xb1c49, 0x0000000100724b6e
>>> h2`v8::internal::NativesCollection<(v8::internal::NativeType)0>::GetScriptSource(int)
>>> [inlined] v8::internal::List<v8::internal::Vector<char const>,
>>> v8::internal::FreeStoreAllocationPolicy>::operator[](i=3) const + 3 at
>>> list.h:69, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS
>>> (code=1, address=0x20)
>>>
>>>   * frame #0: 0x0000000100724b6e
>>> h2`v8::internal::NativesCollection<(v8::internal::NativeType)0>::GetScriptSource(int)
>>> [inlined] v8::internal::List<v8::internal::Vector<char const>,
>>> v8::internal::FreeStoreAllocationPolicy>::operator[](i=3) const + 3 at
>>> list.h:69
>>>
>>>     frame #1: 0x0000000100724b6b
>>> h2`v8::internal::NativesCollection<(v8::internal::NativeType)0>::GetScriptSource(int)
>>> [inlined]
>>> v8::internal::NativesStore::GetScriptSource(this=0x0000000000000000,
>>> index=3) at natives-external.cc:41
>>>
>>>     frame #2: 0x0000000100724b6b
>>> h2`v8::internal::NativesCollection<(v8::internal::NativeType)0>::GetScriptSource(index=3)
>>> + 11 at natives-external.cc:213
>>>
>>>     frame #3: 0x00000001004d3bc2
>>> h2`v8::internal::Deserializer::ReadData(this=0x00007fff5fbff7a8,
>>> current=<unavailable>, limit=0x000034e592019710, source_space=1,
>>> current_object_address="\x89R") + 4802 at serialize.cc:1157
>>>
>>>     frame #4: 0x00000001004d4b97
>>> h2`v8::internal::Deserializer::ReadObject(this=0x00007fff5fbff7a8,
>>> space_number=1, write_back=0x000034e592019610) + 423 at serialize.cc:825
>>>
>>>     frame #5: 0x00000001004d2bf0
>>> h2`v8::internal::Deserializer::ReadData(this=0x00007fff5fbff7a8,
>>> current=<unavailable>, limit=0x000034e5920196e8, source_space=1,
>>> current_object_address="\tB") + 752 at serialize.cc:1028
>>>
>>>     frame #6: 0x00000001004d4b97
>>> h2`v8::internal::Deserializer::ReadObject(this=0x00007fff5fbff7a8,
>>> space_number=1, write_back=0x0000000102801420) + 423 at serialize.cc:825
>>>
>>>     frame #7: 0x00000001004d2bf0
>>> h2`v8::internal::Deserializer::ReadData(this=0x00007fff5fbff7a8,
>>> current=<unavailable>, limit=0x0000000102801ae8, source_space=0,
>>> current_object_address=0x0000000000000000) + 752 at serialize.cc:1028
>>>
>>>     frame #8: 0x00000001002c2219
>>> h2`v8::internal::Heap::IterateStrongRoots(this=0x0000000102801020,
>>> v=0x00007fff5fbff7a8, mode=VISIT_ONLY_STRONG) + 41 at heap.cc:4569
>>>
>>>     frame #9: 0x00000001004d204d
>>> h2`v8::internal::Deserializer::Deserialize(this=0x00007fff5fbff7a8,
>>> isolate=<unavailable>) + 253 at serialize.cc:532
>>>
>>>     frame #10: 0x000000010034cf66
>>> h2`v8::internal::Isolate::Init(this=0x0000000102801000,
>>> des=0x00007fff5fbff7a8) + 4390 at isolate.cc:2201
>>>
>>>     frame #11: 0x00000001004dd0e5
>>> h2`v8::internal::Snapshot::Initialize(isolate=0x0000000102801000) + 549 at
>>> snapshot-common.cc:58
>>>
>>>     frame #12: 0x0000000100029a24
>>> h2`v8::Isolate::New(params=<unavailable>) + 308 at api.cc:7139
>>>
>>>     frame #13: 0x000000010000172d h2`main + 157
>>>
>>>     frame #14: 0x00007fff95ffd5ad libdyld.dylib`start + 1
>>>
>>>     frame #15: 0x00007fff95ffd5ad libdyld.dylib`start + 1
>>>
>>>
>>> Copy in the one file and everything works fine.
>>>
>>>
>>> This is on a completely bog standard build of 4.9.0.0 on os x 10.11.1.
>>>
>>> --
>>> --
>>> v8-dev mailing list
>>> [email protected]
>>> http://groups.google.com/group/v8-dev
>>> ---
>>> You received this message because you are subscribed to the Google
>>> Groups "v8-dev" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to [email protected].
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>> --
>> --
>> v8-dev mailing list
>> [email protected]
>> http://groups.google.com/group/v8-dev
>> ---
>>
> You received this message because you are subscribed to a topic in the
>> Google Groups "v8-dev" group.
>> To unsubscribe from this topic, visit
>> https://groups.google.com/d/topic/v8-dev/gaLpAEur4l8/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to
>> [email protected].
>>
>
>> For more options, visit https://groups.google.com/d/optout.
>>
> --
> --
> v8-dev mailing list
> [email protected]
> http://groups.google.com/group/v8-dev
> ---
> You received this message because you are subscribed to the Google Groups
> "v8-dev" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>

-- 
-- 
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- 
You received this message because you are subscribed to the Google Groups 
"v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to