[v8-users] Re: Could you provide actual up-to-date example of "Accessing Dynamic Variables", please?

2017-04-24 Thread AleK Shmakov
Thx Zac, my best bugged code is:
void GetPointX(Local property,
   const PropertyCallbackInfo& info) {
Local self = info.Holder();
Local wrap = Local::Cast(self->GetInternalField(0));
void* ptr = wrap->Value();
int value = static_cast(ptr)->x_;
info.GetReturnValue().Set(value);
}

void SetPointX(Local property, Local value,
   const PropertyCallbackInfo& info) {
Local self = info.Holder();
Local wrap = Local::Cast(self->GetInternalField(0));
void* ptr = wrap->Value();
static_cast(ptr)->x_ = value->Int32Value();
}

void v8_Point(const v8::FunctionCallbackInfo& args) {
printf("Is constructor call: %s\n", args.IsConstructCall()?"yes":"no");
Point * p = new Point(12);
printf("Internal field count: %d\n",args.This()->InternalFieldCount());
args.This()->SetInternalField(0, External::New(args.GetIsolate(), p));
args.GetReturnValue().Set(args.This());
}

ManagerV8::ManagerV8() {
const char * temp_cc1 = "";
V8::InitializeICUDefaultLocation(temp_cc1);
V8::InitializeExternalStartupData(temp_cc1);
platform = platform::CreateDefaultPlatform();
V8::InitializePlatform(platform);
V8::Initialize();
};

ManagerV8::~ManagerV8() {
V8::Dispose();
V8::ShutdownPlatform();
delete platform;
}

std::string ManagerV8::v8_execute(const char* scriptSource, Point* 
shareVar) {
Isolate::CreateParams create_params;
create_params.array_buffer_allocator = 
v8::ArrayBuffer::Allocator::NewDefaultAllocator();
std::string temp_variable_result;

Isolate* isolate = Isolate::New(create_params);
{
Isolate::Scope isolate_scope(isolate);
HandleScope handle_scope(isolate);
Local global_templ = ObjectTemplate::New(isolate);
Local point_constructor = 
FunctionTemplate::New(isolate, v8_Point);
point_constructor->InstanceTemplate()->SetInternalFieldCount(1);

point_constructor->InstanceTemplate()->SetAccessor(String::NewFromUtf8(isolate, 
"x"), GetPointX, SetPointX);

Local context = Context::New(isolate, NULL, global_templ);
Context::Scope context_scope(context);

Local source = String::NewFromUtf8(isolate, scriptSource, 
NewStringType::kNormal).ToLocalChecked();
Local

Re: [v8-users] Why does a combination of optimization flags(--always-opt --turbo) and code caching show bad performance?

2017-04-24 Thread Jin Chul Kim
Thanks Jakob and Jochen!

Could you please answer the further questions?

1. Regarding code caching, does it keep native code or IR which will be 
translated into native code after loading?
2. May I know the limitations in code caching?

2017년 4월 21일 금요일 오후 11시 3분 2초 UTC+9, Jakob Kummerow 님의 말:
>
> As Jochen already said on chromium-dev, --always-opt does not make things 
> faster. This is expected. The purpose of the flag is to flush out certain 
> kinds of bugs when running tests, at the cost of a big slowdown.
>
> Code caching has limits. It cannot cache everything.
>
> The default configuration is what we believe gives the best performance in 
> general cases. There are no "secret" flags to make things faster.
>
> On Fri, Apr 21, 2017 at 9:27 AM, Jin Chul Kim  > wrote:
>
>> Hello,
>>
>> I am trying to reduce a execution time on general cases. My approach is a 
>> combination of two features: fully optimized code generation + code caching.
>> In my experiment, I figured out that code caching is very powerful. By 
>> the way, the execution time was significantly increased when I was using 
>> the following flags: --always-opt. I know turboFan was enabled on the 
>> recent V8 code. Here are my question.
>>
>> 1. As far as I know, code caching does not need code compilation to 
>> generate machine(native) code. Is that correct?
>>
>> I checked trace with --trace-opt. There were many lines for optimizing 
>> and compilation on code caching. why did them happen?
>>
>> [compiling method 0xed4b9e340c1 > (sfi = 0xed4b9e31ea1)> using TurboFan]
>> [optimizing 0xed4b9e340c1 > 0xed4b9e31ea1)> - took 0.081, 0.356, 0.039 ms]
>> [compiling method 0x3d3958a8f609 > 0xed4b9e41829)> using TurboFan]
>> [optimizing 0x3d3958a8f609 > 0xed4b9e41829)> - took 0.109, 0.560, 0.060 ms]
>> [compiling method 0x3d3958a93a81 > 0xed4b9e3d401)> using TurboFan]
>> [optimizing 0x3d3958a93a81 > 0xed4b9e3d401)> - took 0.028, 0.086, 0.011 ms]
>> ...
>>
>> 2. Do you explain why execution time is significantly increased on w/ 
>> opt. + w/ caching (examples 4) and 5) below)?
>>
>> If I was using the flag(--always-opt), the compiler may generates 
>> optimized or unoptimized code. Then, I think the second run should be same 
>> or better performance than the first run because it does not require 
>> compilation and just loads binary. Please see my experiment result as below:
>>
>> - baseline: w/o opt. + w/o caching
>> 1) 24.06 secs
>>
>> - w/o opt. + w/ caching
>> 2) 1st run(save native code): 24.35 secs
>> 3) 2nd run(load native code): 16.94 secs
>>
>> - w/ opt. + w/ caching
>> 4) 1st run(save native code): 75.12 secs
>> 5) 2nd run(load native code): 74.02 secs
>>
>> 3. How may I generate an optimal code to decrease an execution time on 
>> code caching?
>>
>> Many thanks,
>> Jinchul
>>
>> -- 
>> -- 
>> v8-users mailing list
>> v8-u...@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+u...@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] Re: Could you provide actual up-to-date example of "Accessing Dynamic Variables", please?

2017-04-24 Thread Zac Hansen
it looks at least pretty close.   can you post some code and say what 
specific problems you're having?   

On Thursday, April 20, 2017 at 12:57:18 AM UTC-7, AleK Shmakov wrote:
>
> "Embedder's Guide"  
> unfotunatelly is not valid. 
>

-- 
-- 
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] Re: Building V8 on windows

2017-04-24 Thread Rong Jie
You should set DEPOT_TOOLS_WIN_TOOLCHAIN=0 before running gn and ninja so 
that goma is not used (only available for Googler)

-- 
-- 
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] Building V8 on windows

2017-04-24 Thread Karthikeyan Subramanian
I downloaded depot_tools, extracted it. Followed instructions from 
https://www.chromium.org/developers/how-tos/install-depot-tools

Fetched v8

Then based on instructions at 
https://github.com/v8/v8/wiki/Building%20with%20GN

/tools/dev/v8gen.py -b "V8 Win64" -m client.v8 mav8

Then

ninja -C out.gn/mav8

Getting the following error

ninja: Entering directory `out.gn\mav8'
[1/999] CXX obj/v8_libbase/cpu.obj
FAILED: obj/v8_libbase/cpu.obj
ninja -t msvc -e environment.x64 -- C:\goma\goma-win64/gomacc.exe 
"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\amd64/cl.exe" 
/nologo /showInclude
s /FC @obj/v8_libbase/cpu.obj.rsp /c ../../src/base/cpu.cc 
/Foobj/v8_libbase/cpu.obj /Fd"obj/v8_libbase_cc.pdb"
*ninja: fatal: CreateProcess: The system cannot find the file specified.*

[3/999] CXX obj/v8_libbase/bits.obj
FAILED: obj/v8_libbase/bits.obj
ninja -t msvc -e environment.x64 -- C:\goma\goma-win64/gomacc.exe 
"C:\Program Fi
les (x86)\Microsoft Visual Studio 14.0\VC\BIN\amd64/cl.exe" /nologo 
/showInclude
s /FC @obj/v8_libbase/bits.obj.rsp /c ../../src/base/bits.cc 
/Foobj/v8_libbase/b
its.obj /Fd"obj/v8_libbase_cc.pdb"
ninja: fatal: CreateProcess: The system cannot find the file specified.

[5/999] CXX obj/v8_libbase/stack_trace.obj
FAILED: obj/v8_libbase/stack_trace.obj
ninja -t msvc -e environment.x64 -- C:\goma\goma-win64/gomacc.exe 
"C:\Program Fi
les (x86)\Microsoft Visual Studio 14.0\VC\BIN\amd64/cl.exe" /nologo 
/showInclude
s /FC @obj/v8_libbase/stack_trace.obj.rsp /c 
../../src/base/debug/stack_trace.cc
 /Foobj/v8_libbase/stack_trace.obj /Fd"obj/v8_libbase_cc.pdb"
ninja: fatal: CreateProcess: The system cannot find the file specified.

[6/999] CXX obj/v8_libbase/division-by-constant.obj
FAILED: obj/v8_libbase/division-by-constant.obj
ninja -t msvc -e environment.x64 -- C:\goma\goma-win64/gomacc.exe 
"C:\Program Fi
les (x86)\Microsoft Visual Studio 14.0\VC\BIN\amd64/cl.exe" /nologo 
/showInclude
s /FC @obj/v8_libbase/division-by-constant.obj.rsp /c 
../../src/base/division-by
-constant.cc /Foobj/v8_libbase/division-by-constant.obj 
/Fd"obj/v8_libbase_cc.pd
b"
ninja: fatal: CreateProcess: The system cannot find the file specified.

[10/999] STAMP obj/src/inspector/protocol_compatibility.stamp
ninja: build stopped: subcommand failed.

-- 
-- 
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.