Bug 39583

Summary: Move creation of 'this' object from caller to callee in construction.
Product: WebKit Reporter: Gavin Barraclough <barraclough>
Component: JavaScriptCoreAssignee: Gavin Barraclough <barraclough>
Status: RESOLVED FIXED    
Severity: Normal CC: webkit.review.bot
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: PC   
OS: OS X 10.5   
Attachments:
Description Flags
The patch sam: review+

Description Gavin Barraclough 2010-05-24 01:03:30 PDT
Presently the caller of a constructor is responsible for providing a this
object.  Instead, move the object creation into a new op_create_this opcode,
planted in the head of the contructor bytecode for a function.  Since the
prototype for the object is provided by performing a get_by_id on the callee,
also add a new get_callee opcode (this is used to get the callee JSFunction
into a register so that a normal get_by_id can be used).

Currently the caller is also responsible for detecting when op_construct is
performed on a JSFunction representing a host function, in which case an
exception is thrown – and this check currently takes place when constructing
the this object.  Instead, mirroring the recent changes for non-host functions,
add a parallel code-path for native constructors to follow, with a thunk for
invoking native constructors provided by JITStubs, and a constructor-specific
NativeFunction on NativeExecutable.  Provide an implementation of a host
constructor which will throw an exception.
Comment 1 Gavin Barraclough 2010-05-24 01:05:32 PDT
Created attachment 56858 [details]
The patch

No performance impact
Comment 2 WebKit Review Bot 2010-05-24 01:08:13 PDT
Attachment 56858 [details] did not pass style-queue:

Failed to run "['WebKitTools/Scripts/check-webkit-style', '--no-squash']" exit_code: 1
JavaScriptCore/jit/JITOpcodes.cpp:221:  string_failureCases1Call is incorrectly named. Don't use underscores in your identifier names.  [readability/naming] [4]
JavaScriptCore/jit/JITOpcodes.cpp:222:  string_failureCases2Call is incorrectly named. Don't use underscores in your identifier names.  [readability/naming] [4]
JavaScriptCore/jit/JITOpcodes.cpp:223:  string_failureCases3Call is incorrectly named. Don't use underscores in your identifier names.  [readability/naming] [4]
JavaScriptCore/jit/JITOpcodes32_64.cpp:221:  string_failureCases1Call is incorrectly named. Don't use underscores in your identifier names.  [readability/naming] [4]
JavaScriptCore/jit/JITOpcodes32_64.cpp:222:  string_failureCases2Call is incorrectly named. Don't use underscores in your identifier names.  [readability/naming] [4]
JavaScriptCore/jit/JITOpcodes32_64.cpp:223:  string_failureCases3Call is incorrectly named. Don't use underscores in your identifier names.  [readability/naming] [4]
Total errors found: 6 in 19 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 3 Gavin Barraclough 2010-05-24 11:47:09 PDT
Transmitting file data ...................
Committed revision 60075.