Add newTarget accessor to JS constructor written in C++
authorutatane.tea@gmail.com <utatane.tea@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 22 Jul 2015 00:29:39 +0000 (00:29 +0000)
committerutatane.tea@gmail.com <utatane.tea@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 22 Jul 2015 00:29:39 +0000 (00:29 +0000)
commitc79ae2671c2b9645028b50ec22b033353c49afbf
tree2ecc1ec5de9037b0aaed42795791917ec708a57c
parent3230b6cacb4c007c7fa860a323f2af93f26a010d
Add newTarget accessor to JS constructor written in C++
https://bugs.webkit.org/show_bug.cgi?id=147160

Reviewed by Geoffrey Garen.

This patch adds `ExecState#newTarget()` which returns `new.target` defined in ECMA262 6th.
It enables some C++ constructors (like Intl.XXX constructors) to leverage this to complete
its implementation.

When the constructor is called, |this| in the arguments is used for storing new.target instead.
So by adding the accessor for |this|, JS constructor written in C++ can access new.target.

And at the same time, this patch extends the existing `construct` to accept new.target value.
It is corresponding to the spec's Construct abstract operation.

* interpreter/CallFrame.h:
(JSC::ExecState::newTarget):
* interpreter/Interpreter.cpp:
(JSC::Interpreter::executeConstruct):
* interpreter/Interpreter.h:
* runtime/ConstructData.cpp:
(JSC::construct):
* runtime/ConstructData.h:
(JSC::construct):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@187142 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/interpreter/CallFrame.h
Source/JavaScriptCore/interpreter/Interpreter.cpp
Source/JavaScriptCore/interpreter/Interpreter.h
Source/JavaScriptCore/runtime/ConstructData.cpp
Source/JavaScriptCore/runtime/ConstructData.h