Changeset 200416 in webkit
- Timestamp:
- May 4, 2016 8:48:16 AM (8 years ago)
- Location:
- trunk
- Files:
-
- 7 deleted
- 41 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r200415 r200416 1 2016-05-04 Chris Dumez <cdumez@apple.com> 2 3 Unreviewed, rolling out r200383 and r200406. 4 5 Seems to have caused crashes on iOS / ARMv7s 6 7 Reverted changesets: 8 9 "Speed up JSGlobalObject initialization by making some 10 properties lazy" 11 https://bugs.webkit.org/show_bug.cgi?id=157045 12 http://trac.webkit.org/changeset/200383 13 14 "REGRESSION(r200383): Setting lazily initialized properties 15 across frame boundaries crashes" 16 https://bugs.webkit.org/show_bug.cgi?id=157333 17 http://trac.webkit.org/changeset/200406 18 1 19 2016-05-04 Joanmarie Diggs <jdiggs@igalia.com> 2 20 -
trunk/Source/JavaScriptCore/API/JSCallbackFunction.cpp
r200383 r200416 1 1 /* 2 * Copyright (C) 2006, 2008 , 2016Apple Inc. All rights reserved.2 * Copyright (C) 2006, 2008 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 59 59 JSCallbackFunction* JSCallbackFunction::create(VM& vm, JSGlobalObject* globalObject, JSObjectCallAsFunctionCallback callback, const String& name) 60 60 { 61 Structure* structure = globalObject->callbackFunctionStructure(); 62 JSCallbackFunction* function = new (NotNull, allocateCell<JSCallbackFunction>(vm.heap)) JSCallbackFunction(vm, structure, callback); 61 JSCallbackFunction* function = new (NotNull, allocateCell<JSCallbackFunction>(vm.heap)) JSCallbackFunction(vm, globalObject->callbackFunctionStructure(), callback); 63 62 function->finishCreation(vm, name); 64 63 return function; -
trunk/Source/JavaScriptCore/API/ObjCCallbackFunction.h
r200383 r200416 1 1 /* 2 * Copyright (C) 2013 , 2016Apple Inc. All rights reserved.2 * Copyright (C) 2013 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 63 63 64 64 protected: 65 ObjCCallbackFunction(VM&, Structure*, JSObjectCallAsFunctionCallback, JSObjectCallAsConstructorCallback, std::unique_ptr<ObjCCallbackFunctionImpl>);65 ObjCCallbackFunction(VM&, JSGlobalObject*, JSObjectCallAsFunctionCallback, JSObjectCallAsConstructorCallback, std::unique_ptr<ObjCCallbackFunctionImpl>); 66 66 67 67 private: -
trunk/Source/JavaScriptCore/API/ObjCCallbackFunction.mm
r200383 r200416 1 1 /* 2 * Copyright (C) 2013 , 2016Apple Inc. All rights reserved.2 * Copyright (C) 2013 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 499 499 const JSC::ClassInfo ObjCCallbackFunction::s_info = { "CallbackFunction", &Base::s_info, 0, CREATE_METHOD_TABLE(ObjCCallbackFunction) }; 500 500 501 ObjCCallbackFunction::ObjCCallbackFunction(JSC::VM& vm, JSC:: Structure* structure, JSObjectCallAsFunctionCallback functionCallback, JSObjectCallAsConstructorCallback constructCallback, std::unique_ptr<ObjCCallbackFunctionImpl> impl)502 : Base(vm, structure)501 ObjCCallbackFunction::ObjCCallbackFunction(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSObjectCallAsFunctionCallback functionCallback, JSObjectCallAsConstructorCallback constructCallback, std::unique_ptr<ObjCCallbackFunctionImpl> impl) 502 : Base(vm, globalObject->objcCallbackFunctionStructure()) 503 503 , m_functionCallback(functionCallback) 504 504 , m_constructCallback(constructCallback) … … 509 509 ObjCCallbackFunction* ObjCCallbackFunction::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, const String& name, std::unique_ptr<ObjCCallbackFunctionImpl> impl) 510 510 { 511 Structure* structure = globalObject->objcCallbackFunctionStructure(); 512 ObjCCallbackFunction* function = new (NotNull, allocateCell<ObjCCallbackFunction>(vm.heap)) ObjCCallbackFunction(vm, structure, objCCallbackFunctionCallAsFunction, objCCallbackFunctionCallAsConstructor, WTFMove(impl)); 511 ObjCCallbackFunction* function = new (NotNull, allocateCell<ObjCCallbackFunction>(vm.heap)) ObjCCallbackFunction(vm, globalObject, objCCallbackFunctionCallAsFunction, objCCallbackFunctionCallAsConstructor, WTFMove(impl)); 513 512 function->finishCreation(vm, name); 514 513 return function; -
trunk/Source/JavaScriptCore/CMakeLists.txt
r200383 r200416 741 741 runtime/JSWithScope.cpp 742 742 runtime/JSWrapperObject.cpp 743 runtime/LazyClassStructure.cpp744 743 runtime/LiteralParser.cpp 745 744 runtime/Lookup.cpp -
trunk/Source/JavaScriptCore/ChangeLog
r200409 r200416 1 2016-05-04 Chris Dumez <cdumez@apple.com> 2 3 Unreviewed, rolling out r200383 and r200406. 4 5 Seems to have caused crashes on iOS / ARMv7s 6 7 Reverted changesets: 8 9 "Speed up JSGlobalObject initialization by making some 10 properties lazy" 11 https://bugs.webkit.org/show_bug.cgi?id=157045 12 http://trac.webkit.org/changeset/200383 13 14 "REGRESSION(r200383): Setting lazily initialized properties 15 across frame boundaries crashes" 16 https://bugs.webkit.org/show_bug.cgi?id=157333 17 http://trac.webkit.org/changeset/200406 18 1 19 2016-05-04 Yusuke Suzuki <utatane.tea@gmail.com> 2 20 -
trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
r200383 r200416 1996 1996 DC2143071CA32E55000A8869 /* ICStats.h in Headers */ = {isa = PBXBuildFile; fileRef = DC2143061CA32E52000A8869 /* ICStats.h */; }; 1997 1997 DC2143081CA32E58000A8869 /* ICStats.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DC2143051CA32E52000A8869 /* ICStats.cpp */; }; 1998 DCF3D5691CD2946D003D5C65 /* LazyClassStructure.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DCF3D5641CD29468003D5C65 /* LazyClassStructure.cpp */; };1999 DCF3D56A1CD29470003D5C65 /* LazyClassStructure.h in Headers */ = {isa = PBXBuildFile; fileRef = DCF3D5651CD29468003D5C65 /* LazyClassStructure.h */; settings = {ATTRIBUTES = (Private, ); }; };2000 DCF3D56B1CD29472003D5C65 /* LazyClassStructureInlines.h in Headers */ = {isa = PBXBuildFile; fileRef = DCF3D5661CD29468003D5C65 /* LazyClassStructureInlines.h */; };2001 DCF3D56C1CD29475003D5C65 /* LazyProperty.h in Headers */ = {isa = PBXBuildFile; fileRef = DCF3D5671CD29468003D5C65 /* LazyProperty.h */; settings = {ATTRIBUTES = (Private, ); }; };2002 DCF3D56D1CD29476003D5C65 /* LazyPropertyInlines.h in Headers */ = {isa = PBXBuildFile; fileRef = DCF3D5681CD29468003D5C65 /* LazyPropertyInlines.h */; };2003 1998 DE26E9031CB5DD0500D2BE82 /* BuiltinExecutableCreator.h in Headers */ = {isa = PBXBuildFile; fileRef = DE26E9021CB5DD0500D2BE82 /* BuiltinExecutableCreator.h */; }; 2004 1999 DE26E9071CB5DEFB00D2BE82 /* BuiltinExecutableCreator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DE26E9061CB5DD9600D2BE82 /* BuiltinExecutableCreator.cpp */; }; … … 4210 4205 DC2143051CA32E52000A8869 /* ICStats.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ICStats.cpp; sourceTree = "<group>"; }; 4211 4206 DC2143061CA32E52000A8869 /* ICStats.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ICStats.h; sourceTree = "<group>"; }; 4212 DCF3D5641CD29468003D5C65 /* LazyClassStructure.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LazyClassStructure.cpp; sourceTree = "<group>"; };4213 DCF3D5651CD29468003D5C65 /* LazyClassStructure.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LazyClassStructure.h; sourceTree = "<group>"; };4214 DCF3D5661CD29468003D5C65 /* LazyClassStructureInlines.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LazyClassStructureInlines.h; sourceTree = "<group>"; };4215 DCF3D5671CD29468003D5C65 /* LazyProperty.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LazyProperty.h; sourceTree = "<group>"; };4216 DCF3D5681CD29468003D5C65 /* LazyPropertyInlines.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LazyPropertyInlines.h; sourceTree = "<group>"; };4217 4207 DE26E9021CB5DD0500D2BE82 /* BuiltinExecutableCreator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BuiltinExecutableCreator.h; sourceTree = "<group>"; }; 4218 4208 DE26E9061CB5DD9600D2BE82 /* BuiltinExecutableCreator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = BuiltinExecutableCreator.cpp; sourceTree = "<group>"; }; … … 5507 5497 isa = PBXGroup; 5508 5498 children = ( 5509 DCF3D5641CD29468003D5C65 /* LazyClassStructure.cpp */,5510 DCF3D5651CD29468003D5C65 /* LazyClassStructure.h */,5511 DCF3D5661CD29468003D5C65 /* LazyClassStructureInlines.h */,5512 DCF3D5671CD29468003D5C65 /* LazyProperty.h */,5513 DCF3D5681CD29468003D5C65 /* LazyPropertyInlines.h */,5514 5499 BCF605110E203EF800B9A64D /* ArgList.cpp */, 5515 5500 BCF605120E203EF800B9A64D /* ArgList.h */, … … 7143 7128 0FFC99D1184EC8AD009C10AB /* ConstantMode.h in Headers */, 7144 7129 E354622B1B6065D100545386 /* ConstructAbility.h in Headers */, 7145 DCF3D56D1CD29476003D5C65 /* LazyPropertyInlines.h in Headers */,7146 7130 BC18C3F60E16F5CD00B34460 /* ConstructData.h in Headers */, 7147 7131 A57D23F21891B5B40031C7FA /* ContentSearchUtilities.h in Headers */, … … 7787 7771 BC18C4310E16F5CD00B34460 /* Lexer.h in Headers */, 7788 7772 BC18C52E0E16FCE100B34460 /* Lexer.lut.h in Headers */, 7789 DCF3D56B1CD29472003D5C65 /* LazyClassStructureInlines.h in Headers */,7790 7773 FE187A021BFBE5610038BBCA /* JITMulGenerator.h in Headers */, 7791 7774 86D3B3C310159D7F002865E7 /* LinkBuffer.h in Headers */, … … 7865 7848 86F3EEBF168CDE930077B92A /* ObjcRuntimeExtras.h in Headers */, 7866 7849 14CA958D16AB50FA00938A06 /* ObjectAllocationProfile.h in Headers */, 7867 DCF3D56C1CD29475003D5C65 /* LazyProperty.h in Headers */,7868 7850 BC18C4450E16F5CD00B34460 /* ObjectConstructor.h in Headers */, 7869 7851 996B73221BDA08EF00331B84 /* ObjectConstructor.lut.h in Headers */, … … 7881 7863 93052C350FB792190048FDC3 /* ParserArena.h in Headers */, 7882 7864 0FCCAE4516D0CF7400D0C65B /* ParserError.h in Headers */, 7883 DCF3D56A1CD29470003D5C65 /* LazyClassStructure.h in Headers */,7884 7865 A77F1825164192C700640A47 /* ParserModes.h in Headers */, 7885 7866 65303D641447B9E100D3F904 /* ParserTokens.h in Headers */, … … 8947 8928 FE1C0FFF1B194FD100B53FCA /* Exception.cpp in Sources */, 8948 8929 0F12DE0F1979D5FD0006FF4E /* ExceptionFuzz.cpp in Sources */, 8949 DCF3D5691CD2946D003D5C65 /* LazyClassStructure.cpp in Sources */,8950 8930 1429D8780ED21ACD00B89619 /* ExceptionHelpers.cpp in Sources */, 8951 8931 86CA032E1038E8440028A609 /* Executable.cpp in Sources */, -
trunk/Source/JavaScriptCore/create_hash_table
r200383 r200416 6 6 # David Faure <faure@kde.org> 7 7 # Modified (c) 2004 by Nikolas Zimmermann <wildfox@kde.org> 8 # Copyright (C) 2007, 2008, 2009, 2015 -2016Apple Inc. All rights reserved.8 # Copyright (C) 2007, 2008, 2009, 2015 Apple Inc. All rights reserved. 9 9 # 10 10 # This library is free software; you can redistribute it and/or … … 98 98 $hasSetter = "true"; 99 99 push(@values, { "type" => "Accessor", "get" => $get, "put" => $put }); 100 } elsif ($att =~ m/CellProperty/) {101 my $property = $val;102 push(@values, { "type" => "CellProperty", "property" => $property });103 } elsif ($att =~ m/ClassStructure/) {104 my $property = $val;105 push(@values, { "type" => "ClassStructure", "property" => $property });106 } elsif ($att =~ m/PropertyCallback/) {107 my $cback = $val;108 push(@values, { "type" => "PropertyCallback", "cback" => $cback });109 100 } elsif (length($att)) { 110 101 my $get = $val; … … 308 299 $firstValue = $values[$i]{"value"}; 309 300 $secondValue = "0"; 310 } elsif ($values[$i]{"type"} eq "CellProperty" || $values[$i]{"type"} eq "ClassStructure") {311 $values[$i]{"property"} =~ /\A([a-zA-Z0-9_]+)::(.*)\Z/ or die;312 $firstValue = "OBJECT_OFFSETOF($1, $2)";313 $secondValue = "0";314 } elsif ($values[$i]{"type"} eq "PropertyCallback") {315 $firstCastStr = "static_cast<LazyPropertyCallback>";316 $firstValue = $values[$i]{"cback"};317 $secondValue = "0";318 301 } 319 302 -
trunk/Source/JavaScriptCore/debugger/DebuggerScope.cpp
r200383 r200416 1 1 /* 2 * Copyright (C) 2008-2009, 2014 , 2016Apple Inc. All rights reserved.2 * Copyright (C) 2008-2009, 2014 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 37 37 const ClassInfo DebuggerScope::s_info = { "DebuggerScope", &Base::s_info, 0, CREATE_METHOD_TABLE(DebuggerScope) }; 38 38 39 DebuggerScope* DebuggerScope::create(VM& vm, JSScope* scope) 40 { 41 Structure* structure = scope->globalObject()->debuggerScopeStructure(); 42 DebuggerScope* debuggerScope = new (NotNull, allocateCell<DebuggerScope>(vm.heap)) DebuggerScope(vm, structure, scope); 43 debuggerScope->finishCreation(vm); 44 return debuggerScope; 45 } 46 47 DebuggerScope::DebuggerScope(VM& vm, Structure* structure, JSScope* scope) 48 : JSNonFinalObject(vm, structure) 39 DebuggerScope::DebuggerScope(VM& vm, JSScope* scope) 40 : JSNonFinalObject(vm, scope->globalObject()->debuggerScopeStructure()) 49 41 { 50 42 ASSERT(scope); -
trunk/Source/JavaScriptCore/debugger/DebuggerScope.h
r200383 r200416 1 1 /* 2 * Copyright (C) 2008-2009, 2014 , 2016Apple Inc. All rights reserved.2 * Copyright (C) 2008-2009, 2014 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 39 39 static const unsigned StructureFlags = Base::StructureFlags | OverridesGetOwnPropertySlot | OverridesGetPropertyNames; 40 40 41 JS_EXPORT_PRIVATE static DebuggerScope* create(VM& vm, JSScope* scope); 41 static DebuggerScope* create(VM& vm, JSScope* scope) 42 { 43 DebuggerScope* debuggerScope = new (NotNull, allocateCell<DebuggerScope>(vm.heap)) DebuggerScope(vm, scope); 44 debuggerScope->finishCreation(vm); 45 return debuggerScope; 46 } 42 47 43 48 static void visitChildren(JSCell*, SlotVisitor&); … … 92 97 93 98 private: 94 DebuggerScope(VM&, Structure*, JSScope*);95 void finishCreation(VM&);99 JS_EXPORT_PRIVATE DebuggerScope(VM&, JSScope*); 100 JS_EXPORT_PRIVATE void finishCreation(VM&); 96 101 97 102 JSScope* jsScope() const { return m_scope.get(); } -
trunk/Source/JavaScriptCore/dfg/DFGAbstractInterpreterInlines.h
r200383 r200416 1867 1867 forNode(node).set( 1868 1868 m_graph, 1869 m_graph.globalObjectFor(node->origin.semantic)->typedArrayStructure Concurrently(1869 m_graph.globalObjectFor(node->origin.semantic)->typedArrayStructure( 1870 1870 node->typedArrayType())); 1871 1871 break; -
trunk/Source/JavaScriptCore/dfg/DFGAbstractValue.cpp
r200383 r200416 1 1 /* 2 * Copyright (C) 2013-201 6Apple Inc. All rights reserved.2 * Copyright (C) 2013-2015 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 78 78 void AbstractValue::set(Graph& graph, Structure* structure) 79 79 { 80 RELEASE_ASSERT(structure);81 82 80 m_structure = structure; 83 81 m_arrayModes = asArrayModes(structure->indexingType()); -
trunk/Source/JavaScriptCore/dfg/DFGArrayMode.cpp
r200383 r200416 324 324 default: 325 325 CRASH(); 326 return nullptr;326 return 0; 327 327 } 328 328 } … … 331 331 TypedArrayType type = typedArrayType(); 332 332 if (type == NotTypedArray) 333 return nullptr;334 335 return globalObject->typedArrayStructure Concurrently(type);336 } 337 338 default: 339 return nullptr;333 return 0; 334 335 return globalObject->typedArrayStructure(type); 336 } 337 338 default: 339 return 0; 340 340 } 341 341 } -
trunk/Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp
r200383 r200416 2575 2575 2576 2576 if (argumentCountIncludingThis != 2) 2577 return false;2578 2579 if (!function->globalObject()->typedArrayStructureConcurrently(type))2580 2577 return false; 2581 2578 -
trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp
r200383 r200416 6764 6764 JSGlobalObject* globalObject = m_jit.graph().globalObjectFor(node->origin.semantic); 6765 6765 TypedArrayType type = node->typedArrayType(); 6766 Structure* structure = globalObject->typedArrayStructureConcurrently(type); 6767 RELEASE_ASSERT(structure); 6766 Structure* structure = globalObject->typedArrayStructure(type); 6768 6767 6769 6768 SpeculateInt32Operand size(this, node->child1()); -
trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT32_64.cpp
r200383 r200416 3805 3805 callOperation( 3806 3806 operationNewTypedArrayWithOneArgumentForType(node->typedArrayType()), 3807 resultGPR, globalObject->typedArrayStructure Concurrently(node->typedArrayType()),3807 resultGPR, globalObject->typedArrayStructure(node->typedArrayType()), 3808 3808 argumentTagGPR, argumentPayloadGPR); 3809 3809 m_jit.exceptionCheck(); -
trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT64.cpp
r200383 r200416 3862 3862 callOperation( 3863 3863 operationNewTypedArrayWithOneArgumentForType(node->typedArrayType()), 3864 resultGPR, globalObject->typedArrayStructure Concurrently(node->typedArrayType()),3864 resultGPR, globalObject->typedArrayStructure(node->typedArrayType()), 3865 3865 argumentGPR); 3866 3866 m_jit.exceptionCheck(); -
trunk/Source/JavaScriptCore/dfg/DFGStructureRegistrationPhase.cpp
r200383 r200416 1 1 /* 2 * Copyright (C) 2014 -2016Apple Inc. All rights reserved.2 * Copyright (C) 2014, 2015 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 121 121 122 122 case NewTypedArray: 123 registerStructure(m_graph.globalObjectFor(node->origin.semantic)->typedArrayStructure Concurrently(node->typedArrayType()));123 registerStructure(m_graph.globalObjectFor(node->origin.semantic)->typedArrayStructure(node->typedArrayType())); 124 124 break; 125 125 -
trunk/Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp
r200383 r200416 3909 3909 switch (m_node->child1().useKind()) { 3910 3910 case Int32Use: { 3911 Structure* structure = globalObject->typedArrayStructure Concurrently(type);3911 Structure* structure = globalObject->typedArrayStructure(type); 3912 3912 3913 3913 LValue size = lowInt32(m_node->child1()); … … 3970 3970 LValue result = vmCall( 3971 3971 m_out.intPtr, m_out.operation(operationNewTypedArrayWithOneArgumentForType(type)), 3972 m_callFrame, weakPointer(globalObject->typedArrayStructure Concurrently(type)), argument);3972 m_callFrame, weakPointer(globalObject->typedArrayStructure(type)), argument); 3973 3973 3974 3974 setJSValue(result); -
trunk/Source/JavaScriptCore/runtime/ClonedArguments.cpp
r200383 r200416 1 1 /* 2 * Copyright (C) 2015 -2016Apple Inc. All rights reserved.2 * Copyright (C) 2015 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 159 159 if (isStrictMode) { 160 160 if (ident == vm.propertyNames->callee) { 161 slot.setGetterSlot(thisObject, DontDelete | DontEnum | Accessor, thisObject->globalObject()->throwTypeErrorGetterSetter( ));161 slot.setGetterSlot(thisObject, DontDelete | DontEnum | Accessor, thisObject->globalObject()->throwTypeErrorGetterSetter(vm)); 162 162 return true; 163 163 } 164 164 if (ident == vm.propertyNames->caller) { 165 slot.setGetterSlot(thisObject, DontDelete | DontEnum | Accessor, thisObject->globalObject()->throwTypeErrorGetterSetter( ));165 slot.setGetterSlot(thisObject, DontDelete | DontEnum | Accessor, thisObject->globalObject()->throwTypeErrorGetterSetter(vm)); 166 166 return true; 167 167 } … … 239 239 240 240 if (isStrictMode) { 241 putDirectAccessor(exec, vm.propertyNames->callee, globalObject()->throwTypeErrorGetterSetter( ), DontDelete | DontEnum | Accessor);242 putDirectAccessor(exec, vm.propertyNames->caller, globalObject()->throwTypeErrorGetterSetter( ), DontDelete | DontEnum | Accessor);241 putDirectAccessor(exec, vm.propertyNames->callee, globalObject()->throwTypeErrorGetterSetter(vm), DontDelete | DontEnum | Accessor); 242 putDirectAccessor(exec, vm.propertyNames->caller, globalObject()->throwTypeErrorGetterSetter(vm), DontDelete | DontEnum | Accessor); 243 243 } else 244 244 putDirect(vm, vm.propertyNames->callee, JSValue(m_callee.get())); -
trunk/Source/JavaScriptCore/runtime/CommonSlowPaths.cpp
r200383 r200416 763 763 int scopeReg = pc[3].u.operand; 764 764 JSScope* currentScope = exec->uncheckedR(scopeReg).Register::scope(); 765 RETURN(JSWithScope::create( vm, exec->lexicalGlobalObject(), newScope, currentScope));765 RETURN(JSWithScope::create(exec, newScope, currentScope)); 766 766 } 767 767 -
trunk/Source/JavaScriptCore/runtime/FunctionPrototype.cpp
r200383 r200416 105 105 if (thisValue.inherits(InternalFunction::info())) { 106 106 InternalFunction* function = asInternalFunction(thisValue); 107 return JSValue::encode(jsMakeNontrivialString(exec, "function ", function->name( ), "() {\n [native code]\n}"));107 return JSValue::encode(jsMakeNontrivialString(exec, "function ", function->name(exec), "() {\n [native code]\n}")); 108 108 } 109 109 -
trunk/Source/JavaScriptCore/runtime/InternalFunction.cpp
r200383 r200416 59 59 } 60 60 61 const String& InternalFunction::name( )61 const String& InternalFunction::name(ExecState*) 62 62 { 63 63 const String& name = m_originalName->tryGetValue(); … … 89 89 return explicitName; 90 90 91 return name( );91 return name(exec); 92 92 } 93 93 -
trunk/Source/JavaScriptCore/runtime/InternalFunction.h
r200383 r200416 41 41 JS_EXPORT_PRIVATE static void visitChildren(JSCell*, SlotVisitor&); 42 42 43 JS_EXPORT_PRIVATE const String& name( );43 JS_EXPORT_PRIVATE const String& name(ExecState*); 44 44 const String displayName(ExecState*); 45 45 const String calculatedDisplayName(ExecState*); -
trunk/Source/JavaScriptCore/runtime/JSBoundFunction.cpp
r200383 r200416 197 197 ASSERT(inherits(info())); 198 198 199 putDirectNonIndexAccessor(vm, vm.propertyNames->arguments, globalObject()->throwTypeErrorGetterSetter( ), DontDelete | DontEnum | Accessor);200 putDirectNonIndexAccessor(vm, vm.propertyNames->caller, globalObject()->throwTypeErrorGetterSetter( ), DontDelete | DontEnum | Accessor);199 putDirectNonIndexAccessor(vm, vm.propertyNames->arguments, globalObject()->throwTypeErrorGetterSetter(vm), DontDelete | DontEnum | Accessor); 200 putDirectNonIndexAccessor(vm, vm.propertyNames->caller, globalObject()->throwTypeErrorGetterSetter(vm), DontDelete | DontEnum | Accessor); 201 201 } 202 202 -
trunk/Source/JavaScriptCore/runtime/JSBoundSlotBaseFunction.cpp
r200383 r200416 65 65 NativeExecutable* executable = vm.getHostFunction(boundSlotBaseFunctionCall, callHostFunctionAsConstructor, name); 66 66 67 Structure* structure = globalObject->boundSlotBaseFunctionStructure(); 68 JSBoundSlotBaseFunction* function = new (NotNull, allocateCell<JSBoundSlotBaseFunction>(vm.heap)) JSBoundSlotBaseFunction(vm, globalObject, structure, type); 67 JSBoundSlotBaseFunction* function = new (NotNull, allocateCell<JSBoundSlotBaseFunction>(vm.heap)) JSBoundSlotBaseFunction(vm, globalObject, globalObject->boundSlotBaseFunctionStructure(), type); 69 68 70 69 // Can't do this during initialization because getHostFunction might do a GC allocation. -
trunk/Source/JavaScriptCore/runtime/JSFunction.cpp
r200383 r200416 320 320 } 321 321 322 static GetterSetter* getThrowTypeErrorGetterSetter( JSFunction* function)322 static GetterSetter* getThrowTypeErrorGetterSetter(ExecState* exec, JSFunction* function) 323 323 { 324 324 return function->jsExecutable()->isClassConstructorFunction() || function->jsExecutable()->parseMode() == SourceParseMode::MethodMode 325 ? function->globalObject()->throwTypeErrorArgumentsAndCallerGetterSetter( )326 : function->globalObject()->throwTypeErrorGetterSetter( );325 ? function->globalObject()->throwTypeErrorArgumentsAndCallerGetterSetter(exec->vm()) 326 : function->globalObject()->throwTypeErrorGetterSetter(exec->vm()); 327 327 } 328 328 … … 376 376 bool result = Base::getOwnPropertySlot(thisObject, exec, propertyName, slot); 377 377 if (!result) { 378 GetterSetter* errorGetterSetter = getThrowTypeErrorGetterSetter( thisObject);378 GetterSetter* errorGetterSetter = getThrowTypeErrorGetterSetter(exec, thisObject); 379 379 thisObject->putDirectAccessor(exec, propertyName, errorGetterSetter, DontDelete | DontEnum | Accessor); 380 380 result = Base::getOwnPropertySlot(thisObject, exec, propertyName, slot); … … 391 391 bool result = Base::getOwnPropertySlot(thisObject, exec, propertyName, slot); 392 392 if (!result) { 393 GetterSetter* errorGetterSetter = getThrowTypeErrorGetterSetter( thisObject);393 GetterSetter* errorGetterSetter = getThrowTypeErrorGetterSetter(exec, thisObject); 394 394 thisObject->putDirectAccessor(exec, propertyName, errorGetterSetter, DontDelete | DontEnum | Accessor); 395 395 result = Base::getOwnPropertySlot(thisObject, exec, propertyName, slot); … … 500 500 PropertySlot slot(thisObject, PropertySlot::InternalMethodType::VMInquiry); 501 501 if (!Base::getOwnPropertySlot(thisObject, exec, propertyName, slot)) 502 thisObject->putDirectAccessor(exec, propertyName, thisObject->globalObject()->throwTypeErrorGetterSetter( ), DontDelete | DontEnum | Accessor);502 thisObject->putDirectAccessor(exec, propertyName, thisObject->globalObject()->throwTypeErrorGetterSetter(exec->vm()), DontDelete | DontEnum | Accessor); 503 503 return Base::defineOwnProperty(object, exec, propertyName, descriptor, throwException); 504 504 } … … 508 508 PropertySlot slot(thisObject, PropertySlot::InternalMethodType::VMInquiry); 509 509 if (!Base::getOwnPropertySlot(thisObject, exec, propertyName, slot)) 510 thisObject->putDirectAccessor(exec, propertyName, thisObject->globalObject()->throwTypeErrorGetterSetter( ), DontDelete | DontEnum | Accessor);510 thisObject->putDirectAccessor(exec, propertyName, thisObject->globalObject()->throwTypeErrorGetterSetter(exec->vm()), DontDelete | DontEnum | Accessor); 511 511 return Base::defineOwnProperty(object, exec, propertyName, descriptor, throwException); 512 512 } -
trunk/Source/JavaScriptCore/runtime/JSGenericTypedArrayViewConstructorInlines.h
r200383 r200416 222 222 EncodedJSValue JSC_HOST_CALL constructGenericTypedArrayView(ExecState* exec) 223 223 { 224 InternalFunction* function = asInternalFunction(exec->callee()); 225 Structure* parentStructure = function->globalObject()->typedArrayStructure(ViewClass::TypedArrayStorageType); 226 Structure* structure = InternalFunction::createSubclassStructure(exec, exec->newTarget(), parentStructure); 224 Structure* structure = InternalFunction::createSubclassStructure(exec, exec->newTarget(), asInternalFunction(exec->callee())->globalObject()->typedArrayStructure(ViewClass::TypedArrayStorageType)); 227 225 if (exec->hadException()) 228 226 return JSValue::encode(JSValue()); -
trunk/Source/JavaScriptCore/runtime/JSGlobalObject.cpp
r200383 r200416 111 111 #include "JSWeakSet.h" 112 112 #include "JSWithScope.h" 113 #include "LazyClassStructureInlines.h"114 #include "LazyPropertyInlines.h"115 113 #include "LegacyProfiler.h" 116 114 #include "Lookup.h" … … 175 173 #endif 176 174 177 namespace JSC {178 179 static JSValue createProxyProperty(VM& vm, JSObject* object)180 {181 JSGlobalObject* global = jsCast<JSGlobalObject*>(object);182 return ProxyConstructor::create(vm, ProxyConstructor::createStructure(vm, global, global->functionPrototype()));183 }184 185 static JSValue createJSONProperty(VM& vm, JSObject* object)186 {187 JSGlobalObject* global = jsCast<JSGlobalObject*>(object);188 return JSONObject::create(vm, JSONObject::createStructure(vm, global, global->objectPrototype()));189 }190 191 static JSValue createMathProperty(VM& vm, JSObject* object)192 {193 JSGlobalObject* global = jsCast<JSGlobalObject*>(object);194 return MathObject::create(vm, global, MathObject::createStructure(vm, global, global->objectPrototype()));195 }196 197 } // namespace JSC198 199 175 #include "JSGlobalObject.lut.h" 200 176 … … 207 183 /* Source for JSGlobalObject.lut.h 208 184 @begin globalObjectTable 209 parseFloat globalFuncParseFloat DontEnum|Function 1 210 isNaN globalFuncIsNaN DontEnum|Function 1 211 isFinite globalFuncIsFinite DontEnum|Function 1 212 escape globalFuncEscape DontEnum|Function 1 213 unescape globalFuncUnescape DontEnum|Function 1 214 decodeURI globalFuncDecodeURI DontEnum|Function 1 215 decodeURIComponent globalFuncDecodeURIComponent DontEnum|Function 1 216 encodeURI globalFuncEncodeURI DontEnum|Function 1 217 encodeURIComponent globalFuncEncodeURIComponent DontEnum|Function 1 218 EvalError JSGlobalObject::m_evalErrorConstructor DontEnum|CellProperty 219 ReferenceError JSGlobalObject::m_referenceErrorConstructor DontEnum|CellProperty 220 SyntaxError JSGlobalObject::m_syntaxErrorConstructor DontEnum|CellProperty 221 URIError JSGlobalObject::m_URIErrorConstructor DontEnum|CellProperty 222 Proxy createProxyProperty DontEnum|PropertyCallback 223 JSON createJSONProperty DontEnum|PropertyCallback 224 Math createMathProperty DontEnum|PropertyCallback 225 Int8Array JSGlobalObject::m_typedArrayInt8 DontEnum|ClassStructure 226 Int16Array JSGlobalObject::m_typedArrayInt16 DontEnum|ClassStructure 227 Int32Array JSGlobalObject::m_typedArrayInt32 DontEnum|ClassStructure 228 Uint8Array JSGlobalObject::m_typedArrayUint8 DontEnum|ClassStructure 229 Uint8ClampedArray JSGlobalObject::m_typedArrayUint8Clamped DontEnum|ClassStructure 230 Uint16Array JSGlobalObject::m_typedArrayUint16 DontEnum|ClassStructure 231 Uint32Array JSGlobalObject::m_typedArrayUint32 DontEnum|ClassStructure 232 Float32Array JSGlobalObject::m_typedArrayFloat32 DontEnum|ClassStructure 233 Float64Array JSGlobalObject::m_typedArrayFloat64 DontEnum|ClassStructure 234 DataView JSGlobalObject::m_typedArrayDataView DontEnum|ClassStructure 235 Set JSGlobalObject::m_setStructure DontEnum|ClassStructure 236 Map JSGlobalObject::m_mapStructure DontEnum|ClassStructure 237 Date JSGlobalObject::m_dateStructure DontEnum|ClassStructure 238 Boolean JSGlobalObject::m_booleanObjectStructure DontEnum|ClassStructure 239 Number JSGlobalObject::m_numberObjectStructure DontEnum|ClassStructure 240 WeakMap JSGlobalObject::m_weakMapStructure DontEnum|ClassStructure 241 WeakSet JSGlobalObject::m_weakSetStructure DontEnum|ClassStructure 185 parseFloat globalFuncParseFloat DontEnum|Function 1 186 isNaN globalFuncIsNaN DontEnum|Function 1 187 isFinite globalFuncIsFinite DontEnum|Function 1 188 escape globalFuncEscape DontEnum|Function 1 189 unescape globalFuncUnescape DontEnum|Function 1 190 decodeURI globalFuncDecodeURI DontEnum|Function 1 191 decodeURIComponent globalFuncDecodeURIComponent DontEnum|Function 1 192 encodeURI globalFuncEncodeURI DontEnum|Function 1 193 encodeURIComponent globalFuncEncodeURIComponent DontEnum|Function 1 242 194 @end 243 195 */ … … 340 292 341 293 m_functionStructure.set(vm, this, JSFunction::createStructure(vm, this, m_functionPrototype.get())); 342 m_boundSlotBaseFunctionStructure.initLater( 343 [] (const Initializer<Structure>& init) { 344 init.set(JSBoundSlotBaseFunction::createStructure(init.vm, init.owner, init.owner->m_functionPrototype.get())); 345 }); 346 m_boundFunctionStructure.initLater( 347 [] (const Initializer<Structure>& init) { 348 init.set(JSBoundFunction::createStructure(init.vm, init.owner, init.owner->m_functionPrototype.get())); 349 }); 294 m_boundSlotBaseFunctionStructure.set(vm, this, JSBoundSlotBaseFunction::createStructure(vm, this, m_functionPrototype.get())); 295 m_boundFunctionStructure.set(vm, this, JSBoundFunction::createStructure(vm, this, m_functionPrototype.get())); 350 296 m_getterSetterStructure.set(vm, this, GetterSetter::createStructure(vm, this, jsNull())); 351 m_nativeStdFunctionStructure.initLater( 352 [] (const Initializer<Structure>& init) { 353 init.set(JSNativeStdFunction::createStructure(init.vm, init.owner, init.owner->m_functionPrototype.get())); 354 }); 355 m_namedFunctionStructure.initLater( 356 [] (const Initializer<Structure>& init) { 357 init.set(Structure::addPropertyTransition(init.vm, init.owner->m_functionStructure.get(), init.vm.propertyNames->name, DontDelete | ReadOnly | DontEnum, init.owner->m_functionNameOffset)); 358 }); 297 m_nativeStdFunctionStructure.set(vm, this, JSNativeStdFunction::createStructure(vm, this, m_functionPrototype.get())); 298 m_namedFunctionStructure.set(vm, this, Structure::addPropertyTransition(vm, m_functionStructure.get(), vm.propertyNames->name, DontDelete | ReadOnly | DontEnum, m_functionNameOffset)); 299 m_internalFunctionStructure.set(vm, this, InternalFunction::createStructure(vm, this, m_functionPrototype.get())); 359 300 JSFunction* callFunction = 0; 360 301 JSFunction* applyFunction = 0; … … 363 304 m_callFunction.set(vm, this, callFunction); 364 305 m_applyFunction.set(vm, this, applyFunction); 365 m_arrayProtoValuesFunction.initLater( 366 [] (const Initializer<JSFunction>& init) { 367 init.set(JSFunction::create(init.vm, init.owner, 0, init.vm.propertyNames->values.string(), arrayProtoFuncValues)); 368 }); 369 m_initializePromiseFunction.initLater( 370 [] (const Initializer<JSFunction>& init) { 371 init.set(JSFunction::createBuiltinFunction(init.vm, promiseOperationsInitializePromiseCodeGenerator(init.vm), init.owner)); 372 }); 306 m_arrayProtoValuesFunction.set(vm, this, JSFunction::create(vm, this, 0, vm.propertyNames->values.string(), arrayProtoFuncValues)); 307 m_initializePromiseFunction.set(vm, this, JSFunction::createBuiltinFunction(vm, promiseOperationsInitializePromiseCodeGenerator(vm), this)); 373 308 m_newPromiseCapabilityFunction.set(vm, this, JSFunction::createBuiltinFunction(vm, promiseOperationsNewPromiseCapabilityCodeGenerator(vm), this)); 374 309 m_functionProtoHasInstanceSymbolFunction.set(vm, this, hasInstanceSymbolFunction); 375 m_throwTypeErrorGetterSetter.initLater(376 [] (const Initializer<GetterSetter>& init) {377 JSFunction* thrower = JSFunction::create(init.vm, init.owner, 0, String(), globalFuncThrowTypeError);378 GetterSetter* getterSetter = GetterSetter::create(init.vm, init.owner);379 getterSetter->setGetter(init.vm, init.owner, thrower);380 getterSetter->setSetter(init.vm, init.owner, thrower);381 init.set(getterSetter);382 });383 m_throwTypeErrorArgumentsAndCallerGetterSetter.initLater(384 [] (const Initializer<GetterSetter>& init) {385 JSFunction* thrower = JSFunction::create(init.vm, init.owner, 0, String(), globalFuncThrowTypeErrorArgumentsAndCaller);386 GetterSetter* getterSetter = GetterSetter::create(init.vm, init.owner);387 getterSetter->setGetter(init.vm, init.owner, thrower);388 getterSetter->setSetter(init.vm, init.owner, thrower);389 init.set(getterSetter);390 });391 310 m_nullGetterFunction.set(vm, this, NullGetterFunction::create(vm, NullGetterFunction::createStructure(vm, this, m_functionPrototype.get()))); 392 311 m_nullSetterFunction.set(vm, this, NullSetterFunction::create(vm, NullSetterFunction::createStructure(vm, this, m_functionPrototype.get()))); … … 398 317 m_functionPrototype->structure()->setPrototypeWithoutTransition(vm, m_objectPrototype.get()); 399 318 400 m_speciesGetterSetter.set(vm, this, GetterSetter::create(vm, this)); 401 m_speciesGetterSetter->setGetter(vm, this, JSFunction::createBuiltinFunction(vm, globalObjectSpeciesGetterCodeGenerator(vm), this, "get [Symbol.species]")); 402 403 m_typedArrayProto.initLater( 404 [] (const Initializer<JSTypedArrayViewPrototype>& init) { 405 init.set(JSTypedArrayViewPrototype::create(init.vm, init.owner, JSTypedArrayViewPrototype::createStructure(init.vm, init.owner, init.owner->m_objectPrototype.get()))); 406 407 // Make sure that the constructor gets initialized, too. 408 init.owner->m_typedArraySuperConstructor.get(init.owner); 409 }); 410 m_typedArraySuperConstructor.initLater( 411 [] (const Initializer<JSTypedArrayViewConstructor>& init) { 412 JSTypedArrayViewPrototype* prototype = init.owner->m_typedArrayProto.get(init.owner); 413 JSTypedArrayViewConstructor* constructor = JSTypedArrayViewConstructor::create(init.vm, init.owner, JSTypedArrayViewConstructor::createStructure(init.vm, init.owner, init.owner->m_functionPrototype.get()), prototype, init.owner->m_speciesGetterSetter.get()); 414 prototype->putDirectWithoutTransition(init.vm, init.vm.propertyNames->constructor, constructor, DontEnum); 415 init.set(constructor); 416 }); 417 418 #define INIT_TYPED_ARRAY_LATER(type) \ 419 m_typedArray ## type.initLater( \ 420 [] (LazyClassStructure::Initializer& init) { \ 421 init.setPrototype(JS ## type ## ArrayPrototype::create(init.vm, init.global, JS ## type ## ArrayPrototype::createStructure(init.vm, init.global, init.global->m_typedArrayProto.get(init.global)))); \ 422 init.setStructure(JS ## type ## Array::createStructure(init.vm, init.global, init.prototype)); \ 423 init.setConstructor(JS ## type ## ArrayConstructor::create(init.vm, init.global, JS ## type ## ArrayConstructor::createStructure(init.vm, init.global, init.global->m_typedArraySuperConstructor.get(init.global)), init.prototype, ASCIILiteral(#type "Array"), typedArrayConstructorAllocate ## type ## ArrayCodeGenerator(init.vm))); \ 424 init.global->putDirectWithoutTransition(init.vm, init.vm.propertyNames->type ## ArrayPrivateName, init.constructor, DontEnum); \ 425 }); 426 FOR_EACH_TYPED_ARRAY_TYPE_EXCLUDING_DATA_VIEW(INIT_TYPED_ARRAY_LATER) 427 #undef INIT_TYPED_ARRAY_LATER 428 429 m_typedArrayDataView.initLater( 430 [] (LazyClassStructure::Initializer& init) { 431 init.setPrototype(JSDataViewPrototype::create(init.vm, JSDataViewPrototype::createStructure(init.vm, init.global, init.global->m_objectPrototype.get()))); 432 init.setStructure(JSDataView::createStructure(init.vm, init.global, init.prototype)); 433 init.setConstructor(JSDataViewConstructor::create(init.vm, init.global, JSDataViewConstructor::createStructure(init.vm, init.global, init.global->m_functionPrototype.get()), init.prototype, ASCIILiteral("DataView"), nullptr)); 434 }); 319 JSTypedArrayViewPrototype* typedArrayProto = JSTypedArrayViewPrototype::create(vm, this, JSTypedArrayViewPrototype::createStructure(vm, this, m_objectPrototype.get())); 320 321 m_typedArrays[toIndex(TypeInt8)].prototype.set(vm, this, JSInt8ArrayPrototype::create(vm, this, JSInt8ArrayPrototype::createStructure(vm, this, typedArrayProto))); 322 m_typedArrays[toIndex(TypeInt16)].prototype.set(vm, this, JSInt16ArrayPrototype::create(vm, this, JSInt16ArrayPrototype::createStructure(vm, this, typedArrayProto))); 323 m_typedArrays[toIndex(TypeInt32)].prototype.set(vm, this, JSInt32ArrayPrototype::create(vm, this, JSInt32ArrayPrototype::createStructure(vm, this, typedArrayProto))); 324 m_typedArrays[toIndex(TypeUint8)].prototype.set(vm, this, JSUint8ArrayPrototype::create(vm, this, JSUint8ArrayPrototype::createStructure(vm, this, typedArrayProto))); 325 m_typedArrays[toIndex(TypeUint8Clamped)].prototype.set(vm, this, JSUint8ClampedArrayPrototype::create(vm, this, JSUint8ClampedArrayPrototype::createStructure(vm, this, typedArrayProto))); 326 m_typedArrays[toIndex(TypeUint16)].prototype.set(vm, this, JSUint16ArrayPrototype::create(vm, this, JSUint16ArrayPrototype::createStructure(vm, this, typedArrayProto))); 327 m_typedArrays[toIndex(TypeUint32)].prototype.set(vm, this, JSUint32ArrayPrototype::create(vm, this, JSUint32ArrayPrototype::createStructure(vm, this, typedArrayProto))); 328 m_typedArrays[toIndex(TypeFloat32)].prototype.set(vm, this, JSFloat32ArrayPrototype::create(vm, this, JSFloat32ArrayPrototype::createStructure(vm, this, typedArrayProto))); 329 m_typedArrays[toIndex(TypeFloat64)].prototype.set(vm, this, JSFloat64ArrayPrototype::create(vm, this, JSFloat64ArrayPrototype::createStructure(vm, this, typedArrayProto))); 330 m_typedArrays[toIndex(TypeDataView)].prototype.set(vm, this, JSDataViewPrototype::create(vm, JSDataViewPrototype::createStructure(vm, this, m_objectPrototype.get()))); 331 332 m_typedArrays[toIndex(TypeInt8)].structure.set(vm, this, JSInt8Array::createStructure(vm, this, m_typedArrays[toIndex(TypeInt8)].prototype.get())); 333 m_typedArrays[toIndex(TypeInt16)].structure.set(vm, this, JSInt16Array::createStructure(vm, this, m_typedArrays[toIndex(TypeInt16)].prototype.get())); 334 m_typedArrays[toIndex(TypeInt32)].structure.set(vm, this, JSInt32Array::createStructure(vm, this, m_typedArrays[toIndex(TypeInt32)].prototype.get())); 335 m_typedArrays[toIndex(TypeUint8)].structure.set(vm, this, JSUint8Array::createStructure(vm, this, m_typedArrays[toIndex(TypeUint8)].prototype.get())); 336 m_typedArrays[toIndex(TypeUint8Clamped)].structure.set(vm, this, JSUint8ClampedArray::createStructure(vm, this, m_typedArrays[toIndex(TypeUint8Clamped)].prototype.get())); 337 m_typedArrays[toIndex(TypeUint16)].structure.set(vm, this, JSUint16Array::createStructure(vm, this, m_typedArrays[toIndex(TypeUint16)].prototype.get())); 338 m_typedArrays[toIndex(TypeUint32)].structure.set(vm, this, JSUint32Array::createStructure(vm, this, m_typedArrays[toIndex(TypeUint32)].prototype.get())); 339 m_typedArrays[toIndex(TypeFloat32)].structure.set(vm, this, JSFloat32Array::createStructure(vm, this, m_typedArrays[toIndex(TypeFloat32)].prototype.get())); 340 m_typedArrays[toIndex(TypeFloat64)].structure.set(vm, this, JSFloat64Array::createStructure(vm, this, m_typedArrays[toIndex(TypeFloat64)].prototype.get())); 341 m_typedArrays[toIndex(TypeDataView)].structure.set(vm, this, JSDataView::createStructure(vm, this, m_typedArrays[toIndex(TypeDataView)].prototype.get())); 435 342 436 343 m_lexicalEnvironmentStructure.set(vm, this, JSLexicalEnvironment::createStructure(vm, this)); 437 m_moduleEnvironmentStructure.initLater( 438 [] (const Initializer<Structure>& init) { 439 init.set(JSModuleEnvironment::createStructure(init.vm, init.owner)); 440 }); 344 m_moduleEnvironmentStructure.set(vm, this, JSModuleEnvironment::createStructure(vm, this)); 441 345 m_strictEvalActivationStructure.set(vm, this, StrictEvalActivation::createStructure(vm, this, jsNull())); 442 m_debuggerScopeStructure.initLater( 443 [] (const Initializer<Structure>& init) { 444 init.set(DebuggerScope::createStructure(init.vm, init.owner)); 445 }); 446 m_withScopeStructure.initLater( 447 [] (const Initializer<Structure>& init) { 448 init.set(JSWithScope::createStructure(init.vm, init.owner, jsNull())); 449 }); 450 451 m_nullPrototypeObjectStructure.initLater( 452 [] (const Initializer<Structure>& init) { 453 init.set(JSFinalObject::createStructure(init.vm, init.owner, jsNull(), JSFinalObject::defaultInlineCapacity())); 454 }); 455 456 m_callbackFunctionStructure.initLater( 457 [] (const Initializer<Structure>& init) { 458 init.set(JSCallbackFunction::createStructure(init.vm, init.owner, init.owner->m_functionPrototype.get())); 459 }); 346 m_debuggerScopeStructure.set(m_vm, this, DebuggerScope::createStructure(m_vm, this)); 347 m_withScopeStructure.set(vm, this, JSWithScope::createStructure(vm, this, jsNull())); 348 349 m_nullPrototypeObjectStructure.set(vm, this, JSFinalObject::createStructure(vm, this, jsNull(), JSFinalObject::defaultInlineCapacity())); 350 351 m_callbackFunctionStructure.set(vm, this, JSCallbackFunction::createStructure(vm, this, m_functionPrototype.get())); 460 352 m_directArgumentsStructure.set(vm, this, DirectArguments::createStructure(vm, this, m_objectPrototype.get())); 461 353 m_scopedArgumentsStructure.set(vm, this, ScopedArguments::createStructure(vm, this, m_objectPrototype.get())); 462 354 m_clonedArgumentsStructure.set(vm, this, ClonedArguments::createStructure(vm, this, m_objectPrototype.get())); 463 m_callbackConstructorStructure.initLater( 464 [] (const Initializer<Structure>& init) { 465 init.set(JSCallbackConstructor::createStructure(init.vm, init.owner, init.owner->m_objectPrototype.get())); 466 }); 467 m_callbackObjectStructure.initLater( 468 [] (const Initializer<Structure>& init) { 469 init.set(JSCallbackObject<JSDestructibleObject>::createStructure(init.vm, init.owner, init.owner->m_objectPrototype.get())); 470 }); 355 m_callbackConstructorStructure.set(vm, this, JSCallbackConstructor::createStructure(vm, this, m_objectPrototype.get())); 356 m_callbackObjectStructure.set(vm, this, JSCallbackObject<JSDestructibleObject>::createStructure(vm, this, m_objectPrototype.get())); 471 357 472 358 #if JSC_OBJC_API_ENABLED 473 m_objcCallbackFunctionStructure.initLater( 474 [] (const Initializer<Structure>& init) { 475 init.set(ObjCCallbackFunction::createStructure(init.vm, init.owner, init.owner->m_functionPrototype.get())); 476 }); 477 m_objcWrapperObjectStructure.initLater( 478 [] (const Initializer<Structure>& init) { 479 init.set(JSCallbackObject<JSAPIWrapperObject>::createStructure(init.vm, init.owner, init.owner->m_objectPrototype.get())); 480 }); 359 m_objcCallbackFunctionStructure.set(vm, this, ObjCCallbackFunction::createStructure(vm, this, m_functionPrototype.get())); 360 m_objcWrapperObjectStructure.set(vm, this, JSCallbackObject<JSAPIWrapperObject>::createStructure(vm, this, m_objectPrototype.get())); 481 361 #endif 482 362 … … 522 402 #undef CREATE_PROTOTYPE_FOR_SIMPLE_TYPE 523 403 524 #define CREATE_PROTOTYPE_FOR_LAZY_TYPE(capitalName, lowerName, properName, instanceType, jsName) \525 m_ ## properName ## Structure.initLater(\526 [] (LazyClassStructure::Initializer& init) { \527 init.setPrototype(capitalName##Prototype::create(init.vm, init.global, capitalName##Prototype::createStructure(init.vm, init.global, init.global->m_objectPrototype.get()))); \528 init.setStructure(instanceType::createStructure(init.vm, init.global, init.prototype)); \529 init.setConstructor(capitalName ## Constructor::create(init.vm, capitalName ## Constructor::createStructure(init.vm, init.global, init.global->m_functionPrototype.get()), jsCast<capitalName ## Prototype*>(init.prototype), init.global->m_speciesGetterSetter.get())); \530 });531 532 FOR_EACH_LAZY_BUILTIN_TYPE(CREATE_PROTOTYPE_FOR_LAZY_TYPE)533 534 #undef CREATE_PROTOTYPE_FOR_LAZY_TYPE535 536 404 m_iteratorPrototype.set(vm, this, IteratorPrototype::create(vm, this, IteratorPrototype::createStructure(vm, this, m_objectPrototype.get()))); 537 405 538 406 #define CREATE_PROTOTYPE_FOR_DERIVED_ITERATOR_TYPE(capitalName, lowerName, properName, instanceType, jsName) \ 539 m_ ## lowerName ## Structure.initLater( \ 540 [] (const Initializer<Structure>& init) { \ 541 JSObject* prototype = capitalName ## Prototype::create(init.vm, init.owner, capitalName ## Prototype::createStructure(init.vm, init.owner, init.owner->m_iteratorPrototype.get())); \ 542 init.set(instanceType::createStructure(init.vm, init.owner, prototype)); \ 543 }); 407 m_ ## lowerName ## Prototype.set(vm, this, capitalName##Prototype::create(vm, this, capitalName##Prototype::createStructure(vm, this, m_iteratorPrototype.get()))); \ 408 m_ ## properName ## Structure.set(vm, this, instanceType::createStructure(vm, this, m_ ## lowerName ## Prototype.get())); 409 544 410 FOR_EACH_BUILTIN_DERIVED_ITERATOR_TYPE(CREATE_PROTOTYPE_FOR_DERIVED_ITERATOR_TYPE) 545 #undef CREATE_PROTOTYPE_FOR_DERIVED_ITERATOR_TYPE546 547 411 m_propertyNameIteratorStructure.set(vm, this, JSPropertyNameIterator::createStructure(vm, this, m_iteratorPrototype.get())); 548 412 m_generatorPrototype.set(vm, this, GeneratorPrototype::create(vm, this, GeneratorPrototype::createStructure(vm, this, m_iteratorPrototype.get()))); 549 413 414 #undef CREATE_PROTOTYPE_FOR_DERIVED_ITERATOR_TYPE 415 550 416 // Constructors 417 418 GetterSetter* speciesGetterSetter = GetterSetter::create(vm, this); 419 speciesGetterSetter->setGetter(vm, this, JSFunction::createBuiltinFunction(vm, globalObjectSpeciesGetterCodeGenerator(vm), this, "get [Symbol.species]")); 551 420 552 421 ObjectConstructor* objectConstructor = ObjectConstructor::create(vm, this, ObjectConstructor::createStructure(vm, this, m_functionPrototype.get()), m_objectPrototype.get()); … … 557 426 558 427 JSCell* functionConstructor = FunctionConstructor::create(vm, FunctionConstructor::createStructure(vm, this, m_functionPrototype.get()), m_functionPrototype.get()); 559 JSObject* arrayConstructor = ArrayConstructor::create(vm, this, ArrayConstructor::createStructure(vm, this, m_functionPrototype.get()), m_arrayPrototype.get(), m_speciesGetterSetter.get());560 561 m_regExpConstructor.set(vm, this, RegExpConstructor::create(vm, RegExpConstructor::createStructure(vm, this, m_functionPrototype.get()), m_regExpPrototype.get(), m_speciesGetterSetter.get()));428 JSObject* arrayConstructor = ArrayConstructor::create(vm, this, ArrayConstructor::createStructure(vm, this, m_functionPrototype.get()), m_arrayPrototype.get(), speciesGetterSetter); 429 430 m_regExpConstructor.set(vm, this, RegExpConstructor::create(vm, RegExpConstructor::createStructure(vm, this, m_functionPrototype.get()), m_regExpPrototype.get(), speciesGetterSetter)); 562 431 563 432 #define CREATE_CONSTRUCTOR_FOR_SIMPLE_TYPE(capitalName, lowerName, properName, instanceType, jsName) \ 564 capitalName ## Constructor* lowerName ## Constructor = capitalName ## Constructor::create(vm, capitalName ## Constructor::createStructure(vm, this, m_functionPrototype.get()), m_ ## lowerName ## Prototype.get(), m_speciesGetterSetter.get()); \433 capitalName ## Constructor* lowerName ## Constructor = capitalName ## Constructor::create(vm, capitalName ## Constructor::createStructure(vm, this, m_functionPrototype.get()), m_ ## lowerName ## Prototype.get(), speciesGetterSetter); \ 565 434 m_ ## lowerName ## Prototype->putDirectWithoutTransition(vm, vm.propertyNames->constructor, lowerName ## Constructor, DontEnum); \ 566 435 … … 568 437 569 438 #undef CREATE_CONSTRUCTOR_FOR_SIMPLE_TYPE 570 439 571 440 m_errorConstructor.set(vm, this, errorConstructor); 572 441 m_promiseConstructor.set(vm, this, promiseConstructor); 573 442 m_internalPromiseConstructor.set(vm, this, internalPromiseConstructor); 574 443 575 m_nativeErrorPrototypeStructure.set(vm, this, NativeErrorPrototype::createStructure(vm, this, m_errorPrototype.get())); 576 m_nativeErrorStructure.set(vm, this, NativeErrorConstructor::createStructure(vm, this, m_functionPrototype.get())); 577 m_evalErrorConstructor.initLater( 578 [] (const Initializer<NativeErrorConstructor>& init) { 579 init.set(NativeErrorConstructor::create(init.vm, init.owner, init.owner->m_nativeErrorStructure.get(), init.owner->m_nativeErrorPrototypeStructure.get(), ASCIILiteral("EvalError"))); 580 }); 581 m_rangeErrorConstructor.set(vm, this, NativeErrorConstructor::create(vm, this, m_nativeErrorStructure.get(), m_nativeErrorPrototypeStructure.get(), ASCIILiteral("RangeError"))); 582 m_referenceErrorConstructor.initLater( 583 [] (const Initializer<NativeErrorConstructor>& init) { 584 init.set(NativeErrorConstructor::create(init.vm, init.owner, init.owner->m_nativeErrorStructure.get(), init.owner->m_nativeErrorPrototypeStructure.get(), ASCIILiteral("ReferenceError"))); 585 }); 586 m_syntaxErrorConstructor.initLater( 587 [] (const Initializer<NativeErrorConstructor>& init) { 588 init.set(NativeErrorConstructor::create(init.vm, init.owner, init.owner->m_nativeErrorStructure.get(), init.owner->m_nativeErrorPrototypeStructure.get(), ASCIILiteral("SyntaxError"))); 589 }); 590 m_typeErrorConstructor.set(vm, this, NativeErrorConstructor::create(vm, this, m_nativeErrorStructure.get(), m_nativeErrorPrototypeStructure.get(), ASCIILiteral("TypeError"))); 591 m_URIErrorConstructor.initLater( 592 [] (const Initializer<NativeErrorConstructor>& init) { 593 init.set(NativeErrorConstructor::create(init.vm, init.owner, init.owner->m_nativeErrorStructure.get(), init.owner->m_nativeErrorPrototypeStructure.get(), ASCIILiteral("URIError"))); 594 }); 444 Structure* nativeErrorPrototypeStructure = NativeErrorPrototype::createStructure(vm, this, m_errorPrototype.get()); 445 Structure* nativeErrorStructure = NativeErrorConstructor::createStructure(vm, this, m_functionPrototype.get()); 446 m_evalErrorConstructor.set(vm, this, NativeErrorConstructor::create(vm, this, nativeErrorStructure, nativeErrorPrototypeStructure, ASCIILiteral("EvalError"))); 447 m_rangeErrorConstructor.set(vm, this, NativeErrorConstructor::create(vm, this, nativeErrorStructure, nativeErrorPrototypeStructure, ASCIILiteral("RangeError"))); 448 m_referenceErrorConstructor.set(vm, this, NativeErrorConstructor::create(vm, this, nativeErrorStructure, nativeErrorPrototypeStructure, ASCIILiteral("ReferenceError"))); 449 m_syntaxErrorConstructor.set(vm, this, NativeErrorConstructor::create(vm, this, nativeErrorStructure, nativeErrorPrototypeStructure, ASCIILiteral("SyntaxError"))); 450 m_typeErrorConstructor.set(vm, this, NativeErrorConstructor::create(vm, this, nativeErrorStructure, nativeErrorPrototypeStructure, ASCIILiteral("TypeError"))); 451 m_URIErrorConstructor.set(vm, this, NativeErrorConstructor::create(vm, this, nativeErrorStructure, nativeErrorPrototypeStructure, ASCIILiteral("URIError"))); 595 452 596 453 m_generatorFunctionPrototype.set(vm, this, GeneratorFunctionPrototype::create(vm, GeneratorFunctionPrototype::createStructure(vm, this, m_functionPrototype.get()))); … … 611 468 putDirectWithoutTransition(vm, vm.propertyNames->Array, arrayConstructor, DontEnum); 612 469 putDirectWithoutTransition(vm, vm.propertyNames->RegExp, m_regExpConstructor.get(), DontEnum); 470 putDirectWithoutTransition(vm, vm.propertyNames->EvalError, m_evalErrorConstructor.get(), DontEnum); 613 471 putDirectWithoutTransition(vm, vm.propertyNames->RangeError, m_rangeErrorConstructor.get(), DontEnum); 472 putDirectWithoutTransition(vm, vm.propertyNames->ReferenceError, m_referenceErrorConstructor.get(), DontEnum); 473 putDirectWithoutTransition(vm, vm.propertyNames->SyntaxError, m_syntaxErrorConstructor.get(), DontEnum); 614 474 putDirectWithoutTransition(vm, vm.propertyNames->TypeError, m_typeErrorConstructor.get(), DontEnum); 615 616 putDirectWithoutTransition(vm, vm.propertyNames->ObjectPrivateName, objectConstructor, DontEnum | DontDelete | ReadOnly); 617 putDirectWithoutTransition(vm, vm.propertyNames->ArrayPrivateName, arrayConstructor, DontEnum | DontDelete | ReadOnly); 618 475 putDirectWithoutTransition(vm, vm.propertyNames->URIError, m_URIErrorConstructor.get(), DontEnum); 476 477 putDirectWithoutTransition(vm, vm.propertyNames->Proxy, ProxyConstructor::create(vm, ProxyConstructor::createStructure(vm, this, m_functionPrototype.get())), DontEnum); 478 479 619 480 #define PUT_CONSTRUCTOR_FOR_SIMPLE_TYPE(capitalName, lowerName, properName, instanceType, jsName) \ 620 481 putDirectWithoutTransition(vm, vm.propertyNames-> jsName, lowerName ## Constructor, DontEnum); \ … … 632 493 putDirectWithoutTransition(vm, vm.propertyNames->Intl, intl, DontEnum); 633 494 #endif // ENABLE(INTL) 495 putDirectWithoutTransition(vm, vm.propertyNames->JSON, JSONObject::create(vm, JSONObject::createStructure(vm, this, m_objectPrototype.get())), DontEnum); 496 putDirectWithoutTransition(vm, vm.propertyNames->Math, MathObject::create(vm, this, MathObject::createStructure(vm, this, m_objectPrototype.get())), DontEnum); 634 497 ReflectObject* reflectObject = ReflectObject::create(vm, this, ReflectObject::createStructure(vm, this, m_objectPrototype.get())); 635 498 putDirectWithoutTransition(vm, vm.propertyNames->Reflect, reflectObject, DontEnum); 636 499 637 500 putDirectWithoutTransition(vm, vm.propertyNames->console, ConsoleObject::create(vm, this, ConsoleObject::createStructure(vm, this, m_objectPrototype.get())), DontEnum); 501 502 JSTypedArrayViewConstructor* typedArraySuperConstructor = JSTypedArrayViewConstructor::create(vm, this, JSTypedArrayViewConstructor::createStructure(vm, this, m_functionPrototype.get()), typedArrayProto, speciesGetterSetter); 503 typedArrayProto->putDirectWithoutTransition(vm, vm.propertyNames->constructor, typedArraySuperConstructor, DontEnum); 504 505 m_typedArrays[toIndex(TypeInt8)].constructor.set(vm , this, JSInt8ArrayConstructor::create(vm, this, JSInt8ArrayConstructor::createStructure(vm, this, typedArraySuperConstructor), m_typedArrays[toIndex(TypeInt8)].prototype.get(), ASCIILiteral("Int8Array"), typedArrayConstructorAllocateInt8ArrayCodeGenerator(vm))); 506 m_typedArrays[toIndex(TypeInt16)].constructor.set(vm, this, JSInt16ArrayConstructor::create(vm, this, JSInt16ArrayConstructor::createStructure(vm, this, typedArraySuperConstructor), m_typedArrays[toIndex(TypeInt16)].prototype.get(), ASCIILiteral("Int16Array"), typedArrayConstructorAllocateInt16ArrayCodeGenerator(vm))); 507 m_typedArrays[toIndex(TypeInt32)].constructor.set(vm, this, JSInt32ArrayConstructor::create(vm, this, JSInt32ArrayConstructor::createStructure(vm, this, typedArraySuperConstructor), m_typedArrays[toIndex(TypeInt32)].prototype.get(), ASCIILiteral("Int32Array"), typedArrayConstructorAllocateInt32ArrayCodeGenerator(vm))); 508 m_typedArrays[toIndex(TypeUint8)].constructor.set(vm, this, JSUint8ArrayConstructor::create(vm, this, JSUint8ArrayConstructor::createStructure(vm, this, typedArraySuperConstructor), m_typedArrays[toIndex(TypeUint8)].prototype.get(), ASCIILiteral("Uint8Array"), typedArrayConstructorAllocateUint8ArrayCodeGenerator(vm))); 509 m_typedArrays[toIndex(TypeUint8Clamped)].constructor.set(vm, this, JSUint8ClampedArrayConstructor::create(vm, this, JSUint8ClampedArrayConstructor::createStructure(vm, this, typedArraySuperConstructor), m_typedArrays[toIndex(TypeUint8Clamped)].prototype.get(), ASCIILiteral("Uint8ClampedArray"), typedArrayConstructorAllocateUint8ClampedArrayCodeGenerator(vm))); 510 m_typedArrays[toIndex(TypeUint16)].constructor.set(vm, this, JSUint16ArrayConstructor::create(vm, this, JSUint16ArrayConstructor::createStructure(vm, this, typedArraySuperConstructor), m_typedArrays[toIndex(TypeUint16)].prototype.get(), ASCIILiteral("Uint16Array"), typedArrayConstructorAllocateUint16ArrayCodeGenerator(vm))); 511 m_typedArrays[toIndex(TypeUint32)].constructor.set(vm, this, JSUint32ArrayConstructor::create(vm, this, JSUint32ArrayConstructor::createStructure(vm, this, typedArraySuperConstructor), m_typedArrays[toIndex(TypeUint32)].prototype.get(), ASCIILiteral("Uint32Array"), typedArrayConstructorAllocateUint32ArrayCodeGenerator(vm))); 512 m_typedArrays[toIndex(TypeFloat32)].constructor.set(vm, this, JSFloat32ArrayConstructor::create(vm, this, JSFloat32ArrayConstructor::createStructure(vm, this, typedArraySuperConstructor), m_typedArrays[toIndex(TypeFloat32)].prototype.get(), ASCIILiteral("Float32Array"), typedArrayConstructorAllocateFloat32ArrayCodeGenerator(vm))); 513 m_typedArrays[toIndex(TypeFloat64)].constructor.set(vm, this, JSFloat64ArrayConstructor::create(vm, this, JSFloat64ArrayConstructor::createStructure(vm, this, typedArraySuperConstructor), m_typedArrays[toIndex(TypeFloat64)].prototype.get(), ASCIILiteral("Float64Array"), typedArrayConstructorAllocateFloat64ArrayCodeGenerator(vm))); 514 m_typedArrays[toIndex(TypeDataView)].constructor.set(vm, this, JSDataViewConstructor::create(vm, this, JSDataViewConstructor::createStructure(vm, this, m_functionPrototype.get()), m_typedArrays[toIndex(TypeDataView)].prototype.get(), ASCIILiteral("DataView"), nullptr)); 515 516 for (unsigned typedArrayIndex = NUMBER_OF_TYPED_ARRAY_TYPES; typedArrayIndex--;) { 517 m_typedArrays[typedArrayIndex].prototype->putDirectWithoutTransition(vm, vm.propertyNames->constructor, m_typedArrays[typedArrayIndex].constructor.get(), DontEnum); 518 putDirectWithoutTransition(vm, Identifier::fromString(exec, m_typedArrays[typedArrayIndex].constructor.get()->name(exec)), m_typedArrays[typedArrayIndex].constructor.get(), DontEnum); 519 } 520 521 putDirectWithoutTransition(vm, vm.propertyNames->Int8ArrayPrivateName, m_typedArrays[toIndex(TypeInt8)].constructor.get(), DontEnum); 522 putDirectWithoutTransition(vm, vm.propertyNames->Int16ArrayPrivateName, m_typedArrays[toIndex(TypeInt16)].constructor.get(), DontEnum); 523 putDirectWithoutTransition(vm, vm.propertyNames->Int32ArrayPrivateName, m_typedArrays[toIndex(TypeInt32)].constructor.get(), DontEnum); 524 putDirectWithoutTransition(vm, vm.propertyNames->Uint8ArrayPrivateName, m_typedArrays[toIndex(TypeUint8)].constructor.get(), DontEnum); 525 putDirectWithoutTransition(vm, vm.propertyNames->Uint8ClampedArrayPrivateName, m_typedArrays[toIndex(TypeUint8Clamped)].constructor.get(), DontEnum); 526 putDirectWithoutTransition(vm, vm.propertyNames->Uint16ArrayPrivateName, m_typedArrays[toIndex(TypeUint16)].constructor.get(), DontEnum); 527 putDirectWithoutTransition(vm, vm.propertyNames->Uint32ArrayPrivateName, m_typedArrays[toIndex(TypeUint32)].constructor.get(), DontEnum); 528 putDirectWithoutTransition(vm, vm.propertyNames->Float32ArrayPrivateName, m_typedArrays[toIndex(TypeFloat32)].constructor.get(), DontEnum); 529 putDirectWithoutTransition(vm, vm.propertyNames->Float64ArrayPrivateName, m_typedArrays[toIndex(TypeFloat64)].constructor.get(), DontEnum); 638 530 639 531 m_moduleLoader.set(vm, this, ModuleLoaderObject::create(vm, this, ModuleLoaderObject::createStructure(vm, this, m_objectPrototype.get()))); … … 989 881 } 990 882 883 void JSGlobalObject::createThrowTypeError(VM& vm) 884 { 885 JSFunction* thrower = JSFunction::create(vm, this, 0, String(), globalFuncThrowTypeError); 886 GetterSetter* getterSetter = GetterSetter::create(vm, this); 887 getterSetter->setGetter(vm, this, thrower); 888 getterSetter->setSetter(vm, this, thrower); 889 m_throwTypeErrorGetterSetter.set(vm, this, getterSetter); 890 } 891 892 void JSGlobalObject::createThrowTypeErrorArgumentsAndCaller(VM& vm) 893 { 894 JSFunction* thrower = JSFunction::create(vm, this, 0, String(), globalFuncThrowTypeErrorArgumentsAndCaller); 895 GetterSetter* getterSetter = GetterSetter::create(vm, this); 896 getterSetter->setGetter(vm, this, thrower); 897 getterSetter->setSetter(vm, this, thrower); 898 m_throwTypeErrorArgumentsAndCallerGetterSetter.set(vm, this, getterSetter); 899 } 900 991 901 // Set prototype, and also insert the object prototype at the end of the chain. 992 902 void JSGlobalObject::resetPrototype(VM& vm, JSValue prototype) … … 1015 925 visitor.append(&thisObject->m_regExpConstructor); 1016 926 visitor.append(&thisObject->m_errorConstructor); 1017 visitor.append(&thisObject->m_nativeErrorPrototypeStructure); 1018 visitor.append(&thisObject->m_nativeErrorStructure); 1019 thisObject->m_evalErrorConstructor.visit(visitor); 927 visitor.append(&thisObject->m_evalErrorConstructor); 1020 928 visitor.append(&thisObject->m_rangeErrorConstructor); 1021 thisObject->m_referenceErrorConstructor.visit(visitor);1022 thisObject->m_syntaxErrorConstructor.visit(visitor);929 visitor.append(&thisObject->m_referenceErrorConstructor); 930 visitor.append(&thisObject->m_syntaxErrorConstructor); 1023 931 visitor.append(&thisObject->m_typeErrorConstructor); 1024 thisObject->m_URIErrorConstructor.visit(visitor);932 visitor.append(&thisObject->m_URIErrorConstructor); 1025 933 visitor.append(&thisObject->m_objectConstructor); 1026 934 visitor.append(&thisObject->m_promiseConstructor); 935 visitor.append(&thisObject->m_internalPromiseConstructor); 1027 936 1028 937 visitor.append(&thisObject->m_nullGetterFunction); … … 1034 943 visitor.append(&thisObject->m_applyFunction); 1035 944 visitor.append(&thisObject->m_definePropertyFunction); 1036 thisObject->m_arrayProtoValuesFunction.visit(visitor);1037 thisObject->m_initializePromiseFunction.visit(visitor);945 visitor.append(&thisObject->m_arrayProtoValuesFunction); 946 visitor.append(&thisObject->m_initializePromiseFunction); 1038 947 visitor.append(&thisObject->m_newPromiseCapabilityFunction); 1039 948 visitor.append(&thisObject->m_functionProtoHasInstanceSymbolFunction); 1040 thisObject->m_throwTypeErrorGetterSetter.visit(visitor);1041 thisObject->m_throwTypeErrorArgumentsAndCallerGetterSetter.visit(visitor);949 visitor.append(&thisObject->m_throwTypeErrorGetterSetter); 950 visitor.append(&thisObject->m_throwTypeErrorArgumentsAndCallerGetterSetter); 1042 951 visitor.append(&thisObject->m_moduleLoader); 1043 952 … … 1050 959 visitor.append(&thisObject->m_generatorPrototype); 1051 960 1052 thisObject->m_debuggerScopeStructure.visit(visitor);1053 thisObject->m_withScopeStructure.visit(visitor);961 visitor.append(&thisObject->m_debuggerScopeStructure); 962 visitor.append(&thisObject->m_withScopeStructure); 1054 963 visitor.append(&thisObject->m_strictEvalActivationStructure); 1055 964 visitor.append(&thisObject->m_lexicalEnvironmentStructure); 1056 thisObject->m_moduleEnvironmentStructure.visit(visitor);965 visitor.append(&thisObject->m_moduleEnvironmentStructure); 1057 966 visitor.append(&thisObject->m_directArgumentsStructure); 1058 967 visitor.append(&thisObject->m_scopedArgumentsStructure); … … 1062 971 for (unsigned i = 0; i < NumberOfIndexingShapes; ++i) 1063 972 visitor.append(&thisObject->m_arrayStructureForIndexingShapeDuringAllocation[i]); 1064 thisObject->m_callbackConstructorStructure.visit(visitor); 1065 thisObject->m_callbackFunctionStructure.visit(visitor); 1066 thisObject->m_callbackObjectStructure.visit(visitor); 973 visitor.append(&thisObject->m_booleanObjectStructure); 974 visitor.append(&thisObject->m_callbackConstructorStructure); 975 visitor.append(&thisObject->m_callbackFunctionStructure); 976 visitor.append(&thisObject->m_callbackObjectStructure); 1067 977 visitor.append(&thisObject->m_propertyNameIteratorStructure); 1068 978 #if JSC_OBJC_API_ENABLED 1069 thisObject->m_objcCallbackFunctionStructure.visit(visitor);1070 thisObject->m_objcWrapperObjectStructure.visit(visitor);979 visitor.append(&thisObject->m_objcCallbackFunctionStructure); 980 visitor.append(&thisObject->m_objcWrapperObjectStructure); 1071 981 #endif 1072 thisObject->m_nullPrototypeObjectStructure.visit(visitor);982 visitor.append(&thisObject->m_nullPrototypeObjectStructure); 1073 983 visitor.append(&thisObject->m_errorStructure); 1074 984 visitor.append(&thisObject->m_calleeStructure); 1075 985 visitor.append(&thisObject->m_functionStructure); 1076 thisObject->m_boundSlotBaseFunctionStructure.visit(visitor);1077 thisObject->m_boundFunctionStructure.visit(visitor);986 visitor.append(&thisObject->m_boundSlotBaseFunctionStructure); 987 visitor.append(&thisObject->m_boundFunctionStructure); 1078 988 visitor.append(&thisObject->m_getterSetterStructure); 1079 thisObject->m_nativeStdFunctionStructure.visit(visitor);1080 thisObject->m_namedFunctionStructure.visit(visitor);989 visitor.append(&thisObject->m_nativeStdFunctionStructure); 990 visitor.append(&thisObject->m_namedFunctionStructure); 1081 991 visitor.append(&thisObject->m_symbolObjectStructure); 1082 992 visitor.append(&thisObject->m_regExpStructure); … … 1088 998 visitor.append(&thisObject->m_moduleNamespaceObjectStructure); 1089 999 visitor.append(&thisObject->m_dollarVMStructure); 1000 visitor.append(&thisObject->m_internalFunctionStructure); 1090 1001 visitor.append(&thisObject->m_proxyObjectStructure); 1091 1002 visitor.append(&thisObject->m_callableProxyObjectStructure); … … 1100 1011 1101 1012 FOR_EACH_SIMPLE_BUILTIN_TYPE(VISIT_SIMPLE_TYPE) 1013 FOR_EACH_BUILTIN_DERIVED_ITERATOR_TYPE(VISIT_SIMPLE_TYPE) 1102 1014 1103 1015 #undef VISIT_SIMPLE_TYPE 1104 1016 1105 #define VISIT_LAZY_TYPE(CapitalName, lowerName, properName, instanceType, jsName) \ 1106 thisObject->m_ ## properName ## Structure.visit(visitor); 1107 1108 FOR_EACH_LAZY_BUILTIN_TYPE(VISIT_LAZY_TYPE) 1109 FOR_EACH_BUILTIN_DERIVED_ITERATOR_TYPE(VISIT_LAZY_TYPE) 1110 1111 #undef VISIT_LAZY_TYPE 1112 1113 for (unsigned i = NUMBER_OF_TYPED_ARRAY_TYPES; i--;) 1114 thisObject->lazyTypedArrayStructure(indexToTypedArrayType(i)).visit(visitor); 1115 1116 visitor.append(&thisObject->m_speciesGetterSetter); 1117 thisObject->m_typedArrayProto.visit(visitor); 1118 thisObject->m_typedArraySuperConstructor.visit(visitor); 1017 for (unsigned i = NUMBER_OF_TYPED_ARRAY_TYPES; i--;) { 1018 visitor.append(&thisObject->m_typedArrays[i].prototype); 1019 visitor.append(&thisObject->m_typedArrays[i].constructor); 1020 visitor.append(&thisObject->m_typedArrays[i].structure); 1021 } 1119 1022 } 1120 1023 … … 1158 1061 { 1159 1062 JSGlobalObject* thisObject = jsCast<JSGlobalObject*>(object); 1160 if (getStatic PropertySlot<JSGlobalObject,Base>(exec, globalObjectTable, thisObject, propertyName, slot))1063 if (getStaticFunctionSlot<Base>(exec, globalObjectTable, thisObject, propertyName, slot)) 1161 1064 return true; 1162 1065 return symbolTableGet(thisObject, propertyName, slot); -
trunk/Source/JavaScriptCore/runtime/JSGlobalObject.h
r200383 r200416 32 32 #include "JSSegmentedVariableObject.h" 33 33 #include "JSWeakObjectMapRefInternal.h" 34 #include "LazyProperty.h"35 #include "LazyClassStructure.h"36 34 #include "NumberPrototype.h" 37 35 #include "RuntimeFlags.h" … … 78 76 class JSPromisePrototype; 79 77 class JSStack; 80 class JSTypedArrayViewConstructor;81 class JSTypedArrayViewPrototype;82 78 class LLIntOffsetsExtractor; 83 79 class Microtask; … … 102 98 103 99 #define FOR_EACH_SIMPLE_BUILTIN_TYPE_WITH_CONSTRUCTOR(macro) \ 100 macro(Set, set, set, JSSet, Set) \ 101 macro(Map, map, map, JSMap, Map) \ 102 macro(Date, date, date, DateInstance, Date) \ 104 103 macro(String, string, stringObject, StringObject, String) \ 105 104 macro(Symbol, symbol, symbolObject, SymbolObject, Symbol) \ 105 macro(Boolean, boolean, booleanObject, BooleanObject, Boolean) \ 106 106 macro(Number, number, numberObject, NumberObject, Number) \ 107 107 macro(Error, error, error, ErrorInstance, Error) \ 108 macro(Map, map, map, JSMap, Map) \109 108 macro(JSPromise, promise, promise, JSPromise, Promise) \ 110 109 macro(JSArrayBuffer, arrayBuffer, arrayBuffer, JSArrayBuffer, ArrayBuffer) \ 110 DEFINE_STANDARD_BUILTIN(macro, WeakMap, weakMap) \ 111 DEFINE_STANDARD_BUILTIN(macro, WeakSet, weakSet) \ 111 112 112 113 #define FOR_EACH_BUILTIN_DERIVED_ITERATOR_TYPE(macro) \ … … 124 125 macro(JSInternalPromise, internalPromise, internalPromise, JSInternalPromise, InternalPromise) \ 125 126 126 #define FOR_EACH_LAZY_BUILTIN_TYPE(macro) \127 macro(Set, set, set, JSSet, Set) \128 macro(Date, date, date, DateInstance, Date) \129 macro(Boolean, boolean, booleanObject, BooleanObject, Boolean) \130 DEFINE_STANDARD_BUILTIN(macro, WeakMap, weakMap) \131 DEFINE_STANDARD_BUILTIN(macro, WeakSet, weakSet) \132 133 127 #define DECLARE_SIMPLE_BUILTIN_TYPE(capitalName, lowerName, properName, instanceType, jsName) \ 134 128 class JS ## capitalName; \ … … 138 132 class IteratorPrototype; 139 133 FOR_EACH_SIMPLE_BUILTIN_TYPE(DECLARE_SIMPLE_BUILTIN_TYPE) 140 FOR_EACH_LAZY_BUILTIN_TYPE(DECLARE_SIMPLE_BUILTIN_TYPE)141 134 FOR_EACH_BUILTIN_DERIVED_ITERATOR_TYPE(DECLARE_SIMPLE_BUILTIN_TYPE) 142 135 143 136 #undef DECLARE_SIMPLE_BUILTIN_TYPE 144 145 class JSInternalPromise;146 class InternalPromisePrototype;147 class InternalPromiseConstructor;148 137 149 138 typedef Vector<ExecState*, 16> ExecStateStack; … … 209 198 }; 210 199 211 // Our hashtable code-generator tries to access these properties, so we make them public. 212 // However, we'd like it better if they could be protected. 213 public: 214 template<typename T> using Initializer = typename LazyProperty<JSGlobalObject, T>::Initializer; 215 200 protected: 216 201 Register m_globalCallFrame[JSStack::CallFrameHeaderSize]; 217 202 … … 222 207 WriteBarrier<RegExpConstructor> m_regExpConstructor; 223 208 WriteBarrier<ErrorConstructor> m_errorConstructor; 224 WriteBarrier<Structure> m_nativeErrorPrototypeStructure; 225 WriteBarrier<Structure> m_nativeErrorStructure; 226 LazyProperty<JSGlobalObject, NativeErrorConstructor> m_evalErrorConstructor; 209 WriteBarrier<NativeErrorConstructor> m_evalErrorConstructor; 227 210 WriteBarrier<NativeErrorConstructor> m_rangeErrorConstructor; 228 LazyProperty<JSGlobalObject,NativeErrorConstructor> m_referenceErrorConstructor;229 LazyProperty<JSGlobalObject,NativeErrorConstructor> m_syntaxErrorConstructor;211 WriteBarrier<NativeErrorConstructor> m_referenceErrorConstructor; 212 WriteBarrier<NativeErrorConstructor> m_syntaxErrorConstructor; 230 213 WriteBarrier<NativeErrorConstructor> m_typeErrorConstructor; 231 LazyProperty<JSGlobalObject,NativeErrorConstructor> m_URIErrorConstructor;214 WriteBarrier<NativeErrorConstructor> m_URIErrorConstructor; 232 215 WriteBarrier<ObjectConstructor> m_objectConstructor; 233 216 WriteBarrier<JSPromiseConstructor> m_promiseConstructor; … … 243 226 WriteBarrier<JSFunction> m_applyFunction; 244 227 WriteBarrier<JSFunction> m_definePropertyFunction; 245 LazyProperty<JSGlobalObject,JSFunction> m_arrayProtoValuesFunction;246 LazyProperty<JSGlobalObject,JSFunction> m_initializePromiseFunction;228 WriteBarrier<JSFunction> m_arrayProtoValuesFunction; 229 WriteBarrier<JSFunction> m_initializePromiseFunction; 247 230 WriteBarrier<JSFunction> m_newPromiseCapabilityFunction; 248 231 WriteBarrier<JSFunction> m_functionProtoHasInstanceSymbolFunction; 249 LazyProperty<JSGlobalObject, GetterSetter> m_throwTypeErrorGetterSetter;250 232 WriteBarrier<JSObject> m_regExpProtoExec; 251 233 WriteBarrier<JSObject> m_regExpProtoSymbolReplace; 252 234 WriteBarrier<JSObject> m_regExpProtoGlobalGetter; 253 235 WriteBarrier<JSObject> m_regExpProtoUnicodeGetter; 254 LazyProperty<JSGlobalObject, GetterSetter> m_throwTypeErrorArgumentsAndCallerGetterSetter; 236 WriteBarrier<GetterSetter> m_throwTypeErrorGetterSetter; 237 WriteBarrier<GetterSetter> m_throwTypeErrorArgumentsAndCallerGetterSetter; 255 238 256 239 WriteBarrier<ModuleLoaderObject> m_moduleLoader; … … 264 247 WriteBarrier<GeneratorPrototype> m_generatorPrototype; 265 248 266 LazyProperty<JSGlobalObject,Structure> m_debuggerScopeStructure;267 LazyProperty<JSGlobalObject,Structure> m_withScopeStructure;249 WriteBarrier<Structure> m_debuggerScopeStructure; 250 WriteBarrier<Structure> m_withScopeStructure; 268 251 WriteBarrier<Structure> m_strictEvalActivationStructure; 269 252 WriteBarrier<Structure> m_lexicalEnvironmentStructure; 270 LazyProperty<JSGlobalObject,Structure> m_moduleEnvironmentStructure;253 WriteBarrier<Structure> m_moduleEnvironmentStructure; 271 254 WriteBarrier<Structure> m_directArgumentsStructure; 272 255 WriteBarrier<Structure> m_scopedArgumentsStructure; … … 279 262 WriteBarrier<Structure> m_arrayStructureForIndexingShapeDuringAllocation[NumberOfIndexingShapes]; 280 263 281 LazyProperty<JSGlobalObject,Structure> m_callbackConstructorStructure;282 LazyProperty<JSGlobalObject,Structure> m_callbackFunctionStructure;283 LazyProperty<JSGlobalObject,Structure> m_callbackObjectStructure;264 WriteBarrier<Structure> m_callbackConstructorStructure; 265 WriteBarrier<Structure> m_callbackFunctionStructure; 266 WriteBarrier<Structure> m_callbackObjectStructure; 284 267 WriteBarrier<Structure> m_propertyNameIteratorStructure; 285 268 #if JSC_OBJC_API_ENABLED 286 LazyProperty<JSGlobalObject,Structure> m_objcCallbackFunctionStructure;287 LazyProperty<JSGlobalObject,Structure> m_objcWrapperObjectStructure;269 WriteBarrier<Structure> m_objcCallbackFunctionStructure; 270 WriteBarrier<Structure> m_objcWrapperObjectStructure; 288 271 #endif 289 LazyProperty<JSGlobalObject,Structure> m_nullPrototypeObjectStructure;272 WriteBarrier<Structure> m_nullPrototypeObjectStructure; 290 273 WriteBarrier<Structure> m_calleeStructure; 291 274 WriteBarrier<Structure> m_functionStructure; 292 LazyProperty<JSGlobalObject,Structure> m_boundFunctionStructure;293 LazyProperty<JSGlobalObject,Structure> m_boundSlotBaseFunctionStructure;275 WriteBarrier<Structure> m_boundFunctionStructure; 276 WriteBarrier<Structure> m_boundSlotBaseFunctionStructure; 294 277 WriteBarrier<Structure> m_getterSetterStructure; 295 LazyProperty<JSGlobalObject,Structure> m_nativeStdFunctionStructure;296 LazyProperty<JSGlobalObject,Structure> m_namedFunctionStructure;278 WriteBarrier<Structure> m_nativeStdFunctionStructure; 279 WriteBarrier<Structure> m_namedFunctionStructure; 297 280 PropertyOffset m_functionNameOffset; 298 281 WriteBarrier<Structure> m_privateNameStructure; … … 300 283 WriteBarrier<Structure> m_generatorFunctionStructure; 301 284 WriteBarrier<Structure> m_dollarVMStructure; 285 WriteBarrier<Structure> m_internalFunctionStructure; 302 286 WriteBarrier<Structure> m_iteratorResultObjectStructure; 303 287 WriteBarrier<Structure> m_regExpMatchesArrayStructure; … … 317 301 318 302 FOR_EACH_SIMPLE_BUILTIN_TYPE(DEFINE_STORAGE_FOR_SIMPLE_TYPE) 303 FOR_EACH_BUILTIN_DERIVED_ITERATOR_TYPE(DEFINE_STORAGE_FOR_SIMPLE_TYPE) 319 304 320 305 #undef DEFINE_STORAGE_FOR_SIMPLE_TYPE 321 306 322 #define DEFINE_STORAGE_FOR_ITERATOR_TYPE(capitalName, lowerName, properName, instanceType, jsName) \ 323 LazyProperty<JSGlobalObject, Structure> m_ ## properName ## Structure; 324 FOR_EACH_BUILTIN_DERIVED_ITERATOR_TYPE(DEFINE_STORAGE_FOR_ITERATOR_TYPE) 325 #undef DEFINE_STORAGE_FOR_ITERATOR_TYPE 307 struct TypedArrayData { 308 WriteBarrier<JSObject> prototype; 309 WriteBarrier<InternalFunction> constructor; 310 WriteBarrier<Structure> structure; 311 }; 326 312 327 #define DEFINE_STORAGE_FOR_LAZY_TYPE(capitalName, lowerName, properName, instanceType, jsName) \ 328 LazyClassStructure m_ ## properName ## Structure; 329 FOR_EACH_LAZY_BUILTIN_TYPE(DEFINE_STORAGE_FOR_LAZY_TYPE) 330 #undef DEFINE_STORAGE_FOR_LAZY_TYPE 331 332 WriteBarrier<GetterSetter> m_speciesGetterSetter; 333 334 LazyProperty<JSGlobalObject, JSTypedArrayViewPrototype> m_typedArrayProto; 335 LazyProperty<JSGlobalObject, JSTypedArrayViewConstructor> m_typedArraySuperConstructor; 336 337 #define DECLARE_TYPED_ARRAY_TYPE_STRUCTURE(name) LazyClassStructure m_typedArray ## name; 338 FOR_EACH_TYPED_ARRAY_TYPE(DECLARE_TYPED_ARRAY_TYPE_STRUCTURE) 339 #undef DECLARE_TYPED_ARRAY_TYPE_STRUCTURE 313 std::array<TypedArrayData, NUMBER_OF_TYPED_ARRAY_TYPES> m_typedArrays; 340 314 341 315 JSCell* m_specialPointers[Special::TableSize]; // Special pointers used by the LLInt and JIT. … … 464 438 JSPromiseConstructor* promiseConstructor() const { return m_promiseConstructor.get(); } 465 439 JSInternalPromiseConstructor* internalPromiseConstructor() const { return m_internalPromiseConstructor.get(); } 466 NativeErrorConstructor* evalErrorConstructor() const { return m_evalErrorConstructor.get( this); }440 NativeErrorConstructor* evalErrorConstructor() const { return m_evalErrorConstructor.get(); } 467 441 NativeErrorConstructor* rangeErrorConstructor() const { return m_rangeErrorConstructor.get(); } 468 NativeErrorConstructor* referenceErrorConstructor() const { return m_referenceErrorConstructor.get( this); }469 NativeErrorConstructor* syntaxErrorConstructor() const { return m_syntaxErrorConstructor.get( this); }442 NativeErrorConstructor* referenceErrorConstructor() const { return m_referenceErrorConstructor.get(); } 443 NativeErrorConstructor* syntaxErrorConstructor() const { return m_syntaxErrorConstructor.get(); } 470 444 NativeErrorConstructor* typeErrorConstructor() const { return m_typeErrorConstructor.get(); } 471 NativeErrorConstructor* URIErrorConstructor() const { return m_URIErrorConstructor.get( this); }445 NativeErrorConstructor* URIErrorConstructor() const { return m_URIErrorConstructor.get(); } 472 446 473 447 NullGetterFunction* nullGetterFunction() const { return m_nullGetterFunction.get(); } … … 480 454 JSFunction* applyFunction() const { return m_applyFunction.get(); } 481 455 JSFunction* definePropertyFunction() const { return m_definePropertyFunction.get(); } 482 JSFunction* arrayProtoValuesFunction() const { return m_arrayProtoValuesFunction.get( this); }483 JSFunction* initializePromiseFunction() const { return m_initializePromiseFunction.get( this); }456 JSFunction* arrayProtoValuesFunction() const { return m_arrayProtoValuesFunction.get(); } 457 JSFunction* initializePromiseFunction() const { return m_initializePromiseFunction.get(); } 484 458 JSFunction* newPromiseCapabilityFunction() const { return m_newPromiseCapabilityFunction.get(); } 485 459 JSFunction* functionProtoHasInstanceSymbolFunction() const { return m_functionProtoHasInstanceSymbolFunction.get(); } … … 488 462 JSObject* regExpProtoGlobalGetter() const { return m_regExpProtoGlobalGetter.get(); } 489 463 JSObject* regExpProtoUnicodeGetter() const { return m_regExpProtoUnicodeGetter.get(); } 490 GetterSetter* throwTypeErrorGetterSetter() 491 { 492 return m_throwTypeErrorGetterSetter.get(this); 493 } 494 495 GetterSetter* throwTypeErrorArgumentsAndCallerGetterSetter() 496 { 497 return m_throwTypeErrorArgumentsAndCallerGetterSetter.get(this); 464 GetterSetter* throwTypeErrorGetterSetter(VM& vm) 465 { 466 if (!m_throwTypeErrorGetterSetter) 467 createThrowTypeError(vm); 468 return m_throwTypeErrorGetterSetter.get(); 469 } 470 471 GetterSetter* throwTypeErrorArgumentsAndCallerGetterSetter(VM& vm) 472 { 473 if (!m_throwTypeErrorArgumentsAndCallerGetterSetter) 474 createThrowTypeErrorArgumentsAndCaller(vm); 475 return m_throwTypeErrorArgumentsAndCallerGetterSetter.get(); 498 476 } 499 477 … … 503 481 FunctionPrototype* functionPrototype() const { return m_functionPrototype.get(); } 504 482 ArrayPrototype* arrayPrototype() const { return m_arrayPrototype.get(); } 505 JSObject* booleanPrototype() const { return m_booleanObjectStructure.prototype(this); }483 BooleanPrototype* booleanPrototype() const { return m_booleanPrototype.get(); } 506 484 StringPrototype* stringPrototype() const { return m_stringPrototype.get(); } 507 485 SymbolPrototype* symbolPrototype() const { return m_symbolPrototype.get(); } 508 JSObject* numberPrototype() const { return m_numberPrototype.get(); }509 JSObject* datePrototype() const { return m_dateStructure.prototype(this); }486 NumberPrototype* numberPrototype() const { return m_numberPrototype.get(); } 487 DatePrototype* datePrototype() const { return m_datePrototype.get(); } 510 488 RegExpPrototype* regExpPrototype() const { return m_regExpPrototype.get(); } 511 489 ErrorPrototype* errorPrototype() const { return m_errorPrototype.get(); } … … 514 492 GeneratorPrototype* generatorPrototype() const { return m_generatorPrototype.get(); } 515 493 516 Structure* debuggerScopeStructure() const { return m_debuggerScopeStructure.get( this); }517 Structure* withScopeStructure() const { return m_withScopeStructure.get( this); }494 Structure* debuggerScopeStructure() const { return m_debuggerScopeStructure.get(); } 495 Structure* withScopeStructure() const { return m_withScopeStructure.get(); } 518 496 Structure* strictEvalActivationStructure() const { return m_strictEvalActivationStructure.get(); } 519 497 Structure* activationStructure() const { return m_lexicalEnvironmentStructure.get(); } 520 Structure* moduleEnvironmentStructure() const { return m_moduleEnvironmentStructure.get( this); }498 Structure* moduleEnvironmentStructure() const { return m_moduleEnvironmentStructure.get(); } 521 499 Structure* directArgumentsStructure() const { return m_directArgumentsStructure.get(); } 522 500 Structure* scopedArgumentsStructure() const { return m_scopedArgumentsStructure.get(); } … … 546 524 } 547 525 548 Structure* booleanObjectStructure() const { return m_booleanObjectStructure.get( this); }549 Structure* callbackConstructorStructure() const { return m_callbackConstructorStructure.get( this); }550 Structure* callbackFunctionStructure() const { return m_callbackFunctionStructure.get( this); }551 Structure* callbackObjectStructure() const { return m_callbackObjectStructure.get( this); }526 Structure* booleanObjectStructure() const { return m_booleanObjectStructure.get(); } 527 Structure* callbackConstructorStructure() const { return m_callbackConstructorStructure.get(); } 528 Structure* callbackFunctionStructure() const { return m_callbackFunctionStructure.get(); } 529 Structure* callbackObjectStructure() const { return m_callbackObjectStructure.get(); } 552 530 Structure* propertyNameIteratorStructure() const { return m_propertyNameIteratorStructure.get(); } 553 531 #if JSC_OBJC_API_ENABLED 554 Structure* objcCallbackFunctionStructure() const { return m_objcCallbackFunctionStructure.get( this); }555 Structure* objcWrapperObjectStructure() const { return m_objcWrapperObjectStructure.get( this); }532 Structure* objcCallbackFunctionStructure() const { return m_objcCallbackFunctionStructure.get(); } 533 Structure* objcWrapperObjectStructure() const { return m_objcWrapperObjectStructure.get(); } 556 534 #endif 557 Structure* dateStructure() const { return m_dateStructure.get( this); }558 Structure* nullPrototypeObjectStructure() const { return m_nullPrototypeObjectStructure.get( this); }535 Structure* dateStructure() const { return m_dateStructure.get(); } 536 Structure* nullPrototypeObjectStructure() const { return m_nullPrototypeObjectStructure.get(); } 559 537 Structure* errorStructure() const { return m_errorStructure.get(); } 560 538 Structure* calleeStructure() const { return m_calleeStructure.get(); } 561 539 Structure* functionStructure() const { return m_functionStructure.get(); } 562 Structure* boundFunctionStructure() const { return m_boundFunctionStructure.get( this); }563 Structure* boundSlotBaseFunctionStructure() const { return m_boundSlotBaseFunctionStructure.get( this); }540 Structure* boundFunctionStructure() const { return m_boundFunctionStructure.get(); } 541 Structure* boundSlotBaseFunctionStructure() const { return m_boundSlotBaseFunctionStructure.get(); } 564 542 Structure* getterSetterStructure() const { return m_getterSetterStructure.get(); } 565 Structure* nativeStdFunctionStructure() const { return m_nativeStdFunctionStructure.get( this); }566 Structure* namedFunctionStructure() const { return m_namedFunctionStructure.get( this); }543 Structure* nativeStdFunctionStructure() const { return m_nativeStdFunctionStructure.get(); } 544 Structure* namedFunctionStructure() const { return m_namedFunctionStructure.get(); } 567 545 PropertyOffset functionNameOffset() const { return m_functionNameOffset; } 568 546 Structure* numberObjectStructure() const { return m_numberObjectStructure.get(); } 569 547 Structure* privateNameStructure() const { return m_privateNameStructure.get(); } 548 Structure* internalFunctionStructure() const { return m_internalFunctionStructure.get(); } 570 549 Structure* mapStructure() const { return m_mapStructure.get(); } 571 550 Structure* regExpStructure() const { return m_regExpStructure.get(); } 572 551 Structure* generatorFunctionStructure() const { return m_generatorFunctionStructure.get(); } 573 Structure* setStructure() const { return m_setStructure.get( this); }552 Structure* setStructure() const { return m_setStructure.get(); } 574 553 Structure* stringObjectStructure() const { return m_stringObjectStructure.get(); } 575 554 Structure* symbolObjectStructure() const { return m_symbolObjectStructure.get(); } … … 616 595 617 596 FOR_EACH_SIMPLE_BUILTIN_TYPE(DEFINE_ACCESSORS_FOR_SIMPLE_TYPE) 597 FOR_EACH_BUILTIN_DERIVED_ITERATOR_TYPE(DEFINE_ACCESSORS_FOR_SIMPLE_TYPE) 618 598 619 599 #undef DEFINE_ACCESSORS_FOR_SIMPLE_TYPE 620 600 621 #define DEFINE_ACCESSORS_FOR_ITERATOR_TYPE(capitalName, lowerName, properName, instanceType, jsName) \622 Structure* properName ## Structure() { return m_ ## properName ## Structure.get(this); }623 624 FOR_EACH_BUILTIN_DERIVED_ITERATOR_TYPE(DEFINE_ACCESSORS_FOR_ITERATOR_TYPE)625 626 #undef DEFINE_ACCESSORS_FOR_ITERATOR_TYPE627 628 #define DEFINE_ACCESSORS_FOR_LAZY_TYPE(capitalName, lowerName, properName, instanceType, jsName) \629 Structure* properName ## Structure() { return m_ ## properName ## Structure.get(this); }630 631 FOR_EACH_LAZY_BUILTIN_TYPE(DEFINE_ACCESSORS_FOR_LAZY_TYPE)632 633 #undef DEFINE_ACCESSORS_FOR_LAZY_TYPE634 635 LazyClassStructure& lazyTypedArrayStructure(TypedArrayType type)636 {637 switch (type) {638 case NotTypedArray:639 RELEASE_ASSERT_NOT_REACHED();640 return m_typedArrayInt8;641 #define TYPED_ARRAY_TYPE_CASE(name) case Type ## name: return m_typedArray ## name;642 FOR_EACH_TYPED_ARRAY_TYPE(TYPED_ARRAY_TYPE_CASE)643 #undef TYPED_ARRAY_TYPE_CASE644 }645 RELEASE_ASSERT_NOT_REACHED();646 return m_typedArrayInt8;647 }648 const LazyClassStructure& lazyTypedArrayStructure(TypedArrayType type) const649 {650 return const_cast<const LazyClassStructure&>(const_cast<JSGlobalObject*>(this)->lazyTypedArrayStructure(type));651 }652 653 601 Structure* typedArrayStructure(TypedArrayType type) const 654 602 { 655 return lazyTypedArrayStructure(type).get(this); 656 } 657 Structure* typedArrayStructureConcurrently(TypedArrayType type) const 658 { 659 return lazyTypedArrayStructure(type).getConcurrently(); 603 return m_typedArrays[toIndex(type)].structure.get(); 660 604 } 661 605 bool isOriginalTypedArrayStructure(Structure* structure) … … 664 608 if (type == NotTypedArray) 665 609 return false; 666 return typedArrayStructure Concurrently(type) == structure;610 return typedArrayStructure(type) == structure; 667 611 } 668 612 669 613 JSObject* typedArrayConstructor(TypedArrayType type) const 670 614 { 671 return lazyTypedArrayStructure(type).constructor(this);615 return m_typedArrays[toIndex(type)].constructor.get(); 672 616 } 673 617 … … 796 740 JS_EXPORT_PRIVATE void init(VM&); 797 741 742 void createThrowTypeError(VM&); 743 void createThrowTypeErrorArgumentsAndCaller(VM&); 744 798 745 JS_EXPORT_PRIVATE static void clearRareData(JSCell*); 799 746 }; -
trunk/Source/JavaScriptCore/runtime/JSNativeStdFunction.cpp
r200383 r200416 1 1 /* 2 * Copyright (C) 2015 -2016Apple Inc. All rights reserved.2 * Copyright (C) 2015 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 69 69 NativeExecutable* executable = lookUpOrCreateNativeExecutable(vm, runStdFunction, intrinsic, nativeConstructor, name); 70 70 NativeStdFunctionCell* functionCell = NativeStdFunctionCell::create(vm, WTFMove(nativeStdFunction)); 71 Structure* structure = globalObject->nativeStdFunctionStructure(); 72 JSNativeStdFunction* function = new (NotNull, allocateCell<JSNativeStdFunction>(vm.heap)) JSNativeStdFunction(vm, globalObject, structure); 71 JSNativeStdFunction* function = new (NotNull, allocateCell<JSNativeStdFunction>(vm.heap)) JSNativeStdFunction(vm, globalObject, globalObject->nativeStdFunctionStructure()); 73 72 function->finishCreation(vm, executable, length, name, functionCell); 74 73 return function; -
trunk/Source/JavaScriptCore/runtime/JSWithScope.cpp
r200383 r200416 1 1 /* 2 * Copyright (C) 2012 , 2016Apple Inc. All Rights Reserved.2 * Copyright (C) 2012 Apple Inc. All Rights Reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 33 33 const ClassInfo JSWithScope::s_info = { "WithScope", &Base::s_info, 0, CREATE_METHOD_TABLE(JSWithScope) }; 34 34 35 JSWithScope* JSWithScope::create(36 VM& vm, JSGlobalObject* globalObject, JSObject* object, JSScope* next)37 {38 Structure* structure = globalObject->withScopeStructure();39 JSWithScope* withScope = new (NotNull, allocateCell<JSWithScope>(vm.heap)) JSWithScope(vm, structure, object, next);40 withScope->finishCreation(vm);41 return withScope;42 }43 44 35 void JSWithScope::visitChildren(JSCell* cell, SlotVisitor& visitor) 45 36 { … … 50 41 } 51 42 52 Structure* JSWithScope::createStructure(VM& vm, JSGlobalObject* globalObject, JSValue proto)53 {54 return Structure::create(vm, globalObject, proto, TypeInfo(WithScopeType, StructureFlags), info());55 }56 57 JSWithScope::JSWithScope(VM& vm, Structure* structure, JSObject* object, JSScope* next)58 : Base(vm, structure, next)59 , m_object(vm, this, object)60 {61 }62 63 43 } // namespace JSC -
trunk/Source/JavaScriptCore/runtime/JSWithScope.h
r200383 r200416 1 1 /* 2 * Copyright (C) 2012 , 2016Apple Inc. All Rights Reserved.2 * Copyright (C) 2012 Apple Inc. All Rights Reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 35 35 typedef JSScope Base; 36 36 37 JS_EXPORT_PRIVATE static JSWithScope* create(VM&, JSGlobalObject*, JSObject*, JSScope* next); 37 static JSWithScope* create(ExecState* exec, JSObject* object, JSScope* next) 38 { 39 JSWithScope* withScope = new (NotNull, allocateCell<JSWithScope>(*exec->heap())) JSWithScope(exec, object, next); 40 withScope->finishCreation(exec->vm()); 41 return withScope; 42 } 38 43 39 44 JSObject* object() { return m_object.get(); } … … 41 46 static void visitChildren(JSCell*, SlotVisitor&); 42 47 43 static Structure* createStructure(VM&, JSGlobalObject*, JSValue proto); 48 static Structure* createStructure(VM& vm, JSGlobalObject* globalObject, JSValue proto) 49 { 50 return Structure::create(vm, globalObject, proto, TypeInfo(WithScopeType, StructureFlags), info()); 51 } 44 52 45 53 DECLARE_EXPORT_INFO; 46 54 47 55 private: 48 JSWithScope(VM&, Structure*, JSObject*, JSScope* next); 56 JSWithScope(ExecState* exec, JSObject* object, JSScope* next) 57 : Base( 58 exec->vm(), 59 exec->lexicalGlobalObject()->withScopeStructure(), 60 next 61 ) 62 , m_object(exec->vm(), this, object) 63 { 64 } 49 65 50 66 WriteBarrier<JSObject> m_object; -
trunk/Source/JavaScriptCore/runtime/Lookup.cpp
r200383 r200416 1 1 /* 2 * Copyright (C) 2008, 2012, 2015 -2016Apple Inc. All rights reserved.2 * Copyright (C) 2008, 2012, 2015 Apple Inc. All rights reserved. 3 3 * 4 4 * This library is free software; you can redistribute it and/or … … 46 46 { 47 47 ASSERT(thisObj->globalObject()); 48 ASSERT(entry->attributes() & BuiltinOrFunctionOrAccessor OrLazyProperty);48 ASSERT(entry->attributes() & BuiltinOrFunctionOrAccessor); 49 49 VM& vm = exec->vm(); 50 50 unsigned attributes; … … 64 64 vm, thisObj->globalObject(), propertyName, entry->functionLength(), 65 65 entry->function(), entry->intrinsic(), attributesForStructure(entry->attributes())); 66 } else if (isAccessor) 66 } else { 67 ASSERT(isAccessor); 67 68 reifyStaticAccessor(vm, *entry, *thisObj, propertyName); 68 else if (entry->attributes() & CellProperty) { 69 LazyCellProperty* property = bitwise_cast<LazyCellProperty*>( 70 bitwise_cast<char*>(thisObj) + entry->lazyCellPropertyOffset()); 71 JSCell* result = property->get(thisObj); 72 thisObj->putDirect(vm, propertyName, result, attributesForStructure(entry->attributes())); 73 } else if (entry->attributes() & ClassStructure) { 74 LazyClassStructure* structure = bitwise_cast<LazyClassStructure*>( 75 bitwise_cast<char*>(thisObj) + entry->lazyClassStructureOffset()); 76 structure->get(jsCast<JSGlobalObject*>(thisObj)); 77 } else if (entry->attributes() & PropertyCallback) { 78 JSValue result = entry->lazyPropertyCallback()(vm, thisObj); 79 thisObj->putDirect(vm, propertyName, result, attributesForStructure(entry->attributes())); 80 } else 81 RELEASE_ASSERT_NOT_REACHED(); 69 } 82 70 83 71 offset = thisObj->getDirectOffset(vm, propertyName, attributes); 84 RELEASE_ASSERT(isValidOffset(offset));72 ASSERT(isValidOffset(offset)); 85 73 } 86 74 -
trunk/Source/JavaScriptCore/runtime/Lookup.h
r200406 r200416 1 1 /* 2 2 * Copyright (C) 1999-2000 Harri Porten (porten@kde.org) 3 * Copyright (C) 2003, 2006, 2007, 2008, 2009 , 2016Apple Inc. All rights reserved.3 * Copyright (C) 2003, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. 4 4 * 5 5 * This library is free software; you can redistribute it and/or … … 29 29 #include "Intrinsic.h" 30 30 #include "JSGlobalObject.h" 31 #include "LazyProperty.h"32 31 #include "PropertySlot.h" 33 32 #include "PutPropertySlot.h" … … 47 46 typedef PutPropertySlot::PutValueFunc PutFunction; 48 47 typedef FunctionExecutable* (*BuiltinGenerator)(VM&); 49 typedef JSValue (*LazyPropertyCallback)(VM&, JSObject*);50 48 51 49 // Hash table generated by the create_hash_table script. … … 77 75 unsigned char functionLength() const { ASSERT(m_attributes & Function); return static_cast<unsigned char>(m_values.value2); } 78 76 79 GetFunction propertyGetter() const { ASSERT(!(m_attributes & BuiltinOrFunctionOrAccessorOr LazyPropertyOrConstant)); return reinterpret_cast<GetFunction>(m_values.value1); }80 PutFunction propertyPutter() const { ASSERT(!(m_attributes & BuiltinOrFunctionOrAccessorOr LazyPropertyOrConstant)); return reinterpret_cast<PutFunction>(m_values.value2); }77 GetFunction propertyGetter() const { ASSERT(!(m_attributes & BuiltinOrFunctionOrAccessorOrConstant)); return reinterpret_cast<GetFunction>(m_values.value1); } 78 PutFunction propertyPutter() const { ASSERT(!(m_attributes & BuiltinOrFunctionOrAccessorOrConstant)); return reinterpret_cast<PutFunction>(m_values.value2); } 81 79 82 80 NativeFunction accessorGetter() const { ASSERT(m_attributes & Accessor); return reinterpret_cast<NativeFunction>(m_values.value1); } … … 88 86 89 87 intptr_t lexerValue() const { ASSERT(!m_attributes); return m_values.value1; } 90 91 ptrdiff_t lazyCellPropertyOffset() const { ASSERT(m_attributes & CellProperty); return m_values.value1; }92 ptrdiff_t lazyClassStructureOffset() const { ASSERT(m_attributes & ClassStructure); return m_values.value1; }93 LazyPropertyCallback lazyPropertyCallback() const { ASSERT(m_attributes & PropertyCallback); return reinterpret_cast<LazyPropertyCallback>(m_values.value1); }94 88 }; 95 89 … … 228 222 return false; 229 223 230 if (entry->attributes() & BuiltinOrFunctionOrAccessor OrLazyProperty)224 if (entry->attributes() & BuiltinOrFunctionOrAccessor) 231 225 return setUpStaticFunctionSlot(exec, entry, thisObj, propertyName, slot); 232 226 … … 278 272 return false; 279 273 280 ASSERT(!(entry->attributes() & BuiltinOrFunctionOrAccessor OrLazyProperty));274 ASSERT(!(entry->attributes() & BuiltinOrFunctionOrAccessor)); 281 275 282 276 if (entry->attributes() & ConstantInteger) { … … 294 288 inline bool putEntry(ExecState* exec, const HashTableValue* entry, JSObject* base, JSObject* thisValue, PropertyName propertyName, JSValue value, PutPropertySlot& slot) 295 289 { 296 if (entry->attributes() & BuiltinOrFunction OrLazyProperty) {290 if (entry->attributes() & BuiltinOrFunction) { 297 291 if (!(entry->attributes() & ReadOnly)) { 298 // If this is a function or lazy property put then we just do the put because 299 // logically the object already had the property, so this is just a replace. 292 // If this is a function put it as an override property. 300 293 if (JSObject* thisObject = jsDynamicCast<JSObject*>(thisValue)) 301 294 thisObject->putDirect(exec->vm(), propertyName, value); … … 368 361 return; 369 362 } 370 371 if (value.attributes() & CellProperty) {372 LazyCellProperty* property = bitwise_cast<LazyCellProperty*>(373 bitwise_cast<char*>(&thisObj) + value.lazyCellPropertyOffset());374 JSCell* result = property->get(&thisObj);375 thisObj.putDirect(vm, propertyName, result, attributesForStructure(value.attributes()));376 return;377 }378 379 if (value.attributes() & ClassStructure) {380 LazyClassStructure* structure = bitwise_cast<LazyClassStructure*>(381 bitwise_cast<char*>(&thisObj) + value.lazyClassStructureOffset());382 structure->get(jsCast<JSGlobalObject*>(&thisObj));383 return;384 }385 386 if (value.attributes() & PropertyCallback) {387 JSValue result = value.lazyPropertyCallback()(vm, &thisObj);388 thisObj.putDirect(vm, propertyName, result, attributesForStructure(value.attributes()));389 return;390 }391 363 392 364 CustomGetterSetter* customGetterSetter = CustomGetterSetter::create(vm, value.propertyGetter(), value.propertyPutter()); -
trunk/Source/JavaScriptCore/runtime/PropertySlot.h
r200406 r200416 1 1 /* 2 * Copyright (C) 2005, 2007, 2008, 2015 -2016Apple Inc. All rights reserved.2 * Copyright (C) 2005, 2007, 2008, 2015 Apple Inc. All rights reserved. 3 3 * 4 4 * This library is free software; you can redistribute it and/or … … 47 47 Builtin = 1 << 9, // property is a builtin function - only used by static hashtables 48 48 ConstantInteger = 1 << 10, // property is a constant integer - only used by static hashtables 49 CellProperty = 1 << 11, // property is a lazy property - only used by static hashtables50 ClassStructure = 1 << 12, // property is a lazy class structure - only used by static hashtables51 PropertyCallback = 1 << 13, // property that is a lazy property callback - only used by static hashtables52 49 BuiltinOrFunction = Builtin | Function, // helper only used by static hashtables 53 BuiltinOrFunctionOrLazyProperty = Builtin | Function | CellProperty | ClassStructure | PropertyCallback, // helper only used by static hashtables 54 BuiltinOrFunctionOrAccessorOrLazyProperty = Builtin | Function | Accessor | CellProperty | ClassStructure | PropertyCallback, // helper only used by static hashtables 55 BuiltinOrFunctionOrAccessorOrLazyPropertyOrConstant = Builtin | Function | Accessor | CellProperty | ClassStructure | PropertyCallback | ConstantInteger // helper only used by static hashtables 50 BuiltinOrFunctionOrAccessor = Builtin | Function | Accessor, // helper only used by static hashtables 51 BuiltinOrFunctionOrAccessorOrConstant = Builtin | Function | Accessor | ConstantInteger, // helper only used by static hashtables 56 52 }; 57 53 -
trunk/Source/JavaScriptCore/runtime/TypedArrayType.h
r200383 r200416 1 1 /* 2 * Copyright (C) 2013 , 2016Apple Inc. All rights reserved.2 * Copyright (C) 2013 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 34 34 struct ClassInfo; 35 35 36 #define FOR_EACH_TYPED_ARRAY_TYPE(macro) \37 macro(Int8) \38 macro(Uint8) \39 macro(Uint8Clamped) \40 macro(Int16) \41 macro(Uint16) \42 macro(Int32) \43 macro(Uint32) \44 macro(Float32) \45 macro(Float64) \46 macro(DataView)47 48 #define FOR_EACH_TYPED_ARRAY_TYPE_EXCLUDING_DATA_VIEW(macro) \49 macro(Int8) \50 macro(Uint8) \51 macro(Uint8Clamped) \52 macro(Int16) \53 macro(Uint16) \54 macro(Int32) \55 macro(Uint32) \56 macro(Float32) \57 macro(Float64)58 59 36 enum TypedArrayType { 60 37 NotTypedArray, 61 #define DECLARE_TYPED_ARRAY_TYPE(name) Type ## name, 62 FOR_EACH_TYPED_ARRAY_TYPE(DECLARE_TYPED_ARRAY_TYPE) 63 #undef DECLARE_TYPED_ARRAY_TYPE 38 TypeInt8, 39 TypeUint8, 40 TypeUint8Clamped, 41 TypeInt16, 42 TypeUint16, 43 TypeInt32, 44 TypeUint32, 45 TypeFloat32, 46 TypeFloat64, 47 TypeDataView 64 48 }; 65 49 -
trunk/Source/WTF/ChangeLog
r200383 r200416 1 2016-05-04 Chris Dumez <cdumez@apple.com> 2 3 Unreviewed, rolling out r200383 and r200406. 4 5 Seems to have caused crashes on iOS / ARMv7s 6 7 Reverted changesets: 8 9 "Speed up JSGlobalObject initialization by making some 10 properties lazy" 11 https://bugs.webkit.org/show_bug.cgi?id=157045 12 http://trac.webkit.org/changeset/200383 13 14 "REGRESSION(r200383): Setting lazily initialized properties 15 across frame boundaries crashes" 16 https://bugs.webkit.org/show_bug.cgi?id=157333 17 http://trac.webkit.org/changeset/200406 18 1 19 2016-05-03 Filip Pizlo <fpizlo@apple.com> 2 20 -
trunk/Source/WTF/wtf/StdLibExtras.h
r200383 r200416 1 1 /* 2 * Copyright (C) 2008 , 2016Apple Inc. All Rights Reserved.2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. 3 3 * Copyright (C) 2013 Patrick Gansterer <paroga@paroga.com> 4 4 * … … 30 30 #include <chrono> 31 31 #include <memory> 32 #include <string.h>33 32 #include <wtf/Assertions.h> 34 33 #include <wtf/CheckedArithmetic.h> … … 286 285 WTF_EXPORT_PRIVATE bool isCompilationThread(); 287 286 288 template<typename Func>289 bool isStatelessLambda()290 {291 return std::is_empty<Func>::value;292 }293 294 template<typename ResultType, typename Func, typename... ArgumentTypes>295 ResultType callStatelessLambda(ArgumentTypes&&... arguments)296 {297 uint64_t data[(sizeof(Func) + sizeof(uint64_t) - 1) / sizeof(uint64_t)];298 memset(data, 0, sizeof(data));299 return (*bitwise_cast<Func*>(data))(std::forward<ArgumentTypes>(arguments)...);300 }301 302 287 } // namespace WTF 303 288 … … 419 404 using WTF::bitwise_cast; 420 405 using WTF::safeCast; 421 using WTF::isStatelessLambda;422 using WTF::callStatelessLambda;423 406 424 407 #if COMPILER_SUPPORTS(CXX_USER_LITERALS) -
trunk/Source/WebCore/ChangeLog
r200415 r200416 1 2016-05-04 Chris Dumez <cdumez@apple.com> 2 3 Unreviewed, rolling out r200383 and r200406. 4 5 Seems to have caused crashes on iOS / ARMv7s 6 7 Reverted changesets: 8 9 "Speed up JSGlobalObject initialization by making some 10 properties lazy" 11 https://bugs.webkit.org/show_bug.cgi?id=157045 12 http://trac.webkit.org/changeset/200383 13 14 "REGRESSION(r200383): Setting lazily initialized properties 15 across frame boundaries crashes" 16 https://bugs.webkit.org/show_bug.cgi?id=157333 17 http://trac.webkit.org/changeset/200406 18 1 19 2016-05-04 Joanmarie Diggs <jdiggs@igalia.com> 2 20 -
trunk/Source/WebCore/bindings/js/JSHTMLElementCustom.cpp
r200383 r200416 1 1 /* 2 * Copyright (C) 2007 , 2016Apple Inc. All rights reserved.2 * Copyright (C) 2007 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 102 102 103 103 // The document is put on first, fall back to searching it only after the element and form. 104 // FIXME: This probably may use the wrong global object. If this is called from a native 105 // function, then it would be correct but not optimal since the native function would *know* 106 // the global object. But, it may be that globalObject() is more correct. 107 // https://bugs.webkit.org/show_bug.cgi?id=134932 108 VM& vm = exec->vm(); 109 JSGlobalObject* lexicalGlobalObject = exec->lexicalGlobalObject(); 110 111 scope = JSWithScope::create(vm, lexicalGlobalObject, asObject(toJS(exec, globalObject(), &element.document())), scope); 104 scope = JSWithScope::create(exec, asObject(toJS(exec, globalObject(), &element.document())), scope); 112 105 113 106 // The form is next, searched before the document, but after the element itself. 114 107 if (HTMLFormElement* form = element.form()) 115 scope = JSWithScope::create( vm, lexicalGlobalObject, asObject(toJS(exec, globalObject(), form)), scope);108 scope = JSWithScope::create(exec, asObject(toJS(exec, globalObject(), form)), scope); 116 109 117 110 // The element is on top, searched first. 118 return JSWithScope::create( vm, lexicalGlobalObject, asObject(toJS(exec, globalObject(), &element)), scope);111 return JSWithScope::create(exec, asObject(toJS(exec, globalObject(), &element)), scope); 119 112 } 120 113
Note: See TracChangeset
for help on using the changeset viewer.