Re: [v8-users] BigInt from String?

2018-09-15 Thread Jakob Kummerow
To create arbitrary BigInts via the C++ API, use BigInt::NewFromWords.

An alternative, as you suggest, is to parse the string as source, because
"BigInt strings with 'n' suffixes" are BigInt literals. Instead of "eval",
the API functions to do that are Script::Compile and Script::Run. Look at
samples/shell.cc or test/cctest/* for examples.

Another alternative, depending on your requirements, might be to create
this custom "parser" (more of a wrapper, really) in JavaScript:

function MyBigInt(str) {
  console.assert(str.endsWith("n"));
  return BigInt(str.substring(0, str.length - 1));
}


On Sat, Sep 15, 2018 at 8:44 PM J Decker  wrote:

>
>
> On Sat, Sep 15, 2018 at 8:41 PM J Decker  wrote:
>
>> I was implementing a parser that includes BigInt strings with 'n'
>> suffixes...
>> I tried to create a BigInt::New( isolate, ...  and then found the only
>> constructor takes an int64; which isn't a very big int.
>>
>> howto bigint from string?
>>
>
> maybe someone could share a snippet to call eval()?  Also Date::New()
> doesn't take a string :(
>
>
>> --
>> --
>> v8-users mailing list
>> v8-users@googlegroups.com
>> http://groups.google.com/group/v8-users
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "v8-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to v8-users+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>>
> --
> --
> v8-users mailing list
> v8-users@googlegroups.com
> http://groups.google.com/group/v8-users
> ---
> You received this message because you are subscribed to the Google Groups
> "v8-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to v8-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

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


Re: [v8-users] BigInt from String?

2018-09-15 Thread J Decker
On Sat, Sep 15, 2018 at 8:41 PM J Decker  wrote:

> I was implementing a parser that includes BigInt strings with 'n'
> suffixes...
> I tried to create a BigInt::New( isolate, ...  and then found the only
> constructor takes an int64; which isn't a very big int.
>
> howto bigint from string?
>

maybe someone could share a snippet to call eval()?  Also Date::New()
doesn't take a string :(


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

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


[v8-users] BigInt from String?

2018-09-15 Thread J Decker
I was implementing a parser that includes BigInt strings with 'n' 
suffixes...
I tried to create a BigInt::New( isolate, ...  and then found the only 
constructor takes an int64; which isn't a very big int.

howto bigint from string?

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


Re: [v8-users] How do compile the code coverage for V8?

2018-09-15 Thread hikai . bep
So I solved it but environment is Ubuntu 18.04 with gcc-7.3.0.
However, always occurred warnings.

My CLI is here:
gn args test/ --args='target_cpu="x64" v8_target_cpu="arm64" is_debug=true 
v8_code_coverage=true is_clang=false v8_optimized_debug=false 
treat_warnings_as_errors=false'

And warnings is here:
ninja: Entering directory `test/'
[945/1646] CXX obj/test/cctest/cctest_sources/test-assembler-arm64.o
../../test/cctest/test-assembler-arm64.cc: In function ‘void 
v8::internal::Testcall_no_relocation()’:
../../test/cctest/test-assembler-arm64.cc:15068:11: warning: variable 
‘call_start’ set but not used [-Wunused-but-set-variable]
   Address call_start;
   ^~
../../test/cctest/test-assembler-arm64.cc:15069:11: warning: variable 
‘return_address’ set but not used [-Wunused-but-set-variable]
   Address return_address;
   ^~

2018년 9월 5일 수요일 오후 11시 51분 17초 UTC+9, hika...@gmail.com 님의 말:
>
> I first tried to build using Ubuntu 16.04 latest gcc version. (I don't 
> remember the details, but I probably remember the version 6.0)
> However, when tested in the latest gcc based on the same args, the 
> following linker error occurred:
>
> python "../../build/toolchain/gcc_solink_wrapper.py" --readelf="readelf" 
> --nm="nm" --sofile="./libv8_libbase.so" --tocfile="./libv8_libbase.so.TOC" 
> --output="./libv8_libbase.so" -- g++ -shared -Wl,--fatal-warnings -fPIC 
> -Wl,-z,noexecstack -Wl,-z,now -Wl,-z,relro -Wl,-z,defs -Wl,--as-needed 
> -fuse-ld=gold -B../../third_party/binutils/Linux_x64/Release/bin 
> -Wl,--threads -Wl,--thread-count=4 -Wl,--icf=all -m64 -Werror 
> -Wl,--gdb-index -rdynamic -nodefaultlibs 
> --sysroot=../../build/linux/debian_sid_amd64-sysroot 
> -L../../build/linux/debian_sid_amd64-sysroot/usr/local/lib/x86_64-linux-gnu 
> -Wl,-rpath-link=../../build/linux/debian_sid_amd64-sysroot/usr/local/lib/x86_64-linux-gnu
>  
> -L../../build/linux/debian_sid_amd64-sysroot/lib/x86_64-linux-gnu 
> -Wl,-rpath-link=../../build/linux/debian_sid_amd64-sysroot/lib/x86_64-linux-gnu
>  
> -L../../build/linux/debian_sid_amd64-sysroot/usr/lib/x86_64-linux-gnu 
> -Wl,-rpath-link=../../build/linux/debian_sid_amd64-sysroot/usr/lib/x86_64-linux-gnu
>  
> -rdynamic -fprofile-arcs -lgcov --coverage -o "./libv8_libbase.so" 
> -Wl,-soname="libv8_libbase.so" @"./libv8_libbase.so.rsp" 
> /usr/lib/gcc/x86_64-linux-gnu/5/libgcov.a(_gcov.o):function __gcov_init: 
> error: undefined reference to 'atexit' collect2: error: ld returned 1 exit 
> status
>
> So I tried insert -lgcov flag, -nostdlib flag in LDFLAGS.
> But same error occurred.. XP
>
> Thank you for your reply.
>
> 2018년 9월 5일 수요일 오후 3시 41분 42초 UTC+9, Clemens Hammacher 님의 말:
>
> It seems like this warning ("class-memaccess") was introduces in gcc 8.0, 
> which we do not test currently. Can you try compiling with an older gcc 
> version?
>
> On Tue, Sep 4, 2018 at 4:14 AM  wrote:
>
> Hello
> I create gn files with args.
>
> gn args test/ --args='target_cpu="x64" v8_target_cpu="arm64" is_debug=true 
> v8_code_coverage=true is_clang=false v8_optimized_debug=false'
>
> And I tried compile with gcc 8.1.0 in Ubuntu 16.04 but occured errors.
>
> ---
> hikai@ubuntu:~/wrap_v8/v8/out.gn$ ninja -C ./test/
> ninja: Entering directory `./test/'
> [299/1646] CXX obj/lib_wasm_fuzzer_common/wasm-fuzzer-common.o
> FAILED: obj/lib_wasm_fuzzer_common/wasm-fuzzer-common.o
> g++ -MMD -MF obj/lib_wasm_fuzzer_common/wasm-fuzzer-common.o.d 
> -DV8_DEPRECATION_WARNINGS -DUSE_UDEV -DUSE_AURA=1 -DUSE_GLIB=1 
> -DUSE_NSS_CERTS=1 -DUSE_X11=1 -DFULL_SAFE_BROWSING -DSAFE_BROWSING_CSD 
> -DSAFE_BROWSING_DB_LOCAL -DCHROMIUM_BUILD -DFIELDTRIAL_TESTING_ENABLED 
> -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE 
> -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -DCOMPONENT_BUILD 
> -DCR_LIBCXX_REVISION=332543 -DCR_LIBCXXABI_REVISION=331450 
> -DCR_SYSROOT_HASH=815a8c22f8657fe57d02e2c2d893bcdc25a243cf -D_DEBUG 
> -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DWTF_USE_DYNAMIC_ANNOTATIONS=1 
> -D_GLIBCXX_DEBUG=1 -DUSING_V8_SHARED -DV8_ENABLE_CHECKS 
> -DV8_DEPRECATION_WARNINGS -DV8_IMMINENT_DEPRECATION_WARNINGS 
> -DENABLE_DISASSEMBLER -DV8_TYPED_ARRAY_MAX_SIZE_IN_HEAP=64 
> -DENABLE_MINOR_MC -DOBJECT_PRINT -DVERIFY_HEAP -DV8_TRACE_MAPS 
> -DV8_ENABLE_ALLOCATION_TIMEOUT -DV8_ENABLE_FORCE_SLOW_PATH 
> -DV8_ENABLE_CHECKS -DV8_DEPRECATION_WARNINGS 
> -DV8_IMMINENT_DEPRECATION_WARNINGS -DV8_INTL_SUPPORT 
> -DENABLE_HANDLE_ZAPPING -DV8_USE_SNAPSHOT -DV8_USE_EXTERNAL_STARTUP_DATA 
> -DV8_CONCURRENT_MARKING -DV8_CHECK_MICROTASKS_SCOPES_CONSISTENCY 
> -DV8_EMBEDDED_BUILTINS -DV8_TARGET_ARCH_ARM64 -DDEBUG 
> -DU_USING_ICU_NAMESPACE=0 -DU_ENABLE_DYLOAD=0 
> -DICU_UTIL_DATA_IMPL=ICU_UTIL_DATA_FILE -DUCHAR_TYPE=uint16_t -I../.. -Igen 
> -I../../include -Igen/include -I../.. -Igen 
> -I../../third_party/icu/source/common -I../../third_party/icu/source/i18n 
> -fno-strict-aliasing --param=ssp-buffer-size=4 -fstack-protector 
> -Wno-builtin-macro-redefined -D__DATE__= -D__TIME__= 

Re: [v8-users] Arraybuffer

2018-09-15 Thread dan Med
That’s all.

On Fri, 14 Sep 2018 at 21:53, dan Med  wrote:

> I don’t understand how that code could be helpful to me..
>
> On Fri, 14 Sep 2018 at 21:51, dan Med  wrote:
>
>> Technica question, when Arraybufferbuilder:append will be called ?
>>
>> On Fri, 14 Sep 2018 at 01:14, Peter Schow  wrote:
>>
>>> On Thu, Sep 13, 2018 at 10:45 AM dan Med 
>>> wrote:
>>> > That isn’t my question
>>> > Arraybufferbuilder:append how could I get that to be called.
>>> > What I really need is a little guidance on how to understand how v8
>>> will parse my JavaScript script and how it will allocate the data.
>>> > Maybe even how a buffer or if there’s something that describes how
>>> buffers are handeled or if there’s a file or code that tells me that not
>>> the memory I know... just how it will execute it that’s all
>>>
>>> Starting with the sample REPL code at:
>>>  https://github.com/v8/v8/blob/master/samples/shell.cc
>>>
>>> could answer your questions.  In the days that you've been pursuing
>>> this, you could have traced all this by now.  Good luck.
>>>
>>> --
>>> --
>>> v8-users mailing list
>>> v8-users@googlegroups.com
>>> http://groups.google.com/group/v8-users
>>> ---
>>> You received this message because you are subscribed to the Google
>>> Groups "v8-users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to v8-users+unsubscr...@googlegroups.com.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>

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